X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fportals.qc;h=6f128716365933599e271f4294ef295a779ef8b8;hb=eb96ca5663dfd89df89396421ef633c409626e9d;hp=162026a169e98843d259e2717228984fb06905b8;hpb=6c27fe90b0454df3dbf7b098bc554fcb5eaa75d0;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 162026a16..6f1287163 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -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; - SetResourceAmountExplicit(teleporter, RESOURCE_HEALTH, autocvar_g_balance_portal_health); - SetResourceAmountExplicit(teleporter.enemy, RESOURCE_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; } @@ -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; @@ -435,8 +435,8 @@ void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, if(attacker != this.aiment) if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(this.aiment)) return; - TakeResource(this, RESOURCE_HEALTH, damage); - if(GetResourceAmount(this, RESOURCE_HEALTH) < 0) + TakeResource(this, RES_HEALTH, damage); + if(GetResource(this, RES_HEALTH) < 0) Portal_Remove(this, 1); } @@ -494,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); } @@ -638,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; - SetResourceAmountExplicit(portal, RESOURCE_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);