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)
|
int Obstacle::OnCollisionTrigger(Creature* c, ColliderComponent* collider)
|
||||||
{
|
{
|
||||||
return 0;
|
if (IsDead(c->room)) {
|
||||||
#if 0
|
return 0;
|
||||||
opt_result = kOptPass;
|
}
|
||||||
switch (meta->i->thing_type()) {
|
switch (meta->i->collision_hit()) {
|
||||||
case kObstacleSpring:
|
case kCollisionHitPass:
|
||||||
{
|
{
|
||||||
if (c->IsHuman()) {
|
return 0;
|
||||||
if (!c->AsHuman()->GetCar()) {
|
}
|
||||||
AddObstacleBuff(c);
|
break;
|
||||||
a8::SetBitFlag(c->status, CS_Collisioning);
|
case kCollisionHitBlock:
|
||||||
opt_result = kOptBreak;
|
{
|
||||||
}
|
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;
|
break;
|
||||||
case kObstacleMine:
|
case kCollisionHitSpecEvent:
|
||||||
case kObstacleTrap:
|
|
||||||
{
|
{
|
||||||
if (c->team_id != GetTeamId(c->room)) {
|
if (ProcSpecEvent(c, collider)) {
|
||||||
AddObstacleBuff(c);
|
return 0;
|
||||||
#if 0
|
|
||||||
Explosion();
|
|
||||||
#endif
|
|
||||||
Die(c->room);
|
|
||||||
BroadcastFullState(c->room);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -702,40 +708,8 @@ int Obstacle::OnCollisionTrigger(Creature* c, ColliderComponent* collider)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if 0
|
|
||||||
Global::last_collider = collider;
|
Global::last_collider = collider;
|
||||||
#endif
|
return 1;
|
||||||
#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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Obstacle::DoHideHouseInteraction(Human* sender)
|
void Obstacle::DoHideHouseInteraction(Human* sender)
|
||||||
@ -888,3 +862,39 @@ bool Obstacle::ReceiveExplosionDmg(Explosion* explosion)
|
|||||||
}
|
}
|
||||||
return false;
|
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 AddObstacleBuff(Creature* c);
|
||||||
void ClearObstacleBuff(Creature* c);
|
void ClearObstacleBuff(Creature* c);
|
||||||
bool IsHalfWallCollider();
|
bool IsHalfWallCollider();
|
||||||
|
bool ProcSpecEvent(Creature* c, ColliderComponent* collider);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CircleCollider* self_collider_ = nullptr;
|
CircleCollider* self_collider_ = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user