[MIRROR] Refactors for material container, ammo box & recycler [MDB IGNORE] (#21519)

* Refactors for material container, ammo box & recycler

* Mirror!

* Modular!

---------

Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: Funce <funce.973@gmail.com>
This commit is contained in:
SkyratBot
2023-06-02 01:24:54 +02:00
committed by GitHub
parent 8c0af345d8
commit 24552f5f95
7 changed files with 189 additions and 125 deletions
+1 -2
View File
@@ -171,8 +171,7 @@
if(!materials.has_space(material_amount))
unload_mineral(O)
else
materials.insert_item(O, breakdown_flags=BREAKDOWN_FLAGS_ORE_PROCESSOR)
qdel(O)
materials.insert_item(O, breakdown_flags = BREAKDOWN_FLAGS_ORE_PROCESSOR)
if(mineral_machine)
mineral_machine.updateUsrDialog()
+8 -7
View File
@@ -75,9 +75,6 @@
if(gathered_ore.refined_type == null)
return
if(gathered_ore?.refined_type)
points += gathered_ore.points * point_upgrade * gathered_ore.amount
var/material_amount = mat_container.get_item_material_amount(gathered_ore, BREAKDOWN_FLAGS_ORM)
if(!material_amount)
@@ -89,10 +86,14 @@
else
var/list/stack_mats = gathered_ore.get_material_composition(BREAKDOWN_FLAGS_ORM)
var/mats = stack_mats & mat_container.materials
var/amount = gathered_ore.amount
mat_container.insert_item(gathered_ore, ore_multiplier, breakdown_flags=BREAKDOWN_FLAGS_ORM) //insert it
materials.silo_log(src, "smelted", amount, gathered_ore.name, mats)
qdel(gathered_ore)
var/ore_amount = gathered_ore.amount
var/ore_points= gathered_ore.points
var/ore_name = gathered_ore.name
var/refined_type = gathered_ore?.refined_type
if(mat_container.insert_item(gathered_ore, ore_multiplier, breakdown_flags = BREAKDOWN_FLAGS_ORM) > 0) //increase points only if insertion was successfull
if(refined_type)
points += ore_points * point_upgrade * ore_amount
materials.silo_log(src, "smelted", ore_amount, ore_name, mats)
SEND_SIGNAL(src, COMSIG_ORM_COLLECTED_ORE)
-1
View File
@@ -142,7 +142,6 @@
if (length(matlist))
var/inserted = materials.mat_container.insert_item(inp)
materials.silo_log(src, "collected", inserted, "sheets", matlist)
qdel(inp)
return
// No silo attached process to internal storage