diff --git a/Items/items.xml b/Items/items.xml
index 3652c12..64f425a 100644
--- a/Items/items.xml
+++ b/Items/items.xml
@@ -19,6 +19,25 @@
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -39,6 +58,26 @@
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/Lua/Autorun/autorun.lua b/Lua/Autorun/autorun.lua
index 5ee8553..634a192 100644
--- a/Lua/Autorun/autorun.lua
+++ b/Lua/Autorun/autorun.lua
@@ -1,6 +1,8 @@
local moduleNames = {
"flipflopcomponent",
+ -- "activeflipflopcomponent",
"countercomponent",
+ -- "activecountercomponent",
"reactorcontrollercomponent",
}
diff --git a/Lua/activecountercomponen.lua b/Lua/activecountercomponen.lua
new file mode 100644
index 0000000..790c6cb
--- /dev/null
+++ b/Lua/activecountercomponen.lua
@@ -0,0 +1,36 @@
+local allItems = {}
+
+Hook.Add("item.created", "activecountercomponent.init", function(item)
+ if item.Prefab.Identifier == "activecountercomponent" then
+ allItems[item] = true
+ end
+end)
+
+local signalReceived = function(signal, connection)
+ local this = connection.Item
+ local mem = this.Components[2]
+
+ if signal.value == "" then return end
+ local input = tonumber(signal.value) or 1
+
+ if input > 0 then
+ if tonumber(mem.value) >= this.Components[3].clampMax then
+ mem.value = tostring(this.Components[3].clampMin)
+ else
+ mem.value = tostring(tonumber(mem.value) + 1)
+ end
+ elseif input == 0 then
+ mem.value = "0"
+ elseif input < 0 then
+ mem.value = tostring(-input)
+ end
+end
+
+local think = function()
+ for component, _ in pairs(allItems) do
+ component.SendSignal(component.Components[2].value, "state_out")
+ end
+end
+
+Hook.Add("think", "activecountercomponent.think", think)
+Hook.Add("signalreceived.activecountercomponent", "activecountercomponent.signalReceived", signalReceived)
diff --git a/Lua/activeflipflopcomponent.lua b/Lua/activeflipflopcomponent.lua
new file mode 100644
index 0000000..a5066a0
--- /dev/null
+++ b/Lua/activeflipflopcomponent.lua
@@ -0,0 +1,32 @@
+local allItems = {}
+
+Hook.Add("item.created", "activeflipflopcomponent.init", function(item)
+ if item.Prefab.Identifier == "activeflipflopcomponent" then
+ allItems[item] = true
+ end
+end)
+
+local signalReceived = function(signal, connection)
+ local this = connection.Item
+ local mem = this.Components[2]
+
+ if signal.value == "" then return end
+ local input = tonumber(signal.value) or 1
+
+ if input == 1 then
+ if mem.value == "0" then mem.value = "1" else mem.value = "0" end
+ elseif input == 0 then
+ mem.value = "0"
+ elseif input == -1 then
+ mem.value = "1"
+ end
+end
+
+local think = function()
+ for component, _ in pairs(allItems) do
+ component.SendSignal(component.Components[2].value, "state_out")
+ end
+end
+
+Hook.Add("think", "activeflipflopcomponent.think", think)
+Hook.Add("signalreceived.activeflipflopcomponent", "activeflipflopcomponent.signalReceived", signalReceived)
diff --git a/Lua/countercomponent.lua b/Lua/countercomponent.lua
index bcc5439..84609bf 100644
--- a/Lua/countercomponent.lua
+++ b/Lua/countercomponent.lua
@@ -1,11 +1,3 @@
-local allItems = {}
-
-Hook.Add("item.created", "countercomponent.init", function(item)
- if item.Prefab.Identifier == "countercomponent" then
- allItems[item] = true
- end
-end)
-
local signalReceived = function(signal, connection)
local this = connection.Item
local mem = this.Components[2]
@@ -24,13 +16,8 @@ local signalReceived = function(signal, connection)
elseif input < 0 then
mem.value = tostring(-input)
end
+
+ this.SendSignal(mem.value, "state_out")
end
-local think = function()
- for component, _ in pairs(allItems) do
- component.SendSignal(component.Components[2].value, "state_out")
- end
-end
-
-Hook.Add("think", "countercomponent.think", think)
Hook.Add("signalreceived.countercomponent", "countercomponent.signalReceived", signalReceived)
diff --git a/Lua/flipflopcomponent.lua b/Lua/flipflopcomponent.lua
index 87a4dbc..dfff637 100644
--- a/Lua/flipflopcomponent.lua
+++ b/Lua/flipflopcomponent.lua
@@ -1,11 +1,3 @@
-local allItems = {}
-
-Hook.Add("item.created", "flipflopcomponent.init", function(item)
- if item.Prefab.Identifier == "flipflopcomponent" then
- allItems[item] = true
- end
-end)
-
local signalReceived = function(signal, connection)
local this = connection.Item
local mem = this.Components[2]
@@ -20,13 +12,8 @@ local signalReceived = function(signal, connection)
elseif input == -1 then
mem.value = "1"
end
+
+ this.sendSignal(mem.value, "state_out")
end
-local think = function()
- for component, _ in pairs(allItems) do
- component.SendSignal(component.Components[2].value, "state_out")
- end
-end
-
-Hook.Add("think", "flipflopcomponent.think", think)
Hook.Add("signalreceived.flipflopcomponent", "flipflopcomponent.signalReceived", signalReceived)
diff --git a/Texts/en_us.xml b/Texts/en_us.xml
index fd4d030..df22570 100644
--- a/Texts/en_us.xml
+++ b/Texts/en_us.xml
@@ -3,9 +3,15 @@
Flip-Flop Component
Switches state when receiving 1, forces state to X when receiving -X.
+ Active Flip-Flop Component
+ Switches state when receiving 1, forces state to X when receiving -X. Sends a signal constantly.
+
Counter Component\
Counts up to ClampMax when receiving 1, resets to ClampMin when reached, forces state to X when receiving -X.
+ Active Counter Component\
+ Counts up to ClampMax when receiving 1, resets to ClampMin when reached, forces state to X when receiving -X. Sends a signal constantly.
+
Reactor Controller Component
Automatically sets a reactor's Fission Rate and Turbine Output.
diff --git a/filelist.xml b/filelist.xml
index 94e7f32..48c4d57 100644
--- a/filelist.xml
+++ b/filelist.xml
@@ -6,6 +6,8 @@
+
+