mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
Merge branch 'depth-charge' into ft-217-depth-charge
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 754 B |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
ProjectileId = {HE_SHELL = 0, EMP_SHELL = 1, CRUISE_MISSILE = 2, MISSILE = 3, TORPEDO = 4}
|
ProjectileId = {HE_SHELL = 0, EMP_SHELL = 1, CRUISE_MISSILE = 2, MISSILE = 3, TORPEDO = 4, DEPTH_CHARGE = 5}
|
||||||
ProjectileClass = {SHELL = 0, CRUISE_MISSILE = 1, MISSILE = 2, TORPEDO = 3}
|
ProjectileClass = {SHELL = 0, CRUISE_MISSILE = 1, MISSILE = 2, TORPEDO = 3, DEPTH_CHARGE = 4}
|
||||||
G = 9.8
|
G = 9.8
|
||||||
|
|
||||||
explosionVfx = {
|
explosionVfx = {
|
||||||
@@ -20,7 +20,7 @@ explosionSfx = {
|
|||||||
path = PATH .. 'Sounds/SFX/Explosions/explosion02.ogg',
|
path = PATH .. 'Sounds/SFX/Explosions/explosion02.ogg',
|
||||||
duration = 2500
|
duration = 2500
|
||||||
}
|
}
|
||||||
Detonation = {EXPLOSION = 0, EMP = 1, CRYO = 2}
|
Detonation = {EXPLOSION = 0, EMP = 1, CRYO = 2, UNDERWATER = 3}
|
||||||
|
|
||||||
projectiles = {
|
projectiles = {
|
||||||
{
|
{
|
||||||
@@ -80,13 +80,25 @@ projectiles = {
|
|||||||
{
|
{
|
||||||
projectileClass = ProjectileClass.TORPEDO,
|
projectileClass = ProjectileClass.TORPEDO,
|
||||||
size = {x = 1, y = 6, z = 1},
|
size = {x = 1, y = 6, z = 1},
|
||||||
speed = .06,
|
speed = .6,
|
||||||
explosion = {detonation = Detonation.EXPLOSION, damage = 20, radius = 3, fx = {explosionVfx, explosionSfx}},
|
explosion = {detonation = Detonation.UNDERWATER, damage = 20, radius = 3, fx = {explosionVfx, explosionSfx}},
|
||||||
directHitDamage = 450,
|
directHitDamage = 450,
|
||||||
rayLength = 3.5,
|
rayLength = 3.5,
|
||||||
name = "Torpedo",
|
name = "Torpedo",
|
||||||
basePath = PATH .. "Models/GameObjects/Projectiles/Torpedos/",
|
basePath = PATH .. "Models/GameObjects/Projectiles/Torpedos/",
|
||||||
meshPath = "torpedo.xml",
|
meshPath = "torpedo.xml",
|
||||||
albedoPath = 'torpedo.jpg'
|
albedoPath = 'torpedo.jpg'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
projectileClass = ProjectileClass.DEPTH_CHARGE,
|
||||||
|
size = {x = 5.3, y = 5.3, z = 5.8},
|
||||||
|
speed = .06,
|
||||||
|
explosion = {detonation = Detonation.UNDERWATER, damage = 20, radius = 3, fx = {explosionVfx, explosionSfx}},
|
||||||
|
directHitDamage = 450,
|
||||||
|
rayLength = 3.5,
|
||||||
|
name = "Depth charge",
|
||||||
|
basePath = PATH .. "Models/GameObjects/Projectiles/DepthCharges/",
|
||||||
|
meshPath = "depthCharge.xml",
|
||||||
|
albedoPath = 'depthCharge.jpg'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ units = {
|
|||||||
rateOfFire = 100,
|
rateOfFire = 100,
|
||||||
maxRange = 14,
|
maxRange = 14,
|
||||||
damage = 50,
|
damage = 50,
|
||||||
|
maxFireAngle = .15,
|
||||||
fireFx = {
|
fireFx = {
|
||||||
{
|
{
|
||||||
vfx = true,
|
vfx = true,
|
||||||
@@ -260,7 +261,7 @@ units = {
|
|||||||
selectionSfx = PATH .. 'Sounds/Units/WarMechs/selection.ogg',
|
selectionSfx = PATH .. 'Sounds/Units/WarMechs/selection.ogg',
|
||||||
speed = .3,
|
speed = .3,
|
||||||
destinationOffset = .1,
|
destinationOffset = .1,
|
||||||
anglePrecision = .1,
|
anglePrecision = .01,
|
||||||
maxTurnAngle = .1,
|
maxTurnAngle = .1,
|
||||||
garrisonCategory = 1,
|
garrisonCategory = 1,
|
||||||
deathFx = {explosionVfx, explosionSfx},
|
deathFx = {explosionVfx, explosionSfx},
|
||||||
@@ -623,7 +624,7 @@ units = {
|
|||||||
colorNodes = {'barrel'},
|
colorNodes = {'barrel'},
|
||||||
selectionSfx = PATH .. 'Sounds/Units/Tanks/selection.ogg',
|
selectionSfx = PATH .. 'Sounds/Units/Tanks/selection.ogg',
|
||||||
speed = .3,
|
speed = .3,
|
||||||
destinationOffset = .1,
|
destinationOffset = .01,
|
||||||
anglePrecision = .1,
|
anglePrecision = .1,
|
||||||
maxTurnAngle = .1,
|
maxTurnAngle = .1,
|
||||||
garrisonCategory = 2,
|
garrisonCategory = 2,
|
||||||
@@ -1199,7 +1200,7 @@ units = {
|
|||||||
meshPath = 'acsCargoShip.xml',
|
meshPath = 'acsCargoShip.xml',
|
||||||
albedoPath = 'cargoship.jpg',
|
albedoPath = 'cargoship.jpg',
|
||||||
selectionSfx = PATH .. 'Sounds/Units/Cargoships/selection.ogg',
|
selectionSfx = PATH .. 'Sounds/Units/Cargoships/selection.ogg',
|
||||||
speed = .1,
|
speed = .3,
|
||||||
destinationOffset = .1,
|
destinationOffset = .1,
|
||||||
anglePrecision = .1,
|
anglePrecision = .1,
|
||||||
maxTurnAngle = .1,
|
maxTurnAngle = .1,
|
||||||
@@ -1234,7 +1235,7 @@ units = {
|
|||||||
meshPath = 'aincCargoShip.xml',
|
meshPath = 'aincCargoShip.xml',
|
||||||
albedoPath = 'cargoship.jpg',
|
albedoPath = 'cargoship.jpg',
|
||||||
selectionSfx = PATH .. 'Sounds/Units/Cargoships/selection.ogg',
|
selectionSfx = PATH .. 'Sounds/Units/Cargoships/selection.ogg',
|
||||||
speed = .1,
|
speed = .3,
|
||||||
destinationOffset = .1,
|
destinationOffset = .1,
|
||||||
anglePrecision = .1,
|
anglePrecision = .1,
|
||||||
maxTurnAngle = .1,
|
maxTurnAngle = .1,
|
||||||
@@ -1269,7 +1270,7 @@ units = {
|
|||||||
meshPath = 'erCargoShip.xml',
|
meshPath = 'erCargoShip.xml',
|
||||||
albedoPath = 'cargoship.jpg',
|
albedoPath = 'cargoship.jpg',
|
||||||
selectionSfx = PATH .. 'Sounds/Units/Cargoships/selection.ogg',
|
selectionSfx = PATH .. 'Sounds/Units/Cargoships/selection.ogg',
|
||||||
speed = .1,
|
speed = .3,
|
||||||
destinationOffset = .1,
|
destinationOffset = .1,
|
||||||
anglePrecision = .1,
|
anglePrecision = .1,
|
||||||
maxTurnAngle = .1,
|
maxTurnAngle = .1,
|
||||||
@@ -1609,9 +1610,25 @@ units = {
|
|||||||
weapons = {
|
weapons = {
|
||||||
{
|
{
|
||||||
orderType = OrderType.ATTACK,
|
orderType = OrderType.ATTACK,
|
||||||
rateOfFire = 200,
|
rateOfFire = 2000,
|
||||||
damage = 10,
|
damage = 10,
|
||||||
maxRange = 100,
|
maxRange = 100,
|
||||||
|
targetUnits = {UnitType.UNDERWATER},
|
||||||
|
targetProjectiles = {},
|
||||||
|
fireDir = {x = 0, y = -1, z = 0},
|
||||||
|
projectile = {id = ProjectileId.DEPTH_CHARGE, parent = 'hull', pos = {x = 0, y = -2, z = 0}, rot = {w = .707, x = .707, y = 0, z = 0}},
|
||||||
|
fireFx = {
|
||||||
|
{vfx = false, duration = 50, path = PATH .. 'Sounds/Units/Submarines/fire.ogg'}
|
||||||
|
},
|
||||||
|
hitFx = {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
orderType = OrderType.ATTACK,
|
||||||
|
rateOfFire = 200,
|
||||||
|
damage = 10,
|
||||||
|
minRange = 10,
|
||||||
|
maxRange = 500,
|
||||||
|
maxFireAngle = .01,
|
||||||
nodes = {
|
nodes = {
|
||||||
{name = 'FrontTurret', rotationSpeed = .05, angleConstraints = {min = -2.53, max = 2.53}, vertical = false},
|
{name = 'FrontTurret', rotationSpeed = .05, angleConstraints = {min = -2.53, max = 2.53}, vertical = false},
|
||||||
{name = 'FrontTurretBarrel', rotationSpeed = .05, angleConstraints = {min = -.174, max = .174}, vertical = true}
|
{name = 'FrontTurretBarrel', rotationSpeed = .05, angleConstraints = {min = -.174, max = .174}, vertical = true}
|
||||||
@@ -1634,7 +1651,9 @@ units = {
|
|||||||
orderType = OrderType.ATTACK,
|
orderType = OrderType.ATTACK,
|
||||||
rateOfFire = 200,
|
rateOfFire = 200,
|
||||||
damage = 10,
|
damage = 10,
|
||||||
maxRange = 100,
|
minRange = 10,
|
||||||
|
maxRange = 500,
|
||||||
|
maxFireAngle = .01,
|
||||||
nodes = {
|
nodes = {
|
||||||
{name = 'RearTurret', rotationSpeed = .05, angleConstraints = {min = -2.53, max = 2.53}, vertical = false},
|
{name = 'RearTurret', rotationSpeed = .05, angleConstraints = {min = -2.53, max = 2.53}, vertical = false},
|
||||||
{name = 'RearTurretBarrel', rotationSpeed = .05, angleConstraints = {min = -.174, max = .174}, vertical = true}
|
{name = 'RearTurretBarrel', rotationSpeed = .05, angleConstraints = {min = -.174, max = .174}, vertical = true}
|
||||||
@@ -1663,14 +1682,14 @@ units = {
|
|||||||
cost = 500,
|
cost = 500,
|
||||||
size = {x = 6.93, y = 17.7, z = 76.1},
|
size = {x = 6.93, y = 17.7, z = 76.1},
|
||||||
hitboxOffset = {x = 0, y = 4.77, z = 0},
|
hitboxOffset = {x = 0, y = 4.77, z = 0},
|
||||||
lineOfSight = 5,
|
lineOfSight = 100,
|
||||||
colorNodes = {'FrontTurret', 'RearTurret'},
|
colorNodes = {'FrontTurret', 'RearTurret'},
|
||||||
name = 'Anti sub cruiser',
|
name = 'Anti sub cruiser',
|
||||||
basePath = PATH .. vehiclePrefix .. 'Cruisers/',
|
basePath = PATH .. vehiclePrefix .. 'Cruisers/',
|
||||||
meshPath = 'acsAntiSubCruiser.xml',
|
meshPath = 'acsAntiSubCruiser.xml',
|
||||||
albedoPath = 'cruiser.jpg',
|
albedoPath = 'cruiser.jpg',
|
||||||
selectionSfx = PATH .. 'Sounds/Units/Cruisers/selection.ogg',
|
selectionSfx = PATH .. 'Sounds/Units/Cruisers/selection.ogg',
|
||||||
speed = .1,
|
speed = .3,
|
||||||
destinationOffset = .1,
|
destinationOffset = .1,
|
||||||
anglePrecision = .1,
|
anglePrecision = .1,
|
||||||
maxTurnAngle = .1,
|
maxTurnAngle = .1,
|
||||||
@@ -1679,6 +1698,20 @@ units = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
weapons = {
|
weapons = {
|
||||||
|
{
|
||||||
|
orderType = OrderType.ATTACK,
|
||||||
|
rateOfFire = 2000,
|
||||||
|
damage = 10,
|
||||||
|
maxRange = 100,
|
||||||
|
targetUnits = {UnitType.UNDERWATER},
|
||||||
|
targetProjectiles = {},
|
||||||
|
fireDir = {x = 0, y = -1, z = 0},
|
||||||
|
projectile = {id = ProjectileId.DEPTH_CHARGE, parent = 'Cruiser', pos = {x = 0, y = -2, z = 0}, rot = {w = .707, x = .707, y = 0, z = 0}},
|
||||||
|
fireFx = {
|
||||||
|
{vfx = false, duration = 50, path = PATH .. 'Sounds/Units/Submarines/fire.ogg'}
|
||||||
|
},
|
||||||
|
hitFx = {}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
orderType = OrderType.ATTACK,
|
orderType = OrderType.ATTACK,
|
||||||
rateOfFire = 200,
|
rateOfFire = 200,
|
||||||
@@ -1779,7 +1812,7 @@ units = {
|
|||||||
cost = 500,
|
cost = 500,
|
||||||
size = {x = 9.09, y = 13.6, z = 66.6},
|
size = {x = 9.09, y = 13.6, z = 66.6},
|
||||||
hitboxOffset = {x = 0, y = .88, z = 0},
|
hitboxOffset = {x = 0, y = .88, z = 0},
|
||||||
lineOfSight = 5,
|
lineOfSight = 100,
|
||||||
colorNodes = {'sides'},
|
colorNodes = {'sides'},
|
||||||
name = 'Anti sub cruiser',
|
name = 'Anti sub cruiser',
|
||||||
basePath = PATH .. vehiclePrefix .. 'Cruisers/',
|
basePath = PATH .. vehiclePrefix .. 'Cruisers/',
|
||||||
@@ -1795,6 +1828,20 @@ units = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
weapons = {
|
weapons = {
|
||||||
|
{
|
||||||
|
orderType = OrderType.ATTACK,
|
||||||
|
rateOfFire = 2000,
|
||||||
|
damage = 10,
|
||||||
|
maxRange = 100,
|
||||||
|
targetUnits = {UnitType.UNDERWATER},
|
||||||
|
targetProjectiles = {},
|
||||||
|
fireDir = {x = 0, y = -1, z = 0},
|
||||||
|
projectile = {id = ProjectileId.DEPTH_CHARGE, parent = 'Gunship', pos = {x = 0, y = -2, z = 0}, rot = {w = .707, x = .707, y = 0, z = 0}},
|
||||||
|
fireFx = {
|
||||||
|
{vfx = false, duration = 50, path = PATH .. 'Sounds/Units/Submarines/fire.ogg'}
|
||||||
|
},
|
||||||
|
hitFx = {}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
orderType = OrderType.ATTACK,
|
orderType = OrderType.ATTACK,
|
||||||
rateOfFire = 200,
|
rateOfFire = 200,
|
||||||
@@ -1925,14 +1972,14 @@ units = {
|
|||||||
cost = 500,
|
cost = 500,
|
||||||
size = {x = 6.59, y = 8.6, z = 71.8},
|
size = {x = 6.59, y = 8.6, z = 71.8},
|
||||||
hitboxOffset = {x = 0, y = 1.11, z = .84},
|
hitboxOffset = {x = 0, y = 1.11, z = .84},
|
||||||
lineOfSight = 5,
|
lineOfSight = 100,
|
||||||
colorNodes = {'Gunship.001'},
|
colorNodes = {'Gunship.001'},
|
||||||
name = 'Anti sub cruiser',
|
name = 'Anti sub cruiser',
|
||||||
basePath = PATH .. vehiclePrefix .. 'Cruisers/',
|
basePath = PATH .. vehiclePrefix .. 'Cruisers/',
|
||||||
meshPath = 'erAntiSubCruiser.xml',
|
meshPath = 'erAntiSubCruiser.xml',
|
||||||
albedoPath = 'cruiser.jpg',
|
albedoPath = 'cruiser.jpg',
|
||||||
selectionSfx = PATH .. 'Sounds/Units/Cruisers/selection.ogg',
|
selectionSfx = PATH .. 'Sounds/Units/Cruisers/selection.ogg',
|
||||||
speed = .1,
|
speed = .3,
|
||||||
destinationOffset = .1,
|
destinationOffset = .1,
|
||||||
anglePrecision = .1,
|
anglePrecision = .1,
|
||||||
maxTurnAngle = .1,
|
maxTurnAngle = .1,
|
||||||
@@ -2101,7 +2148,7 @@ units = {
|
|||||||
orderType = OrderType.ATTACK,
|
orderType = OrderType.ATTACK,
|
||||||
projectile = {id = ProjectileId.TORPEDO, pos = {x = 0, y = -.27, z = 4.6}, rot = {w = 1, x = 0, y = 0, z = 0}},
|
projectile = {id = ProjectileId.TORPEDO, pos = {x = 0, y = -.27, z = 4.6}, rot = {w = 1, x = 0, y = 0, z = 0}},
|
||||||
damage = 200,
|
damage = 200,
|
||||||
maxRange = 20,
|
maxRange = 200,
|
||||||
rateOfFire = 500,
|
rateOfFire = 500,
|
||||||
fireFx = {
|
fireFx = {
|
||||||
{
|
{
|
||||||
@@ -2120,14 +2167,14 @@ units = {
|
|||||||
cost = 500,
|
cost = 500,
|
||||||
size = {x = 9.29, y = 11.6, z = 32.9},
|
size = {x = 9.29, y = 11.6, z = 32.9},
|
||||||
hitboxOffset = {x = 0, y = 1.8, z = -1.3},
|
hitboxOffset = {x = 0, y = 1.8, z = -1.3},
|
||||||
lineOfSight = 5,
|
lineOfSight = 0,
|
||||||
name = 'Stealth submarine',
|
name = 'Stealth submarine',
|
||||||
colorNodes = {'Cube.001'},
|
colorNodes = {'Cube.001'},
|
||||||
basePath = PATH .. vehiclePrefix .. 'Submarines/',
|
basePath = PATH .. vehiclePrefix .. 'Submarines/',
|
||||||
meshPath = 'acsSubmarine.xml',
|
meshPath = 'acsSubmarine.xml',
|
||||||
albedoPath = 'submarine.jpg',
|
albedoPath = 'submarine.jpg',
|
||||||
selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg',
|
selectionSfx = PATH .. 'Sounds/Units/Submarines/selection.ogg',
|
||||||
speed = .1,
|
speed = .2,
|
||||||
destinationOffset = .1,
|
destinationOffset = .1,
|
||||||
anglePrecision = .1,
|
anglePrecision = .1,
|
||||||
maxTurnAngle = .1,
|
maxTurnAngle = .1,
|
||||||
@@ -2159,7 +2206,7 @@ units = {
|
|||||||
cost = 500,
|
cost = 500,
|
||||||
hitboxOffset = {x = 0, y = 1.83, z = -3.46},
|
hitboxOffset = {x = 0, y = 1.83, z = -3.46},
|
||||||
size = {x = 8.32, y = 12.1, z = 57.4},
|
size = {x = 8.32, y = 12.1, z = 57.4},
|
||||||
lineOfSight = 5,
|
lineOfSight = 0,
|
||||||
name = 'Stealth submarine',
|
name = 'Stealth submarine',
|
||||||
colorNodes = {'Cube.001'},
|
colorNodes = {'Cube.001'},
|
||||||
basePath = PATH .. vehiclePrefix .. 'Submarines/',
|
basePath = PATH .. vehiclePrefix .. 'Submarines/',
|
||||||
@@ -2198,7 +2245,7 @@ units = {
|
|||||||
cost = 500,
|
cost = 500,
|
||||||
hitboxOffset = {x = 0, y = 1.03, z = -1.41},
|
hitboxOffset = {x = 0, y = 1.03, z = -1.41},
|
||||||
size = {x = 5.37, y = 7.66, z = 43},
|
size = {x = 5.37, y = 7.66, z = 43},
|
||||||
lineOfSight = 5,
|
lineOfSight = 0,
|
||||||
name = 'Stealth submarine',
|
name = 'Stealth submarine',
|
||||||
colorNodes = {'Sphere.001'},
|
colorNodes = {'Sphere.001'},
|
||||||
basePath = PATH .. vehiclePrefix .. 'Submarines/',
|
basePath = PATH .. vehiclePrefix .. 'Submarines/',
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ set(CONTROLLERS gameObjectFrameController.cpp cameraController.cpp)
|
|||||||
set(CONSOLE console.cpp abstractCommand.cpp addUnitCommand.cpp addResourceCommand.cpp addTechnologyCommand.cpp toggleDebugCommand.cpp)
|
set(CONSOLE console.cpp abstractCommand.cpp addUnitCommand.cpp addResourceCommand.cpp addTechnologyCommand.cpp toggleDebugCommand.cpp)
|
||||||
set(CORE gameManager.cpp game.cpp pathfinder.cpp environment.cpp fxManager.cpp defConfigs.cpp player.cpp trader.cpp ${CONSOLE} ${CONTROLLERS})
|
set(CORE gameManager.cpp game.cpp pathfinder.cpp environment.cpp fxManager.cpp defConfigs.cpp player.cpp trader.cpp ${CONSOLE} ${CONTROLLERS})
|
||||||
|
|
||||||
set(PROJECTILES projectile.cpp missile.cpp cruiseMissile.cpp shell.cpp)
|
set(PROJECTILES projectile.cpp missile.cpp cruiseMissile.cpp shell.cpp depthCharge.cpp)
|
||||||
set(VEHICLES vehicle.cpp submarine.cpp engineer.cpp resourceRover.cpp freezer.cpp)
|
set(VEHICLES vehicle.cpp submarine.cpp engineer.cpp resourceRover.cpp freezer.cpp)
|
||||||
set(STRUCTURES structure.cpp factory.cpp pointDefense.cpp extractor.cpp researchStruct.cpp iceSheet.cpp)
|
set(STRUCTURES structure.cpp factory.cpp pointDefense.cpp extractor.cpp researchStruct.cpp iceSheet.cpp)
|
||||||
set(WEAPONS weapon.cpp)
|
set(WEAPONS weapon.cpp)
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#include "depthCharge.h"
|
||||||
|
|
||||||
|
namespace battleship{
|
||||||
|
using namespace vb01;
|
||||||
|
|
||||||
|
DepthCharge::DepthCharge(Unit *un, int id, Vector3 pos, Quaternion rot) : Projectile(un, id, pos, rot){}
|
||||||
|
|
||||||
|
void DepthCharge::update(){
|
||||||
|
Projectile::update();
|
||||||
|
|
||||||
|
if(!remove) checkUnitCollision();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef DEPTH_CHARGE_H
|
||||||
|
#define DEPTH_CHARGE_H
|
||||||
|
|
||||||
|
#include "projectile.h"
|
||||||
|
|
||||||
|
namespace battleship{
|
||||||
|
class DepthCharge : public Projectile{
|
||||||
|
public:
|
||||||
|
DepthCharge(Unit*, int, vb01::Vector3, vb01::Quaternion);
|
||||||
|
void update();
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
Vendored
+1
-1
Submodule external/vb01 updated: f4280ce56a...7ef858737c
@@ -14,6 +14,7 @@
|
|||||||
#include "cruiseMissile.h"
|
#include "cruiseMissile.h"
|
||||||
#include "iceSheet.h"
|
#include "iceSheet.h"
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
|
#include "depthCharge.h"
|
||||||
#include "defConfigs.h"
|
#include "defConfigs.h"
|
||||||
|
|
||||||
#include <solUtil.h>
|
#include <solUtil.h>
|
||||||
@@ -76,6 +77,8 @@ namespace battleship{
|
|||||||
return new CruiseMissile(unit, id, targetPos, pos, rot);
|
return new CruiseMissile(unit, id, targetPos, pos, rot);
|
||||||
case ProjectileClass::MISSILE:
|
case ProjectileClass::MISSILE:
|
||||||
return new Missile(unit, id, targetPos, pos, rot);
|
return new Missile(unit, id, targetPos, pos, rot);
|
||||||
|
case ProjectileClass::DEPTH_CHARGE:
|
||||||
|
return new DepthCharge(unit, id, pos, rot);
|
||||||
default:
|
default:
|
||||||
return new Projectile(unit, id, pos, rot);
|
return new Projectile(unit, id, pos, rot);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -722,7 +722,7 @@ namespace battleship{
|
|||||||
int numHorCells = int(mapSize.x / CELL_SIZE.x), horId = -1;
|
int numHorCells = int(mapSize.x / CELL_SIZE.x), horId = -1;
|
||||||
|
|
||||||
for(int i = 0; i < numHorCells; i++)
|
for(int i = 0; i < numHorCells; i++)
|
||||||
if(fabs(cells[i].pos.x - pos.x) < .5 * CELL_SIZE.x){
|
if(fabs(cells[i].pos.x - pos.x) <= .5 * CELL_SIZE.x){
|
||||||
horId = i;
|
horId = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -730,7 +730,7 @@ namespace battleship{
|
|||||||
int numVertCells = int(mapSize.z / CELL_SIZE.z), vertId = -1;
|
int numVertCells = int(mapSize.z / CELL_SIZE.z), vertId = -1;
|
||||||
|
|
||||||
for(int i = 0; i < numVertCells; i++)
|
for(int i = 0; i < numVertCells; i++)
|
||||||
if(fabs(cells[i * numHorCells].pos.z - pos.z) < .5 * CELL_SIZE.z){
|
if(fabs(cells[i * numHorCells].pos.z - pos.z) <= .5 * CELL_SIZE.z){
|
||||||
vertId = i;
|
vertId = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ namespace vb01{
|
|||||||
namespace battleship {
|
namespace battleship {
|
||||||
class Unit;
|
class Unit;
|
||||||
|
|
||||||
enum class ProjectileClass{SHELL, CRUISE_MISSILE, MISSILE, TORPEDO};
|
enum class ProjectileClass{SHELL, CRUISE_MISSILE, MISSILE, TORPEDO, DEPTH_CHARGE};
|
||||||
|
|
||||||
class Projectile : public GameObject{
|
class Projectile : public GameObject{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -366,15 +366,39 @@ namespace battleship{
|
|||||||
targets.insert(targets.end(), targs.begin(), targs.end());
|
targets.insert(targets.end(), targs.begin(), targs.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<Weapon*> attackWeapons = getWeaponsByOrder(Order::TYPE::ATTACK);
|
||||||
|
|
||||||
for(Order::Target &target : orders[0].targets)
|
for(Order::Target &target : orders[0].targets)
|
||||||
if(target.unit){
|
if(target.unit){
|
||||||
if(find(targets.begin(), targets.end(), target.unit) != targets.end())
|
if(find(targets.begin(), targets.end(), target.unit) != targets.end()){
|
||||||
break;
|
bool canAttack = false;
|
||||||
|
|
||||||
removeOrder(0);
|
for(Weapon *aw : attackWeapons){
|
||||||
|
int tc;
|
||||||
|
|
||||||
|
switch(target.unit->getType()){
|
||||||
|
case GameObject::Type::UNIT:
|
||||||
|
tc = (int)((Unit*)target.unit)->getType();
|
||||||
|
break;
|
||||||
|
case GameObject::Type::PROJECTILE:
|
||||||
|
tc = (int)((Projectile*)target.unit)->getProjectileClass();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(aw->canAttackTarget((int)target.unit->getType(), tc)) canAttack = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!canAttack){
|
||||||
|
removeOrder(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
removeOrder(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Weapon*> attackWeapons = getWeaponsByOrder(Order::TYPE::ATTACK);
|
|
||||||
Vector3 targPos = (order.targets[0].unit ? order.targets[0].unit->getPos() : order.targets[0].pos);
|
Vector3 targPos = (order.targets[0].unit ? order.targets[0].unit->getPos() : order.targets[0].pos);
|
||||||
|
|
||||||
for(Weapon *weapon : attackWeapons)
|
for(Weapon *weapon : attackWeapons)
|
||||||
|
|||||||
+41
-1
@@ -34,6 +34,16 @@ namespace battleship{
|
|||||||
if(typeOpt != sol::nullopt)
|
if(typeOpt != sol::nullopt)
|
||||||
type = (Type)unitTable["weapons"][wid + 1]["type"];
|
type = (Type)unitTable["weapons"][wid + 1]["type"];
|
||||||
|
|
||||||
|
sol::optional<sol::table> fireDirOpt = weaponTable["fireDir"];
|
||||||
|
|
||||||
|
if(fireDirOpt != sol::nullopt){
|
||||||
|
sol::table fireDirTbl = weaponTable["fireDir"];
|
||||||
|
fireDir = Vector3((float)fireDirTbl["x"], (float)fireDirTbl["y"], (float)fireDirTbl["z"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
initTargetData(targetUnits, weaponTable, "targetUnits", vector<int>{(int)UnitType::UNDERWATER, (int)UnitType::SEA_LEVEL, (int)UnitType::HOVER, (int)UnitType::LAND});
|
||||||
|
initTargetData(targetProjectiles, weaponTable, "targetProjeciles", vector<int>{(int)ProjectileClass::SHELL, (int)ProjectileClass::CRUISE_MISSILE, (int)ProjectileClass::MISSILE, (int)ProjectileClass::TORPEDO, (int)ProjectileClass::DEPTH_CHARGE});
|
||||||
|
|
||||||
initProjectileData(weaponTable);
|
initProjectileData(weaponTable);
|
||||||
initNodes(weaponTable);
|
initNodes(weaponTable);
|
||||||
|
|
||||||
@@ -47,6 +57,19 @@ namespace battleship{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Weapon::initTargetData(vector<int> &targetVec, sol::table weaponTable, string tblKey, vector<int> allValues){
|
||||||
|
sol::optional<sol::table> unitTblOpt = weaponTable[tblKey];
|
||||||
|
|
||||||
|
if(unitTblOpt != sol::nullopt){
|
||||||
|
sol::table tbl = weaponTable[tblKey];
|
||||||
|
int tblSize = tbl.size();
|
||||||
|
|
||||||
|
for(int i = 0; i < tblSize; i++)
|
||||||
|
targetVec.push_back((int)tbl[i + 1]);
|
||||||
|
}
|
||||||
|
else targetVec = allValues;
|
||||||
|
}
|
||||||
|
|
||||||
void Weapon::initNodes(sol::table weaponTable){
|
void Weapon::initNodes(sol::table weaponTable){
|
||||||
sol::optional<sol::table> nodesTblOpt = weaponTable["nodes"];
|
sol::optional<sol::table> nodesTblOpt = weaponTable["nodes"];
|
||||||
|
|
||||||
@@ -142,7 +165,13 @@ namespace battleship{
|
|||||||
Vector3 refPos = (isWeaponPos ? components[0].node->localToGlobalPosition(Vector3::VEC_ZERO) : unit->getPos());
|
Vector3 refPos = (isWeaponPos ? components[0].node->localToGlobalPosition(Vector3::VEC_ZERO) : unit->getPos());
|
||||||
|
|
||||||
if(ordTp == (int)orderType){
|
if(ordTp == (int)orderType){
|
||||||
Vector3 dirVec = (isWeaponPos ? components[components.size() - 1].node->getGlobalAxis(2) : unit->getDirVec());
|
Vector3 dirVec;
|
||||||
|
|
||||||
|
if(!isWeaponPos)
|
||||||
|
dirVec = (fireDir.x * unit->getLeftVec() + fireDir.y * unit->getUpVec() + fireDir.z * unit->getDirVec()).norm();
|
||||||
|
else
|
||||||
|
dirVec = components[components.size() - 1].node->getGlobalAxis(2);
|
||||||
|
|
||||||
bool aimedAtTarget = false;
|
bool aimedAtTarget = false;
|
||||||
|
|
||||||
if(targDestruct && targDestruct->getHitbox()){
|
if(targDestruct && targDestruct->getHitbox()){
|
||||||
@@ -324,4 +353,15 @@ namespace battleship{
|
|||||||
component.node->setOrientation(rot);
|
component.node->setOrientation(rot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Weapon::canAttackTarget(int objType, int typeOrClass){
|
||||||
|
switch((GameObject::Type)objType){
|
||||||
|
case GameObject::Type::UNIT:
|
||||||
|
return (find(targetUnits.begin(), targetUnits.end(), typeOrClass) != targetUnits.end());
|
||||||
|
case GameObject::Type::PROJECTILE:
|
||||||
|
return (find(targetProjectiles.begin(), targetProjectiles.end(), typeOrClass) != targetProjectiles.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ namespace battleship{
|
|||||||
virtual void update();
|
virtual void update();
|
||||||
virtual void fire(Order);
|
virtual void fire(Order);
|
||||||
void trackTarget(vb01::Vector3);
|
void trackTarget(vb01::Vector3);
|
||||||
|
bool canAttackTarget(int, int);
|
||||||
inline int getProjectileId(){return projId;}
|
inline int getProjectileId(){return projId;}
|
||||||
inline int getRateOfFire(){return rateOfFire;}
|
inline int getRateOfFire(){return rateOfFire;}
|
||||||
inline int getDamage(){return damage;}
|
inline int getDamage(){return damage;}
|
||||||
@@ -52,15 +53,17 @@ namespace battleship{
|
|||||||
Unit *unit = nullptr;
|
Unit *unit = nullptr;
|
||||||
Order::TYPE orderType;
|
Order::TYPE orderType;
|
||||||
int id, projId = -1, damage = 0;
|
int id, projId = -1, damage = 0;
|
||||||
|
std::vector<int> targetUnits, targetProjectiles;
|
||||||
float minRange = 0, maxRange, maxFireAngle;
|
float minRange = 0, maxRange, maxFireAngle;
|
||||||
vb01::s64 lastFireTime = 0;
|
vb01::s64 lastFireTime = 0;
|
||||||
FxManager::Fx *fireFx = nullptr;
|
FxManager::Fx *fireFx = nullptr;
|
||||||
vb01::Quaternion projRot;
|
vb01::Quaternion projRot;
|
||||||
vb01::Vector3 projPos, initUnitSpaceDir;
|
vb01::Vector3 projPos, initUnitSpaceDir, fireDir = vb01::Vector3::VEC_K;
|
||||||
vb01::Node *projPar = nullptr;
|
vb01::Node *projPar = nullptr;
|
||||||
static std::string LASER_FLAG;
|
static std::string LASER_FLAG;
|
||||||
Type type = Type::DAMAGE;
|
Type type = Type::DAMAGE;
|
||||||
|
|
||||||
|
void initTargetData(std::vector<int>&, sol::table, std::string, std::vector<int>);
|
||||||
void initProjectileData(sol::table);
|
void initProjectileData(sol::table);
|
||||||
void initNodes(sol::table);
|
void initNodes(sol::table);
|
||||||
void useFx(FxManager::Fx*, vb01::Vector3, bool);
|
void useFx(FxManager::Fx*, vb01::Vector3, bool);
|
||||||
|
|||||||
Reference in New Issue
Block a user