Skip to content

Commit

Permalink
Merge branch 'master' into More-Tajaran-Markings
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus authored Feb 25, 2025
2 parents 44e49cf + 330fa0c commit 285b5de
Show file tree
Hide file tree
Showing 19 changed files with 215 additions and 30 deletions.
1 change: 1 addition & 0 deletions Content.Client/NukeOps/WarDeclaratorWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public sealed partial class WarDeclaratorWindow : FancyWindow
public WarDeclaratorWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

WarButton.OnPressed += (_) => OnActivated?.Invoke(Rope.Collapse(MessageEdit.TextRope));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,24 @@ public override void Initialize(IEntitySystemManager sysManager)
if (!damageQuery.TryGetComponent(target, out var damage))
continue;

var tagPrototype = _prototypeManager.Index<TagPrototype>(WeldbotWeldOperator.SiliconTag);
var tagSiliconMobPrototype = _prototypeManager.Index<TagPrototype>(WeldbotWeldOperator.SiliconTag);
var tagWeldFixableStructurePrototype = _prototypeManager.Index<TagPrototype>(WeldbotWeldOperator.WeldotFixableStructureTag);

if (!_entManager.TryGetComponent<TagComponent>(target, out var tagComponent) || !_tagSystem.HasTag(tagComponent, tagPrototype) || !emagged && damage.DamagePerGroup["Brute"].Value == 0)
if (!_entManager.TryGetComponent<TagComponent>(target, out var tagComponent))
continue;

//Needed to make sure it doesn't sometimes stop right outside it's interaction range
var pathRange = SharedInteractionSystem.InteractionRange - 1f;
var canWeldSiliconMob = _tagSystem.HasTag(tagComponent, tagSiliconMobPrototype) && (emagged || damage.DamagePerGroup["Brute"].Value > 0);
var canWeldStructure = _tagSystem.HasTag(tagComponent, tagWeldFixableStructurePrototype) && damage.TotalDamage.Value > 0;

if(!canWeldSiliconMob && !canWeldStructure)
continue;

var pathRange = SharedInteractionSystem.InteractionRange;

//Needed to make sure it doesn't sometimes stop right outside its interaction range, in case of a mob.
if (canWeldSiliconMob)
pathRange--;

var path = await _pathfinding.GetPath(owner, target, pathRange, cancelToken);

if (path.Result == PathResult.NoPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public sealed partial class WeldbotWeldOperator : HTNOperator
private TagSystem _tagSystem = default!;

public const string SiliconTag = "SiliconMob";
public const string WeldotFixableStructureTag = "WeldbotFixableStructure";

public const float EmaggedBurnDamage = 10;
public const float SiliconRepairAmount = 30;
public const float StructureRepairAmount = 5;

/// <summary>
/// Target entity to inject.
Expand Down Expand Up @@ -57,33 +62,58 @@ public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTi
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target, _entMan) || _entMan.Deleted(target))
return HTNOperatorStatus.Failed;

var tagPrototype = _prototypeManager.Index<TagPrototype>(SiliconTag);
var tagSiliconMobPrototype = _prototypeManager.Index<TagPrototype>(SiliconTag);
var tagWeldFixableStructurePrototype = _prototypeManager.Index<TagPrototype>(WeldotFixableStructureTag);

if(!_entMan.TryGetComponent<TagComponent>(target, out var tagComponent))
return HTNOperatorStatus.Failed;

var weldableIsSilicon = _tagSystem.HasTag(tagComponent, tagSiliconMobPrototype);
var weldableIsStructure = _tagSystem.HasTag(tagComponent, tagWeldFixableStructurePrototype);

if (!_entMan.TryGetComponent<TagComponent>(target, out var tagComponent) || !_tagSystem.HasTag(tagComponent, tagPrototype)
if ((!weldableIsSilicon && !weldableIsStructure)
|| !_entMan.TryGetComponent<WeldbotComponent>(owner, out var botComp)
|| !_entMan.TryGetComponent<DamageableComponent>(target, out var damage)
|| !_interaction.InRangeUnobstructed(owner, target)
|| (damage.DamagePerGroup["Brute"].Value == 0 && !_entMan.HasComponent<EmaggedComponent>(owner)))
|| !_interaction.InRangeUnobstructed(owner, target))
return HTNOperatorStatus.Failed;

var canWeldSilicon = damage.DamagePerGroup["Brute"].Value > 0 || _entMan.HasComponent<EmaggedComponent>(owner);
var canWeldStructure = damage.TotalDamage.Value > 0;

if ((!canWeldSilicon && weldableIsSilicon) || (!canWeldStructure && weldableIsStructure))
return HTNOperatorStatus.Failed;

if (botComp.IsEmagged)
{
if (!_prototypeManager.TryIndex<DamageGroupPrototype>("Burn", out var prototype))
if (!_prototypeManager.TryIndex<DamageGroupPrototype>("Burn", out var prototype) || weldableIsStructure)
return HTNOperatorStatus.Failed;

_damageableSystem.TryChangeDamage(target, new DamageSpecifier(prototype, 10), true, false, damage);
_damageableSystem.TryChangeDamage(target, new DamageSpecifier(prototype, EmaggedBurnDamage), true, false, damage);
}
else
{
if (!_prototypeManager.TryIndex<DamageGroupPrototype>("Brute", out var prototype))
if (weldableIsSilicon)
{
if (!_prototypeManager.TryIndex<DamageGroupPrototype>("Brute", out var prototype))
return HTNOperatorStatus.Failed;

_damageableSystem.TryChangeDamage(target, new DamageSpecifier(prototype, -SiliconRepairAmount), true, false, damage);
}
else if (weldableIsStructure)
{
//If a structure explicitly has a tag to allow a Weldbot to fix it, trust that we can just do so no matter what the damage actually is.
_damageableSystem.ChangeAllDamage(target, damage, -StructureRepairAmount);
}
else
{
return HTNOperatorStatus.Failed;

_damageableSystem.TryChangeDamage(target, new DamageSpecifier(prototype, -50), true, false, damage);
}
}

_audio.PlayPvs(botComp.WeldSound, target);

if(damage.DamagePerGroup["Brute"].Value == 0) //only say "all done if we're actually done!"
if((weldableIsSilicon && damage.DamagePerGroup["Brute"].Value == 0)
|| (weldableIsStructure && damage.TotalDamage.Value == 0)) //only say "all done if we're actually done!"
_chat.TrySendInGameICMessage(owner, Loc.GetString("weldbot-finish-weld"), InGameICChatType.Speak, hideChat: true, hideLog: true);

return HTNOperatorStatus.Finished;
Expand Down
33 changes: 33 additions & 0 deletions Content.Shared/Damage/Systems/DamageableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,39 @@ public void SetAllDamage(EntityUid uid, DamageableComponent component, FixedPoin
// Shitmed Change End
}

/// <summary>
/// Changes all damage types supported by a <see cref="DamageableComponent"/> by the specified value.
/// </summary>
/// <remakrs>
/// Will not lower damage to a negative value.
/// </remakrs>
public void ChangeAllDamage(EntityUid uid, DamageableComponent component, FixedPoint2 addedValue)
{
foreach (var type in component.Damage.DamageDict.Keys)
{
component.Damage.DamageDict[type] += addedValue;
if (component.Damage.DamageDict[type] < 0)
component.Damage.DamageDict[type] = 0;
}

// Changing damage does not count as 'dealing' damage, even if it is set to a larger value, so we pass an
// empty damage delta.
DamageChanged(uid, component, new DamageSpecifier());

// Shitmed Change Start
if (!HasComp<TargetingComponent>(uid))
return;

foreach (var (part, _) in _body.GetBodyChildren(uid))
{
if (!TryComp(part, out DamageableComponent? damageComp))
continue;

ChangeAllDamage(part, damageComp, addedValue);
}
// Shitmed Change End
}

public void SetDamageModifierSetId(EntityUid uid, string damageModifierSetId, DamageableComponent? comp = null)
{
if (!_damageableQuery.Resolve(uid, ref comp))
Expand Down
61 changes: 61 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12014,3 +12014,64 @@ Entries:
id: 6878
time: '2025-02-21T16:46:25.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1831
- author: EctoplasmIsGood
changes:
- type: Tweak
message: Advanced Industrial welder from 250 capacity to 500
- type: Tweak
message: Advanced Industrial welder from 1.3x speed to 1.5x speed
- type: Tweak
message: Experimental welder from 1000 capacity to 200
- type: Tweak
message: Experimental welder from 1u of welder fuel generated to 0.5u
- type: Tweak
message: Experimental welder from 1x speed to 2x speed
id: 6879
time: '2025-02-22T03:46:30.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1832
- author: Timfa2112
changes:
- type: Tweak
message: >-
Weldbots can now fix specific structures, like windows and grounding
rods.
id: 6880
time: '2025-02-22T18:08:01.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1838
- author: Timfa2112
changes:
- type: Tweak
message: >-
Tweaked Tricordrazine to heal MINOR amounts of radiation damage. This
includes Medibots. If it's more than a teeny tiny amount, go to medical!
This also alleviates the issue where the medibot keeps pestering you
about the 0.1 rad damage because it thinks it can heal it, while the
medicine it'll inject (before this change) didn't actually do anything.
id: 6881
time: '2025-02-24T00:21:05.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1840
- author: Timfa2112
changes:
- type: Add
message: Added cloth wraps to hands loadouts
id: 6882
time: '2025-02-25T02:16:52.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1841
- author: EctoplasmIsGood
changes:
- type: Tweak
message: Holoparasite melee damage from 20 blunt to 10 blunt
- type: Tweak
message: Holoparasite melee speed from 1.8 to 0.3
id: 6883
time: '2025-02-25T05:22:08.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1843
- author: Diggy
changes:
- type: Tweak
message: Tweaked the nano bot trait value from 0,9 to 0,6.
- type: Fix
message: Bionic legs DO work now, yay.
id: 6884
time: '2025-02-25T14:39:19.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1833
Loading

0 comments on commit 285b5de

Please sign in to comment.