LabAPI icon indicating copy to clipboard operation
LabAPI copied to clipboard

[IDEA] WaypointToy for AdminToys (or NetworkIdentities)

Open TheLongQuite opened this issue 1 year ago • 7 comments

Goal Description

In current state WaypointToys allows us to implement custom elevators, and if desired, very complex ones - and not only elevators, this is just the first idea that comes to people's minds.

However, both existing and new elevators have the problem of properly parenting PrimitiveToy and, consequently, schematics to elevators.

When they are SetParent'ed, most often PrimitiveToy (depending on the SyncValue set) simply fly up when the elevator goes down, and only return to their intended place when the elevator reaches its intended destination.

It would be really cool if it would be implemented!!!!!!!!!!!!!!!!!!!!

Notes

No response

TheLongQuite avatar Oct 15 '25 11:10 TheLongQuite

You should be able to parent admin toys to waypoints or more specifically the GameObject with the NetworkIdentity component. That includes elevators from the base-game. So if admin toys are not following the elevators movement that could be a bug in the game or your code.

If you would like to make that parenting happen automatically you can add the TransformWaypointFollower component from the base-game to the root of your schematic or admin toy and it will parent the toy automatically(keep in mind that AdminToy.Position is the local position so you may want to use the base transform object directly if you need to move the object around).

brayden-dowson avatar Oct 15 '25 11:10 brayden-dowson

If you're parenting to a base-game elevator, make sure that:

  • The parent is an ElevatorChamber's transform
  • The schematic root you're parenting is an AdminToy itself

Axwabo avatar Oct 15 '25 12:10 Axwabo

You should be able to parent admin toys to waypoints or more specifically the GameObject with the NetworkIdentity component. That includes elevators from the base-game. So if admin toys are not following the elevators movement that could be a bug in the game or your code.

If you would like to make that parenting happen automatically you can add the TransformWaypointFollower component from the base-game to the root of your schematic or admin toy and it will parent the toy automatically(keep in mind that AdminToy.Position is the local position so you may want to use the base transform object directly if you need to move the object around).

The current logic of both MER and ProjectMER assumes that schematics objects are game objects with a large number of components in the form of the aforementioned AdminToys. Therefore, if the transform of this schematics object is parented to the elevator, all the adminToys within it will also be parent due to the presence of the parent.

Or do I need to specifically extract the NetworkIdentity component from each AdminToy and parent it to the elevator.gameobject.transform? Because in my attempts, I made fairly simple attempts to parent the schematic's transform to the elevator's transform

TheLongQuite avatar Oct 15 '25 12:10 TheLongQuite

In that case it's a PMER issue. The root of the schematic also needs to be an admin toy for it to be parented properly. You could iterate through the created schematic root's direct children and parent each one to the elevator, or to an invisible & non-collidable primitive that's parented to the elevator.

Axwabo avatar Oct 15 '25 12:10 Axwabo

In that case it's a PMER issue. The root of the schematic also needs to be an admin toy for it to be parented properly. You could iterate through the created schematic root's direct children and parent each one to the elevator, or to an invisible & non-collidable primitive that's parented to the elevator.

Will try

TheLongQuite avatar Oct 15 '25 12:10 TheLongQuite

if the transform of this schematics object is parented to the elevator, all the adminToys within it will also be parent due to the presence of the parent

Yes, this is expected behavior and is what you should rely on. Look at the PMER Discord if anyone's had this issue before, it might be caused your code or PMER's implementation.

Axwabo avatar Oct 15 '25 12:10 Axwabo

if the transform of this schematics object is parented to the elevator, all the adminToys within it will also be parent due to the presence of the parent

Yes, this is expected behavior and is what you should rely on. Look at the PMER Discord if anyone's had this issue before, it might be caused your code or PMER's implementation.

Thanks

TheLongQuite avatar Oct 15 '25 12:10 TheLongQuite