This commit is contained in:
aozhiwei 2021-06-17 17:05:54 +08:00
parent 0686218ec3
commit 458c8c0d70
5 changed files with 33 additions and 5 deletions

View File

@ -338,6 +338,13 @@ enum ObstacleType_e
kObstacleAirDropBox = 8, kObstacleAirDropBox = 8,
}; };
enum OptResult
{
kOptPass = 0,
kOptContinue = 1,
kOptBreak = 2
};
const char* const PROJ_NAME_FMT = "game%d_gameserver"; const char* const PROJ_NAME_FMT = "game%d_gameserver";
const char* const PROJ_ROOT_FMT = "/data/logs/%s"; const char* const PROJ_ROOT_FMT = "/data/logs/%s";

View File

@ -93,7 +93,13 @@ float Human::GetSpeed()
return buff->meta->param2; return buff->meta->param2;
} }
} }
if (downed) { {
Buff* buff = GetBuffByEffectId(kBET_Sprint);
if (buff) {
return buff->meta->param2;
}
}
if (downed) {
return meta->i->move_speed3(); return meta->i->move_speed3();
} else { } else {
if (shot_hold) { if (shot_hold) {
@ -511,6 +517,13 @@ bool Human::IsCollisionInMapService()
) && ) &&
!obstacle->CanThroughable(this)) { !obstacle->CanThroughable(this)) {
if (last_collision_door_ != collider->owner) { if (last_collision_door_ != collider->owner) {
OptResult opt_result = kOptPass;
obstacle->OnCollisionTrigger(this, opt_result);
if (opt_result == kOptContinue) {
continue;
} else if (opt_result == kOptBreak) {
return true;
}
if (!obstacle->IsDead(room) && if (!obstacle->IsDead(room) &&
obstacle->Attackable() && obstacle->Attackable() &&
obstacle->meta->i->drop() != 0 && obstacle->meta->i->drop() != 0 &&
@ -1574,7 +1587,7 @@ void Human::FollowTarget(Human* target)
void Human::SendDebugMsg(const std::string& debug_msg) void Human::SendDebugMsg(const std::string& debug_msg)
{ {
cs::SMDebugMsg notify_msg; cs::SMDebugMsg notify_msg;
notify_msg.set_debug_msg(debug_msg); notify_msg.set_debug_msg(a8::TimestampToDateTime(time(nullptr)) + " " + debug_msg);
SendNotifyMsg(notify_msg); SendNotifyMsg(notify_msg);
} }

View File

@ -641,9 +641,14 @@ bool Obstacle::DoInteraction(Human* sender)
return false; return false;
} }
void Obstacle::OnCollisionTrigger(Creature* c) void Obstacle::OnCollisionTrigger(Creature* c, OptResult& opt_result)
{ {
opt_result = kOptPass;
if (meta->i->thing_type() == kObstacleSpring) {
AddObstacleBuff(c);
a8::SetBitFlag(c->status, CS_Collisioning);
opt_result = kOptBreak;
}
} }
void Obstacle::DoHideHouseInteraction(Human* sender) void Obstacle::DoHideHouseInteraction(Human* sender)

View File

@ -45,7 +45,7 @@ class Obstacle : public Entity
virtual bool CanThroughable(Creature* c); virtual bool CanThroughable(Creature* c);
virtual bool CanThroughable(Bullet* bullet); virtual bool CanThroughable(Bullet* bullet);
virtual bool DoInteraction(Human* sender); virtual bool DoInteraction(Human* sender);
virtual void OnCollisionTrigger(Creature* c); virtual void OnCollisionTrigger(Creature* c, OptResult& opt_result);
void Explosion(Bullet* bullet); void Explosion(Bullet* bullet);
void SetDoorInfo(Building* building, int door_id_x); void SetDoorInfo(Building* building, int door_id_x);
bool IsDoor(); bool IsDoor();

View File

@ -71,6 +71,9 @@ void Player::InternalUpdate(int delta_time)
if (HasSpecMove()) { if (HasSpecMove()) {
_UpdateSpecMove(); _UpdateSpecMove();
} else { } else {
if (HasBuffEffect(kBET_Sprint)) {
moving = true;
}
if (moving) { if (moving) {
UpdateMove(); UpdateMove();
} }