mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 14:08:31 +01:00
General code maintenance for Mat container related stuff (#77671)
1. Removes `/obj/machinery/ore_silo/proc/remote_attackby()`. This proc calls `datum/component/material_container/user_insert()` anyway which performs all the checks necessary for inserting stuff into the ore silo and `/obj/machinery/ore_silo/proc/remote_attackby()` was just repeating its code & checks. So now inserting into the ore silo is directly handled by the mat container without this proxy proc making the operation slightly faster 2. Removed silo `attackby` code. Same operations can be done via `screwdriver_act` & `crowbar_act` procs much cleaner 3. The ore silo now hooks onto signals `COMSIG_MATCONTAINER_ITEM_CONSUMED` and `COMSIG_MATCONTAINER_SHEETS_RETRIVED` and logs into silo when they are triggered. This means when you insert/eject sheets from the silo the connected machine performing the operation no longer has to do the logging manually thus the proc `silo_log` has been removed from a lot of places ,reducing overall code size 4. A lot of stuff that use materials from the ore silo follow this pattern. i.e. They first use the materials from the silo and then log it via `silo_log` proc. This code pattern is repeated in a lot of places so let's just merge these 2 lines with some extra sanity checks into a single proc inside `remote_materials` itself. That's what was done and the number of places where you log manually into the silo has been removed further reducing code size everywhere. 5. Added auto doc & cleaned up some procs Since logging is now done by the ore silo directly, we need a way to pass the machine that is inserting items into the silo to the signal handlers of the ore silo [via the `context` var]. So other code changes elsewhere is because of this var
This commit is contained in:
@@ -112,8 +112,7 @@
|
||||
if (!materials.mat_container.has_materials(design.materials, efficiency_coeff))
|
||||
return
|
||||
|
||||
materials.mat_container.use_materials(design.materials, efficiency_coeff)
|
||||
materials.silo_log(src, "printed", -1, design.name, design.materials)
|
||||
materials.use_materials(design.materials, efficiency_coeff, 1, "printed", "[design.name]")
|
||||
return new design.build_path(drop_location())
|
||||
|
||||
/obj/machinery/component_printer/ui_act(action, list/params)
|
||||
@@ -140,8 +139,8 @@
|
||||
return TRUE
|
||||
|
||||
balloon_alert_to_viewers("printed [design.name]")
|
||||
materials.mat_container.use_materials(design.materials, efficiency_coeff)
|
||||
materials.silo_log(src, "printed", -1, design.name, design.materials)
|
||||
|
||||
materials.use_materials(design.materials, efficiency_coeff, 1, "printed", "[design.name]")
|
||||
var/atom/printed_design = new design.build_path(drop_location())
|
||||
printed_design.pixel_x = printed_design.base_pixel_x + rand(-5, 5)
|
||||
printed_design.pixel_y = printed_design.base_pixel_y + rand(-5, 5)
|
||||
@@ -381,10 +380,9 @@
|
||||
say("Not enough materials.")
|
||||
return TRUE
|
||||
|
||||
balloon_alert_to_viewers("printed [design["name"]]")
|
||||
materials.mat_container.use_materials(design["materials"], efficiency_coeff)
|
||||
materials.silo_log(src, "printed", -1, design["name"], design["materials"])
|
||||
materials.use_materials(design["materials"], efficiency_coeff, 1, design["name"], design["materials"])
|
||||
print_module(design)
|
||||
balloon_alert_to_viewers("printed [design["name"]]")
|
||||
if ("remove_mat")
|
||||
var/datum/material/material = locate(params["ref"])
|
||||
var/amount = text2num(params["amount"])
|
||||
|
||||
Reference in New Issue
Block a user