mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
placeable and rotatable vehicles in the map editor
This commit is contained in:
@@ -41,13 +41,14 @@ mappings = {
|
||||
{bind = 50, trigger = 85, action = true, bindType = 0, inOptions = false},
|
||||
{bind = 51, trigger = 79, action = true, bindType = 0, inOptions = false},
|
||||
|
||||
{bind = 0, trigger = 0, action = true, bindType = 1, inOptions = false},
|
||||
{bind = 7, trigger = 312, action = false, bindType = 2, inOptions = false},
|
||||
{bind = 8, trigger = 313, action = false, bindType = 2, inOptions = false},
|
||||
{bind = 9, trigger = 310, action = false, bindType = 2, inOptions = false},
|
||||
{bind = 10, trigger = 311, action = false, bindType = 2, inOptions = false},
|
||||
{bind = 11, trigger = 1, action = true, bindType = 1, inOptions = false},
|
||||
{bind = 11, trigger = 2, action = true, bindType = 1, inOptions = false},
|
||||
{bind = 13, trigger = 1, action = true, bindType = 1, inOptions = false},
|
||||
{bind = 33, trigger = 256, action = true, bindType = 0, inOptions = false},
|
||||
{bind = 0, trigger = 0, action = true, bindType = 1, inOptions = false},
|
||||
{bind = 34, trigger = 67, action = true, bindType = 0, inOptions = false},
|
||||
{bind = 35, trigger = 86, action = true, bindType = 0, inOptions = false},
|
||||
{bind = 36, trigger = 312, action = false, bindType = 2, inOptions = false},
|
||||
|
||||
+17
-7
@@ -658,26 +658,33 @@ namespace battleship{
|
||||
|
||||
switch((Bind)bind){
|
||||
case Bind::LOOK_AROUND:
|
||||
if(ufCtr->isPlacingOnSurface()){
|
||||
if(!ufCtr->isPlacingOnSurface())
|
||||
CameraController::getSingleton()->setLookingAround(isPressed);
|
||||
|
||||
break;
|
||||
case Bind::ROTATE_OBJ_FRAME:
|
||||
if(isPressed && ufCtr->isPlacingOnSurface())
|
||||
ufCtr->setRotating(true);
|
||||
else if(!isPressed && ufCtr->isRotating()){
|
||||
Player *player = Game::getSingleton()->getPlayer(0);
|
||||
GameObjectFrame &frame = ufCtr->getGameObjectFrame(0);
|
||||
Model *model = frame.getModel();
|
||||
Vector3 pos = model->getPosition();
|
||||
Quaternion rot = model->getOrientation();
|
||||
GameObject *obj;
|
||||
|
||||
if(frame.getType() == GameObject::Type::RESOURCE_DEPOSIT)
|
||||
player->addResourceDeposit(GameObjectFactory::createResourceDeposit(player, frame.getId(), pos, rot));
|
||||
else
|
||||
player->addUnit(GameObjectFactory::createUnit(player, frame.getId(), pos, rot));
|
||||
}
|
||||
else
|
||||
CameraController::getSingleton()->setLookingAround(isPressed);
|
||||
|
||||
break;
|
||||
case Bind::ROTATE_OBJ_FRAME:
|
||||
ufCtr->setRotating(false);
|
||||
}
|
||||
|
||||
break;
|
||||
case Bind::DESELECT_STRUCTURE:
|
||||
ufCtr->removeGameObjectFrames();
|
||||
ufCtr->setPlacingOnSurface(false);
|
||||
ufCtr->setRotating(false);
|
||||
break;
|
||||
case Bind::INCREASE_RADIUS:
|
||||
if(isPressed) mapEditor->updateCircleRadius(true);
|
||||
@@ -751,6 +758,7 @@ namespace battleship{
|
||||
|
||||
void MapEditorAppState::onAnalog(int bind, float strength){
|
||||
CameraController *camCtr = CameraController::getSingleton();
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
|
||||
switch((Bind)bind){
|
||||
case Bind::LOOK_UP:
|
||||
@@ -766,6 +774,8 @@ namespace battleship{
|
||||
case Bind::LOOK_RIGHT:
|
||||
if(camCtr->isLookingAround())
|
||||
camCtr->orientCamera(Vector3(0, 1, 0), strength);
|
||||
else if(ufCtr->isRotating())
|
||||
ufCtr->rotateGameObjectFrames(100 * strength);
|
||||
|
||||
break;
|
||||
case Bind::PUSH_VERTS_UP:
|
||||
|
||||
Reference in New Issue
Block a user