OgelGames / beacon

A redo of the Minetest beacon mod by AgentNagel42 (WIP)
Other
4 stars 3 forks source link

Add `digilines` compatibility #4

Closed OgelGames closed 4 years ago

OgelGames commented 4 years ago

Depends on #7

Something along the lines of this:

-- GET
digiline_send("beacon", {command = "get"})

if event.type == "digiline" and event.channel == "beacon" then
    event.msg = {
        radius = 10,
        effect = "fly",
        active = false
    }
end

-- SET
digiline_send("beacon", {
    command = "set",
    radius = 10,
    effect = "fly",
    active = true
})

-- returns the same as GET

@SwissalpS :wink:

SwissalpS commented 4 years ago

yes, but no need to return anything on set. and all fields should be optional when setting.

BuckarooBanzay commented 4 years ago

(sorry...)

S-S-X commented 4 years ago

yes, but no need to return anything on set. and all fields should be optional when setting.

Could maybe reply with error code or message if settings cannot be applied, like if you try to set radius that is not supported with current upgrades. Or same when trying to enable effect that is not supported with your beacon upgrades.

But if command succeeds I think it is best to stay silent to reduce digiline messages. Or make replying configurable and disable replies for pandorabox.

Why?: For some time it has been required to build overly complex systems with digilines just to reduce digiline messages in larger device's internal communication. That means adding a lot more lua controllers to be able to limit messages to main controller. All in all these setups actually fire a lot more digiline messages and execute a lot more unnecessary lua code just to not get main controller burnt.

One good and fairly simple examples of such setups is my item counter where I had to replace every detector tube with lua tubes, jumpdrive travelnet boxes, space ship cannon setups and my digtron setup where I had to add more digtron components and make trons bigger to get around mesecon lag detection that does not take into account why/what makes it detect something.

OgelGames commented 4 years ago

I have added some basic digilines support for getting and setting the radius and effect of the beacons. It's not possible to activate/deactivate the beacons, because of how it works currently, but I'm not sure if that is needed, or even if it should be added, considering how much lag potential it would have.