From: terencehill Date: Sun, 28 Jul 2019 22:16:29 +0000 (+0200) Subject: Don't spawn by default some useless entities of game modes and mutators X-Git-Tag: xonotic-v0.8.5~507^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4413eca79f9b2e29481b37ba3df488239e8ae938;p=xonotic%2Fxonotic-data.pk3dir.git Don't spawn by default some useless entities of game modes and mutators --- diff --git a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc index 835073d07..a9de7fbc7 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc @@ -3,16 +3,6 @@ .entity sprite; #define AS_ROUND_DELAY 5 -IntrusiveList g_assault_destructibles; -IntrusiveList g_assault_objectivedecreasers; -IntrusiveList g_assault_objectives; -STATIC_INIT(g_assault) -{ - g_assault_destructibles = IL_NEW(); - g_assault_objectivedecreasers = IL_NEW(); - g_assault_objectives = IL_NEW(); -} - // random functions void assault_objective_use(entity this, entity actor, entity trigger) { diff --git a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh index fcfc78917..3709bdff9 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh @@ -7,11 +7,18 @@ const int ASSAULT_VALUE_INACTIVE = 1000; const int ST_ASSAULT_OBJECTIVES = 1; +IntrusiveList g_assault_destructibles; +IntrusiveList g_assault_objectivedecreasers; +IntrusiveList g_assault_objectives; + REGISTER_MUTATOR(as, false) { MUTATOR_STATIC(); MUTATOR_ONADD { + g_assault_destructibles = IL_NEW(); + g_assault_objectivedecreasers = IL_NEW(); + g_assault_objectives = IL_NEW(); GameRules_teams(true); int teams = BITS(2); // always red vs blue GameRules_scoring(teams, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, { diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh index b1518bd4f..492da41b1 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh @@ -2,6 +2,11 @@ #include "ctf.qh" +CLASS(Flag, Pickup) + ATTRIB(Flag, m_mins, vector, (PL_MIN_CONST + '0 0 -13') * 1.4); // scaling be damned + ATTRIB(Flag, m_maxs, vector, (PL_MAX_CONST + '0 0 -13') * 1.4); +ENDCLASS(Flag) +Flag CTF_FLAG; void ctf_Initialize(); REGISTER_MUTATOR(ctf, false) @@ -9,6 +14,7 @@ REGISTER_MUTATOR(ctf, false) MUTATOR_STATIC(); MUTATOR_ONADD { + CTF_FLAG = NEW(Flag); GameRules_teams(true); GameRules_limit_score(autocvar_capturelimit_override); GameRules_limit_lead(autocvar_captureleadlimit_override); @@ -24,12 +30,6 @@ void ctf_RespawnFlag(entity flag); // score rule declarations const int ST_CTF_CAPS = 1; -CLASS(Flag, Pickup) - ATTRIB(Flag, m_mins, vector, (PL_MIN_CONST + '0 0 -13') * 1.4); // scaling be damned - ATTRIB(Flag, m_maxs, vector, (PL_MAX_CONST + '0 0 -13') * 1.4); -ENDCLASS(Flag) -Flag CTF_FLAG; -STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); } void ctf_FlagTouch(entity this, entity toucher) { ITEM_HANDLE(Pickup, CTF_FLAG, this, toucher); } // flag constants // for most of these, there is just one question to be asked: WHYYYYY? diff --git a/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh b/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh index 67e00082c..e937a958e 100644 --- a/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh +++ b/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh @@ -6,6 +6,7 @@ bool autocvar_g_domination_roundbased; int autocvar_g_domination_roundbased_point_limit; int autocvar_g_domination_point_leadlimit; +IntrusiveList g_dompoints; void dom_Initialize(); REGISTER_MUTATOR(dom, false) @@ -13,6 +14,8 @@ REGISTER_MUTATOR(dom, false) MUTATOR_STATIC(); MUTATOR_ONADD { + g_dompoints = IL_NEW(); + int fraglimit_override = autocvar_g_domination_point_limit; if (autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit) fraglimit_override = autocvar_g_domination_roundbased_point_limit; @@ -47,6 +50,3 @@ float domination_roundbased; float domination_teams; void AnimateDomPoint(entity this); - -IntrusiveList g_dompoints; -STATIC_INIT(g_dompoints) { g_dompoints = IL_NEW(); } diff --git a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc index 31c571142..bb1c9aee9 100644 --- a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc +++ b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc @@ -6,16 +6,6 @@ #include -IntrusiveList g_invasion_roundends; -IntrusiveList g_invasion_waves; -IntrusiveList g_invasion_spawns; -STATIC_INIT(g_invasion) -{ - g_invasion_roundends = IL_NEW(); - g_invasion_waves = IL_NEW(); - g_invasion_spawns = IL_NEW(); -} - float autocvar_g_invasion_round_timelimit; float autocvar_g_invasion_spawnpoint_spawn_delay; float autocvar_g_invasion_warmup; diff --git a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh index 167380eeb..3c16e34e1 100644 --- a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh +++ b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh @@ -6,6 +6,9 @@ int autocvar_g_invasion_teams; int autocvar_g_invasion_type; bool autocvar_g_invasion_team_spawns; bool g_invasion; +IntrusiveList g_invasion_roundends; +IntrusiveList g_invasion_waves; +IntrusiveList g_invasion_spawns; void invasion_Initialize(); REGISTER_MUTATOR(inv, false) @@ -13,6 +16,9 @@ REGISTER_MUTATOR(inv, false) MUTATOR_STATIC(); MUTATOR_ONADD { + g_invasion_roundends = IL_NEW(); + g_invasion_waves = IL_NEW(); + g_invasion_spawns = IL_NEW(); if (autocvar_g_invasion_teams >= 2) { GameRules_teams(true); GameRules_spawning_teams(autocvar_g_invasion_team_spawns); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh index add678d7b..4ee453400 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh @@ -5,11 +5,6 @@ REGISTER_NET_LINKED(ENT_CLIENT_GENERATOR) REGISTER_NET_LINKED(ENT_CLIENT_CONTROLPOINT_ICON) #endif -#ifdef SVQC -IntrusiveList g_onsshields; -STATIC_INIT(g_onsshields) { g_onsshields = IL_NEW(); } -#endif - #ifdef CSQC IntrusiveList g_onsgenerators; STATIC_INIT(g_onsgenerators) { g_onsgenerators = IL_NEW(); } diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh index 7a9b192a5..52eec4abc 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh @@ -1,6 +1,7 @@ #pragma once float autocvar_g_onslaught_point_limit; +IntrusiveList g_onsshields; void ons_Initialize(); REGISTER_MUTATOR(ons, false) @@ -8,6 +9,7 @@ REGISTER_MUTATOR(ons, false) MUTATOR_STATIC(); MUTATOR_ONADD { + g_onsshields = IL_NEW(); GameRules_teams(true); GameRules_limit_score(autocvar_g_onslaught_point_limit); diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 63f3182ea..a9eac2423 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -17,16 +17,6 @@ bool autocvar_g_instagib_ammo_convert_bullets; int autocvar_g_instagib_extralives; float autocvar_g_instagib_speed_highspeed; -IntrusiveList g_instagib_items; -STATIC_INIT(instagib) -{ - g_instagib_items = IL_NEW(); - IL_PUSH(g_instagib_items, ITEM_VaporizerCells); - IL_PUSH(g_instagib_items, ITEM_ExtraLife); - IL_PUSH(g_instagib_items, ITEM_Invisibility); - IL_PUSH(g_instagib_items, ITEM_Speed); -} - void instagib_invisibility(entity this) { this.strength_finished = autocvar_g_instagib_invisibility_time; diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh index 56f4ac7da..d01abd080 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh @@ -7,11 +7,18 @@ float autocvar_g_instagib_invis_alpha; void instagib_invisibility(entity this); void instagib_extralife(entity this); void instagib_speed(entity this); +IntrusiveList g_instagib_items; REGISTER_MUTATOR(mutator_instagib, autocvar_g_instagib && !g_nexball) { MUTATOR_ONADD { + g_instagib_items = IL_NEW(); + IL_PUSH(g_instagib_items, ITEM_VaporizerCells); + IL_PUSH(g_instagib_items, ITEM_ExtraLife); + IL_PUSH(g_instagib_items, ITEM_Invisibility); + IL_PUSH(g_instagib_items, ITEM_Speed); + ITEM_VaporizerCells.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED; ITEM_Invisibility.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED; ITEM_Speed.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index c6a853d0e..6418f2a01 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -159,8 +159,6 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan #include #include -REGISTER_MUTATOR(nades, autocvar_g_nades); - .float nade_time_primed; .float nade_lifetime; @@ -1251,7 +1249,14 @@ CLASS(NadeOffhand, OffhandWeapon) } ENDCLASS(NadeOffhand) NadeOffhand OFFHAND_NADE; -STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOffhand); } +REGISTER_MUTATOR(nades, autocvar_g_nades) +{ + MUTATOR_ONADD + { + OFFHAND_NADE = NEW(NadeOffhand); + } + return 0; +} MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST) { diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index 41ba2da62..993afcdd4 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -10,17 +10,6 @@ bool autocvar_g_overkill_itemwaypoints = true; .Weapon ok_lastwep[MAX_WEAPONSLOTS]; -IntrusiveList g_overkill_items; -STATIC_INIT(overkill) -{ - g_overkill_items = IL_NEW(); - IL_PUSH(g_overkill_items, ITEM_HealthMega); - IL_PUSH(g_overkill_items, ITEM_ArmorSmall); - IL_PUSH(g_overkill_items, ITEM_ArmorMedium); - IL_PUSH(g_overkill_items, ITEM_ArmorBig); - IL_PUSH(g_overkill_items, ITEM_ArmorMega); -} - /// \brief Returns a random classname of the overkill item. /// \param[in] prefix Prefix of the cvars that hold probabilities. /// \return Random classname of the overkill item. diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh index 79e5dd3c5..9ee809df6 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh @@ -7,6 +7,7 @@ bool autocvar_g_overkill_filter_armorbig; bool autocvar_g_overkill_filter_armormega; .float ok_item; +IntrusiveList g_overkill_items; REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !MUTATOR_IS_ENABLED(mutator_instagib) && !g_nexball && cvar_string("g_mod_balance") == "Overkill") { @@ -30,6 +31,12 @@ REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !MUTATOR_IS_ENABLED(m { ITEM_ArmorMega.spawnflags |= ITEM_FLAG_MUTATORBLOCKED; } + g_overkill_items = IL_NEW(); + IL_PUSH(g_overkill_items, ITEM_HealthMega); + IL_PUSH(g_overkill_items, ITEM_ArmorSmall); + IL_PUSH(g_overkill_items, ITEM_ArmorMedium); + IL_PUSH(g_overkill_items, ITEM_ArmorBig); + IL_PUSH(g_overkill_items, ITEM_ArmorMega); } MUTATOR_ONREMOVE diff --git a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc index 9458189fd..35f58e89a 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc +++ b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc @@ -16,6 +16,7 @@ float autocvar_g_sandbox_object_scale_max; float autocvar_g_sandbox_object_material_velocity_min; float autocvar_g_sandbox_object_material_velocity_factor; +IntrusiveList g_sandbox_objects; float autosave_time; void sandbox_Database_Load(); @@ -23,6 +24,7 @@ REGISTER_MUTATOR(sandbox, expr_evaluate(autocvar_g_sandbox)) { MUTATOR_ONADD { + g_sandbox_objects = IL_NEW(); autosave_time = time + autocvar_g_sandbox_storage_autosave; // don't save the first server frame if(autocvar_g_sandbox_storage_autoload) sandbox_Database_Load(); diff --git a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh index f6a0afdf4..6f70f09be 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh +++ b/qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qh @@ -1,4 +1 @@ #pragma once - -IntrusiveList g_sandbox_objects; -STATIC_INIT(g_sandbox_objects) { g_sandbox_objects = IL_NEW(); }