12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #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;
- friend Effect;
- friend EntityType;
- };
|