空袭添加多炸弹支持

This commit is contained in:
aozhiwei 2021-10-25 15:57:59 +08:00
parent 1bdeb6e6ff
commit 55fca6a011
4 changed files with 18 additions and 12 deletions

View File

@ -794,6 +794,13 @@ namespace MetaData
void AirRaid::Init()
{
{
std::vector<std::string> strings;
a8::Split(i->bomb_id(), strings, '|');
for (auto& str : strings) {
bomb_ids.push_back(a8::XValue(str));
}
}
{
std::vector<std::string> strings;
a8::Split(i->raid_wave(), strings, '|');

View File

@ -199,6 +199,7 @@ namespace MetaData
{
const metatable::AirRaid* i = nullptr;
std::vector<std::tuple<int, int>> raid_waves;
std::vector<int> bomb_ids;
void Init();
};

View File

@ -3790,10 +3790,6 @@ void Room::AirRaid(int airraid_id)
if (!raid_meta) {
return;
}
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(raid_meta->i->bomb_id());
if (!thing_meta) {
return;
}
a8::Vec2 dir = a8::Vec2::UP;
dir.Rotate(a8::RandAngle());
float rnd_rad = gas_data_.new_area_meta->i->rad() > 0 ? rand() % gas_data_.new_area_meta->i->rad() : 0;
@ -3838,13 +3834,15 @@ void Room::AirRaid(int airraid_id)
dir.Rotate(a8::RandAngle());
a8::Vec2 pos = center + dir * (50 + rand() % 100);
if (room->grid_service->CanAdd(pos.x, pos.y)) {
RoomObstacle* obstacle = room->CreateObstacle
(
raid_meta->i->bomb_id(),
pos.x,
pos.y
);
obstacle->Active();
for (auto bomb_id : raid_meta->bomb_ids) {
RoomObstacle* obstacle = room->CreateObstacle
(
bomb_id,
pos.x,
pos.y
);
obstacle->Active();
}
}
};
Room* room = (Room*)param.sender.GetUserData();

View File

@ -333,7 +333,7 @@ message AirRaid
optional int32 id = 1;
optional int32 time = 2;
optional int32 appear_time = 3;
optional int32 bomb_id = 4;
optional string bomb_id = 4;
optional string raid_wave = 5;
optional float rad = 6;
}