From b327117094daf39069f981223eca2888d579e025 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 25 Oct 2023 01:17:10 -0400
Subject: [PATCH 01/56] Drill foundation
---
.../datums/looping_sounds/machinery_sounds.dm | 6 ++
code/modules/mining/drill.dm | 80 +++++++++++++++++++
shiptest.dme | 1 +
3 files changed, 87 insertions(+)
create mode 100644 code/modules/mining/drill.dm
diff --git a/code/datums/looping_sounds/machinery_sounds.dm b/code/datums/looping_sounds/machinery_sounds.dm
index 743550be16db..82c7b65ad315 100644
--- a/code/datums/looping_sounds/machinery_sounds.dm
+++ b/code/datums/looping_sounds/machinery_sounds.dm
@@ -72,3 +72,9 @@
volume = 85
vary = TRUE
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/datum/looping_sound/drill
+ mid_sounds = list('sound/machines/gravgen/gravgen_mid1.ogg'=1, 'sound/machines/gravgen/gravgen_mid2.ogg'=1, 'sound/machines/gravgen/gravgen_mid3.ogg'=1, 'sound/machines/gravgen/gravgen_mid4.ogg'=1)
+ mid_length = 4
+ volume = 60
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
new file mode 100644
index 000000000000..cb0b0c728bc1
--- /dev/null
+++ b/code/modules/mining/drill.dm
@@ -0,0 +1,80 @@
+/obj/structure/vein
+ name = "ore vein"
+ icon = 'icons/obj/lavaland/terrain.dmi'
+ icon_state = "geyser"
+ anchored = TRUE
+
+ var/drilled = FALSE
+ var/ore_amount = 20
+ var/ore_type = /obj/item/stack/ore/iron
+
+/obj/structure/vein/proc/mine()
+ new ore_type(loc, ore_amount)
+
+/obj/machinery/drill
+ name = "big-ass ore drill"
+ desc = "It's like those drills you put in your hand but, like, way bigger."
+ icon = 'icons/obj/machines/drill.dmi'
+ icon_state = "deep_core_drill"
+ density = TRUE
+ anchored = FALSE
+
+ var/active = FALSE
+ var/obj/structure/vein/mining
+ var/datum/looping_sound/drill/soundloop
+
+/obj/machinery/drill/Initialize()
+ . = ..()
+ soundloop = new(list(src), active)
+
+/obj/machinery/drill/Destroy()
+ QDEL_NULL(soundloop)
+ return ..()
+
+/obj/machinery/drill/attackby(obj/item/tool, mob/living/user, params)
+ var/obj/structure/vein/vein = locate(/obj/structure/vein) in src.loc
+ if(tool.tool_behaviour == TOOL_WRENCH)
+ if(!vein)
+ to_chat(user, "[src] must be on top of an ore vein.")
+ return
+ if(active)
+ to_chat(user, "[src] can't be unsecured while it's running!")
+ return
+ playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
+ if(!anchored && do_after(user, 30, target = src))
+ to_chat(user, "You secure the [src] to the ore vein.")
+ playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
+ mining = vein
+ anchored = TRUE
+ return
+ if(do_after(user, 30, target = src))
+ to_chat(user, "You unsecure the [src] from the ore vein.")
+ playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
+ anchored = FALSE
+ mining = null
+ return
+ return ..()
+
+/obj/machinery/drill/interact(mob/user, special_state)
+ . = ..()
+ if(!mining)
+ to_chat(user, "[src] isn't sercured in place yet!")
+ return
+ if(!active)
+ addtimer(CALLBACK(src, .proc/mine), 100)
+ playsound(src, 'sound/machines/click.ogg', 100, TRUE)
+ user.visible_message( \
+ "[user] activates [src].", \
+ "You hit the ignition button to activate [src].", \
+ "You hear a drill churn to life.")
+ active = TRUE
+ soundloop.start()
+ return
+ else
+ to_chat(user, "[src] is currently busy, wait till it's done!")
+ return
+
+/obj/machinery/drill/proc/mine()
+ new mining.ore_type(loc, mining.ore_amount)
+ active = FALSE
+ soundloop.stop()
diff --git a/shiptest.dme b/shiptest.dme
index 890edeb8b794..bee82466c4ed 100644
--- a/shiptest.dme
+++ b/shiptest.dme
@@ -2344,6 +2344,7 @@
#include "code\modules\mentor\verbs\mentorpm.dm"
#include "code\modules\mentor\verbs\mentorsay.dm"
#include "code\modules\mining\abandoned_crates.dm"
+#include "code\modules\mining\drill.dm"
#include "code\modules\mining\fulton.dm"
#include "code\modules\mining\machine_bluespaceminer.dm"
#include "code\modules\mining\machine_processing.dm"
From 3803ab3bad33779849a66a8d4fc20da4a7d7d8e0 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 25 Oct 2023 01:48:05 -0400
Subject: [PATCH 02/56] I THOUGHT I KILLED YOU!!!
---
code/modules/mining/drill.dm | 3 ---
1 file changed, 3 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index cb0b0c728bc1..57c8abca9a26 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -8,9 +8,6 @@
var/ore_amount = 20
var/ore_type = /obj/item/stack/ore/iron
-/obj/structure/vein/proc/mine()
- new ore_type(loc, ore_amount)
-
/obj/machinery/drill
name = "big-ass ore drill"
desc = "It's like those drills you put in your hand but, like, way bigger."
From 7e18b4850905b2d006df3568a8eedcf26a66e10c Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Thu, 26 Oct 2023 00:35:31 -0400
Subject: [PATCH 03/56] Animations and ore vein file
---
code/modules/mining/drill.dm | 53 ++++++++++++++++++++++++--------
code/modules/mining/ore_veins.dm | 36 ++++++++++++++++++++++
shiptest.dme | 1 +
3 files changed, 77 insertions(+), 13 deletions(-)
create mode 100644 code/modules/mining/ore_veins.dm
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 57c8abca9a26..3f19504f5c56 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -1,13 +1,3 @@
-/obj/structure/vein
- name = "ore vein"
- icon = 'icons/obj/lavaland/terrain.dmi'
- icon_state = "geyser"
- anchored = TRUE
-
- var/drilled = FALSE
- var/ore_amount = 20
- var/ore_type = /obj/item/stack/ore/iron
-
/obj/machinery/drill
name = "big-ass ore drill"
desc = "It's like those drills you put in your hand but, like, way bigger."
@@ -15,6 +5,7 @@
icon_state = "deep_core_drill"
density = TRUE
anchored = FALSE
+ use_power = NO_POWER_USE
var/active = FALSE
var/obj/structure/vein/mining
@@ -31,7 +22,7 @@
/obj/machinery/drill/attackby(obj/item/tool, mob/living/user, params)
var/obj/structure/vein/vein = locate(/obj/structure/vein) in src.loc
if(tool.tool_behaviour == TOOL_WRENCH)
- if(!vein)
+ if(!vein && !anchored)
to_chat(user, "[src] must be on top of an ore vein.")
return
if(active)
@@ -43,19 +34,21 @@
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
mining = vein
anchored = TRUE
+ update_icon_state()
return
if(do_after(user, 30, target = src))
to_chat(user, "You unsecure the [src] from the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
anchored = FALSE
mining = null
+ update_icon_state()
return
return ..()
/obj/machinery/drill/interact(mob/user, special_state)
. = ..()
if(!mining)
- to_chat(user, "[src] isn't sercured in place yet!")
+ to_chat(user, "[src] isn't sercured over an ore vein!")
return
if(!active)
addtimer(CALLBACK(src, .proc/mine), 100)
@@ -66,12 +59,46 @@
"You hear a drill churn to life.")
active = TRUE
soundloop.start()
+ update_icon_state()
+ update_overlays()
return
else
to_chat(user, "[src] is currently busy, wait till it's done!")
return
+/obj/machinery/drill/update_icon_state()
+ if(anchored)
+ /*if(BROKEN)
+ icon_state = "deep_core_drill-deployed_broken"
+ return ..()*/
+ if(active)
+ icon_state = "deep_core_drill-active"
+ return ..()
+ else
+ icon_state = "deep_core_drill-idle"
+ return ..()
+ else
+ /*if(BROKEN)
+ icon_state = "deep_core_drill-broken"
+ return ..()*/
+ icon_state = "deep_core_drill"
+ return ..()
+
+/obj/machinery/drill/update_overlays()
+ . = ..()
+ SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays)
+ //Cool beam of light ignores shadows.
+ if(active && anchored)
+ set_light(3, 1, "99FFFF")
+ SSvis_overlays.add_vis_overlay(src, icon, "mining_beam-particles", layer, plane, dir)
+ SSvis_overlays.add_vis_overlay(src, icon, "mining_beam-particles", layer, EMISSIVE_PLANE, dir)
+ else
+ set_light(0)
+
/obj/machinery/drill/proc/mine()
- new mining.ore_type(loc, mining.ore_amount)
+ mining.deconstruct()
active = FALSE
soundloop.stop()
+ mining = null
+ update_icon_state()
+ update_overlays()
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
new file mode 100644
index 000000000000..99dc1a34eee1
--- /dev/null
+++ b/code/modules/mining/ore_veins.dm
@@ -0,0 +1,36 @@
+/obj/structure/vein
+ name = "ore vein"
+ icon = 'icons/obj/lavaland/terrain.dmi'
+ icon_state = "geyser"
+ anchored = TRUE
+ layer = HIGH_TURF_LAYER
+
+ var/ore_list = list(
+ /obj/item/stack/ore/uranium = 20,
+ /obj/item/stack/ore/iron = 50,
+ /obj/item/stack/ore/plasma = 25,
+ /obj/item/stack/ore/silver = 20,
+ /obj/item/stack/ore/gold = 10,
+ /obj/item/stack/ore/diamond = 5,
+ /obj/item/stack/ore/titanium = 30,
+ )
+
+/obj/structure/vein/Initialize()
+ . = ..()
+ for(var/type in ore_list)
+ var/chance = rand(0, ore_list[type])
+ ore_list[type] = chance
+
+/obj/structure/vein/deconstruct(disassembled)
+ destroy_effect()
+ drop_ore()
+ return..()
+
+/obj/structure/vein/proc/drop_ore()
+ for(var/type in ore_list)
+ var/quantity = ore_list[type]
+ new type(loc, quantity)
+
+/obj/structure/vein/proc/destroy_effect()
+ playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
+ visible_message("[src] collapses!\nOres spew out as the vein is destroyed!")
diff --git a/shiptest.dme b/shiptest.dme
index bee82466c4ed..5baa3b5f7d84 100644
--- a/shiptest.dme
+++ b/shiptest.dme
@@ -2357,6 +2357,7 @@
#include "code\modules\mining\minebot.dm"
#include "code\modules\mining\mint.dm"
#include "code\modules\mining\money_bag.dm"
+#include "code\modules\mining\ore_veins.dm"
#include "code\modules\mining\ores_coins.dm"
#include "code\modules\mining\satchel_ore_boxdm.dm"
#include "code\modules\mining\shelters.dm"
From b24e03a2aa971085214da33b3419aa778960a01a Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Sat, 28 Oct 2023 04:49:37 -0400
Subject: [PATCH 04/56] Spawner changes and polish
---
code/datums/components/spawner.dm | 41 +++++++++-
code/game/objects/structures/spawner.dm | 4 +-
code/modules/mining/drill.dm | 52 +++++++++---
code/modules/mining/ore_veins.dm | 80 +++++++++++++++----
.../living/simple_animal/hostile/hostile.dm | 8 +-
5 files changed, 153 insertions(+), 32 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 0b2794898e13..d15ad6c6eb62 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -7,9 +7,11 @@
var/list/spawn_text = list("emerges from")
var/list/faction = list("mining")
var/list/spawn_sound = list()
+ var/spawn_distance_min = 1
+ var/spawn_distance_max = 1
-/datum/component/spawner/Initialize(_mob_types, _spawn_time, _faction, _spawn_text, _max_mobs, _spawn_sound)
+/datum/component/spawner/Initialize(_mob_types, _spawn_time, _faction, _spawn_text, _max_mobs, _spawn_sound, _spawn_distance_min, _spawn_distance_max)
if(_spawn_time)
spawn_time=_spawn_time
if(_mob_types)
@@ -22,6 +24,10 @@
max_mobs=_max_mobs
if(_spawn_sound)
spawn_sound=_spawn_sound
+ if(_spawn_distance_min)
+ spawn_distance_min=_spawn_distance_min
+ if(_spawn_distance_max)
+ spawn_distance_max=_spawn_distance_max
RegisterSignal(parent, list(COMSIG_PARENT_QDELETING), .proc/stop_spawning)
START_PROCESSING(SSprocessing, src)
@@ -41,13 +47,20 @@
/datum/component/spawner/proc/try_spawn_mob()
var/atom/P = parent
+ var/turf/spot = P.loc
if(spawned_mobs.len >= max_mobs)
return 0
if(spawn_delay > world.time)
return 0
+ //Avoid using this with spawners that add this component on initialize
+ //It causes numerous runtime errors during planet generation
+ if(spawn_distance_max > 1)
+ spot = pick(turf_peel(spawn_distance_max, spawn_distance_min, P.loc, view_based = TRUE))
+ if(!spot)
+ spot = pick(circlerangeturfs(P.loc, spawn_distance_max))
spawn_delay = world.time + spawn_time
var/chosen_mob_type = pickweight(mob_types)
- var/mob/living/simple_animal/L = new chosen_mob_type(P.loc)
+ var/mob/living/simple_animal/L = new chosen_mob_type(spot)
L.flags_1 |= (P.flags_1 & ADMIN_SPAWNED_1)
spawned_mobs += L
L.nest = src
@@ -55,3 +68,27 @@
P.visible_message("[L] [pick(spawn_text)] [P].")
if(length(spawn_sound))
playsound(P, pick(spawn_sound), 50, TRUE)
+
+/**
+ * Behaves like the orange() proc, but only looks in the outer range of the function (The "peel" of the orange).
+ * Can't think of a better place to put this.
+ * Credit to ArcaneMusic for this very handy proc
+ */
+/proc/turf_peel(outer_range, inner_range, center, view_based = FALSE)
+ var/list/peel = list()
+ var/list/outer
+ var/list/inner
+ if(view_based)
+ outer = circleviewturfs(center, outer_range)
+ inner = circleviewturfs(center, inner_range)
+ else
+ outer = circlerangeturfs(center, outer_range)
+ inner = circlerangeturfs(center, inner_range)
+ for(var/turf/possible_spawn in outer)
+ if(possible_spawn in inner)
+ continue
+ if(possible_spawn == /turf/closed)
+ continue
+ peel += possible_spawn
+ return peel
+
diff --git a/code/game/objects/structures/spawner.dm b/code/game/objects/structures/spawner.dm
index 572e150815c6..4166fdc4d5f3 100644
--- a/code/game/objects/structures/spawner.dm
+++ b/code/game/objects/structures/spawner.dm
@@ -42,10 +42,12 @@ GLOBAL_LIST_INIT(astroloot, list(
var/faction = list("hostile")
var/spawn_sound = list('sound/effects/break_stone.ogg')
var/spawner_type = /datum/component/spawner
+ var/spawn_distance_min = 1
+ var/spawn_distance_max = 1
/obj/structure/spawner/Initialize()
. = ..()
- AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound)
+ AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max)
/obj/structure/spawner/attack_animal(mob/living/simple_animal/M)
if(faction_check(faction, M.faction, FALSE)&&!M.client)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 3f19504f5c56..7721233129e8 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -3,9 +3,13 @@
desc = "It's like those drills you put in your hand but, like, way bigger."
icon = 'icons/obj/machines/drill.dmi'
icon_state = "deep_core_drill"
+ max_integrity = 250
+ integrity_failure = 0.25
density = TRUE
anchored = FALSE
use_power = NO_POWER_USE
+ layer = ABOVE_ALL_MOB_LAYER
+ armor = list("melee" = 50, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 90, "acid" = 90)
var/active = FALSE
var/obj/structure/vein/mining
@@ -15,6 +19,13 @@
. = ..()
soundloop = new(list(src), active)
+/obj/machinery/drill/process()
+ if(machine_stat & BROKEN || (active && !mining))
+ active = FALSE
+ update_overlays()
+ update_icon_state()
+ return
+
/obj/machinery/drill/Destroy()
QDEL_NULL(soundloop)
return ..()
@@ -51,14 +62,15 @@
to_chat(user, "[src] isn't sercured over an ore vein!")
return
if(!active)
- addtimer(CALLBACK(src, .proc/mine), 100)
playsound(src, 'sound/machines/click.ogg', 100, TRUE)
user.visible_message( \
"[user] activates [src].", \
"You hit the ignition button to activate [src].", \
"You hear a drill churn to life.")
+ start_mining()
active = TRUE
soundloop.start()
+ mining.begin_spawning()
update_icon_state()
update_overlays()
return
@@ -68,9 +80,9 @@
/obj/machinery/drill/update_icon_state()
if(anchored)
- /*if(BROKEN)
+ if(machine_stat == BROKEN)
icon_state = "deep_core_drill-deployed_broken"
- return ..()*/
+ return ..()
if(active)
icon_state = "deep_core_drill-active"
return ..()
@@ -78,9 +90,9 @@
icon_state = "deep_core_drill-idle"
return ..()
else
- /*if(BROKEN)
+ if(machine_stat == BROKEN)
icon_state = "deep_core_drill-broken"
- return ..()*/
+ return ..()
icon_state = "deep_core_drill"
return ..()
@@ -95,10 +107,28 @@
else
set_light(0)
+/obj/machinery/drill/proc/start_mining()
+ var/eta
+ if(mining.mining_charges >= 1)
+ eta = mining.mining_charges * 300
+ addtimer(CALLBACK(src, .proc/mine), 300)
+ say("Estimated time until vein depletion: [time2text(eta,"mm:ss")].")
+ else
+ say("Vein depleted.")
+ active = FALSE
+ soundloop.stop()
+ mining.deconstruct()
+ mining = null
+ update_icon_state()
+ update_overlays()
+
/obj/machinery/drill/proc/mine()
- mining.deconstruct()
- active = FALSE
- soundloop.stop()
- mining = null
- update_icon_state()
- update_overlays()
+ if(mining.mining_charges)
+ mining.mining_charges -= 1
+ mining.drop_ore()
+ start_mining()
+ else if(!mining.mining_charges)
+ say("Error: Vein Depleted")
+ active = FALSE
+ update_icon_state()
+ update_overlays()
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 99dc1a34eee1..b6d2c7969a18 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -4,33 +4,79 @@
icon_state = "geyser"
anchored = TRUE
layer = HIGH_TURF_LAYER
+ move_resist = INFINITY
- var/ore_list = list(
- /obj/item/stack/ore/uranium = 20,
- /obj/item/stack/ore/iron = 50,
- /obj/item/stack/ore/plasma = 25,
- /obj/item/stack/ore/silver = 20,
- /obj/item/stack/ore/gold = 10,
- /obj/item/stack/ore/diamond = 5,
- /obj/item/stack/ore/titanium = 30,
- )
+ var/mining_charges = 9
+ //Classification of the quality of possible ores within a vein, used to determine difficulty
+ var/vein_class = 1
+ //A weighted list of all possible ores that can generate in a vein
+ //The design process is that class 1 veins have a small chance of generating with class 2 ores and so on
+ //As higher class veins will be increasingly harder to mine
+ var/list/ore_list = list(
+ /obj/item/stack/ore/iron = 5,
+ /obj/item/stack/ore/plasma = 4,
+ /obj/item/stack/ore/silver = 1,
+ /obj/item/stack/ore/uranium = 1,
+ /obj/item/stack/ore/titanium = 1,
+ )
+ //The post initialize list of all possible drops from the vein
+ var/list/vein_contents = list()
+ //Mob spawning variables
+ var/max_mobs = 5
+ var/spawn_time = 100 //10 seconds
+ var/mob_types = list(
+ /mob/living/simple_animal/hostile/asteroid/goliath/beast/random = 50,
+ /mob/living/simple_animal/hostile/asteroid/basilisk/watcher/random = 40,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/random = 30,
+ /mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
+ /mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient/crystal = 1,
+ /mob/living/simple_animal/hostile/asteroid/basilisk/watcher/forgotten = 1,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/crystal = 1,
+ )
+ var/spawn_text = "emerges from"
+ var/faction = list("hostile")
+ var/spawn_sound = list('sound/effects/break_stone.ogg')
+ var/spawner_type = /datum/component/spawner
+ var/spawn_distance_min = 5
+ var/spawn_distance_max = 7
+
+//Generates amount of ore able to be pulled from the vein (mining_charges) and types of ore within it (vein_contents)
/obj/structure/vein/Initialize()
. = ..()
- for(var/type in ore_list)
- var/chance = rand(0, ore_list[type])
- ore_list[type] = chance
+ var/ore_type_amount
+ mining_charges = rand(round(mining_charges/1.5),mining_charges*1.5)
+ switch(vein_class)
+ if(1)
+ ore_type_amount = rand(1,3)
+ if(2)
+ ore_type_amount = rand(3,5)
+ if(3)
+ ore_type_amount = rand(4,6)
+ else
+ ore_type_amount = 1
+ for(ore_type_amount, ore_type_amount>0, ore_type_amount--)
+ var/picked
+ picked = pickweight(ore_list)
+ vein_contents.Add(picked)
+ ore_list.Remove(picked)
/obj/structure/vein/deconstruct(disassembled)
destroy_effect()
- drop_ore()
return..()
+/obj/structure/vein/proc/begin_spawning()
+ AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max)
+
+//Pulls a random ore from the vein list per vein_class
/obj/structure/vein/proc/drop_ore()
- for(var/type in ore_list)
- var/quantity = ore_list[type]
- new type(loc, quantity)
+ var/class
+ class = vein_class
+ for(class, class>0, class--)
+ var/picked
+ picked = pick(vein_contents)
+ new picked(loc,rand(5,10))
/obj/structure/vein/proc/destroy_effect()
playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
- visible_message("[src] collapses!\nOres spew out as the vein is destroyed!")
+ visible_message("[src] collapses!")
diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm
index 106c9ad54f60..36bb76131cc7 100644
--- a/code/modules/mob/living/simple_animal/hostile/hostile.dm
+++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm
@@ -148,7 +148,7 @@
if(!search_objects)
. = hearers(vision_range, target_from) - src //Remove self, so we don't suicide
- var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha))
+ var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha, /obj/machinery/drill))
. += typecache_filter_list(view(vision_range, targets_from), hostile_machines)
@@ -246,6 +246,12 @@
return FALSE
return TRUE
+ if(istype(the_target, /obj/machinery/drill))
+ var/obj/machinery/drill/drill = the_target
+ if(drill.active)
+ return TRUE
+ return FALSE
+
if(isobj(the_target))
if(attack_all_objects || is_type_in_typecache(the_target, wanted_objects))
return TRUE
From 5e7e65dea5ff3e756d594461195970ac88738d6c Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Sun, 29 Oct 2023 03:50:31 -0400
Subject: [PATCH 05/56] Malfunctions part 1
---
code/modules/mining/drill.dm | 33 +++++++++++++++++--
code/modules/mining/ore_veins.dm | 8 ++---
.../living/simple_animal/hostile/hostile.dm | 6 ++--
3 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 7721233129e8..c8a89ea9ffee 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -1,16 +1,22 @@
+#define MALF_LASER 1
+#define MALF_SENSOR 2
+#define MALF_CAPACITOR 3
+#define MALF_STRUCTURAL 4
+#define MALF_CALIBRATE 5
+
/obj/machinery/drill
name = "big-ass ore drill"
desc = "It's like those drills you put in your hand but, like, way bigger."
icon = 'icons/obj/machines/drill.dmi'
icon_state = "deep_core_drill"
- max_integrity = 250
- integrity_failure = 0.25
+ max_integrity = 400
density = TRUE
anchored = FALSE
use_power = NO_POWER_USE
layer = ABOVE_ALL_MOB_LAYER
armor = list("melee" = 50, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 90, "acid" = 90)
+ var/malfunction
var/active = FALSE
var/obj/structure/vein/mining
var/datum/looping_sound/drill/soundloop
@@ -30,6 +36,10 @@
QDEL_NULL(soundloop)
return ..()
+/obj/machinery/drill/deconstruct(disassembled)
+ obj_break()
+ update_icon_state()
+
/obj/machinery/drill/attackby(obj/item/tool, mob/living/user, params)
var/obj/structure/vein/vein = locate(/obj/structure/vein) in src.loc
if(tool.tool_behaviour == TOOL_WRENCH)
@@ -109,10 +119,19 @@
/obj/machinery/drill/proc/start_mining()
var/eta
+ if(obj_integrity <= max_integrity/2)
+ malfunction += rand(1,5)
+ say("Error: Drill malfunction detected!")
+ malfunction(malfunction)
+ active = FALSE
+ update_icon_state()
+ update_overlays()
+ return
if(mining.mining_charges >= 1)
eta = mining.mining_charges * 300
addtimer(CALLBACK(src, .proc/mine), 300)
say("Estimated time until vein depletion: [time2text(eta,"mm:ss")].")
+ return
else
say("Vein depleted.")
active = FALSE
@@ -127,8 +146,16 @@
mining.mining_charges -= 1
mining.drop_ore()
start_mining()
- else if(!mining.mining_charges)
+ else if(!mining.mining_charges) //Extra check to prevent vein related errors locking us in place
say("Error: Vein Depleted")
active = FALSE
update_icon_state()
update_overlays()
+
+/obj/machinery/drill/proc/malfunction(var/malfunction_type)
+ switch(malfunction_type)
+ if(MALF_LASER)
+ if(MALF_SENSOR)
+ if(MALF_CAPACITOR)
+ if(MALF_STRUCTURAL)
+ if(MALF_CALIBRATE)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index b6d2c7969a18..8310a835ab27 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -26,19 +26,19 @@
var/spawn_time = 100 //10 seconds
var/mob_types = list(
/mob/living/simple_animal/hostile/asteroid/goliath/beast/random = 50,
- /mob/living/simple_animal/hostile/asteroid/basilisk/watcher/random = 40,
+ /*/mob/living/simple_animal/hostile/asteroid/basilisk/watcher/random = 40,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/random = 30,
/mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
/mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient/crystal = 1,
/mob/living/simple_animal/hostile/asteroid/basilisk/watcher/forgotten = 1,
- /mob/living/simple_animal/hostile/asteroid/hivelord/legion/crystal = 1,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/crystal = 1,*/
)
var/spawn_text = "emerges from"
var/faction = list("hostile")
var/spawn_sound = list('sound/effects/break_stone.ogg')
var/spawner_type = /datum/component/spawner
- var/spawn_distance_min = 5
- var/spawn_distance_max = 7
+ var/spawn_distance_min = 4
+ var/spawn_distance_max = 6
//Generates amount of ore able to be pulled from the vein (mining_charges) and types of ore within it (vein_contents)
diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm
index 36bb76131cc7..858636a3011e 100644
--- a/code/modules/mob/living/simple_animal/hostile/hostile.dm
+++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm
@@ -148,9 +148,11 @@
if(!search_objects)
. = hearers(vision_range, target_from) - src //Remove self, so we don't suicide
- var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha, /obj/machinery/drill))
+ var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha))
+ var/static/mining_drills = typecacheof(list(/obj/machinery/drill))
. += typecache_filter_list(view(vision_range, targets_from), hostile_machines)
+ . += typecache_filter_list(view(vision_range*2, targets_from), mining_drills)
for(var/HM in typecache_filter_list(range(vision_range, target_from), hostile_machines))
if(can_see(target_from, HM, vision_range))
@@ -588,7 +590,7 @@
toggle_ai(AI_ON)
/mob/living/simple_animal/hostile/proc/ListTargetsLazy(virtual_z)//Step 1, find out what we can see
- var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha)) //WS - add spacepod
+ var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha, /obj/machinery/drill)) //WS - add spacepod
. = list()
for (var/mob/M as anything in LAZYACCESS(SSmobs.players_by_virtual_z, "[virtual_z]"))
if (get_dist(M, src) < vision_range)
From ddcedd8ad57915c63ff864b977bea7065431c4ca Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Mon, 30 Oct 2023 01:47:46 -0400
Subject: [PATCH 06/56] Hate
---
code/modules/mining/drill.dm | 109 +++++++++++++++++++++++----
code/modules/mining/ore_veins.dm | 10 +--
code/modules/research/stock_parts.dm | 1 +
3 files changed, 102 insertions(+), 18 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index c8a89ea9ffee..6abb6ed4bc1b 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -15,19 +15,37 @@
use_power = NO_POWER_USE
layer = ABOVE_ALL_MOB_LAYER
armor = list("melee" = 50, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 90, "acid" = 90)
+ component_parts = list()
var/malfunction
var/active = FALSE
var/obj/structure/vein/mining
var/datum/looping_sound/drill/soundloop
+ var/obj/item/stock_parts/cell/cell
+ var/preload_cell_type = /obj/item/stock_parts/cell
+ var/power_cost = 50
+
+ var/debug_laser_var = /obj/item/stock_parts/micro_laser //REMOVE BEFORE PRING
+ var/debug_sensor_var = /obj/item/stock_parts/scanning_module
+ var/debug_capacitor_var = /obj/item/stock_parts/capacitor
+
/obj/machinery/drill/Initialize()
. = ..()
+ component_parts += new /obj/item/stock_parts/capacitor(null)
+ component_parts += new /obj/item/stock_parts/micro_laser(null)
+ component_parts += new /obj/item/stock_parts/scanning_module(null)
+ if(preload_cell_type)
+ if(!ispath(preload_cell_type,/obj/item/stock_parts/cell))
+ log_mapping("[src] at [AREACOORD(src)] had an invalid preload_cell_type: [preload_cell_type].")
+ else
+ cell = new preload_cell_type(src)
soundloop = new(list(src), active)
/obj/machinery/drill/process()
if(machine_stat & BROKEN || (active && !mining))
active = FALSE
+ soundloop.stop()
update_overlays()
update_icon_state()
return
@@ -40,6 +58,9 @@
obj_break()
update_icon_state()
+/obj/machinery/drill/get_cell()
+ return cell
+
/obj/machinery/drill/attackby(obj/item/tool, mob/living/user, params)
var/obj/structure/vein/vein = locate(/obj/structure/vein) in src.loc
if(tool.tool_behaviour == TOOL_WRENCH)
@@ -64,10 +85,43 @@
mining = null
update_icon_state()
return
+ if(default_deconstruction_screwdriver(user,"deep_core_drill","deep_core_drill",tool))
+ return TRUE
+ if(panel_open)
+ /*var/list/needed_parts = list(/obj/item/stock_parts/scanning_module,/obj/item/stock_parts/micro_laser,/obj/item/stock_parts/capacitor)
+ if(is_type_in_list(tool,needed_parts))
+ for(var/obj/item/stock_parts/part in component_parts)
+ var/obj/item/stock_parts/new_part = tool
+ if(new_part.part_behaviour == part.part_behaviour)
+ if(new_part.rating > part.rating)*/
+
+
+
+
+ /*var/obj/item/stock_parts/new_part = tool
+ for(var/obj/item/stock_parts/part in component_parts)
+ if(new_part.parent_type == part.parent_type || istype(new_part,part))
+ if(new_part.rating > part.rating)
+ component_parts.Remove(part)
+ component_parts.Add(new_part)
+ to_chat(user, "You swap the drill's [part] with a [tool].")
+ return
+ else
+ to_chat(user, "The [part] doesn't need replacing.")
+ return
+ else
+ new_part.forceMove(component_parts)
+ /*component_parts.Add(new_part)*/
+ malfunction = null*/
+
+
return ..()
/obj/machinery/drill/interact(mob/user, special_state)
. = ..()
+ if(malfunction)
+ say("Please resolve existing malfunction before continuing mining operations.")
+ return
if(!mining)
to_chat(user, "[src] isn't sercured over an ore vein!")
return
@@ -78,11 +132,6 @@
"You hit the ignition button to activate [src].", \
"You hear a drill churn to life.")
start_mining()
- active = TRUE
- soundloop.start()
- mining.begin_spawning()
- update_icon_state()
- update_overlays()
return
else
to_chat(user, "[src] is currently busy, wait till it's done!")
@@ -90,7 +139,7 @@
/obj/machinery/drill/update_icon_state()
if(anchored)
- if(machine_stat == BROKEN)
+ if(machine_stat && BROKEN)
icon_state = "deep_core_drill-deployed_broken"
return ..()
if(active)
@@ -100,7 +149,7 @@
icon_state = "deep_core_drill-idle"
return ..()
else
- if(machine_stat == BROKEN)
+ if(machine_stat && BROKEN)
icon_state = "deep_core_drill-broken"
return ..()
icon_state = "deep_core_drill"
@@ -119,17 +168,31 @@
/obj/machinery/drill/proc/start_mining()
var/eta
+ var/power_use
+ for(var/obj/item/stock_parts/capacitor/capacitor in component_parts)
+ power_use = power_cost/capacitor.rating
+ if(cell.charge < power_use)
+ say("Error: Internal cell charge deplted")
+ active = FALSE
+ soundloop.stop()
+ return
if(obj_integrity <= max_integrity/2)
- malfunction += rand(1,5)
- say("Error: Drill malfunction detected!")
+ malfunction = rand(1,5)
malfunction(malfunction)
active = FALSE
update_icon_state()
update_overlays()
return
if(mining.mining_charges >= 1)
- eta = mining.mining_charges * 300
- addtimer(CALLBACK(src, .proc/mine), 300)
+ var/mine_time
+ active = TRUE
+ soundloop.start()
+ mining.begin_spawning()
+ for(var/obj/item/stock_parts/micro_laser/laser in component_parts)
+ mine_time = round((300/sqrt(laser.rating)))
+ eta = mine_time*mining.mining_charges
+ cell.use(power_use)
+ addtimer(CALLBACK(src, .proc/mine), mine_time)
say("Estimated time until vein depletion: [time2text(eta,"mm:ss")].")
return
else
@@ -142,9 +205,12 @@
update_overlays()
/obj/machinery/drill/proc/mine()
+ var/sensor_rating
+ for(var/obj/item/stock_parts/scanning_module/sensor in component_parts)
+ sensor_rating = sensor.rating
if(mining.mining_charges)
mining.mining_charges -= 1
- mining.drop_ore()
+ mining.drop_ore(round(sqrt(sensor_rating), 0.1))
start_mining()
else if(!mining.mining_charges) //Extra check to prevent vein related errors locking us in place
say("Error: Vein Depleted")
@@ -152,10 +218,27 @@
update_icon_state()
update_overlays()
-/obj/machinery/drill/proc/malfunction(var/malfunction_type)
+/obj/machinery/drill/proc/malfunction(malfunction_type)
switch(malfunction_type)
if(MALF_LASER)
+ say("Malfunction: Laser array damaged, please replace before continuing mining operations.")
+ for (var/obj/item/stock_parts/micro_laser/laser in component_parts)
+ component_parts.Remove(laser)
+ return
if(MALF_SENSOR)
+ say("Malfunction: Ground penetrating scanner damaged, please replace before continuing mining operations.")
+ for (var/obj/item/stock_parts/scanning_module/sensor in component_parts)
+ component_parts.Remove(sensor)
+ return
if(MALF_CAPACITOR)
+ say("Malfunction: Energy cell capacitor damaged, please replace before continuin mining operations.")
+ for (var/obj/item/stock_parts/capacitor/capacitor in component_parts)
+ component_parts.Remove(capacitor)
+ return
if(MALF_STRUCTURAL)
+ say("Malfunction: Drill plating damaged, provide structural repairs before continuing mining operations.")
+ /*playsound()*/
+ return
if(MALF_CALIBRATE)
+ say("Malfunction: Drill laser calibrations out of alignment, please recalibrate before continuing.")
+ return
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 8310a835ab27..f72de2dc54ce 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -26,15 +26,15 @@
var/spawn_time = 100 //10 seconds
var/mob_types = list(
/mob/living/simple_animal/hostile/asteroid/goliath/beast/random = 50,
- /*/mob/living/simple_animal/hostile/asteroid/basilisk/watcher/random = 40,
+ /mob/living/simple_animal/hostile/asteroid/basilisk/watcher/random = 40,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/random = 30,
/mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
/mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient/crystal = 1,
/mob/living/simple_animal/hostile/asteroid/basilisk/watcher/forgotten = 1,
- /mob/living/simple_animal/hostile/asteroid/hivelord/legion/crystal = 1,*/
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/crystal = 1,
)
var/spawn_text = "emerges from"
- var/faction = list("hostile")
+ var/faction = list("hostile","mining")
var/spawn_sound = list('sound/effects/break_stone.ogg')
var/spawner_type = /datum/component/spawner
var/spawn_distance_min = 4
@@ -69,13 +69,13 @@
AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max)
//Pulls a random ore from the vein list per vein_class
-/obj/structure/vein/proc/drop_ore()
+/obj/structure/vein/proc/drop_ore(multiplier)
var/class
class = vein_class
for(class, class>0, class--)
var/picked
picked = pick(vein_contents)
- new picked(loc,rand(5,10))
+ new picked(loc,round(rand(5,10)*multiplier))
/obj/structure/vein/proc/destroy_effect()
playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
diff --git a/code/modules/research/stock_parts.dm b/code/modules/research/stock_parts.dm
index ccddbdb3eb22..95680c691d9c 100644
--- a/code/modules/research/stock_parts.dm
+++ b/code/modules/research/stock_parts.dm
@@ -1,6 +1,7 @@
/*Power cells are in code\modules\power\cell.dm
If you create T5+ please take a pass at gene_modder.dm [L40]. Max_values MUST fit with the clamp to not confuse the user or cause possible exploits.*/
+
/obj/item/storage/part_replacer
name = "rapid part exchange device"
desc = "Special mechanical module made to store, sort, and apply standard machine parts."
From 7506e2356f8bf2f195a1d91fdbc2cb5808a45c8a Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Mon, 30 Oct 2023 23:17:22 -0400
Subject: [PATCH 07/56] Beware: Nearing Completion
---
code/datums/components/spawner.dm | 2 +-
.../datums/looping_sounds/machinery_sounds.dm | 3 +-
code/datums/mapgen/planetary/LavaGenerator.dm | 10 +-
code/datums/mapgen/planetary/RockGenerator.dm | 6 +
code/datums/mapgen/planetary/SnowGenerator.dm | 20 ++-
code/modules/mining/drill.dm | 123 +++++++++++++-----
.../mining/equipment/mineral_scanner.dm | 2 +-
code/modules/mining/ore_veins.dm | 50 +++++--
8 files changed, 168 insertions(+), 48 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index d15ad6c6eb62..cecf0fd62f14 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -87,7 +87,7 @@
for(var/turf/possible_spawn in outer)
if(possible_spawn in inner)
continue
- if(possible_spawn == /turf/closed)
+ if(istype(possible_spawn, /turf/closed))
continue
peel += possible_spawn
return peel
diff --git a/code/datums/looping_sounds/machinery_sounds.dm b/code/datums/looping_sounds/machinery_sounds.dm
index 82c7b65ad315..dd05aca8ed44 100644
--- a/code/datums/looping_sounds/machinery_sounds.dm
+++ b/code/datums/looping_sounds/machinery_sounds.dm
@@ -77,4 +77,5 @@
/datum/looping_sound/drill
mid_sounds = list('sound/machines/gravgen/gravgen_mid1.ogg'=1, 'sound/machines/gravgen/gravgen_mid2.ogg'=1, 'sound/machines/gravgen/gravgen_mid3.ogg'=1, 'sound/machines/gravgen/gravgen_mid4.ogg'=1)
mid_length = 4
- volume = 60
+ volume = 50
+ extra_range = 6
diff --git a/code/datums/mapgen/planetary/LavaGenerator.dm b/code/datums/mapgen/planetary/LavaGenerator.dm
index 6e6d4d898ac1..366773ebd0ea 100644
--- a/code/datums/mapgen/planetary/LavaGenerator.dm
+++ b/code/datums/mapgen/planetary/LavaGenerator.dm
@@ -96,9 +96,12 @@
)
feature_spawn_chance = 0.3
feature_spawn_list = list(
- /obj/structure/flora/rock/hell = 10,
+ /obj/structure/flora/rock/hell = 14,
+ /obj/structure/vein = 5,
+ /obj/structure/vein/classtwo = 2,
/obj/structure/elite_tumor = 2,
/obj/structure/geyser/random = 2,
+ /obj/structure/vein/classthree = 1,
/obj/effect/spawner/lootdrop/anomaly/lava = 1,
)
@@ -161,7 +164,10 @@
feature_spawn_list = list(
/obj/structure/flora/tree/dead/barren = 50,
/obj/structure/flora/tree/dead/tall/grey = 45,
- /obj/effect/spawner/lootdrop/anomaly/lava = 5
+ /obj/effect/spawner/lootdrop/anomaly/lava = 10,
+ /obj/structure/vein = 5,
+ /obj/structure/vein/classtwo = 2,
+ /obj/structure/vein/classthree = 1,
)
/datum/biome/lavaland/plains/dense/mixed
diff --git a/code/datums/mapgen/planetary/RockGenerator.dm b/code/datums/mapgen/planetary/RockGenerator.dm
index 61578c7a3ace..95e1273bb9d7 100644
--- a/code/datums/mapgen/planetary/RockGenerator.dm
+++ b/code/datums/mapgen/planetary/RockGenerator.dm
@@ -86,8 +86,11 @@
feature_spawn_chance = 0.25
feature_spawn_list = list(
/obj/structure/geyser/random = 80,
+ /obj/structure/vein = 60,
/obj/structure/elite_tumor = 40,
+ /obj/structure/vein/classtwo = 40,
/obj/effect/spawner/lootdrop/anomaly/rock = 10,
+ /obj/structure/vein/classthree = 10,
/obj/effect/spawner/lootdrop/anomaly/big = 1 //get out of here stalker
)
@@ -147,8 +150,11 @@
)
feature_spawn_chance = 0.5
feature_spawn_list = list(
+ /obj/structure/vein = 3,
/obj/structure/geyser/random = 2,
+ /obj/structure/vein/classtwo = 2,
/obj/structure/elite_tumor = 1,
+ /obj/structure/vein/classthree = 1,
/obj/structure/spawner/ice_moon/rockplanet = 4,
/obj/effect/spawner/lootdrop/anomaly/rock/cave = 1,
)
diff --git a/code/datums/mapgen/planetary/SnowGenerator.dm b/code/datums/mapgen/planetary/SnowGenerator.dm
index 05661009b52d..acd472c86151 100644
--- a/code/datums/mapgen/planetary/SnowGenerator.dm
+++ b/code/datums/mapgen/planetary/SnowGenerator.dm
@@ -116,7 +116,10 @@
/obj/effect/spawner/lootdrop/anomaly/big = 1,
/obj/structure/spawner/ice_moon/demonic_portal/low_threat = 25,
/obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 50,
- /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 13
+ /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 13,
+ /obj/structure/vein = 25,
+ /obj/structure/vein/classtwo = 50,
+ /obj/structure/vein/classthree = 10,
)
/datum/biome/snow/lush
@@ -167,7 +170,10 @@
/obj/structure/spawner/ice_moon = 3,
/obj/structure/spawner/ice_moon/polarbear = 3,
/obj/structure/statue/snow/snowman = 3,
- /obj/structure/statue/snow/snowlegion = 1
+ /obj/structure/statue/snow/snowlegion = 1,
+ /obj/structure/vein = 3,
+ /obj/structure/vein/classtwo = 4,
+ /obj/structure/vein/classthree = 1,
)
mob_spawn_list = list(
/mob/living/simple_animal/hostile/asteroid/wolf/random = 30,
@@ -212,7 +218,10 @@
/obj/structure/spawner/ice_moon/demonic_portal/low_threat = 300,
/obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 500,
/obj/structure/spawner/ice_moon/demonic_portal/high_threat = 50,
- /obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 1
+ /obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 1,
+ /obj/structure/vein = 300,
+ /obj/structure/vein/classtwo = 500,
+ /obj/structure/vein/classthree = 50,
)
@@ -266,7 +275,10 @@
/obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 2,
/obj/structure/spawner/ice_moon = 30,
/obj/structure/spawner/ice_moon/polarbear = 30,
- /obj/effect/spawner/lootdrop/anomaly/ice/cave = 10
+ /obj/effect/spawner/lootdrop/anomaly/ice/cave = 10,
+ /obj/structure/vein = 30,
+ /obj/structure/vein/classtwo = 50,
+ /obj/structure/vein/classthree = 6,
)
/datum/biome/cave/snow/thawed
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 6abb6ed4bc1b..2cc0a9e6790a 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -1,15 +1,20 @@
+//For handling the types of randomized malfunctions
#define MALF_LASER 1
#define MALF_SENSOR 2
#define MALF_CAPACITOR 3
#define MALF_STRUCTURAL 4
#define MALF_CALIBRATE 5
+//For handling the repair of a completely destroyed drill
+#define METAL_PLACED 1
+#define METAL_SECURED 2
+
/obj/machinery/drill
name = "big-ass ore drill"
desc = "It's like those drills you put in your hand but, like, way bigger."
icon = 'icons/obj/machines/drill.dmi'
icon_state = "deep_core_drill"
- max_integrity = 400
+ max_integrity = 200
density = TRUE
anchored = FALSE
use_power = NO_POWER_USE
@@ -24,11 +29,19 @@
var/obj/item/stock_parts/cell/cell
var/preload_cell_type = /obj/item/stock_parts/cell
var/power_cost = 50
+ var/metal_attached
- var/debug_laser_var = /obj/item/stock_parts/micro_laser //REMOVE BEFORE PRING
- var/debug_sensor_var = /obj/item/stock_parts/scanning_module
- var/debug_capacitor_var = /obj/item/stock_parts/capacitor
-
+/obj/machinery/drill/examine(mob/user)
+ . = ..()
+ if(panel_open && component_parts)
+ . += display_parts(user, TRUE)
+ if(cell.charge < power_cost*5)
+ . += "The lower power light is blinking."
+ switch(malfunction)
+ if(4)
+ . += "The drill's structure looks like it needs to be welded back together."
+ if(5)
+ . += "The drill's gimbal is out of alignment, it needs to be recalibrated with a multitool."
/obj/machinery/drill/Initialize()
. = ..()
@@ -55,15 +68,39 @@
return ..()
/obj/machinery/drill/deconstruct(disassembled)
+ if(active && mining)
+ say("Drill integrity failure, comencing emergency shutdown procedure.")
+ mining.deconstruct() //Just to make sure mobs don't spawn infinitely from the vein and as a failure state for players
obj_break()
update_icon_state()
+ update_overlays()
/obj/machinery/drill/get_cell()
return cell
/obj/machinery/drill/attackby(obj/item/tool, mob/living/user, params)
var/obj/structure/vein/vein = locate(/obj/structure/vein) in src.loc
+ if(machine_stat && BROKEN)
+ if(istype(tool,/obj/item/stack/sheet/plasteel))
+ var/obj/item/stack/sheet/plasteel/plating = tool
+ if(plating.use(10,FALSE,TRUE))
+ metal_attached = METAL_PLACED
+ to_chat(user, "You prepare to attach the plating to [src].")
+ return
+ if(tool.tool_behaviour == TOOL_WELDER && do_after(user, 30*tool.toolspeed, target = src))
+ playsound(src, 'sound/items/welder2.ogg', 50, TRUE)
+ to_chat(user, "You weld the new plating onto the [src], successfully repairing it.")
+ metal_attached = null
+ machine_stat = null
+ obj_integrity = max_integrity
+ update_icon_state()
+ return
if(tool.tool_behaviour == TOOL_WRENCH)
+ if(metal_attached && machine_stat && BROKEN)
+ playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
+ do_after(user, 30*tool.toolspeed, target = src)
+ to_chat(user, "You bolt the plating the plating in place on [src].")
+ return
if(!vein && !anchored)
to_chat(user, "[src] must be on top of an ore vein.")
return
@@ -71,50 +108,73 @@
to_chat(user, "[src] can't be unsecured while it's running!")
return
playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
- if(!anchored && do_after(user, 30, target = src))
+ if(!anchored && do_after(user, 30*tool.toolspeed, target = src))
to_chat(user, "You secure the [src] to the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
mining = vein
anchored = TRUE
update_icon_state()
return
- if(do_after(user, 30, target = src))
+ if(do_after(user, 30*tool.toolspeed, target = src))
to_chat(user, "You unsecure the [src] from the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
anchored = FALSE
mining = null
update_icon_state()
return
- if(default_deconstruction_screwdriver(user,"deep_core_drill","deep_core_drill",tool))
+ if(default_deconstruction_screwdriver(user,icon_state,icon_state,tool))
return TRUE
if(panel_open)
- /*var/list/needed_parts = list(/obj/item/stock_parts/scanning_module,/obj/item/stock_parts/micro_laser,/obj/item/stock_parts/capacitor)
+ var/list/needed_parts = list(/obj/item/stock_parts/scanning_module,/obj/item/stock_parts/micro_laser,/obj/item/stock_parts/capacitor)
if(is_type_in_list(tool,needed_parts))
for(var/obj/item/stock_parts/part in component_parts)
var/obj/item/stock_parts/new_part = tool
- if(new_part.part_behaviour == part.part_behaviour)
- if(new_part.rating > part.rating)*/
-
-
-
-
- /*var/obj/item/stock_parts/new_part = tool
- for(var/obj/item/stock_parts/part in component_parts)
if(new_part.parent_type == part.parent_type || istype(new_part,part))
- if(new_part.rating > part.rating)
- component_parts.Remove(part)
- component_parts.Add(new_part)
- to_chat(user, "You swap the drill's [part] with a [tool].")
- return
- else
- to_chat(user, "The [part] doesn't need replacing.")
- return
+ user.transferItemToLoc(tool,src)
+ part.forceMove(user.loc)
+ component_parts += new_part
+ component_parts -= part
+ break
else
- new_part.forceMove(component_parts)
- /*component_parts.Add(new_part)*/
- malfunction = null*/
-
-
+ user.transferItemToLoc(tool,src)
+ component_parts += new_part
+ malfunction = null
+ obj_integrity = max_integrity
+ break
+ return
+ if(tool.tool_behaviour == TOOL_MULTITOOL && malfunction == MALF_CALIBRATE)
+ playsound()
+ do_after(user,(100*tool.toolspeed),src)
+ malfunction = null
+ obj_integrity = max_integrity
+ return
+ if(tool.tool_behaviour == TOOL_WELDER && malfunction == MALF_STRUCTURAL)
+ playsound()
+ do_after(user,(100*tool.toolspeed),src)
+ malfunction = null
+ obj_integrity = max_integrity
+ return
+ if(istype(tool, /obj/item/stock_parts/cell))
+ var/obj/item/stock_parts/cell/battery = tool
+ if(cell)
+ to_chat(user, "[src] already has a cell!")
+ else //This should literally never be tripped unless someone tries to put a watch battery in it or something, but just in case
+ if(battery.maxcharge < power_cost)
+ to_chat(user, "[src] requires a higher capacity cell.")
+ return
+ if(!user.transferItemToLoc(tool, src))
+ return
+ cell = tool
+ to_chat(user, "You install a cell in [src].")
+ return
+ if(tool.tool_behaviour == TOOL_CROWBAR)
+ cell.update_appearance()
+ cell.forceMove(get_turf(src))
+ cell = null
+ to_chat(user, "You remove the cell from [src].")
+ active = FALSE
+ update_appearance()
+ return
return ..()
/obj/machinery/drill/interact(mob/user, special_state)
@@ -175,6 +235,7 @@
say("Error: Internal cell charge deplted")
active = FALSE
soundloop.stop()
+ update_overlays()
return
if(obj_integrity <= max_integrity/2)
malfunction = rand(1,5)
@@ -189,7 +250,7 @@
soundloop.start()
mining.begin_spawning()
for(var/obj/item/stock_parts/micro_laser/laser in component_parts)
- mine_time = round((300/sqrt(laser.rating)))
+ mine_time = round((300/sqrt(laser.rating))*mining.mine_time_multiplier)
eta = mine_time*mining.mining_charges
cell.use(power_use)
addtimer(CALLBACK(src, .proc/mine), mine_time)
diff --git a/code/modules/mining/equipment/mineral_scanner.dm b/code/modules/mining/equipment/mineral_scanner.dm
index 87ed99c0d45b..63cfe41e48fd 100644
--- a/code/modules/mining/equipment/mineral_scanner.dm
+++ b/code/modules/mining/equipment/mineral_scanner.dm
@@ -37,7 +37,7 @@
qdel(src)
/obj/item/t_scanner/adv_mining_scanner
- desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations. This one has an extended range.\nIt has a speaker that can be toggled with alt+click"
+ desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations. This one has an extended range and a ground penetrating scanner.\nIt has a speaker that can be toggled with alt+click"
name = "advanced automatic mining scanner"
icon = 'icons/obj/device.dmi'
icon_state = "mining0"
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index f72de2dc54ce..ffab06b72859 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -6,7 +6,7 @@
layer = HIGH_TURF_LAYER
move_resist = INFINITY
- var/mining_charges = 9
+ var/mining_charges = 6
//Classification of the quality of possible ores within a vein, used to determine difficulty
var/vein_class = 1
//A weighted list of all possible ores that can generate in a vein
@@ -20,17 +20,18 @@
/obj/item/stack/ore/titanium = 1,
)
//The post initialize list of all possible drops from the vein
+ //Meant to be player facing in the form of mining scanners
var/list/vein_contents = list()
+ //Allows subtyped drills to determine how long it takes to mine one mining charge
+ var/mine_time_multiplier = 1
//Mob spawning variables
- var/max_mobs = 5
- var/spawn_time = 100 //10 seconds
+ var/max_mobs = 4
+ var/spawn_time = 150 //15 seconds
var/mob_types = list(
- /mob/living/simple_animal/hostile/asteroid/goliath/beast/random = 50,
- /mob/living/simple_animal/hostile/asteroid/basilisk/watcher/random = 40,
- /mob/living/simple_animal/hostile/asteroid/hivelord/legion/random = 30,
- /mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
+ /mob/living/simple_animal/hostile/asteroid/goliath/beast/random = 60,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/random = 20,
+ /mob/living/simple_animal/hostile/asteroid/brimdemon = 30,
/mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient/crystal = 1,
- /mob/living/simple_animal/hostile/asteroid/basilisk/watcher/forgotten = 1,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/crystal = 1,
)
var/spawn_text = "emerges from"
@@ -80,3 +81,36 @@
/obj/structure/vein/proc/destroy_effect()
playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
visible_message("[src] collapses!")
+
+
+/obj/structure/vein/classtwo
+ mining_charges = 9
+ vein_class = 2
+ ore_list = list(
+ /obj/item/stack/ore/iron = 6,
+ /obj/item/stack/ore/plasma = 5,
+ /obj/item/stack/ore/silver = 4,
+ /obj/item/stack/ore/uranium = 4,
+ /obj/item/stack/ore/titanium = 5,
+ /obj/item/stack/ore/diamond = 1,
+ /obj/item/stack/ore/gold = 2,
+ /obj/item/stack/ore/bluespace_crystal = 1,
+ )
+ max_mobs = 6
+ spawn_time = 100
+
+/obj/structure/vein/classthree
+ mining_charges = 12
+ vein_class = 3
+ ore_list = list(
+ /obj/item/stack/ore/iron = 5,
+ /obj/item/stack/ore/plasma = 5,
+ /obj/item/stack/ore/silver = 5,
+ /obj/item/stack/ore/uranium = 5,
+ /obj/item/stack/ore/titanium = 6,
+ /obj/item/stack/ore/diamond = 3,
+ /obj/item/stack/ore/gold = 5,
+ /obj/item/stack/ore/bluespace_crystal = 3,
+ )
+ max_mobs = 6 //Best not to go past 6 due to balance and lag reasons
+ spawn_time = 80
From e884e2a01aeb3a31bd49c725e928cba69c4f97a1 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Tue, 31 Oct 2023 02:35:11 -0400
Subject: [PATCH 08/56] Mission nightmare begins
---
code/modules/mining/drill.dm | 33 +++++---
.../modules/overmap/missions/drill_mission.dm | 75 +++++++++++++++++++
shiptest.dme | 1 +
3 files changed, 100 insertions(+), 9 deletions(-)
create mode 100644 code/modules/overmap/missions/drill_mission.dm
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 2cc0a9e6790a..c15cad400e77 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -10,8 +10,8 @@
#define METAL_SECURED 2
/obj/machinery/drill
- name = "big-ass ore drill"
- desc = "It's like those drills you put in your hand but, like, way bigger."
+ name = "heavy-duty laser mining drill"
+ desc = "A large scale laser drill. It's able to mine vast amounts of minerals from near-surface ore pockets, however the seismic activity tends to anger local fauna."
icon = 'icons/obj/machines/drill.dmi'
icon_state = "deep_core_drill"
max_integrity = 200
@@ -39,9 +39,16 @@
. += "The lower power light is blinking."
switch(malfunction)
if(4)
- . += "The drill's structure looks like it needs to be welded back together."
+ . += "The [src]'s structure looks like it needs to be welded back together."
if(5)
- . += "The drill's gimbal is out of alignment, it needs to be recalibrated with a multitool."
+ . += "The [src]'s gimbal is out of alignment, it needs to be recalibrated with a multitool."
+ switch(metal_attached)
+ if(METAL_PLACED)
+ . += "Replacement plating has been attached to [src], but has not been bolted in place yet."
+ if(METAL_SECURED)
+ . += "Replacement plating has been secured to [src], but still needs to be welded into place."
+ if(machine_stat && BROKEN && !metal_attached)
+ . += "[src]'s structure has been totaled, the plasteel plating needs to be replaced."
/obj/machinery/drill/Initialize()
. = ..()
@@ -67,10 +74,12 @@
QDEL_NULL(soundloop)
return ..()
+//Instead of being qdeled the drill requires mildly expensive repairs to use again
/obj/machinery/drill/deconstruct(disassembled)
if(active && mining)
say("Drill integrity failure, comencing emergency shutdown procedure.")
- mining.deconstruct() //Just to make sure mobs don't spawn infinitely from the vein and as a failure state for players
+ //Just to make sure mobs don't spawn infinitely from the vein and as a failure state for players
+ mining.deconstruct()
obj_break()
update_icon_state()
update_overlays()
@@ -87,7 +96,9 @@
metal_attached = METAL_PLACED
to_chat(user, "You prepare to attach the plating to [src].")
return
- if(tool.tool_behaviour == TOOL_WELDER && do_after(user, 30*tool.toolspeed, target = src))
+ else
+ to_chat(user, "You don't have enough plasteel to fix the plating.")
+ if(metal_attached == METAL_SECURED && tool.tool_behaviour == TOOL_WELDER && do_after(user, 30*tool.toolspeed, target = src))
playsound(src, 'sound/items/welder2.ogg', 50, TRUE)
to_chat(user, "You weld the new plating onto the [src], successfully repairing it.")
metal_attached = null
@@ -124,7 +135,7 @@
return
if(default_deconstruction_screwdriver(user,icon_state,icon_state,tool))
return TRUE
- if(panel_open)
+ if(panel_open) //All malfunction repair and maintenance actions are handled under here
var/list/needed_parts = list(/obj/item/stock_parts/scanning_module,/obj/item/stock_parts/micro_laser,/obj/item/stock_parts/capacitor)
if(is_type_in_list(tool,needed_parts))
for(var/obj/item/stock_parts/part in component_parts)
@@ -177,6 +188,7 @@
return
return ..()
+//Can we even turn the damn thing on?
/obj/machinery/drill/interact(mob/user, special_state)
. = ..()
if(malfunction)
@@ -226,6 +238,7 @@
else
set_light(0)
+//Handles all checks before starting the 30 second (on average) mining tick
/obj/machinery/drill/proc/start_mining()
var/eta
var/power_use
@@ -237,7 +250,7 @@
soundloop.stop()
update_overlays()
return
- if(obj_integrity <= max_integrity/2)
+ if(obj_integrity <= max_integrity/2.5)
malfunction = rand(1,5)
malfunction(malfunction)
active = FALSE
@@ -265,12 +278,13 @@
update_icon_state()
update_overlays()
+//Handles the process of withdrawing ore from the vein itself
/obj/machinery/drill/proc/mine()
var/sensor_rating
for(var/obj/item/stock_parts/scanning_module/sensor in component_parts)
sensor_rating = sensor.rating
if(mining.mining_charges)
- mining.mining_charges -= 1
+ mining.mining_charges--
mining.drop_ore(round(sqrt(sensor_rating), 0.1))
start_mining()
else if(!mining.mining_charges) //Extra check to prevent vein related errors locking us in place
@@ -279,6 +293,7 @@
update_icon_state()
update_overlays()
+//Overly long proc to handle the unique properties for each malfunction type
/obj/machinery/drill/proc/malfunction(malfunction_type)
switch(malfunction_type)
if(MALF_LASER)
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
new file mode 100644
index 000000000000..12ccbd32a19f
--- /dev/null
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -0,0 +1,75 @@
+/datum/mission/drill
+ name = "Class 2 core sample mission"
+ desc = "We require geological information from one of the neighboring planetoids . \
+ Please anchor the drill in place and defend it until it has gathered enough smaples.\
+ Operation of the core sampling drill is extremely dangerous, use caution. "
+ value = 3000
+ duration = 80 MINUTES
+ weight = 10
+
+ var/obj/machinery/drill/research/sampler
+ var/num_wanted = 10
+ var/class_wanted = 2
+
+/datum/mission/drill/New(...)
+ num_wanted = rand(num_wanted-2,num_wanted+2)
+ value += num_wanted*100
+
+/datum/mission/drill/can_complete()
+ . = ..()
+ if(!.)
+ return
+ var/obj/docking_port/mobile/scanner_port = SSshuttle.get_containing_shuttle(sampler)
+ return . && (sampler.num_current >= num_wanted) && (scanner_port?.current_ship == servant)
+
+/datum/mission/drill/get_progress_string()
+ return "[sampler.num_current]/[num_wanted]"
+
+/datum/mission/research/accept(datum/overmap/ship/controlled/acceptor, turf/accept_loc)
+ . = ..()
+ sampler = spawn_bound(/obj/machinery/drill/mission, accept_loc, VARSET_CALLBACK(src, sampler, null))
+
+/datum/mission/drill/Destroy()
+ sampler = null
+ return ..()
+
+/datum/mission/drill/turn_in()
+ recall_bound(sampler)
+ return ..()
+
+/datum/mission/drill/give_up()
+ recall_bound(sampler)
+ return ..()
+
+/*
+ Core sampling drill
+*/
+
+/obj/machinery/drill/mission
+ name = "core sampling research drill"
+ desc = "A specialized laser drill designed to extract geological samples."
+
+ var/num_current
+ var/mission_class
+
+/obj/machinery/drill/examine()
+ . = ..()
+ . += "The drill contains [num_current] of the []."
+
+/obj/machinery/drill/mission/start_mining()
+ if(mining.vein_class < mission_class)
+ to_chat(user, "[src] requires at least a class [mission_class] vein or higher.")
+ return
+ . = ..()
+
+/obj/machinery/drill/mission/mine()
+ if(mining.mining_charges)
+ mining.mining_charges--
+ num_current++
+ start_mining()
+ else if(!mining.mining_charges)
+ say("Error: Vein Depleted")
+ active = FALSE
+ update_icon_state()
+ update_overlays()
+
diff --git a/shiptest.dme b/shiptest.dme
index 554ac6f56a0f..bf1b389696b6 100644
--- a/shiptest.dme
+++ b/shiptest.dme
@@ -2832,6 +2832,7 @@
#include "code\modules\overmap\overmap_turf.dm"
#include "code\modules\overmap\view_overmap_verb.dm"
#include "code\modules\overmap\missions\acquire_mission.dm"
+#include "code\modules\overmap\missions\drill_mission.dm"
#include "code\modules\overmap\missions\research_mission.dm"
#include "code\modules\overmap\objects\dynamic_datum.dm"
#include "code\modules\overmap\objects\event_datum.dm"
From f806e2f55164c80061482f14e5b471ca8d43a381 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Tue, 31 Oct 2023 18:28:28 -0400
Subject: [PATCH 09/56] Bugged
---
code/datums/components/spawner.dm | 23 ++++++++++-
code/modules/mining/drill.dm | 4 +-
code/modules/mining/ore_veins.dm | 10 +++--
.../modules/overmap/missions/drill_mission.dm | 41 +++++++++++--------
4 files changed, 54 insertions(+), 24 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index cecf0fd62f14..772f6ba67585 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -9,9 +9,13 @@
var/list/spawn_sound = list()
var/spawn_distance_min = 1
var/spawn_distance_max = 1
+ var/wave_length //Average time until break in spawning
+ var/wave_downtime
+ var/spawning_paused = FALSE
+ var/wave_timer
-/datum/component/spawner/Initialize(_mob_types, _spawn_time, _faction, _spawn_text, _max_mobs, _spawn_sound, _spawn_distance_min, _spawn_distance_max)
+/datum/component/spawner/Initialize(_mob_types, _spawn_time, _faction, _spawn_text, _max_mobs, _spawn_sound, _spawn_distance_min, _spawn_distance_max, _wave_length, _wave_downtime)
if(_spawn_time)
spawn_time=_spawn_time
if(_mob_types)
@@ -28,14 +32,22 @@
spawn_distance_min=_spawn_distance_min
if(_spawn_distance_max)
spawn_distance_max=_spawn_distance_max
+ if(_wave_length)
+ wave_length = _wave_length
+ if(_wave_downtime)
+ wave_downtime = _wave_downtime
RegisterSignal(parent, list(COMSIG_PARENT_QDELETING), .proc/stop_spawning)
START_PROCESSING(SSprocessing, src)
/datum/component/spawner/process()
+ if(spawning_paused)
+ addtimer(CALLBACK(GLOBAL_PROC, .proc/START_PROCESSING, SSprocessing, src), wave_downtime)
+ spawning_paused = FALSE
+ wave_timer = null
+ stop_spawning()
try_spawn_mob()
-
/datum/component/spawner/proc/stop_spawning(force)
SIGNAL_HANDLER
@@ -48,6 +60,11 @@
/datum/component/spawner/proc/try_spawn_mob()
var/atom/P = parent
var/turf/spot = P.loc
+ if(!wave_timer && wave_length)
+ wave_timer = wave_length + world.time
+ if(world.time > wave_timer)
+ spawning_paused = TRUE
+ return 0
if(spawned_mobs.len >= max_mobs)
return 0
if(spawn_delay > world.time)
@@ -69,6 +86,8 @@
if(length(spawn_sound))
playsound(P, pick(spawn_sound), 50, TRUE)
+
+
/**
* Behaves like the orange() proc, but only looks in the outer range of the function (The "peel" of the orange).
* Can't think of a better place to put this.
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index c15cad400e77..1f2f87c7ca15 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -14,7 +14,7 @@
desc = "A large scale laser drill. It's able to mine vast amounts of minerals from near-surface ore pockets, however the seismic activity tends to anger local fauna."
icon = 'icons/obj/machines/drill.dmi'
icon_state = "deep_core_drill"
- max_integrity = 200
+ max_integrity = 400
density = TRUE
anchored = FALSE
use_power = NO_POWER_USE
@@ -250,7 +250,7 @@
soundloop.stop()
update_overlays()
return
- if(obj_integrity <= max_integrity/2.5)
+ if(obj_integrity <= max_integrity/1.5)
malfunction = rand(1,5)
malfunction(malfunction)
active = FALSE
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index ffab06b72859..1ea1ec9b94b4 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -28,9 +28,9 @@
var/max_mobs = 4
var/spawn_time = 150 //15 seconds
var/mob_types = list(
- /mob/living/simple_animal/hostile/asteroid/goliath/beast/random = 60,
- /mob/living/simple_animal/hostile/asteroid/hivelord/legion/random = 20,
- /mob/living/simple_animal/hostile/asteroid/brimdemon = 30,
+ /mob/living/simple_animal/hostile/asteroid/goliath/beast = 60,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/tendril = 20,
+ /mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
/mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient/crystal = 1,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/crystal = 1,
)
@@ -40,6 +40,8 @@
var/spawner_type = /datum/component/spawner
var/spawn_distance_min = 4
var/spawn_distance_max = 6
+ var/wave_length = 10
+ var/wave_downtime = 600
//Generates amount of ore able to be pulled from the vein (mining_charges) and types of ore within it (vein_contents)
@@ -67,7 +69,7 @@
return..()
/obj/structure/vein/proc/begin_spawning()
- AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max)
+ AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max, wave_length, wave_downtime)
//Pulls a random ore from the vein list per vein_class
/obj/structure/vein/proc/drop_ore(multiplier)
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
index 12ccbd32a19f..0c75e826adfd 100644
--- a/code/modules/overmap/missions/drill_mission.dm
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -1,19 +1,31 @@
/datum/mission/drill
- name = "Class 2 core sample mission"
+ name = "Class 1 core sample mission"
desc = "We require geological information from one of the neighboring planetoids . \
Please anchor the drill in place and defend it until it has gathered enough smaples.\
Operation of the core sampling drill is extremely dangerous, use caution. "
- value = 3000
+ value = 2000
duration = 80 MINUTES
- weight = 10
+ weight = 8
- var/obj/machinery/drill/research/sampler
- var/num_wanted = 10
- var/class_wanted = 2
+ var/obj/machinery/drill/mission/sampler
+ var/num_wanted = 8
+ var/class_wanted = 1
/datum/mission/drill/New(...)
num_wanted = rand(num_wanted-2,num_wanted+2)
value += num_wanted*100
+ return ..()
+
+/datum/mission/drill/accept(datum/overmap/ship/controlled/acceptor, turf/accept_loc)
+ . = ..()
+ sampler = spawn_bound(/obj/machinery/drill/mission, accept_loc, VARSET_CALLBACK(src, sampler, null))
+ sampler.mission_class = class_wanted
+ sampler.num_wanted = num_wanted
+
+//Gives players a little extra money for going past the mission goal
+/datum/mission/drill/turn_in()
+ value += (sampler.num_current - num_wanted)*50
+ . = ..()
/datum/mission/drill/can_complete()
. = ..()
@@ -23,11 +35,7 @@
return . && (sampler.num_current >= num_wanted) && (scanner_port?.current_ship == servant)
/datum/mission/drill/get_progress_string()
- return "[sampler.num_current]/[num_wanted]"
-
-/datum/mission/research/accept(datum/overmap/ship/controlled/acceptor, turf/accept_loc)
- . = ..()
- sampler = spawn_bound(/obj/machinery/drill/mission, accept_loc, VARSET_CALLBACK(src, sampler, null))
+ return //"[sampler.num_current]/[num_wanted]"
/datum/mission/drill/Destroy()
sampler = null
@@ -49,16 +57,17 @@
name = "core sampling research drill"
desc = "A specialized laser drill designed to extract geological samples."
- var/num_current
+ var/num_current = 0
var/mission_class
+ var/num_wanted
-/obj/machinery/drill/examine()
+/obj/machinery/drill/mission/examine()
. = ..()
- . += "The drill contains [num_current] of the []."
+ . += "The drill contains [num_current] of the [num_wanted] samples needed."
/obj/machinery/drill/mission/start_mining()
- if(mining.vein_class < mission_class)
- to_chat(user, "[src] requires at least a class [mission_class] vein or higher.")
+ if(mining.vein_class < mission_class && mining)
+ say("[src] requires at least a class [mission_class] vein or higher.")
return
. = ..()
From b57875c34d8d725c0d00f2cf9284ed9aeecf4069 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 1 Nov 2023 01:11:00 -0400
Subject: [PATCH 10/56] I'm going to puke blood
Vile pinpointer code
---
code/datums/components/spawner.dm | 3 +-
code/modules/mining/drill.dm | 8 +-
.../mining/equipment/mineral_scanner.dm | 125 ++++++++++++++++++
code/modules/mining/ore_veins.dm | 16 ++-
.../modules/overmap/missions/drill_mission.dm | 15 +++
5 files changed, 160 insertions(+), 7 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 772f6ba67585..fce6b85b2dae 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -42,10 +42,9 @@
/datum/component/spawner/process()
if(spawning_paused)
- addtimer(CALLBACK(GLOBAL_PROC, .proc/START_PROCESSING, SSprocessing, src), wave_downtime)
+ sleep(wave_downtime)
spawning_paused = FALSE
wave_timer = null
- stop_spawning()
try_spawn_mob()
/datum/component/spawner/proc/stop_spawning(force)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 1f2f87c7ca15..ebeee7830823 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -28,7 +28,7 @@
var/datum/looping_sound/drill/soundloop
var/obj/item/stock_parts/cell/cell
var/preload_cell_type = /obj/item/stock_parts/cell
- var/power_cost = 50
+ var/power_cost = 100
var/metal_attached
/obj/machinery/drill/examine(mob/user)
@@ -261,13 +261,17 @@
var/mine_time
active = TRUE
soundloop.start()
- mining.begin_spawning()
+ if(!mining.spawning_started)
+ mining.begin_spawning()
+ mining.spawning_started = TRUE
for(var/obj/item/stock_parts/micro_laser/laser in component_parts)
mine_time = round((300/sqrt(laser.rating))*mining.mine_time_multiplier)
eta = mine_time*mining.mining_charges
cell.use(power_use)
addtimer(CALLBACK(src, .proc/mine), mine_time)
say("Estimated time until vein depletion: [time2text(eta,"mm:ss")].")
+ update_icon_state()
+ update_overlays()
return
else
say("Vein depleted.")
diff --git a/code/modules/mining/equipment/mineral_scanner.dm b/code/modules/mining/equipment/mineral_scanner.dm
index 63cfe41e48fd..11234a9e53d8 100644
--- a/code/modules/mining/equipment/mineral_scanner.dm
+++ b/code/modules/mining/equipment/mineral_scanner.dm
@@ -1,3 +1,6 @@
+#define SCANMODE_SURFACE 0
+#define SCANMODE_SUBSURFACE 1
+
/**********************Mining Scanners**********************/
/obj/item/mining_scanner
desc = "A scanner that checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations.\nIt has a speaker that can be toggled with alt+click"
@@ -100,3 +103,125 @@
/obj/effect/temp_visual/mining_overlay/Initialize()
. = ..()
animate(src, alpha = 0, time = duration, easing = EASE_IN)
+
+/*
+ Vein Mining Scanner
+*/
+
+/obj/item/pinpointer/mineral //Definitely not the deepcore scanner with the serial number filed off
+ name = "ground penetrating mining scanner"
+ desc = "A handheld dowsing utility for locating material deep beneath the surface and on the surface. Alt-Click to change modes."
+ icon = 'icons/obj/mining.dmi'
+ icon_state = "mining"
+ custom_price = 300
+ custom_premium_price = 300
+ icon_suffix = "_mining"
+ var/scanning_surface = FALSE
+ var/cooldown = 50
+ var/current_cooldown = 0
+ var/range = 4
+ var/scanmode = SCANMODE_SURFACE
+
+/obj/item/pinpointer/mineral/examine(mob/user)
+ . = ..()
+ . += "It is currently set to [scanmode ? "scan underground" : "scan the surface"]."
+
+/obj/item/pinpointer/mineral/AltClick(mob/user) //switching modes
+ ..()
+ if(user.canUseTopic(src, BE_CLOSE))
+ if(scanning_surface||active) //prevents swithcing modes when active
+ to_chat(user, "You have to turn the [src] off first before switching modes!")
+ else
+ scanmode = !scanmode
+ to_chat(user, "You switch the [src] to [scanmode ? "scan underground " : "scan the surface"].")
+
+/obj/item/pinpointer/mineral/attack_self(mob/living/user)
+ switch(scanmode)
+ if(SCANMODE_SUBSURFACE)
+ if(active)
+ toggle_on()
+ user.visible_message("[user] deactivates [user.p_their()] scanner.", "You deactivate your scanner.")
+ return
+
+ var/vein = LocateVein(user)
+ if(!vein)
+ user.visible_message("[user]'s scanner fails to detect any material.", "Your scanner fails to detect any material.")
+ return
+
+ target = vein
+ toggle_on()
+ user.visible_message("[user] activates [user.p_their()] scanner.", "You activate your scanner.")
+ update_icon()
+
+ if(SCANMODE_SURFACE)
+ scanning_surface = !scanning_surface
+ update_icon()
+ if(scanning_surface)
+ START_PROCESSING(SSobj, src)
+ user.visible_message("[user] activates [user.p_their()] scanner.", "You activate your scanner.")
+ else
+ STOP_PROCESSING(SSobj, src)
+ user.visible_message("[user] deactivates [user.p_their()] scanner.", "You deactivate your scanner.")
+ playsound(src, 'sound/items/screwdriver2.ogg', 50, TRUE)
+
+/obj/item/pinpointer/mineral/process()
+ switch(scanmode)
+ if(SCANMODE_SUBSURFACE)
+ . = ..() //returns pinpointer code if its scanning for deepcore spots
+
+ if(SCANMODE_SURFACE)
+ if(!scanning_surface)
+ STOP_PROCESSING(SSobj, src)
+ return null
+ scan_minerals()
+
+/obj/item/pinpointer/mineral/proc/scan_minerals() //used by the surface mining mode
+ if(current_cooldown <= world.time)
+ current_cooldown = world.time + cooldown
+ var/turf/t = get_turf(src)
+ mineral_scan_pulse(t, range)
+ playsound(src, 'sound/effects/ping.ogg', 20)
+
+/obj/item/pinpointer/mineral/update_overlays()
+ . = ..()
+ var/mutable_appearance/scan_mode_overlay
+ switch(scanmode)
+ if(SCANMODE_SURFACE)
+ if(scanning_surface)
+ scan_mode_overlay = mutable_appearance(icon, "on_overlay")
+ if(SCANMODE_SUBSURFACE)
+ if(active)
+ scan_mode_overlay = mutable_appearance(icon, "pinpointing_overlay")
+ else
+ scan_mode_overlay = mutable_appearance(icon, "null")
+ . += scan_mode_overlay
+
+/obj/item/pinpointer/mineral/proc/LocateVein(mob/living/user)
+ var/turf/here = get_turf(src)
+ var/located_dist
+ var/obj/structure/located_vein
+ for(var/obj/structure/I in GLOB.ore_veins)
+ if(I.z == 0 || I.virtual_z() != here.virtual_z())
+ continue
+ if(located_vein)
+ var/new_dist = get_dist(here, get_turf(I))
+ if(new_dist < located_dist)
+ located_dist = new_dist
+ located_vein = I
+ else
+ located_dist = get_dist(here, get_turf(I))
+ located_vein = I
+ return located_vein
+
+//For scanning ore veins of their contents
+/obj/item/pinpointer/mineral/afterattack(obj/structure/vein/O, mob/user, proximity)
+ . = ..()
+ if(!proximity || !istype(O,/obj/structure/vein))
+ return
+ playsound(src, 'sound/effects/fastbeep.ogg', 10)
+ if(O.vein_contents.len > 0)
+ to_chat(user, "Class [O.vein_class] ore vein with [O.mining_charges] possible ore lodes found.")
+ for(var/re in O.vein_contents)
+ to_chat(user, "\tExtractable amounts of [re].")
+ else
+ to_chat(user, "No notable mineral deposits found in [O].")
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 1ea1ec9b94b4..00f770783fbe 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -1,10 +1,14 @@
+GLOBAL_LIST_EMPTY(ore_veins)
+
/obj/structure/vein
name = "ore vein"
+ desc = "A mostly subsurface ore deposit."
icon = 'icons/obj/lavaland/terrain.dmi'
icon_state = "geyser"
anchored = TRUE
- layer = HIGH_TURF_LAYER
+ layer = LOW_ITEM_LAYER
move_resist = INFINITY
+ resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
var/mining_charges = 6
//Classification of the quality of possible ores within a vein, used to determine difficulty
@@ -25,6 +29,7 @@
//Allows subtyped drills to determine how long it takes to mine one mining charge
var/mine_time_multiplier = 1
//Mob spawning variables
+ var/spawning_started = FALSE
var/max_mobs = 4
var/spawn_time = 150 //15 seconds
var/mob_types = list(
@@ -40,8 +45,8 @@
var/spawner_type = /datum/component/spawner
var/spawn_distance_min = 4
var/spawn_distance_max = 6
- var/wave_length = 10
- var/wave_downtime = 600
+ var/wave_length = 2 MINUTES
+ var/wave_downtime = 30 SECONDS
//Generates amount of ore able to be pulled from the vein (mining_charges) and types of ore within it (vein_contents)
@@ -63,6 +68,11 @@
picked = pickweight(ore_list)
vein_contents.Add(picked)
ore_list.Remove(picked)
+ GLOB.ore_veins += src
+
+/obj/structure/vein/Destroy()
+ . = ..()
+ GLOB.ore_veins -= src
/obj/structure/vein/deconstruct(disassembled)
destroy_effect()
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
index 0c75e826adfd..fc3e3a689eff 100644
--- a/code/modules/overmap/missions/drill_mission.dm
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -49,6 +49,21 @@
recall_bound(sampler)
return ..()
+/datum/mission/drill/classtwo
+ name = "Class 2 core sample mission"
+ value = 3500
+ weight = 6
+ class_wanted = 2
+ num_wanted = 10
+
+/datum/mission/drill/classthree
+ name = "Class 3 core sample mission"
+ value = 5000
+ weight = 4
+ duration = 100 MINUTES
+ class_wanted = 3
+ num_wanted = 12
+
/*
Core sampling drill
*/
From a8576c0441957cb36ca140dc9ee64bc2cb6953fb Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 1 Nov 2023 20:12:38 -0400
Subject: [PATCH 11/56] Judgement Day: TestMerge-ocalypse
---
code/datums/mapgen/planetary/LavaGenerator.dm | 10 +--
code/datums/mapgen/planetary/SnowGenerator.dm | 24 +++----
code/game/objects/items/pinpointer.dm | 2 +
code/game/turfs/closed/minerals.dm | 18 +++---
code/modules/cargo/packs/machinery.dm | 13 ++++
code/modules/mining/drill.dm | 22 ++++---
code/modules/mining/ore_veins.dm | 62 ++++++++++++++++++-
7 files changed, 116 insertions(+), 35 deletions(-)
diff --git a/code/datums/mapgen/planetary/LavaGenerator.dm b/code/datums/mapgen/planetary/LavaGenerator.dm
index 366773ebd0ea..c244f3ef2560 100644
--- a/code/datums/mapgen/planetary/LavaGenerator.dm
+++ b/code/datums/mapgen/planetary/LavaGenerator.dm
@@ -115,9 +115,9 @@
/mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient/crystal = 1,
/mob/living/simple_animal/hostile/asteroid/basilisk/watcher/forgotten = 1,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/crystal = 1,
- /obj/structure/spawner/lavaland/low_threat = 12,
- /obj/structure/spawner/lavaland/medium_threat = 4,
- /obj/structure/spawner/lavaland/high_threat = 2,
+ /obj/structure/spawner/lavaland/low_threat = 8,
+ /obj/structure/spawner/lavaland/medium_threat = 3,
+ /obj/structure/spawner/lavaland/high_threat = 1,
)
/datum/biome/lavaland/forest
@@ -237,8 +237,8 @@
/mob/living/simple_animal/hostile/asteroid/basilisk/watcher/random = 40,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/random = 30,
/mob/living/simple_animal/hostile/asteroid/goldgrub = 10,
- /obj/structure/spawner/lavaland/low_threat = 12,
- /obj/structure/spawner/lavaland/medium_threat = 4,
+ /obj/structure/spawner/lavaland/low_threat = 8,
+ /obj/structure/spawner/lavaland/medium_threat = 3,
/obj/structure/spawner/lavaland/high_threat = 2,
/obj/structure/spawner/lavaland/extreme_threat = 1
)
diff --git a/code/datums/mapgen/planetary/SnowGenerator.dm b/code/datums/mapgen/planetary/SnowGenerator.dm
index acd472c86151..a883ed58492c 100644
--- a/code/datums/mapgen/planetary/SnowGenerator.dm
+++ b/code/datums/mapgen/planetary/SnowGenerator.dm
@@ -117,9 +117,9 @@
/obj/structure/spawner/ice_moon/demonic_portal/low_threat = 25,
/obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 50,
/obj/structure/spawner/ice_moon/demonic_portal/high_threat = 13,
- /obj/structure/vein = 25,
- /obj/structure/vein/classtwo = 50,
- /obj/structure/vein/classthree = 10,
+ /obj/structure/vein/ice = 25,
+ /obj/structure/vein/ice/classtwo = 50,
+ /obj/structure/vein/ice/classthree = 10,
)
/datum/biome/snow/lush
@@ -171,9 +171,9 @@
/obj/structure/spawner/ice_moon/polarbear = 3,
/obj/structure/statue/snow/snowman = 3,
/obj/structure/statue/snow/snowlegion = 1,
- /obj/structure/vein = 3,
- /obj/structure/vein/classtwo = 4,
- /obj/structure/vein/classthree = 1,
+ /obj/structure/vein/ice = 3,
+ /obj/structure/vein/ice/classtwo = 4,
+ /obj/structure/vein/ice/classthree = 1,
)
mob_spawn_list = list(
/mob/living/simple_animal/hostile/asteroid/wolf/random = 30,
@@ -219,9 +219,9 @@
/obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 500,
/obj/structure/spawner/ice_moon/demonic_portal/high_threat = 50,
/obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 1,
- /obj/structure/vein = 300,
- /obj/structure/vein/classtwo = 500,
- /obj/structure/vein/classthree = 50,
+ /obj/structure/vein/ice = 300,
+ /obj/structure/vein/ice/classtwo = 500,
+ /obj/structure/vein/ice/classthree = 50,
)
@@ -276,9 +276,9 @@
/obj/structure/spawner/ice_moon = 30,
/obj/structure/spawner/ice_moon/polarbear = 30,
/obj/effect/spawner/lootdrop/anomaly/ice/cave = 10,
- /obj/structure/vein = 30,
- /obj/structure/vein/classtwo = 50,
- /obj/structure/vein/classthree = 6,
+ /obj/structure/vein/ice = 30,
+ /obj/structure/vein/ice/classtwo = 50,
+ /obj/structure/vein/ice/classthree = 6,
)
/datum/biome/cave/snow/thawed
diff --git a/code/game/objects/items/pinpointer.dm b/code/game/objects/items/pinpointer.dm
index 12f91f99fb8c..8a84f3192959 100644
--- a/code/game/objects/items/pinpointer.dm
+++ b/code/game/objects/items/pinpointer.dm
@@ -63,6 +63,8 @@
. = ..()
if(!active)
return
+ if(target.loc == null)
+ return
if(!target)
. += "pinon[alert ? "alert" : ""]null[icon_suffix]"
return
diff --git a/code/game/turfs/closed/minerals.dm b/code/game/turfs/closed/minerals.dm
index f31374bc8adf..00b729ffae06 100644
--- a/code/game/turfs/closed/minerals.dm
+++ b/code/game/turfs/closed/minerals.dm
@@ -155,11 +155,11 @@
return
/turf/closed/mineral/random
- var/list/mineralSpawnChanceList = list(/obj/item/stack/ore/uranium = 5, /obj/item/stack/ore/diamond = 1, /obj/item/stack/ore/gold = 10,
- /obj/item/stack/ore/silver = 12, /obj/item/stack/ore/plasma = 20, /obj/item/stack/ore/iron = 40, /obj/item/stack/ore/titanium = 11,
+ var/list/mineralSpawnChanceList = list(/obj/item/stack/ore/uranium = 3, /obj/item/stack/ore/diamond = 1, /obj/item/stack/ore/gold = 4,
+ /obj/item/stack/ore/silver = 4, /obj/item/stack/ore/plasma = 40, /obj/item/stack/ore/iron = 65, /obj/item/stack/ore/titanium = 5,
/turf/closed/mineral/gibtonite = 4, /obj/item/stack/ore/bluespace_crystal = 1)
//Currently, Adamantine won't spawn as it has no uses. -Durandan
- var/mineralChance = 13
+ var/mineralChance = 5
/turf/closed/mineral/random/Initialize(mapload, inherited_virtual_z)
@@ -188,7 +188,7 @@
Spread_Vein(path)
/turf/closed/mineral/random/high_chance
- mineralChance = 25
+ mineralChance = 13
mineralSpawnChanceList = list(
/obj/item/stack/ore/uranium = 35, /obj/item/stack/ore/diamond = 30, /obj/item/stack/ore/gold = 45, /obj/item/stack/ore/titanium = 45,
/obj/item/stack/ore/silver = 50, /obj/item/stack/ore/plasma = 50, /obj/item/stack/ore/bluespace_crystal = 20)
@@ -210,7 +210,7 @@
initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
/turf/closed/mineral/random/low_chance
- mineralChance = 6
+ mineralChance = 3
mineralSpawnChanceList = list(
/obj/item/stack/ore/uranium = 2, /obj/item/stack/ore/diamond = 1, /obj/item/stack/ore/gold = 4, /obj/item/stack/ore/titanium = 4,
/obj/item/stack/ore/silver = 6, /obj/item/stack/ore/plasma = 15, /obj/item/stack/ore/iron = 40,
@@ -227,7 +227,7 @@
initial_gas_mix = LAVALAND_DEFAULT_ATMOS
defer_change = 1
- mineralChance = 10
+ mineralChance = 5
mineralSpawnChanceList = list(
/obj/item/stack/ore/uranium = 5, /obj/item/stack/ore/diamond = 1, /obj/item/stack/ore/gold = 10, /obj/item/stack/ore/titanium = 11,
/obj/item/stack/ore/silver = 12, /obj/item/stack/ore/plasma = 20, /obj/item/stack/ore/iron = 40,
@@ -253,7 +253,7 @@
baseturfs = /turf/open/floor/plating/asteroid/icerock
initial_gas_mix = ICEMOON_DEFAULT_ATMOS
defer_change = TRUE
- mineralChance = 20 //as most caves is snowy, might as well bump up the chance
+ mineralChance = 10 //as most caves is snowy, might as well bump up the chance
mineralSpawnChanceList = list(
/obj/item/stack/ore/uranium = 5, /obj/item/stack/ore/diamond = 1, /obj/item/stack/ore/gold = 10, /obj/item/stack/ore/titanium = 11,
@@ -280,7 +280,7 @@
/turf/closed/mineral/random/snow/underground
baseturfs = /turf/open/floor/plating/asteroid/snow/icemoon
// abundant ore
- mineralChance = 20
+ mineralChance = 10
mineralSpawnChanceList = list(
/obj/item/stack/ore/uranium = 10, /obj/item/stack/ore/diamond = 4, /obj/item/stack/ore/gold = 20, /obj/item/stack/ore/titanium = 22,
/obj/item/stack/ore/silver = 24, /obj/item/stack/ore/plasma = 20, /obj/item/stack/ore/iron = 20, /obj/item/stack/ore/bananium = 1,
@@ -817,7 +817,7 @@
baseturfs = /turf/open/floor/plating/asteroid/wasteplanet
mineralSpawnChanceList = list(/obj/item/stack/ore/uranium = 30, /obj/item/stack/ore/diamond = 0.5, /obj/item/stack/ore/gold = 5,
/obj/item/stack/ore/silver = 7, /obj/item/stack/ore/plasma = 35, /obj/item/stack/ore/iron = 35, /obj/item/stack/ore/titanium = 10)
- mineralChance = 30
+ mineralChance = 10
/turf/closed/mineral/snowmountain/cavern/shipside
name = "ice cavern rock"
diff --git a/code/modules/cargo/packs/machinery.dm b/code/modules/cargo/packs/machinery.dm
index 20f0af7a03a3..e97e6cdae81e 100644
--- a/code/modules/cargo/packs/machinery.dm
+++ b/code/modules/cargo/packs/machinery.dm
@@ -178,6 +178,19 @@
)
crate_name = "Shuttle in a Box"
+/datum/supply_pack/machinery/drill_crate
+ name = "Heavy duty laser mining drill"
+ desc = "An experimental laser-based mining drill that Nanotrasen is kindly allowing YOU, the customer, to opt into testing of."
+ cost = 1000 //Only while TMed, jack up the price before merging
+ contains = list(
+ /obj/machinery/drill,
+ /obj/item/pinpointer/mineral,
+ /obj/item/paper/guides/drill
+ )
+ crate_name = "laser mining drill crate"
+ crate_type = /obj/structure/closet/crate/engineering
+
+
/*
Power generation machines
*/
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index ebeee7830823..e27f5e5beab2 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -39,16 +39,16 @@
. += "The lower power light is blinking."
switch(malfunction)
if(4)
- . += "The [src]'s structure looks like it needs to be welded back together."
+ . += "The [src]'s structure looks like it needs to be welded back together."
if(5)
- . += "The [src]'s gimbal is out of alignment, it needs to be recalibrated with a multitool."
+ . += "The [src]'s gimbal is out of alignment, it needs to be recalibrated with a multitool."
switch(metal_attached)
if(METAL_PLACED)
- . += "Replacement plating has been attached to [src], but has not been bolted in place yet."
+ . += "Replacement plating has been attached to [src], but has not been bolted in place yet."
if(METAL_SECURED)
- . += "Replacement plating has been secured to [src], but still needs to be welded into place."
+ . += "Replacement plating has been secured to [src], but still needs to be welded into place."
if(machine_stat && BROKEN && !metal_attached)
- . += "[src]'s structure has been totaled, the plasteel plating needs to be replaced."
+ . += "[src]'s structure has been totaled, the plasteel plating needs to be replaced."
/obj/machinery/drill/Initialize()
. = ..()
@@ -87,6 +87,11 @@
/obj/machinery/drill/get_cell()
return cell
+//The RPED sort of trivializes a good deal of the malfunction mechancis, as such it will not be allowed to work
+/obj/machinery/drill/exchange_parts(mob/user, obj/item/storage/part_replacer/W)
+ to_chat(user, "[W] does not seem to work on [src], it might require more delecitate parts replacement.")
+ return
+
/obj/machinery/drill/attackby(obj/item/tool, mob/living/user, params)
var/obj/structure/vein/vein = locate(/obj/structure/vein) in src.loc
if(machine_stat && BROKEN)
@@ -289,7 +294,7 @@
sensor_rating = sensor.rating
if(mining.mining_charges)
mining.mining_charges--
- mining.drop_ore(round(sqrt(sensor_rating), 0.1))
+ mining.drop_ore(round(sqrt(sensor_rating), 0.1),src)
start_mining()
else if(!mining.mining_charges) //Extra check to prevent vein related errors locking us in place
say("Error: Vein Depleted")
@@ -317,8 +322,11 @@
return
if(MALF_STRUCTURAL)
say("Malfunction: Drill plating damaged, provide structural repairs before continuing mining operations.")
- /*playsound()*/
return
if(MALF_CALIBRATE)
say("Malfunction: Drill laser calibrations out of alignment, please recalibrate before continuing.")
return
+
+/obj/item/paper/guides/drill
+ name = "Laser Mining Drill Operation Manual"
+ default_raw_text = "Laser Mining Drill Operation Manual
Thank you for opting in to the paid testing of Nanotrasen's new, experimental laser drilling device (trademark pending). We are legally obligated to mention that despite this new and wonderful drilling device being less dangerous than past iterations (note the 75% decrease in plasma ignition incidents), the seismic activity created by the drill has been noted to anger most forms of xenofauna. As such our legal team advises only armed mining expeditions make use of this drill.
How to set up your Laser Mining Drill
1. Find a suitable ore vein with the included scanner.
2. Wrench the drill's anchors in place over the vein.
3. Protect the drill from any enraged xenofauna until it has finished drilling.
With all this done, your ore should be well on its way out of the ground and into your pockets! Be warned though, the Laser Mining Drill is prone to numerous malfunctions when exposed to most forms of physical trauma. As such, we advise any teams utilizing this drill to bring with them a set of replacement Nanotrasen brand stock parts and a set of tools to handle repairs. If the drill suffers a total structural failure, then plasteel alloy may be needed to repair said structure."
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 00f770783fbe..ec8a69b6f615 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -82,18 +82,22 @@ GLOBAL_LIST_EMPTY(ore_veins)
AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max, wave_length, wave_downtime)
//Pulls a random ore from the vein list per vein_class
-/obj/structure/vein/proc/drop_ore(multiplier)
+/obj/structure/vein/proc/drop_ore(multiplier,obj/machinery/drill/current)
var/class
class = vein_class
for(class, class>0, class--)
var/picked
picked = pick(vein_contents)
- new picked(loc,round(rand(5,10)*multiplier))
+ new picked(pick(get_adjacent_open_turfs(current)),round(rand(5,10)*multiplier))
/obj/structure/vein/proc/destroy_effect()
playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
visible_message("[src] collapses!")
+//
+// Planetary and Class Subtypes
+// The current set of subtypes are heavily subject to future balancing and reworking as the balance of them is tested more
+//
/obj/structure/vein/classtwo
mining_charges = 9
@@ -126,3 +130,57 @@ GLOBAL_LIST_EMPTY(ore_veins)
)
max_mobs = 6 //Best not to go past 6 due to balance and lag reasons
spawn_time = 80
+
+/obj/structure/vein/ice
+ mob_types = list(
+ /mob/living/simple_animal/hostile/asteroid/wolf = 30,
+ /mob/living/simple_animal/hostile/asteroid/polarbear = 30,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/snow = 20,
+ /mob/living/simple_animal/hostile/asteroid/ice_demon = 10,
+ /mob/living/simple_animal/hostile/asteroid/ice_whelp = 5,
+ /mob/living/simple_animal/hostile/asteroid/lobstrosity = 20,
+ )
+ //Ice planets earn a slightly higher rare ore chance on account of them being notably harder
+ ore_list = list(
+ /obj/item/stack/ore/iron = 5,
+ /obj/item/stack/ore/plasma = 5,
+ /obj/item/stack/ore/silver = 3,
+ /obj/item/stack/ore/uranium = 3,
+ /obj/item/stack/ore/titanium = 3,
+ /obj/item/stack/ore/titanium = 2,
+ /obj/item/stack/ore/gold = 1,
+ /obj/item/stack/ore/diamond = 1,
+ )
+
+/obj/structure/vein/ice/classtwo
+ mining_charges = 9
+ vein_class = 2
+ ore_list = list(
+ /obj/item/stack/ore/iron = 6,
+ /obj/item/stack/ore/plasma = 6,
+ /obj/item/stack/ore/silver = 5,
+ /obj/item/stack/ore/uranium = 5,
+ /obj/item/stack/ore/titanium = 6,
+ /obj/item/stack/ore/diamond = 2,
+ /obj/item/stack/ore/gold = 3,
+ /obj/item/stack/ore/bluespace_crystal = 1,
+ )
+ max_mobs = 6
+ spawn_time = 100
+
+/obj/structure/vein/ice/classthree
+ mining_charges = 12
+ vein_class = 3
+ ore_list = list(
+ /obj/item/stack/ore/iron = 5,
+ /obj/item/stack/ore/plasma = 5,
+ /obj/item/stack/ore/silver = 6,
+ /obj/item/stack/ore/uranium = 5,
+ /obj/item/stack/ore/titanium = 6,
+ /obj/item/stack/ore/diamond = 4,
+ /obj/item/stack/ore/gold = 6,
+ /obj/item/stack/ore/bluespace_crystal = 4,
+ )
+ max_mobs = 6
+ spawn_time = 80
+
From 6a8bb8901ab86736ee5bf4c4e9d52883c6ba737d Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Thu, 2 Nov 2023 19:06:51 -0400
Subject: [PATCH 12/56] Sand & ice planet spawn tweaks
---
code/datums/mapgen/planetary/SandGenerator.dm | 5 +++
code/datums/mapgen/planetary/SnowGenerator.dm | 34 +++++++++----------
code/modules/research/stock_parts.dm | 1 -
3 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/code/datums/mapgen/planetary/SandGenerator.dm b/code/datums/mapgen/planetary/SandGenerator.dm
index e50223744a7c..442daa0c7705 100644
--- a/code/datums/mapgen/planetary/SandGenerator.dm
+++ b/code/datums/mapgen/planetary/SandGenerator.dm
@@ -92,7 +92,10 @@
feature_spawn_chance = 0.1
feature_spawn_list = list(
/obj/structure/geyser/random = 8,
+ /obj/structure/vein = 8,
+ /obj/structure/vein/classtwo = 4,
/obj/structure/elite_tumor = 4,
+ /obj/structure/vein/classthree = 2,
/obj/effect/spawner/lootdrop/anomaly/sand = 1,
)
mob_spawn_chance = 4
@@ -192,7 +195,9 @@
/obj/structure/flora/ash/puce = 1,
)
feature_spawn_list = list(
+ /obj/structure/vein = 8,
/obj/structure/geyser/random = 4,
+ /obj/structure/vein/classtwo = 4,
/obj/structure/elite_tumor = 4,
/obj/effect/spawner/lootdrop/anomaly/sand/cave = 1
)
diff --git a/code/datums/mapgen/planetary/SnowGenerator.dm b/code/datums/mapgen/planetary/SnowGenerator.dm
index a883ed58492c..a066647a0e4d 100644
--- a/code/datums/mapgen/planetary/SnowGenerator.dm
+++ b/code/datums/mapgen/planetary/SnowGenerator.dm
@@ -101,8 +101,8 @@
mob_spawn_chance = 1
mob_spawn_list = list(
/mob/living/simple_animal/hostile/asteroid/wolf/random = 30,
- /obj/structure/spawner/ice_moon = 3,
- /obj/structure/spawner/ice_moon/polarbear = 3,
+ /obj/structure/spawner/ice_moon = 2,
+ /obj/structure/spawner/ice_moon/polarbear = 2,
/mob/living/simple_animal/hostile/asteroid/polarbear/random = 30,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/snow = 50,
/mob/living/simple_animal/hostile/asteroid/goldgrub = 10,
@@ -167,8 +167,8 @@
)
feature_spawn_chance = 0.1
feature_spawn_list = list(
- /obj/structure/spawner/ice_moon = 3,
- /obj/structure/spawner/ice_moon/polarbear = 3,
+ /obj/structure/spawner/ice_moon = 2,
+ /obj/structure/spawner/ice_moon/polarbear = 2,
/obj/structure/statue/snow/snowman = 3,
/obj/structure/statue/snow/snowlegion = 1,
/obj/structure/vein/ice = 3,
@@ -177,8 +177,8 @@
)
mob_spawn_list = list(
/mob/living/simple_animal/hostile/asteroid/wolf/random = 30,
- /obj/structure/spawner/ice_moon = 3,
- /obj/structure/spawner/ice_moon/polarbear = 3,
+ /obj/structure/spawner/ice_moon = 2,
+ /obj/structure/spawner/ice_moon/polarbear = 2,
/mob/living/simple_animal/hostile/asteroid/polarbear/random = 30,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/snow = 50,
/mob/living/simple_animal/hostile/asteroid/goldgrub = 10,
@@ -215,9 +215,9 @@
feature_spawn_list = list(
/obj/effect/spawner/lootdrop/anomaly/ice = 100,
/obj/effect/spawner/lootdrop/anomaly/big = 1,
- /obj/structure/spawner/ice_moon/demonic_portal/low_threat = 300,
- /obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 500,
- /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 50,
+ /obj/structure/spawner/ice_moon/demonic_portal/low_threat = 200,
+ /obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 400,
+ /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 40,
/obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 1,
/obj/structure/vein/ice = 300,
/obj/structure/vein/ice/classtwo = 500,
@@ -258,8 +258,8 @@
mob_spawn_chance = 2
mob_spawn_list = list(
/mob/living/simple_animal/hostile/asteroid/wolf/random = 30,
- /obj/structure/spawner/ice_moon = 3,
- /obj/structure/spawner/ice_moon/polarbear = 3,
+ /obj/structure/spawner/ice_moon = 2,
+ /obj/structure/spawner/ice_moon/polarbear = 2,
/mob/living/simple_animal/hostile/asteroid/polarbear/random = 30,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/snow = 50,
/mob/living/simple_animal/hostile/asteroid/goldgrub = 10,
@@ -269,12 +269,12 @@
)
feature_spawn_chance = 0.2
feature_spawn_list = list(
- /obj/structure/spawner/ice_moon/demonic_portal/low_threat = 30,
- /obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 50,
- /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 6,
- /obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 2,
- /obj/structure/spawner/ice_moon = 30,
- /obj/structure/spawner/ice_moon/polarbear = 30,
+ /obj/structure/spawner/ice_moon/demonic_portal/low_threat = 20,
+ /obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 40,
+ /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 5,
+ /obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 1,
+ /obj/structure/spawner/ice_moon = 20,
+ /obj/structure/spawner/ice_moon/polarbear = 20,
/obj/effect/spawner/lootdrop/anomaly/ice/cave = 10,
/obj/structure/vein/ice = 30,
/obj/structure/vein/ice/classtwo = 50,
diff --git a/code/modules/research/stock_parts.dm b/code/modules/research/stock_parts.dm
index 95680c691d9c..ccddbdb3eb22 100644
--- a/code/modules/research/stock_parts.dm
+++ b/code/modules/research/stock_parts.dm
@@ -1,7 +1,6 @@
/*Power cells are in code\modules\power\cell.dm
If you create T5+ please take a pass at gene_modder.dm [L40]. Max_values MUST fit with the clamp to not confuse the user or cause possible exploits.*/
-
/obj/item/storage/part_replacer
name = "rapid part exchange device"
desc = "Special mechanical module made to store, sort, and apply standard machine parts."
From 43c8d6f2e1f31521f34371f0cdd13b4980d97d0d Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Fri, 3 Nov 2023 13:58:54 -0400
Subject: [PATCH 13/56] I used the bitflags wrong
---
code/modules/mining/drill.dm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index e27f5e5beab2..ae2bf08b39a1 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -47,7 +47,7 @@
. += "Replacement plating has been attached to [src], but has not been bolted in place yet."
if(METAL_SECURED)
. += "Replacement plating has been secured to [src], but still needs to be welded into place."
- if(machine_stat && BROKEN && !metal_attached)
+ if(machine_stat & BROKEN && !metal_attached)
. += "[src]'s structure has been totaled, the plasteel plating needs to be replaced."
/obj/machinery/drill/Initialize()
@@ -94,7 +94,7 @@
/obj/machinery/drill/attackby(obj/item/tool, mob/living/user, params)
var/obj/structure/vein/vein = locate(/obj/structure/vein) in src.loc
- if(machine_stat && BROKEN)
+ if(machine_stat & BROKEN)
if(istype(tool,/obj/item/stack/sheet/plasteel))
var/obj/item/stack/sheet/plasteel/plating = tool
if(plating.use(10,FALSE,TRUE))
@@ -112,7 +112,7 @@
update_icon_state()
return
if(tool.tool_behaviour == TOOL_WRENCH)
- if(metal_attached && machine_stat && BROKEN)
+ if(metal_attached && machine_stat & BROKEN)
playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
do_after(user, 30*tool.toolspeed, target = src)
to_chat(user, "You bolt the plating the plating in place on [src].")
@@ -216,7 +216,7 @@
/obj/machinery/drill/update_icon_state()
if(anchored)
- if(machine_stat && BROKEN)
+ if(machine_stat & BROKEN)
icon_state = "deep_core_drill-deployed_broken"
return ..()
if(active)
@@ -226,7 +226,7 @@
icon_state = "deep_core_drill-idle"
return ..()
else
- if(machine_stat && BROKEN)
+ if(machine_stat & BROKEN)
icon_state = "deep_core_drill-broken"
return ..()
icon_state = "deep_core_drill"
@@ -316,7 +316,7 @@
component_parts.Remove(sensor)
return
if(MALF_CAPACITOR)
- say("Malfunction: Energy cell capacitor damaged, please replace before continuin mining operations.")
+ say("Malfunction: Energy cell capacitor damaged, please replace before continuing mining operations.")
for (var/obj/item/stock_parts/capacitor/capacitor in component_parts)
component_parts.Remove(capacitor)
return
From 1c1327e2206fa58d1de6af2f8043741b63867e24 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Sat, 4 Nov 2023 16:16:14 -0400
Subject: [PATCH 14/56] 515 funny update
---
code/modules/mining/drill.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index ae2bf08b39a1..80b810f3c68f 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -273,7 +273,7 @@
mine_time = round((300/sqrt(laser.rating))*mining.mine_time_multiplier)
eta = mine_time*mining.mining_charges
cell.use(power_use)
- addtimer(CALLBACK(src, .proc/mine), mine_time)
+ addtimer(CALLBACK(src, PROC_REF(mine)), mine_time)
say("Estimated time until vein depletion: [time2text(eta,"mm:ss")].")
update_icon_state()
update_overlays()
From 7bdfe74dc14ff09c7a98a75b81078cdd4ba2787c Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Sat, 4 Nov 2023 16:48:32 -0400
Subject: [PATCH 15/56] I thought of a better place to put it
---
code/__HELPERS/game.dm | 22 ++++++++++++++++++++++
code/datums/components/spawner.dm | 26 --------------------------
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm
index 6dc31eea2fdb..6cd8f4e14963 100644
--- a/code/__HELPERS/game.dm
+++ b/code/__HELPERS/game.dm
@@ -143,6 +143,28 @@ block( \
//turfs += centerturf
return atoms
+/**
+ * Behaves like the orange() proc, but only looks in the outer range of the function (The "peel" of the orange).
+ * Credit to ArcaneMusic for this one
+ */
+/proc/turf_peel(outer_range, inner_range, center, view_based = FALSE)
+ var/list/peel = list()
+ var/list/outer
+ var/list/inner
+ if(view_based)
+ outer = circleviewturfs(center, outer_range)
+ inner = circleviewturfs(center, inner_range)
+ else
+ outer = circlerangeturfs(center, outer_range)
+ inner = circlerangeturfs(center, inner_range)
+ for(var/turf/possible_spawn in outer)
+ if(possible_spawn in inner)
+ continue
+ if(istype(possible_spawn, /turf/closed))
+ continue
+ peel += possible_spawn
+ return peel
+
/proc/get_dist_euclidian(atom/Loc1 as turf|mob|obj,atom/Loc2 as turf|mob|obj)
var/dx = Loc1.x - Loc2.x
var/dy = Loc1.y - Loc2.y
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 1e53a8b6c62b..d67cf084349b 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -84,29 +84,3 @@
P.visible_message("[L] [pick(spawn_text)] [P].")
if(length(spawn_sound))
playsound(P, pick(spawn_sound), 50, TRUE)
-
-
-
-/**
- * Behaves like the orange() proc, but only looks in the outer range of the function (The "peel" of the orange).
- * Can't think of a better place to put this.
- * Credit to ArcaneMusic for this very handy proc
- */
-/proc/turf_peel(outer_range, inner_range, center, view_based = FALSE)
- var/list/peel = list()
- var/list/outer
- var/list/inner
- if(view_based)
- outer = circleviewturfs(center, outer_range)
- inner = circleviewturfs(center, inner_range)
- else
- outer = circlerangeturfs(center, outer_range)
- inner = circlerangeturfs(center, inner_range)
- for(var/turf/possible_spawn in outer)
- if(possible_spawn in inner)
- continue
- if(istype(possible_spawn, /turf/closed))
- continue
- peel += possible_spawn
- return peel
-
From 5bf7c13ccdcad5f12fb9b91c7bd2c983740f7344 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Mon, 6 Nov 2023 14:28:31 -0500
Subject: [PATCH 16/56] Refines some stuff
Cleaned up some shitty code and improved the repair process
---
code/datums/components/spawner.dm | 3 +++
code/game/objects/items/pinpointer.dm | 2 --
code/modules/mining/drill.dm | 26 ++++++++++++++++----------
code/modules/mining/ore_veins.dm | 2 --
4 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index d67cf084349b..df4baadf6490 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -41,6 +41,9 @@
START_PROCESSING(SSprocessing, src)
/datum/component/spawner/process()
+ if(!parent) //Sanity check for instances where the spawner may be sleeping while the parent is destroyed
+ Destroy(TRUE,FALSE)
+ return
if(spawning_paused)
sleep(wave_downtime)
spawning_paused = FALSE
diff --git a/code/game/objects/items/pinpointer.dm b/code/game/objects/items/pinpointer.dm
index 8a84f3192959..12f91f99fb8c 100644
--- a/code/game/objects/items/pinpointer.dm
+++ b/code/game/objects/items/pinpointer.dm
@@ -63,8 +63,6 @@
. = ..()
if(!active)
return
- if(target.loc == null)
- return
if(!target)
. += "pinon[alert ? "alert" : ""]null[icon_suffix]"
return
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 80b810f3c68f..f2e210f7d7fc 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -159,17 +159,23 @@
break
return
if(tool.tool_behaviour == TOOL_MULTITOOL && malfunction == MALF_CALIBRATE)
- playsound()
- do_after(user,(100*tool.toolspeed),src)
- malfunction = null
- obj_integrity = max_integrity
- return
+ user.visible_message("[user] begins recalibrating [src].", \
+ "You begin recalibrating [src]...")
+ if(tool.use_tool(src, user, 100, volume=50))
+ malfunction = null
+ obj_integrity = max_integrity
+ return
if(tool.tool_behaviour == TOOL_WELDER && malfunction == MALF_STRUCTURAL)
- playsound()
- do_after(user,(100*tool.toolspeed),src)
- malfunction = null
- obj_integrity = max_integrity
- return
+ if(!tool.tool_start_check(user, amount=0))
+ return
+ user.visible_message("[user] begins repairing [src].", \
+ "You begin repairing [src]...", \
+ "You hear welding.")
+ if(tool.use_tool(src, user, 100, volume=50))
+ playsound()
+ malfunction = null
+ obj_integrity = max_integrity
+ return
if(istype(tool, /obj/item/stock_parts/cell))
var/obj/item/stock_parts/cell/battery = tool
if(cell)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index ec8a69b6f615..2e955c5940fc 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -36,8 +36,6 @@ GLOBAL_LIST_EMPTY(ore_veins)
/mob/living/simple_animal/hostile/asteroid/goliath/beast = 60,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/tendril = 20,
/mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
- /mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient/crystal = 1,
- /mob/living/simple_animal/hostile/asteroid/hivelord/legion/crystal = 1,
)
var/spawn_text = "emerges from"
var/faction = list("hostile","mining")
From 23c325d4fd4e15b3c4289221d06a32fc99591b16 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Mon, 6 Nov 2023 15:14:53 -0500
Subject: [PATCH 17/56] More refining
---
code/modules/mining/drill.dm | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index f2e210f7d7fc..0786ff154191 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -103,20 +103,21 @@
return
else
to_chat(user, "You don't have enough plasteel to fix the plating.")
- if(metal_attached == METAL_SECURED && tool.tool_behaviour == TOOL_WELDER && do_after(user, 30*tool.toolspeed, target = src))
- playsound(src, 'sound/items/welder2.ogg', 50, TRUE)
- to_chat(user, "You weld the new plating onto the [src], successfully repairing it.")
- metal_attached = null
- machine_stat = null
- obj_integrity = max_integrity
- update_icon_state()
- return
+ if(metal_attached == METAL_SECURED && tool.tool_behaviour == TOOL_WELDER)
+ if(tool.use_tool(src, user, 30, volume=50))
+ to_chat(user, "You weld the new plating onto the [src], successfully repairing it.")
+ metal_attached = null
+ machine_stat = null
+ obj_integrity = max_integrity
+ update_icon_state()
+ return
if(tool.tool_behaviour == TOOL_WRENCH)
if(metal_attached && machine_stat & BROKEN)
playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
- do_after(user, 30*tool.toolspeed, target = src)
- to_chat(user, "You bolt the plating the plating in place on [src].")
- return
+ if(tool.use_tool(src, user, 30, volume=50))
+ to_chat(user, "You bolt the plating the plating in place on [src].")
+ metal_attached = METAL_SECURED
+ return
if(!vein && !anchored)
to_chat(user, "[src] must be on top of an ore vein.")
return
@@ -124,14 +125,14 @@
to_chat(user, "[src] can't be unsecured while it's running!")
return
playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
- if(!anchored && do_after(user, 30*tool.toolspeed, target = src))
+ if(!anchored && tool.use_tool(src, user, 30, volume=50))
to_chat(user, "You secure the [src] to the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
mining = vein
anchored = TRUE
update_icon_state()
return
- if(do_after(user, 30*tool.toolspeed, target = src))
+ else if(tool.use_tool(src, user, 30, volume=50))
to_chat(user, "You unsecure the [src] from the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
anchored = FALSE
From 2a036fcfae7b868b1d5f4b2b517a95753674f536 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Tue, 7 Nov 2023 22:16:03 -0500
Subject: [PATCH 18/56] Spawner bugfixes
---
code/datums/components/spawner.dm | 3 ++-
code/modules/mining/drill.dm | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index df4baadf6490..c2eea9ad0226 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -48,6 +48,7 @@
sleep(wave_downtime)
spawning_paused = FALSE
wave_timer = null
+ return
try_spawn_mob()
/datum/component/spawner/proc/stop_spawning(force)
@@ -64,7 +65,7 @@
var/turf/spot = P.loc
if(!wave_timer && wave_length)
wave_timer = wave_length + world.time
- if(world.time > wave_timer)
+ if(wave_timer && world.time > wave_timer)
spawning_paused = TRUE
return 0
if(spawned_mobs.len >= max_mobs)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 0786ff154191..687ed105f41f 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -103,17 +103,17 @@
return
else
to_chat(user, "You don't have enough plasteel to fix the plating.")
+ return
if(metal_attached == METAL_SECURED && tool.tool_behaviour == TOOL_WELDER)
if(tool.use_tool(src, user, 30, volume=50))
to_chat(user, "You weld the new plating onto the [src], successfully repairing it.")
metal_attached = null
- machine_stat = null
obj_integrity = max_integrity
+ set_machine_stat(machine_stat & ~BROKEN)
update_icon_state()
return
if(tool.tool_behaviour == TOOL_WRENCH)
if(metal_attached && machine_stat & BROKEN)
- playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
if(tool.use_tool(src, user, 30, volume=50))
to_chat(user, "You bolt the plating the plating in place on [src].")
metal_attached = METAL_SECURED
From 307975c706f85bd146eb464bad1a7fb88f615f11 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Thu, 9 Nov 2023 20:52:44 -0500
Subject: [PATCH 19/56] Reworks the wave spawning to runtime less
---
code/datums/components/spawner.dm | 16 +++++++++++++++-
code/modules/mining/drill.dm | 1 -
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index c2eea9ad0226..50e945e6790e 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -10,9 +10,10 @@
var/spawn_distance_min = 1
var/spawn_distance_max = 1
var/wave_length //Average time until break in spawning
- var/wave_downtime
+ var/wave_downtime //Average time until spawning starts again
var/spawning_paused = FALSE
var/wave_timer
+ var/downtime_timer
/datum/component/spawner/Initialize(_mob_types, _spawn_time, _faction, _spawn_text, _max_mobs, _spawn_sound, _spawn_distance_min, _spawn_distance_max, _wave_length, _wave_downtime)
@@ -63,11 +64,24 @@
/datum/component/spawner/proc/try_spawn_mob()
var/atom/P = parent
var/turf/spot = P.loc
+ //Checks for handling the wave-based pausing and unpausing of spawning
+ //Almost certainly a better way to do this, but until then this technically works
+ if(spawning_paused)
+ if(!downtime_timer)
+ downtime_timer = wave_downtime + world.time
+ if(world.time > downtime_timer)
+ spawning_paused = FALSE
+ downtime_timer = null
+ return 0
+ else
+ return 0
if(!wave_timer && wave_length)
wave_timer = wave_length + world.time
if(wave_timer && world.time > wave_timer)
spawning_paused = TRUE
+ wave_timer = null
return 0
+ ////////////////////////////////
if(spawned_mobs.len >= max_mobs)
return 0
if(spawn_delay > world.time)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 687ed105f41f..e7207bf400a2 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -124,7 +124,6 @@
if(active)
to_chat(user, "[src] can't be unsecured while it's running!")
return
- playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
if(!anchored && tool.use_tool(src, user, 30, volume=50))
to_chat(user, "You secure the [src] to the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
From 035439598aae9af215883919d40c2da5fe4150e2 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Fri, 10 Nov 2023 16:49:29 -0500
Subject: [PATCH 20/56] Last bit of stuff I can think of
---
code/modules/mining/drill.dm | 1 -
1 file changed, 1 deletion(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index e7207bf400a2..03005e9f3819 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -172,7 +172,6 @@
"You begin repairing [src]...", \
"You hear welding.")
if(tool.use_tool(src, user, 100, volume=50))
- playsound()
malfunction = null
obj_integrity = max_integrity
return
From d90f26babf80af79f3a982a3bcb510587ff5d54d Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Mon, 13 Nov 2023 17:13:05 -0500
Subject: [PATCH 21/56] Fixes that absolutely vile pinpointer runtime
---
code/game/objects/items/pinpointer.dm | 2 +-
.../mining/equipment/mineral_scanner.dm | 9 +++--
code/modules/mining/ore_veins.dm | 38 ++++++++++---------
3 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/code/game/objects/items/pinpointer.dm b/code/game/objects/items/pinpointer.dm
index 12f91f99fb8c..1fbe1c7e0f02 100644
--- a/code/game/objects/items/pinpointer.dm
+++ b/code/game/objects/items/pinpointer.dm
@@ -63,7 +63,7 @@
. = ..()
if(!active)
return
- if(!target)
+ if(!target || target.loc == null)
. += "pinon[alert ? "alert" : ""]null[icon_suffix]"
return
var/turf/here = get_turf(src)
diff --git a/code/modules/mining/equipment/mineral_scanner.dm b/code/modules/mining/equipment/mineral_scanner.dm
index 11234a9e53d8..8f4969857d75 100644
--- a/code/modules/mining/equipment/mineral_scanner.dm
+++ b/code/modules/mining/equipment/mineral_scanner.dm
@@ -143,12 +143,11 @@
user.visible_message("[user] deactivates [user.p_their()] scanner.", "You deactivate your scanner.")
return
- var/vein = LocateVein(user)
+ var/vein = scan_for_target()
if(!vein)
user.visible_message("[user]'s scanner fails to detect any material.", "Your scanner fails to detect any material.")
return
- target = vein
toggle_on()
user.visible_message("[user] activates [user.p_their()] scanner.", "You activate your scanner.")
update_icon()
@@ -167,6 +166,9 @@
/obj/item/pinpointer/mineral/process()
switch(scanmode)
if(SCANMODE_SUBSURFACE)
+ if(active && target.loc == null)
+ target = null
+ toggle_on()
. = ..() //returns pinpointer code if its scanning for deepcore spots
if(SCANMODE_SURFACE)
@@ -196,7 +198,7 @@
scan_mode_overlay = mutable_appearance(icon, "null")
. += scan_mode_overlay
-/obj/item/pinpointer/mineral/proc/LocateVein(mob/living/user)
+/obj/item/pinpointer/mineral/scan_for_target()
var/turf/here = get_turf(src)
var/located_dist
var/obj/structure/located_vein
@@ -211,6 +213,7 @@
else
located_dist = get_dist(here, get_turf(I))
located_vein = I
+ target = located_vein
return located_vein
//For scanning ore veins of their contents
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 2e955c5940fc..58c4a553008a 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -17,11 +17,11 @@ GLOBAL_LIST_EMPTY(ore_veins)
//The design process is that class 1 veins have a small chance of generating with class 2 ores and so on
//As higher class veins will be increasingly harder to mine
var/list/ore_list = list(
- /obj/item/stack/ore/iron = 5,
- /obj/item/stack/ore/plasma = 4,
- /obj/item/stack/ore/silver = 1,
+ /obj/item/stack/ore/iron = 6,
+ /obj/item/stack/ore/plasma = 2,
+ /obj/item/stack/ore/silver = 2,
/obj/item/stack/ore/uranium = 1,
- /obj/item/stack/ore/titanium = 1,
+ /obj/item/stack/ore/titanium = 2,
)
//The post initialize list of all possible drops from the vein
//Meant to be player facing in the form of mining scanners
@@ -102,9 +102,9 @@ GLOBAL_LIST_EMPTY(ore_veins)
vein_class = 2
ore_list = list(
/obj/item/stack/ore/iron = 6,
- /obj/item/stack/ore/plasma = 5,
+ /obj/item/stack/ore/plasma = 2,
/obj/item/stack/ore/silver = 4,
- /obj/item/stack/ore/uranium = 4,
+ /obj/item/stack/ore/uranium = 2,
/obj/item/stack/ore/titanium = 5,
/obj/item/stack/ore/diamond = 1,
/obj/item/stack/ore/gold = 2,
@@ -117,12 +117,12 @@ GLOBAL_LIST_EMPTY(ore_veins)
mining_charges = 12
vein_class = 3
ore_list = list(
- /obj/item/stack/ore/iron = 5,
- /obj/item/stack/ore/plasma = 5,
+ /obj/item/stack/ore/iron = 7,
+ /obj/item/stack/ore/plasma = 2,
/obj/item/stack/ore/silver = 5,
- /obj/item/stack/ore/uranium = 5,
+ /obj/item/stack/ore/uranium = 2,
/obj/item/stack/ore/titanium = 6,
- /obj/item/stack/ore/diamond = 3,
+ /obj/item/stack/ore/diamond = 4,
/obj/item/stack/ore/gold = 5,
/obj/item/stack/ore/bluespace_crystal = 3,
)
@@ -139,12 +139,13 @@ GLOBAL_LIST_EMPTY(ore_veins)
/mob/living/simple_animal/hostile/asteroid/lobstrosity = 20,
)
//Ice planets earn a slightly higher rare ore chance on account of them being notably harder
+ //Alongside being a much more reliable source of plasma
ore_list = list(
/obj/item/stack/ore/iron = 5,
- /obj/item/stack/ore/plasma = 5,
+ /obj/item/stack/ore/plasma = 6,
/obj/item/stack/ore/silver = 3,
- /obj/item/stack/ore/uranium = 3,
- /obj/item/stack/ore/titanium = 3,
+ /obj/item/stack/ore/uranium = 1,
+ /obj/item/stack/ore/titanium = 2,
/obj/item/stack/ore/titanium = 2,
/obj/item/stack/ore/gold = 1,
/obj/item/stack/ore/diamond = 1,
@@ -155,9 +156,9 @@ GLOBAL_LIST_EMPTY(ore_veins)
vein_class = 2
ore_list = list(
/obj/item/stack/ore/iron = 6,
- /obj/item/stack/ore/plasma = 6,
+ /obj/item/stack/ore/plasma = 8,
/obj/item/stack/ore/silver = 5,
- /obj/item/stack/ore/uranium = 5,
+ /obj/item/stack/ore/uranium = 2,
/obj/item/stack/ore/titanium = 6,
/obj/item/stack/ore/diamond = 2,
/obj/item/stack/ore/gold = 3,
@@ -171,9 +172,9 @@ GLOBAL_LIST_EMPTY(ore_veins)
vein_class = 3
ore_list = list(
/obj/item/stack/ore/iron = 5,
- /obj/item/stack/ore/plasma = 5,
+ /obj/item/stack/ore/plasma = 8,
/obj/item/stack/ore/silver = 6,
- /obj/item/stack/ore/uranium = 5,
+ /obj/item/stack/ore/uranium = 2,
/obj/item/stack/ore/titanium = 6,
/obj/item/stack/ore/diamond = 4,
/obj/item/stack/ore/gold = 6,
@@ -182,3 +183,6 @@ GLOBAL_LIST_EMPTY(ore_veins)
max_mobs = 6
spawn_time = 80
+/obj/structure/vein/rock
+ mob_types = list(
+ /mob/living/simple_animal/)
From ac45d39b38dc7d97754946f8a34cb4be8906f99d Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Tue, 14 Nov 2023 14:04:10 -0500
Subject: [PATCH 22/56] I'm genuinely surprised I'm even literate
Co-authored-by: thgvr <81882910+thgvr@users.noreply.github.com>
Signed-off-by: BogCreature <112462947+BogCreature@users.noreply.github.com>
---
code/modules/mining/drill.dm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 03005e9f3819..ced8ec68ec70 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -36,7 +36,7 @@
if(panel_open && component_parts)
. += display_parts(user, TRUE)
if(cell.charge < power_cost*5)
- . += "The lower power light is blinking."
+ . += "The low power light is blinking."
switch(malfunction)
if(4)
. += "The [src]'s structure looks like it needs to be welded back together."
@@ -77,7 +77,7 @@
//Instead of being qdeled the drill requires mildly expensive repairs to use again
/obj/machinery/drill/deconstruct(disassembled)
if(active && mining)
- say("Drill integrity failure, comencing emergency shutdown procedure.")
+ say("Drill integrity failure. Engaging emergency shutdown procedure.")
//Just to make sure mobs don't spawn infinitely from the vein and as a failure state for players
mining.deconstruct()
obj_break()
@@ -89,7 +89,7 @@
//The RPED sort of trivializes a good deal of the malfunction mechancis, as such it will not be allowed to work
/obj/machinery/drill/exchange_parts(mob/user, obj/item/storage/part_replacer/W)
- to_chat(user, "[W] does not seem to work on [src], it might require more delecitate parts replacement.")
+ to_chat(user, "[W] does not seem to work on [src], it might require more delicate part manipulation.")
return
/obj/machinery/drill/attackby(obj/item/tool, mob/living/user, params)
@@ -205,7 +205,7 @@
say("Please resolve existing malfunction before continuing mining operations.")
return
if(!mining)
- to_chat(user, "[src] isn't sercured over an ore vein!")
+ to_chat(user, "[src] isn't secured over an ore vein!")
return
if(!active)
playsound(src, 'sound/machines/click.ogg', 100, TRUE)
@@ -216,7 +216,7 @@
start_mining()
return
else
- to_chat(user, "[src] is currently busy, wait till it's done!")
+ to_chat(user, "[src] is currently busy, wait until it's done!")
return
/obj/machinery/drill/update_icon_state()
@@ -255,7 +255,7 @@
for(var/obj/item/stock_parts/capacitor/capacitor in component_parts)
power_use = power_cost/capacitor.rating
if(cell.charge < power_use)
- say("Error: Internal cell charge deplted")
+ say("Error: Internal cell charge depleted")
active = FALSE
soundloop.stop()
update_overlays()
From 3cd1703424c8c3adf543a34bbb8c1c7de576ba33 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Tue, 14 Nov 2023 14:05:10 -0500
Subject: [PATCH 23/56] Smaples...
Co-authored-by: thgvr <81882910+thgvr@users.noreply.github.com>
Signed-off-by: BogCreature <112462947+BogCreature@users.noreply.github.com>
---
code/modules/overmap/missions/drill_mission.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
index fc3e3a689eff..096086f93a70 100644
--- a/code/modules/overmap/missions/drill_mission.dm
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -1,8 +1,8 @@
/datum/mission/drill
name = "Class 1 core sample mission"
desc = "We require geological information from one of the neighboring planetoids . \
- Please anchor the drill in place and defend it until it has gathered enough smaples.\
- Operation of the core sampling drill is extremely dangerous, use caution. "
+ Please anchor the drill in place and defend it until it has gathered enough samples.\
+ Operation of the core sampling drill is extremely dangerous, caution is advised. "
value = 2000
duration = 80 MINUTES
weight = 8
From 8a9b851d2501f314d8fa7c9d7243cbd3e58458bd Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Tue, 14 Nov 2023 19:17:26 -0500
Subject: [PATCH 24/56] Spawning scales with player count
Spawns roughly 1 enemy per 2 players within range of any spawner with a max range higher than 1 tile
---
code/datums/components/spawner.dm | 38 ++++++++++++++++++++-----------
code/modules/mining/drill.dm | 2 +-
2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 50e945e6790e..1c2dc71eaa24 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -88,17 +88,29 @@
return 0
//Avoid using this with spawners that add this component on initialize
//It causes numerous runtime errors during planet generation
- if(spawn_distance_max > 1)
- spot = pick(turf_peel(spawn_distance_max, spawn_distance_min, P.loc, view_based = TRUE))
- if(!spot)
- spot = pick(circlerangeturfs(P.loc, spawn_distance_max))
spawn_delay = world.time + spawn_time
- var/chosen_mob_type = pickweight(mob_types)
- var/mob/living/simple_animal/L = new chosen_mob_type(spot)
- L.flags_1 |= (P.flags_1 & ADMIN_SPAWNED_1)
- spawned_mobs += L
- L.nest = src
- L.faction = src.faction
- P.visible_message("[L] [pick(spawn_text)] [P].")
- if(length(spawn_sound))
- playsound(P, pick(spawn_sound), 50, TRUE)
+ var/spawn_multiplier = 1
+ if(spawn_distance_max > 1)
+ var/player_count = 0
+ for(var/mob/living/players in range(spawn_distance_max, P.loc))
+ if(players.ckey && players.stat == CONSCIOUS)
+ player_count++
+ for(var/obj/mecha/mechs in range(spawn_distance_max, P.loc))
+ player_count++
+ if(player_count > 3)
+ spawn_multiplier = round(player_count/2)
+ spawn_multiplier = clamp(spawn_multiplier, 1, max_mobs - spawned_mobs.len)
+ for(spawn_multiplier, spawn_multiplier > 0, spawn_multiplier--)
+ if(spawn_distance_max > 1)
+ spot = pick(turf_peel(spawn_distance_max, spawn_distance_min, P.loc, view_based = TRUE))
+ if(!spot)
+ spot = pick(circlerangeturfs(P.loc, spawn_distance_max))
+ var/chosen_mob_type = pickweight(mob_types)
+ var/mob/living/simple_animal/L = new chosen_mob_type(spot)
+ L.flags_1 |= (P.flags_1 & ADMIN_SPAWNED_1)
+ spawned_mobs += L
+ L.nest = src
+ L.faction = src.faction
+ P.visible_message("[L] [pick(spawn_text)] [P].")
+ if(length(spawn_sound))
+ playsound(P, pick(spawn_sound), 50, TRUE)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 03005e9f3819..0c5d175c53f9 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -151,7 +151,7 @@
component_parts += new_part
component_parts -= part
break
- else
+ else if(component_parts.len < needed_parts.len)
user.transferItemToLoc(tool,src)
component_parts += new_part
malfunction = null
From 50b8bc8ef1cd59136ee0412426b468c3ed9fd197 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Tue, 14 Nov 2023 20:27:20 -0500
Subject: [PATCH 25/56] Fixes a minor yet annoying bug
---
code/modules/mining/drill.dm | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 0c5d175c53f9..c8093de0f28d 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -283,14 +283,6 @@
update_icon_state()
update_overlays()
return
- else
- say("Vein depleted.")
- active = FALSE
- soundloop.stop()
- mining.deconstruct()
- mining = null
- update_icon_state()
- update_overlays()
//Handles the process of withdrawing ore from the vein itself
/obj/machinery/drill/proc/mine()
@@ -300,7 +292,16 @@
if(mining.mining_charges)
mining.mining_charges--
mining.drop_ore(round(sqrt(sensor_rating), 0.1),src)
- start_mining()
+ if(mining.mining_charges < 1)
+ say("Vein depleted.")
+ active = FALSE
+ soundloop.stop()
+ mining.deconstruct()
+ mining = null
+ update_icon_state()
+ update_overlays()
+ else
+ start_mining()
else if(!mining.mining_charges) //Extra check to prevent vein related errors locking us in place
say("Error: Vein Depleted")
active = FALSE
From a055d75396f61112a59ffc76e3505d5c09649f26 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Tue, 14 Nov 2023 20:30:37 -0500
Subject: [PATCH 26/56] Forgot to remove this before pushing, my bad
---
code/modules/mining/ore_veins.dm | 4 ----
1 file changed, 4 deletions(-)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 58c4a553008a..af29d4f88ec2 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -182,7 +182,3 @@ GLOBAL_LIST_EMPTY(ore_veins)
)
max_mobs = 6
spawn_time = 80
-
-/obj/structure/vein/rock
- mob_types = list(
- /mob/living/simple_animal/)
From 660c8e14d9e7982bb819c7064607d870caed7795 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 15 Nov 2023 03:22:10 -0500
Subject: [PATCH 27/56] Infinite mining loot fix
---
code/modules/mining/ore_veins.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index af29d4f88ec2..df37ff4d1e6f 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -133,7 +133,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
mob_types = list(
/mob/living/simple_animal/hostile/asteroid/wolf = 30,
/mob/living/simple_animal/hostile/asteroid/polarbear = 30,
- /mob/living/simple_animal/hostile/asteroid/hivelord/legion/snow = 20,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/snow/tendril = 20,
/mob/living/simple_animal/hostile/asteroid/ice_demon = 10,
/mob/living/simple_animal/hostile/asteroid/ice_whelp = 5,
/mob/living/simple_animal/hostile/asteroid/lobstrosity = 20,
From 79501329339d0aa3b36f257cb8ed154c74f96b01 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 15 Nov 2023 13:56:02 -0500
Subject: [PATCH 28/56] Vein time and malfunction tweak
---
code/modules/mining/drill.dm | 9 ++++++++-
code/modules/mining/ore_veins.dm | 8 ++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index afea55e85643..252ca2bc0ebe 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -36,8 +36,14 @@
if(panel_open && component_parts)
. += display_parts(user, TRUE)
if(cell.charge < power_cost*5)
- . += "The low power light is blinking."
+ . += "The low power light is blinking."
switch(malfunction)
+ if(1)
+ . += "The [src]'s laser array appears to be broken and needs to be replaced."
+ if(2)
+ . += "The [src]'s sensors appear to be broken and need to be replaced."
+ if(3)
+ . += "The [src]'s capacitor appears to be broken and needs to be replaced.
if(4)
. += "The [src]'s structure looks like it needs to be welded back together."
if(5)
@@ -72,6 +78,7 @@
/obj/machinery/drill/Destroy()
QDEL_NULL(soundloop)
+ QDEL_NULL(cell)
return ..()
//Instead of being qdeled the drill requires mildly expensive repairs to use again
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index df37ff4d1e6f..294e28a0bfbe 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -30,7 +30,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
var/mine_time_multiplier = 1
//Mob spawning variables
var/spawning_started = FALSE
- var/max_mobs = 4
+ var/max_mobs = 6
var/spawn_time = 150 //15 seconds
var/mob_types = list(
/mob/living/simple_animal/hostile/asteroid/goliath/beast = 60,
@@ -51,7 +51,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
/obj/structure/vein/Initialize()
. = ..()
var/ore_type_amount
- mining_charges = rand(round(mining_charges/1.5),mining_charges*1.5)
+ mining_charges = rand(roundmining_charges - 2,mining_charges + 2)
switch(vein_class)
if(1)
ore_type_amount = rand(1,3)
@@ -98,7 +98,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
//
/obj/structure/vein/classtwo
- mining_charges = 9
+ mining_charges = 8
vein_class = 2
ore_list = list(
/obj/item/stack/ore/iron = 6,
@@ -114,7 +114,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
spawn_time = 100
/obj/structure/vein/classthree
- mining_charges = 12
+ mining_charges = 10
vein_class = 3
ore_list = list(
/obj/item/stack/ore/iron = 7,
From e455b2f132c0368ea46b84dd56d735cbbc747583 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 15 Nov 2023 13:58:35 -0500
Subject: [PATCH 29/56] FUCK!!!
---
code/modules/mining/drill.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 252ca2bc0ebe..e562573899a5 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -43,7 +43,7 @@
if(2)
. += "The [src]'s sensors appear to be broken and need to be replaced."
if(3)
- . += "The [src]'s capacitor appears to be broken and needs to be replaced.
+ . += "The [src]'s capacitor appears to be broken and needs to be replaced."
if(4)
. += "The [src]'s structure looks like it needs to be welded back together."
if(5)
From 3a5a6d8027e4427f63c0056b1dbb605e61802980 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 15 Nov 2023 13:59:59 -0500
Subject: [PATCH 30/56] I hate this
---
code/modules/mining/ore_veins.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 294e28a0bfbe..d704ee02e8a8 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -51,7 +51,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
/obj/structure/vein/Initialize()
. = ..()
var/ore_type_amount
- mining_charges = rand(roundmining_charges - 2,mining_charges + 2)
+ mining_charges = rand(round(mining_charges - 2),mining_charges + 2)
switch(vein_class)
if(1)
ore_type_amount = rand(1,3)
From 63406bb00b0f1dbf1017fe3f08a18e4d3ac5c88d Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 15 Nov 2023 14:02:29 -0500
Subject: [PATCH 31/56] Forgot to change these
---
code/modules/mining/ore_veins.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index d704ee02e8a8..c028f46b7aae 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -152,7 +152,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
)
/obj/structure/vein/ice/classtwo
- mining_charges = 9
+ mining_charges = 8
vein_class = 2
ore_list = list(
/obj/item/stack/ore/iron = 6,
@@ -168,7 +168,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
spawn_time = 100
/obj/structure/vein/ice/classthree
- mining_charges = 12
+ mining_charges = 10
vein_class = 3
ore_list = list(
/obj/item/stack/ore/iron = 5,
From 1a490b4e0cdfb50164a54f3aaa7843c8c0525fc8 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 15 Nov 2023 15:02:09 -0500
Subject: [PATCH 32/56] Fix to stock part hell
---
code/__DEFINES/stock_parts.dm | 6 ++++++
code/modules/mining/drill.dm | 17 ++++++++++++-----
code/modules/research/stock_parts.dm | 6 ++++++
shiptest.dme | 1 +
4 files changed, 25 insertions(+), 5 deletions(-)
create mode 100644 code/__DEFINES/stock_parts.dm
diff --git a/code/__DEFINES/stock_parts.dm b/code/__DEFINES/stock_parts.dm
new file mode 100644
index 000000000000..d4ecb54a86a3
--- /dev/null
+++ b/code/__DEFINES/stock_parts.dm
@@ -0,0 +1,6 @@
+//Stock part types (like tool behaviour but for stock parts)
+#define PART_CAPACITOR "capacitor"
+#define PART_SCANNER "scanning module"
+#define PART_MANIPULATOR "manipulator"
+#define PART_LASER "micro-laser"
+#define PART_BIN "matter bin"
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index e562573899a5..587764445ae0 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -30,6 +30,7 @@
var/preload_cell_type = /obj/item/stock_parts/cell
var/power_cost = 100
var/metal_attached
+ var/missing_part //I hate this but it's better than most the ideas I've had
/obj/machinery/drill/examine(mob/user)
. = ..()
@@ -39,11 +40,11 @@
. += "The low power light is blinking."
switch(malfunction)
if(1)
- . += "The [src]'s laser array appears to be broken and needs to be replaced."
+ . += "The [src]'s laser array appears to be broken and needs to be replaced."
if(2)
- . += "The [src]'s sensors appear to be broken and need to be replaced."
+ . += "The [src]'s sensors appear to be broken and need to be replaced."
if(3)
- . += "The [src]'s capacitor appears to be broken and needs to be replaced."
+ . += "The [src]'s capacitor appears to be broken and needs to be replaced."
if(4)
. += "The [src]'s structure looks like it needs to be welded back together."
if(5)
@@ -152,17 +153,20 @@
if(is_type_in_list(tool,needed_parts))
for(var/obj/item/stock_parts/part in component_parts)
var/obj/item/stock_parts/new_part = tool
- if(new_part.parent_type == part.parent_type || istype(new_part,part))
+ if(new_part.part_behaviour == part.part_behaviour)
user.transferItemToLoc(tool,src)
part.forceMove(user.loc)
component_parts += new_part
component_parts -= part
+ to_chat(user, "You replace [part] with [new_part].")
break
- else if(component_parts.len < needed_parts.len)
+ else if(istype(new_part,missing_part))
user.transferItemToLoc(tool,src)
component_parts += new_part
malfunction = null
+ missing_part = null
obj_integrity = max_integrity
+ to_chat(user, "You replace the broken part with [new_part].")
break
return
if(tool.tool_behaviour == TOOL_MULTITOOL && malfunction == MALF_CALIBRATE)
@@ -322,16 +326,19 @@
say("Malfunction: Laser array damaged, please replace before continuing mining operations.")
for (var/obj/item/stock_parts/micro_laser/laser in component_parts)
component_parts.Remove(laser)
+ missing_part = /obj/item/stock_parts/micro_laser
return
if(MALF_SENSOR)
say("Malfunction: Ground penetrating scanner damaged, please replace before continuing mining operations.")
for (var/obj/item/stock_parts/scanning_module/sensor in component_parts)
component_parts.Remove(sensor)
+ missing_part = /obj/item/stock_parts/scanning_module
return
if(MALF_CAPACITOR)
say("Malfunction: Energy cell capacitor damaged, please replace before continuing mining operations.")
for (var/obj/item/stock_parts/capacitor/capacitor in component_parts)
component_parts.Remove(capacitor)
+ missing_part = /obj/item/stock_parts/capacitor
return
if(MALF_STRUCTURAL)
say("Malfunction: Drill plating damaged, provide structural repairs before continuing mining operations.")
diff --git a/code/modules/research/stock_parts.dm b/code/modules/research/stock_parts.dm
index ccddbdb3eb22..3bafadbc08bd 100644
--- a/code/modules/research/stock_parts.dm
+++ b/code/modules/research/stock_parts.dm
@@ -111,6 +111,7 @@ If you create T5+ please take a pass at gene_modder.dm [L40]. Max_values MUST fi
icon = 'icons/obj/stock_parts.dmi'
w_class = WEIGHT_CLASS_SMALL
var/rating = 1
+ var/part_behaviour
/obj/item/stock_parts/Initialize()
. = ..()
@@ -126,30 +127,35 @@ If you create T5+ please take a pass at gene_modder.dm [L40]. Max_values MUST fi
name = "capacitor"
desc = "A basic capacitor used in the construction of a variety of devices."
icon_state = "capacitor"
+ part_behaviour = PART_CAPACITOR
custom_materials = list(/datum/material/iron=50, /datum/material/glass=50)
/obj/item/stock_parts/scanning_module
name = "scanning module"
desc = "A compact, high resolution scanning module used in the construction of certain devices."
icon_state = "scan_module"
+ part_behaviour = PART_SCANNER
custom_materials = list(/datum/material/iron=50, /datum/material/glass=20)
/obj/item/stock_parts/manipulator
name = "micro-manipulator"
desc = "A tiny little manipulator used in the construction of certain devices."
icon_state = "micro_mani"
+ part_behaviour = PART_MANIPULATOR
custom_materials = list(/datum/material/iron=30)
/obj/item/stock_parts/micro_laser
name = "micro-laser"
desc = "A tiny laser used in certain devices."
icon_state = "micro_laser"
+ part_behaviour = PART_LASER
custom_materials = list(/datum/material/iron=10, /datum/material/glass=20)
/obj/item/stock_parts/matter_bin
name = "matter bin"
desc = "A container designed to hold compressed matter awaiting reconstruction."
icon_state = "matter_bin"
+ part_behaviour = PART_BIN
custom_materials = list(/datum/material/iron=80)
//Rating 2
diff --git a/shiptest.dme b/shiptest.dme
index 69968bbd3c74..84383927ecbd 100644
--- a/shiptest.dme
+++ b/shiptest.dme
@@ -134,6 +134,7 @@
#include "code\__DEFINES\stat_tracking.dm"
#include "code\__DEFINES\statpanel.dm"
#include "code\__DEFINES\status_effects.dm"
+#include "code\__DEFINES\stock_parts.dm"
#include "code\__DEFINES\subsystems.dm"
#include "code\__DEFINES\tgs.config.dm"
#include "code\__DEFINES\tgs.dm"
From 9c80491d0e4ab568cee275ab09e25c16c0b02997 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 15 Nov 2023 15:50:55 -0500
Subject: [PATCH 33/56] Temporarily buffed drill output overall
Holdover until I have a better method of ore distribution
---
code/modules/mining/ore_veins.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index c028f46b7aae..5bf4d83c7666 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -86,7 +86,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
for(class, class>0, class--)
var/picked
picked = pick(vein_contents)
- new picked(pick(get_adjacent_open_turfs(current)),round(rand(5,10)*multiplier))
+ new picked(pick(get_adjacent_open_turfs(current)),round(rand(10,15)*multiplier))
/obj/structure/vein/proc/destroy_effect()
playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
From 11222bcd971278abbf300ee2d650faf244c899a9 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 15 Nov 2023 21:25:33 -0500
Subject: [PATCH 34/56] Forgot I moved this around on the main drill
---
code/modules/overmap/missions/drill_mission.dm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
index 096086f93a70..b0522c8c4fda 100644
--- a/code/modules/overmap/missions/drill_mission.dm
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -90,7 +90,16 @@
if(mining.mining_charges)
mining.mining_charges--
num_current++
- start_mining()
+ if(mining.mining_charges < 1)
+ say("Vein depleted.")
+ active = FALSE
+ soundloop.stop()
+ mining.deconstruct()
+ mining = null
+ update_icon_state()
+ update_overlays()
+ else
+ start_mining()
else if(!mining.mining_charges)
say("Error: Vein Depleted")
active = FALSE
From ebb9f654517ab23f979a619ba30e77eabdf1c68f Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 15 Nov 2023 23:54:57 -0500
Subject: [PATCH 35/56] Cooldown stuffs
Co-authored-by: Mark Suckerberg
Signed-off-by: BogCreature <112462947+BogCreature@users.noreply.github.com>
---
code/datums/components/spawner.dm | 46 ++++++++++++++++---------------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 1c2dc71eaa24..f9bebe32b118 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -63,39 +63,41 @@
/datum/component/spawner/proc/try_spawn_mob()
var/atom/P = parent
- var/turf/spot = P.loc
+ var/turf/spot = get_turf(P)
//Checks for handling the wave-based pausing and unpausing of spawning
//Almost certainly a better way to do this, but until then this technically works
if(spawning_paused)
if(!downtime_timer)
- downtime_timer = wave_downtime + world.time
- if(world.time > downtime_timer)
+ COOLDOWN_START(src, downtime_timer, wave_downtime)
+ if(COOLDOWN_FINISHED(src, downtime_timer))
spawning_paused = FALSE
- downtime_timer = null
- return 0
- else
- return 0
- if(!wave_timer && wave_length)
- wave_timer = wave_length + world.time
- if(wave_timer && world.time > wave_timer)
- spawning_paused = TRUE
- wave_timer = null
- return 0
+ COOLDOWN_RESET(src, downtime_timer)
+ return
+ if(wave_length)
+ if(!wave_timer)
+ COOLDOWN_START(src, wave_timer, wave_length)
+ if(wave_timer && COOLDOWN_FINISHED(src, wave_timer))
+ spawning_paused = TRUE
+ COOLDOWN_RESET(src, wave_timer)
+ return
////////////////////////////////
- if(spawned_mobs.len >= max_mobs)
- return 0
- if(spawn_delay > world.time)
- return 0
+ if(length(spawned_mobs) >= max_mobs)
+ return
+ if(COOLDOWN_FINISHED(src, spawn_delay))
+ return
//Avoid using this with spawners that add this component on initialize
//It causes numerous runtime errors during planet generation
- spawn_delay = world.time + spawn_time
+ COOLDOWN_START(src, spawn_delay, spawn_time)
var/spawn_multiplier = 1
if(spawn_distance_max > 1)
var/player_count = 0
- for(var/mob/living/players in range(spawn_distance_max, P.loc))
- if(players.ckey && players.stat == CONSCIOUS)
- player_count++
- for(var/obj/mecha/mechs in range(spawn_distance_max, P.loc))
+ for(var/mob/player as anything in GLOB.player_list)
+ if(!isliving(player))
+ continue
+ if(player.stat != CONSCIOUS)
+ continue
+ if(get_dist(get_turf(player), spot) > spawn_distance_max)
+ continue
player_count++
if(player_count > 3)
spawn_multiplier = round(player_count/2)
From 09460089844f4b706ace37ed67b4b9ffbd45ada8 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Fri, 17 Nov 2023 00:58:23 -0500
Subject: [PATCH 36/56] Spawner waves improved
Switches spawner waves to temporarily stopping processing instead of the previous method
---
code/datums/components/spawner.dm | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index f9bebe32b118..98984836b29b 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -11,7 +11,6 @@
var/spawn_distance_max = 1
var/wave_length //Average time until break in spawning
var/wave_downtime //Average time until spawning starts again
- var/spawning_paused = FALSE
var/wave_timer
var/downtime_timer
@@ -45,11 +44,6 @@
if(!parent) //Sanity check for instances where the spawner may be sleeping while the parent is destroyed
Destroy(TRUE,FALSE)
return
- if(spawning_paused)
- sleep(wave_downtime)
- spawning_paused = FALSE
- wave_timer = null
- return
try_spawn_mob()
/datum/component/spawner/proc/stop_spawning(force)
@@ -61,34 +55,31 @@
L.nest = null
spawned_mobs = null
+/datum/component/spawner/proc/unpause_spawning()
+ START_PROCESSING(SSprocessing, src)
+
/datum/component/spawner/proc/try_spawn_mob()
var/atom/P = parent
var/turf/spot = get_turf(P)
//Checks for handling the wave-based pausing and unpausing of spawning
//Almost certainly a better way to do this, but until then this technically works
- if(spawning_paused)
- if(!downtime_timer)
- COOLDOWN_START(src, downtime_timer, wave_downtime)
- if(COOLDOWN_FINISHED(src, downtime_timer))
- spawning_paused = FALSE
- COOLDOWN_RESET(src, downtime_timer)
- return
if(wave_length)
if(!wave_timer)
COOLDOWN_START(src, wave_timer, wave_length)
if(wave_timer && COOLDOWN_FINISHED(src, wave_timer))
- spawning_paused = TRUE
COOLDOWN_RESET(src, wave_timer)
+ STOP_PROCESSING(SSprocessing, src)
+ addtimer(CALLBACK(src, PROC_REF(unpause_spawning)), wave_downtime)
return
////////////////////////////////
if(length(spawned_mobs) >= max_mobs)
return
- if(COOLDOWN_FINISHED(src, spawn_delay))
+ if(!COOLDOWN_FINISHED(src, spawn_delay))
return
- //Avoid using this with spawners that add this component on initialize
- //It causes numerous runtime errors during planet generation
COOLDOWN_START(src, spawn_delay, spawn_time)
var/spawn_multiplier = 1
+ //Avoid using this with spawners that add this component on initialize
+ //It causes numerous runtime errors during planet generation
if(spawn_distance_max > 1)
var/player_count = 0
for(var/mob/player as anything in GLOB.player_list)
From b26494c0d0ae63e19a5d5af3058abe625c68d8a3 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Fri, 17 Nov 2023 16:47:08 -0500
Subject: [PATCH 37/56] Drill anti cheese measure
Also buffed ore output a bit
---
code/datums/components/spawner.dm | 9 ++++++---
code/modules/mining/ore_veins.dm | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 98984836b29b..4076160621dc 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -95,9 +95,12 @@
spawn_multiplier = clamp(spawn_multiplier, 1, max_mobs - spawned_mobs.len)
for(spawn_multiplier, spawn_multiplier > 0, spawn_multiplier--)
if(spawn_distance_max > 1)
- spot = pick(turf_peel(spawn_distance_max, spawn_distance_min, P.loc, view_based = TRUE))
- if(!spot)
- spot = pick(circlerangeturfs(P.loc, spawn_distance_max))
+ var/origin = spot
+ var/list/peel = turf_peel(spawn_distance_max, spawn_distance_min, origin, view_based = TRUE)
+ if(peel.len>0)
+ spot = pick(peel)
+ else
+ spot = pick(circleviewturfs(origin, spawn_distance_max))
var/chosen_mob_type = pickweight(mob_types)
var/mob/living/simple_animal/L = new chosen_mob_type(spot)
L.flags_1 |= (P.flags_1 & ADMIN_SPAWNED_1)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 5bf4d83c7666..dd436071f140 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -86,7 +86,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
for(class, class>0, class--)
var/picked
picked = pick(vein_contents)
- new picked(pick(get_adjacent_open_turfs(current)),round(rand(10,15)*multiplier))
+ new picked(pick(get_adjacent_open_turfs(current)),round(rand(15,20)*multiplier))
/obj/structure/vein/proc/destroy_effect()
playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
From 839338fda3a93cd615124b4597da86ecec916a77 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 22 Nov 2023 22:28:51 -0500
Subject: [PATCH 38/56] Balance tweaks
---
code/modules/mining/ore_veins.dm | 16 +++++++++++++++-
code/modules/overmap/missions/drill_mission.dm | 6 +++---
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index dd436071f140..f85c9fb2ab84 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -33,7 +33,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
var/max_mobs = 6
var/spawn_time = 150 //15 seconds
var/mob_types = list(
- /mob/living/simple_animal/hostile/asteroid/goliath/beast = 60,
+ /mob/living/simple_animal/hostile/asteroid/goliath/beast/tendril = 60,
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/tendril = 20,
/mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
)
@@ -112,6 +112,13 @@ GLOBAL_LIST_EMPTY(ore_veins)
)
max_mobs = 6
spawn_time = 100
+ mob_types = list(
+ /mob/living/simple_animal/hostile/asteroid/goliath/beast/tendril = 60,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/tendril = 30,
+ /mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
+ /mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient = 5,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/dwarf = 5,
+ )
/obj/structure/vein/classthree
mining_charges = 10
@@ -128,6 +135,13 @@ GLOBAL_LIST_EMPTY(ore_veins)
)
max_mobs = 6 //Best not to go past 6 due to balance and lag reasons
spawn_time = 80
+ mob_types = list(
+ /mob/living/simple_animal/hostile/asteroid/goliath/beast/tendril = 60,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/tendril = 30,
+ /mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
+ /mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient = 10,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/dwarf = 10,
+ )
/obj/structure/vein/ice
mob_types = list(
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
index b0522c8c4fda..553c8be41ef3 100644
--- a/code/modules/overmap/missions/drill_mission.dm
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -8,7 +8,7 @@
weight = 8
var/obj/machinery/drill/mission/sampler
- var/num_wanted = 8
+ var/num_wanted = 5
var/class_wanted = 1
/datum/mission/drill/New(...)
@@ -54,7 +54,7 @@
value = 3500
weight = 6
class_wanted = 2
- num_wanted = 10
+ num_wanted = 7
/datum/mission/drill/classthree
name = "Class 3 core sample mission"
@@ -62,7 +62,7 @@
weight = 4
duration = 100 MINUTES
class_wanted = 3
- num_wanted = 12
+ num_wanted = 9
/*
Core sampling drill
From 8a28244ce24a17b4ab989f80f58ff0bed5c6d95a Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 22 Nov 2023 22:33:16 -0500
Subject: [PATCH 39/56] I like these numbers a bit better
---
code/modules/overmap/missions/drill_mission.dm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
index 553c8be41ef3..3163f58f2cf7 100644
--- a/code/modules/overmap/missions/drill_mission.dm
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -8,7 +8,7 @@
weight = 8
var/obj/machinery/drill/mission/sampler
- var/num_wanted = 5
+ var/num_wanted = 4
var/class_wanted = 1
/datum/mission/drill/New(...)
@@ -54,7 +54,7 @@
value = 3500
weight = 6
class_wanted = 2
- num_wanted = 7
+ num_wanted = 6
/datum/mission/drill/classthree
name = "Class 3 core sample mission"
@@ -62,7 +62,7 @@
weight = 4
duration = 100 MINUTES
class_wanted = 3
- num_wanted = 9
+ num_wanted = 8
/*
Core sampling drill
From 3002eb7b94896b208bce50adbbb8d53020a9ad72 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 29 Nov 2023 17:03:03 -0500
Subject: [PATCH 40/56] Drill mission progress fix
---
code/modules/overmap/missions/drill_mission.dm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
index 3163f58f2cf7..450a547cb3aa 100644
--- a/code/modules/overmap/missions/drill_mission.dm
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -35,7 +35,10 @@
return . && (sampler.num_current >= num_wanted) && (scanner_port?.current_ship == servant)
/datum/mission/drill/get_progress_string()
- return //"[sampler.num_current]/[num_wanted]"
+ if(!sampler)
+ return "0/[num_wanted]"
+ else
+ return "[sampler.num_current]/[num_wanted]"
/datum/mission/drill/Destroy()
sampler = null
From cebb293867b379bf1181e87ef5d47814219af6eb Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 29 Nov 2023 18:23:40 -0500
Subject: [PATCH 41/56] Finer control of veins
---
code/modules/mining/ore_veins.dm | 37 ++++++++++++++++++--------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index f85c9fb2ab84..ae8b260ef9bd 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -25,9 +25,13 @@ GLOBAL_LIST_EMPTY(ore_veins)
)
//The post initialize list of all possible drops from the vein
//Meant to be player facing in the form of mining scanners
+ //Contents won't be randomized if the list isn't empty on initialize
var/list/vein_contents = list()
- //Allows subtyped drills to determine how long it takes to mine one mining charge
+ //Allows subtyped veins to determine how long it takes to mine one mining charge
var/mine_time_multiplier = 1
+ //Allows subtyped veins to determine how much loot is dropped per drop_ore call
+ var/drop_rate_amount_min = 15
+ var/drop_rate_amount_max = 20
//Mob spawning variables
var/spawning_started = FALSE
var/max_mobs = 6
@@ -52,20 +56,21 @@ GLOBAL_LIST_EMPTY(ore_veins)
. = ..()
var/ore_type_amount
mining_charges = rand(round(mining_charges - 2),mining_charges + 2)
- switch(vein_class)
- if(1)
- ore_type_amount = rand(1,3)
- if(2)
- ore_type_amount = rand(3,5)
- if(3)
- ore_type_amount = rand(4,6)
- else
- ore_type_amount = 1
- for(ore_type_amount, ore_type_amount>0, ore_type_amount--)
- var/picked
- picked = pickweight(ore_list)
- vein_contents.Add(picked)
- ore_list.Remove(picked)
+ if(!LAZYLEN(vein_contents))
+ switch(vein_class)
+ if(1)
+ ore_type_amount = rand(1,3)
+ if(2)
+ ore_type_amount = rand(3,5)
+ if(3)
+ ore_type_amount = rand(4,6)
+ else
+ ore_type_amount = 1
+ for(ore_type_amount, ore_type_amount>0, ore_type_amount--)
+ var/picked
+ picked = pickweight(ore_list)
+ vein_contents.Add(picked)
+ ore_list.Remove(picked)
GLOB.ore_veins += src
/obj/structure/vein/Destroy()
@@ -86,7 +91,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
for(class, class>0, class--)
var/picked
picked = pick(vein_contents)
- new picked(pick(get_adjacent_open_turfs(current)),round(rand(15,20)*multiplier))
+ new picked(pick(get_adjacent_open_turfs(current)),round(rand(drop_rate_amount_min,drop_rate_amount_max)*multiplier))
/obj/structure/vein/proc/destroy_effect()
playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
From 26b9afe8100bc049a2a31e9379c617fb06926fa2 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 29 Nov 2023 20:07:28 -0500
Subject: [PATCH 42/56] No more dwarf legion farming
---
code/modules/mining/ore_veins.dm | 4 ++--
.../mob/living/simple_animal/hostile/mining_mobs/hivelord.dm | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index ae8b260ef9bd..5c548fbcc0d3 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -122,7 +122,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/tendril = 30,
/mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
/mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient = 5,
- /mob/living/simple_animal/hostile/asteroid/hivelord/legion/dwarf = 5,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/dwarf/tendril = 5,
)
/obj/structure/vein/classthree
@@ -145,7 +145,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/tendril = 30,
/mob/living/simple_animal/hostile/asteroid/brimdemon = 20,
/mob/living/simple_animal/hostile/asteroid/goliath/beast/ancient = 10,
- /mob/living/simple_animal/hostile/asteroid/hivelord/legion/dwarf = 10,
+ /mob/living/simple_animal/hostile/asteroid/hivelord/legion/dwarf/tendril = 10,
)
/obj/structure/vein/ice
diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm
index bdc4124ed929..c4b11296d42d 100644
--- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm
+++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm
@@ -175,6 +175,9 @@
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/tendril
fromtendril = TRUE
+/mob/living/simple_animal/hostile/asteroid/hivelord/legion/dwarf/tendril
+ fromtendril = TRUE
+
/mob/living/simple_animal/hostile/asteroid/hivelord/legion/dwarf/death(gibbed)
move_force = MOVE_FORCE_DEFAULT
move_resist = MOVE_RESIST_DEFAULT
From 4bf40d5e250a9a4e949836bef2f34dc210786ca1 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Thu, 30 Nov 2023 02:43:45 -0500
Subject: [PATCH 43/56] runtime fix
---
code/modules/mining/equipment/mineral_scanner.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/mining/equipment/mineral_scanner.dm b/code/modules/mining/equipment/mineral_scanner.dm
index 8f4969857d75..bbd0c9831e53 100644
--- a/code/modules/mining/equipment/mineral_scanner.dm
+++ b/code/modules/mining/equipment/mineral_scanner.dm
@@ -166,7 +166,7 @@
/obj/item/pinpointer/mineral/process()
switch(scanmode)
if(SCANMODE_SUBSURFACE)
- if(active && target.loc == null)
+ if(active && target && target.loc == null)
target = null
toggle_on()
. = ..() //returns pinpointer code if its scanning for deepcore spots
From 12966d43d1d5c829a7d8d8814fe1482f35d39ed7 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 6 Dec 2023 14:40:40 -0500
Subject: [PATCH 44/56] Rebalances and a bugfix
---
code/modules/mining/drill.dm | 1 +
code/modules/mining/ore_veins.dm | 30 +++++++++++--------
.../hostile/mining_mobs/goliath.dm | 1 +
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 587764445ae0..e0c83beac842 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -190,6 +190,7 @@
var/obj/item/stock_parts/cell/battery = tool
if(cell)
to_chat(user, "[src] already has a cell!")
+ return
else //This should literally never be tripped unless someone tries to put a watch battery in it or something, but just in case
if(battery.maxcharge < power_cost)
to_chat(user, "[src] requires a higher capacity cell.")
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 5c548fbcc0d3..17e07a6c0e7a 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -17,8 +17,8 @@ GLOBAL_LIST_EMPTY(ore_veins)
//The design process is that class 1 veins have a small chance of generating with class 2 ores and so on
//As higher class veins will be increasingly harder to mine
var/list/ore_list = list(
- /obj/item/stack/ore/iron = 6,
- /obj/item/stack/ore/plasma = 2,
+ /obj/item/stack/ore/iron = 7,
+ /obj/item/stack/ore/plasma = 3,
/obj/item/stack/ore/silver = 2,
/obj/item/stack/ore/uranium = 1,
/obj/item/stack/ore/titanium = 2,
@@ -45,6 +45,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
var/faction = list("hostile","mining")
var/spawn_sound = list('sound/effects/break_stone.ogg')
var/spawner_type = /datum/component/spawner
+ var/spawner
var/spawn_distance_min = 4
var/spawn_distance_max = 6
var/wave_length = 2 MINUTES
@@ -82,7 +83,10 @@ GLOBAL_LIST_EMPTY(ore_veins)
return..()
/obj/structure/vein/proc/begin_spawning()
- AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max, wave_length, wave_downtime)
+ spawner = AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max, wave_length, wave_downtime)
+
+/obj/structure/vein/proc/toggle_spawning()
+
//Pulls a random ore from the vein list per vein_class
/obj/structure/vein/proc/drop_ore(multiplier,obj/machinery/drill/current)
@@ -106,8 +110,8 @@ GLOBAL_LIST_EMPTY(ore_veins)
mining_charges = 8
vein_class = 2
ore_list = list(
- /obj/item/stack/ore/iron = 6,
- /obj/item/stack/ore/plasma = 2,
+ /obj/item/stack/ore/iron = 8,
+ /obj/item/stack/ore/plasma = 3,
/obj/item/stack/ore/silver = 4,
/obj/item/stack/ore/uranium = 2,
/obj/item/stack/ore/titanium = 5,
@@ -129,8 +133,8 @@ GLOBAL_LIST_EMPTY(ore_veins)
mining_charges = 10
vein_class = 3
ore_list = list(
- /obj/item/stack/ore/iron = 7,
- /obj/item/stack/ore/plasma = 2,
+ /obj/item/stack/ore/iron = 9,
+ /obj/item/stack/ore/plasma = 3,
/obj/item/stack/ore/silver = 5,
/obj/item/stack/ore/uranium = 2,
/obj/item/stack/ore/titanium = 6,
@@ -160,8 +164,8 @@ GLOBAL_LIST_EMPTY(ore_veins)
//Ice planets earn a slightly higher rare ore chance on account of them being notably harder
//Alongside being a much more reliable source of plasma
ore_list = list(
- /obj/item/stack/ore/iron = 5,
- /obj/item/stack/ore/plasma = 6,
+ /obj/item/stack/ore/iron = 7,
+ /obj/item/stack/ore/plasma = 7,
/obj/item/stack/ore/silver = 3,
/obj/item/stack/ore/uranium = 1,
/obj/item/stack/ore/titanium = 2,
@@ -174,8 +178,8 @@ GLOBAL_LIST_EMPTY(ore_veins)
mining_charges = 8
vein_class = 2
ore_list = list(
- /obj/item/stack/ore/iron = 6,
- /obj/item/stack/ore/plasma = 8,
+ /obj/item/stack/ore/iron = 8,
+ /obj/item/stack/ore/plasma = 9,
/obj/item/stack/ore/silver = 5,
/obj/item/stack/ore/uranium = 2,
/obj/item/stack/ore/titanium = 6,
@@ -190,8 +194,8 @@ GLOBAL_LIST_EMPTY(ore_veins)
mining_charges = 10
vein_class = 3
ore_list = list(
- /obj/item/stack/ore/iron = 5,
- /obj/item/stack/ore/plasma = 8,
+ /obj/item/stack/ore/iron = 8,
+ /obj/item/stack/ore/plasma = 9,
/obj/item/stack/ore/silver = 6,
/obj/item/stack/ore/uranium = 2,
/obj/item/stack/ore/titanium = 6,
diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm
index 1fa691b85de7..d2df643f1f42 100644
--- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm
+++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm
@@ -281,6 +281,7 @@
cached_tentacle_turfs -= t
/mob/living/simple_animal/hostile/asteroid/goliath/beast/tendril
+ butcher_results = list(/obj/item/reagent_containers/food/snacks/meat/slab/goliath = 2, /obj/item/stack/sheet/bone = 2, /obj/item/stack/sheet/sinew = 2)
fromtendril = TRUE
//tentacles
From be05c97fa0573e4a4a7cc9776e2259f0913f3c9b Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Sat, 9 Dec 2023 13:54:39 -0500
Subject: [PATCH 45/56] Off button update
---
code/datums/components/spawner.dm | 10 +++++++++-
code/modules/mining/drill.dm | 30 ++++++++++++++++++++++++++++--
code/modules/mining/ore_veins.dm | 2 +-
3 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 4076160621dc..7ee7cb4455b2 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -13,6 +13,7 @@
var/wave_downtime //Average time until spawning starts again
var/wave_timer
var/downtime_timer
+ var/current_timerid
/datum/component/spawner/Initialize(_mob_types, _spawn_time, _faction, _spawn_text, _max_mobs, _spawn_sound, _spawn_distance_min, _spawn_distance_max, _wave_length, _wave_downtime)
@@ -50,11 +51,18 @@
SIGNAL_HANDLER
STOP_PROCESSING(SSprocessing, src)
+ deltimer(current_timerid)
for(var/mob/living/simple_animal/L in spawned_mobs)
if(L.nest == src)
L.nest = null
spawned_mobs = null
+//Different from stop_spawning() as it doesn't untether all mobs from it and is meant for temporarily stopping spawning
+/datum/component/spawner/proc/pause_spawning()
+ STOP_PROCESSING(SSprocessing, src)
+ deltimer(current_timerid) //Otherwise if spawning is paused while the wave timer is loose it'll just unpause on its own
+ COOLDOWN_RESET(src, wave_timer)
+
/datum/component/spawner/proc/unpause_spawning()
START_PROCESSING(SSprocessing, src)
@@ -69,7 +77,7 @@
if(wave_timer && COOLDOWN_FINISHED(src, wave_timer))
COOLDOWN_RESET(src, wave_timer)
STOP_PROCESSING(SSprocessing, src)
- addtimer(CALLBACK(src, PROC_REF(unpause_spawning)), wave_downtime)
+ current_timerid = addtimer(CALLBACK(src, PROC_REF(unpause_spawning)), wave_downtime, TIMER_STOPPABLE)
return
////////////////////////////////
if(length(spawned_mobs) >= max_mobs)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index e0c83beac842..9b1e402797b8 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -31,6 +31,7 @@
var/power_cost = 100
var/metal_attached
var/missing_part //I hate this but it's better than most the ideas I've had
+ var/current_timerid
/obj/machinery/drill/examine(mob/user)
. = ..()
@@ -56,6 +57,7 @@
. += "Replacement plating has been secured to [src], but still needs to be welded into place."
if(machine_stat & BROKEN && !metal_attached)
. += "[src]'s structure has been totaled, the plasteel plating needs to be replaced."
+ . += "The manual shutoff switch can be pulled with Alt Click."
/obj/machinery/drill/Initialize()
. = ..()
@@ -143,6 +145,9 @@
to_chat(user, "You unsecure the [src] from the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
anchored = FALSE
+ if(mining.spawner)
+ STOP_PROCESSING(SSprocessing, mining.spawner)
+ mining.spawning_started = FALSE
mining = null
update_icon_state()
return
@@ -210,6 +215,24 @@
return
return ..()
+/obj/machinery/drill/AltClick(mob/user)
+ if(active)
+ to_chat(user, "You begin the manual shutoff process.")
+ if(do_after(user,10))
+ active = FALSE
+ soundloop.stop()
+ deltimer(current_timerid)
+ //STOP_PROCESSING(SSprocessing, mining.spawner)
+ mining.spawner.pause_spawning()
+ mining.spawning_started = FALSE
+ playsound(src, 'sound/machines/switch2.ogg', 50, TRUE)
+ say("Manual shutoff engaged, ceasing mining operations.")
+ update_icon_state()
+ update_overlays()
+ else
+ to_chat(user, "You cancel the manual shutoff process.")
+ return
+
//Can we even turn the damn thing on?
/obj/machinery/drill/interact(mob/user, special_state)
. = ..()
@@ -283,14 +306,17 @@
var/mine_time
active = TRUE
soundloop.start()
- if(!mining.spawning_started)
+ if(!mining.spawner)
mining.begin_spawning()
mining.spawning_started = TRUE
+ else if(!mining.spawning_started)
+ START_PROCESSING(SSprocessing, mining.spawner)
+ mining.spawning_started = TRUE
for(var/obj/item/stock_parts/micro_laser/laser in component_parts)
mine_time = round((300/sqrt(laser.rating))*mining.mine_time_multiplier)
eta = mine_time*mining.mining_charges
cell.use(power_use)
- addtimer(CALLBACK(src, PROC_REF(mine)), mine_time)
+ current_timerid = addtimer(CALLBACK(src, PROC_REF(mine)), mine_time, TIMER_STOPPABLE)
say("Estimated time until vein depletion: [time2text(eta,"mm:ss")].")
update_icon_state()
update_overlays()
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 17e07a6c0e7a..a2e47cb938ec 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -45,7 +45,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
var/faction = list("hostile","mining")
var/spawn_sound = list('sound/effects/break_stone.ogg')
var/spawner_type = /datum/component/spawner
- var/spawner
+ var/datum/component/spawner/spawner
var/spawn_distance_min = 4
var/spawn_distance_max = 6
var/wave_length = 2 MINUTES
From 053dfdcfac3f49fdbd45062bbbcf6f0d72ad43b5 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Mon, 11 Dec 2023 21:00:59 -0500
Subject: [PATCH 46/56] Apply suggestions from code review
Co-authored-by: Mark Suckerberg
Signed-off-by: BogCreature <112462947+BogCreature@users.noreply.github.com>
---
code/datums/components/spawner.dm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 7ee7cb4455b2..9fd090b92e31 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -43,7 +43,7 @@
/datum/component/spawner/process()
if(!parent) //Sanity check for instances where the spawner may be sleeping while the parent is destroyed
- Destroy(TRUE,FALSE)
+ qdel(src)
return
try_spawn_mob()
@@ -100,12 +100,12 @@
player_count++
if(player_count > 3)
spawn_multiplier = round(player_count/2)
- spawn_multiplier = clamp(spawn_multiplier, 1, max_mobs - spawned_mobs.len)
- for(spawn_multiplier, spawn_multiplier > 0, spawn_multiplier--)
+ spawn_multiplier = clamp(spawn_multiplier, 1, max_mobs - length(spawned_mobs))
+ for(var/mob_index in 1 to spawn_multiplier)
if(spawn_distance_max > 1)
var/origin = spot
var/list/peel = turf_peel(spawn_distance_max, spawn_distance_min, origin, view_based = TRUE)
- if(peel.len>0)
+ if(length(peel))
spot = pick(peel)
else
spot = pick(circleviewturfs(origin, spawn_distance_max))
From c27ba67a35b53bf014b54cf6639d5419ecb8962d Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Mon, 11 Dec 2023 21:04:47 -0500
Subject: [PATCH 47/56] Apply suggestions from code review
Co-authored-by: Mark Suckerberg
Signed-off-by: BogCreature <112462947+BogCreature@users.noreply.github.com>
---
code/game/objects/items/pinpointer.dm | 2 +-
code/modules/mining/ore_veins.dm | 12 +++++-------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/code/game/objects/items/pinpointer.dm b/code/game/objects/items/pinpointer.dm
index 1fbe1c7e0f02..fced9d335205 100644
--- a/code/game/objects/items/pinpointer.dm
+++ b/code/game/objects/items/pinpointer.dm
@@ -63,7 +63,7 @@
. = ..()
if(!active)
return
- if(!target || target.loc == null)
+ if(!target?.loc)
. += "pinon[alert ? "alert" : ""]null[icon_suffix]"
return
var/turf/here = get_turf(src)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index a2e47cb938ec..7124510109c3 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -67,16 +67,15 @@ GLOBAL_LIST_EMPTY(ore_veins)
ore_type_amount = rand(4,6)
else
ore_type_amount = 1
- for(ore_type_amount, ore_type_amount>0, ore_type_amount--)
- var/picked
- picked = pickweight(ore_list)
+ for(var/ore_count in 1 to ore_type_amount)
+ var/picked = pickweight(ore_list)
vein_contents.Add(picked)
ore_list.Remove(picked)
GLOB.ore_veins += src
/obj/structure/vein/Destroy()
- . = ..()
GLOB.ore_veins -= src
+ return ..()
/obj/structure/vein/deconstruct(disassembled)
destroy_effect()
@@ -92,9 +91,8 @@ GLOBAL_LIST_EMPTY(ore_veins)
/obj/structure/vein/proc/drop_ore(multiplier,obj/machinery/drill/current)
var/class
class = vein_class
- for(class, class>0, class--)
- var/picked
- picked = pick(vein_contents)
+ for(var/vein_content_count in 1 to class)
+ var/picked = pick(vein_contents)
new picked(pick(get_adjacent_open_turfs(current)),round(rand(drop_rate_amount_min,drop_rate_amount_max)*multiplier))
/obj/structure/vein/proc/destroy_effect()
From 5bc39b17ee96dd4be342837cac10ff917dc7acbc Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Mon, 11 Dec 2023 21:06:07 -0500
Subject: [PATCH 48/56] Ough
---
code/modules/mining/ore_veins.dm | 3 ---
1 file changed, 3 deletions(-)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 7124510109c3..f9da93476adb 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -84,9 +84,6 @@ GLOBAL_LIST_EMPTY(ore_veins)
/obj/structure/vein/proc/begin_spawning()
spawner = AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max, wave_length, wave_downtime)
-/obj/structure/vein/proc/toggle_spawning()
-
-
//Pulls a random ore from the vein list per vein_class
/obj/structure/vein/proc/drop_ore(multiplier,obj/machinery/drill/current)
var/class
From b19593b57a74c2bae5799129a78216808c3bae23 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Mon, 11 Dec 2023 21:13:47 -0500
Subject: [PATCH 49/56] Apply suggestions from code review
Co-authored-by: Mark Suckerberg
Signed-off-by: BogCreature <112462947+BogCreature@users.noreply.github.com>
---
code/modules/mining/drill.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 9b1e402797b8..ac0d999b1545 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -141,7 +141,7 @@
anchored = TRUE
update_icon_state()
return
- else if(tool.use_tool(src, user, 30, volume=50))
+ if(tool.use_tool(src, user, 30, volume=50))
to_chat(user, "You unsecure the [src] from the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
anchored = FALSE
From bd556527ac5ef71394e35a664324dab9ce861fcc Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Wed, 21 Feb 2024 21:34:34 -0500
Subject: [PATCH 50/56] Null mining variable fix
Co-authored-by: Mark Suckerberg
Signed-off-by: BogCreature <112462947+BogCreature@users.noreply.github.com>
---
code/modules/mining/drill.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index ac0d999b1545..bd4eb376f0cb 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -145,7 +145,7 @@
to_chat(user, "You unsecure the [src] from the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
anchored = FALSE
- if(mining.spawner)
+ if(mining?.spawner)
STOP_PROCESSING(SSprocessing, mining.spawner)
mining.spawning_started = FALSE
mining = null
From a8cfa072575a81c530099d51d6072af715684443 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Thu, 22 Feb 2024 20:13:59 -0500
Subject: [PATCH 51/56] First batch of review fixes
Clears out an unused variable, adjusts some drill defines, and fixes a description I accidentally changed
---
code/datums/components/spawner.dm | 1 -
code/modules/mining/drill.dm | 15 ++++++++-------
code/modules/mining/equipment/mineral_scanner.dm | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 9fd090b92e31..e39e951366f5 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -12,7 +12,6 @@
var/wave_length //Average time until break in spawning
var/wave_downtime //Average time until spawning starts again
var/wave_timer
- var/downtime_timer
var/current_timerid
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index bd4eb376f0cb..da77a09d42ab 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -6,6 +6,7 @@
#define MALF_CALIBRATE 5
//For handling the repair of a completely destroyed drill
+#define METAL_ABSENT 0 //Couldn't think of a better word for this but it gets the point across
#define METAL_PLACED 1
#define METAL_SECURED 2
@@ -29,7 +30,7 @@
var/obj/item/stock_parts/cell/cell
var/preload_cell_type = /obj/item/stock_parts/cell
var/power_cost = 100
- var/metal_attached
+ var/metal_attached = METAL_ABSENT
var/missing_part //I hate this but it's better than most the ideas I've had
var/current_timerid
@@ -40,15 +41,15 @@
if(cell.charge < power_cost*5)
. += "The low power light is blinking."
switch(malfunction)
- if(1)
+ if(MALF_LASER)
. += "The [src]'s laser array appears to be broken and needs to be replaced."
- if(2)
+ if(MALF_SENSOR)
. += "The [src]'s sensors appear to be broken and need to be replaced."
- if(3)
+ if(MALF_CAPACITOR)
. += "The [src]'s capacitor appears to be broken and needs to be replaced."
- if(4)
+ if(MALF_STRUCTURAL)
. += "The [src]'s structure looks like it needs to be welded back together."
- if(5)
+ if(MALF_CALIBRATE)
. += "The [src]'s gimbal is out of alignment, it needs to be recalibrated with a multitool."
switch(metal_attached)
if(METAL_PLACED)
@@ -117,7 +118,7 @@
if(metal_attached == METAL_SECURED && tool.tool_behaviour == TOOL_WELDER)
if(tool.use_tool(src, user, 30, volume=50))
to_chat(user, "You weld the new plating onto the [src], successfully repairing it.")
- metal_attached = null
+ metal_attached = METAL_ABSENT
obj_integrity = max_integrity
set_machine_stat(machine_stat & ~BROKEN)
update_icon_state()
diff --git a/code/modules/mining/equipment/mineral_scanner.dm b/code/modules/mining/equipment/mineral_scanner.dm
index bbd0c9831e53..259cfac35fbe 100644
--- a/code/modules/mining/equipment/mineral_scanner.dm
+++ b/code/modules/mining/equipment/mineral_scanner.dm
@@ -40,7 +40,7 @@
qdel(src)
/obj/item/t_scanner/adv_mining_scanner
- desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations. This one has an extended range and a ground penetrating scanner.\nIt has a speaker that can be toggled with alt+click"
+ desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations.\nIt has a speaker that can be toggled with alt+click"
name = "advanced automatic mining scanner"
icon = 'icons/obj/device.dmi'
icon_state = "mining0"
From 4969ec42c3cafbf74d8f8f665e1888f9925d0ea2 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Thu, 22 Feb 2024 20:27:21 -0500
Subject: [PATCH 52/56] Second batch of review fixes
Enhanced ore vein comments, slightly improved scanner for loop, and bizzare and gormless mission drill writing improved
---
code/modules/mining/equipment/mineral_scanner.dm | 2 +-
code/modules/mining/ore_veins.dm | 4 +++-
code/modules/overmap/missions/drill_mission.dm | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/code/modules/mining/equipment/mineral_scanner.dm b/code/modules/mining/equipment/mineral_scanner.dm
index 259cfac35fbe..246826ad889f 100644
--- a/code/modules/mining/equipment/mineral_scanner.dm
+++ b/code/modules/mining/equipment/mineral_scanner.dm
@@ -202,7 +202,7 @@
var/turf/here = get_turf(src)
var/located_dist
var/obj/structure/located_vein
- for(var/obj/structure/I in GLOB.ore_veins)
+ for(var/obj/structure/vein/I in GLOB.ore_veins)
if(I.z == 0 || I.virtual_z() != here.virtual_z())
continue
if(located_vein)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index f9da93476adb..69e059418b86 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -11,7 +11,9 @@ GLOBAL_LIST_EMPTY(ore_veins)
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
var/mining_charges = 6
- //Classification of the quality of possible ores within a vein, used to determine difficulty
+ //Classification of the quality of possible ores within a vein
+ //Used to determine difficulty & ore amounts
+ //Intended to range from class one to class three
var/vein_class = 1
//A weighted list of all possible ores that can generate in a vein
//The design process is that class 1 veins have a small chance of generating with class 2 ores and so on
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
index 450a547cb3aa..7fa385874a67 100644
--- a/code/modules/overmap/missions/drill_mission.dm
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -85,7 +85,7 @@
/obj/machinery/drill/mission/start_mining()
if(mining.vein_class < mission_class && mining)
- say("[src] requires at least a class [mission_class] vein or higher.")
+ say("Error: A vein class of [mission_class] or greater is required for operation.")
return
. = ..()
From b6bb48a6c03190d5377bd18bdc224c87369c9165 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Sat, 24 Feb 2024 20:49:38 -0500
Subject: [PATCH 53/56] Divides mine() into 2 procs and fixes a rare bug
mine() is now mine() and mine_success() so there's less oddity with mission drills and ore veins now have a fallback plan for if there's no open adjacent turfs
---
code/modules/mining/drill.dm | 12 ++++++----
code/modules/mining/ore_veins.dm | 10 +++++----
.../modules/overmap/missions/drill_mission.dm | 22 ++-----------------
3 files changed, 16 insertions(+), 28 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index da77a09d42ab..546b1495476a 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -325,12 +325,9 @@
//Handles the process of withdrawing ore from the vein itself
/obj/machinery/drill/proc/mine()
- var/sensor_rating
- for(var/obj/item/stock_parts/scanning_module/sensor in component_parts)
- sensor_rating = sensor.rating
if(mining.mining_charges)
mining.mining_charges--
- mining.drop_ore(round(sqrt(sensor_rating), 0.1),src)
+ mine_success()
if(mining.mining_charges < 1)
say("Vein depleted.")
active = FALSE
@@ -347,6 +344,13 @@
update_icon_state()
update_overlays()
+//Called when it's time for the drill to rip that sweet ore from the earth
+/obj/machinery/drill/proc/mine_success()
+ var/sensor_rating
+ for(var/obj/item/stock_parts/scanning_module/sensor in component_parts)
+ sensor_rating = round(sqrt(sensor.rating))
+ mining.drop_ore(sensor_rating, src)
+
//Overly long proc to handle the unique properties for each malfunction type
/obj/machinery/drill/proc/malfunction(malfunction_type)
switch(malfunction_type)
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 69e059418b86..40b779b43c06 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -88,11 +88,13 @@ GLOBAL_LIST_EMPTY(ore_veins)
//Pulls a random ore from the vein list per vein_class
/obj/structure/vein/proc/drop_ore(multiplier,obj/machinery/drill/current)
- var/class
- class = vein_class
- for(var/vein_content_count in 1 to class)
+ var/list/adjacent_turfs = get_adjacent_open_turfs(current)
+ var/drop_location = src.loc //Backup in case we can't find an adjacent turf
+ if(adjacent_turfs.len)
+ drop_location = pick(adjacent_turfs)
+ for(var/vein_content_count in 1 to vein_class)
var/picked = pick(vein_contents)
- new picked(pick(get_adjacent_open_turfs(current)),round(rand(drop_rate_amount_min,drop_rate_amount_max)*multiplier))
+ new picked(drop_location,round(rand(drop_rate_amount_min,drop_rate_amount_max)*multiplier))
/obj/structure/vein/proc/destroy_effect()
playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
diff --git a/code/modules/overmap/missions/drill_mission.dm b/code/modules/overmap/missions/drill_mission.dm
index 7fa385874a67..06859e8327d2 100644
--- a/code/modules/overmap/missions/drill_mission.dm
+++ b/code/modules/overmap/missions/drill_mission.dm
@@ -89,23 +89,5 @@
return
. = ..()
-/obj/machinery/drill/mission/mine()
- if(mining.mining_charges)
- mining.mining_charges--
- num_current++
- if(mining.mining_charges < 1)
- say("Vein depleted.")
- active = FALSE
- soundloop.stop()
- mining.deconstruct()
- mining = null
- update_icon_state()
- update_overlays()
- else
- start_mining()
- else if(!mining.mining_charges)
- say("Error: Vein Depleted")
- active = FALSE
- update_icon_state()
- update_overlays()
-
+/obj/machinery/drill/mission/mine_success()
+ num_current++
From 52f6fdcbb8ab5ed5d95c7eb964ac1e2e2622d4c6 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Sat, 24 Feb 2024 21:02:11 -0500
Subject: [PATCH 54/56] Obliterates trailing returns
---
code/modules/mining/drill.dm | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 546b1495476a..9f767f397c7c 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -78,7 +78,6 @@
soundloop.stop()
update_overlays()
update_icon_state()
- return
/obj/machinery/drill/Destroy()
QDEL_NULL(soundloop)
@@ -232,7 +231,6 @@
update_overlays()
else
to_chat(user, "You cancel the manual shutoff process.")
- return
//Can we even turn the damn thing on?
/obj/machinery/drill/interact(mob/user, special_state)
@@ -250,10 +248,8 @@
"You hit the ignition button to activate [src].", \
"You hear a drill churn to life.")
start_mining()
- return
else
to_chat(user, "[src] is currently busy, wait until it's done!")
- return
/obj/machinery/drill/update_icon_state()
if(anchored)
@@ -321,7 +317,6 @@
say("Estimated time until vein depletion: [time2text(eta,"mm:ss")].")
update_icon_state()
update_overlays()
- return
//Handles the process of withdrawing ore from the vein itself
/obj/machinery/drill/proc/mine()
@@ -359,25 +354,20 @@
for (var/obj/item/stock_parts/micro_laser/laser in component_parts)
component_parts.Remove(laser)
missing_part = /obj/item/stock_parts/micro_laser
- return
if(MALF_SENSOR)
say("Malfunction: Ground penetrating scanner damaged, please replace before continuing mining operations.")
for (var/obj/item/stock_parts/scanning_module/sensor in component_parts)
component_parts.Remove(sensor)
missing_part = /obj/item/stock_parts/scanning_module
- return
if(MALF_CAPACITOR)
say("Malfunction: Energy cell capacitor damaged, please replace before continuing mining operations.")
for (var/obj/item/stock_parts/capacitor/capacitor in component_parts)
component_parts.Remove(capacitor)
missing_part = /obj/item/stock_parts/capacitor
- return
if(MALF_STRUCTURAL)
say("Malfunction: Drill plating damaged, provide structural repairs before continuing mining operations.")
- return
if(MALF_CALIBRATE)
say("Malfunction: Drill laser calibrations out of alignment, please recalibrate before continuing.")
- return
/obj/item/paper/guides/drill
name = "Laser Mining Drill Operation Manual"
From 58d7229ad1daf857fc8c4aaf9a577979c02c79e6 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Sat, 24 Feb 2024 23:53:06 -0500
Subject: [PATCH 55/56] Signalizes the ore vein spawning component
Does away with the spawner component reference and converts it to use signals instead
---
code/__DEFINES/dcs/signals.dm | 4 ++++
code/datums/components/spawner.dm | 19 ++++++++++++-------
code/modules/mining/drill.dm | 16 ++++++----------
code/modules/mining/ore_veins.dm | 9 +++++++--
4 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm
index 004b2f23fedf..fe9f6c88fa32 100644
--- a/code/__DEFINES/dcs/signals.dm
+++ b/code/__DEFINES/dcs/signals.dm
@@ -725,6 +725,10 @@
/// From overmap Undock(): (datum/overmap)
#define COMSIG_OVERMAP_UNDOCK "overmap_undock"
+// /datum/component/spawner signals
+// Called by parent when pausing spawning, returns bool: (datum/source, spawning_started)
+#define COMSIG_SPAWNER_TOGGLE_SPAWNING "spawner_toggle"
+
///Beam Signals
/// Called before beam is redrawn
#define COMSIG_BEAM_BEFORE_DRAW "beam_before_draw"
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index e39e951366f5..783e50582e31 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -38,6 +38,7 @@
wave_downtime = _wave_downtime
RegisterSignal(parent, list(COMSIG_PARENT_QDELETING), PROC_REF(stop_spawning))
+ RegisterSignal(parent, list(COMSIG_SPAWNER_TOGGLE_SPAWNING), PROC_REF(toggle_spawning))
START_PROCESSING(SSprocessing, src)
/datum/component/spawner/process()
@@ -57,13 +58,17 @@
spawned_mobs = null
//Different from stop_spawning() as it doesn't untether all mobs from it and is meant for temporarily stopping spawning
-/datum/component/spawner/proc/pause_spawning()
- STOP_PROCESSING(SSprocessing, src)
- deltimer(current_timerid) //Otherwise if spawning is paused while the wave timer is loose it'll just unpause on its own
- COOLDOWN_RESET(src, wave_timer)
+/datum/component/spawner/proc/toggle_spawning(datum/source, spawning_started)
+ SIGNAL_HANDLER
-/datum/component/spawner/proc/unpause_spawning()
- START_PROCESSING(SSprocessing, src)
+ if(spawning_started)
+ STOP_PROCESSING(SSprocessing, src)
+ deltimer(current_timerid) //Otherwise if spawning is paused while the wave timer is loose it'll just unpause on its own
+ COOLDOWN_RESET(src, wave_timer)
+ return FALSE
+ else
+ START_PROCESSING(SSprocessing, src)
+ return TRUE
/datum/component/spawner/proc/try_spawn_mob()
var/atom/P = parent
@@ -76,7 +81,7 @@
if(wave_timer && COOLDOWN_FINISHED(src, wave_timer))
COOLDOWN_RESET(src, wave_timer)
STOP_PROCESSING(SSprocessing, src)
- current_timerid = addtimer(CALLBACK(src, PROC_REF(unpause_spawning)), wave_downtime, TIMER_STOPPABLE)
+ current_timerid = addtimer(CALLBACK(src, PROC_REF(toggle_spawning)), wave_downtime, TIMER_STOPPABLE)
return
////////////////////////////////
if(length(spawned_mobs) >= max_mobs)
diff --git a/code/modules/mining/drill.dm b/code/modules/mining/drill.dm
index 9f767f397c7c..281097be7842 100644
--- a/code/modules/mining/drill.dm
+++ b/code/modules/mining/drill.dm
@@ -145,9 +145,9 @@
to_chat(user, "You unsecure the [src] from the ore vein.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
anchored = FALSE
- if(mining?.spawner)
- STOP_PROCESSING(SSprocessing, mining.spawner)
- mining.spawning_started = FALSE
+
+ if(mining?.spawner_attached && mining?.spawning_started)
+ mining.toggle_spawning()
mining = null
update_icon_state()
return
@@ -222,9 +222,7 @@
active = FALSE
soundloop.stop()
deltimer(current_timerid)
- //STOP_PROCESSING(SSprocessing, mining.spawner)
- mining.spawner.pause_spawning()
- mining.spawning_started = FALSE
+ mining.toggle_spawning()
playsound(src, 'sound/machines/switch2.ogg', 50, TRUE)
say("Manual shutoff engaged, ceasing mining operations.")
update_icon_state()
@@ -303,12 +301,10 @@
var/mine_time
active = TRUE
soundloop.start()
- if(!mining.spawner)
+ if(!mining.spawner_attached)
mining.begin_spawning()
- mining.spawning_started = TRUE
else if(!mining.spawning_started)
- START_PROCESSING(SSprocessing, mining.spawner)
- mining.spawning_started = TRUE
+ mining.toggle_spawning()
for(var/obj/item/stock_parts/micro_laser/laser in component_parts)
mine_time = round((300/sqrt(laser.rating))*mining.mine_time_multiplier)
eta = mine_time*mining.mining_charges
diff --git a/code/modules/mining/ore_veins.dm b/code/modules/mining/ore_veins.dm
index 40b779b43c06..3e5e20053a77 100644
--- a/code/modules/mining/ore_veins.dm
+++ b/code/modules/mining/ore_veins.dm
@@ -35,6 +35,7 @@ GLOBAL_LIST_EMPTY(ore_veins)
var/drop_rate_amount_min = 15
var/drop_rate_amount_max = 20
//Mob spawning variables
+ var/spawner_attached = FALSE //Probably a drastically less sloppy way of doing this, but it technically works
var/spawning_started = FALSE
var/max_mobs = 6
var/spawn_time = 150 //15 seconds
@@ -47,7 +48,6 @@ GLOBAL_LIST_EMPTY(ore_veins)
var/faction = list("hostile","mining")
var/spawn_sound = list('sound/effects/break_stone.ogg')
var/spawner_type = /datum/component/spawner
- var/datum/component/spawner/spawner
var/spawn_distance_min = 4
var/spawn_distance_max = 6
var/wave_length = 2 MINUTES
@@ -84,7 +84,9 @@ GLOBAL_LIST_EMPTY(ore_veins)
return..()
/obj/structure/vein/proc/begin_spawning()
- spawner = AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max, wave_length, wave_downtime)
+ AddComponent(spawner_type, mob_types, spawn_time, faction, spawn_text, max_mobs, spawn_sound, spawn_distance_min, spawn_distance_max, wave_length, wave_downtime)
+ spawner_attached = TRUE
+ spawning_started = TRUE
//Pulls a random ore from the vein list per vein_class
/obj/structure/vein/proc/drop_ore(multiplier,obj/machinery/drill/current)
@@ -100,6 +102,9 @@ GLOBAL_LIST_EMPTY(ore_veins)
playsound(loc,'sound/effects/explosionfar.ogg', 200, TRUE)
visible_message("[src] collapses!")
+/obj/structure/vein/proc/toggle_spawning()
+ spawning_started = SEND_SIGNAL(src, COMSIG_SPAWNER_TOGGLE_SPAWNING, spawning_started)
+
//
// Planetary and Class Subtypes
// The current set of subtypes are heavily subject to future balancing and reworking as the balance of them is tested more
From 74b2c5efb40d7eb0d82d499199b53e1620799941 Mon Sep 17 00:00:00 2001
From: BogCreature <112462947+BogCreature@users.noreply.github.com>
Date: Sun, 25 Feb 2024 00:10:06 -0500
Subject: [PATCH 56/56] Stops an extremely rare bug
Stops an extremely rare bug where if someone is on roughly the same position of an adjacent zlevel they would nudge the mob spawn modifier on the spawners
---
code/datums/components/spawner.dm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm
index 783e50582e31..aab5bb6ea08a 100644
--- a/code/datums/components/spawner.dm
+++ b/code/datums/components/spawner.dm
@@ -95,6 +95,8 @@
if(spawn_distance_max > 1)
var/player_count = 0
for(var/mob/player as anything in GLOB.player_list)
+ if(player.virtual_z() != spot.virtual_z())
+ continue
if(!isliving(player))
continue
if(player.stat != CONSCIOUS)