Floater now dissapears when the player doesn't have an fishing rod equipped.
This commit is contained in:
parent
0d14229ffd
commit
bd6574230a
|
@ -240,6 +240,11 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
|
||||||
HandleFood();
|
HandleFood();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_IsFishing)
|
||||||
|
{
|
||||||
|
HandleFloater();
|
||||||
|
}
|
||||||
|
|
||||||
// Send Player List (Once per m_LastPlayerListTime/1000 ms)
|
// Send Player List (Once per m_LastPlayerListTime/1000 ms)
|
||||||
cTimer t1;
|
cTimer t1;
|
||||||
if (m_LastPlayerListTime + cPlayer::PLAYER_LIST_TIME_MS <= t1.GetNowTime())
|
if (m_LastPlayerListTime + cPlayer::PLAYER_LIST_TIME_MS <= t1.GetNowTime())
|
||||||
|
@ -1781,6 +1786,30 @@ void cPlayer::HandleFood(void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cPlayer::HandleFloater()
|
||||||
|
{
|
||||||
|
if (GetEquippedItem().m_ItemType == E_ITEM_FISHING_ROD)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
class cFloaterCallback :
|
||||||
|
public cEntityCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual bool Item(cEntity * a_Entity) override
|
||||||
|
{
|
||||||
|
a_Entity->Destroy(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} Callback;
|
||||||
|
m_World->DoWithEntityByID(m_FloaterID, Callback);
|
||||||
|
SetIsFishing(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cPlayer::ApplyFoodExhaustionFromMovement()
|
void cPlayer::ApplyFoodExhaustionFromMovement()
|
||||||
{
|
{
|
||||||
if (IsGameModeCreative())
|
if (IsGameModeCreative())
|
||||||
|
|
|
@ -466,6 +466,9 @@ protected:
|
||||||
|
|
||||||
/// Called in each tick to handle food-related processing
|
/// Called in each tick to handle food-related processing
|
||||||
void HandleFood(void);
|
void HandleFood(void);
|
||||||
|
|
||||||
|
/// Called in each tick if the player is fishing to make sure the floater dissapears when the player doesn't have a fishing rod as equipped item.
|
||||||
|
void HandleFloater(void);
|
||||||
|
|
||||||
/// Called in each tick to handle air-related processing i.e. drowning
|
/// Called in each tick to handle air-related processing i.e. drowning
|
||||||
void HandleAir();
|
void HandleAir();
|
||||||
|
|
Loading…
Reference in New Issue