添加新手战前准备时间

This commit is contained in:
aozhiwei 2020-05-21 13:58:50 +08:00
parent b22f82c0e3
commit 708de1c826
5 changed files with 15 additions and 4 deletions

View File

@ -1364,7 +1364,7 @@ void Human::FillMFGasData(cs::MFGasData* gas_data)
{ {
gas_data->set_mode(room->gas_data.gas_mode); gas_data->set_mode(room->gas_data.gas_mode);
if (room->gas_data.gas_mode == GasInactive) { if (room->gas_data.gas_mode == GasInactive) {
long long duration = MetaMgr::Instance()->gas_inactive_time * SERVER_FRAME_RATE - long long duration = room->GetGasInactiveTime() * SERVER_FRAME_RATE -
(room->frame_no - room->gas_data.gas_start_frameno); (room->frame_no - room->gas_data.gas_start_frameno);
gas_data->set_duration(std::max(duration * 50, (long long)1000) / 1000); gas_data->set_duration(std::max(duration * 50, (long long)1000) / 1000);
} else if (room->gas_data.gas_mode == GasJump) { } else if (room->gas_data.gas_mode == GasJump) {

View File

@ -128,6 +128,7 @@ public:
#if 1 #if 1
{ {
MetaMgr::Instance()->gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("gas_inactive_time"); MetaMgr::Instance()->gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("gas_inactive_time");
MetaMgr::Instance()->newbie_gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("newbie_gas_inactive_time", 10);
MetaMgr::Instance()->newbie_wait_time = MetaMgr::Instance()->GetSysParamAsInt("newbie_wait_time", 10); MetaMgr::Instance()->newbie_wait_time = MetaMgr::Instance()->GetSysParamAsInt("newbie_wait_time", 10);
MetaMgr::Instance()->jump_time = MetaMgr::Instance()->GetSysParamAsFloat("jump_time"); MetaMgr::Instance()->jump_time = MetaMgr::Instance()->GetSysParamAsFloat("jump_time");
MetaMgr::Instance()->K = MetaMgr::Instance()->GetSysParamAsFloat("K"); MetaMgr::Instance()->K = MetaMgr::Instance()->GetSysParamAsFloat("K");

View File

@ -47,6 +47,7 @@ class MetaMgr : public a8::Singleton<MetaMgr>
MetaData::Robot* GetRobot(int robot_id); MetaData::Robot* GetRobot(int robot_id);
int gas_inactive_time = 10; int gas_inactive_time = 10;
int newbie_gas_inactive_time = 10;
int newbie_wait_time = 10; int newbie_wait_time = 10;
int jump_time = 10; int jump_time = 10;
float K = 100.0f; float K = 100.0f;

View File

@ -598,7 +598,7 @@ bool Room::CanJoin(const std::string& accountid, RoomType_e self_room_type)
return false; return false;
} }
if (self_room_type == RT_NewBrid) { if (self_room_type == RT_NewBrid) {
int remain_time_ms = MetaMgr::Instance()->gas_inactive_time * 1000 - int remain_time_ms = GetGasInactiveTime() * 1000 -
(frame_no - gas_data.gas_start_frameno) * FRAME_RATE_MS; (frame_no - gas_data.gas_start_frameno) * FRAME_RATE_MS;
remain_time_ms = std::max(remain_time_ms, 0); remain_time_ms = std::max(remain_time_ms, 0);
if (remain_time_ms <= MetaMgr::Instance()->newbie_wait_time * 1000) { if (remain_time_ms <= MetaMgr::Instance()->newbie_wait_time * 1000) {
@ -840,8 +840,7 @@ void Room::UpdateGas()
void Room::UpdateGasInactive() void Room::UpdateGasInactive()
{ {
if (frame_no - gas_data.gas_start_frameno >= if (frame_no - gas_data.gas_start_frameno >= GetGasInactiveTime() * SERVER_FRAME_RATE) {
MetaMgr::Instance()->gas_inactive_time * SERVER_FRAME_RATE) {
gas_data.gas_mode = GasWaiting; gas_data.gas_mode = GasWaiting;
gas_data.old_area_meta = MetaMgr::Instance()->GetSafeArea(30001); gas_data.old_area_meta = MetaMgr::Instance()->GetSafeArea(30001);
gas_data.new_area_meta = MetaMgr::Instance()->GetSafeArea(30002); gas_data.new_area_meta = MetaMgr::Instance()->GetSafeArea(30002);
@ -1597,3 +1596,12 @@ ObstacleData* Room::GetPermanentObstacleData(int entity_uniid)
return nullptr; return nullptr;
} }
} }
long long Room::GetGasInactiveTime()
{
if (room_type == RT_NewBrid) {
return MetaMgr::Instance()->newbie_gas_inactive_time;
} else {
return MetaMgr::Instance()->gas_inactive_time;
}
}

View File

@ -113,6 +113,7 @@ public:
int CreateAndTakeonCar(int car_id, a8::Vec2 pos); int CreateAndTakeonCar(int car_id, a8::Vec2 pos);
bool HaveMyTeam(const std::string& team_uuid); bool HaveMyTeam(const std::string& team_uuid);
ObstacleData* GetPermanentObstacleData(int entity_uniid); ObstacleData* GetPermanentObstacleData(int entity_uniid);
long long GetGasInactiveTime();
private: private:
int AllocUniid(); int AllocUniid();