X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fportals.qc;h=6f128716365933599e271f4294ef295a779ef8b8;hb=e3b57e7c812da74f0aed7c8b1b50d6760a51b357;hp=6de3e0af39fc0e16840ae692f4b13548ca83b755;hpb=2183056a5b6e75d2e025aa6c718eeb6f87de31b6;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 6de3e0af3..6f1287163 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -6,8 +6,8 @@ #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" @@ -149,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; } @@ -157,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,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; } @@ -216,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; } @@ -323,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; @@ -384,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; @@ -429,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); } @@ -495,7 +494,7 @@ void Portal_Think(entity this) this.nextthink = time; - if(time > this.fade_time) + if(this.fade_time && time > this.fade_time) Portal_Remove(this, 0); } @@ -639,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);