OH GOD YOU CAN BUILD PODS NOW OH GOD

Conflicts:
	code/datums/helper_datums/construction_datum.dm
	code/game/machinery/constructable_frame.dm
	code/game/mecha/mech_fabricator.dm
	code/game/mecha/mecha_construction_paths.dm
	code/game/mecha/mecha_parts.dm
	html/changelog.html
	maps/tgstation.2.1.0.0.1.dmm
This commit is contained in:
Rob Nelson
2014-05-16 02:03:17 -07:00
committed by ZomgPonies
parent bfdf7cc217
commit e7d4c1db14
10 changed files with 468 additions and 71 deletions
@@ -0,0 +1,222 @@
/obj/structure/spacepod_frame
density = 1
opacity = 0
anchored = 1
layer = 3.9
icon = 'icons/48x48/pod_construction.dmi'
icon_state = "pod_1"
var/datum/construction/construct
/obj/structure/spacepod_frame/New()
..()
bound_width = 64
bound_height = 64
construct = new /datum/construction/reversible2/pod(src)
dir = EAST
/obj/structure/spacepod_frame/attackby(obj/item/W as obj, mob/user as mob)
if(!construct || !construct.action(W, user))
..()
return
/obj/structure/spacepod_frame/attack_hand()
return
/////////////////////////////////
// CONSTRUCTION STEPS
/////////////////////////////////
/datum/construction/reversible2/pod
result = /obj/spacepod/civilian
base_icon="pod"
//taskpath = /datum/job_objective/make_pod
steps = list(
// 1. Initial state
list(
"desc" = "An empty pod frame.",
state_next = list(
"key" = /obj/item/stack/cable_coil,
"vis_msg" = "{USER} wires the {HOLDER}.",
"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(
"key" = /obj/item/weapon/screwdriver,
"vis_msg" = "{USER} adjusts the wiring.",
"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/stack/sheet/plasteel,
"amount" = 5,
"vis_msg" = "{USER} installs the {HOLDER}'s plasteel armor.",
"self_msg" = "You install the {HOLDER}'s plasteel armor."
)
),
// 11. Loose armor
list(
"desc" = "A space pod with unsecured armor.",
state_prev = list(
"key" = /obj/item/weapon/crowbar,
"vis_msg" = "{USER} pries off {HOLDER}'s armor.",
"self_msg" = "You pry off {HOLDER}'s armor."
),
state_next = list(
"key" = /obj/item/weapon/wrench,
"vis_msg" = "{USER} bolts down the {HOLDER}'s armor.",
"self_msg" = "You bolt down the {HOLDER}'s armor."
)
),
// 12. Bolted-down armor
list(
"desc" = "A space pod with unsecured armor.",
state_prev = list(
"key" = /obj/item/weapon/wrench,
"vis_msg" = "{USER} unsecures the {HOLDER}'s armor.",
"self_msg" = "You unsecure the {HOLDER}'s armor."
),
state_next = list(
"key" = /obj/item/weapon/weldingtool,
"vis_msg" = "{USER} welds the {HOLDER}'s armor.",
"self_msg" = "You weld the {HOLDER}'s armor."
)
)
// EOF
)
spawn_result(mob/user as mob)
..()
feedback_inc("spacepod_created",1)
return
@@ -0,0 +1,10 @@
/obj/item/pod_parts
parent_type = /obj/item/mecha_parts
icon = 'icons/pods/equipment.dmi'
/obj/item/pod_parts/core
name="Space Pod Core"
icon_state = "core"
construction_cost = list("iron"=5000,"uranium"=1000,"plasma"=5000)
flags = FPRINT | CONDUCT
origin_tech = "programming=2;materials=3;bluespace=2;engineering=3"
+138 -1
View File
@@ -43,6 +43,36 @@
return 0
proc/custom_action(step, used_atom, user)
if(istype(used_atom, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/W = used_atom
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))
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)
else if(istype(used_atom, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = used_atom
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
proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one.
@@ -75,6 +105,33 @@
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
var/index
@@ -108,4 +165,84 @@
return 0
custom_action(index, diff, used_atom, user)
return 1
if(!..(index,used_atom,user))
return 0
return 1
#define state_next "next"
#define state_prev "prev"
/datum/construction/reversible2
var/index
var/base_icon = "durand"
New(atom)
..()
index = 1
return
proc/update_index(diff as num, mob/user as mob)
index-=diff
if(index==steps.len+1)
spawn_result(user)
else
set_desc(index)
return
proc/update_icon()
holder.icon_state="[base_icon]_[index]"
is_right_key(mob/user as mob,atom/used_atom) // returns index step
var/list/state = steps[index]
if(state_next in state)
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
var/list/step = steps[index]
var/list/state = step[diff==FORWARD ? state_next : state_prev]
user.visible_message(fixText(state["vis_msg"],user),fixText(state["self_msg"],user))
if("delete" in state)
del(used_atom)
else if("spawn" in state)
var/spawntype=state["spawn"]
var/atom/A = new spawntype(holder.loc)
if("amount" in state)
if(istype(A,/obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C=A
C.amount=state["amount"]
if(istype(A,/obj/item/stack))
var/obj/item/stack/S=A
S.amount=state["amount"]
return 1
action(used_atom,user)
return check_step(used_atom,user)
@@ -13,6 +13,10 @@
var/list/req_component_names = null
var/state = 1
// For pods
var/list/connected_parts = list()
var/pattern_idx=0
proc/update_desc()
var/D
if(req_components)
@@ -28,6 +32,48 @@
desc = D
/obj/machinery/constructable_frame/machine_frame
proc/find_square()
// This is fucking stupid but what the hell.
// This corresponds to indicies from alldirs.
// 1 2 3 4 5 6 7 8
// var/list/alldirs = list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)
var/valid_patterns=list(
list(1,3,5), //SW - NORTH,EAST,NORTHEAST
list(2,3,7), //NW - SOUTH,EAST,SOUTHEAST
list(1,4,6), //SE - NORTH,WEST,NORTHWEST
list(2,4,8) //NE - SOUTH,WEST,SOUTHWEST
)
var/detected_parts[8]
var/tally=0
var/turf/T
var/obj/machinery/constructable_frame/machine_frame/friend
for(var/i=1;i<=8;i++)
T=get_step(src.loc,alldirs[i])
friend = locate() in T
if(friend)
detected_parts[i]=friend
tally++
// Need at least 3 connections to make a square
if(tally<3)
return
// Find stuff in the patterns indicated
for(var/i=1;i<=4;i++)
var/list/scanidxs=valid_patterns[i]
var/list/new_connected=list()
var/allfound=1
for(var/diridx in scanidxs)
if(detected_parts[diridx]==null)
allfound=0
break
new_connected.Add(detected_parts[diridx])
if(allfound)
connected_parts=new_connected
pattern_idx=i
return 1
return 0
attackby(obj/item/P as obj, mob/user as mob)
if(P.crit_fail)
user << "\red This part is faulty, you cannot add this to the machine!"
@@ -46,6 +92,48 @@
user << "\blue You add cables to the frame."
state = 2
icon_state = "box_1"
/*
else if(istype(P, /obj/item/stack/sheet/glass))
var/obj/item/stack/sheet/glass/G=P
if(G.amount<1)
user << "\red How...?"
return
G.use(1)
user << "\blue You add the glass to the frame."
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
new /obj/structure/displaycase_frame(src.loc)
del(src)
return*/
else if(istype(P, /obj/item/stack/rods))
var/obj/item/stack/rods/R=P
if(R.amount<10)
user << "\red You need 10 rods to assemble a pod frame."
return
if(!find_square())
user << "\red You cannot assemble a pod frame without a 2x2 square of machine frames."
return
R.use(10)
for(var/obj/machinery/constructable_frame/machine_frame/F in connected_parts)
qdel(F)
var/turf/T=get_turf(src)
// Offset frame (if needed) so it doesn't look wonky when it spawns.
switch(pattern_idx)
if(2)
T=get_step(T,SOUTH)
if(3)
T=get_step(T,WEST)
if(4)
T=get_step(T,SOUTHWEST)
new /obj/structure/spacepod_frame(T)
user << "\blue You assemble the pod frame."
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
qdel(src)
return
else
if(istype(P, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
+3 -4
View File
@@ -129,10 +129,9 @@
/obj/item/borg/upgrade/jetpack
),
"Space Pod" = list(
/obj/item/pod_parts/core
),
"Misc"=list(/obj/item/mecha_parts/mecha_tracking)
)
+1 -66
View File
@@ -2,72 +2,7 @@
///// Construction datums //////
////////////////////////////////
/datum/construction/mecha/custom_action(step, atom/used_atom, mob/user)
if(istype(used_atom, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/W = used_atom
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))
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)
else if(istype(used_atom, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = used_atom
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
/datum/construction/reversible/mecha/custom_action(index as num, diff as num, atom/used_atom, mob/user as mob)
if(istype(used_atom, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/W = used_atom
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))
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)
else if(istype(used_atom, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = used_atom
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
// custom_actions moved to construction_datum - N3X
/datum/construction/mecha/ripley_chassis
steps = list(list("key"=/obj/item/mecha_parts/part/ripley_torso),//1
+4
View File
@@ -479,4 +479,8 @@
name = "Circuit board (Odysseus Central Control module)"
icon_state = "mainboard"
pod
name = "Circuit board (Space Pod Mainboard)"
icon_state = "mainboard"