1
This commit is contained in:
parent
933a39dfed
commit
700578af9c
@ -119,6 +119,20 @@ void Entity::BroadcastDeleteState(Room* room)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Entity::RemoveFromAroundPlayers(Room* room)
|
||||||
|
{
|
||||||
|
std::set<GridCell*> tmp_grids;
|
||||||
|
room->grid_service->GetAllCells(room, grid_id_, tmp_grids);
|
||||||
|
room->grid_service->TouchAllLayerHumanList
|
||||||
|
(
|
||||||
|
room->GetRoomIdx(),
|
||||||
|
tmp_grids,
|
||||||
|
[this] (Human* hum, bool& stop)
|
||||||
|
{
|
||||||
|
hum->RemovePartObjects(this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Entity::AddEntityCollider(ColliderComponent* collider)
|
void Entity::AddEntityCollider(ColliderComponent* collider)
|
||||||
{
|
{
|
||||||
colliders_.push_back(collider);
|
colliders_.push_back(collider);
|
||||||
|
@ -38,6 +38,7 @@ class Entity
|
|||||||
bool TestCollisionEx(Room* room, const a8::Vec2& aabb_pos, AabbCollider& aabb_box);
|
bool TestCollisionEx(Room* room, const a8::Vec2& aabb_pos, AabbCollider& aabb_box);
|
||||||
void BroadcastFullState(Room* room);
|
void BroadcastFullState(Room* room);
|
||||||
void BroadcastDeleteState(Room* room);
|
void BroadcastDeleteState(Room* room);
|
||||||
|
void RemoveFromAroundPlayers(Room* room);
|
||||||
void AddEntityCollider(ColliderComponent* collider);
|
void AddEntityCollider(ColliderComponent* collider);
|
||||||
a8::Vec2 GetPos() { return pos_; };
|
a8::Vec2 GetPos() { return pos_; };
|
||||||
void SetPos(a8::Vec2 pos) { pos_ = pos; }
|
void SetPos(a8::Vec2 pos) { pos_ = pos; }
|
||||||
|
@ -230,7 +230,7 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
|||||||
}
|
}
|
||||||
for (size_t idx : hum->chged_cars_) {
|
for (size_t idx : hum->chged_cars_) {
|
||||||
if (idx < room->frame_event.chged_cars_.size()) {
|
if (idx < room->frame_event.chged_cars_.size()) {
|
||||||
Human* target = room->frame_event.chged_hps_[idx];
|
Human* target = room->frame_event.chged_cars_[idx];
|
||||||
if (hum->CanSee(target)) {
|
if (hum->CanSee(target)) {
|
||||||
auto p = msg->add_chged_property_list();
|
auto p = msg->add_chged_property_list();
|
||||||
p->set_obj_id(target->GetEntityUniId());
|
p->set_obj_id(target->GetEntityUniId());
|
||||||
|
@ -59,6 +59,11 @@ void Player::InternalUpdate(int delta_time)
|
|||||||
if (HasBuffEffect(kBET_Fly)) {
|
if (HasBuffEffect(kBET_Fly)) {
|
||||||
SetPos(room->plane.curr_pos);
|
SetPos(room->plane.curr_pos);
|
||||||
room->grid_service->MoveHuman(this);
|
room->grid_service->MoveHuman(this);
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (GetCar() && GetCar()->IsDriver(this)) {
|
||||||
|
GetCar()->SyncPos();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (HasSpecMove()) {
|
if (HasSpecMove()) {
|
||||||
_UpdateSpecMove();
|
_UpdateSpecMove();
|
||||||
@ -107,6 +112,9 @@ void Player::InternalUpdate(int delta_time)
|
|||||||
if (get_down) {
|
if (get_down) {
|
||||||
UpdateGetDown();
|
UpdateGetDown();
|
||||||
}
|
}
|
||||||
|
if (get_on) {
|
||||||
|
UpdateGetOn();
|
||||||
|
}
|
||||||
if (shot_start || shot_hold) {
|
if (shot_start || shot_hold) {
|
||||||
UpdateShot();
|
UpdateShot();
|
||||||
}
|
}
|
||||||
@ -374,6 +382,12 @@ void Player::UpdateGetDown()
|
|||||||
get_down = false;
|
get_down = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::UpdateGetOn()
|
||||||
|
{
|
||||||
|
DoGetOn(get_on);
|
||||||
|
get_on = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Player::UpdateUseSkill()
|
void Player::UpdateUseSkill()
|
||||||
{
|
{
|
||||||
if (HasBuffEffect(kBET_Vertigo)) {
|
if (HasBuffEffect(kBET_Vertigo)) {
|
||||||
@ -1089,6 +1103,9 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
|||||||
if (msg.has_get_down()) {
|
if (msg.has_get_down()) {
|
||||||
get_down = msg.get_down();
|
get_down = msg.get_down();
|
||||||
}
|
}
|
||||||
|
if (msg.has_get_on()) {
|
||||||
|
get_on = msg.get_on();
|
||||||
|
}
|
||||||
if (msg.has_jump()) {
|
if (msg.has_jump()) {
|
||||||
jump = true;
|
jump = true;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ class Player : public Human
|
|||||||
bool use_skill = false;
|
bool use_skill = false;
|
||||||
|
|
||||||
bool get_down = false;
|
bool get_down = false;
|
||||||
|
int get_on = 0;
|
||||||
|
|
||||||
::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids;
|
::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids;
|
||||||
|
|
||||||
@ -79,6 +80,7 @@ class Player : public Human
|
|||||||
void UpdateEmote();
|
void UpdateEmote();
|
||||||
void UpdateJump();
|
void UpdateJump();
|
||||||
void UpdateGetDown();
|
void UpdateGetDown();
|
||||||
|
void UpdateGetOn();
|
||||||
void UpdateUseSkill();
|
void UpdateUseSkill();
|
||||||
void Shot();
|
void Shot();
|
||||||
void ProcInteraction();
|
void ProcInteraction();
|
||||||
|
@ -553,6 +553,7 @@ Car* Room::CreateCar(Human* driver,
|
|||||||
const a8::Vec2& pos)
|
const a8::Vec2& pos)
|
||||||
{
|
{
|
||||||
Car* car = EntityFactory::Instance()->MakeCar(car_uniid);
|
Car* car = EntityFactory::Instance()->MakeCar(car_uniid);
|
||||||
|
car->car_uniid = car_uniid;
|
||||||
car->meta = item_meta;
|
car->meta = item_meta;
|
||||||
car->room = this;
|
car->room = this;
|
||||||
car->SetPos(pos);
|
car->SetPos(pos);
|
||||||
@ -595,6 +596,7 @@ void Room::RemoveObjectLater(RoomEntity* entity)
|
|||||||
break;
|
break;
|
||||||
case ET_Car:
|
case ET_Car:
|
||||||
{
|
{
|
||||||
|
entity->RemoveFromAroundPlayers(entity->room);
|
||||||
entity->BroadcastDeleteState(entity->room);
|
entity->BroadcastDeleteState(entity->room);
|
||||||
entity->room->grid_service->DelCar((Car*)entity);
|
entity->room->grid_service->DelCar((Car*)entity);
|
||||||
entity->room->RemoveFromMoveableHash((Car*)entity);
|
entity->room->RemoveFromMoveableHash((Car*)entity);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user