mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-18 21:32:14 +00:00
* SDQL2 update * fix that verb * cl * fix that * toworld * this is pointless * update info * siiiiick.. * vv edit update * fix that * fix editing vars * fix VV * Port the /TG/ globals controller. * part 1 * part 2 * oops * part 3 * Hollow Purple * sadas * bsbsdb * muda na agaki ta * ids 1-15 * 16-31 * 41-75 * bring me back to how things used to be before i lost it all * the strength of mayhem * final touches * cl * protect some vars * update sdql2 to use glob * stuff? * forgot that is not defined there * whoops * observ * but it never gets better * a --------- Co-authored-by: Matt Atlas <liermattia@gmail.com>
63 lines
1.8 KiB
Plaintext
63 lines
1.8 KiB
Plaintext
// Target stakes for the firing range.
|
|
/obj/structure/target_stake
|
|
name = "target stake"
|
|
desc = "A thin platform with negatively-magnetized wheels."
|
|
icon = 'icons/obj/target_stake.dmi'
|
|
icon_state = "target_stake"
|
|
density = TRUE
|
|
w_class = ITEMSIZE_IMMENSE
|
|
build_amt = 10
|
|
var/obj/item/target/pinned_target
|
|
|
|
/obj/structure/target_stake/Initialize(mapload)
|
|
. = ..()
|
|
material = SSmaterials.get_material_by_name(MATERIAL_STEEL)
|
|
|
|
/obj/structure/target_stake/attackby(var/obj/item/W, var/mob/user)
|
|
if(istype(W, /obj/item/target))
|
|
if(pinned_target)
|
|
to_chat(user, SPAN_WARNING("\The [src] already has a target."))
|
|
return
|
|
if(user.unEquip(W, FALSE, get_turf(src)))
|
|
to_chat(user, SPAN_NOTICE("You slide \the [W] into the stake."))
|
|
set_target(W)
|
|
return
|
|
if(W.iswrench())
|
|
if(pinned_target)
|
|
to_chat(user, SPAN_WARNING("You cannot dismantle \the [src] while it has a target attached."))
|
|
return
|
|
dismantle()
|
|
|
|
/obj/structure/target_stake/attack_hand(var/mob/user)
|
|
. = ..()
|
|
if(pinned_target && ishuman(user))
|
|
var/obj/item/target/T = pinned_target
|
|
to_chat(user, SPAN_NOTICE("You take \the [T] out of the stake."))
|
|
set_target(null)
|
|
user.put_in_hands(T)
|
|
|
|
/obj/structure/target_stake/proc/set_target(var/obj/item/target/T)
|
|
if(T)
|
|
density = FALSE
|
|
T.density = TRUE
|
|
T.pixel_x = 0
|
|
T.pixel_y = 0
|
|
T.layer = ABOVE_OBJ_LAYER
|
|
GLOB.moved_event.register(T, src, TYPE_PROC_REF(/atom/movable, move_to_turf))
|
|
GLOB.moved_event.register(src, T, TYPE_PROC_REF(/atom/movable, move_to_turf))
|
|
T.stake = src
|
|
pinned_target = T
|
|
else
|
|
density = TRUE
|
|
if(pinned_target)
|
|
pinned_target.density = FALSE
|
|
pinned_target.layer = OBJ_LAYER
|
|
GLOB.moved_event.unregister(pinned_target, src)
|
|
GLOB.moved_event.unregister(src, pinned_target)
|
|
pinned_target.stake = null
|
|
pinned_target = null
|
|
|
|
/obj/structure/target_stake/Destroy()
|
|
set_target(null)
|
|
return ..()
|