X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fportals.qc;h=6f128716365933599e271f4294ef295a779ef8b8;hp=1656b1400e171b5ed696ed726f8353787d5adaf8;hb=e0012447bfce1b551df3dc01b043655aa93dafad;hpb=228743a67588c5488f678a9d0ead45bf8a50b6c2 diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 1656b1400..6f1287163 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -1,12 +1,13 @@ #include "portals.qh" +#include #include "g_hook.qh" #include "mutators/_mod.qh" #include "../common/constants.qh" #include "../common/deathtypes/all.qh" #include "../common/notifications/all.qh" -#include "../common/triggers/teleporters.qh" -#include "../common/triggers/subs.qh" +#include "../common/mapobjects/teleporters.qh" +#include "../common/mapobjects/subs.qh" #include "../common/util.qh" #include #include "../lib/csqcmodel/sv_model.qh" @@ -148,7 +149,7 @@ float Portal_TeleportPlayer(entity teleporter, entity player) tracebox(safe, player.mins - SAFENUDGE, player.maxs + SAFENUDGE, step, MOVE_NOMONSTERS, player); if(trace_startsolid) { - LOG_INFO("'safe' teleport location is not safe!\n"); + LOG_INFO("'safe' teleport location is not safe!"); // FAIL TODO why does this happen? return 0; } @@ -156,7 +157,7 @@ float Portal_TeleportPlayer(entity teleporter, entity player) tracebox(safe, player.mins - SAFENUDGE, player.maxs + SAFENUDGE, to, MOVE_NOMONSTERS, player); if(trace_startsolid) { - LOG_INFO("trace_endpos in solid, this can't be!\n"); + LOG_INFO("trace_endpos in solid, this can't be!"); // FAIL TODO why does this happen? (reported by MrBougo) return 0; } @@ -197,9 +198,9 @@ float Portal_TeleportPlayer(entity teleporter, entity player) // reset fade counter teleporter.portal_wants_to_vanish = 0; - teleporter.fade_time = time + autocvar_g_balance_portal_lifetime; - teleporter.health = autocvar_g_balance_portal_health; - teleporter.enemy.health = autocvar_g_balance_portal_health; + teleporter.fade_time = ((autocvar_g_balance_portal_lifetime >= 0) ? time + autocvar_g_balance_portal_lifetime : 0); + SetResourceExplicit(teleporter, RES_HEALTH, autocvar_g_balance_portal_health); + SetResourceExplicit(teleporter.enemy, RES_HEALTH, autocvar_g_balance_portal_health); return 1; } @@ -215,7 +216,7 @@ float Portal_FindSafeOrigin(entity portal) if(!move_out_of_solid(portal)) { #ifdef DEBUG - LOG_INFO("NO SAFE ORIGIN\n"); + LOG_INFO("NO SAFE ORIGIN"); #endif return 0; } @@ -322,7 +323,6 @@ void Portal_Touch(entity this, entity toucher) toucher.effects += EF_BLUE - EF_RED; } -void Portal_Think(entity this); void Portal_MakeBrokenPortal(entity portal) { portal.skin = 2; @@ -383,7 +383,7 @@ void Portal_Connect(entity teleporter, entity destination) destination.enemy = teleporter; Portal_MakeInPortal(teleporter); Portal_MakeOutPortal(destination); - teleporter.fade_time = time + autocvar_g_balance_portal_lifetime; + teleporter.fade_time = ((autocvar_g_balance_portal_lifetime >= 0) ? time + autocvar_g_balance_portal_lifetime : 0); destination.fade_time = teleporter.fade_time; teleporter.portal_wants_to_vanish = 0; destination.portal_wants_to_vanish = 0; @@ -428,15 +428,15 @@ void Portal_Remove(entity portal, float killed) } } -void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(deathtype == DEATH_TELEFRAG.m_id) return; if(attacker != this.aiment) if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(this.aiment)) return; - this.health -= damage; - if(this.health < 0) + TakeResource(this, RES_HEALTH, damage); + if(GetResource(this, RES_HEALTH) < 0) Portal_Remove(this, 1); } @@ -473,7 +473,7 @@ void Portal_Think(entity this) fixedmakevectors(this.mangle); - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { if(it != o) if(IS_INDEPENDENT_PLAYER(it) || IS_INDEPENDENT_PLAYER(o)) continue; // cannot go through someone else's portal @@ -481,16 +481,20 @@ void Portal_Think(entity this) if(it != o || time >= this.portal_activatetime) Portal_Think_TryTeleportPlayer(this, it, g); - if(it.hook) - Portal_Think_TryTeleportPlayer(this, it.hook, g); - )); + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if(it.(weaponentity).hook) + Portal_Think_TryTeleportPlayer(this, it.(weaponentity).hook, g); + } + }); this.solid = SOLID_TRIGGER; this.aiment = o; #endif this.nextthink = time; - if(time > this.fade_time) + if(this.fade_time && time > this.fade_time) Portal_Remove(this, 0); } @@ -634,8 +638,8 @@ entity Portal_Spawn(entity own, vector org, vector ang) portal.portal_activatetime = time + 0.1; portal.takedamage = DAMAGE_AIM; portal.event_damage = Portal_Damage; - portal.fade_time = time + autocvar_g_balance_portal_lifetime; - portal.health = autocvar_g_balance_portal_health; + portal.fade_time = ((autocvar_g_balance_portal_lifetime >= 0) ? time + autocvar_g_balance_portal_lifetime : 0); + SetResourceExplicit(portal, RES_HEALTH, autocvar_g_balance_portal_health); setmodel(portal, MDL_PORTAL); portal.savemodelindex = portal.modelindex; setcefc(portal, Portal_Customize);