SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
84 stars 18 forks source link

[Preview Branch] IOBS Update breaks exotic use case #4345

Closed Spebby closed 4 months ago

Spebby commented 4 months ago

I give a more complete description and demonstration in the video linked below, but I'll summarise it, so others can more easily comment on it.

https://youtu.be/O0OtvVAl2ME?si=yqLhtQoWDcuUG6G4 (this has just been uploaded, so the quality isn't going to be great, sorry!)

Essentially: Spyjack found a method to trigger Interactability_Reward from Unity using the IOBS hook. He used it a few times in Tales Of Terror's Jester sections. I use it quite a lot on a project for quest conditions and one-time teleports (as opposed to the volume added a few years ago). This is an exotic use case that was probably never intended for IOBS hook, and I completely understand if this isn't supported in the future. While the IOBS hook can't (and probably shouldn't) be modified continually to support unintended uses, but ideally this functionality would be supported in some way, possibly a new mod hook, would be greatly appreciated.

Gamingtoday093 commented 4 months ago

This seems to be an actual bug with ToggleState() introduced in the preview version. Nelson must've accidentally removed the ! from interactable.isUsed. The reason it doesn't work anymore is because the IOBS doesn't let you update its state to it's current state as you can see Here. (Which is what ToggleState() is trying to do)

image

Nelson Please Fix

SDGNelson commented 4 months ago

Thanks @Gamingtoday093! Not sure how I managed to remove that ! considering the method would have been renamed by F2 and the parameter added was after the existing one. 😕

Spebby commented 4 months ago

Thanks for taking a look at the code @Gamingtoday093 ❤️

SDGNelson commented 4 months ago

Does it seem to be working again in the 3.24.1.0 update? I restored the ! as a last-minute addition.

Gamingtoday093 commented 4 months ago

I just checked and it seems to be working again! I should have the same setup as @Spebby so it should be working for him as well.

Spebby commented 4 months ago

yep, working again!

To note it does not work when using "Override State" but clientside works.

DrDallas1 commented 4 months ago

This doesn't make any sense... isn't this usecase of IOBS (applying interactability rewards to players using IOBS hook) completely broken in multiplayer? How did you manage to use this outside of singleplayer? I originally suggested "Server Listen Host Mode" as a way to combat this, with "OverrideState" bringing multiplayer behavior to singleplayer.

Spebby commented 4 months ago

How did you manage to use this outside of singleplayer?

The server would sometimes apply the rewards. If a player quit and rejoined it would usually give the rewards. Not tested since the update launched so it may be consistent now the IOBS hook behaves consistently in mp and sp.