X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fportals.qc;h=162026a169e98843d259e2717228984fb06905b8;hb=3514dfab68ace0fd00b3df1993b8773868b1a6a3;hp=b41c53bbcce4eed3dcd541f25fd738ebfb750fae;hpb=bc6fe08d1d10d513d52efb1ab57a27d6086b8397;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index b41c53bbc..162026a16 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; } @@ -198,8 +199,8 @@ 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; + SetResourceAmountExplicit(teleporter, RESOURCE_HEALTH, autocvar_g_balance_portal_health); + SetResourceAmountExplicit(teleporter.enemy, RESOURCE_HEALTH, autocvar_g_balance_portal_health); return 1; } @@ -208,14 +209,14 @@ float Portal_FindSafeOrigin(entity portal) { vector o; o = portal.origin; - portal.mins = STAT(PL_MIN, NULL) - SAFERNUDGE; - portal.maxs = STAT(PL_MAX, NULL) + SAFERNUDGE; + portal.mins = PL_MIN_CONST - SAFERNUDGE; + portal.maxs = PL_MAX_CONST + SAFERNUDGE; fixedmakevectors(portal.mangle); portal.origin += 16 * v_forward; 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; @@ -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, RESOURCE_HEALTH, damage); + if(GetResourceAmount(this, RESOURCE_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 @@ -487,7 +487,7 @@ void Portal_Think(entity this) if(it.(weaponentity).hook) Portal_Think_TryTeleportPlayer(this, it.(weaponentity).hook, g); } - )); + }); this.solid = SOLID_TRIGGER; this.aiment = o; #endif @@ -639,7 +639,7 @@ entity Portal_Spawn(entity own, vector org, vector ang) 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; + SetResourceAmountExplicit(portal, RESOURCE_HEALTH, autocvar_g_balance_portal_health); setmodel(portal, MDL_PORTAL); portal.savemodelindex = portal.modelindex; setcefc(portal, Portal_Customize);