空袭添加多炸弹支持
This commit is contained in:
parent
1bdeb6e6ff
commit
55fca6a011
@ -794,6 +794,13 @@ namespace MetaData
|
|||||||
|
|
||||||
void AirRaid::Init()
|
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;
|
std::vector<std::string> strings;
|
||||||
a8::Split(i->raid_wave(), strings, '|');
|
a8::Split(i->raid_wave(), strings, '|');
|
||||||
|
@ -199,6 +199,7 @@ namespace MetaData
|
|||||||
{
|
{
|
||||||
const metatable::AirRaid* i = nullptr;
|
const metatable::AirRaid* i = nullptr;
|
||||||
std::vector<std::tuple<int, int>> raid_waves;
|
std::vector<std::tuple<int, int>> raid_waves;
|
||||||
|
std::vector<int> bomb_ids;
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
};
|
};
|
||||||
|
@ -3790,10 +3790,6 @@ void Room::AirRaid(int airraid_id)
|
|||||||
if (!raid_meta) {
|
if (!raid_meta) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(raid_meta->i->bomb_id());
|
|
||||||
if (!thing_meta) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
a8::Vec2 dir = a8::Vec2::UP;
|
a8::Vec2 dir = a8::Vec2::UP;
|
||||||
dir.Rotate(a8::RandAngle());
|
dir.Rotate(a8::RandAngle());
|
||||||
float rnd_rad = gas_data_.new_area_meta->i->rad() > 0 ? rand() % gas_data_.new_area_meta->i->rad() : 0;
|
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());
|
dir.Rotate(a8::RandAngle());
|
||||||
a8::Vec2 pos = center + dir * (50 + rand() % 100);
|
a8::Vec2 pos = center + dir * (50 + rand() % 100);
|
||||||
if (room->grid_service->CanAdd(pos.x, pos.y)) {
|
if (room->grid_service->CanAdd(pos.x, pos.y)) {
|
||||||
RoomObstacle* obstacle = room->CreateObstacle
|
for (auto bomb_id : raid_meta->bomb_ids) {
|
||||||
(
|
RoomObstacle* obstacle = room->CreateObstacle
|
||||||
raid_meta->i->bomb_id(),
|
(
|
||||||
pos.x,
|
bomb_id,
|
||||||
pos.y
|
pos.x,
|
||||||
);
|
pos.y
|
||||||
obstacle->Active();
|
);
|
||||||
|
obstacle->Active();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Room* room = (Room*)param.sender.GetUserData();
|
Room* room = (Room*)param.sender.GetUserData();
|
||||||
|
@ -333,7 +333,7 @@ message AirRaid
|
|||||||
optional int32 id = 1;
|
optional int32 id = 1;
|
||||||
optional int32 time = 2;
|
optional int32 time = 2;
|
||||||
optional int32 appear_time = 3;
|
optional int32 appear_time = 3;
|
||||||
optional int32 bomb_id = 4;
|
optional string bomb_id = 4;
|
||||||
optional string raid_wave = 5;
|
optional string raid_wave = 5;
|
||||||
optional float rad = 6;
|
optional float rad = 6;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user