mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
circuitry upgrade pt 2 (#4213)
* 1.All reagent containers are acidproof now and have pin with self reference(to make it more easy to link them) 2.reagent scaner. It's like a beaker. But can give a list of contained reagents. 3.reagent filter. Pump,that can transfer only desired reagents,or all,except unwanted. 4.fuel cell.Converts chemicals to energy. 5.2 pins memory circuit. Sometimes it is very useful. 6.pulse demultiplexers. A lot like regular demultiplexer. But it doesn't distributes data. Just sends pulse to given activator pin. 7.list operations. choose element by index. write element by index. delete element by index search desired element in list. lenght of list. 8.strings: find element in string. explode string by delimeter. * athsmos sensors back. * fix
This commit is contained in:
@@ -29,6 +29,28 @@
|
||||
if(assembly)
|
||||
assembly.give_power(adjusted_power)
|
||||
|
||||
/obj/item/integrated_circuit/passive/power/starter
|
||||
name = "starter"
|
||||
desc = "This tiny circuit will send a pulse right after device is turned on, or when power is restored."
|
||||
icon_state = "led"
|
||||
complexity = 1
|
||||
activators = list("pulse out" = IC_PINTYPE_PULSE_OUT)
|
||||
origin_tech = list(TECH_POWER = 3, TECH_ENGINEERING = 3, TECH_DATA = 2)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
var/is_charge=0
|
||||
|
||||
/obj/item/integrated_circuit/passive/power/starter/make_energy()
|
||||
if(assembly.battery)
|
||||
if(assembly.battery.charge)
|
||||
if(!is_charge)
|
||||
activate_pin(1)
|
||||
is_charge=1
|
||||
else
|
||||
is_charge=0
|
||||
else
|
||||
is_charge=0
|
||||
return FALSE
|
||||
|
||||
// For implants.
|
||||
/obj/item/integrated_circuit/passive/power/metabolic_siphon
|
||||
name = "metabolic siphon"
|
||||
@@ -82,6 +104,44 @@
|
||||
origin_tech = list(TECH_POWER = 3, TECH_ENGINEERING = 3, TECH_DATA = 2)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
var/power_amount = 250
|
||||
//fuel cell
|
||||
|
||||
/obj/item/integrated_circuit/passive/power/chemical_cell
|
||||
name = "fuel cell"
|
||||
desc = "Produces electricity from chemicals."
|
||||
icon_state = "chemical_cell"
|
||||
extended_desc = "This is effectively an internal beaker. It will consume and produce power from phoron, slime jelly, welding fuel, carbon,\
|
||||
ethanol, nutriments and blood, in order of decreasing efficiency. It will consume fuel only if the battery can take more energy."
|
||||
flags = OPENCONTAINER
|
||||
complexity = 4
|
||||
inputs = list()
|
||||
outputs = list("volume used" = IC_PINTYPE_NUMBER,"self reference" = IC_PINTYPE_REF)
|
||||
activators = list()
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
var/volume = 60
|
||||
var/list/fuel = list("phoron" = 50000, "slimejelly" = 25000, "fuel" = 15000, "carbon" = 10000, "ethanol"= 10000, "nutriment" =8000, "blood" = 5000)
|
||||
|
||||
/obj/item/integrated_circuit/passive/power/chemical_cell/New()
|
||||
..()
|
||||
create_reagents(volume)
|
||||
|
||||
/obj/item/integrated_circuit/passive/power/chemical_cell/interact(mob/user)
|
||||
set_pin_data(IC_OUTPUT, 2, weakref(src))
|
||||
push_data()
|
||||
..()
|
||||
|
||||
/obj/item/integrated_circuit/passive/power/chemical_cell/on_reagent_change()
|
||||
set_pin_data(IC_OUTPUT, 1, reagents.total_volume)
|
||||
push_data()
|
||||
|
||||
/obj/item/integrated_circuit/passive/power/chemical_cell/make_energy()
|
||||
if(assembly)
|
||||
for(var/I in fuel)
|
||||
if((assembly.battery.maxcharge-assembly.battery.charge) / CELLRATE > fuel[I])
|
||||
if(reagents.remove_reagent(I, 1))
|
||||
assembly.give_power(fuel[I])
|
||||
|
||||
|
||||
// For really fat machines.
|
||||
/obj/item/integrated_circuit/passive/power/relay/large
|
||||
|
||||
@@ -27,13 +27,10 @@
|
||||
|
||||
/obj/item/integrated_circuit/transfer/multiplexer/do_work()
|
||||
var/input_index = get_pin_data(IC_INPUT, 1)
|
||||
var/output = null
|
||||
|
||||
if(!isnull(input_index) && (input_index >= 1 && input_index < inputs.len))
|
||||
output = get_pin_data(IC_INPUT, input_index + 1)
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, output)
|
||||
push_data()
|
||||
set_pin_data(IC_OUTPUT, 1,get_pin_data(IC_INPUT, input_index + 1))
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/transfer/multiplexer/medium
|
||||
@@ -79,10 +76,8 @@
|
||||
|
||||
/obj/item/integrated_circuit/transfer/demultiplexer/do_work()
|
||||
var/output_index = get_pin_data(IC_INPUT, 1)
|
||||
var/output = get_pin_data(IC_INPUT, 2)
|
||||
|
||||
for(var/i = 1 to outputs.len)
|
||||
set_pin_data(IC_OUTPUT, i, i == output_index ? output : null)
|
||||
set_pin_data(IC_OUTPUT, i, i == output_index ? get_pin_data(IC_INPUT, 2) : null)
|
||||
|
||||
activate_pin(2)
|
||||
|
||||
@@ -101,4 +96,51 @@
|
||||
name = "sixteen demultiplexer"
|
||||
icon_state = "dmux16"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
number_of_outputs = 16
|
||||
|
||||
/obj/item/integrated_circuit/transfer/pulsedemultiplexer
|
||||
name = "two pulse demultiplexer"
|
||||
desc = "Selector switch to choose the pin to be activated by number."
|
||||
extended_desc = "The first input pin is used to select which of the pulse out pins will be activated after activation of the circuit. \
|
||||
If the output selection is outside the valid range then no output is given."
|
||||
complexity = 2
|
||||
icon_state = "dmux2"
|
||||
inputs = list("output selection" = IC_PINTYPE_NUMBER)
|
||||
outputs = list()
|
||||
activators = list("select" = IC_PINTYPE_PULSE_IN)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
var/number_of_outputs = 2
|
||||
|
||||
/obj/item/integrated_circuit/transfer/pulsedemultiplexer/New()
|
||||
for(var/i = 1 to number_of_outputs)
|
||||
// outputs += "output [i]"
|
||||
activators["output [i]"] = IC_PINTYPE_PULSE_OUT
|
||||
complexity = number_of_outputs
|
||||
|
||||
..()
|
||||
desc += " It has [number_of_outputs] output pins."
|
||||
extended_desc += " This pulse demultiplexer has a range from 1 to [activators.len - 1]."
|
||||
|
||||
/obj/item/integrated_circuit/transfer/pulsedemultiplexer/do_work()
|
||||
var/output_index = get_pin_data(IC_INPUT, 1)
|
||||
|
||||
if(output_index == Clamp(output_index, 1, number_of_outputs))
|
||||
activate_pin(round(output_index + 1 ,1))
|
||||
|
||||
/obj/item/integrated_circuit/transfer/pulsedemultiplexer/medium
|
||||
name = "four pulse demultiplexer"
|
||||
icon_state = "dmux4"
|
||||
number_of_outputs = 4
|
||||
|
||||
/obj/item/integrated_circuit/transfer/pulsedemultiplexer/large
|
||||
name = "eight pulse demultiplexer"
|
||||
icon_state = "dmux8"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
number_of_outputs = 8
|
||||
|
||||
/obj/item/integrated_circuit/transfer/pulsedemultiplexer/huge
|
||||
name = "sixteen pulse demultiplexer"
|
||||
icon_state = "dmux16"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
number_of_outputs = 16
|
||||
@@ -110,8 +110,10 @@
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/input/adv_med_scanner
|
||||
name = "integrated advanced medical analyser"
|
||||
desc = "A very small version of the medbot's medical analyser. This allows the machine to know how healthy someone is. \
|
||||
|
||||
name = "integrated advanced medical analyzer"
|
||||
desc = "A very small version of the medibot's medical analyzer. This allows the machine to know how healthy someone is. \
|
||||
|
||||
This type is much more precise, allowing the machine to know much more about the target than a normal analyzer."
|
||||
icon_state = "medscan_adv"
|
||||
complexity = 12
|
||||
@@ -134,7 +136,9 @@
|
||||
var/mob/living/carbon/human/H = get_pin_data_as_type(IC_INPUT, 1, /mob/living/carbon/human)
|
||||
if(!istype(H)) //Invalid input
|
||||
return
|
||||
|
||||
if(H in view(get_turf(H))) // Like medbot's analyzer it can be used in range..
|
||||
|
||||
var/total_health = round(H.health/H.getMaxHealth(), 0.01)*100
|
||||
var/missing_health = H.getMaxHealth() - H.health
|
||||
|
||||
@@ -618,7 +622,6 @@
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/input/atmo_scanner
|
||||
name = "integrated atmospheric analyser"
|
||||
desc = "The same atmospheric analysis module that is integrated into every PDA. \
|
||||
@@ -850,4 +853,4 @@
|
||||
else
|
||||
set_pin_data(IC_OUTPUT, 1, 0)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
activate_pin(2)
|
||||
|
||||
@@ -52,12 +52,123 @@
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/list/search
|
||||
name = "search circuit"
|
||||
desc = "This circuit will give index of desired element in the list."
|
||||
extended_desc = "Search will start at 1 position and will return first matching position."
|
||||
inputs = list(
|
||||
"list" = IC_PINTYPE_LIST,
|
||||
"item" = IC_PINTYPE_ANY
|
||||
)
|
||||
outputs = list(
|
||||
"index" = IC_PINTYPE_NUMBER
|
||||
)
|
||||
icon_state = "addition"
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/list/search/do_work()
|
||||
var/list/input_list = get_pin_data(IC_INPUT, 1)
|
||||
var/item = get_pin_data(IC_INPUT, 2)
|
||||
set_pin_data(IC_OUTPUT, 1, input_list.Find(item))
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/list/at
|
||||
name = "at circuit"
|
||||
desc = "This circuit will pick an element from a list by index."
|
||||
extended_desc = "If there is no element with such index, result will be null."
|
||||
inputs = list(
|
||||
"list" = IC_PINTYPE_LIST,
|
||||
"index" = IC_PINTYPE_NUMBER
|
||||
)
|
||||
outputs = list("item" = IC_PINTYPE_ANY)
|
||||
icon_state = "addition"
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/list/at/do_work()
|
||||
var/list/input_list = get_pin_data(IC_INPUT, 1)
|
||||
var/index = get_pin_data(IC_INPUT, 2)
|
||||
var/item = input_list[index]
|
||||
set_pin_data(IC_OUTPUT, 1, item)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/list/delete
|
||||
name = "delete circuit"
|
||||
desc = "This circuit will delete the element from a list by index."
|
||||
extended_desc = "If there is no element with such index, result list will be unchanged."
|
||||
inputs = list(
|
||||
"list" = IC_PINTYPE_LIST,
|
||||
"index" = IC_PINTYPE_NUMBER
|
||||
)
|
||||
outputs = list(
|
||||
"item" = IC_PINTYPE_LIST
|
||||
)
|
||||
icon_state = "addition"
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/list/delete/do_work()
|
||||
var/list/input_list = get_pin_data(IC_INPUT, 1)
|
||||
var/list/red_list = list()
|
||||
var/index = get_pin_data(IC_INPUT, 2)
|
||||
var/j = 0
|
||||
for(var/I in input_list)
|
||||
j = j + 1
|
||||
if(j != index)
|
||||
red_list.Add(I)
|
||||
set_pin_data(IC_OUTPUT, 1, red_list)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/list/write
|
||||
name = "write circuit"
|
||||
desc = "This circuit will write element in list with given index."
|
||||
extended_desc = "If there is no element with such index, it will give the same list, as before."
|
||||
inputs = list(
|
||||
"list" = IC_PINTYPE_LIST,
|
||||
"index" = IC_PINTYPE_NUMBER,
|
||||
"item" = IC_PINTYPE_ANY
|
||||
)
|
||||
outputs = list(
|
||||
"redacted list" = IC_PINTYPE_LIST
|
||||
)
|
||||
icon_state = "addition"
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/list/write/do_work()
|
||||
var/list/input_list = get_pin_data(IC_INPUT, 1)
|
||||
var/index = get_pin_data(IC_INPUT, 2)
|
||||
var/item = get_pin_data(IC_INPUT, 3)
|
||||
input_list[index] = item
|
||||
set_pin_data(IC_OUTPUT, 1, input_list)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
obj/item/integrated_circuit/list/len
|
||||
name = "len circuit"
|
||||
desc = "This circuit will give length of the list."
|
||||
inputs = list(
|
||||
"list" = IC_PINTYPE_LIST,
|
||||
)
|
||||
outputs = list(
|
||||
"item" = IC_PINTYPE_NUMBER
|
||||
)
|
||||
icon_state = "addition"
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/list/len/do_work()
|
||||
var/list/input_list = get_pin_data(IC_INPUT, 1)
|
||||
set_pin_data(IC_OUTPUT, 1, input_list.len)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/list/jointext
|
||||
name = "join text circuit"
|
||||
desc = "This circuit will add all elements of a list into one string, seperated by a character."
|
||||
extended_desc = "Default settings will encode the entire list into a string."
|
||||
inputs = list(
|
||||
"list to join" = IC_PINTYPE_LIST,
|
||||
"list to join" = IC_PINTYPE_LIST,//
|
||||
"delimiter" = IC_PINTYPE_CHAR,
|
||||
"start" = IC_PINTYPE_NUMBER,
|
||||
"end" = IC_PINTYPE_NUMBER
|
||||
|
||||
@@ -40,8 +40,15 @@
|
||||
O.push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/memory/tiny
|
||||
name = "small memory circuit"
|
||||
desc = "This circuit can store two pieces of data."
|
||||
icon_state = "memory2"
|
||||
power_draw_per_use = 2
|
||||
number_of_pins = 2
|
||||
|
||||
/obj/item/integrated_circuit/memory/medium
|
||||
name = "memory circuit"
|
||||
name = "medium memory circuit"
|
||||
desc = "This circuit can store four pieces of data."
|
||||
icon_state = "memory4"
|
||||
power_draw_per_use = 2
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
amount_to_move = 20000
|
||||
|
||||
/obj/item/integrated_circuit/power/transmitter/do_work()
|
||||
set_pin_data(IC_OUTPUT, 1, null)
|
||||
set_pin_data(IC_OUTPUT, 2, null)
|
||||
set_pin_data(IC_OUTPUT, 3, null)
|
||||
|
||||
var/atom/movable/AM = get_pin_data_as_type(IC_INPUT, 1, /atom/movable)
|
||||
if(AM)
|
||||
if(!assembly)
|
||||
@@ -72,7 +70,15 @@
|
||||
set_pin_data(IC_OUTPUT, 2, cell.maxcharge)
|
||||
set_pin_data(IC_OUTPUT, 3, cell.percent())
|
||||
activate_pin(2)
|
||||
push_data()
|
||||
return TRUE
|
||||
else
|
||||
set_pin_data(IC_OUTPUT, 1, null)
|
||||
set_pin_data(IC_OUTPUT, 2, null)
|
||||
set_pin_data(IC_OUTPUT, 3, null)
|
||||
activate_pin(2)
|
||||
push_data()
|
||||
return FALSE
|
||||
return FALSE
|
||||
|
||||
/obj/item/integrated_circuit/power/transmitter/large/do_work()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/obj/item/integrated_circuit/reagent
|
||||
category_text = "Reagent"
|
||||
var/volume = 0
|
||||
unacidable = 1
|
||||
phoronproof = 1
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
|
||||
/obj/item/integrated_circuit/reagent/New()
|
||||
@@ -18,13 +20,23 @@
|
||||
complexity = 20
|
||||
cooldown_per_use = 30 SECONDS
|
||||
inputs = list()
|
||||
outputs = list()
|
||||
activators = list("create smoke" = IC_PINTYPE_PULSE_IN)
|
||||
outputs = list("volume used" = IC_PINTYPE_NUMBER,"self reference" = IC_PINTYPE_REF)
|
||||
activators = list("create smoke" = IC_PINTYPE_PULSE_IN,"on smoked" = IC_PINTYPE_PULSE_OUT)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_BIO = 3)
|
||||
volume = 100
|
||||
power_draw_per_use = 20
|
||||
|
||||
/obj/item/integrated_circuit/reagent/smoke/on_reagent_change()
|
||||
set_pin_data(IC_OUTPUT, 1, reagents.total_volume)
|
||||
push_data()
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/reagent/smoke/interact(mob/user)
|
||||
set_pin_data(IC_OUTPUT, 2, weakref(src))
|
||||
push_data()
|
||||
..()
|
||||
|
||||
/obj/item/integrated_circuit/reagent/smoke/do_work()
|
||||
playsound(src.loc, 'sound/effects/smoke.ogg', 50, 1, -3)
|
||||
var/datum/effect/effect/system/smoke_spread/chem/smoke_system = new()
|
||||
@@ -33,52 +45,141 @@
|
||||
for(var/i = 1 to 8)
|
||||
smoke_system.start()
|
||||
reagents.clear_reagents()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/reagent/injector
|
||||
name = "integrated hypo-injector"
|
||||
desc = "This scary looking thing is able to pump liquids into whatever it's pointed at."
|
||||
icon_state = "injector"
|
||||
extended_desc = "This autoinjector can push reagents into another container or someone else outside of the machine. The target \
|
||||
must be adjacent to the machine, and if it is a person, they cannot be wearing thick clothing."
|
||||
must be adjacent to the machine, and if it is a person, they cannot be wearing thick clothing. A negative amount makes the injector draw out reagents."
|
||||
flags = OPENCONTAINER
|
||||
complexity = 20
|
||||
cooldown_per_use = 6 SECONDS
|
||||
inputs = list("target" = IC_PINTYPE_REF, "injection amount" = IC_PINTYPE_NUMBER)
|
||||
inputs_default = list("2" = 5)
|
||||
outputs = list()
|
||||
activators = list("inject" = IC_PINTYPE_PULSE_IN)
|
||||
outputs = list("volume used" = IC_PINTYPE_NUMBER,"self reference" = IC_PINTYPE_REF)
|
||||
activators = list("inject" = IC_PINTYPE_PULSE_IN, "on injected" = IC_PINTYPE_PULSE_OUT, "on fail" = IC_PINTYPE_PULSE_OUT)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
volume = 30
|
||||
power_draw_per_use = 15
|
||||
var/direc = 1
|
||||
var/transfer_amount = 10
|
||||
|
||||
/obj/item/integrated_circuit/reagent/injector/interact(mob/user)
|
||||
set_pin_data(IC_OUTPUT, 2, weakref(src))
|
||||
push_data()
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/reagent/injector/on_reagent_change()
|
||||
set_pin_data(IC_OUTPUT, 1, reagents.total_volume)
|
||||
push_data()
|
||||
|
||||
/obj/item/integrated_circuit/reagent/injector/on_data_written()
|
||||
var/new_amount = get_pin_data(IC_INPUT, 2)
|
||||
if(new_amount < 0)
|
||||
new_amount = -new_amount
|
||||
direc = 0
|
||||
else
|
||||
direc = 1
|
||||
if(isnum(new_amount))
|
||||
new_amount = Clamp(new_amount, 0, volume)
|
||||
transfer_amount = new_amount
|
||||
|
||||
/obj/item/integrated_circuit/reagent/injector/proc/inject_amount()
|
||||
var/amount = get_pin_data(IC_INPUT, 2)
|
||||
if(isnum(amount))
|
||||
return Clamp(amount, 0, 30)
|
||||
|
||||
/obj/item/integrated_circuit/reagent/injector/do_work()
|
||||
set waitfor = 0 // Don't sleep in a proc that is called by a processor without this set, otherwise it'll delay the entire thing
|
||||
|
||||
var/atom/movable/AM = get_pin_data_as_type(IC_INPUT, 1, /atom/movable)
|
||||
if(!istype(AM)) //Invalid input
|
||||
activate_pin(3)
|
||||
return
|
||||
if(!reagents.total_volume) // Empty
|
||||
return
|
||||
if(AM.can_be_injected_by(src))
|
||||
if(isliving(AM))
|
||||
var/mob/living/L = AM
|
||||
var/turf/T = get_turf(AM)
|
||||
T.visible_message("<span class='warning'>[src] is trying to inject [L]!</span>")
|
||||
sleep(3 SECONDS)
|
||||
if(!L.can_be_injected_by(src))
|
||||
|
||||
if(direc == 1)
|
||||
|
||||
if(!istype(AM)) //Invalid input
|
||||
activate_pin(3)
|
||||
return
|
||||
if(!reagents.total_volume) // Empty
|
||||
activate_pin(3)
|
||||
return
|
||||
if(AM.can_be_injected_by(src))
|
||||
if(isliving(AM))
|
||||
var/mob/living/L = AM
|
||||
var/turf/T = get_turf(AM)
|
||||
T.visible_message("<span class='warning'>[src] is trying to inject [L]!</span>")
|
||||
sleep(3 SECONDS)
|
||||
if(!L.can_be_injected_by(src))
|
||||
activate_pin(3)
|
||||
return
|
||||
var/contained = reagents.get_reagents()
|
||||
var/trans = reagents.trans_to_mob(L, transfer_amount, CHEM_BLOOD)
|
||||
message_admins("[src] injected \the [L] with [trans]u of [contained].")
|
||||
to_chat(AM, "<span class='notice'>You feel a tiny prick!</span>")
|
||||
visible_message("<span class='warning'>[src] injects [L]!</span>")
|
||||
else
|
||||
reagents.trans_to(AM, transfer_amount)
|
||||
else
|
||||
|
||||
if(reagents.total_volume >= volume) // Full
|
||||
activate_pin(3)
|
||||
return
|
||||
var/obj/target = AM
|
||||
if(!target.reagents)
|
||||
activate_pin(3)
|
||||
return
|
||||
var/turf/TS = get_turf(src)
|
||||
var/turf/TT = get_turf(AM)
|
||||
if(!TS.Adjacent(TT))
|
||||
activate_pin(3)
|
||||
return
|
||||
var/tramount = Clamp(min(transfer_amount, reagents.maximum_volume - reagents.total_volume), 0, reagents.maximum_volume)
|
||||
if(ismob(target))//Blood!
|
||||
if(istype(target, /mob/living/carbon))
|
||||
var/mob/living/carbon/T = target
|
||||
if(!T.dna)
|
||||
if(T.reagents.trans_to_obj(src, tramount))
|
||||
activate_pin(2)
|
||||
else
|
||||
activate_pin(3)
|
||||
return
|
||||
if(NOCLONE in T.mutations) //target done been et, no more blood in him
|
||||
if(T.reagents.trans_to_obj(src, tramount))
|
||||
activate_pin(2)
|
||||
else
|
||||
activate_pin(3)
|
||||
return
|
||||
return
|
||||
var/datum/reagent/B
|
||||
if(istype(T, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = T
|
||||
if(H.species && !H.should_have_organ(O_HEART))
|
||||
H.reagents.trans_to_obj(src, tramount)
|
||||
else
|
||||
B = T.take_blood(src, tramount)
|
||||
else
|
||||
B = T.take_blood(src,tramount)
|
||||
if (B)
|
||||
reagents.reagent_list |= B
|
||||
reagents.update_total()
|
||||
on_reagent_change()
|
||||
reagents.handle_reactions()
|
||||
B = null
|
||||
visible_message( "<span class='notice'>Machine takes a blood sample from [target].</span>")
|
||||
else
|
||||
activate_pin(3)
|
||||
return
|
||||
var/contained = reagents.get_reagents()
|
||||
var/trans = reagents.trans_to_mob(L, inject_amount(), CHEM_BLOOD)
|
||||
message_admins("[src] injected \the [L] with [trans]u of [contained].")
|
||||
to_chat(AM, "<span class='notice'>You feel a tiny prick!</span>")
|
||||
visible_message("<span class='warning'>[src] injects [L]!</span>")
|
||||
else
|
||||
reagents.trans_to(AM, inject_amount())
|
||||
|
||||
else //if not mob
|
||||
if(!target.reagents.total_volume)
|
||||
visible_message( "<span class='notice'>[target] is empty.</span>")
|
||||
activate_pin(3)
|
||||
return
|
||||
target.reagents.trans_to_obj(src, tramount)
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/reagent/pump
|
||||
name = "reagent pump"
|
||||
@@ -96,11 +197,17 @@
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
var/transfer_amount = 10
|
||||
var/direc = 1
|
||||
power_draw_per_use = 10
|
||||
|
||||
/obj/item/integrated_circuit/reagent/pump/on_data_written()
|
||||
var/new_amount = get_pin_data(IC_INPUT, 3)
|
||||
if(!isnull(new_amount))
|
||||
if(new_amount < 0)
|
||||
new_amount = -new_amount
|
||||
direc = 0
|
||||
else
|
||||
direc = 1
|
||||
if(isnum(new_amount))
|
||||
new_amount = Clamp(new_amount, 0, 50)
|
||||
transfer_amount = new_amount
|
||||
|
||||
@@ -111,17 +218,23 @@
|
||||
if(!istype(source) || !istype(target)) //Invalid input
|
||||
return
|
||||
var/turf/T = get_turf(src)
|
||||
if(source.Adjacent(T) && target.Adjacent(T))
|
||||
var/turf/TS = get_turf(source)
|
||||
var/turf/TT = get_turf(target)
|
||||
if(TS.Adjacent(T) && TT.Adjacent(T))
|
||||
if(!source.reagents || !target.reagents)
|
||||
return
|
||||
if(ismob(source) || ismob(target))
|
||||
return
|
||||
if(!source.is_open_container() || !target.is_open_container())
|
||||
return
|
||||
if(!target.reagents.get_free_space())
|
||||
return
|
||||
|
||||
source.reagents.trans_to(target, transfer_amount)
|
||||
if(direc)
|
||||
if(!target.reagents.get_free_space())
|
||||
return
|
||||
source.reagents.trans_to(target, transfer_amount)
|
||||
else
|
||||
if(!source.reagents.get_free_space())
|
||||
return
|
||||
target.reagents.trans_to(source, transfer_amount)
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/reagent/storage
|
||||
@@ -132,12 +245,18 @@
|
||||
flags = OPENCONTAINER
|
||||
complexity = 4
|
||||
inputs = list()
|
||||
outputs = list("volume used" = IC_PINTYPE_NUMBER)
|
||||
outputs = list("volume used" = IC_PINTYPE_NUMBER,"self reference" = IC_PINTYPE_REF)
|
||||
activators = list()
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
volume = 60
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/reagent/storage/interact(mob/user)
|
||||
set_pin_data(IC_OUTPUT, 2, weakref(src))
|
||||
push_data()
|
||||
..()
|
||||
|
||||
/obj/item/integrated_circuit/reagent/storage/on_reagent_change()
|
||||
set_pin_data(IC_OUTPUT, 1, reagents.total_volume)
|
||||
push_data()
|
||||
@@ -150,4 +269,95 @@
|
||||
flags = OPENCONTAINER | NOREACT
|
||||
complexity = 8
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
origin_tech = list(TECH_MATERIALS = 4, TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
|
||||
/obj/item/integrated_circuit/reagent/storage/big
|
||||
name = "big reagent storage"
|
||||
desc = "Stores liquid inside, and away from electrical components. Can store up to 180u."
|
||||
icon_state = "reagent_storage_big"
|
||||
extended_desc = "This is effectively an internal beaker."
|
||||
flags = OPENCONTAINER
|
||||
complexity = 16
|
||||
volume = 180
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_MATERIALS = 3, TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
|
||||
/obj/item/integrated_circuit/reagent/storage/scan
|
||||
name = "reagent scanner"
|
||||
desc = "Stores liquid inside, and away from electrical components. Can store up to 60u. On pulse this beaker will send list of contained reagents."
|
||||
icon_state = "reagent_scan"
|
||||
extended_desc = "Mostly useful for reagent filter."
|
||||
flags = OPENCONTAINER
|
||||
complexity = 8
|
||||
outputs = list("volume used" = IC_PINTYPE_NUMBER,"self reference" = IC_PINTYPE_REF,"list of reagents" = IC_PINTYPE_LIST)
|
||||
activators = list("scan" = IC_PINTYPE_PULSE_IN)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_MATERIALS = 3, TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
|
||||
/obj/item/integrated_circuit/reagent/storage/scan/do_work()
|
||||
var/cont[0]
|
||||
for(var/datum/reagent/RE in reagents.reagent_list)
|
||||
cont += RE.id
|
||||
set_pin_data(IC_OUTPUT, 3, cont)
|
||||
push_data()
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/reagent/filter
|
||||
name = "reagent filter"
|
||||
desc = "Filtering liquids by list of desired or unwanted reagents."
|
||||
icon_state = "reagent_filter"
|
||||
extended_desc = "This is a filter which will move liquids from the source ref to the target ref. \
|
||||
It will move all reagents, except list, given in fourth pin if amount value is positive.\
|
||||
Or it will move only desired reagents if amount is negative, The third pin determines \
|
||||
how much reagent is moved per pulse, between 0 and 50. Amount is given for each separate reagent."
|
||||
flags = OPENCONTAINER
|
||||
complexity = 8
|
||||
inputs = list("source" = IC_PINTYPE_REF, "target" = IC_PINTYPE_REF, "injection amount" = IC_PINTYPE_NUMBER, "list of reagents" = IC_PINTYPE_LIST)
|
||||
inputs_default = list("3" = 5)
|
||||
outputs = list()
|
||||
activators = list("transfer reagents" = IC_PINTYPE_PULSE_IN, "on transfer" = IC_PINTYPE_PULSE_OUT)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
var/transfer_amount = 10
|
||||
var/direc = 1
|
||||
power_draw_per_use = 10
|
||||
|
||||
/obj/item/integrated_circuit/reagent/filter/on_data_written()
|
||||
var/new_amount = get_pin_data(IC_INPUT, 3)
|
||||
if(new_amount < 0)
|
||||
new_amount = -new_amount
|
||||
direc = 0
|
||||
else
|
||||
direc = 1
|
||||
if(isnum(new_amount))
|
||||
new_amount = Clamp(new_amount, 0, 50)
|
||||
transfer_amount = new_amount
|
||||
|
||||
/obj/item/integrated_circuit/reagent/filter/do_work()
|
||||
var/atom/movable/source = get_pin_data_as_type(IC_INPUT, 1, /atom/movable)
|
||||
var/atom/movable/target = get_pin_data_as_type(IC_INPUT, 2, /atom/movable)
|
||||
var/list/demand = get_pin_data(IC_INPUT, 4)
|
||||
if(!istype(source) || !istype(target)) //Invalid input
|
||||
return
|
||||
var/turf/T = get_turf(src)
|
||||
if(source.Adjacent(T) && target.Adjacent(T))
|
||||
if(!source.reagents || !target.reagents)
|
||||
return
|
||||
if(ismob(source) || ismob(target))
|
||||
return
|
||||
if(!source.is_open_container() || !target.is_open_container())
|
||||
return
|
||||
if(!target.reagents.get_free_space())
|
||||
return
|
||||
for(var/datum/reagent/G in source.reagents.reagent_list)
|
||||
if (!direc)
|
||||
if(G.id in demand)
|
||||
source.reagents.trans_id_to(target, G.id, transfer_amount)
|
||||
else
|
||||
if(!(G.id in demand))
|
||||
source.reagents.trans_id_to(target, G.id, transfer_amount)
|
||||
activate_pin(2)
|
||||
push_data()
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user