Skip to content

Commit

Permalink
fix(RUST): fixing RUST control consoles and fuel compressor fix and t…
Browse files Browse the repository at this point in the history
…weaks

#12888
  • Loading branch information
BaraBarax authored Oct 13, 2024
1 parent 759e5ad commit 2cde1e1
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 27 deletions.
13 changes: 8 additions & 5 deletions code/modules/power/fusion/core/core_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
light_color = COLOR_ORANGE
idle_power_usage = 250 WATTS
active_power_usage = 500 WATTS
circuit = /obj/item/circuitboard/fusion_core_control

var/id_tag
var/scan_range = 25
Expand All @@ -18,6 +19,7 @@
id_tag = new_ident
cur_viewed_device = null
return

else
return ..()

Expand All @@ -27,6 +29,7 @@
/obj/machinery/computer/fusion_core_control/attack_hand(mob/user)
if(..())
return

add_fingerprint(user)
interact(user)

Expand Down Expand Up @@ -142,7 +145,7 @@
var/idx = Clamp(text2num(href_list["toggle_active"]), 1, connected_devices.len)
cur_viewed_device = connected_devices[idx]
updateUsrDialog()
return 1
return TRUE

//All HREFs from this point on require a device anyways.
if(!cur_viewed_device || !check_core_status(cur_viewed_device) || cur_viewed_device.id_tag != id_tag || get_dist(src, cur_viewed_device) > scan_range)
Expand All @@ -151,13 +154,13 @@
if(href_list["goto_scanlist"])
cur_viewed_device = null
updateUsrDialog()
return 1
return TRUE

if(href_list["toggle_active"])
if(!cur_viewed_device.Startup()) //Startup() whilst the device is active will return null.
cur_viewed_device.Shutdown()
updateUsrDialog()
return 1
return TRUE

if(href_list["str"])
var/val = text2num(href_list["str"])
Expand All @@ -166,8 +169,8 @@
else
cur_viewed_device.set_strength(cur_viewed_device.field_strength + val)
updateUsrDialog()
return 1
return TRUE

//Returns 1 if the machine can be interacted with via this console.
/obj/machinery/computer/fusion_core_control/proc/check_core_status(obj/machinery/power/fusion_core/C)
. = 1
. = TRUE
5 changes: 3 additions & 2 deletions code/modules/power/fusion/core/core_field.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
/obj/item/projectile,
/obj/effect,
/obj/structure/cable,
/obj/machinery/atmospherics
/obj/machinery/atmospherics,
/obj/machinery/air_sensor
)

var/light_min_range = 2
Expand Down Expand Up @@ -143,7 +144,7 @@

check_instability()
Radiate()

set_next_think(world.time + 1 SECOND)

/obj/effect/fusion_em_field/proc/check_instability()
Expand Down
52 changes: 40 additions & 12 deletions code/modules/power/fusion/fuel_assembly/fuel_compressor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,78 @@
name = "fuel compressor"
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "fuel_compressor1"
density = 1
anchored = 1
layer = 4
density = TRUE
anchored = TRUE
atom_flags = ATOM_FLAG_CLIMBABLE
turf_height_offset = 23

component_types = list(
/obj/item/circuitboard/fusion_fuel_compressor = 1,
/obj/item/stock_parts/manipulator/pico = 2,
/obj/item/stock_parts/matter_bin/super = 2,
/obj/item/stock_parts/console_screen = 1
)

/obj/machinery/fusion_fuel_compressor/MouseDrop_T(atom/movable/target, mob/user)
if(user.incapacitated() || !user.Adjacent(src))
return

if(target == user)
. = ..()

return do_fuel_compression(target, user)

/obj/machinery/fusion_fuel_compressor/attackby(obj/item/thing, mob/user)
return do_fuel_compression(thing, user) || ..()
if(default_deconstruction_screwdriver(user, thing))
return

if(default_deconstruction_crowbar(user, thing))
return

if(do_fuel_compression(thing, user))
return

return ..()

/obj/machinery/fusion_fuel_compressor/proc/do_fuel_compression(obj/item/thing, mob/user)
if(istype(thing) && thing.reagents && thing.reagents.total_volume && thing.is_open_container())
if(thing.reagents.reagent_list.len > 1)
to_chat(user, "<span class='warning'>The contents of \the [thing] are impure and cannot be used as fuel.</span>")
return 1
return TRUE

if(thing.reagents.total_volume < 50)
to_chat(user, "<span class='warning'>You need at least fifty units of material to form a fuel rod.</span>")
return 1
return TRUE

var/datum/reagent/R = thing.reagents.reagent_list[1]
visible_message("<span class='notice'>\The [src] compresses the contents of \the [thing] into a new fuel assembly.</span>")
var/obj/item/fuel_assembly/F = new(get_turf(src), R.type, R.color)
thing.reagents.remove_reagent(R.type, R.volume)
user.pick_or_drop(F)
return 1
return TRUE

else if(istype(thing, /obj/machinery/power/supermatter/shard))
var/obj/item/fuel_assembly/F = new(get_turf(src), MATERIAL_SUPERMATTER)
visible_message("<span class='notice'>\The [src] compresses the \[thing] into a new fuel assembly.</span>")
qdel(thing)
user.pick_or_drop(F)
return 1
return TRUE

else if(istype(thing, /obj/item/stack/material))
var/obj/item/stack/material/M = thing
var/material/mat = M.get_material()
if(!mat.is_fusion_fuel)
to_chat(user, "<span class='warning'>It would be pointless to make a fuel rod out of [mat.use_name].</span>")
return
return TRUE

if(M.get_amount() < 25)
to_chat(user, "<span class='warning'>You need at least 25 [mat.sheet_plural_name] to make a fuel rod.</span>")
return
return TRUE

var/obj/item/fuel_assembly/F = new(get_turf(src), mat.name)
visible_message("<span class='notice'>\The [src] compresses the [mat.use_name] into a new fuel assembly.</span>")
M.use(25)
user.pick_or_drop(F)
return 1
return 0
return TRUE

return FALSE
4 changes: 3 additions & 1 deletion code/modules/power/fusion/fuel_assembly/fuel_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
light_color = COLOR_ORANGE
idle_power_usage = 250 WATTS
active_power_usage = 500 WATTS
circuit = /obj/item/circuitboard/fusion_fuel_control

var/id_tag
var/scan_range = 25
Expand All @@ -15,6 +16,7 @@
/obj/machinery/computer/fusion_fuel_control/attack_hand(mob/user)
if(..())
return

add_fingerprint(user)
interact(user)

Expand Down Expand Up @@ -78,7 +80,7 @@

/obj/machinery/computer/fusion_fuel_control/Topic(href, href_list)
if(..())
return 1
return TRUE

if(href_list["toggle_injecting"])
var/obj/machinery/fusion_fuel_injector/I = locate(href_list["toggle_injecting"])
Expand Down
1 change: 0 additions & 1 deletion code/modules/power/fusion/fusion_circuits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/obj/item/stock_parts/manipulator/pico = 2,
/obj/item/stock_parts/matter_bin/super = 2,
/obj/item/stock_parts/console_screen = 1,
/obj/item/stack/cable_coil = 5
)

/obj/item/circuitboard/fusion_fuel_control
Expand Down
15 changes: 9 additions & 6 deletions code/modules/power/fusion/gyrotron/gyrotron_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
light_color = COLOR_BLUE
idle_power_usage = 250 WATTS
active_power_usage = 500 WATTS
circuit = /obj/item/circuitboard/gyrotron_control

var/id_tag
var/scan_range = 25
Expand Down Expand Up @@ -66,27 +67,29 @@
var/new_val = input("Enter new emission power level (1 - 50)", "Modifying power level", G.mega_energy) as num
if(!new_val)
to_chat(usr, "<span class='warning'>That's not a valid number.</span>")
return 1
return TRUE

G.mega_energy = Clamp(new_val, 1, 50)
G.change_power_consumption(G.mega_energy * 1500, POWER_USE_ACTIVE)
updateUsrDialog()
return 1
return TRUE

if(href_list["modifyrate"])
var/new_val = input("Enter new emission delay between 1 and 10 seconds.", "Modifying emission rate", G.rate) as num
if(!new_val)
to_chat(usr, "<span class='warning'>That's not a valid number.</span>")
return 1
return TRUE

G.rate = Clamp(new_val, 1, 10)
updateUsrDialog()
return 1
return TRUE

if(href_list["toggle"])
G.activate(usr)
updateUsrDialog()
return 1
return TRUE

return 0
return FALSE

/obj/machinery/computer/gyrotron_control/attackby(obj/item/W, mob/user)
if(isMultitool(W))
Expand Down

0 comments on commit 2cde1e1

Please sign in to comment.