From: Mario Date: Thu, 1 Aug 2024 05:09:59 +0000 (+1000) Subject: Make jetpacks respect g_powerups and add settings to disable them individually X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cd4e314819583b55d4ee793d0f056fc5dcc2a9e9;p=xonotic%2Fxonotic-data.pk3dir.git Make jetpacks respect g_powerups and add settings to disable them individually --- diff --git a/mutators.cfg b/mutators.cfg index 0851dc4f7..bed614445 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -49,6 +49,7 @@ set g_instagib_blaster_keepdamage 0 "allow secondary fire to hurt players" set g_instagib_blaster_keepforce 0 "allow secondary fire to push players" set g_instagib_mirrordamage 0 "allow damage mirror instagib" set g_instagib_friendlypush 1 "allow pushing teammates with the vaporizer primary attack" +set g_instagib_allow_jetpacks 0 "allow jetpacks and fuel regenerators to appear in maps" // ========== diff --git a/qcsrc/common/items/item/jetpack.qh b/qcsrc/common/items/item/jetpack.qh index 0ece1bf32..ca52f5466 100644 --- a/qcsrc/common/items/item/jetpack.qh +++ b/qcsrc/common/items/item/jetpack.qh @@ -16,9 +16,13 @@ MODEL(Jetpack_ITEM, Item_Model("g_jetpack.md3")); #endif #ifdef SVQC +bool autocvar_g_powerups_jetpack = true; PROPERTY(int, g_pickup_fuel_jetpack); -void powerup_jetpack_init(Pickup this, entity item) +void powerup_jetpack_init(Pickup def, entity item) { + if(!autocvar_g_powerups || !autocvar_g_powerups_jetpack) + def.spawnflags |= ITEM_FLAG_MUTATORBLOCKED; + if(!GetResource(item, RES_FUEL)) SetResourceExplicit(item, RES_FUEL, g_pickup_fuel_jetpack); } @@ -83,13 +87,22 @@ SPAWNFUNC_ITEM(item_fuel, ITEM_JetpackFuel) MODEL(JetpackRegen_ITEM, Item_Model("g_fuelregen.md3")); #endif +#ifdef SVQC +bool autocvar_g_powerups_fuelregen = true; +void powerup_fuelregen_init(Pickup def, entity item) +{ + if(!autocvar_g_powerups || !autocvar_g_powerups_fuelregen) + def.spawnflags |= ITEM_FLAG_MUTATORBLOCKED; +} +#endif + CLASS(JetpackRegen, Powerup) ENDCLASS(JetpackRegen) REGISTER_ITEM(JetpackRegen, JetpackRegen) { this.m_canonical_spawnfunc = "item_fuel_regen"; #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; + this.spawnflags = ITEM_FLAG_NORMAL; this.m_model = MDL_JetpackRegen_ITEM; #endif this.netname = "fuel_regen"; @@ -102,6 +115,7 @@ REGISTER_ITEM(JetpackRegen, JetpackRegen) { this.m_botvalue = 3000; this.m_itemid = IT_FUEL_REGEN; this.m_pickupevalfunc = ammo_pickupevalfunc; + this.m_iteminit = powerup_fuelregen_init; #endif } diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 028dc7e32..9f10236e4 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -16,6 +16,7 @@ bool autocvar_g_instagib_ammo_convert_cells; bool autocvar_g_instagib_ammo_convert_rockets; bool autocvar_g_instagib_ammo_convert_shells; bool autocvar_g_instagib_ammo_convert_bullets; +bool autocvar_g_instagib_allow_jetpacks; /// \brief Returns a random classname of the instagib item. /// \param[in] prefix Prefix of the cvars that hold probabilities. @@ -344,6 +345,9 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem) if(autocvar_g_instagib_ammo_convert_bullets) instagib_replace_item_with(item, ITEM_VaporizerCells); return true; + case ITEM_Jetpack: + case ITEM_JetpackRegen: + return !autocvar_g_instagib_allow_jetpacks; } switch (item.weapon) diff --git a/xonotic-server.cfg b/xonotic-server.cfg index d7304eca0..cd109e608 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -207,6 +207,8 @@ set g_powerups_strength 1 "allow strength powerups to spawn" set g_powerups_shield 1 "allow shield powerups to spawn" set g_powerups_speed 1 "allow speed powerups to spawn" set g_powerups_invisibility 1 "allow invisibility powerups to spawn" +set g_powerups_jetpack 1 "allow jetpacks to spawn" +set g_powerups_fuelregen 1 "allow fuel regenerators to spawn" set g_use_ammunition 1 "if set to 0 all weapons have unlimited ammo" set g_pickup_items -1 "if set to 0 all items (health, armor, ammo, weapons...) are removed from the map, if 1 they are forced to spawn" set g_pickup_respawntime_scaling_reciprocal 0 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `reciprocal` (with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player*"