#Player OR Pickup-only WaypointToy?

1 messages · Page 1 of 1 (latest)

polar osprey
#

I attempted to make a Player or Pickup-only WaypointToy using a Harmony Patch on AdminToWaypoint.Add to prevent things from being 'parented' and although the Loggers in the screenshot successfully execute in the given scenarios, the Players and Pickups still move along with the WaypointToy.

Is there any reason for this? Any other path where these things get added to WaypointToys?

marble lance
#

You may need to go up a level to each IChildWaypointObject.

The item one at PickupStandardPhysics sets its parent after attempting to add anyway.

    wp.Add((IChildWaypointObject) this);
    this.Rb.interpolation = RigidbodyInterpolation.None;
    this.Pickup.transform.SetParent(wp.transform);

So may need to patch OnWaypointChanged in those instead.

icy flint
#

does the client handle waypoints on its side as well or does it entirely rely on the server to tell it

polar osprey
#

this is getting too complex for me

#

i should ignore the player-only waypoint for now

#

need to focus on preventing players from following specific waypoints

marble lance
#

Would be nice if there was an event that fired when attaching to the waypoint.

polar osprey
#

Yesssssssssssssssssssssssssssssssssssssssssss

#

I will dare it
I shall ping him

#

@unkempt zephyr
PlayerEvents.EnteringWaypoint
PlayerEvents.EnteredWaypoint
PlayerEvents.LeavingWaypoint
PlayerEvents.LeftWaypoint
ServerEvents.PickupEnteringWaypoint
etc

plssssss

unkempt zephyr
#

Im not api maintainer anymore

#

and use github for suggestions

polar osprey
#

aw

#

alrighty

#

Wups, somehow my image didnt get sent
This was supposed to be at the top

marble lance
#

Could try attaching a MonoBehaviour to the WaypointToy GameObject (As long as you don't have a lot of them), or a Coroutine and try removing the children. This code likely won't work but may be the right direction.

public class WaypointTracker : MonoBehaviour
{
    private AdminToys.WaypointToy _waypoint;

    public WaypointToy WaypointToy => WaypointToy.Get(_waypoint);
    
    public bool AllowPlayers { get; set; } = true;
    public bool AllowPickups { get; set; } = true;

    private void Awake()
    {
        _waypoint = GetComponent<AdminToys.WaypointToy>();
    }

    private void LateUpdate()
    {
        if(!_waypoint) Destroy(this);
        if(_waypoint._waypoint._children.Count == 0) return;
        foreach (var child in _waypoint._waypoint._children)
        {
            if (child == null) continue;
            if(child.GetType() == typeof(FirstPersonMovementModule) && !AllowPlayers)
            {
                _waypoint._waypoint.Remove(child);
                continue;
            }
            if(child.GetType() == typeof(PickupStandardPhysics) && !AllowPlayers)
            {
                _waypoint._waypoint.Remove(child);
                continue;
            }
        }
        
    }
}
#

May also need to get the player/item and remove its parent transform

#

They made Waypoints easy to use, which can make it hard to break.

brittle fern
#

Which is like

#

Completely opposite from how it should be

mental girder
#

uhhh I tried doing this and ran into many problems

#

1: NetworkPriority doesnt work for negative values cuz it's squared (I reported it as a bug so hopefully next update fixes it)

2: You can't fake sync syncvars for waypoints for some reason (idk why but the Exiled methods that work for every other NetworkIdentity specifically dont work for this for some reason)

3: Waypoint selection is client side I believe

4: waypoints are really freaking complicated as they're inherently meshed with anti-cheat cuz the game has to prevent ppl from just telling server they're anywhere in the map

#

the only solution I came up with for my idea was to just make the waypoint small vertically as people colliding with it barely impacted them and it was hard to impact people with it

#

like, if I could even understand where server receives clients desired movement, I could maybe tell you if selected waypoint is fully client or fully server, but I legitimately cannot, so god help you

brittle fern
#

Someone bug NW devs

#

I've had an issue about this open since august

mental girder
#

hmmmmmmmmmmmmmm

brittle fern
mental girder
#

yeah I'm going down to the depths of hell (AKA mirror)

#

now I'm second guessing if the Exiled extensions could even work on any toy-specific sync var

mental girder
#

@polar osprey if you use Exiled, you can use this PR https://github.com/ExMod-Team/EXILED/pull/654 to probably fake a waypoint toys bounds to zero for clients who shouldn't interact with the waypoint (you might need a CallDelayed tho when using SendFakeSyncVar, idk)

GitHub

Description
Describe the changes
Fix SendFakeSyncVar by including missed dirty bits (just message me on discord if you need to know). Make CameraToy public (idk why it isn&#39;t, plz lmk if som...

#

if you use LabAPI you could also probably get away with just copy pasting the relevant methods to SendFakeSyncVar in MirrorExtensions

vast jackal
#

😢

brittle fern
#

Why does SendFakeSyncVar have to be so complicated

mental girder
#

Mirror

vast jackal
#

kind of, yeah
writing sync var dirty bits in the derived class as well

mental girder
#

It’s basically faking all the data to tell a client to set a specific NetworkBehaviours SyncVar in a specific NetworkIdentity

#

If you follow mirrors deserialization method in NetworkBehaviour / NetworkIdentity, you’ll see the same values written that SetFakeSyncVar sets

brittle fern
#

Reading ts on mobile is impossible

mental girder
#

Indeed

#

But all I did was fix a missing ulong to indicate that nothing was dirty for either AdminToyBase (if modifying toy-specific SyncVar) or for inherited type (if modifying AdminToyBase SyncVar)

brittle fern
#

Wow this exiled SendFakeSyncVar looks much different than the one I stole from @lilac lily

mental girder
#

Can I see it? (If you don’t mind)

brittle fern
#

Yeah sure let me hop on my PC

vast jackal
#

-# let's move discussion out of the post cute_shh

brittle fern
mental girder
#

Keep in mind MakeCustomSyncWriter is also used for fake sync objects (SyncList, etc…)

vast jackal
brittle fern
#

I think it's just an older iteration of the current one

#

But I've had no problems using it for admin toys

polar osprey
#

Slejmur is the fakesync god

polar osprey
brittle fern
mental girder
brittle fern
mental girder
#

So then where does this happen?

brittle fern
#

I checked it with yours and it does effectively the same thing

mental girder
#

Yeah, Exileds one is just more generic and assumes less stuff

brittle fern
#

Except mine was already working with admintoys because it already compensated 👍🏼

brittle fern
#

With some mods

#

I'm unsure why they decided to change it