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

Add "Listen Server Host Mode" option to IOBS Event Hook #4298

Closed DrDallas1 closed 4 months ago

DrDallas1 commented 5 months ago

Hia,

the IOBS event hook does not sync correctly in single player. All IOBS triggers in unity are dependent on the player.

Let me give an example:

Thank you, DrDallas

SDGNelson commented 5 months ago

Can you elaborate on your setup please? Pressing F on the interactable uses the same RPC as if the singleplayer host or a multiplayer client calls the IOBS event hook methods. The difference is only if the dedicated server requests a change of state, in which case there is no player to associate with the request. My guess from your description is that in multiplayer it's being called by the server rather than by a client.

DrDallas1 commented 5 months ago

Yes exactly! In single player, all IOBS interactions are affected by the player. This means that in cases where a unity IOBS event hook triggers a state toggle, the reward and condition is applied to the one, single, player.

Basically: In single player, all IOBS door movements are the "fault" of the player, and the game checks if those IOBS doors are allowed to move (by looking at conditions & rewards)

But in multiplayer, doors are independent, and will always move if told to in Unity, regardless of any conditions or rewards (as they should).

To clarify, I think the multiplayer interpretation is the correct version, that should be carried into single player (it makes the most sense)

Example:

Let’s say there is an IOBS door that rewards you with flag “X” when clicked. This door is normally sunk into the ground, but when you trigger a specific NPC event, it rises out of the ground for a one time trigger.

Multiplayer

(Maybe it would be better if I sent a video. I’ll do that later today.)

Edit: Here is the video:

https://www.youtube.com/watch?v=ptoRcg_bS6g

The NPC in the video gives out this: image Unity of the clipboards: image

SDGNelson commented 5 months ago

I don't think there's really a "correct" case, rather it would be useful to have an option for whether it's run as client or as server when run on the listen server host.

DrDallas1 commented 5 months ago

That’s wonderful! Thank you so much!