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();
speed = (speed + GetBuffAttrAbs(kHAT_Speed)) * (1 + GetBuffAttrRate(kHAT_Speed));
if (a8::HasBitFlag(cell_flags_, kColliderTag_Water)) {
speed *= 0.5f;
speed *= MetaMgr::Instance()->water_move_coefficient;
}
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();
#endif
if (!dead && !room->IsGameOver() && !real_dead) {
cs::SMRollMsg roll_msg;
lethal_weapon = weapon_id;
Entity* hum = room->GetEntityByUniId(killer_id);
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,
});
SendRollMsg(msg);
SendRollMsg(roll_msg);
} else {
((Human*)hum)->stats.kills++;
((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,
name
});
SendRollMsg(msg);
SendRollMsg(roll_msg);
} else {
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon_id);
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(),
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
});
SendRollMsg(msg);
SendRollMsg(roll_msg);
}
break;
case VW_Spectate:
@ -785,7 +786,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
{
name
});
SendRollMsg(msg);
SendRollMsg(roll_msg);
}
break;
case VW_SelfDetonate:
@ -794,7 +795,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
{
name
});
SendRollMsg(msg);
SendRollMsg(roll_msg);
}
break;
case VW_Mine:
@ -803,7 +804,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
{
name
});
SendRollMsg(msg);
SendRollMsg(roll_msg);
}
break;
}
@ -1502,30 +1503,37 @@ void Human::SendDebugMsg(const std::string& debug_msg)
SendNotifyMsg(notify_msg);
}
void Human::SendRollMsg(const std::string& roll_msg)
void Human::SendRollMsg(const cs::SMRollMsg& msg)
{
room->xtimer.AddDeadLineTimerAndAttach(
0,
a8::XParams()
.SetSender(this)
.SetParam1(roll_msg),
[] (const a8::XParams& param)
{
Human* target = (Human*)param.sender.GetUserData();
std::string roll_msg = param.param1;
target->room->TouchHumanList(a8::XParams(),
[target, roll_msg] (Human* hum, a8::XParams& param) -> bool
{
if (target != hum) {
cs::SMRollMsg msg;
msg.set_msg(roll_msg);
hum->SendNotifyMsg(msg);
}
return true;
});
},
&xtimer_attacher.timer_list_
);
cs::SMRollMsg* msg_copy = new cs::SMRollMsg;
*msg_copy = msg;
room->xtimer.AddDeadLineTimerAndAttach
(
0,
a8::XParams()
.SetSender(this)
.SetParam1(msg_copy),
[] (const a8::XParams& param)
{
Human* target = (Human*)param.sender.GetUserData();
cs::SMRollMsg* msg = (cs::SMRollMsg*)param.param1.GetUserData();
target->room->TouchPlayerList
(a8::XParams(),
[target, msg] (Human* hum, a8::XParams& param) -> bool
{
if (target != hum) {
hum->SendNotifyMsg(*msg);
}
return true;
});
},
&xtimer_attacher.timer_list_,
[] (const a8::XParams& param)
{
cs::SMRollMsg* msg = (cs::SMRollMsg*)param.param1.GetUserData();
delete msg;
}
);
}
void Human::UpdateAction()

View File

@ -199,7 +199,7 @@ class Human : public Creature
void SendGameOver();
void FollowTarget(Human* target);
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 SendUIUpdate();
void SendWxVoip();

View File

@ -232,6 +232,7 @@ public:
METAMGR_READ(level0room_robot_protect_time, 60);
METAMGR_READ(level0room_robot_autodie_time, 10);
METAMGR_READ(level0room_robot_autodie_distance, 500);
METAMGR_READ(water_move_coefficient, 0.75);
{
METAMGR_READ_STR(level0room_spec_things, "");
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_show_time = 0.5f;
float water_invisible_time2 = 2.0f;
double water_move_coefficient = 0.75f;
float ice_invisible_time = 0.5;
float ice_show_time = 0.5f;
float ice_invisible_time2 = 2.0f;

View File

@ -318,6 +318,8 @@ message MFLootFull
{
optional int32 obj_uniid = 1; //id
optional MFVec2 pos = 2; //
optional MFVec2 born_pos = 3; //
optional bool drop_at_thisframe = 4; //
optional int32 item_id = 6; //id
optional int32 count = 7; //
@ -749,6 +751,25 @@ message MFSkill
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
//
@ -1010,7 +1031,7 @@ message SMUpdate
//
message SMRollMsg
{
optional string msg = 6; //
repeated RichTextElement elements = 1; //
}
//