diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index cda952d5415..8ba617003af 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -326,10 +326,11 @@ * Will update the machine icon and any user interfaces currently open. * Arguments: * * drop - Boolean. Whether to drop any stored items in the machine. Does not include components. + * * density - Boolean. Whether to make the object dense when it's open. */ -/obj/machinery/proc/open_machine(drop = TRUE) +/obj/machinery/proc/open_machine(drop = TRUE, density_to_set = FALSE) state_open = TRUE - set_density(FALSE) + set_density(density_to_set) if(drop) dump_inventory_contents() update_appearance() @@ -394,9 +395,9 @@ /obj/machinery/proc/can_be_occupant(atom/movable/occupant_atom) return occupant_typecache ? is_type_in_typecache(occupant_atom, occupant_typecache) : isliving(occupant_atom) -/obj/machinery/proc/close_machine(atom/movable/target) +/obj/machinery/proc/close_machine(atom/movable/target, density_to_set = TRUE) state_open = FALSE - set_density(TRUE) + set_density(density_to_set) if(!target) for(var/atom in loc) if (!(can_be_occupant(atom))) @@ -781,13 +782,15 @@ active_power_usage = initial(active_power_usage) * (1 + parts_energy_rating) update_current_power_usage() -/obj/machinery/proc/default_pry_open(obj/item/crowbar) +/obj/machinery/proc/default_pry_open(obj/item/crowbar, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE) . = !(state_open || panel_open || is_operational || (flags_1 & NODECONSTRUCT_1)) && crowbar.tool_behaviour == TOOL_CROWBAR if(!.) return crowbar.play_tool_sound(src, 50) visible_message(span_notice("[usr] pries open \the [src]."), span_notice("You pry open \the [src].")) - open_machine() + open_machine(density_to_set = open_density) + if (close_after_pry) //Should it immediately close after prying? (If not, it must be closed elsewhere) + close_machine(density_to_set = closed_density) /obj/machinery/proc/default_deconstruction_crowbar(obj/item/crowbar, ignore_panel = 0, custom_deconstruct = FALSE) . = (panel_open || ignore_panel) && !(flags_1 & NODECONSTRUCT_1) && crowbar.tool_behaviour == TOOL_CROWBAR diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index 412a5833f4f..40e3861681f 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -91,7 +91,7 @@ return C return null -/obj/machinery/dna_scannernew/close_machine(mob/living/carbon/user) +/obj/machinery/dna_scannernew/close_machine(mob/living/carbon/user, density_to_set = TRUE) if(!state_open) return FALSE @@ -104,7 +104,7 @@ return TRUE -/obj/machinery/dna_scannernew/open_machine() +/obj/machinery/dna_scannernew/open_machine(density_to_set = FALSE) if(state_open) return FALSE @@ -129,7 +129,7 @@ update_appearance()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed return - if(default_pry_open(I)) + if(default_pry_open(I, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE)) return if(default_deconstruction_crowbar(I)) diff --git a/code/game/machinery/fat_sucker.dm b/code/game/machinery/fat_sucker.dm index a893ba2d654..5c8c99d797f 100644 --- a/code/game/machinery/fat_sucker.dm +++ b/code/game/machinery/fat_sucker.dm @@ -50,7 +50,7 @@ [span_notice("Removing [bite_size] nutritional units per operation.")] [span_notice("Requires [nutrient_to_meat] nutritional units per meat slab.")]"} -/obj/machinery/fat_sucker/close_machine(mob/user) +/obj/machinery/fat_sucker/close_machine(mob/user, density_to_set = TRUE) if(panel_open) to_chat(user, span_warning("You need to close the maintenance hatch first!")) return @@ -65,7 +65,7 @@ addtimer(CALLBACK(src, PROC_REF(start_extracting)), 20, TIMER_OVERRIDE|TIMER_UNIQUE) update_appearance() -/obj/machinery/fat_sucker/open_machine(mob/user) +/obj/machinery/fat_sucker/open_machine(mob/user, density_to_set = FALSE) make_meat() playsound(src, 'sound/machines/click.ogg', 50) if(processing) diff --git a/code/game/machinery/harvester.dm b/code/game/machinery/harvester.dm index 9e0ac14928d..0374920e67e 100644 --- a/code/game/machinery/harvester.dm +++ b/code/game/machinery/harvester.dm @@ -42,7 +42,7 @@ icon_state = base_icon_state return ..() -/obj/machinery/harvester/open_machine(drop = TRUE) +/obj/machinery/harvester/open_machine(drop = TRUE, density_to_set = FALSE) if(panel_open) return . = ..() diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 9629f5e33f6..6e375a43ef8 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -245,7 +245,7 @@ Possible to do for anyone motivated enough: if(default_deconstruction_screwdriver(user, "holopad_open", "holopad0", P)) return - if(default_pry_open(P)) + if(default_pry_open(P, close_after_pry = TRUE, closed_density = FALSE)) return if(default_deconstruction_crowbar(P)) diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 55a7d5bc7c9..b86a2884e35 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -80,7 +80,7 @@ if(default_deconstruction_screwdriver(user, "borgdecon2", "borgcharger0", P)) return - if(default_pry_open(P)) + if(default_pry_open(P, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE)) return if(default_deconstruction_crowbar(P)) @@ -93,15 +93,15 @@ /obj/machinery/recharge_station/proc/toggle_open() if(state_open) - close_machine() + close_machine(density_to_set = TRUE) else open_machine() -/obj/machinery/recharge_station/open_machine() +/obj/machinery/recharge_station/open_machine(drop = TRUE, density_to_set = FALSE) . = ..() update_use_power(IDLE_POWER_USE) -/obj/machinery/recharge_station/close_machine() +/obj/machinery/recharge_station/close_machine(density_to_set = TRUE) . = ..() if(occupant) update_use_power(ACTIVE_POWER_USE) //It always tries to charge, even if it can't. diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index c804296b481..92440c95b65 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -76,7 +76,7 @@ if(default_deconstruction_screwdriver(user, "grinder-oOpen", "grinder-o0", I)) return - if(default_pry_open(I)) + if(default_pry_open(I, close_after_pry = TRUE)) return if(default_deconstruction_crowbar(I)) diff --git a/code/game/machinery/sleepers.dm b/code/game/machinery/sleepers.dm index d2dbe9aad87..044d052a3c7 100644 --- a/code/game/machinery/sleepers.dm +++ b/code/game/machinery/sleepers.dm @@ -94,12 +94,12 @@ if (!state_open) container_resist_act(user) -/obj/machinery/sleeper/open_machine() +/obj/machinery/sleeper/open_machine(density_to_set = FALSE) if(!state_open && !panel_open) flick("[initial(icon_state)]-anim", src) return ..() -/obj/machinery/sleeper/close_machine(mob/user) +/obj/machinery/sleeper/close_machine(mob/user, density_to_set = TRUE) if((isnull(user) || istype(user)) && state_open && !panel_open) flick("[initial(icon_state)]-anim", src) ..() diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index bf5cba8df6b..bd159e13af2 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -420,7 +420,7 @@ GLOBAL_LIST_INIT(dye_registry, list( new /obj/item/stack/sheet/iron(drop_location(), 2) qdel(src) -/obj/machinery/washing_machine/open_machine(drop = 1) - ..() +/obj/machinery/washing_machine/open_machine(drop = TRUE, density_to_set = FALSE) + . = ..() set_density(TRUE) //because machinery/open_machine() sets it to FALSE color_source = null diff --git a/code/game/objects/items/implants/implantchair.dm b/code/game/objects/items/implants/implantchair.dm index 161983e4977..0cca201bea9 100644 --- a/code/game/objects/items/implants/implantchair.dm +++ b/code/game/objects/items/implants/implantchair.dm @@ -153,7 +153,7 @@ close_machine(target) -/obj/machinery/implantchair/close_machine(mob/living/user) +/obj/machinery/implantchair/close_machine(mob/living/user, density_to_set = TRUE) if((isnull(user) || istype(user)) && state_open) ..(user) if(auto_inject && ready && ready_implants > 0) diff --git a/code/modules/antagonists/abductor/machinery/experiment.dm b/code/modules/antagonists/abductor/machinery/experiment.dm index cb64d972c53..69f96789222 100644 --- a/code/modules/antagonists/abductor/machinery/experiment.dm +++ b/code/modules/antagonists/abductor/machinery/experiment.dm @@ -28,11 +28,11 @@ return close_machine(target) -/obj/machinery/abductor/experiment/open_machine() +/obj/machinery/abductor/experiment/open_machine(density_to_set = FALSE) if(!state_open && !panel_open) ..() -/obj/machinery/abductor/experiment/close_machine(mob/target) +/obj/machinery/abductor/experiment/close_machine(mob/target, density_to_set = TRUE) for(var/A in loc) if(isabductor(A)) return diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index e028b801d67..279c639b219 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -358,16 +358,16 @@ message_cooldown = world.time + 50 to_chat(user, span_warning("[src]'s door won't budge!")) -/obj/machinery/atmospherics/components/unary/cryo_cell/open_machine(drop = FALSE) +/obj/machinery/atmospherics/components/unary/cryo_cell/open_machine(drop = FALSE, density_to_set = FALSE) if(!state_open && !panel_open) set_on(FALSE) for(var/mob/M in contents) //only drop mobs M.forceMove(get_turf(src)) set_occupant(null) flick("pod-open-anim", src) - ..() + return ..() -/obj/machinery/atmospherics/components/unary/cryo_cell/close_machine(mob/living/carbon/user) +/obj/machinery/atmospherics/components/unary/cryo_cell/close_machine(mob/living/carbon/user, density_to_set = TRUE) treating_wounds = FALSE if((isnull(user) || istype(user)) && state_open && !panel_open) flick("pod-close-anim", src) @@ -419,7 +419,7 @@ return TOOL_ACT_TOOLTYPE_SUCCESS /obj/machinery/atmospherics/components/unary/cryo_cell/crowbar_act(mob/living/user, obj/item/tool) - if(on || occupant || state_open) + if(on || state_open) return FALSE if(default_pry_open(tool) || default_deconstruction_crowbar(tool)) return TOOL_ACT_TOOLTYPE_SUCCESS diff --git a/code/modules/food_and_drinks/machinery/gibber.dm b/code/modules/food_and_drinks/machinery/gibber.dm index 8b8c731acd3..f8d02dfde4e 100644 --- a/code/modules/food_and_drinks/machinery/gibber.dm +++ b/code/modules/food_and_drinks/machinery/gibber.dm @@ -117,7 +117,7 @@ if(default_deconstruction_screwdriver(user, "grinder_open", "grinder", P)) return - else if(default_pry_open(P)) + else if(default_pry_open(P, close_after_pry = TRUE)) return else if(default_deconstruction_crowbar(P)) diff --git a/code/modules/food_and_drinks/machinery/monkeyrecycler.dm b/code/modules/food_and_drinks/machinery/monkeyrecycler.dm index a11a0b8c3db..d70413660e4 100644 --- a/code/modules/food_and_drinks/machinery/monkeyrecycler.dm +++ b/code/modules/food_and_drinks/machinery/monkeyrecycler.dm @@ -48,7 +48,7 @@ GLOBAL_LIST_EMPTY(monkey_recyclers) if(default_deconstruction_screwdriver(user, "grinder_open", "grinder", O)) return - if(default_pry_open(O)) + if(default_pry_open(O, close_after_pry = TRUE)) return if(default_deconstruction_crowbar(O)) diff --git a/code/modules/food_and_drinks/machinery/processor.dm b/code/modules/food_and_drinks/machinery/processor.dm index 434a85ada6d..ae471ab63d2 100644 --- a/code/modules/food_and_drinks/machinery/processor.dm +++ b/code/modules/food_and_drinks/machinery/processor.dm @@ -87,7 +87,7 @@ if(processing) to_chat(user, span_warning("[src] is in the process of processing!")) return TRUE - if(default_deconstruction_screwdriver(user, "processor", "processor1", attacking_item) || default_pry_open(attacking_item) || default_deconstruction_crowbar(attacking_item)) + if(default_deconstruction_screwdriver(user, "processor", "processor1", attacking_item) || default_pry_open(attacking_item, close_after_pry = TRUE) || default_deconstruction_crowbar(attacking_item)) return if(istype(attacking_item, /obj/item/storage/bag/tray)) diff --git a/code/modules/food_and_drinks/machinery/smartfridge.dm b/code/modules/food_and_drinks/machinery/smartfridge.dm index 1cb82da1943..166046db303 100644 --- a/code/modules/food_and_drinks/machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/machinery/smartfridge.dm @@ -88,7 +88,7 @@ SStgui.update_uis(src) return - if(default_pry_open(O)) + if(default_pry_open(O, close_after_pry = TRUE)) return if(default_deconstruction_crowbar(O)) diff --git a/code/modules/hydroponics/seed_extractor.dm b/code/modules/hydroponics/seed_extractor.dm index 3520ebf3827..a5beca3153f 100644 --- a/code/modules/hydroponics/seed_extractor.dm +++ b/code/modules/hydroponics/seed_extractor.dm @@ -112,7 +112,7 @@ if(default_deconstruction_screwdriver(user, "sextractor_open", "sextractor", attacking_item)) return TRUE - if(default_pry_open(attacking_item)) + if(default_pry_open(attacking_item, close_after_pry = TRUE)) return TRUE if(default_deconstruction_crowbar(attacking_item)) diff --git a/code/modules/library/skill_learning/skill_station.dm b/code/modules/library/skill_learning/skill_station.dm index e8c378d7699..9e8fc99031e 100644 --- a/code/modules/library/skill_learning/skill_station.dm +++ b/code/modules/library/skill_learning/skill_station.dm @@ -48,7 +48,7 @@ /obj/machinery/skill_station/relaymove(mob/living/user, direction) open_machine() -/obj/machinery/skill_station/open_machine() +/obj/machinery/skill_station/open_machine(density_to_set = FALSE) . = ..() interrupt_operation() @@ -63,7 +63,7 @@ if(working) interrupt_operation() -/obj/machinery/skill_station/close_machine(atom/movable/target) +/obj/machinery/skill_station/close_machine(atom/movable/target, density_to_set = TRUE) . = ..() if(occupant) ui_interact(occupant) diff --git a/code/modules/mapfluff/ruins/spaceruin_code/oldstation.dm b/code/modules/mapfluff/ruins/spaceruin_code/oldstation.dm index 86154f6be85..bfd8bd6c519 100644 --- a/code/modules/mapfluff/ruins/spaceruin_code/oldstation.dm +++ b/code/modules/mapfluff/ruins/spaceruin_code/oldstation.dm @@ -173,13 +173,13 @@ mod_unit = null open_machine() -/obj/machinery/mod_installer/open_machine() +/obj/machinery/mod_installer/open_machine(density_to_set = FALSE) if(state_open) return FALSE ..() return TRUE -/obj/machinery/mod_installer/close_machine(mob/living/carbon/user) +/obj/machinery/mod_installer/close_machine(mob/living/carbon/user, density_to_set = TRUE) if(!state_open) return FALSE ..() diff --git a/code/modules/wiremod/shell/brain_computer_interface.dm b/code/modules/wiremod/shell/brain_computer_interface.dm index 7893a755b2c..3f377398026 100644 --- a/code/modules/wiremod/shell/brain_computer_interface.dm +++ b/code/modules/wiremod/shell/brain_computer_interface.dm @@ -400,7 +400,7 @@ update_appearance() return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - if (default_pry_open(weapon)) + if (default_pry_open(weapon, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE)) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN if (default_deconstruction_crowbar(weapon)) @@ -453,7 +453,7 @@ say("Occupant has been injected with [bci_to_implant].") bci_to_implant.Insert(carbon_occupant) -/obj/machinery/bci_implanter/open_machine() +/obj/machinery/bci_implanter/open_machine(drop = TRUE, density_to_set = FALSE) if(state_open) return FALSE @@ -461,7 +461,7 @@ return TRUE -/obj/machinery/bci_implanter/close_machine(mob/living/carbon/user) +/obj/machinery/bci_implanter/close_machine(mob/living/carbon/user, density_to_set = TRUE) if(!state_open) return FALSE diff --git a/modular_skyrat/modules/assault_operatives/code/interrogator.dm b/modular_skyrat/modules/assault_operatives/code/interrogator.dm index 07095cdf4d1..f6b6d985c34 100644 --- a/modular_skyrat/modules/assault_operatives/code/interrogator.dm +++ b/modular_skyrat/modules/assault_operatives/code/interrogator.dm @@ -75,8 +75,8 @@ if(!locked) open_machine() -/obj/machinery/interrogator/open_machine(drop) - ..() +/obj/machinery/interrogator/open_machine() + . = ..() human_occupant = null /obj/machinery/interrogator/proc/stop_extract() diff --git a/modular_skyrat/modules/self_actualization_device/code/self_actualization_device.dm b/modular_skyrat/modules/self_actualization_device/code/self_actualization_device.dm index 34bfa481bc2..75be23dd642 100644 --- a/modular_skyrat/modules/self_actualization_device/code/self_actualization_device.dm +++ b/modular_skyrat/modules/self_actualization_device/code/self_actualization_device.dm @@ -71,10 +71,6 @@ . = ..() . += span_notice("ALT-Click to turn ON when closed.") -/obj/machinery/self_actualization_device/open_machine(mob/user) - playsound(src, 'sound/machines/click.ogg', 50) - ..() - /obj/machinery/self_actualization_device/AltClick(mob/user) . = ..() if(!powered() || !occupant || state_open)