FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.67k stars 395 forks source link

Fix NPCOperateItemAction Operate="false" not doing anything #14217

Closed dakkhuza closed 1 week ago

dakkhuza commented 1 week ago

Related to #14216

Fixes the issue mentioned in the above discussion by implementing the suggested fix, that being changing operateItemObjective.OperateTarget == target to operateItemObjective.Component.Item == target

This could also be fixed by actually assigning the OperateTarget in the objective constructor, however I didn't want to change how the action operated and potentially cause unexpected compatibility issues.

Here's a mod to test that it's working correctly, this is the same mod in the above issue. NPCOperateAction.zip

To test:

  1. Load up the "NPCOperateItemAction" sub in the sub editor
  2. Type triggerevent npcoperateaction_example into the console

Expected behavior with this pull request is the NPC cancels the operate objective correctly and starts following the player.

Regalis11 commented 1 week ago

Thank you for taking the time to investigate this! :) The fix looks correct to me and seems to work with no issues. Merged to our private repo in https://github.com/FakeFishGames/Barotrauma-development/commit/c782d90e6d05ff20cacc828d08b1e8c961ce7b6b (commit in our private repo).