Fire effect now shown for creative and spectator mode players (#3998)
* Fire effect now shown for creative and spectator mode players Fixes #3989 * Add documentation for IsFireproof
This commit is contained in:
parent
ed7adef1ca
commit
e33eb529ad
@ -8812,7 +8812,7 @@ a_Player:OpenWindow(Window);
|
||||
}
|
||||
},
|
||||
Notes = "Leash the monster to an entity.",
|
||||
},
|
||||
},
|
||||
MobTypeToString =
|
||||
{
|
||||
IsStatic = true,
|
||||
@ -10351,6 +10351,16 @@ a_Player:OpenWindow(Window);
|
||||
},
|
||||
Notes = "Returns true if the player is currently eating the item in their hand.",
|
||||
},
|
||||
IsFireproof =
|
||||
{
|
||||
Returns =
|
||||
{
|
||||
{
|
||||
Type = "boolean",
|
||||
},
|
||||
},
|
||||
Notes = "Returns true if a player is fireproof. This is when the flag has been explicitly set, or the player is in creative or spectator mode.",
|
||||
},
|
||||
IsFishing =
|
||||
{
|
||||
Returns =
|
||||
@ -15748,7 +15758,7 @@ end
|
||||
E_ITEM_LEASH =
|
||||
{
|
||||
Notes = "The itemtype for lead (E_ITEM_LEAD synonym)"
|
||||
},
|
||||
},
|
||||
E_ITEM_LEATHER =
|
||||
{
|
||||
Notes = "The itemtype for leather"
|
||||
@ -17478,4 +17488,3 @@ end
|
||||
"__.*__",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1180,6 +1180,13 @@ void cEntity::TickBurning(cChunk & a_Chunk)
|
||||
// Remember the current burning state:
|
||||
bool HasBeenBurning = (m_TicksLeftBurning > 0);
|
||||
|
||||
// Fireproof entities burn out on the next tick
|
||||
if (IsFireproof())
|
||||
{
|
||||
m_TicksLeftBurning = 0;
|
||||
}
|
||||
|
||||
// Fire is extinguished by rain
|
||||
if (GetWorld()->IsWeatherWetAt(POSX_TOINT, POSZ_TOINT))
|
||||
{
|
||||
if (POSY_TOINT > m_World->GetHeight(POSX_TOINT, POSZ_TOINT))
|
||||
|
@ -2352,23 +2352,6 @@ void cPlayer::UseEquippedItem(int a_Amount)
|
||||
|
||||
|
||||
|
||||
void cPlayer::TickBurning(cChunk & a_Chunk)
|
||||
{
|
||||
// Don't burn in creative or spectator and stop burning in creative if necessary
|
||||
if (!IsGameModeCreative() && !IsGameModeSpectator())
|
||||
{
|
||||
super::TickBurning(a_Chunk);
|
||||
}
|
||||
else if (IsOnFire())
|
||||
{
|
||||
m_TicksLeftBurning = 0;
|
||||
OnFinishedBurning();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cPlayer::HandleFood(void)
|
||||
{
|
||||
@ -3018,4 +3001,3 @@ float cPlayer::GetPlayerRelativeBlockHardness(BLOCKTYPE a_Block)
|
||||
// LOGD("blockHardness: %f, digSpeed: %f, canHarvestBlockDivisor: %f\n", blockHardness, digSpeed, canHarvestBlockDivisor);
|
||||
return (blockHardness < 0) ? 0 : ((digSpeed / blockHardness) / canHarvestBlockDivisor);
|
||||
}
|
||||
|
||||
|
@ -195,6 +195,15 @@ public:
|
||||
/** Returns true if the player is in Spectator mode, either explicitly, or by inheriting from current world */
|
||||
bool IsGameModeSpectator(void) const;
|
||||
|
||||
/** Returns true if the player is fireproof
|
||||
Stops players burning in creative or spectator modes.
|
||||
*/
|
||||
virtual bool IsFireproof() const override
|
||||
{
|
||||
return (m_IsFireproof || IsGameModeCreative() || IsGameModeSpectator());
|
||||
|
||||
}
|
||||
|
||||
/** Returns true if the player can be targeted by Mobs */
|
||||
bool CanMobsTarget(void) const;
|
||||
|
||||
@ -331,13 +340,13 @@ public:
|
||||
/** Returns true if the player is currently in the process of eating the currently equipped item */
|
||||
bool IsEating(void) const { return (m_EatingFinishTick >= 0); }
|
||||
|
||||
/** Returns true if the player is currently flying. */
|
||||
/** Returns true if the player is currently flying */
|
||||
bool IsFlying(void) const { return m_IsFlying; }
|
||||
|
||||
/** Returns if a player is sleeping in a bed */
|
||||
/** Returns true if a player is sleeping in a bed */
|
||||
bool IsInBed(void) const { return m_bIsInBed; }
|
||||
|
||||
/** returns true if the player has thrown out a floater. */
|
||||
/** Returns true if the player has thrown out a floater */
|
||||
bool IsFishing(void) const { return m_IsFishing; }
|
||||
|
||||
void SetIsFishing(bool a_IsFishing, UInt32 a_FloaterID = cEntity::INVALID_ID) { m_IsFishing = a_IsFishing; m_FloaterID = a_FloaterID; }
|
||||
@ -719,9 +728,6 @@ protected:
|
||||
/** Filters out damage for creative mode / friendly fire */
|
||||
virtual bool DoTakeDamage(TakeDamageInfo & TDI) override;
|
||||
|
||||
/** Stops players from burning in creative mode */
|
||||
virtual void TickBurning(cChunk & a_Chunk) override;
|
||||
|
||||
/** Called in each tick to handle food-related processing */
|
||||
void HandleFood(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user