Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Content.Shared._Shitmed.Targeting;
using Content.Shared.Body.Systems;
using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem;
using Content.Shared.Interaction.Events; // LuaM

namespace Content.Server._EinsteinEngines.Silicon.WeldingHealable;

Expand All @@ -24,6 +25,7 @@ public override void Initialize()
{
SubscribeLocalEvent<WeldingHealableComponent, InteractUsingEvent>(Repair);
SubscribeLocalEvent<WeldingHealableComponent, SiliconRepairFinishedEvent>(OnRepairFinished);
SubscribeLocalEvent<WeldingHealingComponent, UseInHandEvent>(OnUseInHand); //LuaM
}

private void OnRepairFinished(EntityUid uid, WeldingHealableComponent healableComponent, SiliconRepairFinishedEvent args)
Expand All @@ -49,19 +51,22 @@ private void OnRepairFinished(EntityUid uid, WeldingHealableComponent healableCo
_popup.PopupEntity(str, uid, args.User);

if (!args.Used.HasValue
|| _toolSystem.GetWelderFuelAndCapacity(args.Used.Value).fuel < component.FuelCost) //Mono: Nanite applicator
|| _toolSystem.GetWelderFuelAndCapacity(args.Used.Value).fuel < component.FuelCost //Mono: Nanite applicator
|| !HasDamage((args.Target.Value, damageable), component, args.User)) //LuaM HasDamage check
return;

args.Handled = _toolSystem.UseTool
(args.Used.Value,
args.User,
uid,
args.Delay,
component.QualityNeeded,
new SiliconRepairFinishedEvent
{
Delay = args.Delay
});
args.Handled = _toolSystem.UseTool
(args.Used.Value,
args.User,
uid,
args.Delay,
component.QualityNeeded,
new SiliconRepairFinishedEvent
{
Delay = args.Delay
},
breakOnMove: component.BreakOnMove, // LuaM
breakOnDamage: component.BreakOnDamage); //LuaM dedefault value
}
private async void Repair(EntityUid uid, WeldingHealableComponent healableComponent, InteractUsingEvent args)
{
Expand All @@ -77,8 +82,8 @@ private async void Repair(EntityUid uid, WeldingHealableComponent healableCompon
return;

float delay = args.User == args.Target
? component.DoAfterDelay * component.SelfHealPenalty
: component.DoAfterDelay;
? component.DoAfterDelay * component.SelfHealPenalty
: component.DoAfterDelay ;

args.Handled = _toolSystem.UseTool
(args.Used,
Expand All @@ -89,17 +94,56 @@ private async void Repair(EntityUid uid, WeldingHealableComponent healableCompon
new SiliconRepairFinishedEvent
{
Delay = delay,
});
},
breakOnMove: component.BreakOnMove, // LuaM default value
breakOnDamage: component.BreakOnDamage); // LuaM default value
}
// LuaM self-heal with Use in Hand
//LuaM-start:
private void OnUseInHand(Entity<WeldingHealingComponent> ent, ref UseInHandEvent args)
{
var component = ent.Comp;

if (args.Handled
|| !EntityManager.TryGetComponent(args.User, out DamageableComponent? damageable)
|| damageable.DamageContainerID is null
|| !component.DamageContainers.Contains(damageable.DamageContainerID)
|| !HasDamage((args.User, damageable), component, args.User)
|| !_toolSystem.HasQuality(ent.Owner, component.QualityNeeded)
|| !component.AllowSelfHeal
|| _toolSystem.GetWelderFuelAndCapacity(ent.Owner).fuel < component.FuelCost)
return;

float delay = component.DoAfterDelay * component.SelfHealPenalty;

args.Handled = _toolSystem.UseTool(
ent.Owner,
args.User,
args.User,
delay,
component.QualityNeeded,
new SiliconRepairFinishedEvent
{
Delay = delay,
},
breakOnMove: component.BreakOnMove,
breakOnDamage: component.BreakOnDamage);
}
//LuaM-end

private bool HasDamage(Entity<DamageableComponent> damageable, WeldingHealingComponent healable, EntityUid user)
{
if (healable.Damage.DamageDict is null)
return false;

foreach (var type in healable.Damage.DamageDict)
if (damageable.Comp.Damage.DamageDict[type.Key].Value > 0)
Comment thread
Pcolik505 marked this conversation as resolved.
// if (damageable.Comp.Damage.DamageDict[type.Key].Value > 0) // Commented by LuaM

if (damageable.Comp.Damage.DamageDict.TryGetValue(type.Key, out var damage) && // LuaM: Safely handle missing damage types.
damage.Value > 0) // LuaM
{
return true;
}

// In case the healer is a humanoid entity with targeting, we run the check on the targeted parts.
if (!TryComp(user, out TargetingComponent? targeting))
Expand All @@ -109,8 +153,12 @@ private bool HasDamage(Entity<DamageableComponent> damageable, WeldingHealingCom
foreach (var part in _bodySystem.GetBodyChildrenOfType(damageable, targetType, symmetry: targetSymmetry))
if (TryComp<DamageableComponent>(part.Id, out var damageablePart))
foreach (var type in healable.Damage.DamageDict)
if (damageablePart.Damage.DamageDict[type.Key].Value > 0)
Comment thread
Pcolik505 marked this conversation as resolved.
// if (damageablePart.Damage.DamageDict[type.Key].Value > 0) // Commented by LuaM
if (damageablePart.Damage.DamageDict.TryGetValue(type.Key, out var damage) // LuaM: Safely handle missing damage types.
&& damage.Value > 0) // LuaM
{
return true;
}

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,28 @@ public sealed partial class WeldingHealingComponent : Component
/// </summary>
[DataField]
public int FuelCost = 5;
// LuaM-start:
/// <summary>
/// Whether repairing is interrupted when the user moves
/// </summary>
[DataField]
public bool BreakOnMove = true;

/// <summary>
/// Whether repairing is interrupted when the user takes damage
/// </summary>
[DataField]
public bool BreakOnDamage = true;
// LuaM-end.

[DataField]
public int DoAfterDelay = 3;
public int DoAfterDelay = 3;

/// <summary>
/// A multiplier that will be applied to the above if an entity is repairing themselves.
/// </summary>
[DataField]
public float SelfHealPenalty = 3f;
public float SelfHealPenalty = 1.5f; // LuaM 3f > 1.5f

/// <summary>
/// Whether or not an entity is allowed to repair itself.
Expand Down
28 changes: 20 additions & 8 deletions Content.Shared/Tools/Systems/SharedToolSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ public bool UseTool(
IEnumerable<string> toolQualitiesNeeded,
DoAfterEvent doAfterEv,
float fuel = 0,
ToolComponent? toolComponent = null)
ToolComponent? toolComponent = null,
bool breakOnMove = true, // LuaM defaut value
bool breakOnDamage = true) // LuaM defaut value
{
return UseTool(tool,
user,
Expand All @@ -138,7 +140,9 @@ public bool UseTool(
doAfterEv,
out _,
fuel,
toolComponent);
toolComponent,
breakOnMove, // LuaM
breakOnDamage); // LuaM
}

/// <summary>
Expand Down Expand Up @@ -167,7 +171,10 @@ public bool UseTool(
DoAfterEvent doAfterEv,
out DoAfterId? id,
float fuel = 0,
ToolComponent? toolComponent = null)
ToolComponent? toolComponent = null,
bool breakOnMove = true, // LuaM defaut value
bool breakOnDamage = true) // LuaM defaut value

{
id = null;
if (!Resolve(tool, ref toolComponent, false))
Expand All @@ -179,8 +186,8 @@ public bool UseTool(
var toolEvent = new ToolDoAfterEvent(fuel, doAfterEv, GetNetEntity(target));
var doAfterArgs = new DoAfterArgs(EntityManager, user, delay / toolComponent.SpeedModifier, toolEvent, tool, target: target, used: tool)
{
BreakOnDamage = true,
BreakOnMove = true,
BreakOnMove = breakOnMove, // LuaM true > breakOnMove, from fixed value to changeble value
BreakOnDamage = breakOnDamage, // LuaM true > breakOnDamage, from fixed value to changeble value
BreakOnWeightlessMove = false,
NeedHand = tool != user,
AttemptFrequency = fuel > 0 ? AttemptFrequency.EveryTick : AttemptFrequency.Never
Expand Down Expand Up @@ -213,17 +220,22 @@ public bool UseTool(
string toolQualityNeeded,
DoAfterEvent doAfterEv,
float fuel = 0,
ToolComponent? toolComponent = null)
ToolComponent? toolComponent = null,
bool breakOnMove = true, // LuaM defaut value
bool breakOnDamage = true) // LuaM defaut value
{
return UseTool(tool,
return UseTool(
tool,
user,
target,
TimeSpan.FromSeconds(doAfterDelay),
new[] { toolQualityNeeded },
doAfterEv,
out _,
fuel,
toolComponent);
toolComponent,
breakOnMove, // LuaM
breakOnDamage); // LuaM
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ent-ExperimentalPowerCellCombat = экспериментальная боевая батарея
.desc = экспериментальная батарея оснащеная частичной защитой от скачков напряжения.
.suffix = Полная
ent-ExperimentalPowerCellCombatPrinted = экспериментальная боевая батарея
.desc = { ent-ExperimentalPowerCellCombat.desc }
.suffix = Пустрая
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ ent-TechDiskCivAdvancedTools = технодиск продвинутых инс
.desc = Диск, добавляющий челюсти жизни и электродрель в рецепты сервера.
ent-TechDiskRCD = технодиск РСУ
.desc = Диск, добавляющий РСУ в рецепты сервера.
ent-TechDiskCombatSilicon = технодиск боевых технологий синтетиков
.desc = Диск, добавляющий в рецепты боевых технологии синтетиков.
ent-TechDiskSpeedBoots = технодиск скороходов
.desc = Диск предтечей, добавляющий скороходы в рецепты сервера.
ent-TechDiskFtl = технодиск блюспейс-двигателя
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ ent-NaniteApplicator = аппликатор нанитов
.desc = Продвинутый инструмент, использующий технологию нанитов для ремнота киборгов и КПБ.
ent-NaniteApplicatorExperimental = экспериментальный аппликатор нанитов
.desc = Экспериментальный аппликатор нанитов, способный самостоятельно пополнять заряд.
ent-NaniteApplicatorSyndicate = продвинутый аппликатор нанитов
.desc = Продвинутый аппликатор нанитов со значительно увеличенной ёмкостью, а также способный самостоятельно пополнять заряд.
ent-NaniteApplicatorSyndicate = боевой аппликатор нанитов
.desc = Передовой аппликатор нанитов, разработанный для использования в боевых условиях, способный самостоятельно пополнять заряд.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ent-PowerCellCombat = боевая батарея
.desc = Перезаряжаемый стандартный батарея. Эта боевая модель оснащена частичной защитой от скачков напряжения.
.desc = Стандартная батарея оснащеная частичной защитой от скачков напряжения.
.suffix = Полная
ent-PowerCellCombatPrinted = боевая батарея
.desc = { ent-PowerCellCombat.desc }
Expand Down
2 changes: 1 addition & 1 deletion Resources/Maps/_Mono/Shuttles/Capitals/saturn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17886,7 +17886,7 @@ entities:
- type: Transform
pos: -3.3705235,6.3534303
parent: 1
- proto: NaniteApplicatorSyndicate
- proto: NaniteApplicatorExperimental # LuaM
entities:
- uid: 364
components:
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
- Inorganic
- type: ShowSyndicateIcons # Monolith
- type: MovementSpeedModifier # LuaM
baseWalkSpeed: 10
baseSprintSpeed: 35
baseWalkSpeed: 35
baseSprintSpeed: 15

- type: entity
id: ActionAGhostShowSolar
Expand Down
6 changes: 3 additions & 3 deletions Resources/Prototypes/Entities/Objects/Tools/welders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@
fuelCost: 5
damage:
types:
Blunt: -25
Piercing: -25
Slash: -25
Blunt: -12.5 # LuaM -25 > -12.5
Piercing: -12.5 # LuaM -25 > -12.5
Slash: -12.5 # LuaM -25 > -12.5
- type: Cautery # Shitmed
speed: 0.7
- type: SurgeryTool # Shitmed
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Structures/catwalk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- type: Anchorable
flags:
- Anchorable
- type: Rotatable

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не удалить, а закомментить.

# - type: Rotatable Commented by LuaM
- type: Clickable
- type: Sprite
sprite: Structures/catwalk.rsi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
- WelderExperimental
- JawsOfLife
- ExperimentalNaniteApplicator
- NaniteApplicatorSyndicate # LuaM
- TrayGoggles # Delta-V
# - Fulton # Frontier
# - FultonBeacon # Frontier
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Recipes/Lathes/Packs/science.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
recipes:
- PowerCellMicroreactor
- PowerCellCombat # Mono edit
- ExperimentalPowerCellCombat # LuaM
- PowerCellHigh

- type: latheRecipePack
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
- type: entity
name: experimental combat power cell
description: A rechargeable standardized power cell. This combat brand is equipped with partial protection from power spikes.
id: ExperimentalPowerCellCombat
suffix: Full
parent: PowerCellHigh
components:
- type: BatterySelfRecharger
autoRecharge: true
autoRechargeRate: 12 # takes 1 minute to charge itself back to full
- type: Sprite
sprite: _LuaM/Objects/Power/power_cells.rsi
layers:
- map: [ "enum.PowerCellVisualLayers.Base" ]
state: experimental
- map: [ "enum.PowerCellVisualLayers.Unshaded" ]
state: o2
shader: unshaded
- type: EmpResistance
coefficient: 0.0001


- type: entity
id: ExperimentalPowerCellCombatPrinted
suffix: Empty
parent: ExperimentalPowerCellCombat
components:
- type: Sprite
layers:
- map: [ "enum.PowerCellVisualLayers.Base" ]
state: experimental
- map: [ "enum.PowerCellVisualLayers.Unshaded" ]
state: o2
shader: unshaded
visible: false
- type: Battery
maxCharge: 480
startingCharge: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- type: entity
parent: TechDiskBase
id: TechDiskCombatSilicon
name: combat silicon technology tech disk
description: A disk capable of adding advanced combat silicon technology to a server's recipes.
components:
- type: Sprite
layers:
- state: icon
map: ["enum.DamageStateVisualLayers.Base"]
color: "#2d6f8c"
- state: label
- state: protect
- state: design
shader: unshaded
- type: TechnologyDisk
recipes:
- NaniteApplicatorSyndicate
- ExperimentalPowerCellCombat
Loading
Loading