This commit is contained in:
aozhiwei 2021-06-15 22:11:49 +08:00
parent a3b6a8fbbb
commit 58dc4db50b
8 changed files with 91 additions and 1 deletions

View File

@ -149,12 +149,17 @@ void Bullet::ProcBomb()
ProcC4Bomb(delay_time);
}
break;
case IS_SINGAL_GUN:
{
ProcSignalGunBomb(delay_time);
}
default:
{
}
break;
}
room->RemoveObjectLater(this);
later_removed_ = true;
}
void Bullet::ProcSmokeBomb()
@ -203,11 +208,15 @@ bool Bullet::IsBomb()
meta->i->_inventory_slot() == IS_SMOKE ||
meta->i->_inventory_slot() == IS_POSION_GAS_BOMB ||
meta->i->_inventory_slot() == IS_MOLOTOR_COCKTAIL ||
meta->i->_inventory_slot() == IS_C4;
meta->i->_inventory_slot() == IS_C4 ||
meta->i->_inventory_slot() == IS_SINGAL_GUN;
}
void Bullet::MapServiceUpdate()
{
if (later_removed_) {
return;
}
if (sender.Get()) {
SetPos(GetPos() + dir * gun_meta->i->bullet_speed() / (float)SERVER_FRAME_RATE);
float distance = (GetPos() - born_pos).Norm();
@ -218,6 +227,7 @@ void Bullet::MapServiceUpdate()
Check(distance);
if (!later_removed_) {
room->RemoveObjectLater(this);
later_removed_ = true;
}
}
} else {
@ -380,3 +390,20 @@ void Bullet::ProcC4Bomb(int delay_time)
);
}
}
void Bullet::ProcSignalGunBomb(int delay_time)
{
printf("%d xxxxxx\n",this);
if (sender.Get()) {
a8::Vec2 old_buff_vec2_param1 = sender.Get()->buff_vec2_param1;
sender.Get()->buff_vec2_param1 = GetPos();
MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(gun_meta->i->buffid());
if (buff_meta) {
sender.Get()->AddBuff(sender.Get(),
buff_meta,
1
);
}
sender.Get()->buff_vec2_param1 = old_buff_vec2_param1;
}
}

View File

@ -50,6 +50,7 @@ protected:
void ProcPosionGasBomb(int delay_time);
void ProcMolotorCocktailBomb(int delay_time);
void ProcC4Bomb(int delay_time);
void ProcSignalGunBomb(int delay_time);
inline void MapServiceUpdate();
void Check(float distance);

View File

@ -335,6 +335,7 @@ enum ObstacleType_e
kObstacleSpring = 5,
kObstacleHideHouse = 6,
kObstacleGully = 7,
kObstacleAirDropBox = 8,
};
const char* const PROJ_NAME_FMT = "game%d_gameserver";

View File

@ -155,6 +155,14 @@ namespace MetaData
a8::SetBitFlag(receive_special_damage_type, n);
}
}
{
int_param1 = a8::XValue(i->param1());
float_param1 = a8::XValue(i->param1()).GetDouble();
}
{
int_param2 = a8::XValue(i->param2());
float_param2 = a8::XValue(i->param2()).GetDouble();
}
}
void Equip::Init()

View File

@ -47,6 +47,10 @@ namespace MetaData
std::vector<int> airdrop_mon_list;
long long special_damage_type = 0;
long long receive_special_damage_type = 0;
int int_param1 = 0;
float float_param1 = 0;
int int_param2 = 0;
float float_param2 = 0;
void Init();
};

View File

@ -364,6 +364,11 @@ void RoomObstacle::Active()
ActiveGully();
}
break;
case kObstacleAirDropBox:
{
ActiveAirDrop();
}
break;
default:
{
}
@ -506,6 +511,36 @@ void RoomObstacle::ActiveGully()
}
void RoomObstacle::ActiveAirDrop()
{
room->xtimer.AddDeadLineTimerAndAttach
(
meta->int_param2 / FRAME_RATE_MS,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->SummonAirDropBox(obstacle->meta->int_param1);
},
&xtimer_attacher.timer_list_
);
room->xtimer.AddDeadLineTimerAndAttach
(
meta->int_param2 / FRAME_RATE_MS * 1,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->room->frame_event.AddAirDrop(obstacle->meta->int_param2 / 1000,
obstacle->meta->int_param1,
obstacle->GetPos());
},
&xtimer_attacher.timer_list_
);
}
bool RoomObstacle::DoInteraction(Human* sender)
{
if (Obstacle::DoInteraction(sender)) {
@ -514,3 +549,12 @@ bool RoomObstacle::DoInteraction(Human* sender)
return true;
}
void RoomObstacle::SummonAirDropBox(int box_id)
{
RoomObstacle* obstacle = room->CreateObstacle
(
box_id,
GetPos().x,
GetPos().y
);
}

View File

@ -35,6 +35,9 @@ private:
void ActiveSpring();
void ActiveHideHouse();
void ActiveGully();
void ActiveAirDrop();
void SummonAirDropBox(int box_id);
protected:
bool temp_through_ = false;

View File

@ -64,6 +64,8 @@ message MapThing
optional string monster_list = 21;
optional string special_damage_type = 22;
optional string receive_special_damage_type = 23;
optional string param1 = 24;
optional string param2 = 25;
}
message SafeArea