Add 'silent' armor group
parent
e7befeecdc
commit
528f7f0be9
|
@ -103,7 +103,7 @@ core.register_entity(":__builtin:item", {
|
|||
else
|
||||
self.itemstring = staticdata
|
||||
end
|
||||
self.object:set_armor_groups({immortal = 1})
|
||||
self.object:set_armor_groups({immortal = 1, silent = 1})
|
||||
self.object:set_velocity({x = 0, y = 2, z = 0})
|
||||
self.object:set_acceleration({x = 0, y = -gravity, z = 0})
|
||||
self:set_item()
|
||||
|
|
|
@ -43,6 +43,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "camera.h" // CameraModes
|
||||
#include "wieldmesh.h"
|
||||
#include "log.h"
|
||||
#include "itemgroup.h"
|
||||
#include <algorithm>
|
||||
|
||||
class Settings;
|
||||
|
@ -1790,6 +1791,12 @@ bool GenericCAO::directReportPunch(v3f dir, const ItemStack *punchitem,
|
|||
punchitem,
|
||||
time_from_last_punch);
|
||||
|
||||
if (!itemgroup_get(m_armor_groups, "silent")) {
|
||||
SimpleSoundSpec spec;
|
||||
spec.name = "player_punch";
|
||||
spec.gain = 1.0f;
|
||||
m_client->sound()->playSoundAt(spec, false, getPosition());
|
||||
}
|
||||
if(result.did_punch && result.damage != 0)
|
||||
{
|
||||
if(result.damage < m_hp)
|
||||
|
|
|
@ -545,12 +545,6 @@ public:
|
|||
sm->m_sound->playSound(sm->m_ndef->get(nde->n).sound_dug, false);
|
||||
}
|
||||
|
||||
static void objectPunch(MtEvent *e, void *data)
|
||||
{
|
||||
SoundMaker *sm = (SoundMaker *)data;
|
||||
sm->m_sound->playSound(SimpleSoundSpec("player_punch", 1.0), false);
|
||||
}
|
||||
|
||||
static void playerDamage(MtEvent *e, void *data)
|
||||
{
|
||||
SoundMaker *sm = (SoundMaker *)data;
|
||||
|
@ -571,7 +565,6 @@ public:
|
|||
mgr->reg("CameraPunchLeft", SoundMaker::cameraPunchLeft, this);
|
||||
mgr->reg("CameraPunchRight", SoundMaker::cameraPunchRight, this);
|
||||
mgr->reg("NodeDug", SoundMaker::nodeDug, this);
|
||||
mgr->reg("ObjectPunch", SoundMaker::objectPunch, this);
|
||||
mgr->reg("PlayerDamage", SoundMaker::playerDamage, this);
|
||||
mgr->reg("PlayerFallingDamage", SoundMaker::playerFallingDamage, this);
|
||||
}
|
||||
|
@ -3978,7 +3971,6 @@ void Game::handlePointingAtObject(const PointedThing &pointed, const ItemStack &
|
|||
}
|
||||
|
||||
if (do_punch_damage) {
|
||||
client->event()->put(new SimpleTriggerEvent("ObjectPunch"));
|
||||
// Report direct punch
|
||||
v3f objpos = runData.selected_object->getPosition();
|
||||
v3f dir = (objpos - player_position).normalize();
|
||||
|
|
Loading…
Reference in New Issue