mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Merge pull request #3348 from ComicIronic/MechContRedo
Construction datum changes.
This commit is contained in:
@@ -499,6 +499,7 @@
|
|||||||
#include "code\game\mecha\mech_bay.dm"
|
#include "code\game\mecha\mech_bay.dm"
|
||||||
#include "code\game\mecha\mech_fabricator.dm"
|
#include "code\game\mecha\mech_fabricator.dm"
|
||||||
#include "code\game\mecha\mecha.dm"
|
#include "code\game\mecha\mecha.dm"
|
||||||
|
#include "code\game\mecha\mecha_construction_chassis.dm"
|
||||||
#include "code\game\mecha\mecha_construction_paths.dm"
|
#include "code\game\mecha\mecha_construction_paths.dm"
|
||||||
#include "code\game\mecha\mecha_control_console.dm"
|
#include "code\game\mecha\mecha_control_console.dm"
|
||||||
#include "code\game\mecha\mecha_designs.dm"
|
#include "code\game\mecha\mecha_designs.dm"
|
||||||
|
|||||||
@@ -15,210 +15,189 @@
|
|||||||
bound_width = 64
|
bound_width = 64
|
||||||
bound_height = 64
|
bound_height = 64
|
||||||
|
|
||||||
construct = new /datum/construction/reversible2/pod(src)
|
construct = new /datum/construction/reversible/pod(src)
|
||||||
|
|
||||||
dir = EAST
|
dir = EAST
|
||||||
|
|
||||||
/obj/structure/spacepod_frame/attackby(obj/item/W as obj, mob/user as mob)
|
/obj/structure/spacepod_frame/attackby(obj/item/W as obj, mob/user as mob)
|
||||||
if(!construct || !construct.action(W, user))
|
if(!construct || !construct.action(W, user))
|
||||||
..()
|
return ..()
|
||||||
return
|
return 1
|
||||||
|
|
||||||
/obj/structure/spacepod_frame/attack_hand()
|
/obj/structure/spacepod_frame/attack_hand()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// CONSTRUCTION STEPS
|
// CONSTRUCTION STEPS
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
/datum/construction/reversible2/pod
|
/datum/construction/reversible/pod
|
||||||
result = /obj/spacepod/civilian
|
result = /obj/spacepod/civilian
|
||||||
base_icon="pod"
|
|
||||||
//taskpath = /datum/job_objective/make_pod
|
//taskpath = /datum/job_objective/make_pod
|
||||||
steps = list(
|
steps = list(
|
||||||
// 1. Initial state
|
// 12. Bolted-down armor
|
||||||
list(
|
list(
|
||||||
"desc" = "An empty pod frame.",
|
Co_DESC = "A space pod with unsecured armor.",
|
||||||
state_next = list(
|
Co_BACKSTEP = list(
|
||||||
"key" = /obj/item/stack/cable_coil,
|
Co_KEY = /obj/item/weapon/wrench,
|
||||||
"vis_msg" = "{USER} wires the {HOLDER}.",
|
Co_VIS_MSG = "{USER} unsecure{s} {HOLDER}'s armor."
|
||||||
"self_msg" = "You wire the {HOLDER}."
|
|
||||||
)
|
|
||||||
),
|
|
||||||
// 2. Crudely Wired
|
|
||||||
list(
|
|
||||||
"desc" = "A crudely-wired pod frame.",
|
|
||||||
state_prev = list(
|
|
||||||
"key" = /obj/item/weapon/wirecutters,
|
|
||||||
"vis_msg" = "{USER} cuts out the {HOLDER}'s wiring.",
|
|
||||||
"self_msg" = "You remove the {HOLDER}'s wiring."
|
|
||||||
),
|
),
|
||||||
state_next = list(
|
Co_NEXTSTEP = list(
|
||||||
"key" = /obj/item/weapon/screwdriver,
|
Co_KEY = /obj/item/weapon/weldingtool,
|
||||||
"vis_msg" = "{USER} adjusts the wiring.",
|
Co_VIS_MSG = "{USER} weld{s} {HOLDER}'s armor."
|
||||||
"self_msg" = "You adjust the {HOLDER}'s wiring."
|
|
||||||
)
|
|
||||||
),
|
|
||||||
// 3. Cleanly wired
|
|
||||||
list(
|
|
||||||
"desc" = "A wired pod frame.",
|
|
||||||
state_prev = list(
|
|
||||||
"key" = /obj/item/weapon/screwdriver,
|
|
||||||
"vis_msg" = "{USER} unclips {HOLDER}'s wiring harnesses.",
|
|
||||||
"self_msg" = "You unclip {HOLDER}'s wiring harnesses."
|
|
||||||
),
|
|
||||||
state_next = list(
|
|
||||||
"key" = /obj/item/weapon/circuitboard/mecha/pod,
|
|
||||||
"vis_msg" = "{USER} inserts the mainboard into the {HOLDER}.",
|
|
||||||
"self_msg" = "You insert the mainboard into the {HOLDER}.",
|
|
||||||
"delete" = 1
|
|
||||||
)
|
|
||||||
),
|
|
||||||
// 4. Circuit added
|
|
||||||
list(
|
|
||||||
"desc" = "A wired pod frame with a loose mainboard.",
|
|
||||||
state_prev = list(
|
|
||||||
"key" = /obj/item/weapon/crowbar,
|
|
||||||
"vis_msg" = "{USER} pries out the mainboard.",
|
|
||||||
"self_msg" = "You pry out the mainboard.",
|
|
||||||
|
|
||||||
"spawn" = /obj/item/weapon/circuitboard/mecha/pod,
|
|
||||||
"amount" = 1
|
|
||||||
),
|
|
||||||
state_next = list(
|
|
||||||
"key" = /obj/item/weapon/screwdriver,
|
|
||||||
"vis_msg" = "{USER} secures the mainboard.",
|
|
||||||
"self_msg" = "You secure the mainboard."
|
|
||||||
)
|
|
||||||
),
|
|
||||||
// 5. Circuit secured
|
|
||||||
list(
|
|
||||||
"desc" = "A wired pod frame with a secured mainboard.",
|
|
||||||
state_prev = list(
|
|
||||||
"key" = /obj/item/weapon/screwdriver,
|
|
||||||
"vis_msg" = "{USER} unsecures the mainboard.",
|
|
||||||
"self_msg" = "You unscrew the mainboard from the {HOLDER}."
|
|
||||||
),
|
|
||||||
state_next = list(
|
|
||||||
"key" = /obj/item/pod_parts/core,
|
|
||||||
"vis_msg" = "{USER} inserts the core into the {HOLDER}.",
|
|
||||||
"self_msg" = "You carefully insert the core into the {HOLDER}.",
|
|
||||||
"delete" = 1
|
|
||||||
)
|
|
||||||
),
|
|
||||||
// 6. Core inserted
|
|
||||||
list(
|
|
||||||
"desc" = "A naked space pod with a loose core.",
|
|
||||||
state_prev = list(
|
|
||||||
"key" = /obj/item/weapon/crowbar,
|
|
||||||
"vis_msg" = "{USER} delicately removes the core from the {HOLDER} with a crowbar.",
|
|
||||||
"self_msg" = "You delicately remove the core from the {HOLDER} with a crowbar.",
|
|
||||||
|
|
||||||
"spawn" = /obj/item/pod_parts/core,
|
|
||||||
"amount" = 1
|
|
||||||
),
|
|
||||||
state_next = list(
|
|
||||||
"key" = /obj/item/weapon/wrench,
|
|
||||||
"vis_msg" = "{USER} secures the core's bolts.",
|
|
||||||
"self_msg" = "You secure the core's bolts."
|
|
||||||
)
|
|
||||||
),
|
|
||||||
// 7. Core secured
|
|
||||||
list(
|
|
||||||
"desc" = "A naked space pod with an exposed core. How lewd.",
|
|
||||||
state_prev = list(
|
|
||||||
"key" = /obj/item/weapon/wrench,
|
|
||||||
"vis_msg" = "{USER} unsecures the {HOLDER}'s core.",
|
|
||||||
"self_msg" = "You unsecure the {HOLDER}'s core."
|
|
||||||
),
|
|
||||||
state_next = list(
|
|
||||||
"key" = /obj/item/stack/sheet/metal,
|
|
||||||
"amount" = 5,
|
|
||||||
"vis_msg" = "{USER} frabricates a pressure bulkhead for the {HOLDER}.",
|
|
||||||
"self_msg" = "You frabricate a pressure bulkhead for the {HOLDER}."
|
|
||||||
)
|
|
||||||
),
|
|
||||||
// 8. Bulkhead added
|
|
||||||
list(
|
|
||||||
"desc" = "A space pod with loose bulkhead panelling exposed.",
|
|
||||||
state_prev = list(
|
|
||||||
"key" = /obj/item/weapon/crowbar,
|
|
||||||
"vis_msg" = "{USER} pops the {HOLDER}'s bulkhead panelling loose.",
|
|
||||||
"self_msg" = "You pop the {HOLDER}'s bulkhead panelling loose.",
|
|
||||||
|
|
||||||
"spawn" = /obj/item/stack/sheet/metal,
|
|
||||||
"amount" = 5,
|
|
||||||
),
|
|
||||||
state_next = list(
|
|
||||||
"key" = /obj/item/weapon/wrench,
|
|
||||||
"vis_msg" = "{USER} secures the {HOLDER}'s bulkhead panelling.",
|
|
||||||
"self_msg" = "You secure the {HOLDER}'s bulkhead panelling."
|
|
||||||
)
|
|
||||||
),
|
|
||||||
// 9. Bulkhead secured with bolts
|
|
||||||
list(
|
|
||||||
"desc" = "A space pod with unwelded bulkhead panelling exposed.",
|
|
||||||
state_prev = list(
|
|
||||||
"key" = /obj/item/weapon/wrench,
|
|
||||||
"vis_msg" = "{USER} unbolts the {HOLDER}'s bulkhead panelling.",
|
|
||||||
"self_msg" = "You unbolt the {HOLDER}'s bulkhead panelling."
|
|
||||||
),
|
|
||||||
state_next = list(
|
|
||||||
"key" = /obj/item/weapon/weldingtool,
|
|
||||||
"vis_msg" = "{USER} seals the {HOLDER}'s bulkhead panelling with a weld.",
|
|
||||||
"self_msg" = "You seal the {HOLDER}'s bulkhead panelling with a weld."
|
|
||||||
)
|
|
||||||
),
|
|
||||||
// 10. Welded bulkhead
|
|
||||||
list(
|
|
||||||
"desc" = "A space pod with sealed bulkhead panelling exposed.",
|
|
||||||
state_prev = list(
|
|
||||||
"key" = /obj/item/weapon/weldingtool,
|
|
||||||
"vis_msg" = "{USER} cuts the {HOLDER}'s bulkhead panelling loose.",
|
|
||||||
"self_msg" = "You cut the {HOLDER}'s bulkhead panelling loose."
|
|
||||||
),
|
|
||||||
state_next = list(
|
|
||||||
"key" = /obj/item/pod_parts/armor,
|
|
||||||
"vis_msg" = "{USER} installs the {HOLDER}'s armor plating.",
|
|
||||||
"self_msg" = "You install the {HOLDER}'s armor plating.",
|
|
||||||
"delete" = 1
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
// 11. Loose armor
|
// 11. Loose armor
|
||||||
list(
|
list(
|
||||||
"desc" = "A space pod with unsecured armor.",
|
Co_DESC = "A space pod with unsecured armor.",
|
||||||
state_prev = list(
|
Co_BACKSTEP = list(
|
||||||
"key" = /obj/item/weapon/crowbar,
|
Co_KEY = /obj/item/weapon/crowbar,
|
||||||
"vis_msg" = "{USER} pries off {HOLDER}'s armor.",
|
Co_VIS_MSG = "{USER} prie{s} off {HOLDER}'s armor."
|
||||||
"self_msg" = "You pry off {HOLDER}'s armor.",
|
|
||||||
"spawn" = /obj/item/pod_parts/armor,
|
|
||||||
"amount" = 1
|
|
||||||
),
|
),
|
||||||
state_next = list(
|
Co_NEXTSTEP = list(
|
||||||
"key" = /obj/item/weapon/wrench,
|
Co_KEY = /obj/item/weapon/wrench,
|
||||||
"vis_msg" = "{USER} bolts down the {HOLDER}'s armor.",
|
Co_VIS_MSG = "{USER} bolt{s} down {HOLDER}'s armor."
|
||||||
"self_msg" = "You bolt down the {HOLDER}'s armor."
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
// 12. Bolted-down armor
|
// 10. Welded bulkhead
|
||||||
list(
|
list(
|
||||||
"desc" = "A space pod with unsecured armor.",
|
Co_DESC = "A space pod with sealed bulkhead panelling exposed.",
|
||||||
state_prev = list(
|
Co_BACKSTEP = list(
|
||||||
"key" = /obj/item/weapon/wrench,
|
Co_KEY = /obj/item/weapon/weldingtool,
|
||||||
"vis_msg" = "{USER} unsecures the {HOLDER}'s armor.",
|
Co_VIS_MSG = "{USER} cut{s} {HOLDER}'s bulkhead panelling loose.",
|
||||||
"self_msg" = "You unsecure the {HOLDER}'s armor."
|
Co_AMOUNT = 3
|
||||||
),
|
),
|
||||||
state_next = list(
|
Co_NEXTSTEP = list(
|
||||||
"key" = /obj/item/weapon/weldingtool,
|
Co_KEY = /obj/item/pod_parts/armor,
|
||||||
"vis_msg" = "{USER} welds the {HOLDER}'s armor.",
|
Co_VIS_MSG = "{USER} install{s} {HOLDER}'s armor plating.",
|
||||||
"self_msg" = "You weld the {HOLDER}'s armor."
|
Co_AMOUNT = 1,
|
||||||
|
Co_KEEP
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// 9. Bulkhead secured with bolts
|
||||||
|
list(
|
||||||
|
Co_DESC = "A space pod with unwelded bulkhead panelling exposed.",
|
||||||
|
Co_BACKSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/wrench,
|
||||||
|
Co_VIS_MSG = "{USER} unbolt{s} {HOLDER}'s bulkhead panelling.",
|
||||||
|
),
|
||||||
|
Co_NEXTSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/weldingtool,
|
||||||
|
Co_VIS_MSG = "{USER} seal{s} {HOLDER}'s bulkhead panelling with a weld.",
|
||||||
|
Co_AMOUNT = 3
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// 8. Bulkhead added
|
||||||
|
list(
|
||||||
|
Co_DESC = "A space pod with loose bulkhead panelling exposed.",
|
||||||
|
Co_BACKSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/crowbar,
|
||||||
|
Co_VIS_MSG = "{USER} pop{s} {HOLDER}'s bulkhead panelling loose.",
|
||||||
|
),
|
||||||
|
Co_NEXTSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/wrench,
|
||||||
|
Co_VIS_MSG = "{USER} secure{s} {HOLDER}'s bulkhead panelling."
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// 7. Core secured
|
||||||
|
list(
|
||||||
|
Co_DESC = "A naked space pod with an exposed core. How lewd.",
|
||||||
|
Co_BACKSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/wrench,
|
||||||
|
Co_VIS_MSG = "{USER} unsecure{s} {HOLDER}'s core."
|
||||||
|
),
|
||||||
|
Co_NEXTSTEP = list(
|
||||||
|
Co_KEY = /obj/item/stack/sheet/metal,
|
||||||
|
Co_AMOUNT = 5,
|
||||||
|
Co_VIS_MSG = "{USER} fabricate{s} a pressure bulkhead for {HOLDER}.",
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// 6. Core inserted
|
||||||
|
list(
|
||||||
|
Co_DESC = "A naked space pod with a loose core.",
|
||||||
|
Co_BACKSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/crowbar,
|
||||||
|
Co_VIS_MSG = "{USER} delicately remove{s} the core from {HOLDER} with a crowbar."
|
||||||
|
),
|
||||||
|
Co_NEXTSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/wrench,
|
||||||
|
Co_VIS_MSG = "{USER} secure{s} the core's bolts."
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// 5. Circuit secured
|
||||||
|
list(
|
||||||
|
Co_DESC = "A wired pod frame with a secured mainboard.",
|
||||||
|
Co_BACKSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/screwdriver,
|
||||||
|
Co_VIS_MSG = "{USER} unsecure{s} the mainboard."
|
||||||
|
),
|
||||||
|
Co_NEXTSTEP = list(
|
||||||
|
Co_KEY = /obj/item/pod_parts/core,
|
||||||
|
Co_VIS_MSG = "{USER} insert{s} the core into {HOLDER}.",
|
||||||
|
Co_AMOUNT = 1,
|
||||||
|
Co_KEEP
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// 4. Circuit added
|
||||||
|
list(
|
||||||
|
Co_DESC = "A wired pod frame with a loose mainboard.",
|
||||||
|
Co_BACKSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/crowbar,
|
||||||
|
Co_VIS_MSG = "{USER} prie{s} out the mainboard."
|
||||||
|
),
|
||||||
|
Co_NEXTSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/screwdriver,
|
||||||
|
Co_VIS_MSG = "{USER} secure{s} the mainboard."
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// 3. Cleanly wired
|
||||||
|
list(
|
||||||
|
Co_DESC = "A wired pod frame.",
|
||||||
|
Co_BACKSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/screwdriver,
|
||||||
|
Co_VIS_MSG = "{USER} unclip{s} {HOLDER}'s wiring harnesses."
|
||||||
|
),
|
||||||
|
Co_NEXTSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/circuitboard/mecha/pod,
|
||||||
|
Co_VIS_MSG = "{USER} insert{s} the mainboard into {HOLDER}.",
|
||||||
|
Co_AMOUNT = 1,
|
||||||
|
Co_KEEP
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// 2. Crudely Wired
|
||||||
|
list(
|
||||||
|
Co_DESC = "A crudely-wired pod frame.",
|
||||||
|
Co_BACKSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/wirecutters,
|
||||||
|
Co_VIS_MSG = "{USER} cut{s} out {HOLDER}'s wiring."
|
||||||
|
),
|
||||||
|
Co_NEXTSTEP = list(
|
||||||
|
Co_KEY = /obj/item/weapon/screwdriver,
|
||||||
|
Co_VIS_MSG = "{USER} adjust{s} the wiring."
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// 1. Initial state
|
||||||
|
list(
|
||||||
|
Co_DESC = "An empty pod frame.",
|
||||||
|
Co_NEXTSTEP = list(
|
||||||
|
Co_KEY = /obj/item/stack/cable_coil,
|
||||||
|
Co_VIS_MSG = "{USER} wire{s} {HOLDER}.",
|
||||||
|
Co_AMOUNT = 10
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
// EOF
|
|
||||||
)
|
)
|
||||||
|
|
||||||
spawn_result(mob/user as mob)
|
/datum/construction/reversible/pod/spawn_result(mob/user as mob)
|
||||||
..()
|
..()
|
||||||
feedback_inc("spacepod_created",1)
|
feedback_inc("spacepod_created",1)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
/datum/construction/reversible/pod/custom_action(index, diff, atom/used_atom, mob/user)
|
||||||
|
if(!..())
|
||||||
|
return 0
|
||||||
|
|
||||||
|
holder.icon_state = "pod_[steps.len - index + 1 - diff]"
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
/datum/construction/reversible/pod/action(atom/used_atom,mob/user)
|
||||||
|
return check_step(used_atom,user)
|
||||||
@@ -1,251 +1,391 @@
|
|||||||
#define FORWARD -1
|
#define FORWARD -1
|
||||||
#define BACKWARD 1
|
#define BACKWARD 1
|
||||||
|
|
||||||
|
#define Co_KEY "key"
|
||||||
|
#define Co_VIS_MSG "vis_msg"
|
||||||
|
#define Co_START_MSG "start_msg"
|
||||||
|
#define Co_AMOUNT "amount"
|
||||||
|
#define Co_MAX_AMOUNT "max_amount"
|
||||||
|
#define Co_DELAY "delay"
|
||||||
|
#define Co_KEEP "keep" //if permanence is set to 0, we can still store specific step items by including this in the step
|
||||||
|
#define Co_TAKE "take" //if we want to actually have a stack or weldingtool in construction, rather than weld or add a stack, we can use this override
|
||||||
|
#define Co_DESC "desc"
|
||||||
|
|
||||||
|
#define Co_NEXTSTEP "nextstep"
|
||||||
|
#define Co_BACKSTEP "backstep"
|
||||||
|
|
||||||
/datum/construction
|
/datum/construction
|
||||||
var/list/steps
|
var/list/steps
|
||||||
var/atom/holder
|
var/atom/holder
|
||||||
var/result
|
var/result
|
||||||
var/list/steps_desc
|
var/list/steps_desc
|
||||||
var/taskpath = null // Path of job objective completed.
|
var/taskpath = null // Path of job objective completed.
|
||||||
|
var/assembling = 0 //if we're in a step, we won't be allowed to do another step
|
||||||
|
var/permanence = 0
|
||||||
|
var/list/used_atoms = list() //contains the stuff we add. Can be used in multiple-choice construction
|
||||||
|
|
||||||
New(atom)
|
/datum/construction/New(atom)
|
||||||
..()
|
..()
|
||||||
holder = atom
|
holder = atom
|
||||||
if(!holder) //don't want this without a holder
|
if(!holder) //don't want this without a holder
|
||||||
spawn
|
spawn
|
||||||
del src
|
del src
|
||||||
|
set_desc(steps.len)
|
||||||
|
add_max_amounts()
|
||||||
|
return
|
||||||
|
|
||||||
|
/datum/construction/proc/next_step(mob/user as mob)
|
||||||
|
steps.len--
|
||||||
|
if(!steps.len)
|
||||||
|
spawn_result(user)
|
||||||
|
else
|
||||||
set_desc(steps.len)
|
set_desc(steps.len)
|
||||||
return
|
return
|
||||||
|
|
||||||
proc/next_step(mob/user as mob)
|
/datum/construction/proc/action(atom/used_atom,mob/user as mob)
|
||||||
steps.len--
|
return
|
||||||
if(!steps.len)
|
|
||||||
spawn_result(user)
|
|
||||||
else
|
|
||||||
set_desc(steps.len)
|
|
||||||
return
|
|
||||||
|
|
||||||
proc/action(atom/used_atom,mob/user as mob)
|
/datum/construction/proc/check_step(atom/used_atom,mob/user as mob) //check last step only
|
||||||
return
|
var/valid_step = is_right_key(user,used_atom)
|
||||||
|
if(valid_step)
|
||||||
|
assembling = 1
|
||||||
|
if(custom_action(valid_step, used_atom, user))
|
||||||
|
next_step(user)
|
||||||
|
assembling = 0
|
||||||
|
return 1
|
||||||
|
assembling = 0
|
||||||
|
return 0
|
||||||
|
|
||||||
proc/check_step(atom/used_atom,mob/user as mob) //check last step only
|
/datum/construction/proc/is_right_key(mob/user as mob, atom/used_atom) // returns current step num if used_atom is of the right type.
|
||||||
var/valid_step = is_right_key(user,used_atom)
|
if(assembling) return 0
|
||||||
if(valid_step)
|
var/list/L = steps[steps.len]
|
||||||
if(custom_action(valid_step, used_atom, user))
|
if((istype(L[Co_KEY], /list) && is_type_in_list(used_atom, L[Co_KEY])) || istype(used_atom, L[Co_KEY]))
|
||||||
next_step(user)
|
//if our keys are in a list, we want to check them all
|
||||||
|
//otherwise, sanity permits setting it as a single type and checking that
|
||||||
|
if(!try_consume(user, used_atom, L))
|
||||||
|
return 0
|
||||||
|
return steps.len
|
||||||
|
return 0
|
||||||
|
|
||||||
|
/datum/construction/proc/custom_action(step, used_atom, user)
|
||||||
|
if(istype(used_atom, /obj/item/weapon/weldingtool))
|
||||||
|
playsound(holder, 'sound/items/Welder2.ogg', 50, 1)
|
||||||
|
|
||||||
|
else if(istype(used_atom, /obj/item/weapon/wrench))
|
||||||
|
playsound(holder, 'sound/items/Ratchet.ogg', 50, 1)
|
||||||
|
|
||||||
|
else if(istype(used_atom, /obj/item/weapon/screwdriver))
|
||||||
|
playsound(holder, 'sound/items/Screwdriver.ogg', 50, 1)
|
||||||
|
|
||||||
|
else if(istype(used_atom, /obj/item/weapon/wirecutters))
|
||||||
|
playsound(holder, 'sound/items/Wirecutter.ogg', 50, 1)
|
||||||
|
|
||||||
|
construct_message(step, user)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
/datum/construction/proc/fixText(text,user,self=0)
|
||||||
|
if(self)
|
||||||
|
text = replacetext(text, "{s}", "")
|
||||||
|
text = replacetext(text, "{USER}", "You")
|
||||||
|
else
|
||||||
|
text = replacetext(text, "{s}", "s")
|
||||||
|
text = replacetext(text,"{USER}","[user]")
|
||||||
|
text = replacetext(text,"{HOLDER}","[holder]")
|
||||||
|
return text
|
||||||
|
|
||||||
|
/datum/construction/proc/construct_message(step, mob/user)
|
||||||
|
user.visible_message(fixText(step[Co_VIS_MSG],user), fixText(step[Co_VIS_MSG],user,1))
|
||||||
|
|
||||||
|
/datum/construction/proc/start_construct_message(step, mob/user, atom/movable/used_atom)
|
||||||
|
user.visible_message(fixText(step[Co_START_MSG],user), fixText(step[Co_START_MSG],user,1))
|
||||||
|
|
||||||
|
/datum/construction/proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one.
|
||||||
|
for(var/i=1;i<=steps.len;i++)
|
||||||
|
var/list/L = steps[i];
|
||||||
|
if((islist(L[Co_KEY]) && is_type_in_list(used_atom, L[Co_KEY])) ||istype(used_atom, L[Co_KEY]))
|
||||||
|
if(custom_action(i, used_atom, user))
|
||||||
|
steps[i]=null;//stupid byond list from list removal...
|
||||||
|
listclearnulls(steps);
|
||||||
|
if(!steps.len)
|
||||||
|
spawn_result(user)
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
proc/is_right_key(mob/user as mob, atom/used_atom) // returns current step num if used_atom is of the right type.
|
|
||||||
var/list/L = steps[steps.len]
|
|
||||||
if(istype(used_atom, L["key"]))
|
|
||||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
|
||||||
// return 0
|
|
||||||
return steps.len
|
|
||||||
return 0
|
|
||||||
|
|
||||||
proc/custom_action(step, used_atom, user)
|
/datum/construction/proc/spawn_result(mob/user as mob)
|
||||||
if(istype(used_atom, /obj/item/weapon/weldingtool))
|
if(result)
|
||||||
var/obj/item/weapon/weldingtool/W = used_atom
|
testing("[user] finished a [result]!")
|
||||||
if (W.remove_fuel(0, user))
|
|
||||||
playsound(holder, 'sound/items/Welder2.ogg', 50, 1)
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
else if(istype(used_atom, /obj/item/weapon/wrench))
|
|
||||||
playsound(holder, 'sound/items/Ratchet.ogg', 50, 1)
|
|
||||||
|
|
||||||
else if(istype(used_atom, /obj/item/weapon/screwdriver))
|
new result(get_turf(holder))
|
||||||
playsound(holder, 'sound/items/Screwdriver.ogg', 50, 1)
|
spawn()
|
||||||
|
del holder
|
||||||
|
return
|
||||||
|
|
||||||
else if(istype(used_atom, /obj/item/weapon/wirecutters))
|
/datum/construction/proc/set_desc(index as num)
|
||||||
playsound(holder, 'sound/items/Wirecutter.ogg', 50, 1)
|
var/list/step = steps[index]
|
||||||
|
holder.desc = step[Co_DESC]
|
||||||
|
return
|
||||||
|
|
||||||
else if(istype(used_atom, /obj/item/stack/cable_coil))
|
/datum/construction/proc/try_consume(mob/user as mob, atom/movable/used_atom, given_step)
|
||||||
var/obj/item/stack/cable_coil/C = used_atom
|
if(!(Co_AMOUNT in given_step) && !(Co_DELAY in given_step))
|
||||||
if(C.amount<4)
|
|
||||||
user << ("There's not enough cable to finish the task.")
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
C.use(4)
|
|
||||||
playsound(holder, 'sound/items/Deconstruct.ogg', 50, 1)
|
|
||||||
else if(istype(used_atom, /obj/item/stack))
|
|
||||||
var/obj/item/stack/S = used_atom
|
|
||||||
if(S.amount < 5)
|
|
||||||
user << ("There's not enough material in this stack.")
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
S.use(5)
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one.
|
|
||||||
for(var/i=1;i<=steps.len;i++)
|
|
||||||
var/list/L = steps[i];
|
|
||||||
if(istype(used_atom, L["key"]))
|
|
||||||
if(custom_action(i, used_atom, user))
|
|
||||||
steps[i]=null;//stupid byond list from list removal...
|
|
||||||
listclearnulls(steps);
|
|
||||||
if(!steps.len)
|
|
||||||
spawn_result(user)
|
|
||||||
return 1
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
var/delay = 0
|
||||||
|
if(Co_DELAY in given_step)
|
||||||
|
delay = given_step[Co_DELAY]
|
||||||
|
if(delay > 0)
|
||||||
|
start_construct_message(given_step, user, used_atom)
|
||||||
|
if(!do_after(user, delay, needhand = 1))
|
||||||
|
return 0
|
||||||
|
|
||||||
proc/spawn_result(mob/user as mob)
|
var/amount = 0
|
||||||
if(result)
|
if(Co_AMOUNT in given_step)
|
||||||
testing("[user] finished a [result]!")
|
amount = given_step[Co_AMOUNT]
|
||||||
|
if(amount>0)
|
||||||
|
// STACKS
|
||||||
|
if(istype(used_atom,/obj/item/stack) && !(Co_TAKE in given_step))
|
||||||
|
var/obj/item/stack/stack=used_atom
|
||||||
|
if(stack.amount < amount)
|
||||||
|
user << "<span class='notice'>You start adding [stack] to \the [holder]. It still needs [amount - stack.amount] [stack.singular_name].</span>"
|
||||||
|
given_step[Co_AMOUNT] -= stack.amount
|
||||||
|
stack.use(stack.amount)
|
||||||
|
return 0
|
||||||
|
stack.use(amount)
|
||||||
|
// WELDER
|
||||||
|
else if(istype(used_atom,/obj/item/weapon/weldingtool) && !(Co_TAKE in given_step))
|
||||||
|
var/obj/item/weapon/weldingtool/welder=used_atom
|
||||||
|
if(!welder.isOn())
|
||||||
|
user << "\blue You tap the [src] with your unlit welder. [pick("Ding","Dong")]."
|
||||||
|
return 0
|
||||||
|
if(!welder.remove_fuel(amount,user))
|
||||||
|
user << "\red You don't have enough fuel!"
|
||||||
|
return 0
|
||||||
|
//generic things
|
||||||
|
else
|
||||||
|
var/atom_name = used_atom.name
|
||||||
|
if(permanence || (Co_KEEP in given_step))
|
||||||
|
user.drop_item(holder)
|
||||||
|
used_atom.loc = holder
|
||||||
|
used_atoms.Add(list("[steps.Find(given_step)]" = used_atom))
|
||||||
|
else
|
||||||
|
qdel(used_atom)
|
||||||
|
given_step[Co_AMOUNT]--
|
||||||
|
if(given_step[Co_AMOUNT] > 0)
|
||||||
|
user << "<span class='notice'>You add \a [atom_name] to \the [holder]. It still needs [amount -1 ] [atom_name]\s.</span>"
|
||||||
|
return 0
|
||||||
|
given_step[Co_AMOUNT] = given_step[Co_MAX_AMOUNT]
|
||||||
|
return 1
|
||||||
|
|
||||||
new result(get_turf(holder))
|
/datum/construction/proc/add_max_amounts()
|
||||||
spawn()
|
for(var/list/this_step in steps)
|
||||||
del holder
|
if((Co_AMOUNT in this_step))
|
||||||
return
|
this_step.Add(list(Co_MAX_AMOUNT = this_step[Co_AMOUNT])) //puts in something we can refer to when we reset the step
|
||||||
|
|
||||||
proc/set_desc(index as num)
|
|
||||||
var/list/step = steps[index]
|
|
||||||
holder.desc = step["desc"]
|
|
||||||
return
|
|
||||||
|
|
||||||
proc/try_consume(mob/user as mob, atom/used_atom, amount)
|
|
||||||
if(amount>0)
|
|
||||||
// STACKS
|
|
||||||
if(istype(used_atom,/obj/item/stack))
|
|
||||||
var/obj/item/stack/stack=used_atom
|
|
||||||
if(stack.amount < amount)
|
|
||||||
user << "\red You don't have enough [stack]! You need at least [amount]."
|
|
||||||
return 0
|
|
||||||
stack.use(amount)
|
|
||||||
// CABLES
|
|
||||||
if(istype(used_atom,/obj/item/stack/cable_coil))
|
|
||||||
var/obj/item/stack/cable_coil/coil=used_atom
|
|
||||||
if(coil.amount < amount)
|
|
||||||
user << "\red You don't have enough cable! You need at least [amount] coils."
|
|
||||||
return 0
|
|
||||||
coil.use(amount)
|
|
||||||
// WELDER
|
|
||||||
if(istype(used_atom,/obj/item/weapon/weldingtool))
|
|
||||||
var/obj/item/weapon/weldingtool/welder=used_atom
|
|
||||||
if(!welder.isOn())
|
|
||||||
user << "\blue You tap the [src] with your unlit welder. [pick("Ding","Dong")]."
|
|
||||||
return 0
|
|
||||||
if(!welder.remove_fuel(amount,user))
|
|
||||||
user << "\red You don't have enough fuel!"
|
|
||||||
return 0
|
|
||||||
return 1
|
|
||||||
|
|
||||||
/datum/construction/reversible
|
/datum/construction/reversible
|
||||||
var/index
|
var/index
|
||||||
|
|
||||||
New(atom)
|
/datum/construction/reversible/New(atom)
|
||||||
..()
|
..()
|
||||||
index = steps.len
|
index = steps.len
|
||||||
return
|
return
|
||||||
|
|
||||||
proc/update_index(diff as num, mob/user as mob)
|
/datum/construction/reversible/proc/update_index(diff as num, mob/user as mob)
|
||||||
index+=diff
|
index+=diff
|
||||||
if(index==0)
|
if(index==0)
|
||||||
spawn_result(user)
|
spawn_result(user)
|
||||||
else
|
else
|
||||||
set_desc(index)
|
set_desc(index)
|
||||||
return
|
return
|
||||||
|
|
||||||
is_right_key(mob/user as mob,atom/used_atom) // returns index step
|
/datum/construction/reversible/is_right_key(mob/user as mob,atom/used_atom) // returns index step
|
||||||
var/list/L = steps[index]
|
if(assembling) return 0
|
||||||
if(istype(used_atom, L["key"]))
|
assembling = 1
|
||||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
var/list/step_next = get_forward_step(index)
|
||||||
// return 0
|
var/list/step_back = get_backward_step(index)
|
||||||
return FORWARD //to the first step -> forward
|
if(step_next && (islist(step_next[Co_KEY]) && is_type_in_list(used_atom, step_next[Co_KEY])) || istype(used_atom, step_next[Co_KEY]))
|
||||||
else if(L["backkey"] && istype(used_atom, L["backkey"]))
|
//if our keys are in a list, we want to check them all
|
||||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
//otherwise, sanity permits setting it as a single type and checking that
|
||||||
// return 0
|
if(!try_consume(user, used_atom, step_next, index, FORWARD))
|
||||||
return BACKWARD //to the last step -> backwards
|
assembling = 0
|
||||||
return 0
|
|
||||||
|
|
||||||
check_step(atom/used_atom,mob/user as mob)
|
|
||||||
var/diff = is_right_key(user,used_atom)
|
|
||||||
if(diff)
|
|
||||||
if(custom_action(index, diff, used_atom, user))
|
|
||||||
update_index(diff,user)
|
|
||||||
return 1
|
|
||||||
return 0
|
|
||||||
|
|
||||||
custom_action(index, diff, used_atom, user)
|
|
||||||
if(!..(index,used_atom,user))
|
|
||||||
return 0
|
return 0
|
||||||
return 1
|
return FORWARD //to the first step -> forward
|
||||||
|
if(step_back && (islist(step_back[Co_KEY]) && is_type_in_list(used_atom, step_back[Co_KEY])) || istype(used_atom, step_back[Co_KEY]))
|
||||||
|
if(!try_consume(user, used_atom, step_back, index, BACKWARD))
|
||||||
|
assembling = 0
|
||||||
|
return 0
|
||||||
|
return BACKWARD //to the last step -> backwards
|
||||||
|
assembling = 0
|
||||||
|
return 0
|
||||||
|
|
||||||
#define state_next "next"
|
/datum/construction/reversible/check_step(atom/used_atom,mob/user as mob)
|
||||||
#define state_prev "prev"
|
var/diff = is_right_key(user,used_atom)
|
||||||
|
if(diff)
|
||||||
|
assembling = 1
|
||||||
|
if(custom_action(index, diff, used_atom, user))
|
||||||
|
update_index(diff,user)
|
||||||
|
assembling = 0
|
||||||
|
return 1
|
||||||
|
assembling = 0
|
||||||
|
return 0
|
||||||
|
|
||||||
/datum/construction/reversible2
|
/datum/construction/reversible/custom_action(index, diff, used_atom, user)
|
||||||
var/index
|
. = ..(index,used_atom,user)
|
||||||
var/base_icon = "durand"
|
|
||||||
|
|
||||||
New(atom)
|
if(.)
|
||||||
..()
|
construct_message(steps[index], user, diff, 1)
|
||||||
index = 1
|
|
||||||
|
/datum/construction/reversible/construct_message(step, mob/user, diff, override)
|
||||||
|
if(!override)
|
||||||
return
|
return
|
||||||
|
var/message_step
|
||||||
|
if(diff == FORWARD && (Co_NEXTSTEP in step))
|
||||||
|
message_step = step[Co_NEXTSTEP]
|
||||||
|
else if (Co_BACKSTEP in step)
|
||||||
|
message_step = step[Co_BACKSTEP]
|
||||||
|
if(message_step)
|
||||||
|
user.visible_message(fixText(message_step[Co_VIS_MSG],user), fixText(message_step[Co_VIS_MSG],user,1))
|
||||||
|
|
||||||
proc/update_index(diff as num, mob/user as mob)
|
/datum/construction/reversible/start_construct_message(step, mob/user, atom/movable/used_atom)
|
||||||
index-=diff
|
user.visible_message(fixText(step[Co_START_MSG],user), fixText(step[Co_START_MSG],user,1))
|
||||||
if(index==steps.len+1)
|
|
||||||
spawn_result(user)
|
/datum/construction/reversible/add_max_amounts()
|
||||||
|
for(var/i = 1; i <= steps.len; i++)
|
||||||
|
var/list/dir_step = get_forward_step(i)
|
||||||
|
if((Co_AMOUNT in dir_step))
|
||||||
|
dir_step.Add(list(Co_MAX_AMOUNT = dir_step[Co_AMOUNT])) //puts in something we can refer to when we reset the step
|
||||||
|
|
||||||
|
dir_step = get_backward_step(i)
|
||||||
|
if((Co_AMOUNT in dir_step))
|
||||||
|
dir_step.Add(list(Co_MAX_AMOUNT = dir_step[Co_AMOUNT]))
|
||||||
|
|
||||||
|
//NOT IN PLACE: message segments like verbs can be written as {UN|forwardmessage|backwardmessage}. This formats that in selection
|
||||||
|
/datum/construction/reversible/fixText(message, mob/user, self = 0)
|
||||||
|
return ..(message, user, self)
|
||||||
|
/*
|
||||||
|
while("{UN|" in text)
|
||||||
|
var/start_bracket = findtext(text, "{")
|
||||||
|
var/this_verb = copytext(text, start_bracket, findtext(text, "}", start_bracket + 1))
|
||||||
|
world << this_verb
|
||||||
|
var/marker = findtext(this_verb, "|")
|
||||||
|
var/final_verb = ""
|
||||||
|
if(diff == FORWARD)
|
||||||
|
final_verb = copytext(this_verb, marker + 1, findtext(this_verb, "|", marker + 1))
|
||||||
|
else
|
||||||
|
final_verb = copytext(this_verb, findtext(this_verb, "|", marker + 1), findtext(text, "}", start_bracket + 1))
|
||||||
|
world << final_verb
|
||||||
|
replacetext(text, this_verb, final_verb)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/datum/construction/reversible/try_consume(mob/user as mob, atom/movable/used_atom, given_step, index, diff)
|
||||||
|
//if we've made some progress on a step, we want to drop it
|
||||||
|
var/current_step = (diff == BACKWARD ? get_forward_step(index) : get_backward_step(index))
|
||||||
|
if(current_step && (Co_AMOUNT in current_step) && (Co_MAX_AMOUNT in current_step) && (current_step[Co_AMOUNT] < current_step[Co_MAX_AMOUNT]))
|
||||||
|
var/obj/item/stack/S
|
||||||
|
if(used_atoms["[index][diff == FORWARD ? "+" : "-"]"])
|
||||||
|
for(var/atom/movable/A in used_atoms["[index][diff == FORWARD ? "+" : "-"]"])
|
||||||
|
A.loc = holder.loc
|
||||||
|
used_atoms.Remove("[index][diff == FORWARD ? "+" : "-"]")
|
||||||
else
|
else
|
||||||
set_desc(index)
|
var/working_type = (islist(current_step[Co_KEY]) ? pick(current_step[Co_KEY]) : current_step[Co_KEY])
|
||||||
return
|
S = new working_type(holder.loc)
|
||||||
|
if(istype(S) && !(Co_KEEP in current_step))
|
||||||
|
S.amount = current_step[Co_MAX_AMOUNT] - current_step[Co_AMOUNT]
|
||||||
|
S.update_icon()
|
||||||
|
else
|
||||||
|
for(var/i = 2; i <= current_step[Co_MAX_AMOUNT] - current_step[Co_AMOUNT]; i++)
|
||||||
|
new working_type(holder.loc)
|
||||||
|
current_step[Co_AMOUNT] = current_step[Co_MAX_AMOUNT]
|
||||||
|
|
||||||
proc/update_icon()
|
var/delay = 0
|
||||||
holder.icon_state="[base_icon]_[index]"
|
if(Co_DELAY in given_step)
|
||||||
|
delay = given_step[Co_DELAY]
|
||||||
is_right_key(mob/user as mob,atom/used_atom) // returns index step
|
if(delay > 0)
|
||||||
var/list/state = steps[index]
|
start_construct_message(given_step, user, used_atom)
|
||||||
if(state_next in state)
|
if(!do_after(user, delay, needhand = 1))
|
||||||
var/list/step = state[state_next]
|
|
||||||
if(istype(used_atom, step["key"]))
|
|
||||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
|
||||||
// return 0
|
|
||||||
return FORWARD //to the first step -> forward
|
|
||||||
else if(state_prev in state)
|
|
||||||
var/list/step = state[state_prev]
|
|
||||||
if(istype(used_atom, step["key"]))
|
|
||||||
//if(L["consume"] && !try_consume(used_atom,L["consume"]))
|
|
||||||
// return 0
|
|
||||||
return BACKWARD //to the first step -> forward
|
|
||||||
return 0
|
|
||||||
|
|
||||||
check_step(atom/used_atom,mob/user as mob)
|
|
||||||
var/diff = is_right_key(user,used_atom)
|
|
||||||
if(diff)
|
|
||||||
if(custom_action(index, diff, used_atom, user))
|
|
||||||
update_index(diff,user)
|
|
||||||
update_icon()
|
|
||||||
return 1
|
|
||||||
return 0
|
|
||||||
|
|
||||||
proc/fixText(text,user)
|
|
||||||
text = replacetext(text,"{USER}","[user]")
|
|
||||||
text = replacetext(text,"{HOLDER}","[holder]")
|
|
||||||
return text
|
|
||||||
|
|
||||||
custom_action(index, diff, used_atom, var/mob/user)
|
|
||||||
if(!..(index,used_atom,user))
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/list/step = steps[index]
|
var/amount = 0
|
||||||
var/list/state = step[diff==FORWARD ? state_next : state_prev]
|
if(Co_AMOUNT in given_step)
|
||||||
user.visible_message(fixText(state["vis_msg"],user),fixText(state["self_msg"],user))
|
amount = given_step[Co_AMOUNT]
|
||||||
|
if(amount > 0)
|
||||||
|
// STACKS
|
||||||
|
if(istype(used_atom,/obj/item/stack) && !(Co_TAKE in given_step))
|
||||||
|
var/obj/item/stack/stack=used_atom
|
||||||
|
if(stack.amount < amount)
|
||||||
|
user << "<span class='notice'>You start adding [stack] to \the [holder]. It still needs [amount - stack.amount] [stack.singular_name].</span>"
|
||||||
|
given_step[Co_AMOUNT] -= stack.amount
|
||||||
|
stack.use(stack.amount)
|
||||||
|
return 0
|
||||||
|
stack.use(amount)
|
||||||
|
// WELDER
|
||||||
|
else if(istype(used_atom,/obj/item/weapon/weldingtool) && !(Co_TAKE in given_step))
|
||||||
|
var/obj/item/weapon/weldingtool/welder=used_atom
|
||||||
|
if(!welder.isOn())
|
||||||
|
user << "<span class='notice'>You tap the [holder] with your unlit welder. [pick("Ding","Dong")].</span>"
|
||||||
|
return 0
|
||||||
|
if(!welder.remove_fuel(amount,user))
|
||||||
|
user << "<span class='rose'>You don't have enough fuel!</span>"
|
||||||
|
return 0
|
||||||
|
//generic things
|
||||||
|
else
|
||||||
|
var/atom_name = used_atom.name
|
||||||
|
if(permanence || (Co_KEEP in given_step))
|
||||||
|
user.drop_item(holder)
|
||||||
|
used_atom.loc = holder
|
||||||
|
if(!("[index][diff == FORWARD ? "+" : "-"]" in used_atoms))
|
||||||
|
used_atoms.Add(list("[index][diff == FORWARD ? "+" : "-"]" = list()))
|
||||||
|
used_atoms["[index][diff == FORWARD ? "+" : "-"]"] += used_atom
|
||||||
|
else
|
||||||
|
qdel(used_atom)
|
||||||
|
given_step[Co_AMOUNT]--
|
||||||
|
if(given_step[Co_AMOUNT] > 0)
|
||||||
|
user << "<span class='notice'>You add \a [atom_name] to \the [holder]. It still needs [amount -1 ] [atom_name]\s.</span>"
|
||||||
|
return 0
|
||||||
|
given_step[Co_AMOUNT] = given_step[Co_MAX_AMOUNT]
|
||||||
|
|
||||||
if("delete" in state)
|
else
|
||||||
qdel(used_atom)
|
var/list/spawn_step
|
||||||
else if("spawn" in state)
|
var/new_index = (diff == FORWARD ? index - 1 : index + 1)
|
||||||
var/spawntype=state["spawn"]
|
if(diff == FORWARD)
|
||||||
var/atom/A = new spawntype(holder.loc)
|
spawn_step = get_backward_step(new_index)
|
||||||
if("amount" in state)
|
else if(diff == BACKWARD)
|
||||||
if(istype(A,/obj/item/stack/cable_coil))
|
spawn_step = get_forward_step(new_index)
|
||||||
var/obj/item/stack/cable_coil/C=A
|
var/list/atom/movable/to_drop = list()
|
||||||
C.amount=state["amount"]
|
|
||||||
if(istype(A,/obj/item/stack))
|
|
||||||
var/obj/item/stack/S=A
|
|
||||||
S.amount=state["amount"]
|
|
||||||
|
|
||||||
return 1
|
if(("[new_index][diff == FORWARD ? "-" : "+"]" in used_atoms) && used_atoms["[new_index][diff == FORWARD ? "-" : "+"]"])
|
||||||
action(used_atom,user)
|
to_drop = used_atoms["[new_index][diff == FORWARD ? "-" : "+"]"]
|
||||||
return check_step(used_atom,user)
|
used_atoms.Remove("[new_index][diff == FORWARD ? "-" : "+"]")
|
||||||
|
|
||||||
|
else if(Co_AMOUNT in spawn_step)
|
||||||
|
var/to_create = (islist(spawn_step[Co_KEY]) ? pick(spawn_step[Co_KEY]) : spawn_step[Co_KEY])
|
||||||
|
var/test = new to_create
|
||||||
|
if(istype(test, /obj/item/weapon/weldingtool) && !(Co_TAKE in spawn_step))
|
||||||
|
qdel(test)
|
||||||
|
else if(istype(test, /obj/item/stack) && !(Co_TAKE in spawn_step))
|
||||||
|
var/obj/item/stack/S = test
|
||||||
|
S.amount = spawn_step[Co_AMOUNT]
|
||||||
|
to_drop.Add(S)
|
||||||
|
else
|
||||||
|
to_drop.Add(test)
|
||||||
|
for(var/i = 1; i <= spawn_step[Co_AMOUNT] - 1; i++)
|
||||||
|
to_drop.Add(new to_create)
|
||||||
|
|
||||||
|
for(var/atom/movable/this_drop in to_drop)
|
||||||
|
this_drop.loc = holder.loc
|
||||||
|
return 1
|
||||||
|
|
||||||
|
/datum/construction/reversible/proc/get_forward_step(index)
|
||||||
|
if(index < 0 || index > steps.len)
|
||||||
|
return
|
||||||
|
var/list/S = steps[index]
|
||||||
|
if(Co_NEXTSTEP in S)
|
||||||
|
return S[Co_NEXTSTEP]
|
||||||
|
|
||||||
|
/datum/construction/reversible/proc/get_backward_step(index)
|
||||||
|
if(index < 0 || index > steps.len)
|
||||||
|
return
|
||||||
|
var/list/S = steps[index]
|
||||||
|
if(Co_BACKSTEP in S)
|
||||||
|
return S[Co_BACKSTEP]
|
||||||
154
code/game/mecha/mecha_construction_chassis.dm
Normal file
154
code/game/mecha/mecha_construction_chassis.dm
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
/datum/construction/mecha_chassis
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/custom_action(step, atom/used_atom, mob/user)
|
||||||
|
user.visible_message("[user] has connected [used_atom] to [holder].", "You connect [used_atom] to [holder]")
|
||||||
|
holder.overlays += used_atom.icon_state+"+o"
|
||||||
|
del used_atom
|
||||||
|
return 1
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/action(atom/used_atom,mob/user as mob)
|
||||||
|
return check_all_steps(used_atom,user)
|
||||||
|
|
||||||
|
|
||||||
|
// RIPLEY //
|
||||||
|
/datum/construction/mecha_chassis/ripley
|
||||||
|
steps = list(list(Co_KEY=/obj/item/mecha_parts/part/ripley_torso),//1
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/ripley_left_arm),//2
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/ripley_right_arm),//3
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/ripley_left_leg),//4
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/ripley_right_leg)//5
|
||||||
|
)
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/ripley/spawn_result(mob/user as mob)
|
||||||
|
var/obj/item/mecha_parts/chassis/const_holder = holder
|
||||||
|
const_holder.construct = new /datum/construction/reversible/mecha/ripley(const_holder)
|
||||||
|
const_holder.icon = 'icons/mecha/mech_construction.dmi'
|
||||||
|
const_holder.icon_state = "ripley0"
|
||||||
|
const_holder.density = 1
|
||||||
|
const_holder.overlays.len = 0
|
||||||
|
spawn()
|
||||||
|
del src
|
||||||
|
return
|
||||||
|
|
||||||
|
// FIREFIGHTER //
|
||||||
|
/datum/construction/mecha_chassis/firefighter
|
||||||
|
steps = list(list(Co_KEY=/obj/item/mecha_parts/part/ripley_torso),//1
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/ripley_left_arm),//2
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/ripley_right_arm),//3
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/ripley_left_leg),//4
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/ripley_right_leg),//5
|
||||||
|
list(Co_KEY=/obj/item/clothing/suit/fire)//6
|
||||||
|
)
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/firefighter/spawn_result(mob/user as mob)
|
||||||
|
var/obj/item/mecha_parts/chassis/const_holder = holder
|
||||||
|
const_holder.construct = new /datum/construction/reversible/mecha/firefighter(const_holder)
|
||||||
|
const_holder.icon = 'icons/mecha/mech_construction.dmi'
|
||||||
|
const_holder.icon_state = "firefighter0"
|
||||||
|
const_holder.density = 1
|
||||||
|
spawn()
|
||||||
|
del src
|
||||||
|
return
|
||||||
|
|
||||||
|
// GYGAX //
|
||||||
|
/datum/construction/mecha_chassis/gygax
|
||||||
|
steps = list(list(Co_KEY=/obj/item/mecha_parts/part/gygax_torso),//1
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/gygax_left_arm),//2
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/gygax_right_arm),//3
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/gygax_left_leg),//4
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/gygax_right_leg),//5
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/gygax_head)
|
||||||
|
)
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/gygax/spawn_result(mob/user as mob)
|
||||||
|
var/obj/item/mecha_parts/chassis/const_holder = holder
|
||||||
|
const_holder.construct = new /datum/construction/reversible/mecha/combat/gygax(const_holder)
|
||||||
|
const_holder.icon = 'icons/mecha/mech_construction.dmi'
|
||||||
|
const_holder.icon_state = "gygax0"
|
||||||
|
const_holder.density = 1
|
||||||
|
spawn()
|
||||||
|
del src
|
||||||
|
return
|
||||||
|
|
||||||
|
// DURAND //
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/durand
|
||||||
|
steps = list(list(Co_KEY=/obj/item/mecha_parts/part/durand_torso),//1
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/durand_left_arm),//2
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/durand_right_arm),//3
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/durand_left_leg),//4
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/durand_right_leg),//5
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/durand_head)
|
||||||
|
)
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/durand/spawn_result(mob/user as mob)
|
||||||
|
var/obj/item/mecha_parts/chassis/const_holder = holder
|
||||||
|
const_holder.construct = new /datum/construction/reversible/mecha/combat/durand(const_holder)
|
||||||
|
const_holder.icon = 'icons/mecha/mech_construction.dmi'
|
||||||
|
const_holder.icon_state = "durand0"
|
||||||
|
const_holder.density = 1
|
||||||
|
spawn()
|
||||||
|
del src
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
// ODYSSEUS //
|
||||||
|
/datum/construction/mecha_chassis/odysseus
|
||||||
|
steps = list(list(Co_KEY=/obj/item/mecha_parts/part/odysseus_torso),//1
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/odysseus_head),//2
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/odysseus_left_arm),//3
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/odysseus_right_arm),//4
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/odysseus_left_leg),//5
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/odysseus_right_leg)//6
|
||||||
|
)
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/odysseus/spawn_result(mob/user as mob)
|
||||||
|
var/obj/item/mecha_parts/chassis/const_holder = holder
|
||||||
|
const_holder.construct = new /datum/construction/reversible/mecha/odysseus(const_holder)
|
||||||
|
const_holder.icon = 'icons/mecha/mech_construction.dmi'
|
||||||
|
const_holder.icon_state = "odysseus0"
|
||||||
|
const_holder.density = 1
|
||||||
|
spawn()
|
||||||
|
del src
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
// PHAZON //
|
||||||
|
/datum/construction/mecha_chassis/phazon
|
||||||
|
result = "/obj/mecha/combat/phazon"
|
||||||
|
steps = list(list(Co_KEY=/obj/item/mecha_parts/part/phazon_torso),//1
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/phazon_left_arm),//2
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/phazon_right_arm),//3
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/phazon_left_leg),//4
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/phazon_right_leg),//5
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/phazon_head)
|
||||||
|
)
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/phazon/spawn_result(mob/user as mob)
|
||||||
|
var/obj/item/mecha_parts/chassis/const_holder = holder
|
||||||
|
const_holder.construct = new /datum/construction/reversible/mecha/phazon(const_holder)
|
||||||
|
const_holder.icon = 'icons/mecha/mech_construction.dmi'
|
||||||
|
const_holder.icon_state = "phazon0"
|
||||||
|
const_holder.density = 1
|
||||||
|
spawn()
|
||||||
|
del src
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
////////////HONK////////////////
|
||||||
|
/datum/construction/mecha_chassis/honker
|
||||||
|
steps = list(list(Co_KEY=/obj/item/mecha_parts/part/honker_torso),//1
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/honker_left_arm),//2
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/honker_right_arm),//3
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/honker_left_leg),//4
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/honker_right_leg),//5
|
||||||
|
list(Co_KEY=/obj/item/mecha_parts/part/honker_head)
|
||||||
|
)
|
||||||
|
|
||||||
|
/datum/construction/mecha_chassis/honker/spawn_result(mob/user as mob)
|
||||||
|
var/obj/item/mecha_parts/chassis/const_holder = holder
|
||||||
|
const_holder.construct = new /datum/construction/reversible/mecha/honker(const_holder)
|
||||||
|
const_holder.density = 1
|
||||||
|
spawn()
|
||||||
|
del src
|
||||||
|
return
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
New()
|
New()
|
||||||
..()
|
..()
|
||||||
construct = new /datum/construction/mecha/ripley_chassis(src)
|
construct = new /datum/construction/mecha_chassis/ripley(src)
|
||||||
|
|
||||||
/obj/item/mecha_parts/part/ripley_torso
|
/obj/item/mecha_parts/part/ripley_torso
|
||||||
name="Ripley Torso"
|
name="Ripley Torso"
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
|
|
||||||
New()
|
New()
|
||||||
..()
|
..()
|
||||||
construct = new /datum/construction/mecha/gygax_chassis(src)
|
construct = new /datum/construction/mecha_chassis/gygax(src)
|
||||||
|
|
||||||
/obj/item/mecha_parts/part/gygax_torso
|
/obj/item/mecha_parts/part/gygax_torso
|
||||||
name="Gygax Torso"
|
name="Gygax Torso"
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
|
|
||||||
New()
|
New()
|
||||||
..()
|
..()
|
||||||
construct = new /datum/construction/mecha/durand_chassis(src)
|
construct = new /datum/construction/mecha_chassis/durand(src)
|
||||||
|
|
||||||
/obj/item/mecha_parts/part/durand_torso
|
/obj/item/mecha_parts/part/durand_torso
|
||||||
name="Durand Torso"
|
name="Durand Torso"
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
|
|
||||||
New()
|
New()
|
||||||
..()
|
..()
|
||||||
construct = new /datum/construction/mecha/firefighter_chassis(src)
|
construct = new /datum/construction/mecha_chassis/firefighter(src)
|
||||||
/*
|
/*
|
||||||
/obj/item/mecha_parts/part/firefighter_torso
|
/obj/item/mecha_parts/part/firefighter_torso
|
||||||
name="Ripley-on-Fire Torso"
|
name="Ripley-on-Fire Torso"
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
|
|
||||||
New()
|
New()
|
||||||
..()
|
..()
|
||||||
construct = new /datum/construction/mecha/honker_chassis(src)
|
construct = new /datum/construction/mecha_chassis/honker(src)
|
||||||
|
|
||||||
/obj/item/mecha_parts/part/honker_torso
|
/obj/item/mecha_parts/part/honker_torso
|
||||||
name="H.O.N.K Torso"
|
name="H.O.N.K Torso"
|
||||||
@@ -233,7 +233,7 @@
|
|||||||
|
|
||||||
New()
|
New()
|
||||||
..()
|
..()
|
||||||
construct = new /datum/construction/mecha/phazon_chassis(src)
|
construct = new /datum/construction/mecha_chassis/phazon(src)
|
||||||
|
|
||||||
/obj/item/mecha_parts/part/phazon_torso
|
/obj/item/mecha_parts/part/phazon_torso
|
||||||
name="Phazon Torso"
|
name="Phazon Torso"
|
||||||
@@ -278,7 +278,7 @@
|
|||||||
|
|
||||||
New()
|
New()
|
||||||
..()
|
..()
|
||||||
construct = new /datum/construction/mecha/odysseus_chassis(src)
|
construct = new /datum/construction/mecha_chassis/odysseus(src)
|
||||||
|
|
||||||
/obj/item/mecha_parts/part/odysseus_head
|
/obj/item/mecha_parts/part/odysseus_head
|
||||||
name="Odysseus Head"
|
name="Odysseus Head"
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Reference in New Issue
Block a user