From 07e3c61067447d7e3b09cb9fada027a80f2d9260 Mon Sep 17 00:00:00 2001 From: ACCount Date: Mon, 5 Mar 2018 02:51:38 +0300 Subject: [PATCH] Refactors construction datums into components (#35894) --- code/datums/components/construction.dm | 158 ++++++ .../helper_datums/construction_datum.dm | 104 ---- code/game/mecha/mecha_construction_paths.dm | 462 ++++++++---------- code/game/mecha/mecha_parts.dm | 21 +- tgstation.dme | 2 +- 5 files changed, 376 insertions(+), 371 deletions(-) create mode 100644 code/datums/components/construction.dm delete mode 100644 code/datums/helper_datums/construction_datum.dm diff --git a/code/datums/components/construction.dm b/code/datums/components/construction.dm new file mode 100644 index 0000000000..74b6f54a6c --- /dev/null +++ b/code/datums/components/construction.dm @@ -0,0 +1,158 @@ +#define FORWARD 1 +#define BACKWARD -1 + +#define ITEM_DELETE "delete" +#define ITEM_MOVE_INSIDE "move_inside" + + +/datum/component/construction + var/list/steps + var/result + var/index = 1 + var/desc + +/datum/component/construction/Initialize() + if(!isatom(parent)) + . = COMPONENT_INCOMPATIBLE + CRASH("A construction component was applied incorrectly to non-atom: [parent.type].") + + RegisterSignal(COMSIG_PARENT_EXAMINE, .proc/examine) + RegisterSignal(COMSIG_PARENT_ATTACKBY,.proc/action) + update_parent(index) + +/datum/component/construction/proc/examine(mob/user) + if(desc) + to_chat(user, desc) + +/datum/component/construction/proc/on_step() + if(index > steps.len) + spawn_result() + else + update_parent(index) + +/datum/component/construction/proc/action(obj/item/I, mob/living/user) + return check_step(I, user) + +/datum/component/construction/proc/update_index(diff) + index += diff + on_step() + +/datum/component/construction/proc/check_step(obj/item/I, mob/living/user) + var/diff = is_right_key(I) + if(diff && custom_action(I, user, diff)) + update_index(diff) + return TRUE + return FALSE + +/datum/component/construction/proc/is_right_key(obj/item/I) // returns index step + var/list/L = steps[index] + if(check_used_item(I, L["key"])) + return FORWARD //to the first step -> forward + else if(check_used_item(I, L["back_key"])) + return BACKWARD //to the last step -> backwards + return FALSE + +/datum/component/construction/proc/check_used_item(obj/item/I, key) + if(!key) + return FALSE + + if(ispath(key) && istype(I, key)) + return TRUE + + else if(I.tool_behaviour == key) + return TRUE + + return FALSE + +/datum/component/construction/proc/custom_action(obj/item/I, mob/living/user, diff) + var/target_index = index + diff + var/list/current_step = steps[index] + var/list/target_step + + if(target_index > 0 && target_index <= steps.len) + target_step = steps[target_index] + + . = TRUE + + if(I.tool_behaviour) + . = I.use_tool(parent, user, 0, volume=50) + + else if(diff == FORWARD) + switch(current_step["action"]) + if(ITEM_DELETE) + . = user.transferItemToLoc(I, parent) + if(.) + qdel(I) + + if(ITEM_MOVE_INSIDE) + . = user.transferItemToLoc(I, parent) + + // Using stacks + else if(istype(I, /obj/item/stack)) + . = I.use_tool(parent, user, 0, volume=50, amount=current_step["amount"]) + + + // Going backwards? Undo the last action. Drop/respawn the items used in last action, if any. + if(. && diff == BACKWARD && target_step && !target_step["no_refund"]) + var/target_step_key = target_step["key"] + + switch(target_step["action"]) + if(ITEM_DELETE) + new target_step_key(drop_location()) + + if(ITEM_MOVE_INSIDE) + var/obj/item/located_item = locate(target_step_key) in parent + if(located_item) + located_item.forceMove(drop_location()) + + else if(ispath(target_step_key, /obj/item/stack)) + new target_step_key(drop_location(), target_step["amount"]) + +/datum/component/construction/proc/spawn_result() + // Some constructions result in new components being added. + if(ispath(result, /datum/component)) + parent.AddComponent(result) + qdel(src) + + else if(ispath(result, /atom)) + new result(drop_location()) + qdel(parent) + +/datum/component/construction/proc/update_parent(step_index) + var/list/step = steps[step_index] + var/atom/parent_atom = parent + + if(step["desc"]) + desc = step["desc"] + + if(step["icon_state"]) + parent_atom.icon_state = step["icon_state"] + +/datum/component/construction/proc/drop_location() + var/atom/parent_atom = parent + return parent_atom.drop_location() + + + +// Unordered construction. +// Takes a list of part types, to be added in any order, as steps. +// Calls spawn_result() when every type has been added. +/datum/component/construction/unordered/check_step(obj/item/I, mob/living/user) + for(var/typepath in steps) + if(istype(I, typepath) && custom_action(I, user, typepath)) + steps -= typepath + on_step() + return TRUE + return FALSE + +/datum/component/construction/unordered/on_step() + if(!steps.len) + spawn_result() + else + update_parent(steps.len) + +/datum/component/construction/unordered/update_parent(steps_left) + return + +/datum/component/construction/unordered/custom_action(obj/item/I, mob/living/user, typepath) + return TRUE diff --git a/code/datums/helper_datums/construction_datum.dm b/code/datums/helper_datums/construction_datum.dm deleted file mode 100644 index d457c60ade..0000000000 --- a/code/datums/helper_datums/construction_datum.dm +++ /dev/null @@ -1,104 +0,0 @@ -#define FORWARD 1 -#define BACKWARD -1 - -#define ITEM_DELETE "delete" -#define ITEM_MOVE_INSIDE "move_inside" - - -/datum/construction - var/list/steps - var/atom/holder - var/result - var/index = 1 - -/datum/construction/New(atom) - ..() - holder = atom - if(!holder) //don't want this without a holder - qdel(src) - update_holder(index) - -/datum/construction/proc/on_step() - if(index > steps.len) - spawn_result() - else - update_holder(index) - -/datum/construction/proc/action(obj/item/I, mob/living/user) - return check_step(I, user) - -/datum/construction/proc/update_index(diff) - index += diff - on_step() - -/datum/construction/proc/check_step(obj/item/I, mob/living/user) - var/diff = is_right_key(I) - if(diff && custom_action(I, user, diff)) - update_index(diff) - return TRUE - return FALSE - -/datum/construction/proc/is_right_key(obj/item/I) // returns index step - var/list/L = steps[index] - if(check_used_item(I, L["key"])) - return FORWARD //to the first step -> forward - else if(check_used_item(I, L["back_key"])) - return BACKWARD //to the last step -> backwards - return FALSE - -/datum/construction/proc/check_used_item(obj/item/I, key) - if(!key) - return FALSE - - if(ispath(key) && istype(I, key)) - return TRUE - - else if(I.tool_behaviour == key) - return TRUE - - return FALSE - -/datum/construction/proc/custom_action(obj/item/I, mob/living/user, diff) - return TRUE - -/datum/construction/proc/spawn_result() - if(result) - new result(drop_location()) - qdel(holder) - -/datum/construction/proc/update_holder(step_index) - var/list/step = steps[step_index] - - if(step["desc"]) - holder.desc = step["desc"] - - if(step["icon_state"]) - holder.icon_state = step["icon_state"] - -/datum/construction/proc/drop_location() - return holder.drop_location() - - - -// Unordered construction. -// Takes a list of part types, to be added in any order, as steps. -// Calls spawn_result() when every type has been added. -/datum/construction/unordered/check_step(obj/item/I, mob/living/user) - for(var/typepath in steps) - if(istype(I, typepath) && custom_action(I, user, typepath)) - steps -= typepath - on_step() - return TRUE - return FALSE - -/datum/construction/unordered/on_step() - if(!steps.len) - spawn_result() - else - update_holder(steps.len) - -/datum/construction/unordered/update_holder(steps_left) - return - -/datum/construction/unordered/custom_action(obj/item/I, mob/living/user, typepath) - return TRUE diff --git a/code/game/mecha/mecha_construction_paths.dm b/code/game/mecha/mecha_construction_paths.dm index b8a5cca70e..fa6dd9c5a0 100644 --- a/code/game/mecha/mecha_construction_paths.dm +++ b/code/game/mecha/mecha_construction_paths.dm @@ -1,94 +1,49 @@ //////////////////////////////// ///// Construction datums ////// //////////////////////////////// -/datum/construction/mecha +/datum/component/construction/mecha var/base_icon -/datum/construction/mecha/custom_action(obj/item/I, mob/living/user, diff) - var/target_index = index + diff - var/list/current_step = steps[index] - var/list/target_step - - if(target_index > 0 && target_index <= steps.len) - target_step = steps[target_index] - - . = TRUE - - if(I.tool_behaviour) - . = I.use_tool(holder, user, 0, volume=50) - - else if(diff == FORWARD) - switch(current_step["action"]) - if(ITEM_DELETE) - . = user.transferItemToLoc(I, holder) - if(.) - qdel(I) - - if(ITEM_MOVE_INSIDE) - . = user.transferItemToLoc(I, holder) - - else if(istype(I, /obj/item/stack)) - . = I.use_tool(holder, user, 0, volume=50, amount=current_step["amount"]) - - - // Going backwards? Undo the last action. Drop/respawn the items used in last action, if any. - if(. && diff == BACKWARD && target_step && !target_step["no_refund"]) - var/target_step_key = target_step["key"] - - switch(target_step["action"]) - if(ITEM_DELETE) - new target_step_key(drop_location()) - - if(ITEM_MOVE_INSIDE) - var/obj/item/located_item = locate(target_step_key) in holder - if(located_item) - located_item.forceMove(drop_location()) - - else if(ispath(target_step_key, /obj/item/stack)) - new target_step_key(drop_location(), target_step["amount"]) - - -/datum/construction/mecha/spawn_result() +/datum/component/construction/mecha/spawn_result() if(!result) return - // Remove default mech power cell, as we replace it with a new one. var/obj/mecha/M = new result(drop_location()) QDEL_NULL(M.cell) - M.CheckParts(holder.contents) + var/atom/parent_atom = parent + M.CheckParts(parent_atom.contents) SSblackbox.record_feedback("tally", "mechas_created", 1, M.name) - QDEL_NULL(holder) + QDEL_NULL(parent) -/datum/construction/mecha/update_holder(step_index) +/datum/component/construction/mecha/update_parent(step_index) ..() // By default, each step in mech construction has a single icon_state: // "[base_icon][index - 1]" // For example, Ripley's step 1 icon_state is "ripley0". + var/atom/parent_atom = parent if(!steps[index]["icon_state"] && base_icon) - holder.icon_state = "[base_icon][index - 1]" + parent_atom.icon_state = "[base_icon][index - 1]" -/datum/construction/unordered/mecha_chassis/custom_action(obj/item/I, mob/living/user, typepath) - . = user.transferItemToLoc(I, holder) +/datum/component/construction/unordered/mecha_chassis/custom_action(obj/item/I, mob/living/user, typepath) + . = user.transferItemToLoc(I, parent) if(.) - user.visible_message("[user] has connected [I] to [holder].", "You connect [I] to [holder].") - holder.add_overlay(I.icon_state+"+o") + var/atom/parent_atom = parent + user.visible_message("[user] has connected [I] to [parent].", "You connect [I] to [parent].") + parent_atom.add_overlay(I.icon_state+"+o") qdel(I) -/datum/construction/unordered/mecha_chassis/spawn_result() - holder.icon = 'icons/mecha/mech_construction.dmi' - holder.density = TRUE - holder.cut_overlays() - - var/obj/item/mecha_parts/chassis/chassis = holder - chassis.construct = new result(holder) - qdel(src) +/datum/component/construction/unordered/mecha_chassis/spawn_result() + var/atom/parent_atom = parent + parent_atom.icon = 'icons/mecha/mech_construction.dmi' + parent_atom.density = TRUE + parent_atom.cut_overlays() + ..() - -/datum/construction/unordered/mecha_chassis/ripley - result = /datum/construction/mecha/ripley +/datum/component/construction/unordered/mecha_chassis/ripley + result = /datum/component/construction/mecha/ripley steps = list( /obj/item/mecha_parts/part/ripley_torso, /obj/item/mecha_parts/part/ripley_left_arm, @@ -97,7 +52,7 @@ /obj/item/mecha_parts/part/ripley_right_leg ) -/datum/construction/mecha/ripley +/datum/component/construction/mecha/ripley result = /obj/mecha/working/ripley base_icon = "ripley" steps = list( @@ -219,92 +174,92 @@ ), ) -/datum/construction/mecha/ripley/custom_action(obj/item/I, mob/living/user, diff) +/datum/component/construction/mecha/ripley/custom_action(obj/item/I, mob/living/user, diff) if(!..()) return FALSE switch(index) if(1) - user.visible_message("[user] connects [holder] hydraulic systems", "You connect [holder] hydraulic systems.") + user.visible_message("[user] connects [parent] hydraulic systems", "You connect [parent] hydraulic systems.") if(2) if(diff==FORWARD) - user.visible_message("[user] activates [holder] hydraulic systems.", "You activate [holder] hydraulic systems.") + user.visible_message("[user] activates [parent] hydraulic systems.", "You activate [parent] hydraulic systems.") else - user.visible_message("[user] disconnects [holder] hydraulic systems", "You disconnect [holder] hydraulic systems.") + user.visible_message("[user] disconnects [parent] hydraulic systems", "You disconnect [parent] hydraulic systems.") if(3) if(diff==FORWARD) - user.visible_message("[user] adds the wiring to [holder].", "You add the wiring to [holder].") + user.visible_message("[user] adds the wiring to [parent].", "You add the wiring to [parent].") else - user.visible_message("[user] deactivates [holder] hydraulic systems.", "You deactivate [holder] hydraulic systems.") + user.visible_message("[user] deactivates [parent] hydraulic systems.", "You deactivate [parent] hydraulic systems.") if(4) if(diff==FORWARD) - user.visible_message("[user] adjusts the wiring of [holder].", "You adjust the wiring of [holder].") + user.visible_message("[user] adjusts the wiring of [parent].", "You adjust the wiring of [parent].") else - user.visible_message("[user] removes the wiring from [holder].", "You remove the wiring from [holder].") + user.visible_message("[user] removes the wiring from [parent].", "You remove the wiring from [parent].") if(5) if(diff==FORWARD) - user.visible_message("[user] installs the central control module into [holder].", "You install the central computer mainboard into [holder].") + user.visible_message("[user] installs the central control module into [parent].", "You install the central computer mainboard into [parent].") else - user.visible_message("[user] disconnects the wiring of [holder].", "You disconnect the wiring of [holder].") + user.visible_message("[user] disconnects the wiring of [parent].", "You disconnect the wiring of [parent].") if(6) if(diff==FORWARD) user.visible_message("[user] secures the mainboard.", "You secure the mainboard.") else - user.visible_message("[user] removes the central control module from [holder].", "You remove the central computer mainboard from [holder].") + user.visible_message("[user] removes the central control module from [parent].", "You remove the central computer mainboard from [parent].") if(7) if(diff==FORWARD) - user.visible_message("[user] installs the peripherals control module into [holder].", "You install the peripherals control module into [holder].") + user.visible_message("[user] installs the peripherals control module into [parent].", "You install the peripherals control module into [parent].") else user.visible_message("[user] unfastens the mainboard.", "You unfasten the mainboard.") if(8) if(diff==FORWARD) user.visible_message("[user] secures the peripherals control module.", "You secure the peripherals control module.") else - user.visible_message("[user] removes the peripherals control module from [holder].", "You remove the peripherals control module from [holder].") + user.visible_message("[user] removes the peripherals control module from [parent].", "You remove the peripherals control module from [parent].") if(9) if(diff==FORWARD) - user.visible_message("[user] installs the power cell into [holder].", "You install the power cell into [holder].") + user.visible_message("[user] installs the power cell into [parent].", "You install the power cell into [parent].") else user.visible_message("[user] unfastens the peripherals control module.", "You unfasten the peripherals control module.") if(10) if(diff==FORWARD) user.visible_message("[user] secures the power cell.", "You secure the power cell.") else - user.visible_message("[user] prys the power cell from [holder].", "You pry the power cell from [holder].") + user.visible_message("[user] prys the power cell from [parent].", "You pry the power cell from [parent].") if(11) if(diff==FORWARD) - user.visible_message("[user] installs the internal armor layer to [holder].", "You install the internal armor layer to [holder].") + user.visible_message("[user] installs the internal armor layer to [parent].", "You install the internal armor layer to [parent].") else user.visible_message("[user] unfastens the power cell.", "You unfasten the power cell.") if(12) if(diff==FORWARD) user.visible_message("[user] secures the internal armor layer.", "You secure the internal armor layer.") else - user.visible_message("[user] pries internal armor layer from [holder].", "You pry internal armor layer from [holder].") + user.visible_message("[user] pries internal armor layer from [parent].", "You pry internal armor layer from [parent].") if(13) if(diff==FORWARD) - user.visible_message("[user] welds the internal armor layer to [holder].", "You weld the internal armor layer to [holder].") + user.visible_message("[user] welds the internal armor layer to [parent].", "You weld the internal armor layer to [parent].") else user.visible_message("[user] unfastens the internal armor layer.", "You unfasten the internal armor layer.") if(14) if(diff==FORWARD) - user.visible_message("[user] installs the external reinforced armor layer to [holder].", "You install the external reinforced armor layer to [holder].") + user.visible_message("[user] installs the external reinforced armor layer to [parent].", "You install the external reinforced armor layer to [parent].") else - user.visible_message("[user] cuts the internal armor layer from [holder].", "You cut the internal armor layer from [holder].") + user.visible_message("[user] cuts the internal armor layer from [parent].", "You cut the internal armor layer from [parent].") if(15) if(diff==FORWARD) user.visible_message("[user] secures the external armor layer.", "You secure the external reinforced armor layer.") else - user.visible_message("[user] pries external armor layer from [holder].", "You pry external armor layer from [holder].") + user.visible_message("[user] pries external armor layer from [parent].", "You pry external armor layer from [parent].") if(16) if(diff==FORWARD) - user.visible_message("[user] welds the external armor layer to [holder].", "You weld the external armor layer to [holder].") + user.visible_message("[user] welds the external armor layer to [parent].", "You weld the external armor layer to [parent].") else user.visible_message("[user] unfastens the external armor layer.", "You unfasten the external armor layer.") return TRUE -/datum/construction/unordered/mecha_chassis/gygax - result = /datum/construction/mecha/gygax +/datum/component/construction/unordered/mecha_chassis/gygax + result = /datum/component/construction/mecha/gygax steps = list( /obj/item/mecha_parts/part/gygax_torso, /obj/item/mecha_parts/part/gygax_left_arm, @@ -314,7 +269,7 @@ /obj/item/mecha_parts/part/gygax_head ) -/datum/construction/mecha/gygax +/datum/component/construction/mecha/gygax result = /obj/mecha/combat/gygax base_icon = "gygax" steps = list( @@ -481,125 +436,125 @@ ) -/datum/construction/mecha/gygax/action(atom/used_atom,mob/user) +/datum/component/construction/mecha/gygax/action(atom/used_atom,mob/user) return check_step(used_atom,user) -/datum/construction/mecha/gygax/custom_action(obj/item/I, mob/living/user, diff) +/datum/component/construction/mecha/gygax/custom_action(obj/item/I, mob/living/user, diff) if(!..()) return FALSE switch(index) if(1) - user.visible_message("[user] connects [holder] hydraulic systems", "You connect [holder] hydraulic systems.") + user.visible_message("[user] connects [parent] hydraulic systems", "You connect [parent] hydraulic systems.") if(2) if(diff==FORWARD) - user.visible_message("[user] activates [holder] hydraulic systems.", "You activate [holder] hydraulic systems.") + user.visible_message("[user] activates [parent] hydraulic systems.", "You activate [parent] hydraulic systems.") else - user.visible_message("[user] disconnects [holder] hydraulic systems", "You disconnect [holder] hydraulic systems.") + user.visible_message("[user] disconnects [parent] hydraulic systems", "You disconnect [parent] hydraulic systems.") if(3) if(diff==FORWARD) - user.visible_message("[user] adds the wiring to [holder].", "You add the wiring to [holder].") + user.visible_message("[user] adds the wiring to [parent].", "You add the wiring to [parent].") else - user.visible_message("[user] deactivates [holder] hydraulic systems.", "You deactivate [holder] hydraulic systems.") + user.visible_message("[user] deactivates [parent] hydraulic systems.", "You deactivate [parent] hydraulic systems.") if(4) if(diff==FORWARD) - user.visible_message("[user] adjusts the wiring of [holder].", "You adjust the wiring of [holder].") + user.visible_message("[user] adjusts the wiring of [parent].", "You adjust the wiring of [parent].") else - user.visible_message("[user] removes the wiring from [holder].", "You remove the wiring from [holder].") + user.visible_message("[user] removes the wiring from [parent].", "You remove the wiring from [parent].") if(5) if(diff==FORWARD) - user.visible_message("[user] installs the central control module into [holder].", "You install the central computer mainboard into [holder].") + user.visible_message("[user] installs the central control module into [parent].", "You install the central computer mainboard into [parent].") else - user.visible_message("[user] disconnects the wiring of [holder].", "You disconnect the wiring of [holder].") + user.visible_message("[user] disconnects the wiring of [parent].", "You disconnect the wiring of [parent].") if(6) if(diff==FORWARD) user.visible_message("[user] secures the mainboard.", "You secure the mainboard.") else - user.visible_message("[user] removes the central control module from [holder].", "You remove the central computer mainboard from [holder].") + user.visible_message("[user] removes the central control module from [parent].", "You remove the central computer mainboard from [parent].") if(7) if(diff==FORWARD) - user.visible_message("[user] installs the peripherals control module into [holder].", "You install the peripherals control module into [holder].") + user.visible_message("[user] installs the peripherals control module into [parent].", "You install the peripherals control module into [parent].") else user.visible_message("[user] unfastens the mainboard.", "You unfasten the mainboard.") if(8) if(diff==FORWARD) user.visible_message("[user] secures the peripherals control module.", "You secure the peripherals control module.") else - user.visible_message("[user] removes the peripherals control module from [holder].", "You remove the peripherals control module from [holder].") + user.visible_message("[user] removes the peripherals control module from [parent].", "You remove the peripherals control module from [parent].") if(9) if(diff==FORWARD) - user.visible_message("[user] installs the weapon control module into [holder].", "You install the weapon control module into [holder].") + user.visible_message("[user] installs the weapon control module into [parent].", "You install the weapon control module into [parent].") else user.visible_message("[user] unfastens the peripherals control module.", "You unfasten the peripherals control module.") if(10) if(diff==FORWARD) user.visible_message("[user] secures the weapon control module.", "You secure the weapon control module.") else - user.visible_message("[user] removes the weapon control module from [holder].", "You remove the weapon control module from [holder].") + user.visible_message("[user] removes the weapon control module from [parent].", "You remove the weapon control module from [parent].") if(11) if(diff==FORWARD) - user.visible_message("[user] installs scanner module to [holder].", "You install scanner module to [holder].") + user.visible_message("[user] installs scanner module to [parent].", "You install scanner module to [parent].") else user.visible_message("[user] unfastens the weapon control module.", "You unfasten the weapon control module.") if(12) if(diff==FORWARD) user.visible_message("[user] secures the advanced scanner module.", "You secure the scanner module.") else - user.visible_message("[user] removes the advanced scanner module from [holder].", "You remove the scanner module from [holder].") + user.visible_message("[user] removes the advanced scanner module from [parent].", "You remove the scanner module from [parent].") if(13) if(diff==FORWARD) - user.visible_message("[user] installs capacitor to [holder].", "You install capacitor to [holder].") + user.visible_message("[user] installs capacitor to [parent].", "You install capacitor to [parent].") else user.visible_message("[user] unfastens the scanner module.", "You unfasten the scanner module.") if(14) if(diff==FORWARD) user.visible_message("[user] secures the capacitor.", "You secure the capacitor.") else - user.visible_message("[user] removes the capacitor from [holder].", "You remove the capacitor from [holder].") + user.visible_message("[user] removes the capacitor from [parent].", "You remove the capacitor from [parent].") if(15) if(diff==FORWARD) - user.visible_message("[user] installs the power cell into [holder].", "You install the power cell into [holder].") + user.visible_message("[user] installs the power cell into [parent].", "You install the power cell into [parent].") else user.visible_message("[user] unfastens the capacitor.", "You unfasten the capacitor.") if(16) if(diff==FORWARD) user.visible_message("[user] secures the power cell.", "You secure the power cell.") else - user.visible_message("[user] prys the power cell from [holder].", "You pry the power cell from [holder].") + user.visible_message("[user] prys the power cell from [parent].", "You pry the power cell from [parent].") if(17) if(diff==FORWARD) - user.visible_message("[user] installs the internal armor layer to [holder].", "You install the internal armor layer to [holder].") + user.visible_message("[user] installs the internal armor layer to [parent].", "You install the internal armor layer to [parent].") else user.visible_message("[user] unfastens the power cell.", "You unfasten the power cell.") if(18) if(diff==FORWARD) user.visible_message("[user] secures the internal armor layer.", "You secure the internal armor layer.") else - user.visible_message("[user] pries internal armor layer from [holder].", "You pry internal armor layer from [holder].") + user.visible_message("[user] pries internal armor layer from [parent].", "You pry internal armor layer from [parent].") if(19) if(diff==FORWARD) - user.visible_message("[user] welds the internal armor layer to [holder].", "You weld the internal armor layer to [holder].") + user.visible_message("[user] welds the internal armor layer to [parent].", "You weld the internal armor layer to [parent].") else user.visible_message("[user] unfastens the internal armor layer.", "You unfasten the internal armor layer.") if(20) if(diff==FORWARD) - user.visible_message("[user] installs Gygax Armor Plates to [holder].", "You install Gygax Armor Plates to [holder].") + user.visible_message("[user] installs Gygax Armor Plates to [parent].", "You install Gygax Armor Plates to [parent].") else - user.visible_message("[user] cuts the internal armor layer from [holder].", "You cut the internal armor layer from [holder].") + user.visible_message("[user] cuts the internal armor layer from [parent].", "You cut the internal armor layer from [parent].") if(21) if(diff==FORWARD) user.visible_message("[user] secures Gygax Armor Plates.", "You secure Gygax Armor Plates.") else - user.visible_message("[user] pries Gygax Armor Plates from [holder].", "You pry Gygax Armor Plates from [holder].") + user.visible_message("[user] pries Gygax Armor Plates from [parent].", "You pry Gygax Armor Plates from [parent].") if(22) if(diff==FORWARD) - user.visible_message("[user] welds Gygax Armor Plates to [holder].", "You weld Gygax Armor Plates to [holder].") + user.visible_message("[user] welds Gygax Armor Plates to [parent].", "You weld Gygax Armor Plates to [parent].") else user.visible_message("[user] unfastens Gygax Armor Plates.", "You unfasten Gygax Armor Plates.") return TRUE -/datum/construction/unordered/mecha_chassis/firefighter - result = /datum/construction/mecha/firefighter +/datum/component/construction/unordered/mecha_chassis/firefighter + result = /datum/component/construction/mecha/firefighter steps = list( /obj/item/mecha_parts/part/ripley_torso, /obj/item/mecha_parts/part/ripley_left_arm, @@ -609,7 +564,7 @@ /obj/item/clothing/suit/fire ) -/datum/construction/mecha/firefighter +/datum/component/construction/mecha/firefighter result = /obj/mecha/working/ripley/firefighter base_icon = "fireripley" steps = list( @@ -739,98 +694,98 @@ ), ) -/datum/construction/mecha/firefighter/custom_action(obj/item/I, mob/living/user, diff) +/datum/component/construction/mecha/firefighter/custom_action(obj/item/I, mob/living/user, diff) if(!..()) return FALSE //TODO: better messages. switch(index) if(1) - user.visible_message("[user] connects [holder] hydraulic systems", "You connect [holder] hydraulic systems.") + user.visible_message("[user] connects [parent] hydraulic systems", "You connect [parent] hydraulic systems.") if(2) if(diff==FORWARD) - user.visible_message("[user] activates [holder] hydraulic systems.", "You activate [holder] hydraulic systems.") + user.visible_message("[user] activates [parent] hydraulic systems.", "You activate [parent] hydraulic systems.") else - user.visible_message("[user] disconnects [holder] hydraulic systems", "You disconnect [holder] hydraulic systems.") + user.visible_message("[user] disconnects [parent] hydraulic systems", "You disconnect [parent] hydraulic systems.") if(3) if(diff==FORWARD) - user.visible_message("[user] adds the wiring to [holder].", "You add the wiring to [holder].") + user.visible_message("[user] adds the wiring to [parent].", "You add the wiring to [parent].") else - user.visible_message("[user] deactivates [holder] hydraulic systems.", "You deactivate [holder] hydraulic systems.") + user.visible_message("[user] deactivates [parent] hydraulic systems.", "You deactivate [parent] hydraulic systems.") if(4) if(diff==FORWARD) - user.visible_message("[user] adjusts the wiring of [holder].", "You adjust the wiring of [holder].") + user.visible_message("[user] adjusts the wiring of [parent].", "You adjust the wiring of [parent].") else - user.visible_message("[user] removes the wiring from [holder].", "You remove the wiring from [holder].") + user.visible_message("[user] removes the wiring from [parent].", "You remove the wiring from [parent].") if(5) if(diff==FORWARD) - user.visible_message("[user] installs the central control module into [holder].", "You install the central computer mainboard into [holder].") + user.visible_message("[user] installs the central control module into [parent].", "You install the central computer mainboard into [parent].") else - user.visible_message("[user] disconnects the wiring of [holder].", "You disconnect the wiring of [holder].") + user.visible_message("[user] disconnects the wiring of [parent].", "You disconnect the wiring of [parent].") if(6) if(diff==FORWARD) user.visible_message("[user] secures the mainboard.", "You secure the mainboard.") else - user.visible_message("[user] removes the central control module from [holder].", "You remove the central computer mainboard from [holder].") + user.visible_message("[user] removes the central control module from [parent].", "You remove the central computer mainboard from [parent].") if(7) if(diff==FORWARD) - user.visible_message("[user] installs the peripherals control module into [holder].", "You install the peripherals control module into [holder].") + user.visible_message("[user] installs the peripherals control module into [parent].", "You install the peripherals control module into [parent].") else user.visible_message("[user] unfastens the mainboard.", "You unfasten the mainboard.") if(8) if(diff==FORWARD) user.visible_message("[user] secures the peripherals control module.", "You secure the peripherals control module.") else - user.visible_message("[user] removes the peripherals control module from [holder].", "You remove the peripherals control module from [holder].") + user.visible_message("[user] removes the peripherals control module from [parent].", "You remove the peripherals control module from [parent].") if(9) if(diff==FORWARD) - user.visible_message("[user] installs the power cell into [holder].", "You install the power cell into [holder].") + user.visible_message("[user] installs the power cell into [parent].", "You install the power cell into [parent].") else user.visible_message("[user] unfastens the peripherals control module.", "You unfasten the peripherals control module.") if(10) if(diff==FORWARD) user.visible_message("[user] secures the power cell.", "You secure the power cell.") else - user.visible_message("[user] prys the power cell from [holder].", "You pry the power cell from [holder].") + user.visible_message("[user] prys the power cell from [parent].", "You pry the power cell from [parent].") if(11) if(diff==FORWARD) - user.visible_message("[user] installs the internal armor layer to [holder].", "You install the internal armor layer to [holder].") + user.visible_message("[user] installs the internal armor layer to [parent].", "You install the internal armor layer to [parent].") else user.visible_message("[user] unfastens the power cell.", "You unfasten the power cell.") if(12) if(diff==FORWARD) user.visible_message("[user] secures the internal armor layer.", "You secure the internal armor layer.") else - user.visible_message("[user] pries internal armor layer from [holder].", "You pry internal armor layer from [holder].") + user.visible_message("[user] pries internal armor layer from [parent].", "You pry internal armor layer from [parent].") if(13) if(diff==FORWARD) - user.visible_message("[user] welds the internal armor layer to [holder].", "You weld the internal armor layer to [holder].") + user.visible_message("[user] welds the internal armor layer to [parent].", "You weld the internal armor layer to [parent].") else user.visible_message("[user] unfastens the internal armor layer.", "You unfasten the internal armor layer.") if(14) if(diff==FORWARD) - user.visible_message("[user] starts to install the external armor layer to [holder].", "You install the external armor layer to [holder].") + user.visible_message("[user] starts to install the external armor layer to [parent].", "You install the external armor layer to [parent].") else - user.visible_message("[user] cuts the internal armor layer from [holder].", "You cut the internal armor layer from [holder].") + user.visible_message("[user] cuts the internal armor layer from [parent].", "You cut the internal armor layer from [parent].") if(15) if(diff==FORWARD) - user.visible_message("[user] installs the external reinforced armor layer to [holder].", "You install the external reinforced armor layer to [holder].") + user.visible_message("[user] installs the external reinforced armor layer to [parent].", "You install the external reinforced armor layer to [parent].") else - user.visible_message("[user] removes the external armor from [holder].", "You remove the external armor from [holder].") + user.visible_message("[user] removes the external armor from [parent].", "You remove the external armor from [parent].") if(16) if(diff==FORWARD) user.visible_message("[user] secures the external armor layer.", "You secure the external reinforced armor layer.") else - user.visible_message("[user] pries external armor layer from [holder].", "You pry external armor layer from [holder].") + user.visible_message("[user] pries external armor layer from [parent].", "You pry external armor layer from [parent].") if(17) if(diff==FORWARD) - user.visible_message("[user] welds the external armor layer to [holder].", "You weld the external armor layer to [holder].") + user.visible_message("[user] welds the external armor layer to [parent].", "You weld the external armor layer to [parent].") else user.visible_message("[user] unfastens the external armor layer.", "You unfasten the external armor layer.") return TRUE -/datum/construction/unordered/mecha_chassis/honker - result = /datum/construction/mecha/honker +/datum/component/construction/unordered/mecha_chassis/honker + result = /datum/component/construction/mecha/honker steps = list( /obj/item/mecha_parts/part/honker_torso, /obj/item/mecha_parts/part/honker_left_arm, @@ -840,7 +795,7 @@ /obj/item/mecha_parts/part/honker_head ) -/datum/construction/mecha/honker +/datum/component/construction/mecha/honker result = /obj/mecha/combat/honker steps = list( //1 @@ -916,38 +871,39 @@ ) // HONK doesn't have any construction step icons, so we just set an icon once. -/datum/construction/mecha/honker/update_holder(step_index) +/datum/component/construction/mecha/honker/update_parent(step_index) if(step_index == 1) - holder.icon = 'icons/mecha/mech_construct.dmi' - holder.icon_state = "honker_chassis" + var/atom/parent_atom = parent + parent_atom.icon = 'icons/mecha/mech_construct.dmi' + parent_atom.icon_state = "honker_chassis" ..() -/datum/construction/mecha/honker/custom_action(obj/item/I, mob/living/user, diff) +/datum/component/construction/mecha/honker/custom_action(obj/item/I, mob/living/user, diff) if(!..()) return FALSE if(istype(I, /obj/item/bikehorn)) - playsound(holder, 'sound/items/bikehorn.ogg', 50, 1) + playsound(parent, 'sound/items/bikehorn.ogg', 50, 1) user.visible_message("HONK!") //TODO: better messages. switch(index) if(2) - user.visible_message("[user] installs the central control module into [holder].", "You install the central control module into [holder].") + user.visible_message("[user] installs the central control module into [parent].", "You install the central control module into [parent].") if(4) - user.visible_message("[user] installs the peripherals control module into [holder].", "You install the peripherals control module into [holder].") + user.visible_message("[user] installs the peripherals control module into [parent].", "You install the peripherals control module into [parent].") if(6) - user.visible_message("[user] installs the weapon control module into [holder].", "You install the weapon control module into [holder].") + user.visible_message("[user] installs the weapon control module into [parent].", "You install the weapon control module into [parent].") if(8) - user.visible_message("[user] installs the power cell into [holder].", "You install the power cell into [holder].") + user.visible_message("[user] installs the power cell into [parent].", "You install the power cell into [parent].") if(10) - user.visible_message("[user] puts clown wig and mask on [holder].", "You put clown wig and mask on [holder].") + user.visible_message("[user] puts clown wig and mask on [parent].", "You put clown wig and mask on [parent].") if(12) - user.visible_message("[user] puts clown boots on [holder].", "You put clown boots on [holder].") + user.visible_message("[user] puts clown boots on [parent].", "You put clown boots on [parent].") return TRUE -/datum/construction/unordered/mecha_chassis/durand - result = /datum/construction/mecha/durand +/datum/component/construction/unordered/mecha_chassis/durand + result = /datum/component/construction/mecha/durand steps = list( /obj/item/mecha_parts/part/durand_torso, /obj/item/mecha_parts/part/durand_left_arm, @@ -957,7 +913,7 @@ /obj/item/mecha_parts/part/durand_head ) -/datum/construction/mecha/durand +/datum/component/construction/mecha/durand result = /obj/mecha/combat/durand base_icon = "durand" steps = list( @@ -1125,125 +1081,125 @@ ) -/datum/construction/mecha/durand/custom_action(obj/item/I, mob/living/user, diff) +/datum/component/construction/mecha/durand/custom_action(obj/item/I, mob/living/user, diff) if(!..()) return FALSE //TODO: better messages. switch(index) if(1) - user.visible_message("[user] connects [holder] hydraulic systems", "You connect [holder] hydraulic systems.") + user.visible_message("[user] connects [parent] hydraulic systems", "You connect [parent] hydraulic systems.") if(2) if(diff==FORWARD) - user.visible_message("[user] activates [holder] hydraulic systems.", "You activate [holder] hydraulic systems.") + user.visible_message("[user] activates [parent] hydraulic systems.", "You activate [parent] hydraulic systems.") else - user.visible_message("[user] disconnects [holder] hydraulic systems", "You disconnect [holder] hydraulic systems.") + user.visible_message("[user] disconnects [parent] hydraulic systems", "You disconnect [parent] hydraulic systems.") if(3) if(diff==FORWARD) - user.visible_message("[user] adds the wiring to [holder].", "You add the wiring to [holder].") + user.visible_message("[user] adds the wiring to [parent].", "You add the wiring to [parent].") else - user.visible_message("[user] deactivates [holder] hydraulic systems.", "You deactivate [holder] hydraulic systems.") + user.visible_message("[user] deactivates [parent] hydraulic systems.", "You deactivate [parent] hydraulic systems.") if(4) if(diff==FORWARD) - user.visible_message("[user] adjusts the wiring of [holder].", "You adjust the wiring of [holder].") + user.visible_message("[user] adjusts the wiring of [parent].", "You adjust the wiring of [parent].") else - user.visible_message("[user] removes the wiring from [holder].", "You remove the wiring from [holder].") + user.visible_message("[user] removes the wiring from [parent].", "You remove the wiring from [parent].") if(5) if(diff==FORWARD) - user.visible_message("[user] installs the central control module into [holder].", "You install the central computer mainboard into [holder].") + user.visible_message("[user] installs the central control module into [parent].", "You install the central computer mainboard into [parent].") else - user.visible_message("[user] disconnects the wiring of [holder].", "You disconnect the wiring of [holder].") + user.visible_message("[user] disconnects the wiring of [parent].", "You disconnect the wiring of [parent].") if(6) if(diff==FORWARD) user.visible_message("[user] secures the mainboard.", "You secure the mainboard.") else - user.visible_message("[user] removes the central control module from [holder].", "You remove the central computer mainboard from [holder].") + user.visible_message("[user] removes the central control module from [parent].", "You remove the central computer mainboard from [parent].") if(7) if(diff==FORWARD) - user.visible_message("[user] installs the peripherals control module into [holder].", "You install the peripherals control module into [holder].") + user.visible_message("[user] installs the peripherals control module into [parent].", "You install the peripherals control module into [parent].") else user.visible_message("[user] unfastens the mainboard.", "You unfasten the mainboard.") if(8) if(diff==FORWARD) user.visible_message("[user] secures the peripherals control module.", "You secure the peripherals control module.") else - user.visible_message("[user] removes the peripherals control module from [holder].", "You remove the peripherals control module from [holder].") + user.visible_message("[user] removes the peripherals control module from [parent].", "You remove the peripherals control module from [parent].") if(9) if(diff==FORWARD) - user.visible_message("[user] installs the weapon control module into [holder].", "You install the weapon control module into [holder].") + user.visible_message("[user] installs the weapon control module into [parent].", "You install the weapon control module into [parent].") else user.visible_message("[user] unfastens the peripherals control module.", "You unfasten the peripherals control module.") if(10) if(diff==FORWARD) user.visible_message("[user] secures the weapon control module.", "You secure the weapon control module.") else - user.visible_message("[user] removes the weapon control module from [holder].", "You remove the weapon control module from [holder].") + user.visible_message("[user] removes the weapon control module from [parent].", "You remove the weapon control module from [parent].") if(11) if(diff==FORWARD) - user.visible_message("[user] installs scanner module to [holder].", "You install phasic scanner module to [holder].") + user.visible_message("[user] installs scanner module to [parent].", "You install phasic scanner module to [parent].") else user.visible_message("[user] unfastens the weapon control module.", "You unfasten the weapon control module.") if(12) if(diff==FORWARD) user.visible_message("[user] secures the scanner module.", "You secure the scanner module.") else - user.visible_message("[user] removes the scanner module from [holder].", "You remove the scanner module from [holder].") + user.visible_message("[user] removes the scanner module from [parent].", "You remove the scanner module from [parent].") if(13) if(diff==FORWARD) - user.visible_message("[user] installs capacitor to [holder].", "You install capacitor to [holder].") + user.visible_message("[user] installs capacitor to [parent].", "You install capacitor to [parent].") else user.visible_message("[user] unfastens the scanner module.", "You unfasten the scanner module.") if(14) if(diff==FORWARD) user.visible_message("[user] secures the capacitor.", "You secure the capacitor.") else - user.visible_message("[user] removes the super capacitor from [holder].", "You remove the capacitor from [holder].") + user.visible_message("[user] removes the super capacitor from [parent].", "You remove the capacitor from [parent].") if(15) if(diff==FORWARD) - user.visible_message("[user] installs the power cell into [holder].", "You install the power cell into [holder].") + user.visible_message("[user] installs the power cell into [parent].", "You install the power cell into [parent].") else user.visible_message("[user] unfastens the capacitor.", "You unfasten the capacitor.") if(16) if(diff==FORWARD) user.visible_message("[user] secures the power cell.", "You secure the power cell.") else - user.visible_message("[user] prys the power cell from [holder].", "You pry the power cell from [holder].") + user.visible_message("[user] prys the power cell from [parent].", "You pry the power cell from [parent].") if(17) if(diff==FORWARD) - user.visible_message("[user] installs the internal armor layer to [holder].", "You install the internal armor layer to [holder].") + user.visible_message("[user] installs the internal armor layer to [parent].", "You install the internal armor layer to [parent].") else user.visible_message("[user] unfastens the power cell.", "You unfasten the power cell.") if(18) if(diff==FORWARD) user.visible_message("[user] secures the internal armor layer.", "You secure the internal armor layer.") else - user.visible_message("[user] pries internal armor layer from [holder].", "You pry internal armor layer from [holder].") + user.visible_message("[user] pries internal armor layer from [parent].", "You pry internal armor layer from [parent].") if(19) if(diff==FORWARD) - user.visible_message("[user] welds the internal armor layer to [holder].", "You weld the internal armor layer to [holder].") + user.visible_message("[user] welds the internal armor layer to [parent].", "You weld the internal armor layer to [parent].") else user.visible_message("[user] unfastens the internal armor layer.", "You unfasten the internal armor layer.") if(20) if(diff==FORWARD) - user.visible_message("[user] installs Durand Armor Plates to [holder].", "You install Durand Armor Plates to [holder].") + user.visible_message("[user] installs Durand Armor Plates to [parent].", "You install Durand Armor Plates to [parent].") else - user.visible_message("[user] cuts the internal armor layer from [holder].", "You cut the internal armor layer from [holder].") + user.visible_message("[user] cuts the internal armor layer from [parent].", "You cut the internal armor layer from [parent].") if(21) if(diff==FORWARD) user.visible_message("[user] secures Durand Armor Plates.", "You secure Durand Armor Plates.") else - user.visible_message("[user] pries Durand Armor Plates from [holder].", "You pry Durand Armor Plates from [holder].") + user.visible_message("[user] pries Durand Armor Plates from [parent].", "You pry Durand Armor Plates from [parent].") if(22) if(diff==FORWARD) - user.visible_message("[user] welds Durand Armor Plates to [holder].", "You weld Durand Armor Plates to [holder].") + user.visible_message("[user] welds Durand Armor Plates to [parent].", "You weld Durand Armor Plates to [parent].") else user.visible_message("[user] unfastens Durand Armor Plates.", "You unfasten Durand Armor Plates.") return TRUE //PHAZON -/datum/construction/unordered/mecha_chassis/phazon - result = /datum/construction/mecha/phazon +/datum/component/construction/unordered/mecha_chassis/phazon + result = /datum/component/construction/mecha/phazon steps = list( /obj/item/mecha_parts/part/phazon_torso, /obj/item/mecha_parts/part/phazon_left_arm, @@ -1253,7 +1209,7 @@ /obj/item/mecha_parts/part/phazon_head ) -/datum/construction/mecha/phazon +/datum/component/construction/mecha/phazon result = /obj/mecha/combat/phazon base_icon = "phazon" steps = list( @@ -1461,144 +1417,144 @@ ) -/datum/construction/mecha/phazon/custom_action(obj/item/I, mob/living/user, diff) +/datum/component/construction/mecha/phazon/custom_action(obj/item/I, mob/living/user, diff) if(!..()) return FALSE //TODO: better messages. switch(index) if(1) - user.visible_message("[user] connects [holder] hydraulic systems", "You connect [holder] hydraulic systems.") + user.visible_message("[user] connects [parent] hydraulic systems", "You connect [parent] hydraulic systems.") if(2) if(diff==FORWARD) - user.visible_message("[user] activates [holder] hydraulic systems.", "You activate [holder] hydraulic systems.") + user.visible_message("[user] activates [parent] hydraulic systems.", "You activate [parent] hydraulic systems.") else - user.visible_message("[user] disconnects [holder] hydraulic systems", "You disconnect [holder] hydraulic systems.") + user.visible_message("[user] disconnects [parent] hydraulic systems", "You disconnect [parent] hydraulic systems.") if(3) if(diff==FORWARD) - user.visible_message("[user] adds the wiring to [holder].", "You add the wiring to [holder].") + user.visible_message("[user] adds the wiring to [parent].", "You add the wiring to [parent].") else - user.visible_message("[user] deactivates [holder] hydraulic systems.", "You deactivate [holder] hydraulic systems.") + user.visible_message("[user] deactivates [parent] hydraulic systems.", "You deactivate [parent] hydraulic systems.") if(4) if(diff==FORWARD) - user.visible_message("[user] adjusts the wiring of [holder].", "You adjust the wiring of [holder].") + user.visible_message("[user] adjusts the wiring of [parent].", "You adjust the wiring of [parent].") else - user.visible_message("[user] removes the wiring from [holder].", "You remove the wiring from [holder].") + user.visible_message("[user] removes the wiring from [parent].", "You remove the wiring from [parent].") if(5) if(diff==FORWARD) - user.visible_message("[user] installs the central control module into [holder].", "You install the central computer mainboard into [holder].") + user.visible_message("[user] installs the central control module into [parent].", "You install the central computer mainboard into [parent].") else - user.visible_message("[user] disconnects the wiring of [holder].", "You disconnect the wiring of [holder].") + user.visible_message("[user] disconnects the wiring of [parent].", "You disconnect the wiring of [parent].") if(6) if(diff==FORWARD) user.visible_message("[user] secures the mainboard.", "You secure the mainboard.") else - user.visible_message("[user] removes the central control module from [holder].", "You remove the central computer mainboard from [holder].") + user.visible_message("[user] removes the central control module from [parent].", "You remove the central computer mainboard from [parent].") if(7) if(diff==FORWARD) - user.visible_message("[user] installs the peripherals control module into [holder].", "You install the peripherals control module into [holder].") + user.visible_message("[user] installs the peripherals control module into [parent].", "You install the peripherals control module into [parent].") else user.visible_message("[user] unfastens the mainboard.", "You unfasten the mainboard.") if(8) if(diff==FORWARD) user.visible_message("[user] secures the peripherals control module.", "You secure the peripherals control module.") else - user.visible_message("[user] removes the peripherals control module from [holder].", "You remove the peripherals control module from [holder].") + user.visible_message("[user] removes the peripherals control module from [parent].", "You remove the peripherals control module from [parent].") if(9) if(diff==FORWARD) - user.visible_message("[user] installs the weapon control module into [holder].", "You install the weapon control module into [holder].") + user.visible_message("[user] installs the weapon control module into [parent].", "You install the weapon control module into [parent].") else user.visible_message("[user] unfastens the peripherals control module.", "You unfasten the peripherals control module.") if(10) if(diff==FORWARD) user.visible_message("[user] secures the weapon control module.", "You secure the weapon control module.") else - user.visible_message("[user] removes the weapon control module from [holder].", "You remove the weapon control module from [holder].") + user.visible_message("[user] removes the weapon control module from [parent].", "You remove the weapon control module from [parent].") if(11) if(diff==FORWARD) - user.visible_message("[user] installs phasic scanner module to [holder].", "You install scanner module to [holder].") + user.visible_message("[user] installs phasic scanner module to [parent].", "You install scanner module to [parent].") else user.visible_message("[user] unfastens the weapon control module.", "You unfasten the weapon control module.") if(12) if(diff==FORWARD) user.visible_message("[user] secures the phasic scanner module.", "You secure the scanner module.") else - user.visible_message("[user] removes the phasic scanner module from [holder].", "You remove the scanner module from [holder].") + user.visible_message("[user] removes the phasic scanner module from [parent].", "You remove the scanner module from [parent].") if(13) if(diff==FORWARD) - user.visible_message("[user] installs super capacitor to [holder].", "You install capacitor to [holder].") + user.visible_message("[user] installs super capacitor to [parent].", "You install capacitor to [parent].") else user.visible_message("[user] unfastens the phasic scanner module.", "You unfasten the scanner module.") if(14) if(diff==FORWARD) user.visible_message("[user] secures the super capacitor.", "You secure the capacitor.") else - user.visible_message("[user] removes the super capacitor from [holder].", "You remove the capacitor from [holder].") + user.visible_message("[user] removes the super capacitor from [parent].", "You remove the capacitor from [parent].") if(15) if(diff==FORWARD) user.visible_message("[user] installs the bluespace crystal.", "You install the bluespace crystal.") else - user.visible_message("[user] unsecures the super capacitor from [holder].", "You unsecure the capacitor from [holder].") + user.visible_message("[user] unsecures the super capacitor from [parent].", "You unsecure the capacitor from [parent].") if(16) if(diff==FORWARD) user.visible_message("[user] connects the bluespace crystal.", "You connect the bluespace crystal.") else - user.visible_message("[user] removes the bluespace crystal from [holder].", "You remove the bluespace crystal from [holder].") + user.visible_message("[user] removes the bluespace crystal from [parent].", "You remove the bluespace crystal from [parent].") if(17) if(diff==FORWARD) user.visible_message("[user] engages the bluespace crystal.", "You engage the bluespace crystal.") else - user.visible_message("[user] disconnects the bluespace crystal from [holder].", "You disconnect the bluespace crystal from [holder].") + user.visible_message("[user] disconnects the bluespace crystal from [parent].", "You disconnect the bluespace crystal from [parent].") if(18) if(diff==FORWARD) - user.visible_message("[user] installs the power cell into [holder].", "You install the power cell into [holder].") + user.visible_message("[user] installs the power cell into [parent].", "You install the power cell into [parent].") else user.visible_message("[user] disengages the bluespace crystal.", "You disengage the bluespace crystal.") if(19) if(diff==FORWARD) user.visible_message("[user] secures the power cell.", "You secure the power cell.") else - user.visible_message("[user] prys the power cell from [holder].", "You pry the power cell from [holder].") + user.visible_message("[user] prys the power cell from [parent].", "You pry the power cell from [parent].") if(20) if(diff==FORWARD) - user.visible_message("[user] installs the phase armor layer to [holder].", "You install the phase armor layer to [holder].") + user.visible_message("[user] installs the phase armor layer to [parent].", "You install the phase armor layer to [parent].") else user.visible_message("[user] unfastens the power cell.", "You unfasten the power cell.") if(21) if(diff==FORWARD) user.visible_message("[user] secures the phase armor layer.", "You secure the phase armor layer.") else - user.visible_message("[user] pries the phase armor layer from [holder].", "You pry the phase armor layer from [holder].") + user.visible_message("[user] pries the phase armor layer from [parent].", "You pry the phase armor layer from [parent].") if(22) if(diff==FORWARD) - user.visible_message("[user] welds the phase armor layer to [holder].", "You weld the phase armor layer to [holder].") + user.visible_message("[user] welds the phase armor layer to [parent].", "You weld the phase armor layer to [parent].") else user.visible_message("[user] unfastens the phase armor layer.", "You unfasten the phase armor layer.") if(23) if(diff==FORWARD) - user.visible_message("[user] installs Phazon Armor Plates to [holder].", "You install Phazon Armor Plates to [holder].") + user.visible_message("[user] installs Phazon Armor Plates to [parent].", "You install Phazon Armor Plates to [parent].") else - user.visible_message("[user] cuts phase armor layer from [holder].", "You cut the phase armor layer from [holder].") + user.visible_message("[user] cuts phase armor layer from [parent].", "You cut the phase armor layer from [parent].") if(24) if(diff==FORWARD) user.visible_message("[user] secures Phazon Armor Plates.", "You secure Phazon Armor Plates.") else - user.visible_message("[user] pries Phazon Armor Plates from [holder].", "You pry Phazon Armor Plates from [holder].") + user.visible_message("[user] pries Phazon Armor Plates from [parent].", "You pry Phazon Armor Plates from [parent].") if(25) if(diff==FORWARD) - user.visible_message("[user] welds Phazon Armor Plates to [holder].", "You weld Phazon Armor Plates to [holder].") + user.visible_message("[user] welds Phazon Armor Plates to [parent].", "You weld Phazon Armor Plates to [parent].") else user.visible_message("[user] unfastens Phazon Armor Plates.", "You unfasten Phazon Armor Plates.") if(26) if(diff==FORWARD) - user.visible_message("[user] carefully inserts the anomaly core into [holder] and secures it.", + user.visible_message("[user] carefully inserts the anomaly core into [parent] and secures it.", "You slowly place the anomaly core into its socket and close its chamber.") return TRUE //ODYSSEUS -/datum/construction/unordered/mecha_chassis/odysseus - result = /datum/construction/mecha/odysseus +/datum/component/construction/unordered/mecha_chassis/odysseus + result = /datum/component/construction/mecha/odysseus steps = list( /obj/item/mecha_parts/part/odysseus_torso, /obj/item/mecha_parts/part/odysseus_head, @@ -1608,7 +1564,7 @@ /obj/item/mecha_parts/part/odysseus_right_leg ) -/datum/construction/mecha/odysseus +/datum/component/construction/mecha/odysseus result = /obj/mecha/medical/odysseus base_icon = "odysseus" steps = list( @@ -1730,87 +1686,87 @@ ), ) -/datum/construction/mecha/odysseus/custom_action(obj/item/I, mob/living/user, diff) +/datum/component/construction/mecha/odysseus/custom_action(obj/item/I, mob/living/user, diff) if(!..()) return FALSE //TODO: better messages. switch(index) if(1) - user.visible_message("[user] connects [holder] hydraulic systems", "You connect [holder] hydraulic systems.") + user.visible_message("[user] connects [parent] hydraulic systems", "You connect [parent] hydraulic systems.") if(2) if(diff==FORWARD) - user.visible_message("[user] activates [holder] hydraulic systems.", "You activate [holder] hydraulic systems.") + user.visible_message("[user] activates [parent] hydraulic systems.", "You activate [parent] hydraulic systems.") else - user.visible_message("[user] disconnects [holder] hydraulic systems", "You disconnect [holder] hydraulic systems.") + user.visible_message("[user] disconnects [parent] hydraulic systems", "You disconnect [parent] hydraulic systems.") if(3) if(diff==FORWARD) - user.visible_message("[user] adds the wiring to [holder].", "You add the wiring to [holder].") + user.visible_message("[user] adds the wiring to [parent].", "You add the wiring to [parent].") else - user.visible_message("[user] deactivates [holder] hydraulic systems.", "You deactivate [holder] hydraulic systems.") + user.visible_message("[user] deactivates [parent] hydraulic systems.", "You deactivate [parent] hydraulic systems.") if(4) if(diff==FORWARD) - user.visible_message("[user] adjusts the wiring of [holder].", "You adjust the wiring of [holder].") + user.visible_message("[user] adjusts the wiring of [parent].", "You adjust the wiring of [parent].") else - user.visible_message("[user] removes the wiring from [holder].", "You remove the wiring from [holder].") + user.visible_message("[user] removes the wiring from [parent].", "You remove the wiring from [parent].") if(5) if(diff==FORWARD) - user.visible_message("[user] installs the central control module into [holder].", "You install the central computer mainboard into [holder].") + user.visible_message("[user] installs the central control module into [parent].", "You install the central computer mainboard into [parent].") else - user.visible_message("[user] disconnects the wiring of [holder].", "You disconnect the wiring of [holder].") + user.visible_message("[user] disconnects the wiring of [parent].", "You disconnect the wiring of [parent].") if(6) if(diff==FORWARD) user.visible_message("[user] secures the mainboard.", "You secure the mainboard.") else - user.visible_message("[user] removes the central control module from [holder].", "You remove the central computer mainboard from [holder].") + user.visible_message("[user] removes the central control module from [parent].", "You remove the central computer mainboard from [parent].") if(7) if(diff==FORWARD) - user.visible_message("[user] installs the peripherals control module into [holder].", "You install the peripherals control module into [holder].") + user.visible_message("[user] installs the peripherals control module into [parent].", "You install the peripherals control module into [parent].") else user.visible_message("[user] unfastens the mainboard.", "You unfasten the mainboard.") if(8) if(diff==FORWARD) user.visible_message("[user] secures the peripherals control module.", "You secure the peripherals control module.") else - user.visible_message("[user] removes the peripherals control module from [holder].", "You remove the peripherals control module from [holder].") + user.visible_message("[user] removes the peripherals control module from [parent].", "You remove the peripherals control module from [parent].") if(9) if(diff==FORWARD) - user.visible_message("[user] installs the power cell into [holder].", "You install the power cell into [holder].") + user.visible_message("[user] installs the power cell into [parent].", "You install the power cell into [parent].") else user.visible_message("[user] unfastens the peripherals control module.", "You unfasten the peripherals control module.") if(10) if(diff==FORWARD) user.visible_message("[user] secures the power cell.", "You secure the power cell.") else - user.visible_message("[user] prys the power cell from [holder].", "You pry the power cell from [holder].") + user.visible_message("[user] prys the power cell from [parent].", "You pry the power cell from [parent].") if(11) if(diff==FORWARD) - user.visible_message("[user] installs the internal armor layer to [holder].", "You install the internal armor layer to [holder].") + user.visible_message("[user] installs the internal armor layer to [parent].", "You install the internal armor layer to [parent].") else user.visible_message("[user] unfastens the power cell.", "You unfasten the power cell.") if(12) if(diff==FORWARD) user.visible_message("[user] secures the internal armor layer.", "You secure the internal armor layer.") else - user.visible_message("[user] pries internal armor layer from [holder].", "You pry internal armor layer from [holder].") + user.visible_message("[user] pries internal armor layer from [parent].", "You pry internal armor layer from [parent].") if(13) if(diff==FORWARD) - user.visible_message("[user] welds the internal armor layer to [holder].", "You weld the internal armor layer to [holder].") + user.visible_message("[user] welds the internal armor layer to [parent].", "You weld the internal armor layer to [parent].") else user.visible_message("[user] unfastens the internal armor layer.", "You unfasten the internal armor layer.") if(14) if(diff==FORWARD) - user.visible_message("[user] installs the external armor layer to [holder].", "You install the external reinforced armor layer to [holder].") + user.visible_message("[user] installs the external armor layer to [parent].", "You install the external reinforced armor layer to [parent].") else - user.visible_message("[user] cuts the internal armor layer from [holder].", "You cut the internal armor layer from [holder].") + user.visible_message("[user] cuts the internal armor layer from [parent].", "You cut the internal armor layer from [parent].") if(15) if(diff==FORWARD) user.visible_message("[user] secures the external armor layer.", "You secure the external reinforced armor layer.") else - user.visible_message("[user] pries the external armor layer from [holder].", "You pry the external armor layer from [holder].") + user.visible_message("[user] pries the external armor layer from [parent].", "You pry the external armor layer from [parent].") if(16) if(diff==FORWARD) - user.visible_message("[user] welds the external armor layer to [holder].", "You weld the external armor layer to [holder].") + user.visible_message("[user] welds the external armor layer to [parent].", "You weld the external armor layer to [parent].") else user.visible_message("[user] unfastens the external armor layer.", "You unfasten the external armor layer.") return TRUE diff --git a/code/game/mecha/mecha_parts.dm b/code/game/mecha/mecha_parts.dm index 566be391cc..1713b36c37 100644 --- a/code/game/mecha/mecha_parts.dm +++ b/code/game/mecha/mecha_parts.dm @@ -12,17 +12,12 @@ /obj/item/mecha_parts/chassis name = "Mecha Chassis" icon_state = "backbone" - var/datum/construction/construct var/construct_type /obj/item/mecha_parts/chassis/Initialize() . = ..() if(construct_type) - construct = new construct_type(src) - -/obj/item/mecha_parts/chassis/attackby(obj/item/W, mob/user, params) - if(!construct || !construct.action(W, user)) - return ..() + AddComponent(construct_type) /obj/item/mecha_parts/chassis/attack_hand() return @@ -31,7 +26,7 @@ /obj/item/mecha_parts/chassis/ripley name = "\improper Ripley chassis" - construct_type = /datum/construction/unordered/mecha_chassis/ripley + construct_type = /datum/component/construction/unordered/mecha_chassis/ripley /obj/item/mecha_parts/part/ripley_torso name = "\improper Ripley torso" @@ -62,7 +57,7 @@ /obj/item/mecha_parts/chassis/odysseus name = "\improper Odysseus chassis" - construct_type = /datum/construction/unordered/mecha_chassis/odysseus + construct_type = /datum/component/construction/unordered/mecha_chassis/odysseus /obj/item/mecha_parts/part/odysseus_head name = "\improper Odysseus head" @@ -98,7 +93,7 @@ /obj/item/mecha_parts/chassis/gygax name = "\improper Gygax chassis" - construct_type = /datum/construction/unordered/mecha_chassis/gygax + construct_type = /datum/component/construction/unordered/mecha_chassis/gygax /obj/item/mecha_parts/part/gygax_torso name = "\improper Gygax torso" @@ -141,7 +136,7 @@ /obj/item/mecha_parts/chassis/durand name = "\improper Durand chassis" - construct_type = /datum/construction/unordered/mecha_chassis/durand + construct_type = /datum/component/construction/unordered/mecha_chassis/durand /obj/item/mecha_parts/part/durand_torso name = "\improper Durand torso" @@ -183,14 +178,14 @@ /obj/item/mecha_parts/chassis/firefighter name = "\improper Firefighter chassis" - construct_type = /datum/construction/unordered/mecha_chassis/firefighter + construct_type = /datum/component/construction/unordered/mecha_chassis/firefighter ////////// HONK /obj/item/mecha_parts/chassis/honker name = "\improper H.O.N.K chassis" - construct_type = /datum/construction/unordered/mecha_chassis/honker + construct_type = /datum/component/construction/unordered/mecha_chassis/honker /obj/item/mecha_parts/part/honker_torso name = "\improper H.O.N.K torso" @@ -227,7 +222,7 @@ /obj/item/mecha_parts/chassis/phazon name = "\improper Phazon chassis" - construct_type = /datum/construction/unordered/mecha_chassis/phazon + construct_type = /datum/component/construction/unordered/mecha_chassis/phazon /obj/item/mecha_parts/part/phazon_torso name="\improper Phazon torso" diff --git a/tgstation.dme b/tgstation.dme index 87e81d16b7..4a70edb7d5 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -348,6 +348,7 @@ #include "code\datums\components\caltrop.dm" #include "code\datums\components\chasm.dm" #include "code\datums\components\cleaning.dm" +#include "code\datums\components\construction.dm" #include "code\datums\components\decal.dm" #include "code\datums\components\forensics.dm" #include "code\datums\components\infective.dm" @@ -419,7 +420,6 @@ #include "code\datums\diseases\advance\symptoms\vomit.dm" #include "code\datums\diseases\advance\symptoms\weight.dm" #include "code\datums\diseases\advance\symptoms\youth.dm" -#include "code\datums\helper_datums\construction_datum.dm" #include "code\datums\helper_datums\events.dm" #include "code\datums\helper_datums\getrev.dm" #include "code\datums\helper_datums\icon_snapshot.dm"