@name Combine Chinese Delivery
@persist [E P]:entity FC FM WM [M]:array
if(first())
{
    runOnTick(1)
    
    entity():setColor(0,0,0,0)
    
    E = entity():isConstrainedTo()
    if(E:isValid())
    {
        E:setMass(50000)
        
        if(E:isVehicle())
        {
            selfDestruct()
        }else
        {
            P = E:isConstrainedTo()
        }
    }else
    {
        selfDestruct()
    }
    
    FC = 9
    
    holoCreate(1,E:toWorld(vec(0,7.5,17.5)),vec(7.5),E:toWorld(ang()))
    holoModel(1,"models/props_junk/garbage_takeoutcarton001a.mdl")
    holoParent(1,E)
}

Dri = P:driver()
Active = P:driver():isValid()
if(Active)
{
    W = Dri:keyForward()
    A = Dri:keyLeft()
    S = Dri:keyBack()
    D = Dri:keyRight()
    Spc = Dri:keyJump()
    Shift = Dri:keySprint()
    M1 = Dri:keyAttack1()
    M2 = Dri:keyAttack2()
    R = Dri:keyReload()
    
    FM+=0.0025
    
    if(changed(R) & R)
    {
        WM = !WM
        P:printDriver(4,"WEAPON MODE: "+(WM ? "ON" : "OFF"))
    }
    
    if(WM & changed(M1) & M1 & propCanCreate() & M:count() < 16)
    {
        local TE = propSpawn("models/props_phx/ww2bomb.mdl",Dri:shootPos() + Dri:eye()*50,Dri:eyeAngles(),1)
        TE:setColor(0,0,0,0)
        
        holoCreate(TE:id(),TE:pos(),vec(3),TE:angles())
        holoModel(TE:id(),"models/props_junk/garbage_takeoutcarton001a.mdl")
        holoColor(TE:id(),vec(255,100,100))
        holoParent(TE:id(),TE)
        
        M:pushEntity(TE)
    }
}else
{
    FM-=0.0025
}
FM = clamp(FM,0,1)

if(M:count() > 0)
{
    foreach(I, TE:entity = M)
    {
        local RD = rangerOffset(100,TE:pos(),TE:forward())
        if(RD:hit())
        {
            holoDelete(TE:id())
            TE:propBreak()
            M:remove(I)
        }else
        {
            TE:setPos(TE:toWorld(vec(100,0,0)))
        }
    }
}

if(changed(FM)) #Remove this block of code here if you don't want to see the visual representation of the amount of force being applied
{
    
}

E:applyForce((E:up()*(FC+((Spc-Shift)*4))-(E:vel()*vec(0.0025,0.0025,0.005)))*E:mass()*FM)
E:applyAngForce((ang((D-A)*60,(M1-M2)*!WM*80,(S-W)*60)-(E:angles()*ang(3,0,3))-E:angVel()*1.5)*E:mass()*FM)
