1
This commit is contained in:
parent
a1dafd094f
commit
f987ab039a
@ -669,31 +669,37 @@ bool Obstacle::DoInteraction(Human* sender)
|
||||
|
||||
int Obstacle::OnCollisionTrigger(Creature* c, ColliderComponent* collider)
|
||||
{
|
||||
return 0;
|
||||
#if 0
|
||||
opt_result = kOptPass;
|
||||
switch (meta->i->thing_type()) {
|
||||
case kObstacleSpring:
|
||||
if (IsDead(c->room)) {
|
||||
return 0;
|
||||
}
|
||||
switch (meta->i->collision_hit()) {
|
||||
case kCollisionHitPass:
|
||||
{
|
||||
if (c->IsHuman()) {
|
||||
if (!c->AsHuman()->GetCar()) {
|
||||
AddObstacleBuff(c);
|
||||
a8::SetBitFlag(c->status, CS_Collisioning);
|
||||
opt_result = kOptBreak;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case kCollisionHitBlock:
|
||||
{
|
||||
Global::last_collider = collider;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case kCollisionHitDeadAndDrop:
|
||||
{
|
||||
if (c->room->GetGasData().gas_mode != GasInactive &&
|
||||
meta->i->drop() != 0 &&
|
||||
c->IsHuman()) {
|
||||
Die(c->room);
|
||||
c->DropItems(this);
|
||||
BroadcastFullState(c->room);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case kObstacleMine:
|
||||
case kObstacleTrap:
|
||||
case kCollisionHitSpecEvent:
|
||||
{
|
||||
if (c->team_id != GetTeamId(c->room)) {
|
||||
AddObstacleBuff(c);
|
||||
#if 0
|
||||
Explosion();
|
||||
#endif
|
||||
Die(c->room);
|
||||
BroadcastFullState(c->room);
|
||||
if (ProcSpecEvent(c, collider)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -702,40 +708,8 @@ int Obstacle::OnCollisionTrigger(Creature* c, ColliderComponent* collider)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
Global::last_collider = collider;
|
||||
#endif
|
||||
#if 0
|
||||
if (!obstacle->IsDead(room) &&
|
||||
#if 0
|
||||
obstacle->Attackable(this) &&
|
||||
#endif
|
||||
obstacle->meta->i->drop() != 0 &&
|
||||
obstacle->IsTouchInteraction() &&
|
||||
room->GetGasData().gas_mode != GasInactive &&
|
||||
(!obstacle->IsTerminatorAirDropBox(room) || GetRace() == kHumanRace)
|
||||
) {
|
||||
obstacle->Die(room);
|
||||
if (obstacle->IsDead(room)) {
|
||||
#if 0
|
||||
if (obstacle->meta->i->damage_dia() > 0.01f &&
|
||||
obstacle->meta->i->damage() > 0.01f) {
|
||||
obstacle->Explosion(this);
|
||||
}
|
||||
#endif
|
||||
DropItems(obstacle);
|
||||
}
|
||||
obstacle->BroadcastFullState(room);
|
||||
if (obstacle->IsTerminatorAirDropBox(room) &&
|
||||
GetRace() == kHumanRace &&
|
||||
!HasBuffEffect(kBET_Terminator)) {
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(TERMINATOR_BUFF_ID);
|
||||
if (buff_meta) {
|
||||
AddBuff(this, buff_meta, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Obstacle::DoHideHouseInteraction(Human* sender)
|
||||
@ -888,3 +862,39 @@ bool Obstacle::ReceiveExplosionDmg(Explosion* explosion)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Obstacle::ProcSpecEvent(Creature* c, ColliderComponent* collider)
|
||||
{
|
||||
switch (meta->i->thing_type()) {
|
||||
case kObstacleSpring:
|
||||
{
|
||||
if (c->IsHuman()) {
|
||||
if (!c->AsHuman()->GetCar()) {
|
||||
AddObstacleBuff(c);
|
||||
a8::SetBitFlag(c->status, CS_Collisioning);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case kObstacleMine:
|
||||
case kObstacleTrap:
|
||||
{
|
||||
if (c->team_id != GetTeamId(c->room)) {
|
||||
AddObstacleBuff(c);
|
||||
#if 0
|
||||
Explosion();
|
||||
#endif
|
||||
Die(c->room);
|
||||
BroadcastFullState(c->room);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ protected:
|
||||
void AddObstacleBuff(Creature* c);
|
||||
void ClearObstacleBuff(Creature* c);
|
||||
bool IsHalfWallCollider();
|
||||
bool ProcSpecEvent(Creature* c, ColliderComponent* collider);
|
||||
|
||||
protected:
|
||||
CircleCollider* self_collider_ = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user