From: Mario Date: Sat, 17 Feb 2018 12:07:26 +0000 (+0000) Subject: Merge branch 't0uYK8Ne/target_init' into 'master' X-Git-Tag: xonotic-v0.8.5~2300 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=0f1ffe9c0565f1f1a0d6f58240760f227aa3ee99;hp=5b64078700e8dfa9377726f100ea9739486173a2 Merge branch 't0uYK8Ne/target_init' into 'master' Improve target_init support. See merge request xonotic/xonotic-data.pk3dir!517 --- diff --git a/qcsrc/server/compat/quake3.qc b/qcsrc/server/compat/quake3.qc index 6a7f21aa67..8eb8273888 100644 --- a/qcsrc/server/compat/quake3.qc +++ b/qcsrc/server/compat/quake3.qc @@ -3,6 +3,7 @@ #include #include #include +#include #include spawnfunc(target_items); @@ -82,11 +83,55 @@ void target_init_verify(entity this) } } +void target_init_use(entity this, entity actor, entity trigger) +{ + if (!(this.spawnflags & 1)) + { + SetResourceAmount(actor, RESOURCE_ARMOR, start_armorvalue); + actor.pauserotarmor_finished = time + autocvar_g_balance_pause_armor_rot; + } + + if (!(this.spawnflags & 2)) + { + SetResourceAmount(actor, RESOURCE_HEALTH, start_health); + actor.pauserothealth_finished = time + autocvar_g_balance_pause_health_rot; + actor.pauseregen_finished = time + autocvar_g_balance_pause_health_regen; + } + + if (!(this.spawnflags & 4)) + { + SetResourceAmount(actor, RESOURCE_SHELLS, start_ammo_shells); + SetResourceAmount(actor, RESOURCE_BULLETS, start_ammo_nails); + SetResourceAmount(actor, RESOURCE_ROCKETS, start_ammo_rockets); + SetResourceAmount(actor, RESOURCE_CELLS, start_ammo_cells); + SetResourceAmount(actor, RESOURCE_PLASMA, start_ammo_plasma); + SetResourceAmount(actor, RESOURCE_FUEL, start_ammo_fuel); + + actor.weapons = start_weapons; + if (this.spawnflags & 32) + { + // TODO + } + } + + if (!(this.spawnflags & 8)) + { + actor.strength_finished = 0; + actor.invincible_finished = 0; + actor.buffs = 0; + } + + if (!(this.spawnflags & 16)) + { + // We don't have holdables. + } + + SUB_UseTargets(this, actor, trigger); +} + spawnfunc(target_init) { - this.spawnflags = 0; // remove all weapons except the ones listed below - this.netname = "shotgun"; // keep these weapons through the remove trigger - spawnfunc_target_items(this); + this.use = target_init_use; InitializeEntity(this, target_init_verify, INITPRIO_FINDTARGET); }