inline bool isAttached() const
{ return getParent(); }
+ inline bool isImmortal() const
+ { return itemgroup_get(getArmorGroups(), "immortal"); }
+
void setArmorGroups(const ItemGroupList &armor_groups);
- const ItemGroupList &getArmorGroups();
+ const ItemGroupList &getArmorGroups() const;
void setAnimation(v2f frame_range, float frame_speed, float frame_blend, bool frame_loop);
void getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend, bool *frame_loop);
void setAnimationSpeed(float frame_speed);
void setBonePosition(const std::string &bone, v3f position, v3f rotation);
void getBonePosition(const std::string &bone, v3f *position, v3f *rotation);
void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation);
- void getAttachment(int *parent_id, std::string *bone, v3f *position, v3f *rotation);
+ void getAttachment(int *parent_id, std::string *bone, v3f *position,
+ v3f *rotation) const;
void clearChildAttachments();
void clearParentAttachment();
void addAttachmentChild(int child_id);
void removeAttachmentChild(int child_id);
- const std::unordered_set<int> &getAttachmentChildIds();
+ const std::unordered_set<int> &getAttachmentChildIds() const;
ServerActiveObject *getParent() const;
ObjectProperties* accessObjectProperties();
void notifyObjectPropertiesModified();
{
public:
LuaEntitySAO(ServerEnvironment *env, v3f pos,
- const std::string &name, const std::string &state);
+ const std::string &name, const std::string &state);
~LuaEntitySAO();
ActiveObjectType getType() const
{ return ACTIVEOBJECT_TYPE_LUAENTITY; }
{ return ACTIVEOBJECT_TYPE_GENERIC; }
virtual void addedToEnvironment(u32 dtime_s);
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
- const std::string &data);
+ const std::string &data);
void step(float dtime, bool send_recommended);
std::string getClientInitializationData(u16 protocol_version);
bool isStaticAllowed() const
{ return m_prop.static_save; }
void getStaticData(std::string *result) const;
- int punch(v3f dir,
- const ToolCapabilities *toolcap=NULL,
- ServerActiveObject *puncher=NULL,
- float time_from_last_punch=1000000);
+ u16 punch(v3f dir,
+ const ToolCapabilities *toolcap = nullptr,
+ ServerActiveObject *puncher = nullptr,
+ float time_from_last_punch = 1000000.0f);
void rightClick(ServerActiveObject *clicker);
void setPos(const v3f &pos);
void moveTo(v3f pos, bool continuous);
std::string getDescription();
void setHP(s32 hp, const PlayerHPChangeReason &reason);
u16 getHP() const;
+
/* LuaEntitySAO-specific */
void setVelocity(v3f velocity);
void addVelocity(v3f velocity)
public:
PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_,
bool is_singleplayer);
- ~PlayerSAO();
+
ActiveObjectType getType() const
{ return ACTIVEOBJECT_TYPE_PLAYER; }
ActiveObjectType getSendType() const
Interaction interface
*/
- int punch(v3f dir,
+ u16 punch(v3f dir,
const ToolCapabilities *toolcap,
ServerActiveObject *puncher,
float time_from_last_punch);
/*
Inventory interface
*/
-
- Inventory* getInventory();
- const Inventory* getInventory() const;
+ Inventory *getInventory() const;
InventoryLocation getInventoryLocation() const;
- std::string getWieldList() const;
- ItemStack getWieldedItem() const;
- ItemStack getWieldedItemOrHand() const;
+ void setInventoryModified() {}
+ std::string getWieldList() const { return "main"; }
+ u16 getWieldIndex() const;
+ ItemStack getWieldedItem(ItemStack *selected, ItemStack *hand = nullptr) const;
bool setWieldedItem(const ItemStack &item);
- int getWieldIndex() const;
- void setWieldIndex(int i);
/*
PlayerSAO-specific
{
return m_dig_pool;
}
+ void setMaxSpeedOverride(const v3f &vel);
// Returns true if cheated
bool checkMovementCheat();
RemotePlayer *m_player = nullptr;
session_t m_peer_id = 0;
- Inventory *m_inventory = nullptr;
// Cheat prevention
LagPool m_dig_pool;
float m_time_from_last_punch = 0.0f;
v3s16 m_nocheat_dig_pos = v3s16(32767, 32767, 32767);
float m_nocheat_dig_time = 0.0f;
+ float m_max_speed_override_time = 0.0f;
+ v3f m_max_speed_override = v3f(0.0f, 0.0f, 0.0f);
// Timers
IntervalLimiter m_breathing_interval;
IntervalLimiter m_drowning_interval;
IntervalLimiter m_node_hurt_interval;
- int m_wield_index = 0;
bool m_position_not_sent = false;
// Cached privileges for enforcement