This commit is contained in:
aozhiwei 2021-04-02 10:00:29 +08:00
parent e07988c0ce
commit 537230305a
5 changed files with 64 additions and 33 deletions

View File

@ -110,7 +110,7 @@ float Human::GetSpeed()
float speed = meta->i->move_speed(); float speed = meta->i->move_speed();
speed = (speed + GetBuffAttrAbs(kHAT_Speed)) * (1 + GetBuffAttrRate(kHAT_Speed)); speed = (speed + GetBuffAttrAbs(kHAT_Speed)) * (1 + GetBuffAttrRate(kHAT_Speed));
if (a8::HasBitFlag(cell_flags_, kColliderTag_Water)) { if (a8::HasBitFlag(cell_flags_, kColliderTag_Water)) {
speed *= 0.5f; speed *= MetaMgr::Instance()->water_move_coefficient;
} }
return std::max(speed, 1.0f); return std::max(speed, 1.0f);
} }
@ -734,6 +734,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
room->CheckPartObjects(); room->CheckPartObjects();
#endif #endif
if (!dead && !room->IsGameOver() && !real_dead) { if (!dead && !room->IsGameOver() && !real_dead) {
cs::SMRollMsg roll_msg;
lethal_weapon = weapon_id; lethal_weapon = weapon_id;
Entity* hum = room->GetEntityByUniId(killer_id); Entity* hum = room->GetEntityByUniId(killer_id);
if (hum && hum->IsEntityType(ET_Player)) { if (hum && hum->IsEntityType(ET_Player)) {
@ -742,7 +743,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
{ {
killer_name, killer_name,
}); });
SendRollMsg(msg); SendRollMsg(roll_msg);
} else { } else {
((Human*)hum)->stats.kills++; ((Human*)hum)->stats.kills++;
((Human*)hum)->stats.last_kill_frameno = room->GetFrameNo(); ((Human*)hum)->stats.last_kill_frameno = room->GetFrameNo();
@ -754,7 +755,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
killer_name, killer_name,
name name
}); });
SendRollMsg(msg); SendRollMsg(roll_msg);
} else { } else {
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon_id); MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon_id);
if (equip_meta) { if (equip_meta) {
@ -764,7 +765,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
equip_meta->i->name(), equip_meta->i->name(),
name name
}); });
SendRollMsg(msg); SendRollMsg(roll_msg);
} }
} }
} }
@ -776,7 +777,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
{ {
name name
}); });
SendRollMsg(msg); SendRollMsg(roll_msg);
} }
break; break;
case VW_Spectate: case VW_Spectate:
@ -785,7 +786,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
{ {
name name
}); });
SendRollMsg(msg); SendRollMsg(roll_msg);
} }
break; break;
case VW_SelfDetonate: case VW_SelfDetonate:
@ -794,7 +795,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
{ {
name name
}); });
SendRollMsg(msg); SendRollMsg(roll_msg);
} }
break; break;
case VW_Mine: case VW_Mine:
@ -803,7 +804,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
{ {
name name
}); });
SendRollMsg(msg); SendRollMsg(roll_msg);
} }
break; break;
} }
@ -1502,30 +1503,37 @@ void Human::SendDebugMsg(const std::string& debug_msg)
SendNotifyMsg(notify_msg); SendNotifyMsg(notify_msg);
} }
void Human::SendRollMsg(const std::string& roll_msg) void Human::SendRollMsg(const cs::SMRollMsg& msg)
{ {
room->xtimer.AddDeadLineTimerAndAttach( cs::SMRollMsg* msg_copy = new cs::SMRollMsg;
0, *msg_copy = msg;
a8::XParams() room->xtimer.AddDeadLineTimerAndAttach
.SetSender(this) (
.SetParam1(roll_msg), 0,
[] (const a8::XParams& param) a8::XParams()
{ .SetSender(this)
Human* target = (Human*)param.sender.GetUserData(); .SetParam1(msg_copy),
std::string roll_msg = param.param1; [] (const a8::XParams& param)
target->room->TouchHumanList(a8::XParams(), {
[target, roll_msg] (Human* hum, a8::XParams& param) -> bool Human* target = (Human*)param.sender.GetUserData();
{ cs::SMRollMsg* msg = (cs::SMRollMsg*)param.param1.GetUserData();
if (target != hum) { target->room->TouchPlayerList
cs::SMRollMsg msg; (a8::XParams(),
msg.set_msg(roll_msg); [target, msg] (Human* hum, a8::XParams& param) -> bool
hum->SendNotifyMsg(msg); {
} if (target != hum) {
return true; hum->SendNotifyMsg(*msg);
}); }
}, return true;
&xtimer_attacher.timer_list_ });
); },
&xtimer_attacher.timer_list_,
[] (const a8::XParams& param)
{
cs::SMRollMsg* msg = (cs::SMRollMsg*)param.param1.GetUserData();
delete msg;
}
);
} }
void Human::UpdateAction() void Human::UpdateAction()

View File

@ -199,7 +199,7 @@ class Human : public Creature
void SendGameOver(); void SendGameOver();
void FollowTarget(Human* target); void FollowTarget(Human* target);
virtual void SendDebugMsg(const std::string& debug_msg) override; virtual void SendDebugMsg(const std::string& debug_msg) override;
void SendRollMsg(const std::string& roll_msg); void SendRollMsg(const cs::SMRollMsg& msg);
void UpdateAction(); void UpdateAction();
void SendUIUpdate(); void SendUIUpdate();
void SendWxVoip(); void SendWxVoip();

View File

@ -232,6 +232,7 @@ public:
METAMGR_READ(level0room_robot_protect_time, 60); METAMGR_READ(level0room_robot_protect_time, 60);
METAMGR_READ(level0room_robot_autodie_time, 10); METAMGR_READ(level0room_robot_autodie_time, 10);
METAMGR_READ(level0room_robot_autodie_distance, 500); METAMGR_READ(level0room_robot_autodie_distance, 500);
METAMGR_READ(water_move_coefficient, 0.75);
{ {
METAMGR_READ_STR(level0room_spec_things, ""); METAMGR_READ_STR(level0room_spec_things, "");
std::vector<std::string> tmpstrings; std::vector<std::string> tmpstrings;

View File

@ -134,6 +134,7 @@ class MetaMgr : public a8::Singleton<MetaMgr>
float water_invisible_time = 0.5; float water_invisible_time = 0.5;
float water_show_time = 0.5f; float water_show_time = 0.5f;
float water_invisible_time2 = 2.0f; float water_invisible_time2 = 2.0f;
double water_move_coefficient = 0.75f;
float ice_invisible_time = 0.5; float ice_invisible_time = 0.5;
float ice_show_time = 0.5f; float ice_show_time = 0.5f;
float ice_invisible_time2 = 2.0f; float ice_invisible_time2 = 2.0f;

View File

@ -318,6 +318,8 @@ message MFLootFull
{ {
optional int32 obj_uniid = 1; //id optional int32 obj_uniid = 1; //id
optional MFVec2 pos = 2; // optional MFVec2 pos = 2; //
optional MFVec2 born_pos = 3; //
optional bool drop_at_thisframe = 4; //
optional int32 item_id = 6; //id optional int32 item_id = 6; //id
optional int32 count = 7; // optional int32 count = 7; //
@ -749,6 +751,25 @@ message MFSkill
optional int32 cd_time = 3; //cd时间() optional int32 cd_time = 3; //cd时间()
} }
message TextElement
{
optional string text = 1; //
optional int32 color = 2; //rgb
}
message ImageElement
{
optional int32 id = 1; //id
}
message RichTextElement
{
//1:TextElement 2:ImageElement
optional int32 element_type = 1; //
optional TextElement union_obj_1 = 2; //
optional ImageElement union_obj_2 = 3; //
}
//end mfmsg //end mfmsg
// //
@ -1010,7 +1031,7 @@ message SMUpdate
// //
message SMRollMsg message SMRollMsg
{ {
optional string msg = 6; // repeated RichTextElement elements = 1; //
} }
// //