wiremod / advdupe2

Advanced Duplicator 2
http://wiremod.com
Apache License 2.0
91 stars 60 forks source link

AdvDupe2 creating strange (invisible) props when duping some objects (like wire hydraulics) #127

Closed EdoTM closed 5 years ago

EdoTM commented 6 years ago

Here is an example (on the left, the normal prop before being duped, on the right, the ghosted one just copied). Under the chair there is a wire hydraulic. As long as you paste the duplication, there will be that prop (but invisible) which will prevent the hydraulic to work, until you grab the invisible prop with the physgun (and it will disappear).

image

It happens also with other wiremod and non-wiremod stuff (like WAC entities or some vehicles). Sorry for posting if this is an already-known bug.

thegrb93 commented 6 years ago

Seems like another addon you have installed is doing it. I've never seen this before.

EdoTM commented 6 years ago

I have tried disabling all the addons and activating only AdvDupe2 and Wiremod, the "prop" is still there: image Steps to reproduce (for the example above):

  1. Freeze a prop in mid air (better a flat surface, like a plate)
  2. Pick the Hydraulic tool from the Physics/Constraints Wiremod menu
  3. Right-click the bottom part of the plate, so that it "places an hydraulic along the hit normal"
  4. Place anywhere near the plate the hydraulic controller
  5. Pick the Advanced Duplicator 2 tool
  6. Shift + right-click and then right-click to area copy the plate with the hydraulic

This bug is there from a very long time, but I did not know there was an issue-tracker on GitHub (p.s. sorry i did not want to close the issue)

EdoTM commented 6 years ago

(Before) image As you can see, the prop is there and it also has collisions; just after you select it with the physgun, it disappears. (After) image

thegrb93 commented 6 years ago

I followed your steps and still didn't get the bug.

EdoTM commented 6 years ago

Found it! It happens when the hydraulic is "Fixed".

thegrb93 commented 6 years ago

Yeah, I tried with 'fixed' wire hydraulics and it still didn't happen.

thegrb93 commented 6 years ago

Seems like there's something weird with your slider constraint. Maybe some mod in your lua folder or something.

thegrb93 commented 6 years ago

Maybe check if a script modified your slider function?

>lua_run PrintTable(debug.getinfo(constraint.Slider))

What's this print?

EdoTM commented 6 years ago

Here is the print:

currentline =   -1
func    =   function: 0x00c49468
isvararg    =   false
lastlinedefined =   778
linedefined =   698
namewhat    =   
nparams =   8
nups    =   2
short_src   =   lua/includes/modules/constraint.lua
source  =   @lua/includes/modules/constraint.lua
what    =   Lua

However, this is my AdvDupe2+Hydraulic settings, maybe it can help reproducing the problem.

Advanced Duplicator 2:


Wire hydraulic:

(Model: nano)

thegrb93 commented 6 years ago

Can you copy the thing, then tell me what this prints? This should list all the entities that it copied

>lua_run PrintTable(Entity(1).AdvDupe2.Entities)

Also print

>lua_run PrintTable(Entity(1).AdvDupe2.Constraints)
thegrb93 commented 6 years ago

Can you also paste your contraption, copy it again with that glitched prop, and tell me what those commands print.

EdoTM commented 6 years ago

First duplication

Print 1

184:
        BuildDupeInfo:
                IsNPC   =   false
                IsVehicle   =   false
        Class   =   gmod_anchor
        CollisionGroup  =   0
        Model   =   models/combine_helicopter/helicopter_bomb01.mdl
        PhysicsObjects:
                0:
                        Angle   =   0.000 0.000 360.000
                        Pos =   8.101334 -3.623474 -97.302811
185:
        Class   =   prop_physics
        CollisionGroup  =   0
        Model   =   models/props_phx/construct/glass/glass_angle360.mdl
        PhysicsObjects:
                0:
                        Angle   =   0.000 -45.000 -0.000
                        Pos =   0.000000 0.000000 0.000000
187:
        BuildDupeInfo:
                IsNPC   =   false
                IsVehicle   =   false
        Class   =   gmod_wire_hydraulic
        CollisionGroup  =   20
        EntityMods:
                WireDupeInfo:
                        Wires:
        Model   =   models/beer/wiremod/hydraulic_nano.mdl
        MyId    =   187
        PhysicsObjects:
                0:
                        Angle   =   0.000 0.000 360.000
                        Pos =   19.914688 -6.416962 -97.052841

Print 2

1:
        BuildDupeInfo:
                Ent1Ang =   0.000 -45.000 -0.000
        Entity:
                1:
                        Bone    =   0
                        Index   =   185
                        LPos    =   8.290695 3.166316 0.223148
                2:
                        Bone    =   0
                        Index   =   0
                        LPos    =   8.101334 -3.623474 -97.302811
                        World   =   true
        LPos1   =   8.290695 3.166316 0.223148
        LPos2   =   8.101334 -3.623474 -97.302811
        MyCrtl  =   187
        Type    =   WireHydraulic
        fixed   =   1
        material    =   cable/cable2
        speed   =   4
        stretchonly =   false
        width   =   1

Second duplication

(Copy of the already duped one)

Print 1

186:
        BuildDupeInfo:
                IsNPC   =   false
                IsVehicle   =   false
        Class   =   gmod_anchor
        CollisionGroup  =   0
        Model   =   models/combine_helicopter/helicopter_bomb01.mdl
        PhysicsObjects:
                0:
                        Angle   =   0.000 0.000 0.000
                        Pos =   0.000000 0.000000 0.000000
188:
        Class   =   prop_physics
        CollisionGroup  =   0
        Model   =   models/props_phx/construct/glass/glass_angle360.mdl
        PhysicsObjects:
                0:
                        Angle   =   0.000 -45.000 360.000
                        Pos =   -8.101334 3.623474 97.302811
189:
        BuildDupeInfo:
                IsNPC   =   false
                IsVehicle   =   false
        Class   =   gmod_wire_hydraulic
        CollisionGroup  =   20
        EntityMods:
                WireDupeInfo:
                        Wires:
        Model   =   models/beer/wiremod/hydraulic_nano.mdl
        MyId    =   189
        PhysicsObjects:
                0:
                        Angle   =   0.000 0.000 0.000
                        Pos =   11.813354 -2.793488 0.249969
192:
        BuildDupeInfo:
                IsNPC   =   false
                IsVehicle   =   false
        Class   =   gmod_anchor
        CollisionGroup  =   0
        Model   =   models/combine_helicopter/helicopter_bomb01.mdl
        PhysicsObjects:
                0:
                        Angle   =   0.000 0.000 360.000
                        Pos =   0.000000 0.000000 0.000000

Print 2

1:
        BuildDupeInfo:
                Ent1Ang =   0.000 -45.000 -0.000
        Entity:
                1:
                        Bone    =   0
                        Index   =   188
                        LPos    =   8.290695 3.166316 0.223148
                2:
                        Bone    =   0
                        Index   =   0
                        LPos    =   8.101334 -3.623474 -97.302811
                        World   =   true
        LPos1   =   8.290695 3.166316 0.223148
        LPos2   =   8.101334 -3.623474 -97.302811
        MyCrtl  =   189
        Type    =   WireHydraulic
        fixed   =   1
        material    =   cable/cable2
        speed   =   4
        stretchonly =   false
        width   =   1

As you can see, it continuously keeps recreating the helicopter_bomb01 model, right where the start of the hydraulic is.

thegrb93 commented 6 years ago

Okay, now I can see the problem. The prop protection I was using was preventing me from copying the gmod_anchor. Let me look at that entity and see what can be done.

thegrb93 commented 6 years ago

You can add ENT.DoNotDuplicate = true to gamemodes/sandbox/entities/entities/gmod_anchor.lua to fix this. Or use a prop protection that has that entity blacklisted (most do). I'll make a PR to garrysmod to add that fix.

EdoTM commented 6 years ago

Ok, thanks for your support.

thegrb93 commented 6 years ago

That fix works for fixed hydraulics but breaks normal sliders, I gotta find another fix.