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

Рефактор мехов, правки в системе медицины #507

Merged
merged 73 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f3cb955
mech system, fix hands, fix fraction
Rinary1 Oct 13, 2024
38fb777
fix
Rinary1 Oct 13, 2024
00a7744
fix fake hypo
Rinary1 Oct 13, 2024
bc2c5a2
fix triple airlocks big sizing
Rinary1 Oct 13, 2024
11f9fcd
fix
Rinary1 Oct 14, 2024
b808496
upd clown hulk
Rinary1 Oct 14, 2024
bf5becd
xd fix 2
Rinary1 Oct 14, 2024
fb3dd08
bigger exit delay
Rinary1 Oct 14, 2024
83f6b89
mechs reflect changes
Rinary1 Oct 15, 2024
88d3c3d
guns changes
Rinary1 Oct 15, 2024
adca6b3
draike up
Rinary1 Oct 15, 2024
43a242a
mechs in another category
Rinary1 Oct 15, 2024
09c1475
add equipment
Rinary1 Oct 15, 2024
75931b8
Revert "upd clown hulk"
Rinary1 Oct 15, 2024
c9794e4
SPIN MY MECH ASS
Rinary1 Oct 15, 2024
44a1f9c
mech no rot
Rinary1 Oct 15, 2024
b2685ed
some resprite
Rinary1 Oct 15, 2024
8d6fa8a
no injections in hardsuits
Rinary1 Oct 16, 2024
08308ec
some species can not be injectable
Rinary1 Oct 16, 2024
45d19e8
medipans can ignore armor, admeme hypospray ignore armor
Rinary1 Oct 16, 2024
35b4952
fix
Rinary1 Oct 16, 2024
0e1401d
fix admeme hypo
Rinary1 Oct 16, 2024
533b58d
mob fraction fix
Rinary1 Oct 16, 2024
f752a82
rover + nt gygax add
Rinary1 Oct 16, 2024
cdce68b
fix description
Rinary1 Oct 17, 2024
19ce1e5
fix id
Rinary1 Oct 17, 2024
6c2a3f1
some better dome effects
Rinary1 Oct 17, 2024
caf7c53
если пустая гильза в стволе -> Кнопки "казнь" не будет
Rinary1 Oct 17, 2024
da683bf
phazon added
Rinary1 Oct 17, 2024
24eaacd
Merge branch 'space-sunrise:master' into mech-things
Rinary1 Oct 17, 2024
9161b78
fix server crashes
Rinary1 Oct 18, 2024
70306ca
full rework mechs on mobstates, coils fix mechs, diagnostic hud show …
Rinary1 Oct 18, 2024
1f4ad89
some fixes
Rinary1 Oct 18, 2024
403db9a
configure health of all mechs
Rinary1 Oct 18, 2024
5b9e065
upd
Rinary1 Oct 18, 2024
cb6e4fb
add rover to uplink
Rinary1 Oct 18, 2024
77bf795
translate bundle
Rinary1 Oct 18, 2024
49b794d
change price
Rinary1 Oct 18, 2024
1421306
phazon construction
Rinary1 Oct 18, 2024
f39deb9
fix
Rinary1 Oct 18, 2024
323e893
fix
Rinary1 Oct 18, 2024
8484ef0
Finish phazon construction
Rinary1 Oct 19, 2024
938716b
add phazon research and recipes
Rinary1 Oct 19, 2024
444f67b
phazon construction translate
Rinary1 Oct 19, 2024
dd7ff9a
fix
Rinary1 Oct 19, 2024
3e29c66
Mech lights
Rinary1 Oct 19, 2024
bad0b43
fix
Rinary1 Oct 19, 2024
75a55a6
translate light action
Rinary1 Oct 19, 2024
db3b628
Mech sounds, fix damage
Rinary1 Oct 19, 2024
cd2ef24
fix
Rinary1 Oct 19, 2024
c279479
fix hello sound
Rinary1 Oct 19, 2024
0a07405
upd
Rinary1 Oct 19, 2024
809bfea
fix linter
Rinary1 Oct 19, 2024
7ca7caf
change damagePercentage
Rinary1 Oct 19, 2024
5823dac
fix
Rinary1 Oct 19, 2024
2a3315f
fix hello sound
Rinary1 Oct 19, 2024
6f9da7a
temp disable damage sounds
Rinary1 Oct 19, 2024
f7e1947
fix battery needed on construct
Rinary1 Oct 20, 2024
5d08729
some changes
Rinary1 Oct 20, 2024
2ad34ec
Merge branch 'space-sunrise:master' into mech-things
Rinary1 Oct 21, 2024
9c67b6b
add mech painting system as DEBUG(in dev)
Rinary1 Oct 26, 2024
372e633
Fix yaml, durand paintings
Rinary1 Oct 26, 2024
9d96535
mech spray cans textures
Rinary1 Oct 26, 2024
34ae35f
change sprite
Rinary1 Oct 26, 2024
36fdc44
fix
Rinary1 Oct 26, 2024
e8e57c9
ripley, clarke new textures
Rinary1 Oct 27, 2024
e0e53ff
ripley,clarke paints
Rinary1 Oct 27, 2024
f537772
fix
Rinary1 Oct 27, 2024
9c7690d
sec pod texture
Rinary1 Oct 27, 2024
2348149
Merge branch 'space-sunrise:master' into mech-things
Rinary1 Oct 28, 2024
2dcdf1e
Merge branch 'master' of https://github.com/space-sunrise/space-stati…
Rinary1 Oct 30, 2024
1b35fbf
Merge branch 'mech-things' of https://github.com/Rinary1/space-sunris…
Rinary1 Oct 30, 2024
02ac32d
Merge branch 'master' into mech-things
VigersRay Oct 30, 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
28 changes: 24 additions & 4 deletions Content.Client/Mech/MechSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Shared.Mech.Components;
using Content.Shared.Mech.EntitySystems;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;

namespace Content.Client.Mech;
Expand All @@ -17,30 +18,49 @@ public override void Initialize()
base.Initialize();

SubscribeLocalEvent<MechComponent, AppearanceChangeEvent>(OnAppearanceChanged);
SubscribeLocalEvent<MechComponent, UpdateAppearanceEvent>(OnUpdateAppearanceEvent);
}

private void OnAppearanceChanged(EntityUid uid, MechComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;

if (!args.Sprite.TryGetLayer((int) MechVisualLayers.Base, out var layer))
UpdateAppearance(uid, component, args.Sprite);
}

private void OnUpdateAppearanceEvent(EntityUid uid, MechComponent component, ref UpdateAppearanceEvent args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;

UpdateAppearance(uid, component, sprite);
}

private void UpdateAppearance(EntityUid uid, MechComponent component, SpriteComponent sprite)
{
if (!sprite.TryGetLayer((int) MechVisualLayers.Base, out var layer))
return;

var state = component.BaseState;
var drawDepth = DrawDepth.Mobs;
if (component.BrokenState != null && _appearance.TryGetData<bool>(uid, MechVisuals.Broken, out var broken, args.Component) && broken)

if (component.BrokenState != null
&& _appearance.TryGetData<bool>(uid, MechVisuals.Broken, out var broken)
&& broken)
{
state = component.BrokenState;
drawDepth = DrawDepth.SmallMobs;
}
else if (component.OpenState != null && _appearance.TryGetData<bool>(uid, MechVisuals.Open, out var open, args.Component) && open)
else if (component.OpenState != null
&& _appearance.TryGetData<bool>(uid, MechVisuals.Open, out var open)
&& open)
{
state = component.OpenState;
drawDepth = DrawDepth.SmallMobs;
}

layer.SetState(state);
args.Sprite.DrawDepth = (int) drawDepth;
sprite.DrawDepth = (int) drawDepth;
}
}
23 changes: 23 additions & 0 deletions Content.Server/Chemistry/EntitySystems/HypospraySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
using Content.Shared.Mobs.Components;
using Content.Shared.Timing;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Inventory;
using Content.Shared.Tag;
using Content.Shared.Popups;
using Content.Server.Interaction;
using Content.Server.Body.Components;
using Content.Server.Popups;
using Robust.Shared.GameStates;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
Expand All @@ -22,6 +26,8 @@ namespace Content.Server.Chemistry.EntitySystems;

public sealed class HypospraySystem : SharedHypospraySystem
{
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly InteractionSystem _interaction = default!;

Expand Down Expand Up @@ -84,6 +90,23 @@ public bool TryDoInject(Entity<HyposprayComponent> entity, EntityUid target, Ent
}

string? msgFormat = null;

if (!component.PierceArmor && _inventorySystem.TryGetSlotEntity(target, "outerClothing", out var suit))
{
if (TryComp<TagComponent>(suit, out var tag) && tag.Tags.Contains("Hardsuit"))
{
if (target == null) return false;
var taget = (EntityUid) target;

_popup.PopupEntity(Loc.GetString("hypospay-component-failure-hardsuit"), target, user, PopupType.MediumCaution);
return false;
}
}
else if (!component.PierceArmor && TryComp<TagComponent>(target, out var tag) && tag.Tags.Contains("NoInjectable"))
{
_popup.PopupEntity(Loc.GetString("hypospay-component-failure-hardsuit"), target, user, PopupType.MediumCaution);
return false;
}

if (target == user)
msgFormat = "hypospray-component-inject-self-message";
Expand Down
20 changes: 20 additions & 0 deletions Content.Server/Chemistry/EntitySystems/InjectorSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Popups;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
Expand All @@ -11,13 +12,18 @@
using Content.Shared.Forensics;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Shared.Mobs.Components;
using Content.Shared.Stacks;
using Content.Shared.Tag;
using Content.Shared.Popups;

namespace Content.Server.Chemistry.EntitySystems;

public sealed class InjectorSystem : SharedInjectorSystem
{
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly BloodstreamSystem _blood = default!;
[Dependency] private readonly ReactiveSystem _reactiveSystem = default!;

Expand All @@ -31,6 +37,20 @@ public override void Initialize()

private bool TryUseInjector(Entity<InjectorComponent> injector, EntityUid target, EntityUid user)
{
if (_inventorySystem.TryGetSlotEntity(target, "outerClothing", out var suit))
{
if (TryComp<TagComponent>(suit, out var tag) && tag.Tags.Contains("Hardsuit"))
{
_popup.PopupEntity(Loc.GetString("injector-component-failure-hardsuit"), target, user, PopupType.MediumCaution);
return false;
}
}
else if (TryComp<TagComponent>(target, out var tag) && tag.Tags.Contains("NoInjectable"))
{
_popup.PopupEntity(Loc.GetString("injector-component-failure-hardsuit"), target, user, PopupType.MediumCaution);
return false;
}

// Handle injecting/drawing for solutions
if (injector.Comp.ToggleState == InjectorToggleMode.Inject)
{
Expand Down
55 changes: 43 additions & 12 deletions Content.Server/Mech/Systems/MechSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
using Content.Shared.Mech;
using Content.Shared.Mech.Components;
using Content.Shared.Mech.EntitySystems;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Systems;
using Content.Shared.Mobs.Components;
using Content.Shared.Movement.Events;
using Content.Shared.Popups;
using Content.Shared.Tools.Components;
Expand All @@ -20,7 +23,11 @@
using Content.Shared.Tools.Systems;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.NPC.Components;
using Content.Shared.NPC.Systems;
using Content.Shared.Tag;
using Robust.Server.Audio;
using Robust.Shared.Audio;
using Robust.Server.Containers;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
Expand All @@ -32,6 +39,8 @@ namespace Content.Server.Mech.Systems;
/// <inheritdoc/>
public sealed partial class MechSystem : SharedMechSystem
{
[Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly NpcFactionSystem _factionSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
[Dependency] private readonly BatterySystem _battery = default!;
Expand All @@ -44,6 +53,7 @@ public sealed partial class MechSystem : SharedMechSystem
[Dependency] private readonly SharedToolSystem _toolSystem = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;

/// <inheritdoc/>
public override void Initialize()
Expand Down Expand Up @@ -240,14 +250,11 @@ private void OnMechEntry(EntityUid uid, MechComponent component, MechEntryEvent
return;
}

if (!TryComp<HandsComponent>(args.Args.User, out var handsComponent))
return;

foreach (var hand in _hands.EnumerateHands(args.Args.User, handsComponent))
{
_hands.DoDrop(args.Args.User, hand, true, handsComponent);
}
if (TryComp<HandsComponent>(args.Args.User, out var handsComponent))
foreach (var hand in _hands.EnumerateHands(args.Args.User, handsComponent))
_hands.DoDrop(args.Args.User, hand, true, handsComponent);

_factionSystem.Up(args.Args.User, uid);
TryInsert(uid, args.Args.User, component);
_actionBlocker.UpdateCanMove(uid);

Expand All @@ -259,24 +266,48 @@ private void OnMechExit(EntityUid uid, MechComponent component, MechExitEvent ar
if (args.Cancelled || args.Handled)
return;

RemComp<NpcFactionMemberComponent>(component.Owner);
TryEject(uid, component);

args.Handled = true;
}

private void OnDamageChanged(EntityUid uid, MechComponent component, DamageChangedEvent args)
{
var integrity = component.MaxIntegrity - args.Damageable.TotalDamage;
SetIntegrity(uid, integrity, component);

/*
if (TryComp<DamageableComponent>(uid, out var damage))
{
PlayCritSound(uid, component, damage);
}
*/
if (args.DamageIncreased &&
args.DamageDelta != null &&
component.PilotSlot.ContainedEntity != null)
{
var damage = args.DamageDelta * component.MechToPilotDamageMultiplier;
_damageable.TryChangeDamage(component.PilotSlot.ContainedEntity, damage);
var damagetoplayer = args.DamageDelta * component.MechToPilotDamageMultiplier;
_damageable.TryChangeDamage(component.PilotSlot.ContainedEntity, damagetoplayer);
}
}

private void PlayCritSound(EntityUid uid, MechComponent component, DamageableComponent damage )
{
var total = damage.TotalDamage;
if (_mobThresholdSystem.TryGetThresholdForState(uid, MobState.Critical, out var critThreshold))
{
var damagePercentage = (total / critThreshold) * 100;
if (component.PilotSlot.ContainedEntity != null)
{
if (damagePercentage >= 95)
_audioSystem.PlayPvs(_audioSystem.GetSound(component.Alert5), component.PilotSlot.ContainedEntity.Value);
else if (damagePercentage >= 75)
_audioSystem.PlayPvs(_audioSystem.GetSound(component.Alert25), component.PilotSlot.ContainedEntity.Value);
else if (damagePercentage >= 50)
_audioSystem.PlayPvs(_audioSystem.GetSound(component.Alert50), component.PilotSlot.ContainedEntity.Value);
Dirty(uid ,component);
}
}
}


private void ToggleMechUi(EntityUid uid, MechComponent? component = null, EntityUid? user = null)
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Medical/HealingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private bool HasDamage(DamageableComponent component, HealingComponent healing)
var healingDict = healing.Damage.DamageDict;
foreach (var type in healingDict)
{
if (damageableDict[type.Key].Value > 0)
if (damageableDict.TryGetValue(type.Key, out var damageValue) && damageValue.Value > 0) //Sunrise-edit: fix server crashes
{
return true;
}
Expand Down
11 changes: 11 additions & 0 deletions Content.Server/_Sunrise/Execution/ExecutionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Containers;

namespace Content.Server._Sunrise.Execution;

Expand All @@ -29,6 +30,7 @@ namespace Content.Server._Sunrise.Execution;
/// </summary>
public sealed class ExecutionSystem : EntitySystem
{
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
Expand Down Expand Up @@ -168,6 +170,15 @@ private bool CanExecuteWithGun(EntityUid weapon, EntityUid victim, EntityUid use
// We must be able to actually fire the gun
if (!TryComp<GunComponent>(weapon, out var gun) && _gunSystem.CanShoot(gun!))
return false;

if (_containerSystem.TryGetContainer(weapon, "gun_chamber", out var chamberContainer))
{
foreach (var contained in chamberContainer.ContainedEntities)
{
if (TryComp<CartridgeAmmoComponent>(contained, out var cartridge) && cartridge.Spent)
return false;
}
}

return true;
}
Expand Down
Loading
Loading