Fixes supermatter sliver objective being given if there is no supermatter engine (#30032)

* Adds /engine variants of supermatter_shard

* Makes maps use /engine supermatter_shard variants

* Adds a framework for ensuring an objective_item exists before giving it as a target

* Fixes supermatter sliver objective being given with no supermatter engine on the map

* Works around BYOND stupidity
This commit is contained in:
Jordan Brown
2017-08-24 11:39:35 +12:00
committed by oranges
parent 0a530cff9c
commit b208a51975
8 changed files with 61 additions and 9 deletions
+13 -1
View File
@@ -55,6 +55,8 @@
#define SUPERMATTER_DANGER_PERCENT 50
#define SUPERMATTER_WARNING_PERCENT 100
GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_shard)
/obj/machinery/power/supermatter_shard
name = "supermatter shard"
desc = "A strangely translucent and iridescent crystal that looks like it used to be part of a larger structure."
@@ -131,6 +133,7 @@
var/produces_gas = TRUE
var/obj/effect/countdown/supermatter/countdown
var/is_main_engine = FALSE
/obj/machinery/power/supermatter_shard/Initialize()
. = ..()
@@ -143,7 +146,8 @@
radio.listening = 0
radio.recalculateChannels()
investigate_log("has been created.", INVESTIGATE_SUPERMATTER)
if(is_main_engine)
GLOB.main_supermatter_engine = src
/obj/machinery/power/supermatter_shard/Destroy()
investigate_log("has been destroyed.", INVESTIGATE_SUPERMATTER)
@@ -151,6 +155,8 @@
QDEL_NULL(radio)
GLOB.poi_list -= src
QDEL_NULL(countdown)
if(is_main_engine && GLOB.main_supermatter_engine == src)
GLOB.main_supermatter_engine = null
. = ..()
/obj/machinery/power/supermatter_shard/examine(mob/user)
@@ -584,6 +590,9 @@
else
L.show_message("<span class='italics'>You hear an unearthly ringing and notice your skin is covered in fresh radiation burns.</span>", 2)
/obj/machinery/power/supermatter_shard/engine
is_main_engine = TRUE
// When you wanna make a supermatter shard for the dramatic effect, but
// don't want it exploding suddenly
/obj/machinery/power/supermatter_shard/hugbox
@@ -599,6 +608,9 @@
gasefficency = 0.15
explosion_power = 35
/obj/machinery/power/supermatter_shard/crystal/engine
is_main_engine = TRUE
/obj/machinery/power/supermatter_shard/proc/supermatter_pull(turf/center, pull_range = 10)
playsound(src.loc, 'sound/weapons/marauder.ogg', 100, 1, extrarange = 7)
for(var/atom/P in orange(pull_range,center))