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

feat(mechanics): Make stray projectiles not hit disabled fighters #9760

Merged
merged 27 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c09cbb7
feat
tibetiroka Feb 4, 2024
de36132
style
tibetiroka Feb 4, 2024
1e5dea7
I should really set up the coding style profile in the IDE
tibetiroka Feb 4, 2024
fb533bf
fix
tibetiroka Feb 5, 2024
1660179
I should really pay attention to what I'm doing.
tibetiroka Feb 6, 2024
26e2d85
Update source/Engine.cpp
tibetiroka Feb 6, 2024
78b8f5f
Update source/Engine.h
tibetiroka Feb 18, 2024
3613ce9
Merge remote-tracking branch 'upstream/master' into fighter-phasing
tibetiroka Feb 18, 2024
329a6fd
thing
tibetiroka Feb 18, 2024
6162dfa
Update source/Engine.cpp
tibetiroka Mar 10, 2024
c9abeef
fix targeting reset
tibetiroka Mar 10, 2024
9d5920e
fix beams
tibetiroka Mar 10, 2024
ea19de9
Merge branch 'master' into fighter-phasing
tibetiroka Mar 10, 2024
3d19a92
Update source/Engine.cpp
tibetiroka Mar 11, 2024
10c711e
lambda
tibetiroka Mar 11, 2024
dbb66a3
Update source/CollisionSet.cpp
tibetiroka Mar 11, 2024
6e24a39
Update source/CollisionSet.cpp
tibetiroka Mar 11, 2024
50e8a62
Update source/CollisionSet.cpp
tibetiroka Mar 11, 2024
11d817e
Update source/Engine.cpp
tibetiroka Mar 11, 2024
8110c5e
Move the responsibility of skipping disabled fighter collisions to th…
Amazinite Mar 12, 2024
8a62339
Derpy's change
tibetiroka Mar 12, 2024
a30ad16
quyykk's targeting thing
tibetiroka Mar 12, 2024
3c9997f
Merge branch 'master' into fighter-phasing
tibetiroka Mar 12, 2024
fd25542
fix
tibetiroka Mar 12, 2024
07145de
Update source/Projectile.cpp
tibetiroka Mar 13, 2024
24d392d
Update source/Projectile.cpp
tibetiroka Mar 13, 2024
f29cae5
Update source/AI.cpp
tibetiroka Mar 15, 2024
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
6 changes: 6 additions & 0 deletions source/CollisionSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ const vector<Collision> &CollisionSet::Line(const Point &from, const Point &to,
const Government *iGov = it->body->GetGovernment();
if(it->body != target && iGov && pGov && !iGov->IsEnemy(pGov))
continue;
if(collisionType == CollisionType::SHIP)
{
Ship *ship = reinterpret_cast<Ship *>(it->body);
if(ship != target && ship->CanBeCarried() && ship->IsDisabled())
continue;
}
Amazinite marked this conversation as resolved.
Show resolved Hide resolved

const Mask &mask = it->body->GetMask(step);
Point offset = from - it->body->Position();
Expand Down
15 changes: 14 additions & 1 deletion source/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ void Engine::Step(bool isActive)
else if(jumpCount > 0)
--jumpCount;
}
ai.UpdateEvents(events);
HandleEvents();
if(isActive)
{
HandleKeyboardInputs();
Expand Down Expand Up @@ -2738,3 +2738,16 @@ void Engine::EmplaceStatusOverlay(const shared_ptr<Ship> &it, Preferences::Overl
statuses.emplace_back(it->Position() - center, it->Shields(), it->Hull(),
min(it->Hull(), it->DisabledHull()), max(20., width * .5), type, alpha);
}



void Engine::HandleEvents()
{
for(const auto &event : events)
if(event.Type() ^ ShipEvent::DISABLE)
for(auto &projectile : projectiles)
if(projectile.Target() == event.Target().get() && projectile.Target()->CanBeCarried())
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved
projectile.BreakTarget();

ai.UpdateEvents(events);
}
2 changes: 2 additions & 0 deletions source/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ class Engine {
void CreateStatusOverlays();
void EmplaceStatusOverlay(const std::shared_ptr<Ship> &ship, Preferences::OverlayState overlaySetting, int value);

// Handle any events the engine is interested in.
void HandleEvents();
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved

private:
PlayerInfo &player;
Expand Down
Loading