Merge pull request #1529 from yogstation13/upstream-merge-38751

[MIRROR] Updates plastic flaps icon and cleans up its code
This commit is contained in:
Nich
2018-06-30 22:34:46 +02:00
committed by GitHub
3 changed files with 34 additions and 41 deletions

View File

@@ -8,50 +8,47 @@
anchored = TRUE
layer = ABOVE_MOB_LAYER
CanAtmosPass = ATMOS_PASS_NO
var/state = PLASTIC_FLAPS_NORMAL
/obj/structure/plasticflaps/opaque
opacity = TRUE
/obj/structure/plasticflaps/examine(mob/user)
. = ..()
switch(state)
if(PLASTIC_FLAPS_NORMAL)
to_chat(user, "<span class='notice'>[src] are <b>screwed</b> to the floor.</span>")
if(PLASTIC_FLAPS_DETACHED)
to_chat(user, "<span class='notice'>[src] are no longer <i>screwed</i> to the floor, and the flaps can be <b>cut</b> apart.</span>")
/obj/structure/plasticflaps/attackby(obj/item/W, mob/user, params)
add_fingerprint(user)
if(istype(W, /obj/item/screwdriver))
if(state == PLASTIC_FLAPS_NORMAL)
user.visible_message("<span class='warning'>[user] unscrews [src] from the floor.</span>", "<span class='notice'>You start to unscrew [src] from the floor...</span>", "You hear rustling noises.")
if(W.use_tool(src, user, 100, volume=100))
if(state != PLASTIC_FLAPS_NORMAL)
return
state = PLASTIC_FLAPS_DETACHED
anchored = FALSE
to_chat(user, "<span class='notice'>You unscrew [src] from the floor.</span>")
else if(state == PLASTIC_FLAPS_DETACHED)
user.visible_message("<span class='warning'>[user] screws [src] to the floor.</span>", "<span class='notice'>You start to screw [src] to the floor...</span>", "You hear rustling noises.")
if(W.use_tool(src, user, 40, volume=100))
if(state != PLASTIC_FLAPS_DETACHED)
return
state = PLASTIC_FLAPS_NORMAL
anchored = TRUE
to_chat(user, "<span class='notice'>You screw [src] from the floor.</span>")
else if(istype(W, /obj/item/wirecutters))
if(state == PLASTIC_FLAPS_DETACHED)
user.visible_message("<span class='warning'>[user] cuts apart [src].</span>", "<span class='notice'>You start to cut apart [src].</span>", "You hear cutting.")
if(W.use_tool(src, user, 50, volume=100))
if(state != PLASTIC_FLAPS_DETACHED)
return
to_chat(user, "<span class='notice'>You cut apart [src].</span>")
var/obj/item/stack/sheet/plastic/five/P = new(loc)
P.add_fingerprint(user)
qdel(src)
if(anchored)
to_chat(user, "<span class='notice'>[src] are <b>screwed</b> to the floor.</span>")
else
. = ..()
to_chat(user, "<span class='notice'>[src] are no longer <i>screwed</i> to the floor, and the flaps can be <b>cut</b> apart.</span>")
/obj/structure/plasticflaps/screwdriver_act(mob/living/user, obj/item/W)
add_fingerprint(user)
var/action = anchored ? "unscrews [src] from" : "screws [src] to"
var/uraction = anchored ? "unscrew [src] from " : "screw [src] to"
user.visible_message("<span class='warning'>[user] [action] the floor.</span>", "<span class='notice'>You start to [uraction] the floor...</span>", "You hear rustling noises.")
if(W.use_tool(src, user, 100, volume=100, extra_checks = CALLBACK(src, .proc/check_anchored_state, anchored)))
anchored = !anchored
to_chat(user, "<span class='notice'> You [anchored ? "unscrew" : "screw"] [src] from the floor.</span>")
return TRUE
else
return TRUE
/obj/structure/plasticflaps/wirecutter_act(mob/living/user, obj/item/W)
if(!anchored)
user.visible_message("<span class='warning'>[user] cuts apart [src].</span>", "<span class='notice'>You start to cut apart [src].</span>", "You hear cutting.")
if(W.use_tool(src, user, 50, volume=100))
if(anchored)
return TRUE
to_chat(user, "<span class='notice'>You cut apart [src].</span>")
var/obj/item/stack/sheet/plastic/five/P = new(loc)
P.add_fingerprint(user)
qdel(src)
return TRUE
else
return TRUE
/obj/structure/plasticflaps/proc/check_anchored_state(check_anchored)
if(anchored != check_anchored)
return FALSE
return TRUE
/obj/structure/plasticflaps/CanAStarPass(ID, to_dir, caller)
if(isliving(caller))