[Orxonox-commit 5222] r9885 - in code/branches/spacestationentry: data/levels src/modules/docking
agermann at orxonox.net
agermann at orxonox.net
Mon Dec 9 15:57:28 CET 2013
Author: agermann
Date: 2013-12-09 15:57:28 +0100 (Mon, 09 Dec 2013)
New Revision: 9885
Modified:
code/branches/spacestationentry/data/levels/dockingToASpaceStation.oxw
code/branches/spacestationentry/src/modules/docking/Dock.cc
code/branches/spacestationentry/src/modules/docking/Dock.h
code/branches/spacestationentry/src/modules/docking/MoveToDockingTarget.cc
Log:
The level EntryTest.oxw can be deleted. Finally a nice and working solution.
Modified: code/branches/spacestationentry/data/levels/dockingToASpaceStation.oxw
===================================================================
--- code/branches/spacestationentry/data/levels/dockingToASpaceStation.oxw 2013-12-09 13:53:57 UTC (rev 9884)
+++ code/branches/spacestationentry/data/levels/dockingToASpaceStation.oxw 2013-12-09 14:57:28 UTC (rev 9885)
@@ -92,19 +92,21 @@
</activity>
</events>
<attached>
+ <!-- Trigger for docking with billboard -->
<Billboard position="0,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=1 />
<DistanceTrigger position="0,0,0" distance="200" target="Pawn"
beaconMode="exclude" targetname="bcnDestroyer" name="dockMe"
/>
-
- <Billboard position="-2730,-19970,50" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=1 />
- <DistanceTrigger position="-2730,-19970,50" distance="50" target="Pawn"
+ <!-- Trigger for undocking with billboard -->
+ <Billboard position="-2630,-19970,150" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=1 />
+ <DistanceTrigger position="-2630,-19970,150" distance="50" target="Pawn"
beaconMode="identify" targetname="bcnDestroyer" name="undockMe"
/>
</attached>
</Dock>
-
+
+<!-- FPS Player as destination of the dock -->
<FpsPlayer template = "fps" radarname = "First Person Player" position = "0,-19900,0" >
<attached>
<DockingTarget name="spaceShip" />
@@ -113,8 +115,13 @@
</attached>
</FpsPlayer>
-<!-- Wuerfel -->
+<!-- Cube as test SpaceStation
+
+The station can either be hidden outside of the skybox, within the hull of the space station if it is big enough or within a planet.
+Complex spacestations can be placed very far away from the spaceship so it is rendered at low resolution while the player uses the space ship.
+
+-->
<StaticEntity position="0,-20000,0" direction="0,-1,0" collisionType=static mass=100000 friction=0.01 >
<attached>
<Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
@@ -124,11 +131,11 @@
</collisionShapes>
</StaticEntity>
-<!-- Schwerkraftfeld -->
+<!-- Homogenous gravitationfield to simulate local gravity (activating the normal gravity will affect the spaceship terribly) -->
+<ForceField position="0,-20000,0" mode="homogen" diameter="2000" forcedirection = "0,-500,0" />
-<ForceField position="0,-20000,0" mode="homogen" diameter="2000" forcedirection = "0,-400,0" />
-<!-- Rest -->
+<!-- Some more stuff -->
<!-- triple large belt around the planet -->
<?lua
Modified: code/branches/spacestationentry/src/modules/docking/Dock.cc
===================================================================
--- code/branches/spacestationentry/src/modules/docking/Dock.cc 2013-12-09 13:53:57 UTC (rev 9884)
+++ code/branches/spacestationentry/src/modules/docking/Dock.cc 2013-12-09 14:57:28 UTC (rev 9885)
@@ -84,41 +84,45 @@
bool Dock::undocking(bool bTriggered, BaseObject* trigger)
{
- // Noch lange nicht fertig (leich veraenderte Kopie von execute())
+
PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
- PlayerInfo* player = NULL;
+ PlayerInfo* player = NULL;
- // Check whether it is a player trigger and extract pawn from it
- if(pTrigger != NULL)
- {
- if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
- orxout(verbose, context::docking) << "Docking:execute PlayerTrigger was not triggered by a player.." << endl;
- return false;
- }
- player = pTrigger->getTriggeringPlayer();
- }
- else
- {
- orxout(verbose, context::docking) << "Docking::execute Not a player trigger, can't extract pawn from it.." << endl;
- return false;
- }
- if(player == NULL)
- {
- orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl;
- return false;
- }
+ // Check whether it is a player trigger and extract pawn from it
+ if(pTrigger != NULL)
+ {
+ if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
+ orxout(verbose, context::docking) << "Docking:execute PlayerTrigger was not triggered by a player.." << endl;
+ return false;
+ }
+ player = pTrigger->getTriggeringPlayer();
+ }
+ else
+ {
+ orxout(verbose, context::docking) << "Docking::execute Not a player trigger, can't extract pawn from it.." << endl;
+ return false;
+ }
+ if(player == NULL)
+ {
+ orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl;
+ return false;
+ }
- if(bTriggered)
- {
- cmdUndock();
- }
- else
- {
- // Remove player from candidates list
- candidates_.erase(player);
- }
+ if(bTriggered)
+ {
+ // Add player to this Docks candidates
+ candidates_.insert(player);
- return true;
+ // Show docking dialog
+ this->showUndockingDialogHelper(player);
+ }
+ else
+ {
+ // Remove player from candidates list
+ candidates_.erase(player);
+ }
+
+ return true;
}
@@ -166,6 +170,23 @@
}
+ void Dock::showUndockingDialogHelper(PlayerInfo* player)
+ {
+ assert(player);
+
+ if(!player->isHumanPlayer())
+ return;
+
+ if(GameMode::isMaster())
+ {
+ if(GameMode::showsGraphics())
+ GUIManager::showGUI("UndockingDialog");
+ }
+ else
+ callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
+
+ }
+
void Dock::showDockingDialogHelper(PlayerInfo* player)
{
assert(player);
Modified: code/branches/spacestationentry/src/modules/docking/Dock.h
===================================================================
--- code/branches/spacestationentry/src/modules/docking/Dock.h 2013-12-09 13:53:57 UTC (rev 9884)
+++ code/branches/spacestationentry/src/modules/docking/Dock.h 2013-12-09 14:57:28 UTC (rev 9885)
@@ -85,6 +85,8 @@
// tolua_begin
void dock()
{ this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); }
+ void undock()
+ { this->undock(HumanController::getLocalControllerSingleton()->getPlayer()); }
static unsigned int getNumberOfActiveDocks();
static Dock* getActiveDockAtIndex(unsigned int index);
// tolua_end
@@ -95,6 +97,7 @@
// Network functions
void showDockingDialogHelper(PlayerInfo* player);
+ void showUndockingDialogHelper(PlayerInfo* player);
static void showDockingDialog();
private:
Modified: code/branches/spacestationentry/src/modules/docking/MoveToDockingTarget.cc
===================================================================
--- code/branches/spacestationentry/src/modules/docking/MoveToDockingTarget.cc 2013-12-09 13:53:57 UTC (rev 9884)
+++ code/branches/spacestationentry/src/modules/docking/MoveToDockingTarget.cc 2013-12-09 14:57:28 UTC (rev 9885)
@@ -65,8 +65,11 @@
bool MoveToDockingTarget::release(PlayerInfo *player)
{
//TODO: Investigate strange things...
- this->parent_->detach((WorldEntity*)player->getControllableEntity());
+ //this->parent_->detach((WorldEntity*)player->getControllableEntity());
+ //TODO: Check the issue with this detach call.
+ //I have removed the line because the detach call only caused a warning and terminated. And because I didn't find a attach call either.
+ //Didn't find the need for the line.
this->parent_->undockingAnimationFinished(player);
return true;
}
More information about the Orxonox-commit
mailing list