diff --git a/code/game/mecha/equipment/mecha_equipment.dm b/code/game/mecha/equipment/mecha_equipment.dm index 72d643b50805..b29a2aa291bf 100644 --- a/code/game/mecha/equipment/mecha_equipment.dm +++ b/code/game/mecha/equipment/mecha_equipment.dm @@ -157,7 +157,7 @@ forceMove(M) log_message("[src] initialized.", LOG_MECHA) update_chassis_page() - ADD_TRAIT(src, TRAIT_NODROP, "mecha") + ADD_TRAIT(src, TRAIT_NODROP, REF(M)) item_flags |= NO_MAT_REDEMPTION // terrible for(var/datum/action/innate/mecha/equipment/action as anything in equip_actions) action.chassis = M @@ -171,7 +171,7 @@ for(var/datum/action/innate/mecha/equipment/action as anything in equip_actions) action.chassis = null item_flags &= ~NO_MAT_REDEMPTION - REMOVE_TRAIT(src, TRAIT_NODROP, "mecha") + REMOVE_TRAIT(src, TRAIT_NODROP, REF(chassis)) if(chassis.selected == src) src.on_deselect() moveto = moveto || get_turf(chassis) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index b6c2a0a6c464..756e379ee7b7 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -26,7 +26,7 @@ GLOBAL_LIST_EMPTY(lockers) var/max_mob_size = MOB_SIZE_HUMAN //Biggest mob_size accepted by the container var/mob_storage_capacity = 3 // how many human sized mob/living can fit together inside a closet. var/storage_capacity = 30 //This is so that someone can't pack hundreds of items in a locker/crate then open it in a populated area to crash clients. - var/cutting_tool = /obj/item/weldingtool + var/cutting_tool = TOOL_WELDER var/open_sound = 'sound/machines/click.ogg' var/close_sound = 'sound/machines/click.ogg' var/material_drop = /obj/item/stack/sheet/metal @@ -320,71 +320,67 @@ GLOBAL_LIST_EMPTY(lockers) if(!broken && !(flags_1 & NODECONSTRUCT_1)) bust_open() -/obj/structure/closet/attackby(obj/item/W, mob/user, params) +/obj/structure/closet/attackby(obj/item/attacking_item, mob/user, params) if(user in src) return - if(src.tool_interact(W,user)) - return 1 // No afterattack - else - return ..() - -/obj/structure/closet/proc/tool_interact(obj/item/W, mob/user)//returns TRUE if attackBy call shouldnt be continued (because tool was used/closet was of wrong type), FALSE if otherwise - . = TRUE - if(opened) - if(user.a_intent == INTENT_HARM) - return FALSE - if(istype(W, cutting_tool)) - if(W.tool_behaviour == TOOL_WELDER) - if(!W.tool_start_check(user, amount=0)) - return - - to_chat(user, span_notice("You begin cutting \the [src] apart...")) - if(W.use_tool(src, user, 40, volume=50)) - if(!opened) - return - user.visible_message(span_notice("[user] slices apart \the [src]."), - span_notice("You cut \the [src] apart with \the [W]."), - span_italics("You hear welding.")) - deconstruct(TRUE) - return - else // for example cardboard box is cut with wirecutters - user.visible_message(span_notice("[user] cut apart \the [src]."), \ - span_notice("You cut \the [src] apart with \the [W].")) - deconstruct(TRUE) - return - if(user.transferItemToLoc(W, drop_location())) // so we put in unlit welder too - return - else if(W.tool_behaviour == TOOL_WELDER && can_weld_shut) - if(!W.tool_start_check(user, amount=0)) - return + if(user.a_intent != INTENT_HARM && attacking_item.GetID()) + togglelock(user) + return TRUE + return ..() +/obj/structure/closet/welder_act(mob/living/user, obj/item/tool) + if(user.a_intent == INTENT_HARM) + return FALSE + if(!tool.tool_start_check(user, amount=0)) + return FALSE + if(opened && !(flags_1 & NODECONSTRUCT_1)) + if(tool.tool_behaviour != cutting_tool) + return FALSE // the wrong tool + to_chat(user, span_notice("You begin cutting \the [src] apart...")) + if(tool.use_tool(src, user, 4 SECONDS, volume=50)) + if(!opened) + return TRUE + user.visible_message(span_notice("[user] slices apart \the [src]."), + span_notice("You cut \the [src] apart with \the [tool]."), + span_italics("You hear welding.")) + deconstruct(TRUE) + return TRUE + if(can_weld_shut) to_chat(user, span_notice("You begin [welded ? "unwelding":"welding"] \the [src]...")) - if(W.use_tool(src, user, 40, volume=50)) + if(tool.use_tool(src, user, 4 SECONDS, volume=50)) if(opened) return welded = !welded after_weld(welded) update_airtightness() user.visible_message(span_notice("[user] [welded ? "welds shut" : "unwelded"] \the [src]."), - span_notice("You [welded ? "weld" : "unwelded"] \the [src] with \the [W]."), - span_italics("You hear welding.")) + span_notice("You [welded ? "weld" : "unwelded"] \the [src] with \the [tool]."), + span_italics("You hear welding.")) update_appearance() - else if(W.tool_behaviour == TOOL_WRENCH && anchorable) - if(isinspace() && !anchored) - return - setAnchored(!anchored) - W.play_tool_sound(src, 75) - user.visible_message(span_notice("[user] [anchored ? "anchored" : "unanchored"] \the [src] [anchored ? "to" : "from"] the ground."), \ - span_notice("You [anchored ? "anchored" : "unanchored"] \the [src] [anchored ? "to" : "from"] the ground."), \ - span_italics("You hear a ratchet.")) - else if(user.a_intent != INTENT_HARM) - var/item_is_id = W.GetID() - if(!item_is_id && !(W.item_flags & NOBLUDGEON)) - return FALSE - if(item_is_id || !toggle(user)) - togglelock(user) - else + return TRUE + return FALSE + +/obj/structure/closet/wirecutter_act(mob/living/user, obj/item/tool) + if(user.a_intent == INTENT_HARM || (flags_1 & NODECONSTRUCT_1)) return FALSE + if(tool.tool_behaviour != cutting_tool) + return FALSE + user.visible_message(span_notice("[user] cut apart \the [src]."), \ + span_notice("You cut \the [src] apart with \the [tool].")) + deconstruct(TRUE) + return TRUE + +/obj/structure/closet/wrench_act(mob/living/user, obj/item/tool) + if(!anchorable) + return FALSE + if(isinspace() && !anchored) + return FALSE + setAnchored(!anchored) + tool.play_tool_sound(src, 75) + user.visible_message(span_notice("[user] [anchored ? "anchored" : "unanchored"] \the [src] [anchored ? "to" : "from"] the ground."), \ + span_notice("You [anchored ? "anchored" : "unanchored"] \the [src] [anchored ? "to" : "from"] the ground."), \ + span_italics("You hear a ratchet.")) + return TRUE /obj/structure/closet/proc/after_weld(weld_state) return diff --git a/code/game/objects/structures/crates_lockers/closets/bluespace_locker.dm b/code/game/objects/structures/crates_lockers/closets/bluespace_locker.dm index f43afb5fcb7c..6985debc4a1a 100644 --- a/code/game/objects/structures/crates_lockers/closets/bluespace_locker.dm +++ b/code/game/objects/structures/crates_lockers/closets/bluespace_locker.dm @@ -28,7 +28,9 @@ desc = "" cutting_tool = null can_weld_shut = FALSE + anchorable = FALSE anchored = TRUE + flags_1 = NODECONSTRUCT_1 resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF var/list/mirage_whitelist = list() @@ -54,9 +56,6 @@ return TRUE return other.can_open(user) -/obj/structure/closet/bluespace/internal/tool_interact(obj/item/W, mob/user) - return - /obj/structure/closet/bluespace/internal/attack_hand(mob/living/user) var/obj/structure/closet/other = get_other_locker() if(!other) diff --git a/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm b/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm index 9b0bd4e4a69f..c74d91bda453 100644 --- a/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm +++ b/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm @@ -8,7 +8,7 @@ max_integrity = 70 integrity_failure = 0 can_weld_shut = 0 - cutting_tool = /obj/item/wirecutters + cutting_tool = TOOL_WIRECUTTER open_sound = "rustle" material_drop = /obj/item/stack/sheet/cardboard delivery_icon = "deliverybox" @@ -77,7 +77,7 @@ mob_storage_capacity = 5 resistance_flags = NONE move_speed_multiplier = 2 - cutting_tool = /obj/item/weldingtool + cutting_tool = TOOL_WELDER open_sound = 'sound/machines/click.ogg' material_drop = /obj/item/stack/sheet/plasteel #undef SNAKE_SPAM_TICKS diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 094650274a29..55d79883d2e2 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -189,14 +189,14 @@ /obj/structure/table/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/rsf)) // Stops RSF from placing itself instead of glasses return - if(!(flags_1 & NODECONSTRUCT_1)) - if(I.tool_behaviour == TOOL_SCREWDRIVER && deconstruction_ready && (user.a_intent != INTENT_HELP && user.a_intent != INTENT_HARM || !(INTENT_DISARM in user.possible_a_intents))) + if(!(flags_1 & NODECONSTRUCT_1) && deconstruction_ready && ((user.a_intent != INTENT_HELP || HAS_TRAIT(I, TRAIT_NODROP)) && (user.a_intent != INTENT_HARM || (I.item_flags & NOBLUDGEON)) || !(INTENT_DISARM in user.possible_a_intents))) + if(I.tool_behaviour == TOOL_SCREWDRIVER) to_chat(user, span_notice("You start disassembling [src]...")) if(I.use_tool(src, user, 20, volume=50)) deconstruct(TRUE) return - if(I.tool_behaviour == TOOL_WRENCH && deconstruction_ready && (user.a_intent != INTENT_HELP && user.a_intent != INTENT_HARM || !(INTENT_DISARM in user.possible_a_intents))) + if(I.tool_behaviour == TOOL_WRENCH) to_chat(user, span_notice("You start deconstructing [src]...")) if(I.use_tool(src, user, 40, volume=50)) playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) @@ -211,7 +211,7 @@ return // If the tray IS empty, continue on (tray will be placed on the table like other items) - if(user.a_intent != INTENT_HARM && !(I.item_flags & ABSTRACT)) + if((user.a_intent != INTENT_HARM && !HAS_TRAIT(I, TRAIT_NODROP)) && !(I.item_flags & ABSTRACT)) // if you can't drop it, you can't place it on the table if(user.transferItemToLoc(I, drop_location())) var/list/click_params = params2list(params) //Center the icon where the user clicked. diff --git a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_coffin.dm b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_coffin.dm index 153c94faa3c5..7e6b3a3c7797 100644 --- a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_coffin.dm +++ b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_coffin.dm @@ -196,30 +196,37 @@ return TRUE /// You cannot weld or deconstruct an owned coffin. Only the owner can destroy their own coffin. -/obj/structure/closet/crate/coffin/attackby(obj/item/item, mob/user, params) - if(!resident) - return ..() - if(user != resident) - if(istype(item, cutting_tool)) - to_chat(user, span_notice("This is a much more complex mechanical structure than you thought. You don't know where to begin cutting [src].")) - return - if(anchored && (item.tool_behaviour == TOOL_WRENCH)) - to_chat(user, span_danger("The coffin won't come unanchored from the floor.[user == resident ? " You can Alt-Click to unclaim and unwrench your Coffin." : ""]")) - return +/obj/structure/closet/crate/coffin/welder_act(mob/living/user, obj/item/tool) + if(user.a_intent != INTENT_HARM && resident && resident != user) + to_chat(user, span_notice("This is a much more complex mechanical structure than you thought. You don't know where to begin cutting [src].")) + return TRUE + return ..() + +/obj/structure/closet/crate/coffin/wirecutter_act(mob/living/user, obj/item/tool) + if(user.a_intent != INTENT_HARM && resident && resident != user && tool.tool_behaviour == cutting_tool) + to_chat(user, span_notice("This is a much more complex mechanical structure than you thought. You don't know where to begin cutting [src].")) + return TRUE + return ..() - if(locked && (item.tool_behaviour == TOOL_CROWBAR)) - var/pry_time = pry_lid_timer * item.toolspeed // Pry speed must be affected by the speed of the tool. +/obj/structure/closet/crate/coffin/crowbar_act(mob/living/user, obj/item/tool) + if(locked && resident) user.visible_message( - span_notice("[user] tries to pry the lid off of [src] with [item]."), - span_notice("You begin prying the lid off of [src] with [item]. This should take about [DisplayTimeText(pry_time)].")) - if(!do_after(user, pry_time, src)) - return + span_notice("[user] tries to pry the lid off of [src] with [tool]."), + span_notice("You begin prying the lid off of [src] with [tool]. This should take about [DisplayTimeText(pry_lid_timer)].")) + if(!tool.use_tool(src, user, pry_lid_timer)) // Pry speed must be affected by the speed of the tool. + return TRUE bust_open() user.visible_message( span_notice("[user] snaps the door of [src] wide open."), span_notice("The door of [src] snaps open.")) - return - . = ..() + return TRUE + return FALSE + +/obj/structure/closet/crate/coffin/wrench_act(mob/living/user, obj/item/tool) + if(anchored && resident) + to_chat(user, span_danger("The coffin won't come unanchored from the floor.[user == resident ? " You can Alt-Click to unclaim and unwrench your Coffin." : ""]")) + return TRUE + return ..() /// Distance Check (Inside Of) /obj/structure/closet/crate/coffin/AltClick(mob/user) diff --git a/code/modules/cargo/supplypod.dm b/code/modules/cargo/supplypod.dm index 30ddf37ea894..d4dae56958cc 100644 --- a/code/modules/cargo/supplypod.dm +++ b/code/modules/cargo/supplypod.dm @@ -61,6 +61,7 @@ /obj/structure/closet/supplypod/bluespacepod style = STYLE_BLUESPACE bluespace = TRUE + flags_1 = NODECONSTRUCT_1|PREVENT_CONTENTS_EXPLOSION_1 explosionSize = list(0,0,1,2) delays = list(POD_TRANSIT = 15, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30) @@ -70,12 +71,14 @@ specialised = TRUE style = STYLE_SYNDICATE bluespace = TRUE + flags_1 = NODECONSTRUCT_1|PREVENT_CONTENTS_EXPLOSION_1 explosionSize = list(0,0,1,2) delays = list(POD_TRANSIT = 25, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30) /obj/structure/closet/supplypod/centcompod style = STYLE_CENTCOM bluespace = TRUE + flags_1 = NODECONSTRUCT_1|PREVENT_CONTENTS_EXPLOSION_1 explosionSize = list(0,0,0,0) delays = list(POD_TRANSIT = 20, POD_FALLING = 4, POD_OPENING = 30, POD_LEAVING = 30) resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF @@ -178,12 +181,6 @@ if(decal) . += decal -/obj/structure/closet/supplypod/tool_interact(obj/item/W, mob/user) - if(bluespace) //We dont want to worry about interacting with bluespace pods, as they are due to delete themselves soon anyways. - return FALSE - else - ..() - /obj/structure/closet/supplypod/ex_act() //Explosions dont do SHIT TO US! This is because supplypods create explosions when they land. return @@ -199,6 +196,7 @@ /obj/structure/closet/supplypod/proc/handleReturnAfterDeparting(atom/movable/holder = src) reversing = FALSE //Now that we're done reversing, we set this to false (otherwise we would get stuck in an infinite loop of calling the close proc at the bottom of open_pod() ) bluespace = TRUE //Make it so that the pod doesn't stay in centcom forever + flags_1 = NODECONSTRUCT_1|PREVENT_CONTENTS_EXPLOSION_1 pod_flags &= ~FIRST_SOUNDS //Make it so we play sounds now if (!effectQuiet && style != STYLE_SEETHROUGH) audible_message(span_notice("The pod hisses, closing and launching itself away from the station."), span_notice("The ground vibrates, and you hear the sound of engines firing."))