Skip to content

Commit

Permalink
Research and Lathes resprite emissives + tcomms emmisives (#20398)
Browse files Browse the repository at this point in the history
Title. 'nuff seid.

Also fixes the fucked up material insertion animations to use
flick_overlay_view so it isn't laggy as fuck.

And adds emissives to machines that have lights so they glow in the dark
epically.

<img width="138" alt="dreamseeker_N6egRW6Yz3"
src="https://github.com/user-attachments/assets/a17f12ba-b768-4ad6-a35f-baf33aaae658"
/>
  • Loading branch information
alsoandanswer authored Jan 30, 2025
1 parent c76a3de commit edba602
Show file tree
Hide file tree
Showing 22 changed files with 179 additions and 87 deletions.
34 changes: 25 additions & 9 deletions code/game/machinery/autolathe/autolathe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
..()
wires = new(src)
print_loc = src
update_icon()
return INITIALIZE_HINT_LATELOAD

/obj/machinery/autolathe/LateInitialize()
Expand Down Expand Up @@ -269,7 +270,8 @@
/obj/machinery/autolathe/proc/start_processing_queue_item()
if(does_flick)
//Fancy autolathe animation.
AddOverlays("process")
AddOverlays(emissive_appearance(icon, "[icon_state]_lights_working"))
AddOverlays("[icon_state]_lights_working")
autolathe_flags |= AUTOLATHE_STARTED|AUTOLATHE_BUSY

/obj/machinery/autolathe/proc/process_queue_item()
Expand All @@ -292,14 +294,23 @@

print_queue -= currently_printing
QDEL_NULL(currently_printing)
CutOverlays("process")
CutOverlays(emissive_appearance(icon, "[icon_state]_lights_working"))
CutOverlays("[icon_state]_lights_working")
I.update_icon()
flick_overlay_view(mutable_appearance(icon, "[icon_state]_print"), 1 SECONDS)
update_use_power(POWER_USE_IDLE)

return TRUE

/obj/machinery/autolathe/update_icon()
icon_state = (panel_open ? "autolathe_panel" : "autolathe")
CutOverlays("[icon_state]_panel")
CutOverlays(emissive_appearance(icon, "[icon_state]_lights"))
CutOverlays("[icon_state]_lights")
if(panel_open)
AddOverlays("[icon_state]_panel")
if(!(stat & (NOPOWER|BROKEN)))
AddOverlays(emissive_appearance(icon, "[icon_state]_lights"))
AddOverlays("[icon_state]_lights")

//Updates overall lathe storage size.
/obj/machinery/autolathe/RefreshParts()
Expand Down Expand Up @@ -384,15 +395,20 @@

// Plays metal insertion animation.
if(istype(eating, /obj/item/stack/material))
var/obj/item/stack/material/sheet = eating
var/icon/load = icon(icon, "load")
load.Blend(sheet.material.icon_colour,ICON_MULTIPLY)
AddOverlays(load)
CUT_OVERLAY_IN(load, 6)
var/obj/item/stack/material/stack = eating
var/mutable_appearance/M = mutable_appearance(icon, "material_insertion")
M.color = stack.material.icon_colour
//first play the insertion animation
flick_overlay_view(M, 1 SECONDS)

//now play the progress bar animation
flick_overlay_view(mutable_appearance(icon, "autolathe_progress"), 1 SECONDS)

if(istype(eating, /obj/item/stack))
var/obj/item/stack/stack = eating
var/amount_needed = total_used / mass_per_sheet
var/amount_needed
if(total_used && mass_per_sheet)
amount_needed = total_used / mass_per_sheet
stack.use(min(stack.get_amount(), (round(amount_needed) == amount_needed)? amount_needed : round(amount_needed) + 1)) // Prevent maths imprecision from leading to infinite resources
else
user.remove_from_mob(O)
Expand Down
7 changes: 3 additions & 4 deletions code/game/machinery/bluespacerelay.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@
)

/obj/machinery/bluespacerelay/process()

update_power()

update_icon()

/obj/machinery/bluespacerelay/update_icon()
ClearOverlays()
if(on)
icon_state = initial(icon_state)
else
icon_state = "[initial(icon_state)]_off"
AddOverlays(emissive_appearance(icon, "[icon_state]_lights"))
AddOverlays("[icon_state]_lights")

/obj/machinery/bluespacerelay/proc/update_power()

Expand Down
27 changes: 17 additions & 10 deletions code/game/machinery/mecha_fabricator.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/obj/machinery/mecha_part_fabricator
name = "mechatronic fabricator"
desc = "A general purpose fabricator that can be used to fabricate robotic equipment."
icon = 'icons/obj/machinery/robotics.dmi'
icon_state = "fab-base"
icon = 'icons/obj/machinery/robotics_fabricator.dmi'
icon_state = "fab"
density = TRUE
anchored = TRUE
idle_power_usage = 20
Expand Down Expand Up @@ -53,11 +53,15 @@

/obj/machinery/mecha_part_fabricator/update_icon()
ClearOverlays()
icon_state = "fab-base"
if(build_callback_timer)
AddOverlays("fab-active")
if(panel_open)
AddOverlays("fab-panel")
AddOverlays("[icon_state]_panel")
if(!(stat & (NOPOWER|BROKEN)))
AddOverlays(emissive_appearance(icon, "[icon_state]_lights"))
AddOverlays("[icon_state]_lights")
if(build_callback_timer)
AddOverlays("[icon_state]_working")
AddOverlays(emissive_appearance(icon, "[icon_state]_lights_working"))
AddOverlays("[icon_state]_lights_working")

/obj/machinery/mecha_part_fabricator/dismantle()
for(var/f in materials)
Expand Down Expand Up @@ -184,10 +188,13 @@
if(materials[M.material.name] + M.perunit <= res_max_amount)
if(M.amount >= 1)
var/count = 0
var/icon/load = icon(icon, "load")
load.Blend(M.material.icon_colour,ICON_MULTIPLY)
AddOverlays(load)
CUT_OVERLAY_IN(load, 6)
var/mutable_appearance/MA = mutable_appearance(icon, "material_insertion")
MA.color = M.material.icon_colour
//first play the insertion animation
flick_overlay_view(MA, 1 SECONDS)

//now play the progress bar animation
flick_overlay_view(mutable_appearance(icon, "fab_progress"), 1 SECONDS)

while(materials[M.material.name] + M.perunit <= res_max_amount && M.amount >= 1)
materials[M.material.name] += M.perunit
Expand Down
10 changes: 1 addition & 9 deletions code/game/machinery/telecomms/machines/message_server.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
priority = "Undetermined"

/obj/machinery/telecomms/message_server
icon_state = "server"
name = "messaging server"
desc = "A machine that processes and routes request console messages."
icon_state = "message_server"
telecomms_type = /obj/machinery/telecomms/message_server
idle_power_usage = 10
active_power_usage = 100
Expand Down Expand Up @@ -164,14 +164,6 @@
else
..()

/obj/machinery/telecomms/message_server/update_icon()
icon_state = initial(icon_state)
ClearOverlays()
if(panel_open)
icon_state += "_o"
if(!operable())
icon_state += "_off"

/datum/signal/subspace/pda
frequency = PUB_FREQ
server_type = /obj/machinery/telecomms/message_server
Expand Down
14 changes: 9 additions & 5 deletions code/game/machinery/telecomms/telecommunications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
if(T != src && (T.z in GetConnectedZlevels(z)))
add_automatic_link(T)

update_icon()

/obj/machinery/telecomms/Destroy()
// QDEL_NULL(soundloop)
SSmachinery.all_telecomms -= src
Expand Down Expand Up @@ -106,13 +108,15 @@
return

/obj/machinery/telecomms/update_icon()
var/state = construct_op ? "[initial(icon_state)]_o" : initial(icon_state)
if(!use_power)
state += "_off"

icon_state = state
ClearOverlays()
if(operable())
AddOverlays(emissive_appearance(icon, "[icon_state]_lights"))
AddOverlays("[icon_state]_lights")
if(panel_open)
AddOverlays("[icon_state]_panel")

/obj/machinery/telecomms/process()
update_icon()
if(!use_power) return PROCESS_KILL
if(!operable(EMPED))
toggle_power(additional_flags = EMPED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
/obj/item/circuitboard/weapons_analyzer
name = T_BOARD("Weapons Analyzer")
desc = "The circuitboard for a weapons analyzer."
build_path = /obj/machinery/weapons_analyzer
build_path = /obj/machinery/r_n_d/weapons_analyzer
origin_tech = list(TECH_DATA = 3, TECH_ENGINEERING = 4, TECH_COMBAT = 3)
board_type = BOARD_MACHINE
req_components = list(
Expand Down
18 changes: 10 additions & 8 deletions code/modules/modular_computers/NTNet/NTNet_relay.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@
return TRUE

/obj/machinery/ntnet_relay/update_icon()
icon_state = initial(icon_state)
ClearOverlays()
if(operable())
AddOverlays(emissive_appearance(icon, "[icon_state]_lights"))
AddOverlays("[icon_state]_lights")
if(dos_failure)
AddOverlays(emissive_appearance(icon, "[icon_state]_failure"))
AddOverlays("[icon_state]_failure")
if(!enabled)
AddOverlays(emissive_appearance(icon, "[icon_state]_lights_failure"))
AddOverlays("[icon_state]_lights_failure")
if(panel_open)
icon_state += "_o"
if(!operable())
icon_state += "_off"
else if(dos_failure)
AddOverlays("relay_traitor")
else if(!enabled)
AddOverlays("relay_traitor_activate")
AddOverlays("[icon_state]_panel")

/obj/machinery/ntnet_relay/process()
if(operable())
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/modular/laser_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@

/obj/item/device/laser_assembly/proc/finish()

var/obj/machinery/weapons_analyzer/an = analyzer.resolve()
var/obj/machinery/r_n_d/weapons_analyzer/an = analyzer.resolve()
if(!an)
return FALSE

Expand Down
34 changes: 26 additions & 8 deletions code/modules/research/protolathe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
T += M.rating
mat_efficiency = 1 - (T - 2) / 8
production_speed = T / 2
update_icon()

/obj/machinery/r_n_d/protolathe/dismantle()
for(var/obj/I in component_parts)
Expand All @@ -76,13 +77,21 @@
S.amount = round(materials[f] / SHEET_MATERIAL_AMOUNT)
..()

/obj/machinery/r_n_d/protolathe/power_change()
. = ..()
update_icon()

/obj/machinery/r_n_d/protolathe/update_icon()
ClearOverlays()
if(panel_open)
icon_state = "protolathe_t"
else if(build_callback_timer)
icon_state = "protolathe_n"
else
icon_state = "protolathe"
AddOverlays("[icon_state]_panel")
if(!(stat & (NOPOWER|BROKEN)))
AddOverlays(emissive_appearance(icon, "[icon_state]_lights"))
AddOverlays("[icon_state]_lights")
if(build_callback_timer)
AddOverlays("[icon_state]_working")
AddOverlays(emissive_appearance(icon, "[icon_state]_lights_working"))
AddOverlays("[icon_state]_lights_working")

/obj/machinery/r_n_d/protolathe/attackby(obj/item/attacking_item, mob/user)
if(build_callback_timer)
Expand Down Expand Up @@ -131,14 +140,22 @@
if(amount <= 0)//No negative numbers, no nulls
return

AddOverlays("protolathe_[stack.default_type]")
CUT_OVERLAY_IN("protolathe_[stack.default_type]", 10)
var/mutable_appearance/M = mutable_appearance(icon, "material_insertion")
M.color = stack.material.icon_colour
//first play the insertion animation
flick_overlay_view(M, 1 SECONDS)

//now play the progress bar animation
flick_overlay_view(mutable_appearance(icon, "protolathe_progress"), 1 SECONDS)

//Use some power and add the materials
use_power_oneoff(max(1000, (SHEET_MATERIAL_AMOUNT * amount / 10)))
if(do_after(user, 1.6 SECONDS))
if(stack.use(amount))
to_chat(user, SPAN_NOTICE("You add [amount] sheets to \the [src]."))
if(amount>1)
to_chat(user, SPAN_NOTICE("You add [amount] [stack.material.sheet_plural_name] of [stack.material.name] to \the [src]."))
else
to_chat(user, SPAN_NOTICE("You add [amount] [stack.material.sheet_singular_name] of [stack.material.name] to \the [src]."))
materials[stack.default_type] += amount * SHEET_MATERIAL_AMOUNT

//In case there's things queued up, we run the queue handler
Expand Down Expand Up @@ -184,6 +201,7 @@
//If there's no power, there's no building
if(stat & NOPOWER)
queue = list()
update_icon()
return

//Get the first design in the queue
Expand Down
4 changes: 2 additions & 2 deletions code/modules/research/rdmachines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/obj/machinery/r_n_d
name = "R&D device"
icon = 'icons/obj/machinery/research.dmi'
density = 1
anchored = 1
density = TRUE
anchored = TRUE
var/busy = 0
var/obj/machinery/computer/rdconsole/linked_console

Expand Down
3 changes: 1 addition & 2 deletions code/modules/research/server.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/obj/machinery/r_n_d/server
name = "\improper R&D server"
desc = "A server which houses a back-up of all station research. It can be used to restore lost data, or to act as another point of retrieval."
icon = 'icons/obj/machinery/research.dmi'
icon_state = "server"
icon_state = "RD-server"
var/datum/research/files
var/health = 100
var/list/id_with_upload = list() //List of R&D consoles with upload to server access.
Expand Down
8 changes: 4 additions & 4 deletions code/modules/research/tech_processor.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/obj/machinery/r_n_d/tech_processor
name = "\improper R&D tech processor"
desc = "A highly advanced analytical computation engine, when connected to an R&D server with a multitool, it will start processing known technology and add research points to it."
icon_state = "tech_processor"
icon_state = "RD-server"

component_types = list(
/obj/item/circuitboard/rdtechprocessor,
Expand Down Expand Up @@ -76,10 +76,10 @@
/obj/machinery/r_n_d/tech_processor/update_icon()
ClearOverlays()
if(stat & (NOPOWER|BROKEN))
icon_state = "[initial(icon_state)]_off"
icon_state = "[initial(icon_state)]-off"
else if(!linked_server)
icon_state = "[initial(icon_state)]_unlinked"
icon_state = "[initial(icon_state)]-halt"
else
icon_state = initial(icon_state)
icon_state = "[initial(icon_state)]-on"
if(panel_open)
AddOverlays("[initial(icon_state)]_open")
Loading

0 comments on commit edba602

Please sign in to comment.