Player can still manipulate enemy entities after changing forces
Posted: Sat Aug 13, 2022 6:47 am
Usually, when you click on an entity that belongs to another force that is an enemy of your own force, you'll see a flying text "Cannot open enemy structure". Also, if you try to enter a vehicle belonging to an enemy force, you'll usually get "Cannot enter enemy vehicles". But there is an edge case where it doesn't work as expected:
To reproduce, make sure you belong to force "player", put down a spidertron, arm it with some rockets, enter it, and open its GUI. Use
to change your force, then
In my WIP version of GCKI, I already set player.vehicle = nil in response to defines.events.on_player_ changed _force. Closing player.opened if that refers to an entity shouldn't be too hard either. Still, I feel this should be taken care of by the game as the issue is somewhat obscure and many modders (myself included -- I only found out about the GUI stuff today) won't handle this because they simply aren't aware of it.
To reproduce, make sure you belong to force "player", put down a spidertron, arm it with some rockets, enter it, and open its GUI. Use
Code: Select all
/c game.player.force = 'enemy'
- try to rename the spidertron;
- try to insert/remove something into/from the spidertrons inventory;
- move around in the spidertron;
- attack something with the spidertron.
In my WIP version of GCKI, I already set player.vehicle = nil in response to defines.events.on_player_ changed _force. Closing player.opened if that refers to an entity shouldn't be too hard either. Still, I feel this should be taken care of by the game as the issue is somewhat obscure and many modders (myself included -- I only found out about the GUI stuff today) won't handle this because they simply aren't aware of it.