Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discs of Repulsion no longer blast players when friendly collision is disabled #2803

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/playsim/p_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,20 @@ TArray<spechit_t> portalhit;
//
//==========================================================================

bool P_ShouldPassThroughPlayer(AActor *self, AActor *other)
static int P_ShouldPassThroughPlayer(AActor *self, AActor *other)
{
return (dmflags3 & DF3_NO_PLAYER_CLIP) &&
other->player && other->player->mo == other &&
self->IsFriend(other);
}

DEFINE_ACTION_FUNCTION_NATIVE(AActor, ShouldPassThroughPlayer, P_ShouldPassThroughPlayer)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT_NOT_NULL(other, AActor);
ACTION_RETURN_BOOL(P_ShouldPassThroughPlayer(self, other));
}

//==========================================================================
//
// CanCollideWith
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/actors/actor.zs
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ class Actor : Thinker native
native void Thrust(double speed = 1e37, double angle = 1e37);
native clearscope bool isFriend(Actor other) const;
native clearscope bool isHostile(Actor other) const;
native clearscope bool ShouldPassThroughPlayer(Actor other) const;
native void AdjustFloorClip();
native clearscope DropItem GetDropItems() const;
native void CopyFriendliness (Actor other, bool changeTarget, bool resetHealth = true);
Expand Down
5 changes: 5 additions & 0 deletions wadsrc/static/zscript/actors/hexen/blastradius.zs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ extend class Actor
{ // Must be monster, player, missile, touchy or vulnerable
continue;
}
if (player && ShouldPassThroughPlayer(mo))
{
// Don't blast friendly players if collision is disabled.
continue;
}
if (Distance2D(mo) > radius)
{ // Out of range
continue;
Expand Down