Comments (5)
Actually, nevermind that fix. That fixed my local "replication" of the issue, but the issue on the server seems to involve multiple detectors in a sequence or something, so they're still creating an infinite loop and crashing.
from techpack.
And actually, you can create this issue just by creating a long enough linear sequence of detectors (though you need quite a few). No loop required.
from techpack.
What about that proposal?
diff --git a/tubelib_addons1/detector.lua b/tubelib_addons1/detector.lua
index f7c5ad9..7bfd552 100644
--- a/tubelib_addons1/detector.lua
+++ b/tubelib_addons1/detector.lua
@@ -19,14 +19,17 @@ local function switch_on(pos)
node.name = "tubelib_addons1:detector_active"
minetest.swap_node(pos, node)
minetest.get_node_timer(pos):start(1)
- local meta = minetest.get_meta(pos)
- local own_num = meta:get_string("own_num")
- local numbers = meta:get_string("numbers")
- local placer_name = meta:get_string("placer_name")
- tubelib.send_message(numbers, placer_name, nil, "on", own_num)
end
end
+local function send_on_msg(pos)
+ local meta = minetest.get_meta(pos)
+ local own_num = meta:get_string("own_num")
+ local numbers = meta:get_string("numbers")
+ local placer_name = meta:get_string("placer_name")
+ tubelib.send_message(numbers, placer_name, nil, "on", own_num)
+end
+
local function switch_off(pos)
if tubelib.data_not_corrupted(pos) then
local node = minetest.get_node(pos)
@@ -128,12 +131,12 @@ minetest.register_craft({
},
})
-
-tubelib.register_node("tubelib_addons1:detector", {"tubelib_addons1:detector_active"}, {
+tubelib.register_node("tubelib_addons1:detector", {}, {
on_push_item = function(pos, side, item)
local player_name = minetest.get_meta(pos):get_string("player_name")
+ switch_on(pos)
if tubelib.push_items(pos, "R", item, player_name) then
- switch_on(pos)
+ send_on_msg(pos)
return true
end
return false
It will not solve the "endless line of detectors", but is this a real server scenario?
from techpack.
If I'm reading that right, as soon as something possibly comes in, it switches the machine to the "on" node, and so, because you removed the active node from the declaration, no longer can process input. Then it does the check of where to sends stuff, and if that succeeds, it triggers the send message logic.
That sounds like it should work, but here's my 2nd solution on BlS, which simply refuses all input on the detector except from the appropriate side. I reverted the "self loop" check I had earlier. This prevented the issue in all configurations I could cook up.
I did a quick check and am (nearly) certain there aren't any other machines that accept items and immediately send them out again, so this is probably the only change needed to prevent stack overflows (unless something really insane happens). At this point, I feel the issue of someone putting several thousand detectors in series isn't really a sensible concern, so I'm happy with my solution.
The "broken" machines on BlS turned out to be two detectors that were both aimed at each others output, due to a couple of misconfigured teleporters.
from techpack.
You are right, your proposal is much better. I will take it over. Thanks
from techpack.
Related Issues (20)
- TechPack on 5.4.1 Server Doesn't Display Recipe for Gravel Sieve, An Overlooked Modding Error? HOT 5
- feature/enhancement request: make harvester.MAX_HEIGHT configurable in the in-game UI (like radius) HOT 1
- Papyrus is always considered as oven fuel HOT 4
- Add to mod somthing like OpenComputers HOT 2
- I found this in my Logs HOT 1
- HP pusher back texture is rotated 180 twice resulting in the texture being reverse HOT 1
- minetest 5.4.1 and minetest 5.6.0-dev not works HOT 1
- TNT causes issues with functional blocks HOT 1
- Can't get tubelib to put fuel into lwcomponents forcefield generator HOT 3
- Request: Tubelib compatibility with elepower HOT 1
- Request: tubelib comparability with lwcomponents HOT 1
- SmartLine State Collector doesn't have "running" state
- Disable connection and pushing into certain sides of certain nodes
- Warehouse stacks can exceed their limits if items are manually put in
- Major issue!!! tubelib.register_node is undefined on master HOT 2
- Feature request: Configurable sieves
- New Feature: Pushing Detector HOT 17
- Items can be injected into tubes from the side HOT 1
- Defective warehouses call `after_dig_node` which does not exist HOT 1
- `filter` is nil on highperf distributors for some reason HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from techpack.