}
//LegendGuard adds vehicle spawn option for emerald nade 20-06-2021
-entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, int moveflag)
-{
- e.spawnflags = VHF_MULTISLOT;
-
- if(!respwn) { e.spawnflags |= VHF_ISVEHICLE; }
- setorigin(e, orig);
- bool allow_any = boolean(vehicle == "anyrandom");
-
- if(vehicle == "random" || allow_any)
- {
- RandomSelection_Init();
- FOREACH(Vehicles, it != VEH_Null && (allow_any || !(it.spawnflags & VHF_MULTISLOT)),
- {
- RandomSelection_AddEnt(it, 1, 1);
- });
-
- veh = RandomSelection_chosen_ent;
- }
- else if(vehicle != "")
- {
- bool found = false;
- FOREACH(Vehicles, it != VEH_Null,
- {
- if(it.netname == vehicle)
- {
- found = true;
- veh = it; // we have the vehicle, old vehicle id is no longer required
- break;
- }
- });
-
- if(!found && veh == VEH_Null)
- {
- if(removeifinvalid)
- {
- delete(e);
- 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, moveflag);
- }
- }
-
- e.realowner = spawnedby;
-
- e.effects |= EF_DIMLIGHT;
-
- // TODO: Create a vehicle .entity moveflag
- //if(moveflag && e.vehicle_flags == VEH_FLAG_MOVE)
- // e.monster_moveflags = moveflag;
-
- if(IS_PLAYER(spawnedby))
- {
- if(teamplay && autocvar_g_monsters_teams)
- e.team = spawnedby.team; // colors handled in spawn code
-
- e.angles_y = spawnedby.angles_y;
- }
-
- // TODO: Remove or not?
- if(!(e.spawnflags & VHF_ISVEHICLE)) { delete(e); return NULL; } // remove even if told not to, as we didn't spawn any kind of vehicle
-
- // e.angles = '0 0 0';
- e.velocity = randomvec() * 150 + '0 0 325';
- e.spawnfunc_checked = true;
- time = 0.4;
-
- vehicle_initialize(e, veh, true);
-
- return e;
-}
//LegendGuard adds turret spawn option for emerald nade 22-06-2021
-entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, int moveflag)
-{
- e.spawnflags = TSF_SUSPENDED;
-
- if(!respwn) { e.spawnflags |= TSL_NO_RESPAWN; }
- // if(invincible) { e.damage_flags |= TFL_DMG_NO; }
-
- setorigin(e, orig);
- bool allow_any = boolean(turret == "anyrandom");
-
- if(turret == "random" || allow_any)
- {
- RandomSelection_Init();
- FOREACH(Turrets, it != TUR_Null && (allow_any || !(it.spawnflags & TSF_SUSPENDED)),
- {
- RandomSelection_AddEnt(it, 1, 1);
- });
-
- tur = RandomSelection_chosen_ent;
- }
- else if(turret != "")
- {
- bool found = false;
- FOREACH(Turrets, it != TUR_Null,
- {
- if(it.netname == turret)
- {
- found = true;
- tur = it; // we have the turret, old turret id is no longer required
- break;
- }
- });
-
- if(!found && tur == TUR_Null)
- {
- if(removeifinvalid)
- {
- delete(e);
- 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, removeifinvalid, moveflag);
- }
- }
-
- e.realowner = spawnedby;
-
- e.effects |= EF_DIMLIGHT;
-
- // TODO: Create a turret .entity moveflag
- //if(moveflag && e.turret_flags == TUR_FLAG_MOVE)
- // e.monster_moveflags = moveflag;
-
- if(IS_PLAYER(spawnedby))
- {
- if(teamplay && autocvar_g_monsters_teams)
- e.team = spawnedby.team; // colors handled in spawn code
-
- // TODO: Create a turret .entity moveflag
- //if(autocvar_g_monsters_owners)
- // e.monster_follow = own; // using .owner makes the monster non-solid for its master
-
- e.angles_y = spawnedby.angles_y;
- }
-
- // TODO: Remove or not?
- 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);
-
- return e;
-}
void nade_emerald_randomitem(entity e, vector org)
{
return true;
}
+
+entity spawnturret (entity e, string turret, Turret tur, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, int moveflag)
+{
+ e.spawnflags = TSF_SUSPENDED;
+
+ if(!respwn) { e.spawnflags |= TSL_NO_RESPAWN; }
+ // if(invincible) { e.damage_flags |= TFL_DMG_NO; }
+
+ setorigin(e, orig);
+ bool allow_any = boolean(turret == "anyrandom");
+
+ if(turret == "random" || allow_any)
+ {
+ RandomSelection_Init();
+ FOREACH(Turrets, it != TUR_Null && (allow_any || !(it.spawnflags & TSF_SUSPENDED)),
+ {
+ RandomSelection_AddEnt(it, 1, 1);
+ });
+
+ tur = RandomSelection_chosen_ent;
+ }
+ else if(turret != "")
+ {
+ bool found = false;
+ FOREACH(Turrets, it != TUR_Null,
+ {
+ if(it.netname == turret)
+ {
+ found = true;
+ tur = it; // we have the turret, old turret id is no longer required
+ break;
+ }
+ });
+
+ if(!found && tur == TUR_Null)
+ {
+ if(removeifinvalid)
+ {
+ delete(e);
+ 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, removeifinvalid, moveflag);
+ }
+ }
+
+ e.realowner = spawnedby;
+
+ // TODO: Create a turret .entity moveflag
+ //if(moveflag && e.turret_flags == TUR_FLAG_MOVE)
+ // e.monster_moveflags = moveflag;
+
+ if(IS_PLAYER(spawnedby))
+ {
+ if(teamplay)
+ e.team = spawnedby.team; // colors handled in spawn code
+
+ // TODO: Create a turret .entity moveflag
+ //if(autocvar_g_monsters_owners)
+ // 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);
+
+ return e;
+}
#endif
return true;
}
+
+entity spawnvehicle (entity e, string vehicle, Vehicle veh, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, int moveflag)
+{
+ e.spawnflags = VHF_MULTISLOT;
+
+ if(!respwn) { e.spawnflags |= VHF_ISVEHICLE; }
+ setorigin(e, orig);
+ bool allow_any = boolean(vehicle == "anyrandom");
+
+ if(vehicle == "random" || allow_any)
+ {
+ RandomSelection_Init();
+ FOREACH(Vehicles, it != VEH_Null && (allow_any || !(it.spawnflags & VHF_MULTISLOT)),
+ {
+ RandomSelection_AddEnt(it, 1, 1);
+ });
+
+ veh = RandomSelection_chosen_ent;
+ }
+ else if(vehicle != "")
+ {
+ bool found = false;
+ FOREACH(Vehicles, it != VEH_Null,
+ {
+ if(it.netname == vehicle)
+ {
+ found = true;
+ veh = it; // we have the vehicle, old vehicle id is no longer required
+ break;
+ }
+ });
+
+ if(!found && veh == VEH_Null)
+ {
+ if(removeifinvalid)
+ {
+ delete(e);
+ 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, moveflag);
+ }
+ }
+
+ e.realowner = spawnedby;
+
+ if(IS_PLAYER(spawnedby))
+ {
+ if(teamplay)
+ e.team = spawnedby.team; // colors handled in spawn code
+
+ e.angles_y = spawnedby.angles_y;
+ }
+
+ if(!(e.spawnflags & VHF_ISVEHICLE)) { delete(e); return NULL; } // remove even if told not to, as we didn't spawn any kind of vehicle
+
+ // e.angles = '0 0 0';
+ e.velocity = randomvec() * 150 + '0 0 325';
+ e.spawnfunc_checked = true;
+ time = 0.6;
+
+ vehicle_initialize(e, veh, true);
+
+ return e;
+}