From c53eb2a0224e64a570841e085085eaefb9531dd7 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 3 May 2026 20:10:59 +0300 Subject: [PATCH] updated unit stats configurable cruise missile stats bugfix for incorrect projectile collision with the surface --- .../Units/Vehicles/Mechs/acsMech.xml | 1 + .../Units/Vehicles/Mechs/aincMech.xml | 3 +- .../Units/Vehicles/Mechs/erMech.xml | 3 +- Assets/Scripts/Core/player.lua | 4 +- Assets/Scripts/Core/playerInit.lua | 2 +- .../Projectiles/projectileData.lua | 21 ++- Assets/Scripts/GameObjects/Units/unitData.lua | 176 +++++++++--------- cruiseMissile.cpp | 11 +- cruiseMissile.h | 2 + projectile.cpp | 2 +- 10 files changed, 126 insertions(+), 99 deletions(-) diff --git a/Assets/Models/GameObjects/Units/Vehicles/Mechs/acsMech.xml b/Assets/Models/GameObjects/Units/Vehicles/Mechs/acsMech.xml index 0404f3f..c1665da 100644 --- a/Assets/Models/GameObjects/Units/Vehicles/Mechs/acsMech.xml +++ b/Assets/Models/GameObjects/Units/Vehicles/Mechs/acsMech.xml @@ -1,4 +1,5 @@ + diff --git a/Assets/Models/GameObjects/Units/Vehicles/Mechs/aincMech.xml b/Assets/Models/GameObjects/Units/Vehicles/Mechs/aincMech.xml index c12dd9e..b4c17ea 100644 --- a/Assets/Models/GameObjects/Units/Vehicles/Mechs/aincMech.xml +++ b/Assets/Models/GameObjects/Units/Vehicles/Mechs/aincMech.xml @@ -1,4 +1,5 @@ + @@ -29429,4 +29430,4 @@ - \ No newline at end of file + diff --git a/Assets/Models/GameObjects/Units/Vehicles/Mechs/erMech.xml b/Assets/Models/GameObjects/Units/Vehicles/Mechs/erMech.xml index 593ddd4..0469c69 100644 --- a/Assets/Models/GameObjects/Units/Vehicles/Mechs/erMech.xml +++ b/Assets/Models/GameObjects/Units/Vehicles/Mechs/erMech.xml @@ -1,4 +1,5 @@ + @@ -21081,4 +21082,4 @@ - \ No newline at end of file + diff --git a/Assets/Scripts/Core/player.lua b/Assets/Scripts/Core/player.lua index 0564c27..2c6f1e5 100644 --- a/Assets/Scripts/Core/player.lua +++ b/Assets/Scripts/Core/player.lua @@ -237,7 +237,7 @@ function Player:findSuitableSpot(buildingId, idealPos, radius) structFrame:destroy() return point elseif structFrame.status == GameObjectFrameStatus.BLOCKED_BY_FOG_OF_WAR then - engis = self:getUnitsByClass(UnitClass.CYBORG_ENGINEER, -1) + engis = self:getUnitsByClass(UnitClass.ROBO_ENGINEER, -1) for i = 1, #engis do if engis[i]:getNumOrders() > 0 and engis[i]:getOrder(0).targets[1].pos:getDistanceFrom(point) < engis[i]:getLineOfSight() then @@ -279,7 +279,7 @@ function Player:buildStructure(engineer, buildingId, buildPos, buildAngle) end function Player:findIdleEngineer() - engineers = self:getUnitsByClass(UnitClass.CYBORG_ENGINEER, -1) + engineers = self:getUnitsByClass(UnitClass.ROBO_ENGINEER, -1) for i = 1, #engineers do if engineers[i]:getNumOrders() == 0 then return engineers[i] end diff --git a/Assets/Scripts/Core/playerInit.lua b/Assets/Scripts/Core/playerInit.lua index 5071a07..e43e9dd 100644 --- a/Assets/Scripts/Core/playerInit.lua +++ b/Assets/Scripts/Core/playerInit.lua @@ -11,7 +11,7 @@ for i = 1, #game.cpuPlayers do func = player.buildTaskForces, args = { factoryClass = UnitClass.LAND_FACTORY, - taskForceData = {{class = UnitClass.CYBORG_ENGINEER, numUnits = 5}} + taskForceData = {{class = UnitClass.ROBO_ENGINEER, numUnits = 5}} } }, { diff --git a/Assets/Scripts/GameObjects/Projectiles/projectileData.lua b/Assets/Scripts/GameObjects/Projectiles/projectileData.lua index 6a35775..37b0940 100644 --- a/Assets/Scripts/GameObjects/Projectiles/projectileData.lua +++ b/Assets/Scripts/GameObjects/Projectiles/projectileData.lua @@ -1,4 +1,4 @@ -ProjectileId = {HE_SHELL = 0, EMP_SHELL = 1, CRUISE_MISSILE = 2, MISSILE = 3, TORPEDO = 4, DEPTH_CHARGE = 5} +ProjectileId = {TANK_SHELL = 0, ANTI_SUB_CRUISER_SHELL = 1, EMP_SHELL = 2, CRUISE_MISSILE = 3, MISSILE = 4, TORPEDO = 5, DEPTH_CHARGE = 6} ProjectileClass = {SHELL = 0, CRUISE_MISSILE = 1, MISSILE = 2, TORPEDO = 3, DEPTH_CHARGE = 4} G = 9.8 @@ -36,6 +36,19 @@ projectiles = { meshPath = "shell.xml", albedoPath = 'shell.jpg' }, + { + projectileClass = ProjectileClass.SHELL, + size = {x = 1, y = 1, z = 1}, + speed = 5, + rotAngle = .1, + explosion = {detonation = Detonation.EXPLOSION, damage = 100, radius = 20, fx = {explosionVfx, explosionSfx}}, + directHitDamage = 80, + rayLength = 1, + name = "Shell", + basePath = PATH .. "Models/GameObjects/Projectiles/Shells/", + meshPath = "shell.xml", + albedoPath = 'shell.jpg' + }, { projectileClass = ProjectileClass.SHELL, size = {x = 1, y = 1, z = 1}, @@ -51,9 +64,11 @@ projectiles = { }, { projectileClass = ProjectileClass.CRUISE_MISSILE, + minDist = 6, + minHeight = 50, health = 75, size = {x = 6, y = 13.5, z = 2.54}, - speed = .5, + speed = 1.5, rotAngle = .1, explosion = {detonation = Detonation.EXPLOSION, damage = 100, radius = 20, fx = {explosionVfx, explosionSfx}}, directHitDamage = 450, @@ -71,7 +86,7 @@ projectiles = { rotAngle = .1, explosion = {detonation = Detonation.EXPLOSION, damage = 70, radius = 12, fx = {explosionVfx, explosionSfx}}, directHitDamage = 250, - rayLength = 3, + rayLength = 1.8, name = "Missile", basePath = PATH .. "Models/GameObjects/Projectiles/Missiles/", meshPath = "missile.xml", diff --git a/Assets/Scripts/GameObjects/Units/unitData.lua b/Assets/Scripts/GameObjects/Units/unitData.lua index 404e0d2..2baa161 100644 --- a/Assets/Scripts/GameObjects/Units/unitData.lua +++ b/Assets/Scripts/GameObjects/Units/unitData.lua @@ -129,8 +129,10 @@ units = { { orderType = OrderType.ATTACK, rateOfFire = 100, - maxRange = 14, + maxRange = 40, damage = 50, + maxFireAngle = .1, + nodes = {{name = 'turret', rotationSpeed = 0, angleConstraints = {min = -1.5, max = 1.5}, vertical = true}}, fireFx = { { vfx = true, @@ -191,7 +193,7 @@ units = { selectionSfx = PATH .. 'Sounds/Units/WarMechs/selection.ogg', speed = .4, destinationOffset = .1, - anglePrecision = .1, + anglePrecision = .01, maxTurnAngle = .1, garrisonCategory = 1, deathFx = {explosionVfx, explosionSfx}, @@ -201,9 +203,10 @@ units = { { orderType = OrderType.ATTACK, rateOfFire = 100, - maxRange = 14, + maxRange = 40, damage = 50, - maxFireAngle = .15, + maxFireAngle = .1, + nodes = {{name = 'turret', rotationSpeed = 1, angleConstraints = {min = -1.5, max = 1.5}, vertical = true}}, fireFx = { { vfx = true, @@ -248,6 +251,7 @@ units = { unitClass = UnitClass.MECH, unitType = UnitType.LAND, armor = {ArmorType.MECHANIC}, + alignToSurface = true, maxUnevenness = .5, isVehicle = true, health = 500, @@ -264,7 +268,7 @@ units = { selectionSfx = PATH .. 'Sounds/Units/WarMechs/selection.ogg', speed = .3, destinationOffset = .1, - anglePrecision = .01, + anglePrecision = .1, maxTurnAngle = .1, garrisonCategory = 1, deathFx = {explosionVfx, explosionSfx}, @@ -273,9 +277,11 @@ units = { weapons = { { orderType = OrderType.ATTACK, - rateOfFire = 100, - maxRange = 14, + rateOfFire = 250, + maxRange = 40, damage = 50, + maxFireAngle = .1, + nodes = {{name = 'turret', rotationSpeed = 1, angleConstraints = {min = -1.5, max = 1.5}, vertical = true}}, fireFx = { { vfx = true, @@ -320,6 +326,7 @@ units = { unitClass = UnitClass.MECH, unitType = UnitType.LAND, armor = {ArmorType.MECHANIC}, + alignToSurface = true, maxUnevenness = .5, isVehicle = true, health = 500, @@ -334,7 +341,7 @@ units = { albedoPath = 'mech.jpg', colorNodes = {'stripes'}, selectionSfx = PATH .. 'Sounds/Units/WarMechs/selection.ogg', - speed = .3, + speed = .4, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -350,7 +357,7 @@ units = { maxRange = 50, maxFireAngle = .1, nodes = {{name = 'TankASHead', rotationSpeed = .05, vertical = false}, {name = 'barell', rotationSpeed = .05, angleConstraints = {min = 0, max = .349}, vertical = true}}, - projectile = {id = ProjectileId.HE_SHELL, parent = 'barell', pos = {x = 0, y = .49, z = 8.35}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.TANK_SHELL, parent = 'barell', pos = {x = 0, y = .49, z = 8.35}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -392,7 +399,7 @@ units = { albedoPath = 'tank.jpg', colorNodes = {'TankASHead'}, selectionSfx = PATH .. 'Sounds/Units/Tanks/selection.ogg', - speed = 5, + speed = .5, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -405,10 +412,10 @@ units = { orderType = OrderType.ATTACK, rateOfFire = 1000, damage = 200, - maxRange = 250, + maxRange = 50, maxFireAngle = .1, nodes = {{name = 'TankGun_AM', rotationSpeed = .05, vertical = false}, {name = 'barell', rotationSpeed = .05, angleConstraints = {min = -.2, max = .74}, vertical = true}}, - projectile = {id = ProjectileId.HE_SHELL, parent = 'barell', pos = {x = 0.06, y = .19, z = 9.18}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.TANK_SHELL, parent = 'barell', pos = {x = 0.06, y = .19, z = 9.18}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -465,8 +472,11 @@ units = { damage = 200, maxRange = 50, maxFireAngle = .1, - nodes = {{name = 'turret', rotationSpeed = .05, vertical = false}}, - projectile = {id = ProjectileId.HE_SHELL, parent = 'turret', pos = {x = 0, y = .67, z = 5}, rot = {w = 1, x = 0, y = 0, z = 0}}, + nodes = { + {name = 'turret', rotationSpeed = .05, vertical = false}, + {name = 'GunHead', rotationSpeed = .05, angleConstraints = {min = -.174, max = 0}, vertical = true} + }, + projectile = {id = ProjectileId.TANK_SHELL, parent = 'turret', pos = {x = 0, y = .67, z = 5}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -491,7 +501,7 @@ units = { } }, unitClass = UnitClass.TANK, - unitType = UnitType.LAND, + unitType = UnitType.HOVER, armor = {ArmorType.STEEL}, maxUnevenness = .5, isVehicle = true, @@ -527,7 +537,7 @@ units = { {name = 'Asia_Mech.001', rotationSpeed = .05, vertical = false}, {name = 'Asia_Mech.002', rotationSpeed = .05, angleConstraints = {min = -.348, max = .785}, vertical = true} }, - projectile = {id = ProjectileId.HE_SHELL, parent = 'Asia_Mech.002', pos = {x = 0., y = 0., z = 5.91}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.TANK_SHELL, parent = 'Asia_Mech.002', pos = {x = 0., y = 0., z = 5.91}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = true, @@ -586,7 +596,7 @@ units = { {name = 'turret', rotationSpeed = .05, vertical = false}, {name = 'barrel', rotationSpeed = .05, angleConstraints = {min = -.139, max = .279}, vertical = true} }, - projectile = {id = ProjectileId.HE_SHELL, parent = 'barrel', pos = {x = 0., y = 0, z = 9.14}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.TANK_SHELL, parent = 'barrel', pos = {x = 0., y = 0, z = 9.14}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = true, @@ -612,7 +622,6 @@ units = { unitType = UnitType.LAND, armor = {ArmorType.MECHANIC}, maxUnevenness = .5, - alignToSurface = true, isVehicle = true, health = 500, buildTime = 1000, @@ -748,7 +757,7 @@ units = { }, abilityButtons = {{buttonType = ButtonType.ORDER, name = 'Hack', orderType = OrderType.HACK}}, unitClass = UnitClass.CYBORG_ENGINEER, - unitType = UnitType.HOVER, + unitType = UnitType.LAND, armor = {ArmorType.MECHANIC}, maxUnevenness = .5, isVehicle = true, @@ -769,7 +778,7 @@ units = { speed = 1, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .3, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, @@ -829,7 +838,7 @@ units = { }, abilityButtons = {{buttonType = ButtonType.ORDER, name = 'Hack', orderType = OrderType.HACK}}, unitClass = UnitClass.CYBORG_ENGINEER, - unitType = UnitType.HOVER, + unitType = UnitType.LAND, armor = {ArmorType.MECHANIC}, maxUnevenness = .5, isVehicle = true, @@ -910,7 +919,7 @@ units = { }, abilityButtons = {{buttonType = ButtonType.ORDER, name = 'Hack', orderType = OrderType.HACK}}, unitClass = UnitClass.CYBORG_ENGINEER, - unitType = UnitType.HOVER, + unitType = UnitType.LAND, armor = {ArmorType.MECHANIC}, maxUnevenness = .5, isVehicle = true, @@ -1092,7 +1101,7 @@ units = { meshPath = 'aincTransport.xml', albedoPath = 'transport.jpg', selectionSfx = PATH .. 'Sounds/Units/Transports/selection.ogg', - speed = .1, + speed = .6, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -1168,7 +1177,7 @@ units = { meshPath = 'erTransport.xml', albedoPath = 'transport.jpg', selectionSfx = PATH .. 'Sounds/Units/Transports/selection.ogg', - speed = .1, + speed = .6, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -1284,8 +1293,8 @@ units = { weapons = { { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 1500, + damage = 80, maxRange = 50, nodes = { {name = 'FrontTurret', rotationSpeed = .05, angleConstraints = {min = -2.53, max = 2.53}, vertical = false}, @@ -1307,8 +1316,8 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 1500, + damage = 80, maxRange = 50, nodes = { {name = 'RearTurret', rotationSpeed = .05, angleConstraints = {min = -2.53, max = 2.53}, vertical = false}, @@ -1391,8 +1400,8 @@ units = { weapons = { { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 1500, + damage = 70, maxRange = 50, nodes = {{name = 'frontTurret', rotationSpeed = .05, angleConstraints = {min = -2.44, max = 2.44}, vertical = false}}, fireFx = { @@ -1411,8 +1420,8 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 1500, + damage = 70, maxRange = 50, nodes = {{name = 'rearTurret', rotationSpeed = .05, angleConstraints = {min = -2.44, max = 2.44}, vertical = false}}, fireFx = { @@ -1492,7 +1501,7 @@ units = { meshPath = 'mediumAssaultCruiser.xml', albedoPath = 'cruiser.jpg', selectionSfx = PATH .. 'Sounds/Units/Cruisers/selection.ogg', - speed = .1, + speed = .45, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -1503,8 +1512,8 @@ units = { weapons = { { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 1400, + damage = 60, maxRange = 50, nodes = { {name = 'frontTurret', rotationSpeed = .05, angleConstraints = {min = -2.44, max = 2.44}, vertical = false}, @@ -1526,8 +1535,8 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 1400, + damage = 60, maxRange = 50, nodes = { {name = 'rearTurret', rotationSpeed = .05, angleConstraints = {min = -2.44, max = 2.44}, vertical = false}, @@ -1602,10 +1611,10 @@ units = { meshPath = 'lightAssaultCruiser.xml', albedoPath = 'cruiser.jpg', selectionSfx = PATH .. 'Sounds/Units/Cruisers/selection.ogg', - speed = .1, + speed = .5, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .05, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, @@ -1704,7 +1713,6 @@ units = { { orderType = OrderType.ATTACK, rateOfFire = 2000, - damage = 10, maxRange = 100, targetUnits = {UnitType.UNDERWATER}, targetProjectiles = {}, @@ -1717,14 +1725,13 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 1500, maxRange = 50, nodes = { {name = 'frontTurret', rotationSpeed = .05, angleConstraints = {min = -2.26, max = 2.26}, vertical = false}, {name = 'frontTurretBarrels', rotationSpeed = .05, angleConstraints = {min = -.1395, max = .348}, vertical = true} }, - projectile = {id = ProjectileId.HE_SHELL, parent = 'frontTurret', pos = {x = 0.52, y = .83, z = 4.16}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.ANTI_SUB_CRUISER_SHELL, parent = 'frontTurret', pos = {x = 0.52, y = .83, z = 4.16}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -1747,14 +1754,13 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 1500, maxRange = 50, nodes = { {name = 'middleTurret', rotationSpeed = .05, vertical = false}, {name = 'middleTurretBarrel', rotationSpeed = .05, angleConstraints = {min = -.0872, max = .209}, vertical = true} }, - projectile = {id = ProjectileId.HE_SHELL, parent = 'middleTurret', pos = {x = 0, y = 1.8, z = 7.45}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.ANTI_SUB_CRUISER_SHELL, parent = 'middleTurret', pos = {x = 0, y = 1.8, z = 7.45}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -1777,14 +1783,13 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 1500, maxRange = 50, nodes = { {name = 'rearTurret', rotationSpeed = .05, angleConstraints = {min = -2.79, max = 2.79}, vertical = false}, {name = 'rearTurretBarrel', rotationSpeed = .05, angleConstraints = {min = -.0872, max = .209}, vertical = true} }, - projectile = {id = ProjectileId.HE_SHELL, parent = 'rearTurret', pos = {x = 0, y = 1.8, z = 7.45}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.ANTI_SUB_CRUISER_SHELL, parent = 'rearTurret', pos = {x = 0, y = 1.8, z = 7.45}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -1822,7 +1827,7 @@ units = { meshPath = 'aincAntiSubCruiser.xml', albedoPath = 'cruiser.jpg', selectionSfx = PATH .. 'Sounds/Units/Cruisers/selection.ogg', - speed = .3, + speed = .6, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -1834,7 +1839,6 @@ units = { { orderType = OrderType.ATTACK, rateOfFire = 2000, - damage = 10, maxRange = 100, targetUnits = {UnitType.UNDERWATER}, targetProjectiles = {}, @@ -1847,14 +1851,13 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 2000, maxRange = 50, nodes = { {name = 'frontLowerTurret', rotationSpeed = .05, angleConstraints = {min = -2.44, max = 2.44} , vertical = false}, {name = 'frontLowerTurretBarrels', rotationSpeed = .05, angleConstraints = {min = 0, max = .785}, vertical = true}, }, - projectile = {id = ProjectileId.HE_SHELL, parent = 'frontLowerTurret', pos = {x = .42, y = 1.68, z = 4.14}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.ANTI_SUB_CRUISER_SHELL, parent = 'frontLowerTurret', pos = {x = .42, y = 1.68, z = 4.14}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -1877,14 +1880,13 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 2000, maxRange = 50, nodes = { {name = 'frontUpperTurret', rotationSpeed = .05, angleConstraints = {min = -2.44, max = 2.44} , vertical = false}, {name = 'frontUpperTurretBarrels', rotationSpeed = .05, angleConstraints = {min = 0, max = .785}, vertical = true}, }, - projectile = {id = ProjectileId.HE_SHELL, parent = 'frontUpperTurret', pos = {x = .42, y = 1.68, z = 4.14}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.ANTI_SUB_CRUISER_SHELL, parent = 'frontUpperTurret', pos = {x = .42, y = 1.68, z = 4.14}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -1907,14 +1909,13 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 2000, maxRange = 50, nodes = { {name = 'rearLowerTurret', rotationSpeed = .05, angleConstraints = {min = -2.44, max = 2.44} , vertical = false}, {name = 'rearLowerTurretBarrels', rotationSpeed = .05, angleConstraints = {min = 0, max = .785}, vertical = true}, }, - projectile = {id = ProjectileId.HE_SHELL, parent = 'rearLowerTurret', pos = {x = .42, y = 1.68, z = 4.14}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.ANTI_SUB_CRUISER_SHELL, parent = 'rearLowerTurret', pos = {x = .42, y = 1.68, z = 4.14}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -1937,14 +1938,13 @@ units = { }, { orderType = OrderType.ATTACK, - rateOfFire = 200, - damage = 10, + rateOfFire = 2000, maxRange = 50, nodes = { {name = 'rearUpperTurret', rotationSpeed = .05, angleConstraints = {min = -2.44, max = 2.44} , vertical = false}, {name = 'rearUpperTurretBarrels', rotationSpeed = .05, angleConstraints = {min = 0, max = .785}, vertical = true}, }, - projectile = {id = ProjectileId.HE_SHELL, parent = 'rearUpperTurret', pos = {x = .42, y = 5.82, z = 11.4}, rot = {w = 1, x = 0, y = 0, z = 0}}, + projectile = {id = ProjectileId.ANTI_SUB_CRUISER_SHELL, parent = 'rearUpperTurret', pos = {x = .42, y = 5.82, z = 11.4}, rot = {w = 1, x = 0, y = 0, z = 0}}, fireFx = { { vfx = false, @@ -1982,7 +1982,7 @@ units = { meshPath = 'erAntiSubCruiser.xml', albedoPath = 'cruiser.jpg', selectionSfx = PATH .. 'Sounds/Units/Cruisers/selection.ogg', - speed = .3, + speed = .6, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -2034,10 +2034,10 @@ units = { albedoPath = 'submarine.jpg', colorNodes = {'Cube.001'}, selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .3, + speed = .4, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .125, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, @@ -2054,7 +2054,7 @@ units = { } }, damage = 200, - maxRange = 20, + maxRange = 200, projectile = {id = ProjectileId.TORPEDO, pos = {x = 0, y = -.27, z = 4.6}, rot = {w = 1, x = 0, y = 0, z = 0}} }, { @@ -2086,10 +2086,10 @@ units = { albedoPath = 'submarine.jpg', colorNodes = {'Cube.001'}, selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .1, + speed = .4, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .125, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, @@ -2106,7 +2106,7 @@ units = { } }, damage = 200, - maxRange = 20, + maxRange = 200, projectile = {id = ProjectileId.TORPEDO, pos = {x = 0, y = -.27, z = 4.6}, rot = {w = 1, x = 0, y = 0, z = 0}} }, { @@ -2138,10 +2138,10 @@ units = { albedoPath = 'submarine.jpg', colorNodes = {'Sphere.001'}, selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .1, + speed = .4, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .125, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, @@ -2177,10 +2177,10 @@ units = { meshPath = 'acsSubmarine.xml', albedoPath = 'submarine.jpg', selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .2, + speed = .5, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .15, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, @@ -2190,7 +2190,7 @@ units = { orderType = OrderType.ATTACK, projectile = {id = ProjectileId.TORPEDO, pos = {x = 0, y = -.27, z = 4.6}, rot = {w = 1, x = 0, y = 0, z = 0}}, damage = 200, - maxRange = 20, + maxRange = 200, rateOfFire = 500, fireFx = { { @@ -2216,10 +2216,10 @@ units = { meshPath = 'aincSubmarine.xml', albedoPath = 'submarine.jpg', selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .1, + speed = .6, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .15, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, @@ -2229,7 +2229,7 @@ units = { orderType = OrderType.ATTACK, projectile = {id = ProjectileId.TORPEDO, pos = {x = 0, y = -.27, z = 4.6}, rot = {w = 1, x = 0, y = 0, z = 0}}, damage = 200, - maxRange = 20, + maxRange = 200, rateOfFire = 500, fireFx = { { @@ -2255,10 +2255,10 @@ units = { meshPath = 'erSubmarine.xml', albedoPath = 'submarine.jpg', selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .1, + speed = .5, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .15, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, @@ -2278,7 +2278,7 @@ units = { meshPath = 'acsIcebreaker.xml', albedoPath = 'icebreaker.jpg', selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .1, + speed = .4, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -2301,7 +2301,7 @@ units = { meshPath = 'aincIcebreaker.xml', albedoPath = 'icebreaker.jpg', selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .1, + speed = .4, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -2324,7 +2324,7 @@ units = { meshPath = 'erIcebreaker.xml', albedoPath = 'icebreaker.jpg', selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .1, + speed = .4, destinationOffset = .1, anglePrecision = .1, maxTurnAngle = .1, @@ -2337,7 +2337,7 @@ units = { type = WeaponClass.FREEZE, orderType = OrderType.ATTACK, rateOfFire = 100, - maxRange = 30, + maxRange = 500, damage = 0, nodes = { {name = 'turret', rotationSpeed = .05, vertical = false}, @@ -2371,10 +2371,10 @@ units = { meshPath = 'freezer.xml', albedoPath = 'freezer.jpg', selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .3, + speed = .7, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .15, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, @@ -2412,10 +2412,10 @@ units = { meshPath = 'empShip.xml', albedoPath = 'empShip.jpg', selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg', - speed = .1, + speed = 1.5, destinationOffset = .1, anglePrecision = .1, - maxTurnAngle = .1, + maxTurnAngle = .2, garrisonCategory = 3, deathFx = {explosionVfx, explosionSfx}, }, diff --git a/cruiseMissile.cpp b/cruiseMissile.cpp index c43998e..e7d26e3 100644 --- a/cruiseMissile.cpp +++ b/cruiseMissile.cpp @@ -12,6 +12,7 @@ namespace battleship{ using namespace std; using namespace vb01; + using namespace gameBase; CruiseMissile::CruiseMissile(Unit *unit, int id, Vector3 tp, Vector3 pos, Quaternion rot) : Projectile(unit, id, pos, rot), @@ -20,6 +21,8 @@ namespace battleship{ { destructable = new Destructable(this); + initProperties(); + Vector3 unitDir = unit->getDirVec(); Vector3 leftDir = unit->getLeftVec(); Vector3 targDir = (Vector3(targetPoint.x, pos.y, targetPoint.z) - pos).norm(); @@ -31,8 +34,13 @@ namespace battleship{ CruiseMissile::~CruiseMissile(){delete destructable;} + void CruiseMissile::initProperties(){ + sol::table projTable = generateView()[GameObject::getGameObjTableName()][id + 1]; + minHeight = (float)projTable["minHeight"]; + minDist = (float)projTable["minDist"]; + } + void CruiseMissile::pitch(float rotAngle, Vector3 compVec){ - float minHeight = 20; float angleToCompVec = Projectile::dirVec.getAngleBetween(compVec); float angle = (angleToCompVec > rotAngle ? rotAngle : angleToCompVec); @@ -49,7 +57,6 @@ namespace battleship{ } void CruiseMissile::cruise(){ - float minDist = 6; float initDist = Vector3(targetPoint.x, initPos.y, targetPoint.z).getDistanceFrom(initPos); if(Projectile::pos.getDistanceFrom(Vector3(targetPoint.x, Projectile::pos.y, targetPoint.z)) < minDist) diff --git a/cruiseMissile.h b/cruiseMissile.h index ff76db4..c2cff02 100644 --- a/cruiseMissile.h +++ b/cruiseMissile.h @@ -13,7 +13,9 @@ namespace battleship{ enum class FlightStage{ASCENT, CRUISE, DESCENT}; FlightStage flightStage; vb01::Vector3 targetPoint; + float minHeight, minDist; + void initProperties(); void pitch(float, vb01::Vector3); void cruise(); }; diff --git a/projectile.cpp b/projectile.cpp index d76085e..92f139a 100755 --- a/projectile.cpp +++ b/projectile.cpp @@ -122,7 +122,7 @@ namespace battleship{ cellId = cells[cellId].underWaterCellIds[numUnderwaterCells - 1]; } - if((pos + dirVec * rayLength).y <= cells[cellId].pos.y + .5 * map->getCellSize().y) + if((pos + dirVec * rayLength).y <= cells[cellId].pos.y) detonate(); }