diff --git a/code/__DEFINES/construction.dm b/code/__DEFINES/construction.dm index 157069f4eb..0d088c903a 100644 --- a/code/__DEFINES/construction.dm +++ b/code/__DEFINES/construction.dm @@ -28,10 +28,6 @@ #define AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS 1 #define AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER 2 -//plastic flaps construction states -#define PLASTIC_FLAPS_NORMAL 0 -#define PLASTIC_FLAPS_DETACHED 1 - //default_unfasten_wrench() return defines #define CANT_UNFASTEN 0 #define FAILED_UNFASTEN 1 diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm index 395c0f42d1..80156535ef 100644 --- a/code/game/objects/structures/plasticflaps.dm +++ b/code/game/objects/structures/plasticflaps.dm @@ -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, "[src] are screwed to the floor.") - if(PLASTIC_FLAPS_DETACHED) - to_chat(user, "[src] are no longer screwed to the floor, and the flaps can be cut apart.") - -/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("[user] unscrews [src] from the floor.", "You start to unscrew [src] from the floor...", "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, "You unscrew [src] from the floor.") - else if(state == PLASTIC_FLAPS_DETACHED) - user.visible_message("[user] screws [src] to the floor.", "You start to screw [src] to the floor...", "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, "You screw [src] from the floor.") - else if(istype(W, /obj/item/wirecutters)) - if(state == PLASTIC_FLAPS_DETACHED) - user.visible_message("[user] cuts apart [src].", "You start to cut apart [src].", "You hear cutting.") - if(W.use_tool(src, user, 50, volume=100)) - if(state != PLASTIC_FLAPS_DETACHED) - return - to_chat(user, "You cut apart [src].") - var/obj/item/stack/sheet/plastic/five/P = new(loc) - P.add_fingerprint(user) - qdel(src) + if(anchored) + to_chat(user, "[src] are screwed to the floor.") else - . = ..() + to_chat(user, "[src] are no longer screwed to the floor, and the flaps can be cut apart.") + +/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("[user] [action] the floor.", "You start to [uraction] the floor...", "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, " You [anchored ? "unscrew" : "screw"] [src] from the floor.") + return TRUE + else + return TRUE + +/obj/structure/plasticflaps/wirecutter_act(mob/living/user, obj/item/W) + if(!anchored) + user.visible_message("[user] cuts apart [src].", "You start to cut apart [src].", "You hear cutting.") + if(W.use_tool(src, user, 50, volume=100)) + if(anchored) + return TRUE + to_chat(user, "You cut apart [src].") + 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)) diff --git a/icons/obj/stationobjs.dmi b/icons/obj/stationobjs.dmi index 8761662a63..67c1a59c51 100644 Binary files a/icons/obj/stationobjs.dmi and b/icons/obj/stationobjs.dmi differ