diff --git a/mapinfo.txt b/mapinfo.txt index b0578ab3..f8914a95 100644 --- a/mapinfo.txt +++ b/mapinfo.txt @@ -3,11 +3,7 @@ GameInfo { AddEventHandlers = "UaS_Bootstrap" AddEventHandlers = "UaS_Scarcity_Handler" 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" } diff --git a/modules/allies/spawner.zsc b/modules/allies/spawner.zsc index 2aebb92f..fd17c175 100644 --- a/modules/allies/spawner.zsc +++ b/modules/allies/spawner.zsc @@ -1,4 +1,4 @@ -class UaS_Ally_Spawner : EventHandler { +extend class UaS_Spawner { double spawnChance; override void WorldLoaded(WorldEvent e) { @@ -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 diff --git a/modules/hunger/spawner.zsc b/modules/hunger/spawner.zsc index f7f07ba3..c18f419d 100644 --- a/modules/hunger/spawner.zsc +++ b/modules/hunger/spawner.zsc @@ -17,7 +17,7 @@ extend class UaS_Spawner { if(UaS.RandomChance(0.5)) { toSpawnClass = 'UaS_WaterRation'; } //Spawn rations on backpacks, with a chance of an extra ration - if(e.Thing.GetClassName() == "Backpack") { + if(e.Thing.GetClassName() == "HDBackpack") { UaS.SpawnStuff('UaS_FoodRation', 1, spawnPos); UaS.SpawnStuff('UaS_WaterRation', 1, spawnPos); } diff --git a/modules/items/flare.zsc b/modules/items/flare.zsc index eb6539c0..66ea0e7c 100644 --- a/modules/items/flare.zsc +++ b/modules/items/flare.zsc @@ -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; } @@ -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); } } } diff --git a/modules/items/glowstick.zsc b/modules/items/glowstick.zsc index 484ebbfd..12a22b4c 100644 --- a/modules/items/glowstick.zsc +++ b/modules/items/glowstick.zsc @@ -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; } @@ -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); } } } diff --git a/modules/items/laser.zsc b/modules/items/laser.zsc index 465e0e61..2e03c644 100644 --- a/modules/items/laser.zsc +++ b/modules/items/laser.zsc @@ -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; diff --git a/modules/items/sling.zsc b/modules/items/sling.zsc index d7b1a153..64cfc71f 100644 --- a/modules/items/sling.zsc +++ b/modules/items/sling.zsc @@ -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; } @@ -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); } } } diff --git a/modules/spawner/spawner.zsc b/modules/spawner/spawner.zsc index e5a05891..0be00dc1 100644 --- a/modules/spawner/spawner.zsc +++ b/modules/spawner/spawner.zsc @@ -11,14 +11,13 @@ class UaS_Spawner : EventHandler { } // Stuff that only spawns on map start - if (level.maptime != 1) { return; } - - bool llmspawns = ( - e.Thing is 'PortableLiteAmp' || - e.Thing is 'HDBackpack' || - e.Thing is 'HDAmBox'); - if(llmspawns) { UaS.SpawnStuff('UaS_LaserLightModule', 0.5, e.Thing.pos); } + if (level.maptime > 1) { return; } HungerSpawns(e); + AllySpawns(e); + SlingSpawns(e); + GlowstickSpawns(e); + FlareSpawns(e); + LLMSpawns(e); } }