]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Simplify emerald_fountain_explode code in a function and remove unnecessary colormap...
authorLegendaryGuard <rootuser999@gmail.com>
Tue, 5 Jul 2022 20:33:17 +0000 (22:33 +0200)
committerLegendaryGuard <rootuser999@gmail.com>
Tue, 5 Jul 2022 20:33:17 +0000 (22:33 +0200)
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/vehicles/sv_vehicles.qc

index f5c0a0b3d2c6b92e3a2c066977e3eb1e381e0baf..44cced3bf3f4d4a3623a58807601ea949393ea49 100644 (file)
@@ -991,6 +991,46 @@ void emerald_fountain_think(entity this)
        }
 }
 
+void emerald_fountain_explode(entity this)
+{
+       for (int c = 0; c < autocvar_g_nades_emerald_ball_count; c++)
+               nade_emerald_ball(this);
+       
+       entity fountain = new(nade_emerald_fountain);
+       fountain.owner = this.owner;
+       fountain.realowner = this.realowner;
+       fountain.origin = this.origin;
+       fountain.flags = FL_PROJECTILE;
+       IL_PUSH(g_projectiles, fountain);
+       IL_PUSH(g_bot_dodge, fountain);
+       setorigin(fountain, fountain.origin);
+       setthink(fountain, emerald_fountain_think);
+       fountain.nextthink = time;
+       fountain.ltime = time + autocvar_g_nades_emerald_fountain_lifetime;
+       fountain.pushltime = fountain.ltime;
+       fountain.team = this.team;
+       
+       //nade model maintaining
+       setmodel(fountain, MDL_PROJECTILE_GRENADE);
+       entity timer = new(nade_timer);
+       setmodel(timer, MDL_NADE_TIMER);
+       setattachment(timer, fountain, "");
+       timer.colormap = this.colormap;
+       timer.glowmod = this.glowmod;
+       setthink(timer, nade_timer_think);
+       timer.nextthink = time;
+       timer.wait = fountain.ltime;
+       timer.owner = fountain;
+       timer.skin = 10;
+       
+       set_movetype(fountain, MOVETYPE_TOSS);
+       fountain.bot_dodge = true;
+       fountain.nade_special_time = time;
+       setsize(fountain, '-16 -16 -16', '16 16 16');
+       CSQCProjectile(fountain, true, PROJECTILE_NADE_EMERALD_BURN, true);
+       nade_emerald_dropping(fountain.origin);
+}
+
 void nade_emerald_boom(entity this)
 {
        entity e = spawn();
@@ -1048,42 +1088,7 @@ void nade_emerald_boom(entity this)
                }
                default:
                {
-                       for (int c = 0; c < autocvar_g_nades_emerald_ball_count; c++)
-                               nade_emerald_ball(this);
-                       
-                       entity fountain = new(nade_emerald_fountain);
-                       fountain.owner = this.owner;
-                       fountain.realowner = this.realowner;
-                       fountain.origin = this.origin;
-                       fountain.flags = FL_PROJECTILE;
-                       IL_PUSH(g_projectiles, fountain);
-                       IL_PUSH(g_bot_dodge, fountain);
-                       setorigin(fountain, fountain.origin);
-                       setthink(fountain, emerald_fountain_think);
-                       fountain.nextthink = time;
-                       fountain.ltime = time + autocvar_g_nades_emerald_fountain_lifetime;
-                       fountain.pushltime = fountain.ltime;
-                       fountain.team = this.team;
-                       
-                       //nade model maintaining
-                       setmodel(fountain, MDL_PROJECTILE_GRENADE);
-                       entity timer = new(nade_timer);
-                       setmodel(timer, MDL_NADE_TIMER);
-                       setattachment(timer, fountain, "");
-                       timer.colormap = this.colormap;
-                       timer.glowmod = this.glowmod;
-                       setthink(timer, nade_timer_think);
-                       timer.nextthink = time;
-                       timer.wait = fountain.ltime;
-                       timer.owner = fountain;
-                       timer.skin = 10;
-                       
-                       set_movetype(fountain, MOVETYPE_TOSS);
-                       fountain.bot_dodge = true;
-                       fountain.nade_special_time = time;
-                       setsize(fountain, '-16 -16 -16', '16 16 16');
-                       CSQCProjectile(fountain, true, PROJECTILE_NADE_EMERALD_BURN, true);
-                       nade_emerald_dropping(fountain.origin);
+                       emerald_fountain_explode(this);
                        return;
                }
        }
index ba0a5088a88c7abbe2a1bff97ab85f97be81a5f0..399eac132b04d8461331d3022093679799faa107 100644 (file)
@@ -1378,8 +1378,6 @@ entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, en
        }
 
        e.realowner = spawnedby;
-       e.colormod = spawnedby.colormod;
-       e.colormap = spawnedby.colormap;
 
        if(IS_PLAYER(spawnedby))
        {