Fixed in client for shoot event. Weapon system now damages health on any target not only players.

This commit is contained in:
Jocke
2016-01-24 11:36:01 +01:00
parent a28748b35d
commit 97d70f8e32
4 changed files with 6 additions and 6 deletions
+2 -1
View File
@@ -21,4 +21,5 @@ F1=ToggleEditor
X=EditorToggleTransformSpace
C=ConnectToServer
N=SwitchToServer
M=SwitchToClient
M=SwitchToClient
P=SwitchToPlayer
+2 -2
View File
@@ -310,9 +310,9 @@ bool Client::OnInputCommand(const Events::InputCommand & e)
bool Client::OnPlayerDamage(const Events::PlayerDamage & e)
{
Packet packet(MessageType::OnInputCommand, m_SendPacketID);
Packet packet(MessageType::OnPlayerDamage, m_SendPacketID);
packet.WritePrimitive(e.DamageAmount);
packet.WritePrimitive(e.PlayerDamagedID);
packet.WritePrimitive(m_ClientIDToServerID.at(e.PlayerDamagedID));
send(packet);
return false;
}
-1
View File
@@ -12,7 +12,6 @@ HealthSystem::HealthSystem(World* m_World, EventBroker* eventBroker)
void HealthSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
{
//if entityID of health is 9 then the players ID is also 9 (player,health are connected to the same entity)
ComponentWrapper player = m_World->GetComponent(component.EntityID, "Player");
double maxHealth = (double)component["MaxHealth"];
//process the DeltaHealthVector and change the entitys health accordingly
+2 -2
View File
@@ -22,8 +22,8 @@ void WeaponSystem::Update(double dt)
continue;
}
//if its a player, do PlayerDamage event
const bool hasPlayerComponent = m_World->HasComponent(pickDataFromShot.Entity, "Player");
if (hasPlayerComponent) {
const bool hasHealthComponent = m_World->HasComponent(pickDataFromShot.Entity, "Health");
if (hasHealthComponent) {
Events::PlayerDamage ePlayerDamage;
//TODO: damage based on weapontype/class?
//TODO: multiple shots at the same time? (shotgunner)