Skip to content

Commit

Permalink
Merge branch 'master' into medical
Browse files Browse the repository at this point in the history
  • Loading branch information
caligari87 committed Sep 6, 2020
2 parents fdb0291 + ec214ab commit 9934296
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 28 deletions.
7 changes: 1 addition & 6 deletions mapinfo.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
GameInfo {
AddEventHandlers = "UaS_Spawner"
AddEventHandlers = "UaS_Bootstrap"
AddEventHandlers = "UaS_Hunger_Spawner"
AddEventHandlers = "UaS_Scarcity_Handler"
AddEventHandlers = "UaS_Spawner"
AddEventHandlers = "UaS_FragRemovalHandler"
AddEventHandlers = "UaS_Ally_Spawner"
AddEventHandlers = "UaS_AI_Bootstrap"
AddEventHandlers = "UaS_VisWeps_Bootstrap"
AddEventHandlers = "UaS_Sling_Spawner"
AddEventHandlers = "UaS_Glowstick_Spawner"
AddEventHandlers = "UaS_Flare_Spawner"
AddEventHandlers = "UaS_YOLO_Handler"
}
4 changes: 2 additions & 2 deletions modules/allies/spawner.zsc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class UaS_Ally_Spawner : EventHandler {
extend class UaS_Spawner {
double spawnChance;

override void WorldLoaded(WorldEvent e) {
Expand All @@ -8,7 +8,7 @@ class UaS_Ally_Spawner : EventHandler {
}

//Spawn allied marines randomly
override void WorldThingSpawned(WorldEvent e) {
void AllySpawns(WorldEvent e) {
bool replaced = false;

// Conditions for skipping spawns
Expand Down
6 changes: 3 additions & 3 deletions modules/hunger/spawner.zsc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class UaS_Hunger_Spawner : EventHandler {
extend class UaS_Spawner {
double spawnRate;
vector3 spawnPos;

//Set up spawns
override void WorldThingSpawned(WorldEvent e) {
void HungerSpawns(WorldEvent e) {
if(UaS_HungerTimeScale == 0 || UaS_HungerEnabled == false) { return; }
if(level.maptime > 1) { return; }
if(!e.Thing) { return; }
Expand All @@ -17,7 +17,7 @@ class UaS_Hunger_Spawner : EventHandler {
if(UaS.RandomChance(0.5)) { toSpawnClass = 'UaS_WaterRation'; }

//Spawn rations on backpacks, with a chance of an extra ration
if(e.Thing.GetClassName() == "HDBP") {
if(e.Thing.GetClassName() == "HDBackpack") {
UaS.SpawnStuff('UaS_FoodRation', 1, spawnPos);
UaS.SpawnStuff('UaS_WaterRation', 1, spawnPos);
}
Expand Down
8 changes: 4 additions & 4 deletions modules/items/flare.zsc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class UaS_Flare_Spawner : EventHandler {
extend class UaS_Spawner {
//Set up spawns
override void WorldThingSpawned(WorldEvent e) {
void FlareSpawns(WorldEvent e) {
if(level.maptime > 1) { return; }
if(!e.Thing) { return; }
if(e.Thing is "Inventory" && Inventory(e.Thing).Owner) { return; }
Expand All @@ -9,10 +9,10 @@ class UaS_Flare_Spawner : EventHandler {
e.thing.GetClassName() == "HDAmBox" ||
e.Thing.GetClassName() == "PortableStimpack" ||
e.Thing.GetClassName() == "PortableMedikit" ||
e.Thing.GetClassName() == "HDBP");
e.Thing.GetClassName() == "HDBackpack");

if(spawnable) {
UaS.SpawnStuff('UaS_flare', randompick[flare](0, 0, 1), e.Thing.pos);
UaS.SpawnStuff('UaS_flare', randompick[flare](0, 0, 0, 1), e.Thing.pos);
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions modules/items/glowstick.zsc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class UaS_Glowstick_Spawner : EventHandler {
//Set up spawns
override void WorldThingSpawned(WorldEvent e) {
extend class UaS_Spawner {
void GlowstickSpawns(WorldEvent e) {
if(level.maptime > 1) { return; }
if(!e.Thing) { return; }
if(e.Thing is "Inventory" && Inventory(e.Thing).Owner) { return; }
Expand All @@ -9,10 +8,10 @@ class UaS_Glowstick_Spawner : EventHandler {
e.thing.GetClassName() == "HDAmBox" ||
e.Thing.GetClassName() == "PortableStimpack" ||
e.Thing.GetClassName() == "PortableMedikit" ||
e.Thing.GetClassName() == "HDBP");
e.Thing.GetClassName() == "HDBackpack");

if(spawnable) {
UaS.SpawnStuff('UaS_Glowstick', randompick[glowstick](0, 0, 1, 2), e.Thing.pos);
UaS.SpawnStuff('UaS_Glowstick', randompick[glowstick](0, 0, 0, 1), e.Thing.pos);
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions modules/items/laser.zsc
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
extend class UaS_Spawner {
void LLMSpawns(WorldEvent e) {
if(level.maptime > 1) { return; }
if(!e.Thing) { return; }
if(e.Thing is "Inventory" && Inventory(e.Thing).Owner) { return; }

bool spawnable = (
e.thing.GetClassName() == "PortableLiteAmp" ||
e.Thing.GetClassName() == "HDAmBox" ||
e.Thing.GetClassName() == "HDBackpack");

if(spawnable) {
UaS.SpawnStuff('UaS_LaserLightModule', randompick[llm](0, 1), e.Thing.pos);
}
}
}


class UaS_LaserLightModule : HDPickup {
int mode;
bool activated;
Expand Down
6 changes: 3 additions & 3 deletions modules/items/sling.zsc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class UaS_Sling_Spawner : EventHandler {
override void WorldThingSpawned(WorldEvent e) {
extend class UaS_Spawner {
void SlingSpawns(WorldEvent e) {
if(level.maptime > 1) { return; }
if(!e.Thing) { return; }
if(e.Thing is "Inventory" && Inventory(e.Thing).Owner) { return; }
Expand All @@ -17,7 +17,7 @@ class UaS_Sling_Spawner : EventHandler {
e.Thing.GetClassName() == "bossrifle"
);

if (spawnable && UaS.RandomChance(0.1)) { UaS.SpawnStuff("UaS_WeaponSling", 1, e.Thing.pos); }
if (spawnable && UaS.RandomChance(0.2)) { UaS.SpawnStuff("UaS_WeaponSling", 1, e.Thing.pos); }
}
}

Expand Down
9 changes: 7 additions & 2 deletions modules/spawner/spawner.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ class UaS_Spawner : EventHandler {
}

// Stuff that only spawns on map start
if (level.maptime != 1) { return; }
if (level.maptime > 1) { return; }

if(e.Thing is 'PortableLiteAmp') { UaS.SpawnStuff('UaS_LaserLightModule', 1, e.Thing.pos); }
HungerSpawns(e);
AllySpawns(e);
SlingSpawns(e);
GlowstickSpawns(e);
FlareSpawns(e);
LLMSpawns(e);
}
}
6 changes: 3 additions & 3 deletions zscript.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ version "3.5"
#include "modules/constants.zsc"
#include "modules/bootstrap/bootstrap.zsc"

// General spawner
#include "modules/spawner/spawner.zsc"

// Hunger and Thirst scripts
#include "modules/hunger/spawner.zsc"
#include "modules/hunger/tracker.zsc"
Expand All @@ -20,9 +23,6 @@ version "3.5"
#include "modules/scarcity/handler.zsc"
#include "modules/scarcity/items.zsc"

// General spawner
#include "modules/spawner/spawner.zsc"

// Frag spawning factor
#include "modules/fragfactor/fragfactor.zsc"

Expand Down

0 comments on commit 9934296

Please sign in to comment.