From: LegendaryGuard Date: Sun, 16 Oct 2022 13:33:08 +0000 (+0200) Subject: Add server side bool cvars to handle nade balance for admin purposes X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f07f67a0af841e38a719a07d607d9555ac82471e;p=xonotic%2Fxonotic-data.pk3dir.git Add server side bool cvars to handle nade balance for admin purposes --- diff --git a/mutators.cfg b/mutators.cfg index 17e1570b36..f1e5106870 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -237,6 +237,7 @@ set g_nades_bonus_score_time -1 "Bonus nade score given per second (negative t set g_nades_bonus_score_time_flagcarrier 2 "Bonus nade score given per second as flag carrier (negative to have the score decay)" // Napalm (2) +set g_nades_napalm 0 "Napalm nade: spreads fire balls around the fountain and burns for a while" set g_nades_napalm_blast 1 "Whether the napalm grenades also give damage with the usual grenade explosion" set g_nades_napalm_burntime 0.5 "Time that the fire from napalm will stick to the player" set g_nades_napalm_selfdamage 1 "Whether the player that tossed the nade can be harmed by its fire" @@ -255,21 +256,25 @@ set g_nades_napalm_fountain_edgedamage 20 "Damage caused by the edge of the foun set g_nades_napalm_fountain_radius 130 "Distance from the fountain" // Ice (3) +set g_nades_ice 0 "Ice nade: freezes and reduces health" set g_nades_ice_freeze_time 3 "How long the ice field will last" set g_nades_ice_health 0 "How much health the player will have after being unfrozen" set g_nades_ice_explode 0 "Whether the ice nade should explode again once the ice field dissipated" set g_nades_ice_teamcheck 0 "Don't freeze teammates" // Spawn (5) +set g_nades_spawntype 0 "Spawn nade: respawns into nade explosion location after being fragged" set g_nades_spawn_count 3 "Number of times player will spawn at their spawn nade explosion location" // Heal (6) +set g_nades_heal 0 "Heal nade: spawns a orb to recover health inside, enemies take the reverse effect when being inside orb" set g_nades_heal_time 5 "How long the healing field will last" set g_nades_heal_rate 30 "Health given per second" set g_nades_heal_friend 1 "Multiplier of health given to team mates" set g_nades_heal_foe -2 "Multiplier of health given to enemies" // Tandem (7) +set g_nades_tandem 0 "Tandem nade: spawns items, monsters, vehicles and turrets into the explosion nade location" set g_nades_pokenade_monster_lifetime 150 "How long pokenade monster will survive" set g_nades_pokenade_turret_lifetime 150 "How long pokenade turret will take to be in the world" set g_nades_pokenade_vehicle_lifetime 150 "How long pokenade vehicle will take to be in the world" @@ -286,22 +291,26 @@ set g_nades_tandem_item_includespecial 0 "Include ammo, jetpack and powerups" set g_nades_tandem_randomweapon_includespecial 0 "Include special and super weapons" // Entrap (8) +set g_nades_entrap 0 "Entrap nade: spawns a orb to slow down movements inside" set g_nades_entrap_strength 0.01 "Strength of the orb's movement slowing powers" set g_nades_entrap_speed 0.5 "Running speed while entrapped" set g_nades_entrap_time 10 "Life time of the orb" set g_nades_entrap_radius 500 "Distance from the entrap orb" // Veil (9) +set g_nades_veil 0 "Veil nade: spawns a orb to turn invisible inside" set g_nades_veil_time 8 "Life time of the orb" set g_nades_veil_radius 200 "Distance from the veil orb" // Ammo (10) +set g_nades_ammo 0 "Ammo nade: spawns a orb to recover ammo inside, enemies take the reverse effect when being inside orb" set g_nades_ammo_time 4 "Life time of the orb" set g_nades_ammo_rate 30 "Ammo given per second" set g_nades_ammo_friend 1 "Multiplier of ammo given to team mates" set g_nades_ammo_foe -2 "Multiplier of ammo given to enemies" // Darkness (11) +set g_nades_dark 0 "Darkness nade: spawns a orb to blind enemies inside" set g_nades_dark_damage 25 "How much damage dark orb can do when foes are entering inside" set g_nades_dark_time 13 "Life time of the orb" set g_nades_dark_radius 700 "Distance from the dark orb" diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index ce18c8b0c4..9620fb750b 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1233,6 +1233,13 @@ void nade_dark_boom(entity this) //CSQCProjectile(fountain, true, PROJECTILE_NADE_DARK_BURN, true); } +void normal_nade_boom(entity this) +{ + RadiusDamage(this, this.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, + autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, DMG_NOWEP, this.enemy); + Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this); +} + void nade_boom(entity this) { entity expef = NULL; @@ -1244,13 +1251,16 @@ void nade_boom(entity this) nade_blast = autocvar_g_nades_napalm_blast; expef = EFFECT_EXPLOSION_MEDIUM; break; + case NADE_TYPE_ICE: nade_blast = false; expef = EFFECT_ELECTRO_COMBO; // hookbomb_explode electro_combo bigplasma_impact break; + case NADE_TYPE_TRANSLOCATE: nade_blast = false; break; + case NADE_TYPE_TANDEM: if(!autocvar_g_monsters) { @@ -1267,6 +1277,7 @@ void nade_boom(entity this) expef = EFFECT_NADE_EXPLODE(this.realowner.team); break; // fall back to a standard nade explosion } + case NADE_TYPE_SPAWN: nade_blast = false; switch(this.realowner.team) @@ -1278,6 +1289,7 @@ void nade_boom(entity this) default: expef = EFFECT_SPAWN_NEUTRAL; break; } break; + case NADE_TYPE_HEAL: nade_blast = false; expef = EFFECT_SPAWN_RED; @@ -1318,25 +1330,61 @@ void nade_boom(entity this) this.event_damage = func_null; // prevent somehow calling damage in the next call if(nade_blast) - { - RadiusDamage(this, this.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, - autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, DMG_NOWEP, this.enemy); - Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this); - } + normal_nade_boom(this); if(this.takedamage) switch ( REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this)) ) { - case NADE_TYPE_NAPALM: nade_napalm_boom(this); break; - case NADE_TYPE_ICE: nade_ice_boom(this); break; - case NADE_TYPE_TRANSLOCATE: nade_translocate_boom(this); break; - case NADE_TYPE_SPAWN: nade_spawn_boom(this); break; - case NADE_TYPE_HEAL: nade_heal_boom(this); break; - case NADE_TYPE_TANDEM: nade_tandem_boom(this); break; - case NADE_TYPE_ENTRAP: nade_entrap_boom(this); break; - case NADE_TYPE_VEIL: nade_veil_boom(this); break; - case NADE_TYPE_AMMO: nade_ammo_boom(this); break; - case NADE_TYPE_DARK: nade_dark_boom(this); break; + case NADE_TYPE_NAPALM: + { + nade_napalm_boom(this); + break; + } + case NADE_TYPE_ICE: + { + nade_ice_boom(this); + break; + } + case NADE_TYPE_TRANSLOCATE: + { + nade_translocate_boom(this); + break; + } + case NADE_TYPE_SPAWN: + { + nade_spawn_boom(this); + break; + } + case NADE_TYPE_HEAL: + { + nade_heal_boom(this); + break; + } + case NADE_TYPE_TANDEM: + { + nade_tandem_boom(this); + break; + } + case NADE_TYPE_ENTRAP: + { + nade_entrap_boom(this); + break; + } + case NADE_TYPE_VEIL: + { + nade_veil_boom(this); + break; + } + case NADE_TYPE_AMMO: + { + nade_ammo_boom(this); + break; + } + case NADE_TYPE_DARK: + { + nade_dark_boom(this); + break; + } } IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this, @@ -1768,6 +1816,25 @@ void nades_Clear(entity player) STAT(NADE_TIMER, player) = 0; } +void nades_CheckTypes(entity player) +{ + int cl_ntype = CS_CVAR(player).cvar_cl_nade_type; + switch (cl_ntype) + { + case 2: if (!autocvar_g_nades_napalm) cl_ntype = 1; break; + case 3: if (!autocvar_g_nades_ice) cl_ntype = 1; break; + case 4: if (!autocvar_g_nades_translocate) cl_ntype = 1; break; + case 5: if (!autocvar_g_nades_spawntype) cl_ntype = 1; break; + case 6: if (!autocvar_g_nades_heal) cl_ntype = 1; break; + case 7: if (!autocvar_g_nades_tandem) cl_ntype = 1; break; + case 8: if (!autocvar_g_nades_entrap) cl_ntype = 1; break; + case 9: if (!autocvar_g_nades_veil) cl_ntype = 1; break; + case 10: if (!autocvar_g_nades_ammo) cl_ntype = 1; break; + case 11: if (!autocvar_g_nades_dark) cl_ntype = 1; break; + } + STAT(NADE_BONUS_TYPE, player) = cl_ntype; +} + MUTATOR_HOOKFUNCTION(nades, VehicleEnter) { entity player = M_ARGV(0, entity); @@ -1875,7 +1942,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) if(autocvar_g_nades_bonus_client_select) { - STAT(NADE_BONUS_TYPE, player) = CS_CVAR(player).cvar_cl_nade_type; + nades_CheckTypes(player); player.pokenade_type = CS_CVAR(player).cvar_cl_pokenade_type; player.tandemnade_type = CS_CVAR(player).cvar_cl_tandemnade_type; } diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index 85aa8f6ef2..157a93957b 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -21,6 +21,7 @@ float autocvar_g_nades_nade_edgedamage; float autocvar_g_nades_nade_radius; float autocvar_g_nades_nade_force; int autocvar_g_nades_nade_newton_style; +bool autocvar_g_nades_napalm; int autocvar_g_nades_napalm_ball_count; float autocvar_g_nades_napalm_ball_spread; float autocvar_g_nades_napalm_ball_damage; @@ -50,20 +51,27 @@ int autocvar_g_nades_bonus_score_low; int autocvar_g_nades_bonus_score_high; int autocvar_g_nades_bonus_score_medium; int autocvar_g_nades_bonus_score_spree; +bool autocvar_g_nades_ice; float autocvar_g_nades_ice_freeze_time; float autocvar_g_nades_ice_health; bool autocvar_g_nades_ice_explode; bool autocvar_g_nades_ice_teamcheck; +bool autocvar_g_nades_translocate; +bool autocvar_g_nades_spawntype; +bool autocvar_g_nades_heal; float autocvar_g_nades_heal_time; float autocvar_g_nades_heal_rate; float autocvar_g_nades_heal_friend; float autocvar_g_nades_heal_foe; +bool autocvar_g_nades_entrap; float autocvar_g_nades_entrap_strength = 0.01; float autocvar_g_nades_entrap_speed = 0.5; float autocvar_g_nades_entrap_radius = 500; float autocvar_g_nades_entrap_time = 10; +bool autocvar_g_nades_veil; float autocvar_g_nades_veil_time = 8; float autocvar_g_nades_veil_radius = 300; +bool autocvar_g_nades_tandem; float autocvar_g_nades_tandem_item_lifetime; bool autocvar_g_nades_tandem_includespecial; bool autocvar_g_nades_tandem_randomweapon_includespecial = false; @@ -73,10 +81,12 @@ float autocvar_g_nades_tandem_ball_spread; float autocvar_g_nades_tandem_ball_lifetime = 1; float autocvar_g_nades_tandem_fountain_delay = 5; float autocvar_g_nades_tandem_fountain_lifetime; +bool autocvar_g_nades_ammo; float autocvar_g_nades_ammo_time; float autocvar_g_nades_ammo_rate; float autocvar_g_nades_ammo_friend; float autocvar_g_nades_ammo_foe; +bool autocvar_g_nades_dark; float autocvar_g_nades_dark_damage; float autocvar_g_nades_dark_time; float autocvar_g_nades_dark_radius;