meetric1 / gmod-infinite-map

GNU General Public License v3.0
181 stars 30 forks source link

Some problems with WAC, Drivable Yacht and GTA V Submersible #88

Closed SolsticeSpectrum closed 1 year ago

SolsticeSpectrum commented 1 year ago

First problem:

WAC Halo Addon I have been doing some extensive testing with bunch of addons and simphys vehicles work perfectly but WAC aircraft doesn't. It works most of the time but it has some issues.

https://user-images.githubusercontent.com/38611351/208853676-1a50659e-3d1b-40b7-bf15-5889ebde8abe.mp4

As you can see on this recording, some WAC aircraft (best visible on WAC Community Halo aircraft) get destroyed when flying into new chunks. In second chunk I lost control due to first rotor being destroyed and in third chunk I lost second rotor and fell down. It also happens with helicopters where their rotors straight up disappear.

Small airplanes work great as shown in the video, but it has a problem too. The camera goes wild when flying into new chunks which makes flying the aircraft really hard.


Second problem:

Drivable Yacht Addon Drivable Yacht works super great and it is so epic to drive a yacht in the vast waters on the map but it throws quite a lot of errors. I don't know which one is corresponding to the Yacht tho but these are all errors I have got when playing with Yacht, WAC and simphys vehicles so it might be worth it to look into that.

2022-12-21_08-56


Third problem:

GTA V Submersible Addon With this addon the submarine cannot dive. It works in normal source water so maybe add some handlers for objects that have buoyancy modifiers? (I don't know if it's called like that)

meetric1 commented 1 year ago

the first error is unfixable because wac uses a special hitentity and I cant detour it, sorry

the second issue is already solved in a recent PR dont worry about that

the third one is a special case with the water system, can you send source code of the mod so I can try and add compatibility?

SolsticeSpectrum commented 1 year ago

the first error is unfixable because wac uses a special hitentity and I cant detour it, sorry

the second issue is already solved in a recent PR dont worry about that

the third one is a special case with the water system, can you send source code of the mod so I can try and add compatibility?

lua/autorun/gtasub.lua

local Category = "SGM Misc"

local V = {
                // Required information
                Name =  "GTA V Sub",
                Class = "prop_vehicle_airboat",
                Category = Category,

                // Optional information
                Author = "SentryGunMan",
                Information = "vroom vroom",
                Model = "models/sentry/sub.mdl",

                KeyValues = {               
                                vehiclescript = "scripts/vehicles/sentry/sub.txt"
                        }
}

list.Set( "Vehicles", "sub_sgm", V )

lua/autorun/sub_functions.lua

function sgm_sub_function(ent)  
    if SERVER then
    local driver = ent:GetDriver()
    if ent:WaterLevel()>0 then
        ent:GetPhysicsObject():ApplyForceOffset(Vector(0,0,-409.5)*(66*FrameTime()),ent:GetPhysicsObject():LocalToWorld(Vector(40,80,0)))
        ent:GetPhysicsObject():ApplyForceOffset(Vector(0,0,-409.5)*(66*FrameTime()),ent:GetPhysicsObject():LocalToWorld(Vector(-40,80,0)))
        ent:GetPhysicsObject():ApplyForceOffset(Vector(0,0,-409.5)*(66*FrameTime()),ent:GetPhysicsObject():LocalToWorld(Vector(40,-80,0)))
        ent:GetPhysicsObject():ApplyForceOffset(Vector(0,0,-409.5)*(66*FrameTime()),ent:GetPhysicsObject():LocalToWorld(Vector(-40,-80,0)))

        --print('in water')
    end
--  print(driver)

    if driver:IsValid() then
    if driver:KeyDown(IN_SPEED) then
        ent.downForce = -40
    elseif driver:KeyDown(IN_JUMP) then
        ent.downForce = 40
    else
        ent.downForce = 0
    end
    if ent:WaterLevel()>0 then
        ent:GetPhysicsObject():ApplyForceOffset(Vector(0,0,-696+ent.downForce)*(66*FrameTime()),ent:GetPhysicsObject():LocalToWorld(Vector(40,80,0)))
        ent:GetPhysicsObject():ApplyForceOffset(Vector(0,0,-696+ent.downForce)*(66*FrameTime()),ent:GetPhysicsObject():LocalToWorld(Vector(-40,80,0)))
        ent:GetPhysicsObject():ApplyForceOffset(Vector(0,0,-688+ent.downForce)*(66*FrameTime()),ent:GetPhysicsObject():LocalToWorld(Vector(40,-80,0)))
        ent:GetPhysicsObject():ApplyForceOffset(Vector(0,0,-688+ent.downForce)*(66*FrameTime()),ent:GetPhysicsObject():LocalToWorld(Vector(-40,-80,0)))

        ent:GetPhysicsObject():AddAngleVelocity( Vector(0.0125*ent.downForce, 0, 0 )*(66*FrameTime()) ) 

    end

    end

    end
    if CLIENT then

    end
end
hook.Add("Think", "SGM_Sub_Functions", function()
    for k,ent in pairs(ents.FindByClass("prop_vehicle_airboat*")) do
        local mdl = ent:GetModel()
--      print(ent:GetModel())
            if mdl == "models/sentry/sub.mdl" then 
            sgm_sub_function(ent) 
            end
    end
end)

scripts/vehicles/sentry/sub.txt

// Airboat

"vehicle"
{
    "wheelsperaxle"     "2"
    "body"
    {
        "countertorquefactor"       "0.0"
        "massCenterOverride"        "0 0 -100"
        "massoverride"          "200"   // kg
    }
    "engine"
    {
        "horsepower"            "400"   
        "maxrpm"            "15000"
        "maxspeed"          "25"        // mph
        "maxReverseSpeed"   "2"     // mph
        "autotransmission"  "1"
        "axleratio"         "4.85"
        "gear"              "3.35"      // 1st gear
        "shiftuprpm"            "10000"
        "shiftdownrpm"          "0"
    }
    "steering"
    {
        "slowcarspeed"      "1"
        "fastcarspeed"      "2"
        "degreesSlow"       "1"
        "degreesFast"       "10"
        "degreesBoost"      "10"
        "slowSteeringRate"  "8"
        "fastSteeringRate"  "8"
        "steeringRestRateSlow"  "8.0"
        "steeringRestRateFast"  "8.0"
        "brakeSteeringRateFactor"   "1"
        "throttleSteeringRestRateFactor"    "1"
        "boostSteeringRestRateFactor"   "1"
        "boostSteeringRateFactor"   "1"
        "steeringExponent" "1.0"
    }

    // front axle
    "axle"
    {
        "wheel"
        {
            "radius"        "10"
            "mass"          "10000"
            "inertia"       "0.5"
            "damping"       "0"
            "rotdamping"        "0.0"
            "material"      "rubbertire"
        }
        "suspension"
        {
            "springConstant"            "60"
            "springDamping"             "4"
            "stabilizerConstant"            "100"
            "springDampingCompression"      "4"
            "maxBodyForce"              "625"
        }

        "torquefactor"  "0.0"
        "brakefactor"   "0.5"
    }

    // rear axle
    "axle"
    {
        "wheel"
        {
            "radius"        "10"
            "mass"          "10000"
            "inertia"       "0.5"
            "damping"       "0"
            "rotdamping"        "0.0"
            "material"      "rubbertire"
        }
        "suspension"
        {
            "springConstant"            "60"
            "springDamping"             "4"
            "stabilizerConstant"            "100"
            "springDampingCompression"      "4"
            "maxBodyForce"              "625"
        }
        "torquefactor"  "0.0"
        "brakefactor"   "0.5"
    }
}

"vehicle_sounds"
{
    // List gears in order from lowest speed to highest speed
    "gear"
    {
        "max_speed"     "0.5"
        "speed_approach_factor" "0.1"
    }

    "gear"
    {
        "max_speed"     "1.0"
        "speed_approach_factor" "0.1"
    }
    "state"
    {
        "name"      "SS_START_IDLE"
        "sound"     "common/null.wav"
    }
    "crashsound"
    {
        "min_speed"         "100"
        "min_speed_change"  "50"
        "sound"             "ATV_impact_medium"
        "gear_limit"        "1"
    }

    "crashsound"
    {
        "min_speed"         "200"
        "min_speed_change"  "100"
        "sound"             "ATV_impact_heavy"
    }

    "skid_lowfriction"  "Airboat_skid_smooth"
    "skid_normalfriction"   "Airboat_skid_rough"
    "skid_highfriction" "Airboat_skid_rough"
}

Then there are: materials/sentry models/sentry

meetric1 commented 1 year ago

I realized these issues have all been solved, forgot to close a while ago, my b

the water system appears to need a detour to make the submarine work which I have decided on not doing because water is technically not part of the base, sorry