21.箱子无法被触碰爆开,仅可被枪械攻击或手动打开

This commit is contained in:
aozhiwei 2021-06-18 11:37:17 +08:00
parent e93f8c9bfc
commit f1cd20be5a
6 changed files with 20 additions and 1 deletions

View File

@ -75,6 +75,7 @@ void Car::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data)
p->set_max_health(GetMaxHP()); p->set_max_health(GetMaxHP());
p->set_oil(cur_oil_); p->set_oil(cur_oil_);
p->set_max_oil(meta->i->max_oil()); p->set_max_oil(meta->i->max_oil());
p->set_bullet_num(weapons[GUN_SLOT1].ammo);
FillBuffList(hum, p->mutable_buff_list()); FillBuffList(hum, p->mutable_buff_list());
} }

View File

@ -157,9 +157,17 @@ bool Hero::IsCollisionInMapService()
) )
) { ) {
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 &&
obstacle->IsTouchInteraction() &&
room->GetGasData().gas_mode != GasInactive && room->GetGasData().gas_mode != GasInactive &&
(!obstacle->IsTerminatorAirDropBox(room)) (!obstacle->IsTerminatorAirDropBox(room))
) { ) {

View File

@ -527,6 +527,7 @@ bool Human::IsCollisionInMapService()
if (!obstacle->IsDead(room) && if (!obstacle->IsDead(room) &&
obstacle->Attackable() && obstacle->Attackable() &&
obstacle->meta->i->drop() != 0 && obstacle->meta->i->drop() != 0 &&
obstacle->IsTouchInteraction() &&
room->GetGasData().gas_mode != GasInactive && room->GetGasData().gas_mode != GasInactive &&
(!obstacle->IsTerminatorAirDropBox(room) || GetRace() == kHumanRace) (!obstacle->IsTerminatorAirDropBox(room) || GetRace() == kHumanRace)
) { ) {

View File

@ -639,6 +639,10 @@ bool Obstacle::DoInteraction(Human* sender)
break; break;
default: default:
{ {
if (!IsDead(sender->room) && IsOpenInteraction()) {
Die(sender->room);
BroadcastFullState(sender->room);
}
} }
break; break;
} }
@ -736,3 +740,8 @@ bool Obstacle::IsTouchInteraction()
{ {
return meta->i->interaction_mode() == 1; return meta->i->interaction_mode() == 1;
} }
bool Obstacle::IsOpenInteraction()
{
return meta->i->interaction_mode() == 2;
}

View File

@ -68,6 +68,7 @@ class Obstacle : public Entity
bool Attackable(); bool Attackable();
bool Throughable(); bool Throughable();
bool IsTouchInteraction(); bool IsTouchInteraction();
bool IsOpenInteraction();
protected: protected:
Obstacle(); Obstacle();

View File

@ -667,7 +667,6 @@ void Player::LootInteraction(Loot* entity)
case IS_C4: case IS_C4:
case IS_SHIELD_WALL: case IS_SHIELD_WALL:
case IS_SINGAL_GUN: case IS_SINGAL_GUN:
case IS_SHEN_BAO:
case IS_OIL_BUCKET: case IS_OIL_BUCKET:
{ {
Weapon* weapon = &weapons[SPEC3_SLOT_BEGIN + Weapon* weapon = &weapons[SPEC3_SLOT_BEGIN +