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

Proj from tall shooter under roof ignore roof #3365

Merged
merged 4 commits into from
Sep 21, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public virtual float DamageAmount
public bool canTargetSelf;
public bool castShadow = true;
public bool logMisses = true;
protected bool ignoreRoof;

public GlobalTargetInfo globalTargetInfo = GlobalTargetInfo.Invalid;
public GlobalTargetInfo globalSourceInfo = GlobalTargetInfo.Invalid;
Expand Down Expand Up @@ -348,6 +349,7 @@ public override void ExposeData()
Scribe_Values.Look<bool>(ref logMisses, "logMisses", true);
Scribe_Values.Look<bool>(ref castShadow, "castShadow", true);
Scribe_Values.Look<bool>(ref lerpPosition, "lerpPosition", true);
Scribe_Values.Look(ref ignoreRoof, "ignoreRoof", true);

//To fix landed grenades sl problem
Scribe_Values.Look(ref exactPosition, "exactPosition");
Expand Down Expand Up @@ -551,6 +553,10 @@ public virtual void Launch(Thing launcher, Vector2 origin, float shotAngle, floa
this.lerpPosition = props.lerpPosition;
this.GravityFactor = props.Gravity;
}
if (shotHeight >= CollisionVertical.WallCollisionHeight && Position.Roofed(launcher.Map))
{
ignoreRoof = true;
}
Launch(launcher, origin, equipment);
}

Expand Down Expand Up @@ -867,7 +873,7 @@ protected bool CheckCellForCollision(IntVec3 cell)

protected virtual bool TryCollideWithRoof(IntVec3 cell)
{
if (!cell.Roofed(Map))
if (!cell.Roofed(Map) || ignoreRoof)
{
return false;
}
Expand Down Expand Up @@ -1194,6 +1200,11 @@ public override void Tick()
{
DangerTracker?.Notify_BulletAt(Position, def.projectile.damageAmountBase * dangerFactor);
}
//If a flyoverhead ignore roof projectile is descending, enable roof check.
if (ignoreRoof && def.projectile.flyOverhead && shotAngle < 0)
{
ignoreRoof = false;
}
}

/// <summary>
Expand Down
Loading