1
This commit is contained in:
parent
cf7431a597
commit
e9baeff236
@ -15,6 +15,7 @@ class Bullet;
|
|||||||
class Entity
|
class Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
long long delete_frameno = 0;
|
||||||
|
|
||||||
Entity();
|
Entity();
|
||||||
virtual ~Entity();
|
virtual ~Entity();
|
||||||
@ -32,6 +33,8 @@ class Entity
|
|||||||
virtual void OnPreCollision(Room* room) {};
|
virtual void OnPreCollision(Room* room) {};
|
||||||
virtual void RecalcSelfCollider() {};
|
virtual void RecalcSelfCollider() {};
|
||||||
virtual void OnBulletHit(Bullet* bullet) {};
|
virtual void OnBulletHit(Bullet* bullet) {};
|
||||||
|
virtual void OnAddToTargetPartObject(Entity* target) {};
|
||||||
|
virtual void OnRemoveFromTargetPartObject(Entity* target) {};
|
||||||
int GetEntityUniId() const { return entity_uniid_; }
|
int GetEntityUniId() const { return entity_uniid_; }
|
||||||
EntityType_e GetEntityType() const { return entity_type_; }
|
EntityType_e GetEntityType() const { return entity_type_; }
|
||||||
EntitySubType_e GetEntitySubType() const { return entity_subtype_; }
|
EntitySubType_e GetEntitySubType() const { return entity_subtype_; }
|
||||||
|
@ -306,6 +306,24 @@ void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
|||||||
hero->RemoveFromAroundPlayers(hero->room);
|
hero->RemoveFromAroundPlayers(hero->room);
|
||||||
hero->room->grid_service->RemoveCreature(hero);
|
hero->room->grid_service->RemoveCreature(hero);
|
||||||
hero->room->RemoveObjectLater(hero);
|
hero->room->RemoveObjectLater(hero);
|
||||||
|
hero->delete_frameno = hero->room->GetFrameNo();
|
||||||
|
std::vector<Human*> watch_list;
|
||||||
|
hero->room->GetPartObjectWatchList(hero, watch_list);
|
||||||
|
if (watch_list.empty()) {
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
&xtimer_attacher.timer_list_);
|
&xtimer_attacher.timer_list_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Hero::OnAddToTargetPartObject(Entity* target)
|
||||||
|
{
|
||||||
|
if (delete_frameno > 0) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hero::OnRemoveFromTargetPartObject(Entity* target)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -35,6 +35,8 @@ public:
|
|||||||
virtual float GetHitRadius() override;
|
virtual float GetHitRadius() override;
|
||||||
virtual void GetAabbBox(AabbCollider& aabb_box) override;
|
virtual void GetAabbBox(AabbCollider& aabb_box) override;
|
||||||
virtual void GetHitAabbBox(AabbCollider& aabb_box) override;
|
virtual void GetHitAabbBox(AabbCollider& aabb_box) override;
|
||||||
|
virtual void OnAddToTargetPartObject(Entity* target) override;
|
||||||
|
virtual void OnRemoveFromTargetPartObject(Entity* target) override;
|
||||||
void SetAiLevel(int ai_level);
|
void SetAiLevel(int ai_level);
|
||||||
void DetachFromMaster();
|
void DetachFromMaster();
|
||||||
|
|
||||||
|
@ -967,12 +967,15 @@ void Human::AddToPartObjects(Entity* entity)
|
|||||||
part_obj.entity_uniid = entity->GetEntityUniId();
|
part_obj.entity_uniid = entity->GetEntityUniId();
|
||||||
part_obj.entity_type = entity->GetEntityType();
|
part_obj.entity_type = entity->GetEntityType();
|
||||||
part_obj.entity_subtype = entity->GetEntitySubType();
|
part_obj.entity_subtype = entity->GetEntitySubType();
|
||||||
|
part_obj.add_frameno = room->GetFrameNo();
|
||||||
part_objects[entity] = part_obj;
|
part_objects[entity] = part_obj;
|
||||||
|
entity->OnAddToTargetPartObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::RemovePartObjects(Entity* entity)
|
void Human::RemovePartObjects(Entity* entity)
|
||||||
{
|
{
|
||||||
part_objects.erase(entity);
|
part_objects.erase(entity);
|
||||||
|
entity->OnRemoveFromTargetPartObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::ClearPartObjects()
|
void Human::ClearPartObjects()
|
||||||
|
@ -36,6 +36,7 @@ struct PartObject
|
|||||||
int entity_uniid = 0;
|
int entity_uniid = 0;
|
||||||
int entity_type = 0;
|
int entity_type = 0;
|
||||||
int entity_subtype = 0;
|
int entity_subtype = 0;
|
||||||
|
long long add_frameno = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xtimer_list;
|
struct xtimer_list;
|
||||||
|
@ -3887,3 +3887,17 @@ void Room::ShuaMon(const a8::Vec2& center, std::vector<int>& airdrop_mon_list, f
|
|||||||
}//end if
|
}//end if
|
||||||
}//end for hero_id
|
}//end for hero_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Room::GetPartObjectWatchList(Entity* entity, std::vector<Human*>& watch_list)
|
||||||
|
{
|
||||||
|
TouchHumanList
|
||||||
|
(
|
||||||
|
a8::XParams(),
|
||||||
|
[&watch_list, entity] (Human* hum, a8::XParams& param) -> bool
|
||||||
|
{
|
||||||
|
if (hum->InPartObjects(entity)) {
|
||||||
|
watch_list.push_back(hum);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -177,6 +177,7 @@ public:
|
|||||||
int AllocUniid();
|
int AllocUniid();
|
||||||
Incubator* GetIncubator() { return incubator_;};
|
Incubator* GetIncubator() { return incubator_;};
|
||||||
void ShuaMon(const a8::Vec2& center, std::vector<int>& airdrop_mon_list, float radius);
|
void ShuaMon(const a8::Vec2& center, std::vector<int>& airdrop_mon_list, float radius);
|
||||||
|
void GetPartObjectWatchList(Entity* entity, std::vector<Human*>& watch_list);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ShuaAndroid();
|
void ShuaAndroid();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user