Immersive Vehicles (Formerly Transport Simulator)

Immersive Vehicles (Formerly Transport Simulator)

4M Downloads

Sub-part is able to be removed when it has parts on it

gyrohero opened this issue ยท 6 comments

commented

For testing, use Hero Aviation Helicopter Pack's newly remodeled Huey (slight shout-out) with the gun mount. Place guns on the mount, then remove the mount. Place a different (empty) mount, and use a wrench to hit where the guns would be.

Seems like this could be used to dupe parts.

commented

You shouldn't even be able to hit parts with children normally. You can only hit the top-level part. The core bug is being able to remove a part with subParts, period. Does that mount have collision boxes on it? Cause that could be a possible issue.

commented

Yeah, hitting the collision box with a wrench

commented

Yeah, it does have a couple collision boxes

commented

Are you hitting the collision boxes with a wrench? Cause that might be what's happening. I disable the part's box if there are sub-parts, but it could be that I'm not disabling the collision boxes. Though IIRC, if you disable those then you might not collide with them. Probably have to check in the interaction packet code. I coulda swore I have that code not get called for removal if the part has sub-parts....

commented

Okay, so here's what's happening:
Normally when holding a wrench, I disable the hitbox for parts with children (subParts or additionalParts). This prevents wrenching them. This is done here:

if(clientPlayer.getHeldItem() instanceof ItemWrench && !part.childParts.isEmpty()){

But, although I disable the part's hitbox, I don't disable the collision boxes. As such, the wrench will remove that part. What needs to happen is the wrench needs to not remove parts with children. Appropriate check location would be here alongside the permanent part check:

I'd say just remove the code from the vehicle, and put it on the wrench, so no matter where or when you wrench a part, it won't remove it if the are children on it.

commented

Ok, gotcha