Difference between revisions of "Mesecons guidelines"
Jump to navigation
Jump to search
Line 13: | Line 13: | ||
==== On/Off switches ==== | ==== On/Off switches ==== | ||
− | + | * Please add On/Off switches to your machinery and toggle them on only if you use them | |
==== Intervals ==== | ==== Intervals ==== | ||
− | + | * Use intervals of 5 seconds or more, depending on how much is connected to the wire | |
+ | * Shorter intervals are ok if the executed action is not that heavy (for example: a simple light or signal) | ||
+ | ==== Size/Length limits ==== | ||
− | [[Category: | + | * Try to limit the amount of machines triggered by LuaC's or blinkys |
+ | |||
+ | {| class="wikitable" style="float:right;" | ||
+ | !colspan="10"| This should work fine with a 3 to 5 seconds interval | ||
+ | |- | ||
+ | !colspan="10"|[[File:monitoring-mesecons-2.png|400px]] | ||
+ | |} | ||
+ | |||
+ | ==== Luacontroller with on/off switch ==== | ||
+ | |||
+ | The following program generates a signal-change every 5 seconds. | ||
+ | It can be toggled with a switch on '''port A''' and generates the signal on '''port B''' | ||
+ | |||
+ | <syntaxhighlight lang="Lua"> | ||
+ | if event.type == "program" or event.type == "interrupt" then | ||
+ | interrupt(5) | ||
+ | if not pin.a then | ||
+ | return | ||
+ | end | ||
+ | port.b = not port.b | ||
+ | end | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==== Debugging ==== | ||
+ | |||
+ | * Use the Monitoring page to see how the mesecons are working right now: https://monitoring.minetest.land/d/LjYzPumWz/mesecons?orgId=1&refresh=5s | ||
+ | * You can check out the lag-stats, if the average value is above ~750 milliseconds there is something wrong... | ||
+ | |||
+ | {| class="wikitable" style="float:right;" | ||
+ | !colspan="10"| Example of heavy mesecons activity | ||
+ | |- | ||
+ | !colspan="10"|[[File:monitoring-mesecons-1.png|400px]] | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | [[Category:Mesecons]] |
Revision as of 14:06, 12 October 2019
just... why? | |||||||||
---|---|---|---|---|---|---|---|---|---|
Overview
This page should help to keep the mesecons performant and efficient so that everybody can play with them
On/Off switches
- Please add On/Off switches to your machinery and toggle them on only if you use them
Intervals
- Use intervals of 5 seconds or more, depending on how much is connected to the wire
- Shorter intervals are ok if the executed action is not that heavy (for example: a simple light or signal)
Size/Length limits
- Try to limit the amount of machines triggered by LuaC's or blinkys
This should work fine with a 3 to 5 seconds interval | |||||||||
---|---|---|---|---|---|---|---|---|---|
Luacontroller with on/off switch
The following program generates a signal-change every 5 seconds. It can be toggled with a switch on port A and generates the signal on port B
if event.type == "program" or event.type == "interrupt" then
interrupt(5)
if not pin.a then
return
end
port.b = not port.b
end
Debugging
- Use the Monitoring page to see how the mesecons are working right now: https://monitoring.minetest.land/d/LjYzPumWz/mesecons?orgId=1&refresh=5s
- You can check out the lag-stats, if the average value is above ~750 milliseconds there is something wrong...
Example of heavy mesecons activity | |||||||||
---|---|---|---|---|---|---|---|---|---|