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/
85 stars 18 forks source link

Can open InteractableVault and door when group changed to 0 on deploy #4363

Closed MrRousek closed 3 months ago

MrRousek commented 3 months ago
using System;
using Rocket.API;
using Rocket.Core;
using Rocket.Core.Plugins;
using Rocket.Unturned.Player;
using SDG.Unturned;
using Steamworks;
using UnityEngine;

namespace TheObjectToUse
{
    protected override void Load()
    {
        SDG.Unturned.BarricadeManager.onDeployBarricadeRequested += OnDeployBarricade;
    }

    private void OnDeployBarricade(Barricade barricade, ItemBarricadeAsset asset, Transform hit, ref Vector3 point, ref float angle_x, ref float angle_y, ref float angle_z, ref ulong owner, ref ulong group, ref bool shouldAllow)
    {
        group = 0;
    }
}

image image

MrRousek commented 3 months ago

image

MrRousek commented 3 months ago

You can't salvage barricade, but you can interact. image

SDGNelson commented 3 months ago

Perhaps I'm misunderstanding, but if the owner still matches the player then they can still interact with it intentionally. If you set both owner and group to zero they won't be able to.

MrRousek commented 3 months ago

Perhaps I'm misunderstanding, but if the owner still matches the player then they can still interact with it intentionally. If you set both owner and group to zero they won't be able to.

it is clear that I am the owner, but other players from the group can still interact even if group = 0

GazziFX commented 3 months ago

Interactable Storage still have old group

MrRousek commented 3 months ago

Interactable Storage still have old group

Гази, прикол в том, что можно открыть сейф/дверь, а вот забрать(снять) нельзя. Ну по логике так не должно работать

GazziFX commented 3 months ago

InteractableStorage and BarricadeDrop have their own owner and group you should change _owner or _group field of InteractableStorage and call rebuildState() to keep them in sync

MrRousek commented 3 months ago

InteractableStorage and BarricadeDrop have their own owner and group you should change _owner or _group field of InteractableStorage and call rebuildState() to keep them in sync

Thank you, I understand that. But still, it probably needs to be synchronized at the level of the game code.

SDGNelson commented 3 months ago

Ah, I understand now, sorry - yes: GazziFX's answer is correct that the interactables have their own owner/group properties whereas the general barricade owner/group are used for things like salvaging and whether players can see the HP.

MrRousek commented 3 months ago

Ah, I understand now, sorry - yes: GazziFX's answer is correct that the interactables have their own owner/group properties whereas the general barricade owner/group are used for things like salvaging and whether players can see the HP.

Do you synchronize this at the game code level?

MrRousek commented 3 months ago

I think it's worth synchronizing it.

MrRousek commented 3 months ago

Or at least add a synchronization method

DanielWillett commented 3 months ago

(#3498)