rotatable freezer turret

removed CryoGun class
This commit is contained in:
devZoGok
2026-01-28 19:46:01 +02:00
parent 5e93806088
commit a608273b57
8 changed files with 5357 additions and 5280 deletions
File diff suppressed because it is too large Load Diff
@@ -71,7 +71,7 @@ UnitId = {
ER_REFINERY = 54,
ICE_SHEET = 55
}
WeaponClass = {FREEZE = 1}
WeaponClass = {DAMAGE = 0, FREEZE = 1}
UnitClass = {
WAR_MECH = 0,
TANK = 1,
@@ -2287,8 +2287,12 @@ units = {
type = WeaponClass.FREEZE,
orderType = OrderType.ATTACK,
rateOfFire = 100,
maxRange = 10,
maxRange = 30,
damage = 0,
nodes = {
{name = 'turret', rotationSpeed = .05, vertical = false},
{name = 'barrel', rotationSpeed = .05, angleConstraints = {min = -.523, max = .523}, vertical = true},
},
fireFx = {
{
vfx = false,
+1 -1
View File
@@ -35,7 +35,7 @@ set(CORE gameManager.cpp game.cpp pathfinder.cpp environment.cpp fxManager.cpp d
set(PROJECTILES projectile.cpp missile.cpp cruiseMissile.cpp shell.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(WEAPONS weapon.cpp cryoGun.cpp)
set(WEAPONS weapon.cpp)
set(UNITS unit.cpp ${WEAPONS} ${STRUCTURES} ${VEHICLES})
set(CONTENT map.cpp gameObject.cpp destructable.cpp gameObjectFrame.h gameObjectFactory.cpp resourceDeposit.cpp ${UNITS} ${PROJECTILES})
-20
View File
@@ -1,20 +0,0 @@
#include "cryoGun.h"
#include "destructable.h"
#include "unit.h"
namespace battleship{
using namespace std;
using namespace vb01;
using namespace gameBase;
CryoGun::CryoGun(Unit *u, sol::table unitTable, int wid) : Weapon(u, unitTable, wid){}
void CryoGun::updateTarget(GameObject *target){
if(canFreeze()){
Destructable *destructTarg = target->getDestructable();
destructTarg->setFreezeStatus(destructTarg->getFreezeStatus() + 1);
lastFreezeTime = getTime();
}
}
}
-25
View File
@@ -1,25 +0,0 @@
#ifndef CRYOGUN_H
#define CRYOGUN_H
#include "weapon.h"
#include <util.h>
#include <solUtil.h>
namespace battleship{
class Unit;
class CryoGun : public Weapon{
public:
CryoGun(Unit*, sol::table, int);
private:
vb01::s64 lastFreezeTime = 0;
void updateTarget(GameObject*);
inline bool canFreeze(){return vb01::getTime() - lastFreezeTime > rateOfFire;}
};
}
#endif
+1 -9
View File
@@ -13,7 +13,6 @@
#include <ext.hpp>
#include "unit.h"
#include "cryoGun.h"
#include "weapon.h"
#include "util.h"
#include "game.h"
@@ -142,14 +141,7 @@ namespace battleship{
if(wtOpt != sol::nullopt) wt = unitTable[tblName][i + 1]["type"];
switch((Weapon::Type)wt){
case Weapon::Type::FREEZER:
weapons.push_back(new CryoGun(this, unitTable, i));
break;
default:
weapons.push_back(new Weapon(this, unitTable, i));
break;
}
weapons.push_back(new Weapon(this, unitTable, i));
}
}
}
+16 -3
View File
@@ -28,6 +28,11 @@ namespace battleship{
maxFireAngle = weaponTable["maxFireAngle"].get_or(.1);
orderType = (Order::TYPE)weaponTable["orderType"];
sol::optional<float> typeOpt = unitTable["weapons"][wid + 1]["type"];
if(typeOpt != sol::nullopt)
type = (Type)unitTable["weapons"][wid + 1]["type"];
initProjectileData(weaponTable);
initNodes(weaponTable);
@@ -155,8 +160,7 @@ namespace battleship{
aimedAtTarget = withinRange && withinAngle;
}
if((Order::TYPE)ordTp == Order::TYPE::ATTACK && aimedAtTarget)
fire(unit->getOrder(0));
if(aimedAtTarget) fire(unit->getOrder(0));
}
else{
Vector3 dir = (
@@ -204,7 +208,16 @@ namespace battleship{
}
void Weapon::updateTarget(GameObject *target){
target->getDestructable()->takeDamage(damage);
Destructable *destr = target->getDestructable();
switch(type){
case Type::FREEZER:
destr->setFreezeStatus(destr->getFreezeStatus() + 1);
break;
default:
destr->takeDamage(damage);
break;
}
if(target->getType() == GameObject::Type::UNIT)
unit->getPlayer()->updateGameStats((Unit*)target);
+2 -1
View File
@@ -19,7 +19,7 @@ namespace battleship{
class Weapon{
public:
enum class Type{FREEZER = 1};
enum class Type{DAMAGE = 0, FREEZER = 1};
struct Component{
vb01::Node *node = nullptr;
@@ -58,6 +58,7 @@ namespace battleship{
vb01::Vector3 projPos, initUnitSpaceDir;
vb01::Node *projPar = nullptr;
static std::string LASER_FLAG;
Type type = Type::DAMAGE;
void initProjectileData(sol::table);
void initNodes(sol::table);