Merge pull request #8778 from VOREStation/upstream-merge-7534

[MIRROR] Emergency Travis Appeasement: Sacrifice of one Giant Spider, one HMS Jolly Pip, and one Capital City sacked and looted by Cultists
This commit is contained in:
Novacat
2020-08-21 01:41:39 -04:00
committed by GitHub
3 changed files with 277 additions and 1 deletions

View File

@@ -0,0 +1,92 @@
/obj/item/stack/hose
name = "plastic tubing"
singular_name = "plastic tube"
desc = "A non-reusable plastic tube for moving reagents to and fro. It looks flimsy."
description_info = "This tubing may be used to join two hose sockets, if able.<br>\
Clicking on an object with a connector, such as a water tank, will display a list of possible sockets.<br>\
Neutral can link to all socket types, and Input/Output sockets can link to all but their own type.<br><br>\
<span class='warning'>This hose does not stretch. The maximum distance you can move two objects from eachother\
without snapping the tube is determined by distance upon connection.</span>"
icon = 'icons/obj/machines/reagent.dmi'
icon_state = "hose"
origin_tech = list(TECH_MATERIAL = 2, TECH_ENGINEERING = 1)
amount = 1
w_class = ITEMSIZE_SMALL
no_variants = TRUE
var/obj/item/hose_connector/remembered = null
/obj/item/stack/hose/Destroy()
remembered = null
..()
/obj/item/stack/hose/CtrlClick(mob/user)
if(remembered)
to_chat(user, "<span class='notice'>You wind \the [src] back up.</span>")
remembered = null
return
/obj/item/stack/hose/afterattack(var/atom/target, var/mob/living/user, proximity, params)
if(!proximity)
return
var/list/available_sockets = list()
for(var/obj/item/hose_connector/HC in target.contents)
if(!HC.my_hose)
if(remembered)
if(HC.flow_direction == HOSE_NEUTRAL || HC.flow_direction != remembered.flow_direction)
available_sockets |= HC
else
available_sockets |= HC
if(LAZYLEN(available_sockets))
if(available_sockets.len == 1)
var/obj/item/hose_connector/AC = available_sockets[1]
if(remembered && remembered.valid_connection(AC))
var/distancetonode = get_dist(remembered,AC)
if(distancetonode > world.view)
to_chat(user, "<span class='notice'>\The [src] would probably burst if it were this long.</span>")
else if(distancetonode <= amount)
to_chat(user, "<span class='notice'>You join \the [remembered] to \the [AC]</span>")
remembered.setup_hoses(AC)
use(distancetonode)
remembered = null
else
to_chat(user, "<span class='notice'>You do not have enough tubing to connect the sockets.</span>")
else
remembered = AC
to_chat(user, "<span class='notice'>You connect one end of tubing to \the [AC].</span>")
else
var/choice = input("Select a target hose connector.", "Socket Selection", null) as null|anything in available_sockets
if(choice)
var/obj/item/hose_connector/CC = choice
if(remembered)
if(remembered.valid_connection(CC))
var/distancetonode = get_dist(remembered, CC)
if(distancetonode > world.view)
to_chat(user, "<span class='notice'>\The [src] would probably burst if it were this long.</span>")
else if(distancetonode <= amount)
to_chat(user, "<span class='notice'>You join \the [remembered] to \the [CC]</span>")
remembered.setup_hoses(CC)
use(distancetonode)
remembered = null
else
to_chat(user, "<span class='notice'>You do not have enough tubing to connect the sockets.</span>")
else
remembered = CC
to_chat(user, "<span class='notice'>You connect one end of tubing to \the [CC].</span>")
return
else
..()