summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRorkh <78957156+Rorkh@users.noreply.github.com>2021-07-28 22:51:59 +0200
committerGitHub <noreply@github.com>2021-07-28 22:51:59 +0200
commit4221e08f3a76dbb1ca2321f58a893b5662d772f4 (patch)
treee107fef78a5960f589ab120f8ea5f63da7ae5617
parentUpdate to mybed 3.0.0 (#5275) (diff)
downloadcuberite-4221e08f3a76dbb1ca2321f58a893b5662d772f4.tar
cuberite-4221e08f3a76dbb1ca2321f58a893b5662d772f4.tar.gz
cuberite-4221e08f3a76dbb1ca2321f58a893b5662d772f4.tar.bz2
cuberite-4221e08f3a76dbb1ca2321f58a893b5662d772f4.tar.lz
cuberite-4221e08f3a76dbb1ca2321f58a893b5662d772f4.tar.xz
cuberite-4221e08f3a76dbb1ca2321f58a893b5662d772f4.tar.zst
cuberite-4221e08f3a76dbb1ca2321f58a893b5662d772f4.zip
-rw-r--r--CONTRIBUTORS1
-rw-r--r--src/Entities/Entity.cpp12
-rw-r--r--src/Entities/Painting.cpp9
-rw-r--r--src/Entities/Painting.h6
4 files changed, 23 insertions, 5 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index e6a1fa7ec..a5a6c71c8 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -61,6 +61,7 @@ p-mcgowan
pokechu22
ProjectBM
pwnOrbitals
+Rorkh
rs2k
SamJBarney
Schwertspize
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index aada520f7..e9605fe5a 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -390,6 +390,18 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
return false;
}
+ if (IsPainting())
+ {
+ KilledBy(a_TDI);
+
+ if (a_TDI.Attacker != nullptr)
+ {
+ a_TDI.Attacker->Killed(this);
+ }
+
+ return true;
+ }
+
if ((a_TDI.Attacker != nullptr) && (a_TDI.Attacker->IsPlayer()))
{
cPlayer * Player = static_cast<cPlayer *>(a_TDI.Attacker);
diff --git a/src/Entities/Painting.cpp b/src/Entities/Painting.cpp
index 0f2139cd1..1f9662019 100644
--- a/src/Entities/Painting.cpp
+++ b/src/Entities/Painting.cpp
@@ -24,6 +24,8 @@ void cPainting::SpawnOn(cClientHandle & a_Client)
{
Super::SpawnOn(a_Client);
a_Client.SendPaintingSpawn(*this);
+
+ m_World->BroadcastSoundEffect("entity.painting.place", GetPosition(), 1, 1);
}
@@ -41,3 +43,10 @@ void cPainting::GetDrops(cItems & a_Items, cEntity * a_Killer)
+
+void cPainting::KilledBy(TakeDamageInfo & a_TDI)
+{
+ Super::KilledBy(a_TDI);
+ m_World->BroadcastSoundEffect("entity.painting.break", GetPosition(), 1, 1);
+ Destroy();
+}
diff --git a/src/Entities/Painting.h b/src/Entities/Painting.h
index 844fd72f5..f6ca5f000 100644
--- a/src/Entities/Painting.h
+++ b/src/Entities/Painting.h
@@ -28,11 +28,7 @@ private:
virtual void SpawnOn(cClientHandle & a_Client) override;
virtual void GetDrops(cItems & a_Items, cEntity * a_Killer) override;
- virtual void KilledBy(TakeDamageInfo & a_TDI) override
- {
- Super::KilledBy(a_TDI);
- Destroy();
- }
+ virtual void KilledBy(TakeDamageInfo & a_TDI) override;
AString m_Name;