From: LegendaryGuard Date: Sun, 14 Feb 2021 17:16:17 +0000 (+0100) Subject: Added LegendaryGuard's new nade: Ammunitioning nade X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a4d2df57be76a70e4d053b425b26a696584fb105;p=xonotic%2Fxonotic-data.pk3dir.git Added LegendaryGuard's new nade: Ammunitioning nade --- diff --git a/gfx/hud/default/nade_ammo.tga b/gfx/hud/default/nade_ammo.tga new file mode 100644 index 000000000..31cf048fd Binary files /dev/null and b/gfx/hud/default/nade_ammo.tga differ diff --git a/gfx/hud/luma/nade_ammo.tga b/gfx/hud/luma/nade_ammo.tga new file mode 100644 index 000000000..3f0a8f0f6 Binary files /dev/null and b/gfx/hud/luma/nade_ammo.tga differ diff --git a/qcsrc/common/items/inventory.qh b/qcsrc/common/items/inventory.qh index ec435f988..f0cb32052 100644 --- a/qcsrc/common/items/inventory.qh +++ b/qcsrc/common/items/inventory.qh @@ -167,10 +167,10 @@ void Inventory_new(PlayerState this) if(!g_duel) setcefc(inv, Inventory_customize); Net_LinkEntity((inv.owner = this).inventory = inv, false, 0, Inventory_Send); } + void Inventory_delete(entity e) { delete(e.inventory.inventory); delete(e.inventory); } void Inventory_update(entity e) { e.inventory.SendFlags = 0xFFFFFF; } - void Inventory_clear(entity store) { // NOTE: you will need to perform Inventory_update after this to update the storage entity diff --git a/qcsrc/common/mutators/mutator/nades/effects.inc b/qcsrc/common/mutators/mutator/nades/effects.inc index aa7b729b1..19bc67e5f 100644 --- a/qcsrc/common/mutators/mutator/nades/effects.inc +++ b/qcsrc/common/mutators/mutator/nades/effects.inc @@ -1,13 +1,14 @@ #include - //LegendGuard adds purple nade parts 08-02-2021 //LegendGuard adds green nade parts 11-02-2021 +//LegendGuard adds brown nade parts 13-02-2021 EFFECT(0, NADE_EXPLODE_RED, "nade_red_explode") EFFECT(0, NADE_EXPLODE_BLUE, "nade_blue_explode") EFFECT(0, NADE_EXPLODE_YELLOW, "nade_yellow_explode") EFFECT(0, NADE_EXPLODE_PINK, "nade_pink_explode") EFFECT(0, NADE_EXPLODE_NEUTRAL, "nade_neutral_explode") EFFECT(0, NADE_EXPLODE_GREEN, "nade_green_explode") +EFFECT(0, NADE_EXPLODE_BROWN, "nade_brown_explode") EFFECT(0, NADE_EXPLODE_PURPLE, "nade_purple_explode") entity EFFECT_NADE_EXPLODE(int teamid) @@ -27,6 +28,7 @@ EFFECT(1, NADE_TRAIL_YELLOW, "nade_yellow") EFFECT(1, NADE_TRAIL_PINK, "nade_pink") EFFECT(1, NADE_TRAIL_NEUTRAL, "nade_neutral") EFFECT(1, NADE_TRAIL_GREEN, "nade_green") +EFFECT(1, NADE_TRAIL_BROWN, "nade_brown") EFFECT(1, NADE_TRAIL_PURPLE, "nade_purple") entity EFFECT_NADE_TRAIL(int teamid) { @@ -45,6 +47,7 @@ EFFECT(1, NADE_TRAIL_BURN_YELLOW, "nade_yellow_burn") EFFECT(1, NADE_TRAIL_BURN_PINK, "nade_pink_burn") EFFECT(1, NADE_TRAIL_BURN_NEUTRAL, "nade_neutral_burn") EFFECT(1, NADE_TRAIL_BURN_GREEN, "nade_green_burn") +EFFECT(1, NADE_TRAIL_BURN_BROWN, "nade_brown_burn") EFFECT(1, NADE_TRAIL_BURN_PURPLE, "nade_purple_burn") entity EFFECT_NADE_TRAIL_BURN(int teamid) { diff --git a/qcsrc/common/mutators/mutator/nades/nades.inc b/qcsrc/common/mutators/mutator/nades/nades.inc index 4c3f0df64..24b32f84b 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.inc +++ b/qcsrc/common/mutators/mutator/nades/nades.inc @@ -105,11 +105,22 @@ REGISTER_NADE(ARMORIZE) { #endif } +//LegendGuard writes Ammo nade code 13-02-2021 +REGISTER_NADE(AMMO) { + this.m_color = '0.66 0.33 0'; + this.m_name = _("Ammo grenade"); + this.m_icon = "nade_ammo"; +#ifdef GAMEQC + NADE_PROJECTILE(0, PROJECTILE_NADE_AMMO, EFFECT_NADE_TRAIL_BROWN); + NADE_PROJECTILE(1, PROJECTILE_NADE_AMMO_BURN, EFFECT_NADE_TRAIL_BURN_BROWN); +#endif +} + //LegendGuard writes Dark nade code 08-02-2021 REGISTER_NADE(DARK) { this.m_color = '0.23 0 0.23'; this.m_name = _("Dark grenade"); - this.m_icon = "nade_dark"; + this.m_icon = "nade_dark"; //nade icon (put texture, please) #ifdef GAMEQC NADE_PROJECTILE(0, PROJECTILE_NADE_DARK, EFFECT_NADE_TRAIL_PURPLE); NADE_PROJECTILE(1, PROJECTILE_NADE_DARK_BURN, EFFECT_NADE_TRAIL_BURN_PURPLE); diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index c9f25b9cb..a5b4a39c3 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -67,6 +67,12 @@ MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay) M_ARGV(1, float) = STAT(ARMORIZING_ORB_ALPHA); return true; } + if (STAT(AMMUNITIONING_ORB) > time) //LegendGuard adds new nade STAT ORB (keep in mind: qcsrc/common/stats.qh) 13-02-2021 + { + M_ARGV(0, vector) = NADE_TYPE_AMMO.m_color; + M_ARGV(1, float) = STAT(AMMUNITIONING_ORB_ALPHA); + return true; + } if (STAT(DARK_ORB) > time) //LegendGuard adds new nade STAT ORB (keep in mind: qcsrc/common/stats.qh) 08-02-2021 { M_ARGV(0, vector) = NADE_TYPE_DARK.m_color; @@ -714,20 +720,17 @@ void nade_veil_boom(entity this) settouch(orb, nade_veil_touch); orb.colormod = NADE_TYPE_VEIL.m_color; } -/**************LEGENDGUARD NEW NADES: ARMORIZE AND DARK NADES functions "cl_nade_type 10" and "cl_nade_type 11" *** //more ideas: BLOCKING NADE ***********************/ +/**************LEGENDGUARD NEW NADES: ARMORIZE, AMMO AND DARK NADES functions "cl_nade_type 10", "cl_nade_type 11" and "cl_nade_type 12" *** //more ideas: BLOCKING NADE ***********************/ void nade_armorize_touch(entity this, entity toucher) { - float maxarmor; - float maxhealth; float armor_factor; - float health_foemantain; - float health_maintaining = 1; + float maxarmor = 999; + float ar = GetResource(toucher, RES_ARMOR); if(IS_PLAYER(toucher) || IS_MONSTER(toucher)) if(!IS_DEAD(toucher)) if(!STAT(FROZEN, toucher)) { armor_factor = autocvar_g_nades_armorize_rate*frametime/2; - health_foemantain = autocvar_g_nades_armorize_rate*frametime/2; if ( toucher != this.realowner ) { if ( SAME_TEAM(toucher,this) ) @@ -736,18 +739,11 @@ void nade_armorize_touch(entity this, entity toucher) } else { - //maintain foe health and reduce armor armor_factor *= autocvar_g_nades_armorize_foe; - if (autocvar_g_nades_armorize_friend > 1 || autocvar_g_nades_armorize_friend < 1) - health_foemantain *= health_maintaining; - else - health_foemantain *= autocvar_g_nades_armorize_friend; } } if ( armor_factor > 0 ) { - maxarmor = 200; - float ar = GetResource(toucher, RES_ARMOR); if (ar < maxarmor) { if (this.nade_show_particles) @@ -759,17 +755,9 @@ void nade_armorize_touch(entity this, entity toucher) } else if ( armor_factor < 0 ) { - //Foe should drop only armor points - maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : g_pickup_healthmega_max; - float hp = GetResource(toucher, RES_HEALTH); - if (hp < maxhealth) - { - if ((GetResource(toucher, RES_ARMOR) <= 0) && (GetResource(toucher, RES_HEALTH) <= 9999)) - return; - else - GiveResourceWithLimit(toucher, RES_HEALTH, health_foemantain/1.3, maxhealth); - Damage(toucher,this,this.realowner,-armor_factor,DEATH_NADE_HEAL.m_id,DMG_NOWEP,toucher.origin,'0 0 0'); - } + //Foe drops armor points + if (ar > 0) + SetResource(toucher, RES_ARMOR, ar + armor_factor); } } @@ -789,6 +777,94 @@ void nade_armorize_boom(entity this) orb.colormod = '0.33 1 0.66'; } /***********************************************************************************/ +//LegendGuard develops ammo nade 13-02-2021 +void nade_ammo_touch(entity this, entity toucher) +{ + float maxammo = 999; + float ammo_factor; + float amshells = GetResource(toucher, RES_SHELLS); + float ambullets = GetResource(toucher, RES_BULLETS); + float amrockets = GetResource(toucher, RES_ROCKETS); + float amcells = GetResource(toucher, RES_CELLS); + float amplasma = GetResource(toucher, RES_PLASMA); + if(IS_PLAYER(toucher) || IS_MONSTER(toucher)) + if(!IS_DEAD(toucher)) + if(!STAT(FROZEN, toucher)) + { + ammo_factor = autocvar_g_nades_ammo_rate*frametime/2; + if ( toucher != this.realowner ) + { + if ( SAME_TEAM(toucher,this) ) + { + ammo_factor *= autocvar_g_nades_ammo_friend; + } + else + { + ammo_factor *= autocvar_g_nades_ammo_foe; + } + } + if ( ammo_factor > 0 ) + { + if ((amshells < maxammo) && (ambullets < maxammo) && (amrockets < maxammo) && (amcells < maxammo) && (amplasma < maxammo)) + { + if (this.nade_show_particles) + { + Send_Effect(EFFECT_HEALING, toucher.origin, '0 0 0', 1); + } + GiveResourceWithLimit(toucher, RES_SHELLS, ammo_factor, maxammo); + GiveResourceWithLimit(toucher, RES_BULLETS, ammo_factor, maxammo); + GiveResourceWithLimit(toucher, RES_ROCKETS, ammo_factor, maxammo); + GiveResourceWithLimit(toucher, RES_CELLS, ammo_factor, maxammo); + GiveResourceWithLimit(toucher, RES_PLASMA, ammo_factor, maxammo); + } + } + else if ( ammo_factor < 0 ) + { + //Foe drops ammo points + if (amshells > 0) + { + SetResource(toucher, RES_SHELLS, amshells + ammo_factor); + } + + if (ambullets > 0) + { + SetResource(toucher, RES_BULLETS, ambullets + ammo_factor); + } + + if (amrockets > 0) + { + SetResource(toucher, RES_ROCKETS, amrockets + ammo_factor); + } + + if (amcells > 0) + { + SetResource(toucher, RES_CELLS, amcells + ammo_factor); + } + + if (amplasma > 0) + { + SetResource(toucher, RES_PLASMA, amplasma + ammo_factor); + } + return; + } + } + + if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) ) + { + entity show_brown = (IS_VEHICLE(toucher)) ? toucher.owner : toucher; + STAT(AMMUNITIONING_ORB, show_brown) = time+0.1; + STAT(AMMUNITIONING_ORB_ALPHA, show_brown) = 0.75 * (this.ltime - time) / this.orb_lifetime; + } +} + +void nade_ammo_boom(entity this) +{ + entity orb = nades_spawn_orb(this.owner, this.realowner, this.origin, autocvar_g_nades_ammo_time, autocvar_g_nades_nade_radius); + + settouch(orb, nade_ammo_touch); + orb.colormod = '0.66 0.33 0'; +} +/***********************************************************************************/ //remember to put an image in gfx/hud/luma and gfx/hud/default per each nade_blabla.tga //dark nade does damage like a normal nade but the damage is minor void dark_damage(entity this, float radius, float damage) @@ -901,6 +977,11 @@ void nade_boom(entity this) expef = EFFECT_SPAWN_NEUTRAL; break; + case NADE_TYPE_AMMO: //LegendGuard adds nade case 13-02-2021 + nade_blast = false; + expef = EFFECT_SPAWN_NEUTRAL; + break; + case NADE_TYPE_DARK: //LegendGuard adds nade case 08-02-2021 nade_blast = false; expef = EFFECT_EXPLOSION_MEDIUM; @@ -939,6 +1020,7 @@ void nade_boom(entity this) case NADE_TYPE_ENTRAP: nade_entrap_boom(this); break; case NADE_TYPE_VEIL: nade_veil_boom(this); break; case NADE_TYPE_ARMORIZE: nade_armorize_boom(this); break; //LegendGuard adds the register of new nade 11-02-2021 + case NADE_TYPE_AMMO: nade_ammo_boom(this); break; //LegendGuard adds the register of new nade 13-02-2021 case NADE_TYPE_DARK: nade_dark_boom(this); break; //LegendGuard adds the register of new nade 08-02-2021 } @@ -1716,6 +1798,8 @@ MUTATOR_HOOKFUNCTION(nades, SpectateCopy) STAT(VEIL_ORB_ALPHA, client) = STAT(VEIL_ORB_ALPHA, spectatee); STAT(ARMORIZING_ORB, client) = STAT(ARMORIZING_ORB, spectatee); //LegendGuard adds nade STAT client 11-02-2021 STAT(ARMORIZING_ORB_ALPHA, client) = STAT(ARMORIZING_ORB_ALPHA, spectatee); + STAT(AMMUNITIONING_ORB, client) = STAT(AMMUNITIONING_ORB, spectatee); //LegendGuard adds nade STAT client 13-02-2021 + STAT(AMMUNITIONING_ORB_ALPHA, client) = STAT(AMMUNITIONING_ORB_ALPHA, spectatee); STAT(DARK_ORB, client) = STAT(DARK_ORB, spectatee); //LegendGuard adds nade STAT client 08-02-2021 STAT(DARK_ORB_ALPHA, client) = STAT(DARK_ORB_ALPHA, spectatee); } diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index 142728344..7fab64874 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -68,6 +68,10 @@ float autocvar_g_nades_armorize_time = 5; //LegendGuard adds new nade cvars 11-0 float autocvar_g_nades_armorize_rate = 30; float autocvar_g_nades_armorize_friend = 1; float autocvar_g_nades_armorize_foe = -2; +float autocvar_g_nades_ammo_time = 5; //LegendGuard adds new nade cvars 13-02-2021 +float autocvar_g_nades_ammo_rate = 30; +float autocvar_g_nades_ammo_friend = 1; +float autocvar_g_nades_ammo_foe = -2; float autocvar_g_nades_dark_damage = 25; //LegendGuard adds new nade cvars 08-02-2021 float autocvar_g_nades_dark_time = 13; float autocvar_g_nades_dark_radius = 700; @@ -95,8 +99,10 @@ const int PROJECTILE_NADE_VEIL = 86; const int PROJECTILE_NADE_VEIL_BURN = 87; const int PROJECTILE_NADE_ARMORIZE = 88; //LegendGuard adds new nade MACROS 11-02-2021 const int PROJECTILE_NADE_ARMORIZE_BURN = 89; -const int PROJECTILE_NADE_DARK = 90; //LegendGuard adds new nade MACROS 08-02-2021 -const int PROJECTILE_NADE_DARK_BURN = 91; +const int PROJECTILE_NADE_AMMO = 90; //LegendGuard adds new nade MACROS 13-02-2021 +const int PROJECTILE_NADE_AMMO_BURN = 91; +const int PROJECTILE_NADE_DARK = 92; //LegendGuard adds new nade MACROS 08-02-2021 +const int PROJECTILE_NADE_DARK_BURN = 93; REGISTRY(Nades, BITS(4)) REGISTER_REGISTRY(Nades)