Page 1 of 1

Player can still manipulate enemy entities after changing forces

Posted: Sat Aug 13, 2022 6:47 am
by Pi-C
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

Code: Select all

/c game.player.force = 'enemy'
to change your force, then
  • 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.
All of the above will still work although the spidertron doesn't belong to you anymore. You'll get back the expected behavior after you've left the spidertron and closed its GUI.

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.

Re: Player can still manipulate enemy entities after changing forces

Posted: Sat Aug 13, 2022 1:37 pm
by Rseding91
Thanks for the report however I don't consider this worth changing. If a mod changes the force of something it can eject the player; or change the players vehicle force as well.

Re: Player can still manipulate enemy entities after changing forces

Posted: Sat Aug 13, 2022 6:05 pm
by Pi-C
Rseding91 wrote: Sat Aug 13, 2022 1:37 pm Thanks for the report however I don't consider this worth changing. If a mod changes the force of something it can eject the player; or change the players vehicle force as well.
Thanks for the reply! Actually, I've already made a map setting for that: When players change forces, they will either be ejected from the vehicle they're riding in, or their vehicles will change forces as well. :-)