1
This commit is contained in:
parent
feaddff103
commit
cf1a03f5c8
@ -139,6 +139,9 @@ void Car::GetOn(Human* passenger)
|
|||||||
if (later_removed_) {
|
if (later_removed_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!CanOn(passenger)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (meta->_int_param2 <= 0) {
|
if (meta->_int_param2 <= 0) {
|
||||||
A8_ABORT();
|
A8_ABORT();
|
||||||
}
|
}
|
||||||
@ -577,3 +580,14 @@ void Car::Update(int delta_time)
|
|||||||
UpdateSkill();
|
UpdateSkill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Car::CanOn(Human* hum)
|
||||||
|
{
|
||||||
|
return special_operators_.empty() ||
|
||||||
|
special_operators_.find(hum->GetUniId()) != special_operators_.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Car::SetSpecialOperators(std::set<int>& special_operators)
|
||||||
|
{
|
||||||
|
special_operators_ = special_operators;
|
||||||
|
}
|
||||||
|
@ -49,6 +49,8 @@ class Car : public Creature
|
|||||||
void OnKillTarget(Creature* target);
|
void OnKillTarget(Creature* target);
|
||||||
void SetShotDir(const glm::vec3& dir) { curr_shot_dir_ = dir; };
|
void SetShotDir(const glm::vec3& dir) { curr_shot_dir_ = dir; };
|
||||||
bool IsSingle();
|
bool IsSingle();
|
||||||
|
bool CanOn(Human* hum);
|
||||||
|
void SetSpecialOperators(std::set<int>& special_operators);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int AllocSeat();
|
int AllocSeat();
|
||||||
@ -67,6 +69,7 @@ class Car : public Creature
|
|||||||
int cur_buff_idx_ = -1;
|
int cur_buff_idx_ = -1;
|
||||||
float cur_oil_ = 0;
|
float cur_oil_ = 0;
|
||||||
glm::vec3 curr_shot_dir_ = GlmHelper::ZERO;
|
glm::vec3 curr_shot_dir_ = GlmHelper::ZERO;
|
||||||
|
std::set<int> special_operators_;
|
||||||
|
|
||||||
friend class PBUtils;
|
friend class PBUtils;
|
||||||
};
|
};
|
||||||
|
@ -315,10 +315,11 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
|
|||||||
int car_uniid = room->AllocUniid();
|
int car_uniid = room->AllocUniid();
|
||||||
glm::vec3 pos = GetPos().ToGlmVec3();
|
glm::vec3 pos = GetPos().ToGlmVec3();
|
||||||
Car* c = room->CreateCar(nullptr,
|
Car* c = room->CreateCar(nullptr,
|
||||||
car_uniid,
|
car_uniid,
|
||||||
equip_meta,
|
equip_meta,
|
||||||
pos,
|
pos,
|
||||||
0);
|
0,
|
||||||
|
nullptr);
|
||||||
if (c) {
|
if (c) {
|
||||||
#if 0
|
#if 0
|
||||||
CarObject car;
|
CarObject car;
|
||||||
|
@ -2089,12 +2089,12 @@ void Human::DoGetOnWithLoot(Loot* entity)
|
|||||||
GetCar()->GetDown(this);
|
GetCar()->GetDown(this);
|
||||||
}
|
}
|
||||||
Car* car = room->CreateCar(
|
Car* car = room->CreateCar(
|
||||||
this,
|
this,
|
||||||
entity->GetUniId(),
|
entity->GetUniId(),
|
||||||
item_meta,
|
item_meta,
|
||||||
entity->GetPos().ToGlmVec3(),
|
entity->GetPos().ToGlmVec3(),
|
||||||
team_id
|
team_id,
|
||||||
);
|
nullptr);
|
||||||
car->GetOn(this);
|
car->GetOn(this);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
a8::XPrintf("DoGetOnWithLoot uniid:%d car_uniid:%d\n", {car->GetUniId(), car->car_uniid});
|
a8::XPrintf("DoGetOnWithLoot uniid:%d car_uniid:%d\n", {car->GetUniId(), car->car_uniid});
|
||||||
|
@ -702,7 +702,8 @@ Car* Room::CreateCar(Human* driver,
|
|||||||
int car_uniid,
|
int car_uniid,
|
||||||
const mt::Equip* item_meta,
|
const mt::Equip* item_meta,
|
||||||
const glm::vec3& pos,
|
const glm::vec3& pos,
|
||||||
int team_id)
|
int team_id,
|
||||||
|
std::set<int>* special_operators)
|
||||||
{
|
{
|
||||||
Car* car = EntityFactory::Instance()->MakeCar(AllocUniid());
|
Car* car = EntityFactory::Instance()->MakeCar(AllocUniid());
|
||||||
car->car_uniid = car_uniid;
|
car->car_uniid = car_uniid;
|
||||||
@ -711,6 +712,9 @@ Car* Room::CreateCar(Human* driver,
|
|||||||
car->team_id = team_id;
|
car->team_id = team_id;
|
||||||
car->GetMutablePos().FromGlmVec3(pos);
|
car->GetMutablePos().FromGlmVec3(pos);
|
||||||
car->SetAttackDir(GlmHelper::DONW);
|
car->SetAttackDir(GlmHelper::DONW);
|
||||||
|
if (special_operators) {
|
||||||
|
car->SetSpecialOperators(*special_operators);
|
||||||
|
}
|
||||||
car->Initialize();
|
car->Initialize();
|
||||||
AddToEntityHash(car);
|
AddToEntityHash(car);
|
||||||
AddToMoveableHash(car);
|
AddToMoveableHash(car);
|
||||||
@ -3008,7 +3012,8 @@ void Room::CreateWorldObjects()
|
|||||||
car_uniid,
|
car_uniid,
|
||||||
equip_meta,
|
equip_meta,
|
||||||
pos,
|
pos,
|
||||||
0);
|
0,
|
||||||
|
nullptr);
|
||||||
if (c) {
|
if (c) {
|
||||||
CarObject car;
|
CarObject car;
|
||||||
car.car_id = equip_meta->id();
|
car.car_id = equip_meta->id();
|
||||||
|
@ -172,7 +172,8 @@ public:
|
|||||||
int car_uniid,
|
int car_uniid,
|
||||||
const mt::Equip* meta,
|
const mt::Equip* meta,
|
||||||
const glm::vec3& pos,
|
const glm::vec3& pos,
|
||||||
int team_id);
|
int team_id,
|
||||||
|
std::set<int>* special_operators);
|
||||||
Hero* CreateHero(Creature* master,
|
Hero* CreateHero(Creature* master,
|
||||||
const mt::Hero* meta,
|
const mt::Hero* meta,
|
||||||
const glm::vec3& pos,
|
const glm::vec3& pos,
|
||||||
|
@ -510,6 +510,7 @@ message MFCarFull
|
|||||||
repeated MFEffect effect_list = 18; //特效列表
|
repeated MFEffect effect_list = 18; //特效列表
|
||||||
optional int32 team_id = 19; //队伍id
|
optional int32 team_id = 19; //队伍id
|
||||||
repeated MFSkill skill_list = 20; //技能列表
|
repeated MFSkill skill_list = 20; //技能列表
|
||||||
|
repeated int32 special_operators = 21; //指定能上载具的玩家uniid,空的话则不限
|
||||||
/*
|
/*
|
||||||
乘客列表(包含驾驶员)
|
乘客列表(包含驾驶员)
|
||||||
!!!注意这里只返回客户端必要的用于显示玩家外观的信息而不是全量信息
|
!!!注意这里只返回客户端必要的用于显示玩家外观的信息而不是全量信息
|
||||||
|
Loading…
x
Reference in New Issue
Block a user