99 lines
2.5 KiB
C++
99 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include "entity.h"
|
|
#include "framedata.h"
|
|
|
|
namespace MetaData
|
|
{
|
|
struct Player;
|
|
struct Equip;
|
|
}
|
|
|
|
class CircleCollider;
|
|
class Obstacle;
|
|
class Human : public Entity
|
|
{
|
|
public:
|
|
int team_id = 0;
|
|
std::string account_id;
|
|
std::string team_uniid;
|
|
MetaData::Player* meta = nullptr;
|
|
MetaData::Equip* helmet_meta = nullptr;
|
|
MetaData::Equip* chest_meta = nullptr;
|
|
|
|
Vector2D move_dir;
|
|
Vector2D attack_dir;
|
|
|
|
std::string name;
|
|
std::string avatar_url;
|
|
float health = 0.0;
|
|
bool dead = false;
|
|
bool downed = false;
|
|
bool disconnected = false;
|
|
int anim_type = 0;
|
|
int anim_seq = 0;
|
|
ActionType_e action_type = AT_None;
|
|
long long action_frameno = 0;
|
|
int action_duration = 0;
|
|
int action_item_id = 0;
|
|
int action_target_id = 0;
|
|
int skin = 0;
|
|
int backpack = 0;
|
|
int helmet = 0;
|
|
int chest = 0;
|
|
int energy_shield = 0;
|
|
int vip = 0;
|
|
int sdmg = 0;
|
|
bool poisoning = false;
|
|
long long poisoning_time = 0;
|
|
long long dead_frameno = 0;
|
|
long long join_frameno = 0;
|
|
|
|
Weapon default_weapon;
|
|
std::vector<Weapon> weapons;
|
|
Weapon* curr_weapon = nullptr;
|
|
|
|
int curr_scope_idx = 0;
|
|
std::vector<int> inventory;
|
|
|
|
bool need_sync_active_player = false;
|
|
|
|
HumanFrameData frame_data;
|
|
PlayerStats stats;
|
|
|
|
bool send_gameover = false;
|
|
|
|
std::set<Entity*> new_objects;
|
|
std::set<Entity*> part_objects;
|
|
|
|
Human();
|
|
virtual ~Human() override;
|
|
virtual void Initialize() override;
|
|
virtual float GetSpeed() override;
|
|
virtual void FillMFObjectPart(cs::MFObjectPart* part_data) override;
|
|
virtual void FillMFObjectFull(cs::MFObjectFull* full_data) override;
|
|
virtual void FillMFPlayerStats(cs::MFPlayerStats* stats);
|
|
void Shot(Vector2D& target_dir);
|
|
void RecalcSelfCollider();
|
|
bool IsCollision();
|
|
ColliderComponent* GetFirstCollision();
|
|
void FindPath();
|
|
float GetRadius();
|
|
void UpdatePoisoning();
|
|
void SyncAroundPlayers();
|
|
void AutoLoadingBullet(bool manual = false);
|
|
void StartAction(ActionType_e action_type,
|
|
int action_duration,
|
|
int item_id,
|
|
int target_id);
|
|
void CancelAction();
|
|
void ResetAction();
|
|
void FillSMGameOver(cs::SMGameOver& msg);
|
|
void BeKill(int killer_id, const std::string& killer_name);
|
|
void DecHP(float dec_hp, int killer_id, const std::string& killer_name);
|
|
|
|
private:
|
|
CircleCollider* self_collider_ = nullptr;
|
|
|
|
};
|