Problem sending an event targetting a block from client to server

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
I am diagnosing a problem with multiplayer where I am attempting to send an event from a block's gui but instead of the event's code getting run on the server, I get this message (link to the line that produced that warning):
13:56:58.492 [main] WARN o.t.network.internal.NetClient - Received event org.terasology.workstation.event.WorkstationProcessRequest@514fa446 for non-owned entity EntityRef{id = 327, netId = 298, prefab = 'ManualLabor:AssemblyTable'} from org.terasology.network.internal.NetClient@2118ee38
I tried working around this message by eliminating the warning just to see if it functioned as I had expected, and it worked. It ran the event handler code on the server side, like I was expecting.

I would like some help to conceptually understand how this is supposed to work with networkSystem ownership. So the client that places a block should gain ownership of it, right? But this also means that if one ever wanted to let another client initiate events that target these owned blocks (share your placed blocks with another player), it would not be possible as it is baked into the engine.

Is my understanding anywhere near correct?
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
Events can only be sent from client to server via entities the client owns as a security measure. If this restriction is removed, a client could send events to another client's entity and mess with them (tell them to drop items, walk off a cliff, etc).

In general ownership is a strong relationship tying entities together, similar to the composite relationship in UML. Owned entities are persisted together, sometimes destroyed together. In the networking, replication can be restricted to only the owner. Owners can be dynamically changed - you could set the owner of the workstation to the player while they are using it, assuming that only one player can use it at a time, but this may cause issues if the game is saved while this is going on (might need to review things in this space - we might be using ownership for too much).
 

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
Further guidance from Immortius over IRC:
Events can only be sent from client to server targeting entities the client owns to prevent messing with another player. So send the event via the client entity or character entity. I don't think players should own blocks as such or at least not in the network sense certainly not in the persistence sense.​
 

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
Confirmed, sending events to the player as apposed to the block has fixed this. Thanks Immortius.
 
Top