Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Small Mobs Fixing (new-frontiers-14#1665)
Browse files Browse the repository at this point in the history
* Einstein-Engines fix

Simple-Station/Einstein-Engines#530

* Update BluespaceErrorRule.cs
  • Loading branch information
dvir001 authored Jul 13, 2024
1 parent b790d63 commit 3a65686
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ private void UpdateRanged(float frameTime)
return;
}

_gun.SetTarget(gun, comp.Target); // Frontier - This ensures that the bullet won't fly over the target if it's downed
_gun.AttemptShoot(uid, gunUid, gun, targetCordinates);
}
}
Expand Down
16 changes: 14 additions & 2 deletions Content.Server/StationEvents/Events/BluespaceErrorRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Content.Shared.Humanoid;
using Content.Shared.Mobs.Components;
using Robust.Shared.Random;
using Content.Server._NF.Salvage;

namespace Content.Server.StationEvents.Events;

Expand Down Expand Up @@ -75,6 +76,17 @@ protected override void Ended(EntityUid uid, BluespaceErrorRuleComponent compone

var gridValue = _pricing.AppraiseGrid(gridUid, null);

// Handle mobrestrictions getting deleted
var query = AllEntityQuery<SalvageMobRestrictionsNFComponent>();

while (query.MoveNext(out var salvUid, out var salvMob))
{
if (gridTransform.GridUid == salvMob.LinkedGridEntity)
{
QueueDel(salvUid);
}
}

var mobQuery = AllEntityQuery<HumanoidAppearanceComponent, MobStateComponent, TransformComponent>();
_playerMobs.Clear();

Expand All @@ -96,8 +108,8 @@ protected override void Ended(EntityUid uid, BluespaceErrorRuleComponent compone
_transform.SetCoordinates(mob.Entity.Owner, new EntityCoordinates(mob.MapUid, mob.LocalPosition));
}

var query = EntityQuery<StationBankAccountComponent>();
foreach (var account in query)
var queryBank = EntityQuery<StationBankAccountComponent>();
foreach (var account in queryBank)
{
_cargo.DeductFunds(account, (int)-(gridValue * component.RewardFactor));
}
Expand Down
8 changes: 8 additions & 0 deletions Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ private void StopShooting(EntityUid uid, GunComponent gun)
Dirty(uid, gun);
}

/// <summary>
/// Frontier - Sets the targeted entity of the gun. Should be called before attempting to shoot to avoid shooting over the target.
/// </summary>
public void SetTarget(GunComponent gun, EntityUid target)
{
gun.Target = target;
}

/// <summary>
/// Attempts to shoot at the target coordinates. Resets the shot counter after every shot.
/// </summary>
Expand Down

0 comments on commit 3a65686

Please sign in to comment.