Changed fish launching mechanism (#3520)
Fish and other fishing loot now correctly fly towards played when reeled in.
This commit is contained in:
parent
750e2c1944
commit
9cb1ad546f
@ -40,6 +40,7 @@ Seadragon91 (Lukas Pioch)
|
|||||||
Sofapriester
|
Sofapriester
|
||||||
SphinxC0re
|
SphinxC0re
|
||||||
structinf (xdot)
|
structinf (xdot)
|
||||||
|
sweetgiorni
|
||||||
Sxw1212
|
Sxw1212
|
||||||
Taugeshtu
|
Taugeshtu
|
||||||
tigerw (Tiger Wang)
|
tigerw (Tiger Wang)
|
||||||
|
@ -6585,6 +6585,15 @@ cFile:DeleteFile("/usr/bin/virus.exe");
|
|||||||
},
|
},
|
||||||
Notes = "Returns the EntityID of the player who owns the floater.",
|
Notes = "Returns the EntityID of the player who owns the floater.",
|
||||||
},
|
},
|
||||||
|
GetBitePos =
|
||||||
|
{
|
||||||
|
Returns =
|
||||||
|
{
|
||||||
|
Name = "BitePosition",
|
||||||
|
Type = "Vector3d",
|
||||||
|
},
|
||||||
|
Notes = "Returns the position of the floater just before a fish bites. If a fish hasn't bitten the floater, this function returns the position the floater was cast from.",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Inherits = "cEntity",
|
Inherits = "cEntity",
|
||||||
},
|
},
|
||||||
|
@ -103,6 +103,7 @@ protected:
|
|||||||
|
|
||||||
cFloater::cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime) :
|
cFloater::cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime) :
|
||||||
cEntity(etFloater, a_X, a_Y, a_Z, 0.2, 0.2),
|
cEntity(etFloater, a_X, a_Y, a_Z, 0.2, 0.2),
|
||||||
|
m_BitePos(Vector3d(a_X, a_Y, a_Z)),
|
||||||
m_CanPickupItem(false),
|
m_CanPickupItem(false),
|
||||||
m_PickupCountDown(0),
|
m_PickupCountDown(0),
|
||||||
m_CountDownTime(a_CountDownTime),
|
m_CountDownTime(a_CountDownTime),
|
||||||
@ -135,6 +136,7 @@ void cFloater::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
|||||||
{
|
{
|
||||||
if (m_CountDownTime <= 0)
|
if (m_CountDownTime <= 0)
|
||||||
{
|
{
|
||||||
|
m_BitePos = GetPosition();
|
||||||
m_World->BroadcastSoundEffect("entity.bobber.splash", GetPosX(), GetPosY(), GetPosZ(), 1, 1);
|
m_World->BroadcastSoundEffect("entity.bobber.splash", GetPosX(), GetPosY(), GetPosZ(), 1, 1);
|
||||||
SetPosY(GetPosY() - 1);
|
SetPosY(GetPosY() - 1);
|
||||||
m_CanPickupItem = true;
|
m_CanPickupItem = true;
|
||||||
|
@ -27,12 +27,16 @@ public:
|
|||||||
bool CanPickup(void) const { return m_CanPickupItem; }
|
bool CanPickup(void) const { return m_CanPickupItem; }
|
||||||
UInt32 GetOwnerID(void) const { return m_PlayerID; }
|
UInt32 GetOwnerID(void) const { return m_PlayerID; }
|
||||||
UInt32 GetAttachedMobID(void) const { return m_AttachedMobID; }
|
UInt32 GetAttachedMobID(void) const { return m_AttachedMobID; }
|
||||||
|
Vector3d GetBitePos(void) const { return m_BitePos; }
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Position
|
// Position
|
||||||
Vector3d m_ParticlePos;
|
Vector3d m_ParticlePos;
|
||||||
|
|
||||||
|
// Position just before the floater gets pulled under by a fish
|
||||||
|
Vector3d m_BitePos;
|
||||||
|
|
||||||
// Bool needed to check if you can get a fish.
|
// Bool needed to check if you can get a fish.
|
||||||
bool m_CanPickupItem;
|
bool m_CanPickupItem;
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_CanPickup = reinterpret_cast<cFloater *>(a_Entity)->CanPickup();
|
m_CanPickup = reinterpret_cast<cFloater *>(a_Entity)->CanPickup();
|
||||||
m_Pos = Vector3d(a_Entity->GetPosX(), a_Entity->GetPosY(), a_Entity->GetPosZ());
|
m_Pos = Vector3d(a_Entity->GetPosX(), a_Entity->GetPosY(), a_Entity->GetPosZ());
|
||||||
|
m_BitePos = reinterpret_cast<cFloater *>(a_Entity)->GetBitePos();
|
||||||
m_AttachedMobID = reinterpret_cast<cFloater *>(a_Entity)->GetAttachedMobID();
|
m_AttachedMobID = reinterpret_cast<cFloater *>(a_Entity)->GetAttachedMobID();
|
||||||
a_Entity->Destroy(true);
|
a_Entity->Destroy(true);
|
||||||
return true;
|
return true;
|
||||||
@ -44,11 +45,13 @@ public:
|
|||||||
bool IsAttached(void) const { return (m_AttachedMobID != cEntity::INVALID_ID); }
|
bool IsAttached(void) const { return (m_AttachedMobID != cEntity::INVALID_ID); }
|
||||||
UInt32 GetAttachedMobID(void) const { return m_AttachedMobID; }
|
UInt32 GetAttachedMobID(void) const { return m_AttachedMobID; }
|
||||||
Vector3d GetPos(void) const { return m_Pos; }
|
Vector3d GetPos(void) const { return m_Pos; }
|
||||||
|
Vector3d GetBitePos(void) const { return m_BitePos; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_CanPickup;
|
bool m_CanPickup;
|
||||||
UInt32 m_AttachedMobID;
|
UInt32 m_AttachedMobID;
|
||||||
Vector3d m_Pos;
|
Vector3d m_Pos;
|
||||||
|
Vector3d m_BitePos;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
@ -236,9 +239,12 @@ public:
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Vector3d FloaterPos = FloaterInfo.GetPos();
|
Vector3d FloaterPos = FloaterInfo.GetBitePos();
|
||||||
|
FloaterPos.y += 0.5f;
|
||||||
|
const float FISH_SPEED_MULT = 2.25f;
|
||||||
|
|
||||||
Vector3d FlyDirection = a_Player->GetEyePosition() - FloaterPos;
|
Vector3d FlyDirection = a_Player->GetEyePosition() - FloaterPos;
|
||||||
a_World->SpawnItemPickups(Drops, FloaterPos.x, FloaterPos.y, FloaterPos.z, FlyDirection.x, FlyDirection.y + 1, FlyDirection.z);
|
a_World->SpawnItemPickups(Drops, FloaterPos.x, FloaterPos.y, FloaterPos.z, FlyDirection.x * FISH_SPEED_MULT, (FlyDirection.y + 1.0f) * FISH_SPEED_MULT, FlyDirection.z * FISH_SPEED_MULT);
|
||||||
cRoot::Get()->GetPluginManager()->CallHookPlayerFished(*a_Player, Drops);
|
cRoot::Get()->GetPluginManager()->CallHookPlayerFished(*a_Player, Drops);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user