Fixes #3319, you cannot use rpd's when they are far away from you.

Fixes machine frames (but the real way that should have been done originally)
Fixes #2701, r-ust topics should no longer be affected by ghost hands
This commit is contained in:
clusterfack
2015-03-05 17:07:40 -06:00
parent c7df7494d4
commit b401dbf909
10 changed files with 177 additions and 173 deletions

View File

@@ -122,7 +122,7 @@
user.set_machine(src)
/obj/machinery/computer/rust_core_control/Topic(href, href_list)
..()
if(..()) return
if( href_list["goto_scanlist"] )
cur_viewed_device = null

View File

@@ -180,6 +180,7 @@ max volume of plasma storeable by the field = the total volume of a number of ti
user.set_machine(src)
/obj/machinery/power/rust_core/Topic(href, href_list)
if(..()) return
if(href_list["str"])
var/dif = text2num(href_list["str"])
field_strength = min(max(field_strength + dif, MIN_FIELD_STR), MAX_FIELD_STR)

View File

@@ -68,7 +68,7 @@ var/const/max_assembly_amount = 300
//var/coverlocked
/obj/machinery/rust_fuel_compressor/Topic(href, href_list)
..()
if(..()) return
if( href_list["close"] )
usr << browse(null, "window=fuelcomp")
usr.machine = null

View File

@@ -130,7 +130,7 @@
user.set_machine(src)
/obj/machinery/computer/rust_fuel_control/Topic(href, href_list)
..()
if(..()) return
if( href_list["scan"] )
connected_injectors = list()

View File

@@ -137,7 +137,7 @@
user.set_machine(src)
/obj/machinery/power/rust_fuel_injector/Topic(href, href_list)
..()
if(..()) return
if( href_list["modify_tag"] )
id_tag = input("Enter new ID tag", "Modifying ID tag") as text|null

View File

@@ -28,7 +28,7 @@
//pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
Topic(href, href_list)
..()
if(..()) return
if( href_list["close"] )
usr << browse(null, "window=gyro_monitor")
usr.machine = null

View File

@@ -12,187 +12,187 @@
var/list/req_components = null
var/list/req_component_names = null
var/list/components_in_use = null
var/build_state = 2
var/build_state = 1
// For pods
var/list/connected_parts = list()
var/pattern_idx=0
machine_flags = WRENCHMOVE | FIXED2WORK
proc/update_desc()
var/D
if(req_components)
D = "Requires "
var/first = 1
for(var/I in req_components)
if(req_components[I] > 0)
D += "[first?"":", "][num2text(req_components[I])] [req_component_names[I]]"
first = 0
if(first) // nothing needs to be added, then
D += "nothing"
D += "."
desc = D
/obj/machinery/constructable_frame/proc/update_desc()
var/D
if(req_components)
D = "Requires "
var/first = 1
for(var/I in req_components)
if(req_components[I] > 0)
D += "[first?"":", "][num2text(req_components[I])] [req_component_names[I]]"
first = 0
if(first) // nothing needs to be added, then
D += "nothing"
D += "."
desc = D
/obj/machinery/constructable_frame/machine_frame
attackby(obj/item/P as obj, mob/user as mob)
if(P.crit_fail)
user << "<span class='warning'>This part is faulty, you cannot add this to the machine!</span>"
return
switch(build_state)
if(1)
if(istype(P, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = P
if(C.amount >= 5)
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
user << "<span class='notice'>You start to add cables to the frame.</span>"
if(do_after(user, 20))
if(C && C.amount >= 5) // Check again
C.use(5)
user << "<span class='notice'>You add cables to the frame.</span>"
build_state = 2
icon_state = "box_1"
else if(istype(P, /obj/item/stack/sheet/glass/glass))
var/obj/item/stack/sheet/glass/glass/G=P
if(G.amount<1)
user << "<span class='warning'>How...?</span>"
return
G.use(1)
user << "<span class='notice'>You add the glass to the frame.</span>"
/obj/machinery/constructable_frame/machine_frame/attackby(obj/item/P as obj, mob/user as mob)
if(P.crit_fail)
user << "<span class='warning'>This part is faulty, you cannot add this to the machine!</span>"
return
switch(build_state)
if(1)
if(istype(P, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = P
if(C.amount >= 5)
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
new /obj/structure/displaycase_frame(src.loc)
del(src)
user << "<span class='notice'>You start to add cables to the frame.</span>"
if(do_after(user, 20))
if(C && C.amount >= 5) // Check again
C.use(5)
user << "<span class='notice'>You add cables to the frame.</span>"
build_state = 2
icon_state = "box_1"
else if(istype(P, /obj/item/stack/sheet/glass/glass))
var/obj/item/stack/sheet/glass/glass/G=P
if(G.amount<1)
user << "<span class='warning'>How...?</span>"
return
G.use(1)
user << "<span class='notice'>You add the glass to the frame.</span>"
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/weapon/wrench))
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 75, 1)
user << "<span class='notice'>You dismantle the frame.</span>"
//new /obj/item/stack/sheet/metal(src.loc, 5)
var/obj/item/stack/sheet/metal/M = getFromPool(/obj/item/stack/sheet/metal, src.loc)
M.amount = 5
del(src)
if(2)
if(!..())
if(istype(P, /obj/item/weapon/circuitboard))
var/obj/item/weapon/circuitboard/B = P
if(B.board_type == "machine")
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
user << "<span class='notice'>You add the circuit board to the frame.</span>"
circuit = P
user.drop_item()
P.loc = src
icon_state = "box_2"
build_state = 3
components = list()
req_components = circuit.req_components.Copy()
for(var/A in circuit.req_components)
req_components[A] = circuit.req_components[A]
req_component_names = circuit.req_components.Copy()
for(var/A in req_components)
var/cp = text2path(A)
var/obj/ct = new cp() // have to quickly instantiate it get name
req_component_names[A] = ct.name
del(ct)
if(circuit.frame_desc)
desc = circuit.frame_desc
else
update_desc()
user << desc
else
user << "<span class='warning'>This frame does not accept circuit boards of this type!</span>"
else
if(istype(P, /obj/item/weapon/wrench))
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 75, 1)
user << "<span class='notice'>You dismantle the frame.</span>"
//new /obj/item/stack/sheet/metal(src.loc, 5)
var/obj/item/stack/sheet/metal/M = getFromPool(/obj/item/stack/sheet/metal, src.loc)
M.amount = 5
del(src)
if(2)
if(!..())
if(istype(P, /obj/item/weapon/circuitboard))
var/obj/item/weapon/circuitboard/B = P
if(B.board_type == "machine")
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
user << "<span class='notice'>You add the circuit board to the frame.</span>"
circuit = P
user.drop_item()
P.loc = src
icon_state = "box_2"
build_state = 3
components = list()
req_components = circuit.req_components.Copy()
for(var/A in circuit.req_components)
req_components[A] = circuit.req_components[A]
req_component_names = circuit.req_components.Copy()
for(var/A in req_components)
var/cp = text2path(A)
var/obj/ct = new cp() // have to quickly instantiate it get name
req_component_names[A] = ct.name
del(ct)
if(circuit.frame_desc)
desc = circuit.frame_desc
else
update_desc()
user << desc
else
user << "<span class='warning'>This frame does not accept circuit boards of this type!</span>"
else
if(istype(P, /obj/item/weapon/wirecutters))
playsound(get_turf(src), 'sound/items/Wirecutter.ogg', 50, 1)
user << "<span class='notice'>You remove the cables.</span>"
build_state = 1
icon_state = "box_0"
var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( src.loc )
A.amount = 5
if(istype(P, /obj/item/weapon/wirecutters))
playsound(get_turf(src), 'sound/items/Wirecutter.ogg', 50, 1)
user << "<span class='notice'>You remove the cables.</span>"
build_state = 1
icon_state = "box_0"
var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( src.loc )
A.amount = 5
if(3)
if(!..())
if(istype(P, /obj/item/weapon/crowbar))
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
build_state = 2
circuit.loc = src.loc
circuit = null
if(components.len == 0)
user << "<span class='notice'>You remove the circuit board.</span>"
else
user << "<span class='notice'>You remove the circuit board and other components.</span>"
for(var/obj/item/weapon/W in components)
W.loc = src.loc
desc = initial(desc)
req_components = null
components = null
icon_state = "box_1"
if(3)
if(!..())
if(istype(P, /obj/item/weapon/crowbar))
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
build_state = 2
circuit.loc = src.loc
circuit = null
if(components.len == 0)
user << "<span class='notice'>You remove the circuit board.</span>"
else
if(istype(P, /obj/item/weapon/screwdriver))
var/component_check = 1
for(var/R in req_components)
if(req_components[R] > 0)
component_check = 0
break
if(component_check)
playsound(get_turf(src), 'sound/items/Screwdriver.ogg', 50, 1)
var/obj/machinery/new_machine = new src.circuit.build_path(src.loc)
for(var/obj/O in new_machine.component_parts)
del(O)
new_machine.component_parts = list()
for(var/obj/O in src)
if(circuit.contain_parts) // things like disposal don't want their parts in them
O.loc = components_in_use
else
O.loc = null
new_machine.component_parts += O
if(circuit.contain_parts)
circuit.loc = components_in_use
user << "<span class='notice'>You remove the circuit board and other components.</span>"
for(var/obj/item/weapon/W in components)
W.loc = src.loc
desc = initial(desc)
req_components = null
components = null
icon_state = "box_1"
else
if(istype(P, /obj/item/weapon/screwdriver))
var/component_check = 1
for(var/R in req_components)
if(req_components[R] > 0)
component_check = 0
break
if(component_check)
playsound(get_turf(src), 'sound/items/Screwdriver.ogg', 50, 1)
var/obj/machinery/new_machine = new src.circuit.build_path(src.loc)
for(var/obj/O in new_machine.component_parts)
del(O)
new_machine.component_parts = list()
for(var/obj/O in src)
if(circuit.contain_parts) // things like disposal don't want their parts in them
O.loc = components_in_use
else
circuit.loc = null
new_machine.RefreshParts()
del(src)
else
if(istype(P, /obj/item/weapon)||istype(P, /obj/item/stack))
for(var/I in req_components)
if(istype(P, text2path(I)) && (req_components[I] > 0))
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
if(istype(P, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/CP = P
if(CP.amount >= req_components[I])
var/camt = min(CP.amount, req_components[I]) // amount of cable to take, idealy amount required, but limited by amount provided
var/obj/item/stack/cable_coil/CC = new /obj/item/stack/cable_coil(src)
CC.amount = camt
CC.update_icon()
CP.use(camt)
components += CC
req_components[I] -= camt
update_desc()
break
else
user << "<span class='warning'>You do not have enough [P]!</span>"
if(istype(P, /obj/item/stack/rods))
var/obj/item/stack/rods/R = P
if(R.amount >= req_components[I])
var/camt = min(R.amount, req_components[I]) // amount of cable to take, idealy amount required, but limited by amount provided
var/obj/item/stack/rods/RR = new /obj/item/stack/rods(src)
RR.amount = camt
RR.update_icon()
R.use(camt)
components += RR
req_components[I] -= camt
update_desc()
break
else
user << "<span class='warning'>You do not have enough [P]!</span>"
user.drop_item()
P.loc = src
components += P
req_components[I]--
update_desc()
break
user << desc
if(P && P.loc != src && !istype(P, /obj/item/stack/cable_coil))
user << "<span class='warning'>You cannot add that component to the machine!</span>"
O.loc = null
new_machine.component_parts += O
if(circuit.contain_parts)
circuit.loc = components_in_use
else
circuit.loc = null
new_machine.RefreshParts()
del(src)
else
if(istype(P, /obj/item/weapon)||istype(P, /obj/item/stack))
for(var/I in req_components)
if(istype(P, text2path(I)) && (req_components[I] > 0))
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
if(istype(P, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/CP = P
if(CP.amount >= req_components[I])
var/camt = min(CP.amount, req_components[I]) // amount of cable to take, idealy amount required, but limited by amount provided
var/obj/item/stack/cable_coil/CC = new /obj/item/stack/cable_coil(src)
CC.amount = camt
CC.update_icon()
CP.use(camt)
components += CC
req_components[I] -= camt
update_desc()
break
else
user << "<span class='warning'>You do not have enough [P]!</span>"
if(istype(P, /obj/item/stack/rods))
var/obj/item/stack/rods/R = P
if(R.amount >= req_components[I])
var/camt = min(R.amount, req_components[I]) // amount of cable to take, idealy amount required, but limited by amount provided
var/obj/item/stack/rods/RR = new /obj/item/stack/rods(src)
RR.amount = camt
RR.update_icon()
R.use(camt)
components += RR
req_components[I] -= camt
update_desc()
break
else
user << "<span class='warning'>You do not have enough [P]!</span>"
user.drop_item()
P.loc = src
components += P
req_components[I]--
update_desc()
break
user << desc
if(P && P.loc != src && !istype(P, /obj/item/stack/cable_coil))
user << "<span class='warning'>You cannot add that component to the machine!</span>"
//Machine Frame Circuit Boards

View File

@@ -415,8 +415,8 @@ Class Procs:
/obj/machinery/proc/dropFrame()
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
M.state = 1
M.build_state = 2
M.state = 1
M.icon_state = "box_1"
/obj/machinery/proc/crowbarDestroy(mob/user)

View File

@@ -407,6 +407,9 @@ var/global/list/RPD_recipes=list(
return
usr.set_machine(src)
src.add_fingerprint(usr)
if(get_dist(usr,src)>=1)
usr.unset_machine(usr)
return
if(href_list["setdir"])
p_dir= text2num(href_list["setdir"])
show_menu(usr)

View File

@@ -221,7 +221,6 @@ var/global/ingredientLimit = 10
icon_state_on = "mixer_on"
cookSound = 'sound/machines/juicer.ogg'
v
/obj/machinery/cooking/candy/validateIngredient(var/obj/item/I)
. = ..()
@@ -241,6 +240,7 @@ var/global/ingredientLimit = 10
/obj/machinery/cooking/candy/getFoodChoices()
return (typesof(/obj/item/weapon/reagent_containers/food/snacks/customizable/candy)-(/obj/item/weapon/reagent_containers/food/snacks/customizable/candy))
// Still ///////////////////////////////////////////////////////
/obj/machinery/cooking/still