mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 02:57:48 +01:00
....Well i fixed IKEA shuttles anyway....
now just to fix docking templates without force docking it.
This commit is contained in:
@@ -16,6 +16,8 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
|
||||
// Whether a datum was hard-deleted by the GC; 0 if not, 1 if it was queued, -1 if directly deleted
|
||||
/datum/var/hard_deleted = 0
|
||||
|
||||
|
||||
|
||||
/datum/controller/process/garbage_collector
|
||||
var/list/queue = new
|
||||
var/del_everything = 0
|
||||
@@ -25,6 +27,11 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
|
||||
var/hard_dels = 0
|
||||
var/soft_dels = 0
|
||||
|
||||
// all types that did not respect qdel(A, force=TRUE) and returned one
|
||||
// of the immortality qdel hints
|
||||
var/list/noforcerespect = list()
|
||||
|
||||
|
||||
/datum/controller/process/garbage_collector/proc/addTrash(var/datum/D)
|
||||
if(!istype(D) || del_everything)
|
||||
del(D)
|
||||
@@ -86,7 +93,7 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
|
||||
dels_count++
|
||||
|
||||
// Effectively replaces del for any datum-based type
|
||||
/proc/qdel(var/datum/D)
|
||||
/proc/qdel(datum/D, force=FALSE)
|
||||
if(isnull(D))
|
||||
return
|
||||
|
||||
@@ -105,7 +112,7 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
|
||||
var/hint
|
||||
D.gcDestroyed = world.time
|
||||
try
|
||||
hint = D.Destroy()
|
||||
hint = D.Destroy(force)
|
||||
catch(var/exception/e)
|
||||
if(istype(e))
|
||||
log_runtime(e, D, "Caught by qdel() destroying [D.type]")
|
||||
@@ -124,10 +131,19 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
|
||||
switch(hint)
|
||||
if(QDEL_HINT_QUEUE) //qdel should queue the object for deletion
|
||||
garbageCollector.addTrash(D)
|
||||
if(QDEL_HINT_LETMELIVE) //qdel should let the object live after calling destroy.
|
||||
return
|
||||
if(QDEL_HINT_IWILLGC) //functionally the same as the above. qdel should assume the object will gc on its own, and not check it.
|
||||
return
|
||||
if (QDEL_HINT_LETMELIVE, QDEL_HINT_IWILLGC) //qdel should let the object live after calling destory.
|
||||
if(!force)
|
||||
return
|
||||
// Returning LETMELIVE after being told to force destroy
|
||||
// indicates the objects Destroy() does not respect force
|
||||
if(!("[D.type]" in garbageCollector.noforcerespect))
|
||||
garbageCollector.noforcerespect += "[D.type]"
|
||||
gcwarning("WARNING: [D.type] has been force deleted, but is \
|
||||
returning an immortal QDEL_HINT, indicating it does \
|
||||
not respect the force flag for qdel(). It has been \
|
||||
placed in the queue, further instances of this type \
|
||||
will also be queued.")
|
||||
garbageCollector.addTrash(D)
|
||||
if(QDEL_HINT_HARDDEL_NOW) //qdel should assume this object won't gc, and hard del it post haste.
|
||||
D.hard_deleted = -1 // -1 means "this hard del skipped the queue", used for profiling
|
||||
del(D)
|
||||
@@ -157,7 +173,7 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
|
||||
* Like Del(), but for qdel.
|
||||
* Called BEFORE qdel moves shit.
|
||||
*/
|
||||
/datum/proc/Destroy()
|
||||
/datum/proc/Destroy(force=FALSE)
|
||||
tag = null
|
||||
return QDEL_HINT_QUEUE // Garbage Collect everything.
|
||||
|
||||
|
||||
@@ -101,14 +101,15 @@
|
||||
shuttle_master.emergency = src
|
||||
return 1
|
||||
|
||||
/obj/docking_port/mobile/emergency/Destroy()
|
||||
// This'll make the shuttle subsystem use the backup shuttle.
|
||||
if(src == shuttle_master.emergency)
|
||||
// If we're the selected emergency shuttle
|
||||
shuttle_master.emergencyDeregister()
|
||||
/obj/docking_port/mobile/emergency/Destroy(force)
|
||||
if(force)
|
||||
// This'll make the shuttle subsystem use the backup shuttle.
|
||||
if(src == shuttle_master.emergency)
|
||||
// If we're the selected emergency shuttle
|
||||
shuttle_master.emergencyDeregister()
|
||||
|
||||
|
||||
. = ..()
|
||||
return ..()
|
||||
|
||||
/obj/docking_port/mobile/emergency/timeLeft(divisor)
|
||||
if(divisor <= 0)
|
||||
|
||||
@@ -21,14 +21,12 @@
|
||||
// A timid shuttle will not register itself with the shuttle subsystem
|
||||
// All shuttle templates are timid
|
||||
var/timid = FALSE
|
||||
var/JUSTDOIT = FALSE //ITS A HACKY VAR FOR THIS SHIT OKAY
|
||||
|
||||
//these objects are indestructable
|
||||
/obj/docking_port/Destroy()
|
||||
if(JUSTDOIT)
|
||||
/obj/docking_port/Destroy(force)
|
||||
if(force)
|
||||
..()
|
||||
. = QDEL_HINT_HARDDEL_NOW
|
||||
JUSTDOIT = FALSE //THIS HURTS US PRECIOUS
|
||||
else
|
||||
|
||||
return QDEL_HINT_LETMELIVE
|
||||
@@ -245,13 +243,13 @@
|
||||
|
||||
return 1
|
||||
|
||||
/obj/docking_port/mobile/Destroy()
|
||||
if(JUSTDOIT)
|
||||
/obj/docking_port/mobile/Destroy(force)
|
||||
if(force)
|
||||
shuttle_master.mobile -= src
|
||||
areaInstance = null
|
||||
destination = null
|
||||
previous = null
|
||||
. = ..()
|
||||
return ..()
|
||||
|
||||
//this is a hook for custom behaviour. Maybe at some point we could add checks to see if engines are intact
|
||||
/obj/docking_port/mobile/proc/canMove()
|
||||
@@ -275,6 +273,7 @@
|
||||
//check the dock isn't occupied
|
||||
// by someone other than us
|
||||
if(S.get_docked())
|
||||
to_chat(world, "[S.getDockedId()]")
|
||||
return SHUTTLE_SOMEONE_ELSE_DOCKED
|
||||
return SHUTTLE_CAN_DOCK
|
||||
|
||||
@@ -364,8 +363,6 @@
|
||||
/obj/docking_port/mobile/proc/jumpToNullSpace()
|
||||
// Destroys the docking port and the shuttle contents.
|
||||
// Not in a fancy way, it just ceases.
|
||||
|
||||
JUSTDOIT = TRUE //GOD WHY WHY GOD
|
||||
var/obj/docking_port/stationary/S0 = get_docked()
|
||||
var/turf_type = /turf/space
|
||||
var/area_type = /area/space
|
||||
@@ -393,7 +390,6 @@
|
||||
for(var/AM in T0.GetAllContents())
|
||||
if(istype(AM, /mob/dead))
|
||||
continue
|
||||
world << "[AM]"
|
||||
qdel(AM)
|
||||
|
||||
T0.ChangeTurf(turf_type)
|
||||
@@ -403,7 +399,7 @@
|
||||
T0.CalculateAdjacentTurfs()
|
||||
air_master.add_to_active(T0,1)
|
||||
|
||||
qdel(src)
|
||||
qdel(src,force=TRUE)
|
||||
|
||||
//this is the main proc. It instantly moves our mobile port to stationary port S1
|
||||
//it handles all the generic behaviour, such as sanity checks, closing doors on the shuttle, stunning mobs, etc
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
var/obj/docking_port/mobile/M = P
|
||||
found++
|
||||
if(found > 1)
|
||||
qdel(P)
|
||||
qdel(P, force=TRUE)
|
||||
world.log << "Map warning: Shuttle Template [S.mappath] \
|
||||
has multiple mobile docking ports."
|
||||
else if(!M.timid)
|
||||
@@ -323,6 +323,5 @@
|
||||
|
||||
/obj/machinery/shuttle_manipulator/proc/unload_preview()
|
||||
if(preview_shuttle)
|
||||
to_chat(usr, "unloading: [preview_shuttle]")
|
||||
preview_shuttle.jumpToNullSpace()
|
||||
preview_shuttle = null
|
||||
|
||||
Reference in New Issue
Block a user