Skip to content

Commit

Permalink
Merge branch 'master' into blueshield-rework
Browse files Browse the repository at this point in the history
  • Loading branch information
EstKemran authored Dec 8, 2024
2 parents e51f24a + 59d1e97 commit d5023a3
Show file tree
Hide file tree
Showing 127 changed files with 44,273 additions and 43,283 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ public FixedPoint2 TileReact(TileRef tile,
{
if (Whitelist != null)
{
//ss220 infinity entities on tile fix start
var entityLookup = entityManager.System<EntityLookupSystem>();
var entities = entityLookup.GetLocalEntitiesIntersecting(tile);
//ss220 infinity entities on tile fix end

int acc = 0;
foreach (var ent in tile.GetEntitiesInTile())
foreach (var ent in entities) //ss220 infinity entities on tile fix
{
var whitelistSystem = entityManager.System<EntityWhitelistSystem>();
if (whitelistSystem.IsWhitelistPass(Whitelist, ent))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Content.Shared.Mobs.Components;
using Content.Shared.Silicons.Bots;
using Content.Shared.Emag.Components;
using Content.Shared.Stealth.Components;
using Robust.Shared.Containers;

namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Specific;

Expand All @@ -17,6 +19,7 @@ public sealed partial class PickNearbyInjectableOperator : HTNOperator
private EntityLookupSystem _lookup = default!;
private MedibotSystem _medibot = default!;
private PathfindingSystem _pathfinding = default!;
private SharedContainerSystem _container = default!; //ss220 stealth inject fix

[DataField("rangeKey")] public string RangeKey = NPCBlackboard.MedibotInjectRange;

Expand All @@ -38,6 +41,7 @@ public override void Initialize(IEntitySystemManager sysManager)
_lookup = sysManager.GetEntitySystem<EntityLookupSystem>();
_medibot = sysManager.GetEntitySystem<MedibotSystem>();
_pathfinding = sysManager.GetEntitySystem<PathfindingSystem>();
_container = sysManager.GetEntitySystem<SharedContainerSystem>(); //ss220 npc stealth inject fix
}

public override async Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard,
Expand All @@ -56,6 +60,7 @@ public override void Initialize(IEntitySystemManager sysManager)
var recentlyInjected = _entManager.GetEntityQuery<NPCRecentlyInjectedComponent>();
var mobState = _entManager.GetEntityQuery<MobStateComponent>();
var emaggedQuery = _entManager.GetEntityQuery<EmaggedComponent>();
var stealthQuery = _entManager.GetEntityQuery<StealthComponent>(); //ss220 medibot inject in stealth entity fix

foreach (var entity in _lookup.GetEntitiesInRange(owner, range))
{
Expand All @@ -64,6 +69,17 @@ public override void Initialize(IEntitySystemManager sysManager)
damageQuery.TryGetComponent(entity, out var damage) &&
!recentlyInjected.HasComponent(entity))
{
//ss220 medibot inject in stealth entity fix start
if (_container.IsEntityInContainer(entity))
{
continue;
}
if (stealthQuery.TryGetComponent(entity, out var stealthComponent) && stealthComponent.Enabled)
{
continue;
}
//ss220 medibot inject in stealth entity fix end

// no treating dead bodies
if (!_medibot.TryGetTreatment(medibot, state.CurrentState, out var treatment))
continue;
Expand Down
5 changes: 4 additions & 1 deletion Content.Server/SS220/MechClothing/MechClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ private void OnInteract(Entity<MechClothingComponent> ent, ref MechClothingGrabE
if (Transform(args.Target).Anchored)
return;

if (ent.Comp.ItemContainer.ContainedEntities.Count >= ent.Comp.MaxContents)
if(!TryComp<MechGrabberComponent>(ent.Comp.CurrentEquipmentUid, out var grabberComp))
return;

if (grabberComp.ItemContainer.ContainedEntities.Count >= grabberComp.MaxContents)
return;

if (!TryComp<MechComponent>(ent.Comp.MechUid, out var mech))
Expand Down
25 changes: 20 additions & 5 deletions Content.Server/SS220/MindSlave/Systems/MindSlaveStopWordSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public string StopWord
get
{
if (_stopWord == string.Empty)
Log.Error("Asked for mind slave stop word but it is empty");
Log.Error("Asked for mind slave stop word but it is empty!");
if (!_textGeneratedThisRound)
Log.Error("Asked for mind slave stop word but it wasnt generated!");
return _stopWord;
}
}
Expand All @@ -46,13 +48,16 @@ public string Text
get
{
if (_text == string.Empty)
Log.Error("Asked for mind slave stop word but it is empty");
Log.Error("Asked for mind slave text but it is empty");
if (!_textGeneratedThisRound)
Log.Error("Asked for mind slave text but it wasnt generated!");
return _text;
}
}

private string _stopWord = string.Empty;
private string _text = string.Empty;
private bool _textGeneratedThisRound = false;

public override void Initialize()
{
Expand All @@ -65,11 +70,17 @@ public override void Initialize()
SubscribeLocalEvent<MindSlaveStopWordContainerComponent, MapInitEvent>(OnInit);
}

private void OnRoundStart(RoundStartedEvent args)
private void OnRoundStart(RoundStartedEvent _)
{
if (!_textGeneratedThisRound)
MakeTextAndStopWord();
}

private void MakeTextAndStopWord()
{
_markovText.Initialize(_prototype.Index<DatasetPrototype>(TextDatasetId).Values, KeySize);
_text = _markovText.GenerateText(83);

_textGeneratedThisRound = true;
_stopWord = _markovText.ReplacePunctuationInEnding(_random.Pick(_text.Split().Where(x => x.Length >= StopWordMinSize).ToArray()));
RaiseLocalEvent(new StopWordGeneratedEvent(_stopWord));
}
Expand All @@ -79,10 +90,14 @@ private void OnRoundEnded(RoundEndedEvent args)
_markovText.CleatData();
_stopWord = string.Empty;
_text = string.Empty;
_textGeneratedThisRound = false;
}

private void OnInit(Entity<MindSlaveStopWordContainerComponent> entity, ref MapInitEvent args)
{
if (!_textGeneratedThisRound)
MakeTextAndStopWord();

if (_specificFormManager is null)
return;

Expand All @@ -100,7 +115,7 @@ private void OnInit(Entity<MindSlaveStopWordContainerComponent> entity, ref MapI
|| !TryComp<PaperComponent>(entity, out var entityPaperComponent))
return;
// idea was that hos documents is container of this information
_paper.SetContent((entity.Owner, entityPaperComponent), paperComponent.Content.Replace("mindslave-stop-word-text", _text));
_paper.SetContent((entity.Owner, entityPaperComponent), paperComponent.Content.Replace("mindslave-stop-word-text", Text));
QueueDel(spawnedForm);

foreach (var stampProtoId in entity.Comp.StampList)
Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/Clumsy/ClumsySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Damage;
using Content.Shared.IdentityManagement;
using Content.Shared.Medical;
using Content.Shared.Mobs.Systems;
using Content.Shared.Popups;
using Content.Shared.Stunnable;
using Content.Shared.Weapons.Ranged.Events;
Expand All @@ -24,6 +25,7 @@ public sealed class ClumsySystem : EntitySystem
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -82,6 +84,11 @@ private void BeforeGunShotEvent(Entity<ClumsyComponent> ent, ref SelfBeforeGunSh

private void OnBeforeClimbEvent(Entity<ClumsyComponent> ent, ref SelfBeforeClimbEvent args)
{
//ss220 don't clumsy if entity is dead start
if (_mobStateSystem.IsDead(ent.Owner))
return;
//ss220 don't clumsy if entity is dead end

// This event is called in shared, thats why it has all the extra prediction stuff.
var rand = new System.Random((int)_timing.CurTick.Value);

Expand Down
6 changes: 0 additions & 6 deletions Content.Shared/SS220/MechClothing/MechClothingComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ public sealed partial class MechClothingComponent : Component
[DataField("grabDelay")]
public float GrabDelay = 2.5f;

/// <summary>
/// The maximum amount of items that can be fit in this grabber
/// </summary>
[DataField("maxContents")]
public int MaxContents = 10;

/// <summary>
/// The sound played when a mech is grabbing something
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
Expand Down Expand Up @@ -45,10 +46,10 @@ public sealed partial class BatteryWeaponFireMode
public string? FireModeName;

/// <summary>
/// Sound of a gunshot that is used in the selected fire mode
/// Gun modifiers of this fire mode
/// </summary>
[DataField]
public string? SoundGunshot;
public FireModeGunModifiers? GunModifiers;

/// <summary>
/// Sprite of the remaining charge that is used in the selected fire mode
Expand All @@ -63,3 +64,39 @@ public sealed partial class BatteryWeaponFireMode
[DataField]
public float FireCost = 100;
}

//SS220 Add firemode modificators begin
/// <summary>
/// Gun modifiers that can be applied in each fire mode
/// </summary>
[DataDefinition, Serializable, NetSerializable]
public sealed partial class FireModeGunModifiers
{
[DataField]
public SoundSpecifier? SoundGunshot;

[DataField]
public float? CameraRecoilScala;

[DataField]
public Angle? AngleIncrease;

[DataField]
public Angle? AngleDecay;

[DataField]
public Angle? MaxAngle;

[DataField]
public Angle? MinAngle;

[DataField]
public int? ShotsPerBurst;

[DataField]
public float? FireRate;

[DataField]
public float? ProjectileSpeed;
}
//SS220 Add firemode modificators end
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,18 @@ private void OnRefreshModifiers(Entity<BatteryWeaponFireModesComponent> ent, ref
{
var firemode = GetMode(ent.Comp);

if (firemode.SoundGunshot is not null)
args.SoundGunshot = new SoundPathSpecifier(firemode.SoundGunshot);
if (firemode.GunModifiers is not { } modifiers ||
!TryComp<GunComponent>(ent.Owner, out var gunComponent))
return;

args.SoundGunshot = modifiers.SoundGunshot ?? gunComponent.SoundGunshot;
args.AngleIncrease = modifiers.AngleIncrease ?? gunComponent.AngleIncrease;
args.AngleDecay = modifiers.AngleDecay ?? gunComponent.AngleDecay;
args.MaxAngle = modifiers.MaxAngle ?? gunComponent.MaxAngle;
args.MinAngle = modifiers.MinAngle ?? gunComponent.MinAngle;
args.ShotsPerBurst = modifiers.ShotsPerBurst ?? gunComponent.ShotsPerBurst;
args.FireRate = modifiers.FireRate ?? gunComponent.FireRate;
args.ProjectileSpeed = modifiers.ProjectileSpeed ?? gunComponent.ProjectileSpeed;
}
//SS220 Add Multifaze gun end
}
Expand Down
Loading

0 comments on commit d5023a3

Please sign in to comment.