commit
5e6a4c99a7
@ -37,6 +37,7 @@ $cfile "../Entities/Player.h"
|
||||
$cfile "../Entities/Pickup.h"
|
||||
$cfile "../Entities/ProjectileEntity.h"
|
||||
$cfile "../Entities/TNTEntity.h"
|
||||
$cfile "../Entities/Effects.h"
|
||||
$cfile "../Server.h"
|
||||
$cfile "../World.h"
|
||||
$cfile "../Inventory.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Lua binding: AllToLua
|
||||
** Generated automatically by tolua++-1.0.92 on 12/14/13 16:22:45.
|
||||
** Generated automatically by tolua++-1.0.92 on 12/14/13 22:33:52.
|
||||
*/
|
||||
|
||||
#ifndef __cplusplus
|
||||
@ -8,7 +8,7 @@
|
||||
#endif
|
||||
#include "string.h"
|
||||
|
||||
#include "tolua++/include/tolua++.h"
|
||||
#include "tolua++.h"
|
||||
|
||||
/* Exported function */
|
||||
TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);
|
||||
@ -35,6 +35,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);
|
||||
#include "../Entities/Pickup.h"
|
||||
#include "../Entities/ProjectileEntity.h"
|
||||
#include "../Entities/TNTEntity.h"
|
||||
#include "../Entities/Effects.h"
|
||||
#include "../Server.h"
|
||||
#include "../World.h"
|
||||
#include "../Inventory.h"
|
||||
@ -31064,6 +31065,29 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
||||
tolua_function(tolua_S,"GetCounterTime",tolua_AllToLua_cTNTEntity_GetCounterTime00);
|
||||
tolua_function(tolua_S,"GetMaxFuseTime",tolua_AllToLua_cTNTEntity_GetMaxFuseTime00);
|
||||
tolua_endmodule(tolua_S);
|
||||
tolua_constant(tolua_S,"E_EFFECT_SPEED",E_EFFECT_SPEED);
|
||||
tolua_constant(tolua_S,"E_EFFECT_SLOWNESS",E_EFFECT_SLOWNESS);
|
||||
tolua_constant(tolua_S,"E_EFFECT_HASTE",E_EFFECT_HASTE);
|
||||
tolua_constant(tolua_S,"E_EFFECT_MINING_FATIGUE",E_EFFECT_MINING_FATIGUE);
|
||||
tolua_constant(tolua_S,"E_EFFECT_STENGTH",E_EFFECT_STENGTH);
|
||||
tolua_constant(tolua_S,"E_EFFECT_INSTANT_HEALTH",E_EFFECT_INSTANT_HEALTH);
|
||||
tolua_constant(tolua_S,"E_EFFECT_INSTANT_DAMAGE",E_EFFECT_INSTANT_DAMAGE);
|
||||
tolua_constant(tolua_S,"E_EFFECT_JUMP_BOOST",E_EFFECT_JUMP_BOOST);
|
||||
tolua_constant(tolua_S,"E_EFFECT_NAUSEA",E_EFFECT_NAUSEA);
|
||||
tolua_constant(tolua_S,"E_EFFECT_REGENERATION",E_EFFECT_REGENERATION);
|
||||
tolua_constant(tolua_S,"E_EFFECT_RESISTANCE",E_EFFECT_RESISTANCE);
|
||||
tolua_constant(tolua_S,"E_EFFECT_FIRE_RESISTANCE",E_EFFECT_FIRE_RESISTANCE);
|
||||
tolua_constant(tolua_S,"E_EFFECT_WATER_BREATHING",E_EFFECT_WATER_BREATHING);
|
||||
tolua_constant(tolua_S,"E_EFFECT_INVISIBILITY",E_EFFECT_INVISIBILITY);
|
||||
tolua_constant(tolua_S,"E_EFFECT_BLINDNESS",E_EFFECT_BLINDNESS);
|
||||
tolua_constant(tolua_S,"E_EFFECT_NIGHT_VISION",E_EFFECT_NIGHT_VISION);
|
||||
tolua_constant(tolua_S,"E_EFFECT_HUNGER",E_EFFECT_HUNGER);
|
||||
tolua_constant(tolua_S,"E_EFFECT_WEAKNESS",E_EFFECT_WEAKNESS);
|
||||
tolua_constant(tolua_S,"E_EFFECT_POISON",E_EFFECT_POISON);
|
||||
tolua_constant(tolua_S,"E_EFFECT_WITHER",E_EFFECT_WITHER);
|
||||
tolua_constant(tolua_S,"E_EFFECT_HEALTH_BOOST",E_EFFECT_HEALTH_BOOST);
|
||||
tolua_constant(tolua_S,"E_EFFECT_ABSORPTION",E_EFFECT_ABSORPTION);
|
||||
tolua_constant(tolua_S,"E_EFFECT_SATURATION",E_EFFECT_SATURATION);
|
||||
tolua_cclass(tolua_S,"cServer","cServer","",NULL);
|
||||
tolua_beginmodule(tolua_S,"cServer");
|
||||
tolua_function(tolua_S,"GetDescription",tolua_AllToLua_cServer_GetDescription00);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Lua binding: AllToLua
|
||||
** Generated automatically by tolua++-1.0.92 on 12/14/13 16:22:46.
|
||||
** Generated automatically by tolua++-1.0.92 on 12/14/13 22:33:53.
|
||||
*/
|
||||
|
||||
/* Exported function */
|
||||
|
@ -1673,6 +1673,15 @@ void cClientHandle::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration)
|
||||
{
|
||||
m_Protocol->SendEntityEffect(a_Entity, a_EffectID, a_Amplifier, a_Duration);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
m_Protocol->SendEntityEquipment(a_Entity, a_SlotNum, a_Item);
|
||||
@ -1882,6 +1891,15 @@ void cClientHandle::SendPlayerSpawn(const cPlayer & a_Player)
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID)
|
||||
{
|
||||
m_Protocol->SendRemoveEntityEffect(a_Entity, a_EffectID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendRespawn(void)
|
||||
{
|
||||
m_Protocol->SendRespawn();
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
void SendDestroyEntity (const cEntity & a_Entity);
|
||||
void SendDisconnect (const AString & a_Reason);
|
||||
void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration);
|
||||
void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item);
|
||||
void SendEntityHeadLook (const cEntity & a_Entity);
|
||||
void SendEntityLook (const cEntity & a_Entity);
|
||||
@ -120,6 +121,7 @@ public:
|
||||
void SendPlayerMoveLook (void);
|
||||
void SendPlayerPosition (void);
|
||||
void SendPlayerSpawn (const cPlayer & a_Player);
|
||||
void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID);
|
||||
void SendRespawn (void);
|
||||
void SendExperience (void);
|
||||
void SendExperienceOrb (const cExpOrb & a_ExpOrb);
|
||||
|
30
src/Entities/Effects.h
Normal file
30
src/Entities/Effects.h
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
// tolua_begin
|
||||
enum ENUM_ENTITY_EFFECT
|
||||
{
|
||||
E_EFFECT_SPEED = 1,
|
||||
E_EFFECT_SLOWNESS = 2,
|
||||
E_EFFECT_HASTE = 3,
|
||||
E_EFFECT_MINING_FATIGUE = 4,
|
||||
E_EFFECT_STENGTH = 5,
|
||||
E_EFFECT_INSTANT_HEALTH = 6,
|
||||
E_EFFECT_INSTANT_DAMAGE = 7,
|
||||
E_EFFECT_JUMP_BOOST = 8,
|
||||
E_EFFECT_NAUSEA = 9,
|
||||
E_EFFECT_REGENERATION = 10,
|
||||
E_EFFECT_RESISTANCE = 11,
|
||||
E_EFFECT_FIRE_RESISTANCE = 12,
|
||||
E_EFFECT_WATER_BREATHING = 13,
|
||||
E_EFFECT_INVISIBILITY = 14,
|
||||
E_EFFECT_BLINDNESS = 15,
|
||||
E_EFFECT_NIGHT_VISION = 16,
|
||||
E_EFFECT_HUNGER = 17,
|
||||
E_EFFECT_WEAKNESS = 18,
|
||||
E_EFFECT_POISON = 19,
|
||||
E_EFFECT_WITHER = 20,
|
||||
E_EFFECT_HEALTH_BOOST = 21,
|
||||
E_EFFECT_ABSORPTION = 22,
|
||||
E_EFFECT_SATURATION = 23,
|
||||
} ;
|
||||
// tolua_end
|
@ -557,9 +557,13 @@ void cPlayer::FoodPoison(int a_NumTicks)
|
||||
m_FoodPoisonedTicksRemaining = std::max(m_FoodPoisonedTicksRemaining, a_NumTicks);
|
||||
if (!HasBeenFoodPoisoned)
|
||||
{
|
||||
// TODO: Send the poisoning indication to the client - how?
|
||||
m_ClientHandle->SendRemoveEntityEffect(*this, E_EFFECT_HUNGER);
|
||||
SendHealth();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ClientHandle->SendEntityEffect(*this, E_EFFECT_HUNGER, 0, 20);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1704,6 +1708,10 @@ void cPlayer::HandleFood(void)
|
||||
m_FoodPoisonedTicksRemaining--;
|
||||
m_FoodExhaustionLevel += 0.025; // 0.5 per second = 0.025 per tick
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ClientHandle->SendRemoveEntityEffect(*this, E_EFFECT_HUNGER); // remove the "Hunger" effect.
|
||||
}
|
||||
|
||||
// Apply food exhaustion that has accumulated:
|
||||
if (m_FoodExhaustionLevel >= 4)
|
||||
|
@ -220,6 +220,7 @@ public:
|
||||
// Common headers (part 2, with macros):
|
||||
#include "ChunkDef.h"
|
||||
#include "BlockID.h"
|
||||
#include "Entities/Effects.h"
|
||||
|
||||
|
||||
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) = 0;
|
||||
virtual void SendDisconnect (const AString & a_Reason) = 0;
|
||||
virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) = 0; ///< Request the client to open up the sign editor for the sign (1.6+)
|
||||
virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) = 0;
|
||||
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) = 0;
|
||||
virtual void SendEntityHeadLook (const cEntity & a_Entity) = 0;
|
||||
virtual void SendEntityLook (const cEntity & a_Entity) = 0;
|
||||
@ -85,6 +86,7 @@ public:
|
||||
virtual void SendPlayerMoveLook (void) = 0;
|
||||
virtual void SendPlayerPosition (void) = 0;
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0;
|
||||
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) = 0;
|
||||
virtual void SendRespawn (void) = 0;
|
||||
virtual void SendExperience (void) = 0;
|
||||
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) = 0;
|
||||
|
@ -43,6 +43,8 @@ enum
|
||||
PACKET_HANDSHAKE = 0x02,
|
||||
PACKET_CHAT = 0x03,
|
||||
PACKET_UPDATE_TIME = 0x04,
|
||||
PACKET_ENTITY_EFFECT = 0x1D,
|
||||
PACKET_REMOVE_ENTITY_EFFECT = 0x1E,
|
||||
PACKET_ENTITY_EQUIPMENT = 0x05,
|
||||
PACKET_USE_ENTITY = 0x07,
|
||||
PACKET_UPDATE_HEALTH = 0x08,
|
||||
@ -300,6 +302,21 @@ void cProtocol125::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
WriteByte (PACKET_ENTITY_EFFECT);
|
||||
WriteInt (a_Entity.GetUniqueID());
|
||||
WriteByte (a_EffectID);
|
||||
WriteByte (a_Amplifier);
|
||||
WriteShort(a_Duration);
|
||||
Flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
@ -678,6 +695,19 @@ void cProtocol125::SendPlayerSpawn(const cPlayer & a_Player)
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
WriteByte (PACKET_REMOVE_ENTITY_EFFECT);
|
||||
WriteInt (a_Entity.GetUniqueID());
|
||||
WriteByte (a_EffectID);
|
||||
Flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendRespawn(void)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
|
||||
virtual void SendDisconnect (const AString & a_Reason) override;
|
||||
virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
|
||||
virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) override;
|
||||
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
|
||||
virtual void SendEntityHeadLook (const cEntity & a_Entity) override;
|
||||
virtual void SendEntityLook (const cEntity & a_Entity) override;
|
||||
@ -61,6 +62,7 @@ public:
|
||||
virtual void SendPlayerMoveLook (void) override;
|
||||
virtual void SendPlayerPosition (void) override;
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
|
||||
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
|
||||
virtual void SendRespawn (void) override;
|
||||
virtual void SendExperience (void) override;
|
||||
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
|
||||
|
@ -236,6 +236,19 @@ void cProtocol172::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration)
|
||||
{
|
||||
cPacketizer Pkt(*this, 0x1D); // Entity Effect packet
|
||||
Pkt.WriteInt(a_Entity.GetUniqueID());
|
||||
Pkt.WriteByte(a_EffectID);
|
||||
Pkt.WriteByte(a_Amplifier);
|
||||
Pkt.WriteShort(a_Duration);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
cPacketizer Pkt(*this, 0x04); // Entity Equipment packet
|
||||
@ -585,6 +598,17 @@ void cProtocol172::SendPlayerSpawn(const cPlayer & a_Player)
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID)
|
||||
{
|
||||
cPacketizer Pkt(*this, 0x1E);
|
||||
Pkt.WriteInt(a_Entity.GetUniqueID());
|
||||
Pkt.WriteByte(a_EffectID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendRespawn(void)
|
||||
{
|
||||
cPacketizer Pkt(*this, 0x07); // Respawn packet
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
|
||||
virtual void SendDisconnect (const AString & a_Reason) override;
|
||||
virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
|
||||
virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) override;
|
||||
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
|
||||
virtual void SendEntityHeadLook (const cEntity & a_Entity) override;
|
||||
virtual void SendEntityLook (const cEntity & a_Entity) override;
|
||||
@ -70,6 +71,7 @@ public:
|
||||
virtual void SendPlayerMoveLook (void) override;
|
||||
virtual void SendPlayerPosition (void) override;
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
|
||||
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
|
||||
virtual void SendRespawn (void) override;
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8
|
||||
virtual void SendExperience (void) override;
|
||||
|
@ -216,6 +216,16 @@ void cProtocolRecognizer::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendEntityEffect(a_Entity, a_EffectID, a_Amplifier, a_Duration);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
@ -456,6 +466,16 @@ void cProtocolRecognizer::SendPlayerSpawn(const cPlayer & a_Player)
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendRemoveEntityEffect(a_Entity, a_EffectID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendRespawn(void)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
|
||||
virtual void SendDisconnect (const AString & a_Reason) override;
|
||||
virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
|
||||
virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) override;
|
||||
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
|
||||
virtual void SendEntityHeadLook (const cEntity & a_Entity) override;
|
||||
virtual void SendEntityLook (const cEntity & a_Entity) override;
|
||||
@ -96,6 +97,7 @@ public:
|
||||
virtual void SendPlayerMoveLook (void) override;
|
||||
virtual void SendPlayerPosition (void) override;
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
|
||||
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
|
||||
virtual void SendRespawn (void) override;
|
||||
virtual void SendExperience (void) override;
|
||||
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
|
||||
|
Loading…
Reference in New Issue
Block a user