i hope i understood correctly what you want to accomplish.
why do you want to intercept a command in the engine? if i understood it right you want to do something like this:
user gives a unit in spring a command -> allowcommand "checks" if the real life counterpart unit can do the command, and then returns true/false ? is that correct?
lua sockets in spring
Moderator: Moderators
Re: lua sockets in spring
I think I might not have described our goal clearly enough. I know it's pretty bizarre.
We have several real-life units connected via an ad-hoc network. Each of those units is paired with a unit in the game. When the user gives a command to a unit in Spring, it needs to travel outside of the game via that ad-hoc network to reach the target unit. If the target unit can be reached, the command is executed in Spring (and in real life).
The way we considered doing this was to catch a command in AllowCommand, send it out to the network on a UDP packet, and return false. Then, a program running on the nodes sends this command back to the game (if the node receives it) where it would be inserted into the unit's command queue. So the command is never really given at the mouse click. It must travel through the network first. This way, we ensure that the unit that the user is giving a command to is within radio range.
I hope that's more helpful. If not, let me know, and I'll try again.
We have several real-life units connected via an ad-hoc network. Each of those units is paired with a unit in the game. When the user gives a command to a unit in Spring, it needs to travel outside of the game via that ad-hoc network to reach the target unit. If the target unit can be reached, the command is executed in Spring (and in real life).
The way we considered doing this was to catch a command in AllowCommand, send it out to the network on a UDP packet, and return false. Then, a program running on the nodes sends this command back to the game (if the node receives it) where it would be inserted into the unit's command queue. So the command is never really given at the mouse click. It must travel through the network first. This way, we ensure that the unit that the user is giving a command to is within radio range.
I hope that's more helpful. If not, let me know, and I'll try again.
Re: lua sockets in spring
aaah, ok.
then imo SendLuaRulesMsg / SendToUnsynced is the way to go... you've just to encode / decode the commands.
then imo SendLuaRulesMsg / SendToUnsynced is the way to go... you've just to encode / decode the commands.
Re: lua sockets in spring
We'll start looking into those methods then. Thanks for your help.
Re: lua sockets in spring
you're welcome. any progress/success/problems?
Re: lua sockets in spring
Going well so far. For anyone who has found this thread and is looking for information on widget/gadget communication, see my post on the Q&A