mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
* Yes, all of them. * Also did a few corrections to redundant New() and broken Destroy() along the way * Renamed the turf_initializer.initialize() proc to InitializeTurf to avoid confusion. * Subsumed /area/proc/initialize into /atom/proc/initialize() - Made /area's LateInitialize to get same behavior as before.
81 lines
2.8 KiB
Plaintext
81 lines
2.8 KiB
Plaintext
// These are used to spawn a specific mob when triggered, with the mob controlled by a player pulled from the ghost pool, hense its name.
|
|
/obj/structure/ghost_pod
|
|
name = "Base Ghost Pod"
|
|
desc = "If you can read me, someone don goofed."
|
|
icon = 'icons/obj/structures.dmi'
|
|
var/ghost_query_type = null
|
|
var/icon_state_opened = null // Icon to switch to when 'used'.
|
|
var/used = FALSE
|
|
var/busy = FALSE // Don't spam ghosts by spamclicking.
|
|
|
|
// Call this to get a ghost volunteer.
|
|
/obj/structure/ghost_pod/proc/trigger()
|
|
if(!ghost_query_type)
|
|
return FALSE
|
|
if(busy)
|
|
return FALSE
|
|
|
|
busy = TRUE
|
|
var/datum/ghost_query/Q = new ghost_query_type()
|
|
var/list/winner = Q.query()
|
|
busy = FALSE
|
|
if(winner.len)
|
|
var/mob/observer/dead/D = winner[1]
|
|
create_occupant(D)
|
|
new /obj/machinery/recharge_station/ghost_pod_recharger(src.loc)
|
|
del(src)
|
|
return TRUE
|
|
else
|
|
return FALSE
|
|
|
|
// Override this to create whatever mob you need. Be sure to call ..() if you don't want it to make infinite mobs.
|
|
/obj/structure/ghost_pod/proc/create_occupant(var/mob/M)
|
|
used = TRUE
|
|
return TRUE
|
|
|
|
|
|
// This type is triggered manually by a player discovering the pod and deciding to open it.
|
|
/obj/structure/ghost_pod/manual
|
|
var/confirm_before_open = FALSE // Recommended to be TRUE if the pod contains a surprise.
|
|
|
|
/obj/structure/ghost_pod/manual/attack_hand(var/mob/living/user)
|
|
if(!used)
|
|
if(confirm_before_open)
|
|
if(alert(user, "Are you sure you want to open \the [src]?", "Confirm", "No", "Yes") == "No")
|
|
return
|
|
trigger()
|
|
|
|
/obj/structure/ghost_pod/manual/attack_ai(var/mob/living/silicon/user)
|
|
if(Adjacent(user))
|
|
attack_hand(user) // Borgs can open pods.
|
|
|
|
// This type is triggered on a timer, as opposed to needing another player to 'open' the pod. Good for away missions.
|
|
/obj/structure/ghost_pod/automatic
|
|
var/delay_to_self_open = 10 MINUTES // How long to wait for first attempt. Note that the timer by default starts when the pod is created.
|
|
var/delay_to_try_again = 20 MINUTES // How long to wait if first attempt fails. Set to 0 to never try again.
|
|
|
|
/obj/structure/ghost_pod/automatic/initialize()
|
|
. = ..()
|
|
spawn(delay_to_self_open)
|
|
if(src)
|
|
trigger()
|
|
|
|
/obj/structure/ghost_pod/automatic/trigger()
|
|
. = ..()
|
|
if(. == FALSE) // If we failed to get a volunteer, try again later if allowed to.
|
|
if(delay_to_try_again)
|
|
spawn(delay_to_try_again)
|
|
if(src)
|
|
trigger()
|
|
|
|
|
|
// This type is triggered by a ghost clicking on it, as opposed to a living player. A ghost query type isn't needed.
|
|
/obj/structure/ghost_pod/ghost_activated
|
|
description_info = "A ghost can click on this to return to the round as whatever is contained inside this object."
|
|
|
|
/obj/structure/ghost_pod/ghost_activated/attack_ghost(var/mob/observer/dead/user)
|
|
if(used)
|
|
to_chat(user, "<span class='warning'>Another spirit appears to have gotten to \the [src] before you. Sorry.</span>")
|
|
return
|
|
|
|
create_occupant(user) |