1
This commit is contained in:
parent
40fb1b60ad
commit
ecce9ffa0a
@ -1274,7 +1274,7 @@ void Room::InitAirDrop()
|
|||||||
void Room::AirDrop(int appear_time, int box_id)
|
void Room::AirDrop(int appear_time, int box_id)
|
||||||
{
|
{
|
||||||
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(box_id);
|
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(box_id);
|
||||||
if (thing_meta) {
|
if (thing_meta && thing_meta->i->type() == 2) {
|
||||||
a8::Vec2 dir = a8::Vec2::UP;
|
a8::Vec2 dir = a8::Vec2::UP;
|
||||||
dir.Rotate(a8::RandAngle());
|
dir.Rotate(a8::RandAngle());
|
||||||
a8::Vec2 box_pos = gas_data.pos_new + dir * (500 + rand() % 300);
|
a8::Vec2 box_pos = gas_data.pos_new + dir * (500 + rand() % 300);
|
||||||
@ -1305,6 +1305,13 @@ void Room::AirDrop(int appear_time, int box_id)
|
|||||||
box_pos.x = new_x;
|
box_pos.x = new_x;
|
||||||
box_pos.y = new_y;
|
box_pos.y = new_y;
|
||||||
}
|
}
|
||||||
|
if (box_pos.x + thing_meta->i->width()/2 + 2 > map_meta->i->map_width() ||
|
||||||
|
box_pos.x - thing_meta->i->width()/2 - 2 < 1 ||
|
||||||
|
box_pos.y + thing_meta->i->height()/2 + 2 > map_meta->i->map_height() ||
|
||||||
|
box_pos.y - thing_meta->i->height()/2 - 2 < 1
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
frame_event.AddAirDrop(appear_time, box_id, box_pos);
|
frame_event.AddAirDrop(appear_time, box_id, box_pos);
|
||||||
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * appear_time / 1000.f,
|
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * appear_time / 1000.f,
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user