------------------------------------------------------------------------------
--  File     :  /mods/4DC_V0.8/lua/4D_projectiles.lua
--
--  Author(s):  EbolaSoup, Resin Smoker, Optimus Prime, Vissroid 
--
--  (Weapon Templates by:Exavier Macbeth)
--
--  Copyright © 2011 4DC_V0.8  All rights reserved.
------------------------------------------------------------------------------

-------------------------------------------------------------------------
--  PROJECTILES SCRIPTS
-------------------------------------------------------------------------
local Projectile = import('/lua/sim/projectile.lua').Projectile
local DefaultProjectileFile = import('/lua/sim/defaultprojectiles.lua')
local EmitterProjectile = DefaultProjectileFile.EmitterProjectile
local OnWaterEntryEmitterProjectile = DefaultProjectileFile.OnWaterEntryEmitterProjectile
local SingleBeamProjectile = DefaultProjectileFile.SingleBeamProjectile
local SinglePolyTrailProjectile = DefaultProjectileFile.SinglePolyTrailProjectile
local MultiPolyTrailProjectile = DefaultProjectileFile.MultiPolyTrailProjectile
local SingleCompositeEmitterProjectile = DefaultProjectileFile.SingleCompositeEmitterProjectile
local Explosion = import('/lua/defaultexplosions.lua')
local EffectTemplate = import('/lua/EffectTemplates.lua')
local DefaultExplosion = import('/lua/defaultexplosions.lua')
local DepthCharge = import('/lua/defaultantiprojectile.lua').DepthCharge
local util = import('/lua/utilities.lua')
local EffectTemplate = import('/lua/EffectTemplates.lua')

EmtBpPath = '/effects/emitters/'
MOD_BpPath = '/mods/4DC_V0.8/effects/emitters/'
Custom_4D_EffectTemplate = import('/mods/4DC_V0.8/lua/4D_EffectTemplates.lua')

-------------------------------------------------------------------------
--  AEON UAL0216 LongHammer artillery weapon (4DC Custom Projectile)
-------------------------------------------------------------------------

TArtCannon = Class(MultiPolyTrailProjectile) {
    FxImpactWater = Custom_4D_EffectTemplate.TArtCannonHit,
    FxImpactLand = Custom_4D_EffectTemplate.TArtCannonHit,
    FxImpactNone = Custom_4D_EffectTemplate.TArtCannonHit,
    FxImpactProp = Custom_4D_EffectTemplate.TArtCannonHit,    
    FxImpactUnit = Custom_4D_EffectTemplate.TArtCannonUnitHit,    
    FxTrails = Custom_4D_EffectTemplate.TArtCannonFxTrails,

    -- Using MultPolyTrail:
    PolyTrails = Custom_4D_EffectTemplate.TArtCannonPolyTrails,  
    PolyTrailOffset = {0,-0.5}, # original = {0,0}
    FxImpactProjectile = {},
    FxImpactUnderWater = {},   
    FxTrailScale = 0.5,
    FxUnitHitScale = 0.5,
    FxLandHitScale = 0.5, 
    FxNoneHitScale = 0.5, 
    FxPropHitScale = 0.5, 
    FxWaterHitScale = 0.5,
}

-------------------------------------------------------------------------
--  AEON UAL0216 LongHammer direct fire weapon (4DC Custom Projectile)
-------------------------------------------------------------------------

TMidCannon = Class(MultiPolyTrailProjectile) {
    FxImpactWater = Custom_4D_EffectTemplate.TMidCannonHit,
    FxImpactLand = Custom_4D_EffectTemplate.TMidCannonHit,
    FxImpactNone = Custom_4D_EffectTemplate.TMidCannonHit,
    FxImpactProp = Custom_4D_EffectTemplate.TMidCannonHit,    
    FxImpactUnit = Custom_4D_EffectTemplate.TMidCannonUnitHit,    
    FxTrails = Custom_4D_EffectTemplate.TMidCannonFxTrails,

    -- Using MultPolyTrail:
    PolyTrails = Custom_4D_EffectTemplate.TMidCannonPolyTrails,
    PolyTrailOffset = {0,-0.5}, # original = {0,0.5}
    FxImpactProjectile = {},
    FxImpactUnderWater = {},   
    FxTrailScale = 0.25,
    FxUnitHitScale = 0.1,
    FxLandHitScale = 0.1, 
    FxNoneHitScale = 0.1, 
    FxPropHitScale = 0.1, 
    FxWaterHitScale = 0.1,
}

-------------------------------------------------------------------------
--  AEON ARROW MISSILE PROJECTILES (4DC Custom Projectile)
-------------------------------------------------------------------------
ArrowMissileProjectile = Class(SingleCompositeEmitterProjectile) {
    PolyTrail = '/effects/emitters/serpentine_missile_trail_emit.bp',
    BeamName = '/effects/emitters/serpentine_missle_exhaust_beam_01_emit.bp',
    PolyTrailOffset = -0.05,
    FxUnitHitScale = 3.0,
    FxLandHitScale = 3.0,
    FxWaterHitScale = 3.0,
    FxUnderWaterHitScale = 2.5,
    FxAirUnitHitScale = 3.0,
    FxNoneHitScale = 3.0,    
    FxImpactUnit = EffectTemplate.AMissileHit01,
    FxImpactProp = EffectTemplate.AMissileHit01,
    FxImpactLand = EffectTemplate.AMissileHit01,
    FxImpactUnderWater = {},
    OnCreate = function(self)
        self:SetCollisionShape('Sphere', 0, 0, 0, 1.0)
        SingleCompositeEmitterProjectile.OnCreate(self)
    end,
}

-------------------------------------------------------------------------
--  AEON LASER PHALANX PROJECTILES (4DC Custom Projectile)
-------------------------------------------------------------------------
LaserPhalanxProjectile = Class(MultiPolyTrailProjectile) {

    PolyTrails = {
        '/effects/emitters/disintegrator_polytrail_04_emit.bp',
        '/effects/emitters/disintegrator_polytrail_05_emit.bp',
        '/effects/emitters/default_polytrail_03_emit.bp',
    },  
    -- offset is needed for proj to hit the missiles 
    PolyTrailOffset = EffectTemplate.TPhalanxGunPolyTrailsOffsets,
    FxTrailScale = 0.25,
    FxImpactUnit = {},
    FxImpactProp = {},
    FxImpactNone = {},
    FxImpactLand = {},
    FxImpactUnderWater = {},
    FxImpactProjectile = EffectTemplate.TMissileHit02,
    FxProjectileHitScale = 0.5,
}

-------------------------------------------------------------------------
--  AEON BFG PROJECTILES (4DC Custom Projectile)
-------------------------------------------------------------------------
BFGProjectile = Class(EmitterProjectile) { 
    FxTrails = EffectTemplate.SDFExperimentalPhasonProjFXTrails01,
    FxTrailScale = 0.75,
    FxImpactUnit =  EffectTemplate.SDFExperimentalPhasonProjHit01,
    FxUnitHitScale = 0.75,
    FxImpactProp =  EffectTemplate.SDFExperimentalPhasonProjHit01,
    FxLandHitScale = 0.75,
    FxImpactLand =  EffectTemplate.SDFExperimentalPhasonProjHit01,
    FxPropHitScale = 0.75,    
}

--------------------------------------------------------------------------
--  TERRAN UEL0416 Rocket weapon (4DC Custom Projectile)
--------------------------------------------------------------------------

TRocketCannon = Class(MultiPolyTrailProjectile) {

    FxImpactLand = Custom_4D_EffectTemplate.TRocketCannonHit,
    FxImpactNone = EffectTemplate.TMissileHit01,
    FxImpactProjectile = {},    
    FxImpactProp = Custom_4D_EffectTemplate.TRocketCannonHit,    
    FxImpactUnit = EffectTemplate.TShipGaussCannonHitUnit01, 
    FxImpactUnderWater = {},  
    FxImpactWater = EffectTemplate.WaterSplash01,         
    FxTrails = Custom_4D_EffectTemplate.TRocketCannonFxTrails,

    -- Using MultPolyTrail:
    PolyTrails = {}, 
    PolyTrailOffset = {0,0}, 
    
    -- Adjusting scale for testing...remove and fix projectile if sizing desired
    FxTrailScale = 0.12, 
    FxUnitHitScale = 0.60,
    FxLandHitScale = 0.50, 
    FxNoneHitScale = 0.60, 
    FxPropHitScale = 0.80, 
    FxWaterHitScale = 0.60,
}

--------------------------------------------------------------------------
--  TERRAN UEL0416 BigGausCannon weapon (4DC Custom Projectile)
--------------------------------------------------------------------------

TBigGausCannon = Class(MultiPolyTrailProjectile) {
    FxImpactWater = Custom_4D_EffectTemplate.TBigGausCannonHit,
    FxImpactLand = Custom_4D_EffectTemplate.TBigGausCannonHit,
    FxImpactNone = Custom_4D_EffectTemplate.TBigGausCannonHit,
    FxImpactProp = Custom_4D_EffectTemplate.TBigGausCannonHit,    
    FxImpactUnit = Custom_4D_EffectTemplate.TBigGausCannonUnitHit,    
    FxTrails = Custom_4D_EffectTemplate.TBigGausCannonFxTrails,

    -- Using MultPolyTrail:
    PolyTrails = Custom_4D_EffectTemplate.TBigGausCannonPolyTrails,
    PolyTrailOffset = {0,-0.5}, 
    FxImpactProjectile = {},
    FxImpactUnderWater = {},
    
    -- Adjusting scale for testing...remove and fix projectile if sizing desired
    FxTrailScale = 1.0,
    FxUnitHitScale = 0.45,
    FxLandHitScale = 0.85, 
    FxNoneHitScale = 0.65, 
    FxPropHitScale = 0.95, 
    FxWaterHitScale = 0.85,
}

--------------------------------------------------------------------------
--  TERRAN UEL0416  RailCannon weapon (4DC Custom Projectile)
--------------------------------------------------------------------------

TRailCannon = Class(MultiPolyTrailProjectile) {
    FxImpactWater = Custom_4D_EffectTemplate.TRailCannonUnitHit,
    FxImpactLand = Custom_4D_EffectTemplate.TRailCannonUnitHit,
    FxImpactNone = Custom_4D_EffectTemplate.TRailCannonUnitHit,
    FxImpactProp = Custom_4D_EffectTemplate.TRailCannonUnitHit,    
    FxImpactUnit = Custom_4D_EffectTemplate.TRailCannonUnitHit,    
    FxTrails = Custom_4D_EffectTemplate.TRailCannonFxTrails,

    -- Using MultPolyTrail:
    PolyTrails = Custom_4D_EffectTemplate.TRailCannonPolyTrails,
    PolyTrailOffset = {0,-0.5}, 
    FxImpactProjectile = {},
    FxImpactUnderWater = {},
    
    -- Adjusting scale for testing...remove and fix projectile if sizing desired
    FxTrailScale = 0.01,
    FxUnitHitScale = 1.65,
    FxLandHitScale = 1.65, 
    FxNoneHitScale = 1.65, 
    FxPropHitScale = 1.65, 
    FxWaterHitScale = 1.65,
}

-------------------------------------------------------------------------
--  TERRAN UEL0403 Magma Cannon (4DC Custom Projectile)
-------------------------------------------------------------------------
TBalrogMagmaCannon = Class(MultiPolyTrailProjectile) {
    FxImpactWater = Custom_4D_EffectTemplate.TMagmaCannonHit,
    FxImpactLand = Custom_4D_EffectTemplate.TMagmaCannonHit,
    FxImpactNone = Custom_4D_EffectTemplate.TMagmaCannonHit,
    FxImpactProp = Custom_4D_EffectTemplate.TMagmaCannonUnitHit,    
    FxImpactUnit = Custom_4D_EffectTemplate.TMagmaCannonUnitHit,    
    FxTrails = Custom_4D_EffectTemplate.TMagmaCannonFxTrails,
    --Using MultPolyTrail:
    PolyTrails = Custom_4D_EffectTemplate.TMagmaCannonPolyTrails,
    PolyTrailOffset = {0,-1.55}, 
    FxImpactProjectile = {},
    FxImpactUnderWater = {},    
    -- Adjusting scale for testing...remove and fix projectile if sizing desired
    FxTrailScale = 1.25,
}

-------------------------------------------------------------------------
--  TERRAN UEL0402 Rapid Plasma (4DC Custom Projectile)
-------------------------------------------------------------------------
Rapid_PlasmaProjectile = Class(EmitterProjectile) {
    FxUnitHitScale = 1.0,
    FxLandHitScale = 1.0,
    FxPropHitScale = 1.0,

    FxTrails = {
        '/effects/emitters/aeon_missiled_wisp_04_emit.bp',
    },
    FxTrailScale = 0.5,
    -- Hit Effects
    FxImpactUnit =  EffectTemplate.AQuarkBombHitUnit01,
    FxImpactProp =  EffectTemplate.AQuarkBombHitUnit01,
    FxImpactLand =  EffectTemplate.AQuarkBombHitLand01,
    FxImpactAirUnit =  EffectTemplate.AQuarkBombHitAirUnit01,
    FxImpactUnderWater = {},
}

-------------------------------------------------------------------------
--  TERRAN UEL0402 Naplam Missile (4DC Custom Projectile)
-------------------------------------------------------------------------
NapalmMissileProjectile = Class(SingleCompositeEmitterProjectile) {
    -- Emitter Values
    FxInitial = {},
    TrailDelay = 0,
    FxTrails = {'/effects/emitters/missile_sam_munition_trail_01_emit.bp',},
    FxTrailOffset = 0,
    PolyTrail = '/effects/emitters/default_polytrail_01_emit.bp',
    BeamName = '/effects/emitters/rocket_iridium_exhaust_beam_01_emit.bp',

    -- Hit Effects
    FxImpactUnit = {
        MOD_BpPath  .. 'napalm_fire_emit_2.bp',
        EmtBpPath .. 'napalm_01_emit.bp',
    },
    FxImpactProp = {
        MOD_BpPath  .. 'napalm_fire_emit_2.bp',
        EmtBpPath .. 'napalm_01_emit.bp',
    },
    FxImpactLand = {
        MOD_BpPath  .. 'napalm_fire_emit_2.bp',
        EmtBpPath .. 'napalm_01_emit.bp',
    },

    FxImpactWater = EffectTemplate.TNapalmHvyCarpetBombHitWater01,
    FxImpactUnderWater = {},
}

-------------------------------------------------------------------------
--  TERRAN UEL0402 EMP Overcharge (4DC Custom Projectile)
-------------------------------------------------------------------------
Over_ChargeProjectile = Class(MultiPolyTrailProjectile) {
    FxUnitHitScale = 1,
    FxLandHitScale = 1,
    FxPropHitScale = 1,
    FxAirHitScale = 1,
    PolyTrails = {
        '/effects/emitters/laserturret_munition_trail_01_emit.bp',
        '/effects/emitters/default_polytrail_06_emit.bp',
    },
    PolyTrailOffset = {0,0},
    BeamName = '/effects/emitters/laserturret_munition_beam_03_emit.bp',
    FxImpactUnit = EffectTemplate.TCommanderOverchargeHit01,
    FxImpactProp = EffectTemplate.TCommanderOverchargeHit01,
    FxImpactLand = EffectTemplate.TCommanderOverchargeHit01,
    FxImpactAirUnit = EffectTemplate.TCommanderOverchargeHit01,
    FxImpactUnderWater = {},
}