{
pos_translator.translate(dtime);
updateNodePos();
+
+ if(m_damage_visual_timer > 0){
+ m_damage_visual_timer -= dtime;
+ if(m_damage_visual_timer <= 0){
+ updateTextures("");
+ }
+ }
}
void processMessage(const std::string &data)
updateNodePos();
}
+ else if(cmd == 1) // punched
+ {
+ // damage
+ s16 damage = readS16(is);
+
+ if(m_is_local_player)
+ m_env->damageLocalPlayer(damage, false);
+
+ m_damage_visual_timer = 0.5;
+ updateTextures("^[brighten");
+ }
}
void updateTextures(const std::string &mod)
}
}
}
-
- bool directReportPunch(const std::string &toolname, v3f dir)
- {
- updateTextures("^[brighten");
- return false;
- }
};
// Prototype
HittingProperties hitprop = getHittingProperties(&mp, &tp,
time_from_last_punch);
- infostream<<"1. getHP()="<<getHP()<<std::endl;
setHP(getHP() - hitprop.hp);
- infostream<<"2. getHP()="<<getHP()<<std::endl;
puncher->damageWieldedItem(hitprop.wear);
+
+ {
+ std::ostringstream os(std::ios::binary);
+ // command (1 = punched)
+ writeU8(os, 1);
+ // damage
+ writeS16(os, hitprop.hp);
+ // create message and add to list
+ ActiveObjectMessage aom(getId(), false, os.str());
+ m_messages_out.push_back(aom);
+ }
}
void ServerRemotePlayer::rightClick(ServerActiveObject *clicker)