123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #pragma once
- #include <ReferenceCounter.h>
- #include <Vec3.h>
- #include <Vec2.h>
- #include <Writer.h>
- #include "Effect.h"
- #include "Inventory.h"
- #include "NetworkResponse.h"
- #include "ItemSkill.h"
- class EntityType;
- class Dimension;
- class ActionTarget
- {
- private:
- Framework::Vec3<int> blockPos;
- Direction targetBlockSide;
- int entityId;
- public:
- ActionTarget(Framework::Vec3<int> blockPos, Direction blockSide);
- ActionTarget(int entityId);
- bool isBlock(Framework::Vec3<int> blockPos, Direction blockSide) const;
- bool isEntity(int entityId) const;
- void applyItemSkillOnTarget(Entity* zActor, ItemSkill* zItemSkill, Item* zUsedItem);
- void placeBlock(Entity* zActor, Item* zItem);
- static void save(ActionTarget* zTarget, Framework::StreamWriter* zWriter);
- static ActionTarget* load(Framework::StreamReader* zReader);
- };
- class Entity : public Inventory
- {
- protected:
- float maxHP;
- float currentHP;
- float stamina;
- float maxStamina;
- float hunger;
- float maxHunger;
- float thirst;
- float maxThirst;
- float targetDistanceLimit;
- Framework::Vec3<float> speed;
- Framework::Vec3<float> faceDir;
- Framework::Vec3<float> faceOffset;
- Framework::RCArray<ItemSkill> skills;
- ActionTarget* target;
- const EntityType* zEntityType;
- int currentDimensionId;
- bool removed;
- float gravityMultiplier;
- bool needUpdate;
- int id;
- virtual void onDeath();
- virtual void useItem(const ItemType* zType, Item* zItem);
- Entity(const EntityType* zType, Framework::Vec3<float> location, int dimensionId, int entityId);
- public:
- void prepareTick(const Dimension* zDimension);
- virtual void tick(const Dimension* zDimension);
- virtual void api(Framework::StreamReader* zRequest, NetworkResponse* zResponse);
- virtual void onFall(float collisionSpeed);
- void setPosition(Framework::Vec3<float> pos);
- float getMaxHP() const;
- float getCurrentHP() const;
- float getStamina() const;
- float getMaxStamina() const;
- float getHunger() const;
- float getMaxHunger() const;
- float getThirst() const;
- float getMaxThirst() const;
- Framework::Vec3<float> getSpeed() const;
- Framework::Vec3<float> getFaceDir() const;
- Framework::Vec3<float> getPosition() const;
- float getGravityMultiplier() const;
- int getCurrentDimensionId() const;
- bool isRemoved() const;
- const EntityType* zType() const;
- const ActionTarget* zTarget() const;
- int getId() const;
- virtual bool hasDefaultModel() const;
- virtual ModelInfo getSpecialModel() const;
- friend Effect;
- friend EntityType;
- };
|