]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/nades/nades.qc
Registry API: add REGISTRY_GET
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nades / nades.qc
index 9ac33b45bb328a612a395fb74f5a206fd62a7644..7dffc0f4d0fc9a8d4b6122f00709feb82d2ad127 100644 (file)
@@ -125,7 +125,7 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
        float bonusNades    = STAT(NADE_BONUS);
        float bonusProgress = STAT(NADE_BONUS_SCORE);
        float bonusType     = STAT(NADE_BONUS_TYPE);
-       Nade def = Nades_from(bonusType);
+       Nade def = REGISTRY_GET(Nades, bonusType);
        vector nadeColor    = def.m_color;
        string nadeIcon     = def.m_icon;
 
@@ -181,7 +181,7 @@ void nade_timer_think(entity this)
 
 void nade_burn_spawn(entity _nade)
 {
-       CSQCProjectile(_nade, true, Nades_from(STAT(NADE_BONUS_TYPE, _nade)).m_projectile[true], true);
+       CSQCProjectile(_nade, true, REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, _nade)).m_projectile[true], true);
 }
 
 void nade_spawn(entity _nade)
@@ -199,7 +199,7 @@ void nade_spawn(entity _nade)
 
        _nade.effects |= EF_LOWPRECISION;
 
-       CSQCProjectile(_nade, true, Nades_from(STAT(NADE_BONUS_TYPE, _nade)).m_projectile[false], true);
+       CSQCProjectile(_nade, true, REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, _nade)).m_projectile[false], true);
 }
 
 void napalm_damage(entity this, float dist, float damage, float edgedamage, float burntime)
@@ -714,7 +714,7 @@ void nade_boom(entity this)
        entity expef = NULL;
        bool nade_blast = true;
 
-       switch ( Nades_from(STAT(NADE_BONUS_TYPE, this)) )
+       switch ( REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this)) )
        {
                case NADE_TYPE_NAPALM:
                        nade_blast = autocvar_g_nades_napalm_blast;
@@ -776,7 +776,7 @@ void nade_boom(entity this)
        }
 
        if(this.takedamage)
-       switch ( Nades_from(STAT(NADE_BONUS_TYPE, this)) )
+       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;
@@ -1074,7 +1074,10 @@ bool nade_customize(entity this, entity client)
        {
                //this.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
                if(!this.traileffectnum)
-                       this.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(STAT(NADE_BONUS_TYPE, this)).m_projectile[false], this.team).eent_eff_name);
+               {
+                       entity nade = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this));
+                       this.traileffectnum = _particleeffectnum(Nade_TrailEffect(nade.m_projectile[false], this.team).eent_eff_name);
+               }
                this.alpha = 1;
        }
 
@@ -1088,7 +1091,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        STAT(NADE_BONUS_TYPE, n) = max(1, ntype);
        n.pokenade_type = pntype;
 
-       if(Nades_from(STAT(NADE_BONUS_TYPE, n)) == NADE_TYPE_Null)
+       if(REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)) == NADE_TYPE_Null)
                STAT(NADE_BONUS_TYPE, n) = NADE_TYPE_NORMAL.m_id;
 
        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
@@ -1097,8 +1100,8 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        //setattachment(n, player, "bip01 l hand");
        n.exteriormodeltoclient = player;
        setcefc(n, nade_customize);
-       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(STAT(NADE_BONUS_TYPE, n)).m_projectile[false], player.team).eent_eff_name);
-       n.colormod = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_color;
+       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_projectile[false], player.team).eent_eff_name);
+       n.colormod = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_color;
        n.realowner = nowner;
        n.colormap = player.colormap;
        n.glowmod = player.glowmod;
@@ -1109,19 +1112,19 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        n.projectiledeathtype = DEATH_NADE.m_id;
        n.weaponentity_fld = weaponentity;
        n.nade_lifetime = ntime;
-       n.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha;
+       n.alpha = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_alpha;
 
        setmodel(fn, MDL_NADE_VIEW);
        //setattachment(fn, player.(weaponentity), "");
        fn.viewmodelforclient = player;
        fn.realowner = fn.owner = player;
-       fn.colormod = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_color;
+       fn.colormod = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_color;
        fn.colormap = player.colormap;
        fn.glowmod = player.glowmod;
        setthink(fn, SUB_Remove);
        fn.nextthink = n.wait;
        fn.weaponentity_fld = weaponentity;
-       fn.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha;
+       fn.alpha = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_alpha;
 
        player.nade = n;
        player.fake_nade = fn;