[MIRROR] Minor cleanup for machine frames & boulder machines (#26810)

* Minor cleanup for machine frames & boulder machines (#81706)

## About The Pull Request
- Moves call to `update_appearance(UPDATE_ICON_STATE)` to
`/obj/structure/frame/Initialize()` for both computer & machine frames
cause both do that anyway
- Fixes wrench screentip for machine frames
- Screw driving an incomplete machine frame won't display the "you need
to unsecure it first" along with "missing components" balloon alerts
- Moved boulder refinery code to `item_interaction()`
- Autodoc some golem procs for refineries
- Gives the secured machine frame an icon state of `box_1` so it looks
wired in the rcd menu as well
- Fixes screentips(like wrench act) for boulder machines

## Changelog
🆑
fix: fixes toolact screentips & balloon alerts for boulder machines &
machine frame
/🆑

* Minor cleanup for machine frames & boulder machines

---------

Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-03-10 01:31:21 +01:00
committed by GitHub
parent ce17d7984d
commit 571fd77b39
6 changed files with 104 additions and 84 deletions
@@ -66,9 +66,9 @@
else if(istype(held_item, /obj/item/card/id) && points_held > 0)
context[SCREENTIP_CONTEXT_LMB] = "Claim mining points"
else if(held_item.tool_behaviour == TOOL_SCREWDRIVER)
context[SCREENTIP_CONTEXT_LMB] = "[panel_open ? "Close" : "Open"] Panel"
context[SCREENTIP_CONTEXT_LMB] = "[panel_open ? "Close" : "Open"] panel"
else if(held_item.tool_behaviour == TOOL_WRENCH)
context[SCREENTIP_CONTEXT_LMB] = "[anchored ? "" : "Un"] Anchor"
context[SCREENTIP_CONTEXT_LMB] = "[anchored ? "Un" : ""]Anchor"
else if(panel_open && held_item.tool_behaviour == TOOL_CROWBAR)
context[SCREENTIP_CONTEXT_LMB] = "Deconstruct"
@@ -96,39 +96,17 @@
/obj/machinery/bouldertech/update_icon_state()
. = ..()
var/suffix = ""
if(!anchored || !is_operational || (machine_stat & (BROKEN | NOPOWER)) || panel_open)
if(!anchored || panel_open || !is_operational || (machine_stat & (BROKEN | NOPOWER)))
suffix = "-off"
icon_state ="[initial(icon_state)][suffix]"
/obj/machinery/bouldertech/wrench_act(mob/living/user, obj/item/tool)
. = ITEM_INTERACT_BLOCKING
if(default_unfasten_wrench(user, tool, time = 1.5 SECONDS) == SUCCESSFUL_UNFASTEN)
if(anchored)
begin_processing()
else
end_processing()
update_appearance(UPDATE_ICON_STATE)
return ITEM_INTERACT_SUCCESS
/obj/machinery/bouldertech/screwdriver_act(mob/living/user, obj/item/tool)
. = ITEM_INTERACT_BLOCKING
if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-off", initial(icon_state), tool))
update_appearance(UPDATE_ICON_STATE)
return ITEM_INTERACT_SUCCESS
/obj/machinery/bouldertech/crowbar_act(mob/living/user, obj/item/tool)
. = ITEM_INTERACT_BLOCKING
if(default_deconstruction_crowbar(tool))
return ITEM_INTERACT_SUCCESS
/obj/machinery/bouldertech/CanAllowThrough(atom/movable/mover, border_dir)
if(!anchored)
return FALSE
if(istype(mover, /obj/item/boulder))
return can_process_boulder(mover)
if(isgolem(mover))
var/mob/living/carbon/human/rockman = mover
return rockman.body_position == LYING_DOWN
return can_process_golem(mover)
return ..()
/**
@@ -142,7 +120,7 @@
SHOULD_BE_PURE(TRUE)
//machine not operational
if(!anchored || panel_open || !is_operational)
if(!anchored || panel_open || !is_operational || (machine_stat & (BROKEN | NOPOWER)))
return FALSE
//not a valid boulder
@@ -170,6 +148,8 @@
* * obj/item/boulder/new_boulder - the boulder to accept
*/
/obj/machinery/bouldertech/proc/accept_boulder(obj/item/boulder/new_boulder)
PRIVATE_PROC(TRUE)
if(!can_process_boulder(new_boulder))
return FALSE
@@ -180,28 +160,55 @@
return TRUE
/**
* Accepts a golem to be processed, mainly for memes
* Can we maim this golem
* Arguments
*
* * [rockman][mob/living/carbon/human] - the golem we are trying to main
*/
/obj/machinery/bouldertech/proc/accept_golem(mob/living/carbon/human/rockman)
if(!is_operational || !anchored)
/obj/machinery/bouldertech/proc/can_process_golem(mob/living/carbon/human/rockman)
PRIVATE_PROC(TRUE)
SHOULD_BE_PURE(TRUE)
//not operatinal
if(!anchored || panel_open || !is_operational || (machine_stat & (BROKEN | NOPOWER)))
return FALSE
//still in cooldown
if(!COOLDOWN_FINISHED(src, accept_cooldown))
return FALSE
if(rockman.body_position != LYING_DOWN)
//not processable
if(!istype(rockman) || QDELETED(rockman) || rockman.body_position != LYING_DOWN)
return FALSE
if(!maim_golem(rockman))
return FALSE
playsound(src, usage_sound, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
COOLDOWN_START(src, accept_cooldown, 3 SECONDS)
return TRUE
/**
* Accepts a golem to be processed, mainly for memes
* Arguments
*
* * [rockman][mob/living/carbon/human] - the golem we are trying to main
*/
/obj/machinery/bouldertech/proc/accept_golem(mob/living/carbon/human/rockman)
PRIVATE_PROC(TRUE)
if(!can_process_golem(rockman))
return
maim_golem(rockman)
use_power(active_power_usage * 1.5)
playsound(src, usage_sound, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
COOLDOWN_START(src, accept_cooldown, 3 SECONDS)
/// What effects actually happens to a golem when it is "processed"
/obj/machinery/bouldertech/proc/maim_golem(mob/living/carbon/human/rockman)
PROTECTED_PROC(TRUE)
Shake(duration = 1 SECONDS)
rockman.visible_message(span_warning("[rockman] is processed by [src]!"), span_userdanger("You get processed into bits by [src]!"))
rockman.investigate_log("was gibbed by [src] for being a golem", INVESTIGATE_DEATHS)
rockman.gib(DROP_ALL_REMAINS)
return TRUE
/obj/machinery/bouldertech/proc/on_entered(datum/source, atom/movable/atom_movable)
SIGNAL_HANDLER
@@ -234,42 +241,61 @@
return FALSE
/obj/machinery/bouldertech/attackby(obj/item/attacking_item, mob/user, params)
if(panel_open)
/obj/machinery/bouldertech/item_interaction(mob/living/user, obj/item/tool, list/modifiers, is_right_clicking)
if(panel_open || user.combat_mode)
return ..()
if(istype(attacking_item, /obj/item/boulder))
. = TRUE
var/obj/item/boulder/my_boulder = attacking_item
if(istype(tool, /obj/item/boulder))
var/obj/item/boulder/my_boulder = tool
if(!accept_boulder(my_boulder))
balloon_alert_to_viewers("cannot accept!")
return
return ITEM_INTERACT_BLOCKING
balloon_alert_to_viewers("accepted")
return
return ITEM_INTERACT_SUCCESS
if(istype(attacking_item, /obj/item/card/id))
. = TRUE
if(istype(tool, /obj/item/card/id))
if(points_held <= 0)
balloon_alert_to_viewers("no points to claim!")
if(!COOLDOWN_FINISHED(src, sound_cooldown))
return
return ITEM_INTERACT_BLOCKING
COOLDOWN_START(src, sound_cooldown, 1.5 SECONDS)
playsound(src, 'sound/machines/buzz-sigh.ogg', 30, FALSE)
return
return ITEM_INTERACT_BLOCKING
var/obj/item/card/id/id_card = attacking_item
var/obj/item/card/id/id_card = tool
var/amount = tgui_input_number(user, "How many mining points do you wish to claim? ID Balance: [id_card.registered_account.mining_points], stored mining points: [points_held]", "Transfer Points", max_value = points_held, min_value = 0, round_value = 1)
if(!amount)
return
return ITEM_INTERACT_BLOCKING
if(amount > points_held)
amount = points_held
id_card.registered_account.mining_points += amount
points_held = round(points_held - amount)
to_chat(user, span_notice("You claim [amount] mining points from \the [src] to [id_card]."))
return
return ITEM_INTERACT_SUCCESS
return ..()
/obj/machinery/bouldertech/wrench_act(mob/living/user, obj/item/tool)
. = ITEM_INTERACT_BLOCKING
if(default_unfasten_wrench(user, tool, time = 1.5 SECONDS) == SUCCESSFUL_UNFASTEN)
if(anchored)
begin_processing()
else
end_processing()
update_appearance(UPDATE_ICON_STATE)
return ITEM_INTERACT_SUCCESS
/obj/machinery/bouldertech/screwdriver_act(mob/living/user, obj/item/tool)
. = ITEM_INTERACT_BLOCKING
if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-off", initial(icon_state), tool))
update_appearance(UPDATE_ICON_STATE)
return ITEM_INTERACT_SUCCESS
/obj/machinery/bouldertech/crowbar_act(mob/living/user, obj/item/tool)
. = ITEM_INTERACT_BLOCKING
if(default_deconstruction_crowbar(tool))
return ITEM_INTERACT_SUCCESS
/obj/machinery/bouldertech/attack_hand_secondary(mob/user, list/modifiers)
. = ..()
if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN || panel_open)
@@ -295,15 +321,17 @@
* Accepts a boulder into the machinery, then converts it into minerals.
* If the boulder can be fully processed by this machine, we take the materials, insert it into the silo, and destroy the boulder.
* If the boulder has materials left, we make a copy of the boulder to hold the processable materials, take the processable parts, and eject the original boulder.
* @param chosen_boulder The boulder to being breaking down into minerals.
* Arguments
*
* * obj/item/boulder/chosen_boulder - The boulder to being breaking down into minerals.
*/
/obj/machinery/bouldertech/proc/breakdown_boulder(obj/item/boulder/chosen_boulder)
PRIVATE_PROC(TRUE)
if(QDELETED(chosen_boulder))
return FALSE
return
if(chosen_boulder.loc != src)
return FALSE
return
//if boulders are kept inside because there is no space to eject them, then they could be reprocessed, lets avoid that
if(!chosen_boulder.processed_by)
@@ -330,7 +358,7 @@
if(istype(chosen_boulder, /obj/item/boulder/artifact))
points_held = round((points_held + MINER_POINT_MULTIPLIER) * MINING_POINT_MACHINE_MULTIPLIER) /// Artifacts give bonus points!
chosen_boulder.break_apart()
return TRUE //We've processed all the materials in the boulder, so we can just destroy it in break_apart.
return//We've processed all the materials in the boulder, so we can just destroy it in break_apart.
chosen_boulder.processed_by = src
@@ -338,7 +366,7 @@
remove_boulder(chosen_boulder)
/obj/machinery/bouldertech/process()
if(!anchored || panel_open || !is_operational || machine_stat & (BROKEN | NOPOWER))
if(!anchored || panel_open || !is_operational || (machine_stat & (BROKEN | NOPOWER)))
return
var/boulders_found = FALSE