mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
vehicles can't obstruct their own frames
This commit is contained in:
+6
-1
@@ -10,7 +10,10 @@ namespace battleship{
|
|||||||
struct GameObjectFrame : public GameObject{
|
struct GameObjectFrame : public GameObject{
|
||||||
enum Status{PLACEABLE, NOT_PLACEABLE, PLACED};
|
enum Status{PLACEABLE, NOT_PLACEABLE, PLACED};
|
||||||
|
|
||||||
GameObjectFrame(int i, GameObject::Type t, vb01::Vector3 pos = vb01::Vector3::VEC_ZERO, vb01::Quaternion rot = vb01::Quaternion::QUAT_W) : GameObject(t, i, nullptr, pos, rot) {
|
GameObjectFrame(int i, GameObject::Type t, Unit *ou = nullptr, vb01::Vector3 pos = vb01::Vector3::VEC_ZERO, vb01::Quaternion rot = vb01::Quaternion::QUAT_W) :
|
||||||
|
originalUnit(ou),
|
||||||
|
GameObject(t, i, nullptr, pos, rot)
|
||||||
|
{
|
||||||
initModel(false);
|
initModel(false);
|
||||||
initProperties();
|
initProperties();
|
||||||
placeAt(pos);
|
placeAt(pos);
|
||||||
@@ -18,8 +21,10 @@ namespace battleship{
|
|||||||
}
|
}
|
||||||
~GameObjectFrame(){}
|
~GameObjectFrame(){}
|
||||||
void destroy(){destroyModel();}
|
void destroy(){destroyModel();}
|
||||||
|
inline Unit* getOriginalUnit(){return originalUnit;}
|
||||||
|
|
||||||
Status status;
|
Status status;
|
||||||
|
Unit *originalUnit = nullptr;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace battleship{
|
|||||||
buildDir = gameObjectFrames[1].getModel()->getPosition() - gameObjectFrames[0].getModel()->getPosition();
|
buildDir = gameObjectFrames[1].getModel()->getPosition() - gameObjectFrames[0].getModel()->getPosition();
|
||||||
|
|
||||||
Vector3 pos = paintSelectRowStart + buildDir.norm() * hypothenuse * gameObjectFrames.size();
|
Vector3 pos = paintSelectRowStart + buildDir.norm() * hypothenuse * gameObjectFrames.size();
|
||||||
addGameObjectFrame(GameObjectFrame(structureId, GameObject::Type::UNIT, pos));
|
addGameObjectFrame(GameObjectFrame(structureId, GameObject::Type::UNIT, nullptr, pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +104,8 @@ namespace battleship{
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(Unit *unit : units){
|
for(Unit *unit : units){
|
||||||
|
if(unit == s.getOriginalUnit()) continue;
|
||||||
|
|
||||||
Vector3 gm1Pos = s.getPos();
|
Vector3 gm1Pos = s.getPos();
|
||||||
Vector3 gm1Dir = s.getDirVec();
|
Vector3 gm1Dir = s.getDirVec();
|
||||||
gm1Dir = Vector3(gm1Dir.x, 0, gm1Dir.z).norm();
|
gm1Dir = Vector3(gm1Dir.x, 0, gm1Dir.z).norm();
|
||||||
|
|||||||
Reference in New Issue
Block a user