[MIRROR] Cow udders as reagent hose connectors (#11315)

Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-08-04 18:52:34 -07:00
committed by GitHub
parent 099d56add0
commit 6dc533a93c
3 changed files with 27 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
/datum/component/hose_connector /datum/component/hose_connector
var/name = "" var/name = ""
dupe_mode = COMPONENT_DUPE_ALLOWED dupe_mode = COMPONENT_DUPE_ALLOWED
VAR_PROTECTED/force_name = FALSE // If it gets doesn't do automatic naming
VAR_PROTECTED/obj/carrier = null VAR_PROTECTED/obj/carrier = null
VAR_PROTECTED/flow_direction = HOSE_NEUTRAL VAR_PROTECTED/flow_direction = HOSE_NEUTRAL
VAR_PROTECTED/datum/hose/my_hose = null VAR_PROTECTED/datum/hose/my_hose = null
@@ -8,12 +9,18 @@
// Atom reagent code piggyback // Atom reagent code piggyback
var/flags = NOREACT // Prevent reagent explosions runtiming because no turf or by deleting the hose datum var/flags = NOREACT // Prevent reagent explosions runtiming because no turf or by deleting the hose datum
var/datum/reagents/reagents = null var/datum/reagents/reagents = null
var/makes_gurgles = TRUE
/datum/component/hose_connector/Initialize() /datum/component/hose_connector/Initialize(var/set_unique_name = null)
carrier = parent carrier = parent
reagents = new /datum/reagents( 60, src) reagents = new /datum/reagents( 60, src)
// Handle uniquely named connectors
if(set_unique_name)
name = set_unique_name
force_name = TRUE
else if(!force_name)
name = "[flow_direction] hose connector" name = "[flow_direction] hose connector"
// Setup signaling
var/list/CL = carrier.GetComponents(type) var/list/CL = carrier.GetComponents(type)
connector_number = CL.len + 1 connector_number = CL.len + 1
RegisterSignal(carrier, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine)) RegisterSignal(carrier, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine))
@@ -78,7 +85,7 @@
if(!my_hose) if(!my_hose)
return return
process() process()
if(prob(5)) if(makes_gurgles && prob(5))
carrier.visible_message(span_infoplain(span_bold("\The [carrier]") + " gurgles as it pumps fluid.")) carrier.visible_message(span_infoplain(span_bold("\The [carrier]") + " gurgles as it pumps fluid."))
/datum/component/hose_connector/proc/valid_connection(var/datum/component/hose_connector/C) /datum/component/hose_connector/proc/valid_connection(var/datum/component/hose_connector/C)
@@ -225,13 +232,10 @@
/// Endless source, produces a reagent and pumps it out forever. Does not require attached object to have reagents. /// Endless source, produces a reagent and pumps it out forever. Does not require attached object to have reagents.
/datum/component/hose_connector/endless_source /datum/component/hose_connector/endless_source
name = "source connector" name = "source connector"
force_name = TRUE
flow_direction = HOSE_OUTPUT flow_direction = HOSE_OUTPUT
var/reagent_id = null var/reagent_id = null
/datum/component/hose_connector/endless_source/Initialize()
. = ..()
name = initial(name)
/datum/component/hose_connector/endless_source/connected_reagents() /datum/component/hose_connector/endless_source/connected_reagents()
if(!carrier) if(!carrier)
return null return null
@@ -247,12 +251,9 @@
/// Endless drain, removes reagents from existance /// Endless drain, removes reagents from existance
/datum/component/hose_connector/endless_drain /datum/component/hose_connector/endless_drain
name = "drain connector" name = "drain connector"
force_name = TRUE
flow_direction = HOSE_INPUT flow_direction = HOSE_INPUT
/datum/component/hose_connector/endless_drain/Initialize()
. = ..()
name = initial(name)
/datum/component/hose_connector/endless_drain/connected_reagents() /datum/component/hose_connector/endless_drain/connected_reagents()
if(!carrier) if(!carrier)
return null return null
@@ -261,3 +262,14 @@
/datum/component/hose_connector/endless_drain/handle_pump(var/datum/reagents/connected_to) /datum/component/hose_connector/endless_drain/handle_pump(var/datum/reagents/connected_to)
ASSERT(connected_to) ASSERT(connected_to)
connected_to.clear_reagents() connected_to.clear_reagents()
/// Moo, needed because it has a seperate reagent container as udder.
/datum/component/hose_connector/output/cow
name = "Udder"
force_name = TRUE
makes_gurgles = FALSE
/datum/component/hose_connector/output/cow/connected_reagents()
var/mob/living/simple_mob/animal/passive/cow/C = carrier
return C.udder

View File

@@ -16,6 +16,7 @@
. = ..() . = ..()
open = round(rand(0, 1)) open = round(rand(0, 1))
update_icon() update_icon()
AddComponent(/datum/component/hose_connector/endless_drain) // Cannot suck from toilet... for obvious reasons.
/obj/structure/toilet/attack_hand(mob/living/user as mob) /obj/structure/toilet/attack_hand(mob/living/user as mob)
if(swirlie) if(swirlie)

View File

@@ -30,6 +30,8 @@
udder = new(50) udder = new(50)
udder.my_atom = src udder.my_atom = src
AddComponent(/datum/component/hose_connector/output/cow) // Moo?
/mob/living/simple_mob/animal/passive/cow/attackby(var/obj/item/O as obj, var/mob/user as mob) /mob/living/simple_mob/animal/passive/cow/attackby(var/obj/item/O as obj, var/mob/user as mob)
var/obj/item/reagent_containers/glass/G = O var/obj/item/reagent_containers/glass/G = O
if(stat == CONSCIOUS && istype(G) && G.is_open_container()) if(stat == CONSCIOUS && istype(G) && G.is_open_container())