Intercoms are now constructable (#28659)

* Intercoms are now constructable

* l a t h e

* replaces on_wall with pixel_shift

* does the thing

* Adds an additional construction step
This commit is contained in:
Ashe Higgs
2017-06-23 14:39:43 -04:00
committed by Jordan Brown
parent 6101e63516
commit 2c047bd4c7
4 changed files with 80 additions and 3 deletions

View File

@@ -6,8 +6,8 @@
item_state = "syringe_kit"
w_class = WEIGHT_CLASS_SMALL
var/result_path
var/inverse = 0
// For inverse dir frames like light fixtures.
var/inverse = 0 // For inverse dir frames like light fixtures.
var/pixel_shift //The amount of pixels
/obj/item/wallframe/proc/try_build(turf/on_wall, mob/user)
if(get_dist(on_wall,user)>1)
@@ -40,6 +40,16 @@
ndir = turn(ndir, 180)
var/obj/O = new result_path(get_turf(user), ndir, TRUE)
if(pixel_shift)
switch(ndir)
if(NORTH)
O.pixel_y = pixel_shift
if(SOUTH)
O.pixel_y = -pixel_shift
if(EAST)
O.pixel_x = pixel_shift
if(WEST)
O.pixel_x = -pixel_shift
after_attach(O)
qdel(src)

View File

@@ -10,15 +10,64 @@
var/mob/living/silicon/ai/ai = list()
var/last_tick //used to delay the powercheck
dog_fashion = null
var/unfastened = FALSE
/obj/item/device/radio/intercom/Initialize()
/obj/item/device/radio/intercom/unscrewed
unfastened = TRUE
/obj/item/device/radio/intercom/Initialize(mapload, ndir, building)
. = ..()
if(building)
setDir(ndir)
START_PROCESSING(SSobj, src)
/obj/item/device/radio/intercom/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/device/radio/intercom/examine(mob/user)
..()
if(!unfastened)
to_chat(user, "<span class='notice'>It's <b>screwed</b> and secured to the wall.</span>")
else
to_chat(user, "<span class='notice'>It's <i>unscrewed</i> from the wall, and can be <b>detached</b>.</span>")
/obj/item/device/radio/intercom/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/weapon/screwdriver))
var/obj/item/weapon/screwdriver/S = I
if(unfastened)
user.visible_message("<span class='notice'>[user] starts tightening [src]'s screws...</span>", "<span class='notice'>You start screwing in [src]...</span>")
playsound(src, S.usesound, 50, 1)
if(!do_after(user, 30 * S.toolspeed, target = src))
return
user.visible_message("<span class='notice'>[user] tightens [src]'s screws!</span>", "<span class='notice'>You tighten [src]'s screws.</span>")
playsound(src, 'sound/items/screwdriver2.ogg', 50, 1)
unfastened = FALSE
else
user.visible_message("<span class='notice'>[user] starts loosening [src]'s screws...</span>", "<span class='notice'>You start unscrewing [src]...</span>")
playsound(src, S.usesound, 50, 1)
if(!do_after(user, 60 * S.toolspeed, target = src))
return
user.visible_message("<span class='notice'>[user] loosens [src]'s screws!</span>", "<span class='notice'>You unscrew [src], loosening it from the wall.</span>")
playsound(src, 'sound/items/screwdriver2.ogg', 50, 1)
unfastened = TRUE
return
else if(istype(I, /obj/item/weapon/wrench))
if(!unfastened)
to_chat(user, "<span class='warning'>You need to unscrew [src] from the wall first!</span>")
return
var/obj/item/weapon/wrench/W = I
user.visible_message("<span class='notice'>[user] starts unsecuring [src]...</span>", "<span class='notice'>You start unsecuring [src]...</span>")
playsound(src, W.usesound, 50, 1)
if(!do_after(user, 80 * W.toolspeed, target = src))
return
user.visible_message("<span class='notice'>[user] unsecures [src]!</span>", "<span class='notice'>You detach [src] from the wall.</span>")
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
new/obj/item/wallframe/intercom(get_turf(src))
qdel(src)
return
return ..()
/obj/item/device/radio/intercom/attack_ai(mob/user)
interact(user)
@@ -69,3 +118,13 @@
/obj/item/device/radio/intercom/add_blood(list/blood_dna)
return 0
//Created through the autolathe or through deconstructing intercoms. Can be applied to wall to make a new intercom on it!
/obj/item/wallframe/intercom
name = "intercom frame"
desc = "A ready-to-go intercom. Just slap it on a wall and screw it in!"
icon_state = "intercom"
result_path = /obj/item/device/radio/intercom/unscrewed
pixel_shift = 29
inverse = TRUE
materials = list(MAT_METAL = 75, MAT_GLASS = 25)

View File

@@ -479,6 +479,14 @@
build_path = /obj/item/device/radio/off
category = list("initial", "T-Comm")
/datum/design/intercom_frame
name = "Intercom Frame"
id = "intercom_frame"
build_type = AUTOLATHE
materials = list(MAT_METAL = 75, MAT_GLASS = 25)
build_path = /obj/item/wallframe/intercom
category = list("initial", "T-Comm")
/datum/design/infrared_emitter
name = "Infrared Emitter"
id = "infrared_emitter"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 979 B