mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-26 22:57:39 +01:00
[MIRROR] Refinery Feedback P1 (#11298)
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
This commit is contained in:
co-authored by
Will
parent
fd0ec87646
commit
9f0e900ca7
@@ -8,7 +8,7 @@
|
||||
idle_power_usage = 5
|
||||
active_power_usage = 300
|
||||
circuit = /obj/item/circuitboard/industrial_reagent_grinder
|
||||
VAR_PRIVATE/limit = 50
|
||||
var/static/limit = 50
|
||||
VAR_PRIVATE/list/holdingitems = list()
|
||||
|
||||
/obj/machinery/reagent_refinery/grinder/Initialize(mapload)
|
||||
@@ -34,7 +34,7 @@
|
||||
// Insert grindables if not handled by parent proc
|
||||
if(holdingitems && holdingitems.len >= limit)
|
||||
to_chat(user, "The machine cannot hold anymore items.")
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
// Botany/Chemistry gameplay
|
||||
if(istype(O,/obj/item/storage/bag))
|
||||
@@ -71,6 +71,8 @@
|
||||
return FALSE
|
||||
|
||||
// Needs to be sheet, ore, or grindable reagent containing things
|
||||
if(istype(O,/obj/item/tool)) // Stops messages about the wrench being unsuitable to grind
|
||||
return FALSE
|
||||
if(!GLOB.sheet_reagents[O.type] && !GLOB.ore_reagents[O.type] && (!O.reagents || !O.reagents.total_volume))
|
||||
to_chat(user, "\The [O] is not suitable for blending.")
|
||||
return FALSE
|
||||
@@ -88,6 +90,18 @@
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
// Get objects from incoming conveyors
|
||||
if(holdingitems.len < limit)
|
||||
for(var/D in GLOB.cardinal)
|
||||
var/turf/T = get_step(src,D)
|
||||
if(!T)
|
||||
continue
|
||||
var/obj/machinery/conveyor/C = locate() in T
|
||||
if(C && !C.stat && C.operating && C.dir == GLOB.reverse_dir[D]) // If an operating conveyor points into us... Check if it's moving anything
|
||||
var/obj/item/I = pick(T.contents - list(C))
|
||||
if(istype(I) && conveyor_load(I))
|
||||
break
|
||||
|
||||
if(holdingitems.len > 0 && grind_items_to_reagents(holdingitems,reagents))
|
||||
//Lazy coder sound design moment. THE SEQUEL
|
||||
playsound(src, 'sound/items/poster_being_created.ogg', 50, 1)
|
||||
@@ -109,21 +123,18 @@
|
||||
var/image/dot = image(icon, icon_state = "grinder_dot_[holdingitems.len ? "on" : "off" ]")
|
||||
add_overlay(dot)
|
||||
|
||||
/obj/machinery/reagent_refinery/grinder/Bumped(atom/movable/AM as mob|obj)
|
||||
. = ..()
|
||||
if(!anchored)
|
||||
return
|
||||
/obj/machinery/reagent_refinery/grinder/proc/conveyor_load(atom/movable/AM as mob|obj)
|
||||
if(!AM || QDELETED(AM))
|
||||
return
|
||||
return FALSE
|
||||
if(holdingitems.len >= limit)
|
||||
return
|
||||
return FALSE
|
||||
if(ismob(AM)) // No mob bumping YET
|
||||
return
|
||||
return FALSE
|
||||
if(!GLOB.sheet_reagents[AM.type] && !GLOB.ore_reagents[AM.type] && (!AM.reagents || !AM.reagents.total_volume))
|
||||
return
|
||||
|
||||
return FALSE
|
||||
AM.forceMove(src)
|
||||
holdingitems += AM
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/reagent_refinery/grinder/examine(mob/user, infix, suffix)
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user