mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-25 04:57:47 +01:00
Fixes some circuit bugs.
This commit is contained in:
@@ -339,7 +339,7 @@
|
||||
if(battery)
|
||||
var/lost = battery.use(amount * CELLRATE)
|
||||
net_power -= lost
|
||||
return TRUE
|
||||
return lost > 0
|
||||
return FALSE
|
||||
|
||||
// Ditto for giving.
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
desc = "A complicated piece of technology which converts bodily nutriments of a host into electricity."
|
||||
extended_desc = "The siphon generates 10W of energy, so long as the siphon exists inside a biological entity. The entity will feel an increased \
|
||||
appetite and will need to eat more often due to this. This device will fail if used inside synthetic entities."
|
||||
icon_state = "setup_implant"
|
||||
icon_state = "implant_power"
|
||||
complexity = 10
|
||||
origin_tech = list(TECH_POWER = 4, TECH_ENGINEERING = 4, TECH_DATA = 4, TECH_BIO = 5)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
@@ -82,8 +82,6 @@
|
||||
desc = "A small circuit designed to be connected to an internal power wire inside a synthetic entity."
|
||||
extended_desc = "The siphon generates 10W of energy, so long as the siphon exists inside a synthetic entity. The entity need to recharge \
|
||||
more often due to this. This device will fail if used inside organic entities."
|
||||
icon_state = "setup_implant"
|
||||
complexity = 10
|
||||
origin_tech = list(TECH_POWER = 3, TECH_ENGINEERING = 4, TECH_DATA = 3)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
/obj/item/integrated_circuit/output/screen
|
||||
name = "small screen"
|
||||
desc = "This small screen can display a single piece of data, when the machine is examined closely."
|
||||
extended_desc = "This will show the data loaded into it when the machine is examined."
|
||||
icon_state = "screen"
|
||||
inputs = list("displayed data" = IC_PINTYPE_ANY)
|
||||
outputs = list()
|
||||
activators = list("load data" = IC_PINTYPE_PULSE_IN)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 10
|
||||
cooldown_per_use = 0 // Can be updated frequently.
|
||||
var/stuff_to_display = null
|
||||
|
||||
|
||||
@@ -30,8 +32,9 @@
|
||||
stuff_to_display = I.data
|
||||
|
||||
/obj/item/integrated_circuit/output/screen/medium
|
||||
name = "screen"
|
||||
name = "medium screen"
|
||||
desc = "This screen allows for people holding the device to see a piece of data."
|
||||
extended_desc = "This will display a message to the user holding the assembly when activated."
|
||||
icon_state = "screen_medium"
|
||||
power_draw_per_use = 20
|
||||
|
||||
@@ -45,8 +48,10 @@
|
||||
/obj/item/integrated_circuit/output/screen/large
|
||||
name = "large screen"
|
||||
desc = "This screen allows for people able to see the device to see a piece of data."
|
||||
extended_desc = "This will display a message to everyone who can see the assembly when activated."
|
||||
icon_state = "screen_large"
|
||||
power_draw_per_use = 40
|
||||
cooldown_per_use = 1 SECOND // Because everyone will get the output instead of just the user/examiner.
|
||||
|
||||
/obj/item/integrated_circuit/output/screen/large/do_work()
|
||||
..()
|
||||
@@ -114,8 +119,8 @@
|
||||
|
||||
/obj/item/integrated_circuit/output/text_to_speech
|
||||
name = "text-to-speech circuit"
|
||||
desc = "A miniature speaker is attached to this component."
|
||||
extended_desc = "This unit is more advanced than the plain speaker circuit, able to transpose any valid text to speech."
|
||||
desc = "A miniature speaker is attached to this component. It is able to transpose any valid text to speech."
|
||||
extended_desc = "This will emit an audible message to anyone who can hear the assembly."
|
||||
icon_state = "speaker"
|
||||
complexity = 12
|
||||
cooldown_per_use = 4 SECONDS
|
||||
|
||||
@@ -7,79 +7,38 @@
|
||||
category_text = "Time"
|
||||
|
||||
/obj/item/integrated_circuit/time/delay
|
||||
name = "two-sec delay circuit"
|
||||
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||
This circuit is set to send a pulse after a delay of two seconds."
|
||||
icon_state = "delay-20"
|
||||
var/delay = 2 SECONDS
|
||||
name = "delay circuit"
|
||||
desc = "This sends a pulse signal out after a delay defined in tenths of a second, critical for ensuring proper \
|
||||
control flow in a complex machine. This circuit's delay can be customized, between 1/10th of a second to one hour. \
|
||||
The delay is updated upon receiving a pulse."
|
||||
extended_desc = "The delay is defined in tenths of a second. For instance, 4 will be a delay of 0.4 seconds, or 15 for 1.5 seconds."
|
||||
icon_state = "delay"
|
||||
inputs = list("delay time" = IC_PINTYPE_NUMBER)
|
||||
activators = list("incoming"= IC_PINTYPE_PULSE_IN,"outgoing" = IC_PINTYPE_PULSE_OUT)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 2
|
||||
var/delay = 20
|
||||
|
||||
/obj/item/integrated_circuit/time/delay/do_work()
|
||||
set waitfor = 0 // Don't sleep in a proc that is called by a processor. It'll delay the entire thing
|
||||
|
||||
sleep(delay)
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/time/delay/five_sec
|
||||
name = "five-sec delay circuit"
|
||||
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||
This circuit is set to send a pulse after a delay of five seconds."
|
||||
icon_state = "delay-50"
|
||||
delay = 5 SECONDS
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/time/delay/one_sec
|
||||
name = "one-sec delay circuit"
|
||||
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||
This circuit is set to send a pulse after a delay of one second."
|
||||
icon_state = "delay-10"
|
||||
delay = 1 SECOND
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/time/delay/half_sec
|
||||
name = "half-sec delay circuit"
|
||||
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||
This circuit is set to send a pulse after a delay of half a second."
|
||||
icon_state = "delay-5"
|
||||
delay = 5
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/time/delay/tenth_sec
|
||||
name = "tenth-sec delay circuit"
|
||||
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||
This circuit is set to send a pulse after a delay of 1/10th of a second."
|
||||
icon_state = "delay-1"
|
||||
delay = 1
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/time/delay/custom
|
||||
name = "custom delay circuit"
|
||||
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||
This circuit's delay can be customized, between 1/10th of a second to one hour. The delay is updated upon receiving a pulse."
|
||||
icon_state = "delay"
|
||||
inputs = list("delay time" = IC_PINTYPE_NUMBER)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/time/delay/custom/do_work()
|
||||
var/delay_input = get_pin_data(IC_INPUT, 1)
|
||||
if(delay_input && isnum(delay_input) )
|
||||
var/new_delay = between(1, delay_input, 36000) //An hour.
|
||||
var/new_delay = CLAMP(delay_input, 1, 1 HOUR)
|
||||
delay = new_delay
|
||||
|
||||
..()
|
||||
addtimer(CALLBACK(src, .proc/activate_pin, 2), delay)
|
||||
|
||||
/obj/item/integrated_circuit/time/ticker
|
||||
name = "ticker circuit"
|
||||
desc = "This circuit sends an automatic pulse every four seconds."
|
||||
icon_state = "tick-m"
|
||||
complexity = 8
|
||||
var/ticks_to_pulse = 4
|
||||
var/ticks_completed = 0
|
||||
var/is_running = FALSE
|
||||
inputs = list("enable ticking" = IC_PINTYPE_BOOLEAN)
|
||||
desc = "This circuit sends an automatic pulse every given interval, defined in tenths of a second."
|
||||
extended_desc ="This circuit sends an automatic pulse every given interval, defined in tenths of a second. \
|
||||
For example, setting the time pin to 4 will send a pulse every 0.4 seconds, or 15 for every 1.5 seconds.<br>\
|
||||
The power consumption will scale based on how fast this ticks. Also, note that most components have a short \
|
||||
internal cooldown when activated."
|
||||
icon_state = "tick-f"
|
||||
complexity = 10
|
||||
inputs = list("enable ticking" = IC_PINTYPE_BOOLEAN, "delay time" = IC_PINTYPE_NUMBER)
|
||||
activators = list("outgoing pulse" = IC_PINTYPE_PULSE_OUT)
|
||||
<<<<<<< HEAD
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
|
||||
@@ -87,11 +46,29 @@
|
||||
if(is_running)
|
||||
processing_objects -= src
|
||||
. = ..()
|
||||
=======
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 5
|
||||
var/delay = 2 SECONDS
|
||||
var/next_fire = 0
|
||||
var/is_running = FALSE
|
||||
// Power consumption scales based on how fast it ticks.
|
||||
// This, plus the fact it ticks more often will increase consumption non-linearly,
|
||||
// and the circuit cooldown and will hopefully discourage stupidly fast ticking machines.
|
||||
var/max_power_draw = 500
|
||||
>>>>>>> dcc6cad... Fixes some circuit bugs. (#5897)
|
||||
|
||||
/obj/item/integrated_circuit/time/ticker/on_data_written()
|
||||
var/delay_input = get_pin_data(IC_INPUT, 2)
|
||||
if(delay_input && isnum(delay_input) )
|
||||
var/new_delay = CLAMP(delay_input, 1, 1 HOUR)
|
||||
delay = new_delay
|
||||
power_draw_per_use = CEILING((max_power_draw / delay) / delay, 1)
|
||||
|
||||
var/do_tick = get_pin_data(IC_INPUT, 1)
|
||||
if(do_tick && !is_running)
|
||||
is_running = TRUE
|
||||
<<<<<<< HEAD
|
||||
processing_objects |= src
|
||||
else if(is_running)
|
||||
is_running = FALSE
|
||||
@@ -107,24 +84,19 @@
|
||||
else
|
||||
ticks_completed = 0
|
||||
activate_pin(1)
|
||||
=======
|
||||
tick()
|
||||
else if(!do_tick && is_running)
|
||||
is_running = FALSE
|
||||
>>>>>>> dcc6cad... Fixes some circuit bugs. (#5897)
|
||||
|
||||
/obj/item/integrated_circuit/time/ticker/fast
|
||||
name = "fast ticker"
|
||||
desc = "This advanced circuit sends an automatic pulse every two seconds."
|
||||
icon_state = "tick-f"
|
||||
complexity = 12
|
||||
ticks_to_pulse = 2
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 8
|
||||
|
||||
/obj/item/integrated_circuit/time/ticker/slow
|
||||
name = "slow ticker"
|
||||
desc = "This simple circuit sends an automatic pulse every six seconds."
|
||||
icon_state = "tick-s"
|
||||
complexity = 4
|
||||
ticks_to_pulse = 6
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 2
|
||||
/obj/item/integrated_circuit/time/ticker/proc/tick()
|
||||
if(is_running && check_power())
|
||||
addtimer(CALLBACK(src, .proc/tick), delay)
|
||||
if(world.time > next_fire)
|
||||
next_fire = world.time + delay
|
||||
activate_pin(1)
|
||||
|
||||
/obj/item/integrated_circuit/time/clock
|
||||
name = "integrated clock"
|
||||
@@ -148,4 +120,4 @@
|
||||
set_pin_data(IC_OUTPUT, 4, text2num(time2text(station_time_in_ticks, "ss") ) )
|
||||
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
activate_pin(2)
|
||||
|
||||
Reference in New Issue
Block a user