PickClass used for class-picking, SwapToClassPick to swap camera.

This commit is contained in:
William Moberg
2016-03-03 16:59:17 +01:00
parent 398bc725b6
commit 98366ec038
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -28,4 +28,4 @@ P=SwitchToPlayer
K=TakeDamage,1500
F2=PerformanceTimingResetAllTimers
F3=PerformanceTimingCreateExcelData
F4=PickClass
F4=SwapToClassPick
+2
View File
@@ -45,6 +45,7 @@ bool ButtonSystem::OnMousePress(const Events::MousePress& e)
EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity);
eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"];
eInputCmd.Value = (float)button["InputCmdButton"]["PressValue"];
m_EventBroker->Publish(eInputCmd);
} else {
Events::ButtonPressed ePressed;
ePressed.Entity = m_PickEntity;
@@ -72,6 +73,7 @@ bool ButtonSystem::OnMouseRelease(const Events::MouseRelease& e)
EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity);
eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"];
eInputCmd.Value = 0;
m_EventBroker->Publish(eInputCmd);
} else {
Events::ButtonReleased eReleased;
eReleased.EntityName = m_PickEntity.Name();
+4 -4
View File
@@ -105,7 +105,7 @@ void PlayerSpawnSystem::Update(double dt)
bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
{
if (e.Command != "PickTeam" && e.Command != "PickClass") {
if (e.Command != "PickTeam" && e.Command != "SwapToClassPick") {
return false;
}
@@ -117,7 +117,7 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
if (IsClient && !LocalPlayer.Valid()) {
// Set the camera as active, if it exists.
// Find the respawn camera or class pick camera.
std::string camName = e.Command == "PickClass" ? "PickClassCamera" : "SpectatorCamera";
std::string camName = e.Command == "SwapToClassPick" ? "PickClassCamera" : "SpectatorCamera";
EntityWrapper spectatorCam = m_World->GetFirstEntityByName(camName);
if (spectatorCam.Valid() && spectatorCam.HasComponent("Camera")) {
Events::SetCamera eSetCamera;
@@ -137,14 +137,14 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
for (; iter != m_SpawnRequests.end(); ++iter) {
if (iter->PlayerID == e.PlayerID) {
// If player wants to switch class, remove their spawn request.
if (e.Command == "PickClass") {
if (e.Command == "SwapToClassPick") {
m_SpawnRequests.erase(iter);
}
break;
}
}
if (e.Command == "PickClass") {
if (e.Command == "SwapToClassPick") {
return true;
}