]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add effects for spawned turrets from the nade or anything, plus add a verify paramete...
authorLegendaryGuard <rootuser999@gmail.com>
Sat, 25 Jun 2022 10:49:42 +0000 (12:49 +0200)
committerLegendaryGuard <rootuser999@gmail.com>
Sat, 25 Jun 2022 10:49:42 +0000 (12:49 +0200)
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/sv_turrets.qh
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh

index b05bdb2f76999cba9295e5594d3d4ddb447a9203..60faafe9acdc88c888b78a8d4b5a89ad8aac50a9 100644 (file)
@@ -1005,7 +1005,8 @@ void nade_emerald_boom(entity this)
                                        this.realowner, 
                                        this.origin, 
                                        false, 
-                                       false
+                                       false,
+                                       true
                                );
 
                                vehspawncount++;
@@ -1029,7 +1030,8 @@ void nade_emerald_boom(entity this)
                                        false,
                                        false, 
                                        false, 
-                                       1
+                                       1,
+                                       true
                                );
                                
                                turspawncount++;
index 0e049d25a01cbdf0b7beb6c33a3ff22b5eb5152d..c88727aa81d7255923cba86c7563d1f5eaf98045 100644 (file)
@@ -1416,9 +1416,10 @@ bool turret_initialize(entity this, Turret tur)
        return true;
 }
 
-entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, bool removeifinvalid, int moveflag)
+entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, bool removeifinvalid, int moveflag, bool optional)
 {
        e.spawnflags = TSF_SUSPENDED;
+       e.optionalsetup = optional;
 
        if(!respwn) { e.spawnflags |= TSL_NO_RESPAWN; }
        if(invincible) { e.damage_flags |= TFL_DMG_NO; }
@@ -1457,7 +1458,7 @@ entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entit
                                return NULL; // no good
                        }
                        // select a random valid turret type if no valid turret was provided
-                       return spawnturret(e, "random", TUR_Null, spawnedby, own, orig, respwn, invincible, removeifinvalid, moveflag);
+                       return spawnturret(e, "random", TUR_Null, spawnedby, own, orig, respwn, invincible, removeifinvalid, moveflag, optional);
                }
        }
 
@@ -1472,16 +1473,21 @@ entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entit
                        e.team = spawnedby.team; // colors handled in spawn code
 
                // TODO: Create a "following player" feature when turret has moveflag
-               //if(autocvar_g_monsters_owners)
+               //if(autocvar_g_monsters_owners && e.move_movetype == MOVETYPE_WALK)
                //      e.monster_follow = own; // using .owner makes the monster non-solid for its master
                
                e.angles_y = spawnedby.angles_y;
        }
        
        if(!(e.spawnflags & TSF_SUSPENDED)) { delete(e); return NULL; } // remove even if told not to, as we didn't spawn any kind of turret
-       
+
        turret_initialize(e, tur);
 
+       //LOG_INFOF("^1tur.netname^3: %s", tur.netname);
+
+       if (e.optionalsetup)
+               e.tur_head.effects = (EF_DIMLIGHT | EF_FULLBRIGHT);
+
        return e;
 }
 #endif
index d1edfeef9fde8ff046b5052c710cd0550c03ecad..1bd0b43aaebe9e33a6a28de930d2d96881ace830 100644 (file)
@@ -9,7 +9,7 @@ bool autocvar_g_turrets_reloadcvars;
 float autocvar_g_turrets_targetscan_maxdelay;
 float autocvar_g_turrets_targetscan_mindelay;
 
-entity spawnturret(entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, bool removeifinvalid, int moveflag);
+entity spawnturret(entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, bool removeifinvalid, int moveflag, bool optional);
 entity turret_projectile(entity actor, Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
 void turret_projectile_explode(entity this);
 float turret_validate_target(entity e_turret, entity e_target, float validate_flags);
@@ -26,6 +26,7 @@ TR_PROPS_COMMON(X, , )
 .float shot_volly_refire; // refire after completed volly
 */
 
+.bool optionalsetup; // optional setup
 .float ticrate; // interal ai think rate
 .entity tur_head; // top part of the turret
 .entity tur_defend; // defend this entity
index 6986d7033e80424f318e259a259baa793b15298e..329e74e735fc32c44708ac72df48aa399be4cd90 100644 (file)
@@ -424,7 +424,7 @@ void vehicles_reset_colors(entity this, entity player)
        if (this.optionalsetup)
                this.effects = EF_DIMLIGHT;
        else 
-               this.effects   = eff;
+               this.effects = eff;
 
        Vehicle info = this.vehicledef; //REGISTRY_GET(Vehicles, this.vehicleid);
        info.vr_setcolors(info, this);
@@ -1295,10 +1295,10 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
        return true;
 }
 
-entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid)
+entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, bool optional)
 {
        e.spawnflags = VHF_MULTISLOT;
-       e.optionalsetup = true;
+       e.optionalsetup = optional;
        
        // TODO: Make a respawn option, the following line isn't functional
        if(!respwn) { e.spawnflags |= VHF_ISVEHICLE; }
@@ -1336,7 +1336,7 @@ entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, en
                                return NULL; // no good
                        }
                        // select a random valid vehicle type if no valid vehicle was provided
-                       return spawnvehicle(e, "random", VEH_Null, spawnedby, own, orig, respwn, removeifinvalid);
+                       return spawnvehicle(e, "random", VEH_Null, spawnedby, own, orig, respwn, removeifinvalid, optional);
                }
        }
 
index cfaefba96286cff61e435204854d9de7b168082a..c293a287d64377f7ed2101daea29647d07b252bc 100644 (file)
@@ -82,7 +82,7 @@ const int MAX_AXH = 4;
 .float  lock_strength;
 .float  lock_time;
 .float  lock_soundtime;
-.bool optionalsetup;
+.bool  optionalsetup;
 
 // vehicle functions
 .void(int _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
@@ -104,7 +104,7 @@ float vehicles_exit_running;
 
 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
 
-entity spawnvehicle(entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid);
+entity spawnvehicle(entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, bool optional);
 void vehicles_exit(entity vehic, int eject);
 bool vehicle_initialize(entity this, Vehicle info, float nodrop);
 bool vehicle_impulse(entity this, int imp);