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

Disable hostile ai on protected grids #2398

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GreaseMonk
Copy link
Contributor

About the PR

Disabled hostile ai on protected grids like transport shuttle and frontier outpost

Why / Balance

Hostile mobs seem to get on board protected areas way too often and kills ssd players mostly, leaving a mess.

How to test

Spawn any hostile AI that may attack things on frontier and check if it just does nothing, as intended.
Also spawn other AI like chicken, cow, CDET should still work too.

I tested this by dragging AI from a protected grid to a normal grid, which then reactivates the AI again, which may come as a suprise but if players push them out of the docks of frontier, it 'should' not hit the player - but it might ? . Either way better than what it was.

Media

Recording.2024-11-13.113915.mp4

Requirements

Breaking changes

No breaking changes.

Changelog

🆑

  • add: Hostile AI no longer work on protected zones.

@github-actions github-actions bot added the C# label Nov 13, 2024
@github-actions github-actions bot added Status: Needs Review This PR is awaiting reviews labels Nov 13, 2024
Copy link
Contributor

@whatston3 whatston3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a bit much to me, and open to some exploitation. I'll defer to others, but doesn't seem critical.

Left a recommendation to remove the mob and all of its contents, Dvir had something like this for the salvage mob restrictions off the top of my head.

Comment on lines +176 to +185
// Frontier: Disable hostile AI in pacified zones
var grid = Transform(uid).GridUid;
if (grid != null && EntityManager.TryGetComponent<ProtectedGridComponent>(grid, out _))
{
if (EntityManager.TryGetComponent<NpcFactionMemberComponent>(uid, out var npcFactionMemberComponent))
{
if (_npcFaction.IsFactionHostile("NanoTrasen", (uid, npcFactionMemberComponent)))
continue;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going this far, why not just kill them, gib them, and delete their contents? No iteration, fewer entities, nothing to gain by dragging crabs into the zone. They provide no threat, shouldn't reward coming back into a hidey hole.

Might also want to use another flag for this, ProtectedGrid could just mean "I'd like the floors in one piece".

if (grid != null
    && TryComp<ProtectedGridComponent>(grid, out var protectedGrid)
    && protectedGrid.KillHostileMobs
    && TryComp<NpcFactionMemberComponent>(uid, out var npcFactionMember)
    && _npcFaction.IsFactionHostile("NanoTrasen", (uid, npcFactionMember))
{
    // turn it into dust, could play a funny noise
    continue;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea. i will change this soonish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# Status: Needs Review This PR is awaiting reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants