cbt
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
/obj/structure/frame/machine/examine(user)
|
||||
. = ..()
|
||||
if(state == 3 && req_components && req_component_names)
|
||||
var/hasContent = 0
|
||||
var/hasContent = FALSE
|
||||
var/requires = "It requires"
|
||||
|
||||
for(var/i = 1 to req_components.len)
|
||||
@@ -46,10 +46,10 @@
|
||||
continue
|
||||
var/use_and = i == req_components.len
|
||||
requires += "[(hasContent ? (use_and ? ", and" : ",") : "")] [amt] [amt == 1 ? req_component_names[tname] : "[req_component_names[tname]]\s"]"
|
||||
hasContent = 1
|
||||
hasContent = TRUE
|
||||
|
||||
if(hasContent)
|
||||
. += requires + "."
|
||||
. += "[requires]."
|
||||
else
|
||||
. += "It does not require any more components."
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
amt += req_components[path]
|
||||
return amt
|
||||
|
||||
/obj/structure/frame/machine/attackby(obj/item/P, mob/user, params)
|
||||
/obj/structure/frame/machine/attackby(obj/item/P, mob/living/user, params)
|
||||
switch(state)
|
||||
if(1)
|
||||
if(istype(P, /obj/item/circuitboard/machine))
|
||||
@@ -88,6 +88,7 @@
|
||||
if(istype(P, /obj/item/stack/cable_coil))
|
||||
if(!P.tool_start_check(user, amount=5))
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You start to add cables to the frame...</span>")
|
||||
if(P.use_tool(src, user, 20, volume=50, amount=5, extra_checks = CALLBACK(src, .proc/check_state, 1)))
|
||||
to_chat(user, "<span class='notice'>You add cables to the frame.</span>")
|
||||
@@ -97,39 +98,41 @@
|
||||
return
|
||||
if(P.tool_behaviour == TOOL_SCREWDRIVER && !anchored)
|
||||
user.visible_message("<span class='warning'>[user] disassembles the frame.</span>", \
|
||||
"<span class='notice'>You start to disassemble the frame...</span>", "You hear banging and clanking.")
|
||||
"<span class='notice'>You start to disassemble the frame...</span>", "<span class='hear'>You hear banging and clanking.</span>")
|
||||
if(P.use_tool(src, user, 40, volume=50, extra_checks = CALLBACK(src, .proc/check_state, 1)))
|
||||
to_chat(user, "<span class='notice'>You disassemble the frame.</span>")
|
||||
var/obj/item/stack/sheet/metal/M = new (loc, 5)
|
||||
M.add_fingerprint(user)
|
||||
qdel(src)
|
||||
if(state == 1)
|
||||
to_chat(user, "<span class='notice'>You disassemble the frame.</span>")
|
||||
var/obj/item/stack/sheet/metal/M = new (loc, 5)
|
||||
M.add_fingerprint(user)
|
||||
qdel(src)
|
||||
return
|
||||
if(P.tool_behaviour == TOOL_WRENCH)
|
||||
to_chat(user, "<span class='notice'>You start [anchored ? "un" : ""]securing [name]...</span>")
|
||||
to_chat(user, "<span class='notice'>You start [anchored ? "un" : ""]securing [src]...</span>")
|
||||
if(P.use_tool(src, user, 40, volume=75, extra_checks = CALLBACK(src, .proc/check_state, 1)))
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [name].</span>")
|
||||
setAnchored(!anchored)
|
||||
if(state == 1)
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [src].</span>")
|
||||
set_anchored(!anchored)
|
||||
return
|
||||
|
||||
if(2)
|
||||
if(P.tool_behaviour == TOOL_WRENCH)
|
||||
to_chat(user, "<span class='notice'>You start [anchored ? "un" : ""]securing [name]...</span>")
|
||||
to_chat(user, "<span class='notice'>You start [anchored ? "un" : ""]securing [src]...</span>")
|
||||
if(P.use_tool(src, user, 40, volume=75, extra_checks = CALLBACK(src, .proc/check_state, 2)))
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [name].</span>")
|
||||
setAnchored(!anchored)
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [src].</span>")
|
||||
set_anchored(!anchored)
|
||||
return
|
||||
|
||||
if(istype(P, /obj/item/circuitboard/machine))
|
||||
var/obj/item/circuitboard/machine/B = P
|
||||
if(!B.build_path)
|
||||
to_chat(user, "<span class'warning'>This circuitboard seems to be broken.</span>")
|
||||
to_chat(user, "<span class='warning'>This circuitboard seems to be broken.</span>")
|
||||
return
|
||||
if(!anchored && B.needs_anchored)
|
||||
to_chat(user, "<span class='warning'>The frame needs to be secured first!</span>")
|
||||
return
|
||||
if(!user.transferItemToLoc(B, src))
|
||||
return
|
||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
|
||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
to_chat(user, "<span class='notice'>You add the circuit board to the frame.</span>")
|
||||
circuit = B
|
||||
icon_state = "box_2"
|
||||
@@ -171,34 +174,49 @@
|
||||
return
|
||||
|
||||
if(P.tool_behaviour == TOOL_WRENCH && !circuit.needs_anchored)
|
||||
to_chat(user, "<span class='notice'>You start [anchored ? "un" : ""]securing [name]...</span>")
|
||||
to_chat(user, "<span class='notice'>You start [anchored ? "un" : ""]securing [src]...</span>")
|
||||
if(P.use_tool(src, user, 40, volume=75, extra_checks = CALLBACK(src, .proc/check_state, 3)))
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [name].</span>")
|
||||
setAnchored(!anchored)
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [src].</span>")
|
||||
set_anchored(!anchored)
|
||||
return
|
||||
|
||||
if(P.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
var/component_check = 1
|
||||
var/component_check = TRUE
|
||||
for(var/R in req_components)
|
||||
if(req_components[R] > 0)
|
||||
component_check = 0
|
||||
component_check = FALSE
|
||||
break
|
||||
if(component_check)
|
||||
P.play_tool_sound(src)
|
||||
var/obj/machinery/new_machine = new circuit.build_path(loc)
|
||||
if(new_machine.circuit)
|
||||
QDEL_NULL(new_machine.circuit)
|
||||
new_machine.circuit = circuit
|
||||
new_machine.setAnchored(anchored)
|
||||
new_machine.on_construction()
|
||||
for(var/obj/O in new_machine.component_parts)
|
||||
qdel(O)
|
||||
new_machine.component_parts = list()
|
||||
for(var/obj/O in src)
|
||||
O.moveToNullspace()
|
||||
new_machine.component_parts += O
|
||||
circuit.moveToNullspace()
|
||||
new_machine.RefreshParts()
|
||||
if(istype(new_machine))
|
||||
// Machines will init with a set of default components. Move to nullspace so we don't trigger handle_atom_del, then qdel.
|
||||
// Finally, replace with this frame's parts.
|
||||
if(new_machine.circuit)
|
||||
// Move to nullspace and delete.
|
||||
new_machine.circuit.moveToNullspace()
|
||||
QDEL_NULL(new_machine.circuit)
|
||||
for(var/obj/old_part in new_machine.component_parts)
|
||||
// Move to nullspace and delete.
|
||||
old_part.moveToNullspace()
|
||||
qdel(old_part)
|
||||
|
||||
// Set anchor state and move the frame's parts over to the new machine.
|
||||
// Then refresh parts and call on_construction().
|
||||
|
||||
new_machine.set_anchored(anchored)
|
||||
new_machine.component_parts = list()
|
||||
|
||||
circuit.forceMove(new_machine)
|
||||
new_machine.component_parts += circuit
|
||||
new_machine.circuit = circuit
|
||||
|
||||
for(var/obj/new_part in src)
|
||||
new_part.forceMove(new_machine)
|
||||
new_machine.component_parts += new_part
|
||||
new_machine.RefreshParts()
|
||||
|
||||
new_machine.on_construction()
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
@@ -232,12 +250,15 @@
|
||||
|
||||
for(var/obj/item/part in added_components)
|
||||
if(istype(part,/obj/item/stack))
|
||||
var/obj/item/stack/S = part
|
||||
var/obj/item/stack/NS = locate(S.merge_type) in components //find a stack to merge with
|
||||
if(NS)
|
||||
S.merge(NS)
|
||||
var/obj/item/stack/incoming_stack = part
|
||||
for(var/obj/item/stack/merge_stack in components)
|
||||
if(incoming_stack.can_merge(merge_stack))
|
||||
incoming_stack.merge(merge_stack)
|
||||
if(QDELETED(incoming_stack))
|
||||
break
|
||||
if(!QDELETED(part)) //If we're a stack and we merged we might not exist anymore
|
||||
components += part
|
||||
part.forceMove(src)
|
||||
to_chat(user, "<span class='notice'>[part.name] applied.</span>")
|
||||
if(added_components.len)
|
||||
replacer.play_rped_sound()
|
||||
@@ -267,9 +288,9 @@
|
||||
to_chat(user, "<span class='notice'>You add [P] to [src].</span>")
|
||||
components += P
|
||||
req_components[I]--
|
||||
return 1
|
||||
return TRUE
|
||||
to_chat(user, "<span class='warning'>You cannot add that to the machine!</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
return ..()
|
||||
|
||||
@@ -280,5 +301,4 @@
|
||||
for(var/X in components)
|
||||
var/obj/item/I = X
|
||||
I.forceMove(loc)
|
||||
|
||||
..()
|
||||
|
||||
@@ -549,6 +549,7 @@
|
||||
contraband = TRUE
|
||||
obj_flags |= EMAGGED
|
||||
to_chat(user, "<span class='notice'>You adjust [src]'s routing and receiver spectrum, unlocking special supplies and contraband.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/item/circuitboard/computer/cargo/configure_machine(obj/machinery/computer/cargo/machine)
|
||||
if(!istype(machine))
|
||||
@@ -565,10 +566,12 @@
|
||||
build_path = /obj/machinery/computer/cargo/express
|
||||
|
||||
/obj/item/circuitboard/computer/cargo/express/emag_act(mob/living/user)
|
||||
. = ..()
|
||||
if(!(obj_flags & EMAGGED))
|
||||
contraband = TRUE
|
||||
obj_flags |= EMAGGED
|
||||
to_chat(user, "<span class='notice'>You change the routing protocols, allowing the Drop Pod to land anywhere on the station.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/item/circuitboard/computer/cargo/express/multitool_act(mob/living/user)
|
||||
if (!(obj_flags & EMAGGED))
|
||||
|
||||
Reference in New Issue
Block a user