forked from Rxup/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4670791
commit 7816788
Showing
86 changed files
with
137,819 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
Content.Client/Atmos/EntitySystems/GasPressurePumpSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Content.Client.Atmos.UI; | ||
using Content.Shared.Atmos.Components; | ||
using Content.Shared.Atmos.EntitySystems; | ||
using Content.Shared.Atmos.Piping.Binary.Components; | ||
|
||
namespace Content.Client.Atmos.EntitySystems; | ||
|
||
public sealed class GasPressurePumpSystem : SharedGasPressurePumpSystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<GasPressurePumpComponent, AfterAutoHandleStateEvent>(OnPumpUpdate); | ||
} | ||
|
||
private void OnPumpUpdate(Entity<GasPressurePumpComponent> ent, ref AfterAutoHandleStateEvent args) | ||
{ | ||
if (UserInterfaceSystem.TryGetOpenUi<GasPressurePumpBoundUserInterface>(ent.Owner, GasPressurePumpUiKey.Key, out var bui)) | ||
{ | ||
bui.Update(); | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
Content.Server/Backmen/Abilities/Xeno/XenoAbilitiesSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using Content.Server.Weapons.Ranged.Systems; | ||
using Content.Shared.Actions; | ||
using Content.Shared.Backmen.Abilities.Xeno; | ||
using Robust.Server.GameObjects; | ||
using Robust.Shared.Audio.Systems; | ||
|
||
namespace Content.Server.Backmen.Abilities.Xeno; | ||
|
||
public sealed class XenoAbilitiesSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!; | ||
[Dependency] private readonly GunSystem _gunSystem = default!; | ||
[Dependency] private readonly PhysicsSystem _physics = default!; | ||
[Dependency] private readonly SharedTransformSystem _transform = default!; | ||
[Dependency] private readonly SharedActionsSystem _actions = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<XenoAcidSpillerComponent, XenoAcidSpitActionEvent>(OnAcidSpit); | ||
SubscribeLocalEvent<XenoAcidSpillerComponent, ComponentStartup>(OnStartup); | ||
SubscribeLocalEvent<XenoAcidSpillerComponent, ComponentShutdown>(OnShutdown); | ||
} | ||
|
||
private void OnAcidSpit(EntityUid uid, XenoAcidSpillerComponent component, XenoAcidSpitActionEvent args) | ||
{ | ||
if (args.Handled) | ||
return; | ||
|
||
var xform = Transform(uid); | ||
var acidBullet = Spawn(component.BulletSpawnId, xform.Coordinates); | ||
var mapCoords = _transform.ToMapCoordinates(args.Target); | ||
var direction = mapCoords.Position - _transform.GetMapCoordinates(xform).Position; | ||
var userVelocity = _physics.GetMapLinearVelocity(uid); | ||
|
||
_gunSystem.ShootProjectile(acidBullet, direction, userVelocity, uid, uid); | ||
_audioSystem.PlayPvs(component.BulletSound, uid, component.BulletSound.Params); | ||
|
||
args.Handled = true; | ||
} | ||
|
||
private void OnStartup(EntityUid uid, XenoAcidSpillerComponent component, ComponentStartup args) | ||
{ | ||
_actions.AddAction(uid, ref component.AcidSpitAction, component.AcidSpitActionId); | ||
} | ||
|
||
private void OnShutdown(EntityUid uid, XenoAcidSpillerComponent component, ComponentShutdown args) | ||
{ | ||
_actions.RemoveAction(uid, component.AcidSpitAction); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Content.Server.Backmen.Cocoon; | ||
|
||
[RegisterComponent] | ||
public sealed partial class CocoonComponent : Component | ||
{ | ||
public bool WasReplacementAccent = false; | ||
|
||
public string OldAccent = ""; | ||
|
||
[DataField("damagePassthrough")] | ||
public float DamagePassthrough = 0.5f; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Server.Backmen.Cocoon; | ||
|
||
[RegisterComponent] | ||
public sealed partial class CocoonerComponent : Component | ||
{ | ||
[DataField("cocoonDelay")] | ||
public float CocoonDelay = 12f; | ||
|
||
[DataField("cocoonKnockdownMultiplier")] | ||
public float CocoonKnockdownMultiplier = 0.5f; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,272 @@ | ||
using Content.Server.Backmen.Vampiric; | ||
using Content.Server.Body.Components; | ||
using Content.Server.Destructible; | ||
using Content.Server.DoAfter; | ||
using Content.Server.Players; | ||
using Content.Server.Popups; | ||
using Content.Server.Speech.Components; | ||
using Content.Shared.Administration.Logs; | ||
using Content.Shared.Backmen.Arachne; | ||
using Content.Shared.Backmen.Cocoon; | ||
using Content.Shared.Backmen.Vampiric.Components; | ||
using Content.Shared.Containers.ItemSlots; | ||
using Content.Shared.Damage; | ||
using Content.Shared.Database; | ||
using Content.Shared.DoAfter; | ||
using Content.Shared.Examine; | ||
using Content.Shared.Eye.Blinding.Systems; | ||
using Content.Shared.Humanoid; | ||
using Content.Shared.IdentityManagement; | ||
using Content.Shared.Mobs.Components; | ||
using Content.Shared.Nutrition.Components; | ||
using Content.Shared.Storage; | ||
using Content.Shared.Stunnable; | ||
using Content.Shared.Verbs; | ||
using Robust.Shared.Containers; | ||
using Robust.Shared.Player; | ||
using Robust.Shared.Random; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Server.Backmen.Cocoon; | ||
|
||
public sealed class CocoonerSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly PopupSystem _popupSystem = default!; | ||
[Dependency] private readonly DoAfterSystem _doAfter = default!; | ||
[Dependency] private readonly BlindableSystem _blindableSystem = default!; | ||
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!; | ||
[Dependency] private readonly DamageableSystem _damageableSystem = default!; | ||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; | ||
[Dependency] private readonly DestructibleSystem _destructibleSystem = default!; | ||
[Dependency] private readonly IRobustRandom _robustRandom = default!; | ||
[Dependency] private readonly BloodSuckerSystem _bloodSuckerSystem = default!; | ||
|
||
private const string BodySlot = "body_slot"; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<CocoonComponent, EntInsertedIntoContainerMessage>(OnCocEntInserted); | ||
SubscribeLocalEvent<CocoonComponent, EntRemovedFromContainerMessage>(OnCocEntRemoved); | ||
SubscribeLocalEvent<CocoonComponent, DamageChangedEvent>(OnDamageChanged); | ||
|
||
SubscribeLocalEvent<CocoonerComponent, GetVerbsEvent<InnateVerb>>(AddVerbs); | ||
SubscribeLocalEvent<CocoonerComponent, CocoonDoAfterEvent>(OnCocoonDoAfter); | ||
SubscribeLocalEvent<CocoonerComponent, UnCocoonDoAfterEvent>(OnUnCocoonDoAfter); | ||
SubscribeLocalEvent<CocoonComponent, GetVerbsEvent<AlternativeVerb>>(AddSuccVerb); | ||
} | ||
|
||
private void AddSuccVerb(EntityUid uid, CocoonComponent component, GetVerbsEvent<AlternativeVerb> args) | ||
{ | ||
if (!args.CanAccess || !args.CanInteract) | ||
return; | ||
|
||
if (!TryComp<BloodSuckerComponent>(args.User, out var sucker)) | ||
return; | ||
|
||
if (!sucker.WebRequired) | ||
return; | ||
|
||
var victim = _itemSlots.GetItemOrNull(uid, BodySlot); | ||
|
||
if (victim == null) | ||
return; | ||
|
||
if (!TryComp<BloodstreamComponent>(victim, out var stream)) | ||
return; | ||
|
||
AlternativeVerb verb = new() | ||
{ | ||
Act = () => | ||
{ | ||
_bloodSuckerSystem.StartSuccDoAfter(args.User, victim.Value, sucker, stream, false); // start doafter | ||
}, | ||
Text = Loc.GetString("action-name-suck-blood"), | ||
Icon = new SpriteSpecifier.Texture(new("/Textures/Nyanotrasen/Icons/verbiconfangs.png")), | ||
Priority = 2 | ||
}; | ||
args.Verbs.Add(verb); | ||
} | ||
|
||
private void AddVerbs(EntityUid uid, CocoonerComponent component, GetVerbsEvent<InnateVerb> args) | ||
{ | ||
AddCocoonVerb(uid, component, args); | ||
AddUnCocoonVerb(uid, component, args); | ||
} | ||
|
||
private void AddCocoonVerb(EntityUid uid, CocoonerComponent component, GetVerbsEvent<InnateVerb> args) | ||
{ | ||
if (!args.CanAccess || !args.CanInteract || !HasComp<MobStateComponent>(args.Target)) | ||
return; | ||
|
||
InnateVerb verb = new() | ||
{ | ||
Act = () => | ||
{ | ||
StartCocooning(uid, component, args.Target); | ||
}, | ||
Text = Loc.GetString("cocoon"), | ||
Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/Actions/web.png")), | ||
Priority = 2 | ||
}; | ||
args.Verbs.Add(verb); | ||
} | ||
|
||
private void AddUnCocoonVerb(EntityUid uid, CocoonerComponent component, GetVerbsEvent<InnateVerb> args) | ||
{ | ||
if (!args.CanAccess || !args.CanInteract || !HasComp<CocoonComponent>(args.Target)) | ||
return; | ||
|
||
InnateVerb verb = new() | ||
{ | ||
Act = () => | ||
{ | ||
StartUnCocooning(uid, component, args.Target); | ||
}, | ||
Text = Loc.GetString("uncocoon"), | ||
Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/Actions/web.png")), | ||
Priority = 2 | ||
}; | ||
args.Verbs.Add(verb); | ||
} | ||
|
||
private void StartCocooning(EntityUid uid, CocoonerComponent component, EntityUid target) | ||
{ | ||
_popupSystem.PopupEntity(Loc.GetString("cocoon-start-third-person", | ||
("target", Identity.Entity(target, EntityManager)), | ||
("spider", Identity.Entity(uid, EntityManager))), | ||
uid, | ||
Shared.Popups.PopupType.MediumCaution); | ||
|
||
var delay = component.CocoonDelay; | ||
|
||
if (HasComp<KnockedDownComponent>(target)) | ||
delay *= component.CocoonKnockdownMultiplier; | ||
|
||
var args = new DoAfterArgs(EntityManager, uid, delay, new CocoonDoAfterEvent(), uid, target: target) | ||
{ | ||
BreakOnMove = true, | ||
}; | ||
|
||
_doAfter.TryStartDoAfter(args); | ||
} | ||
|
||
private void StartUnCocooning(EntityUid uid, CocoonerComponent component, EntityUid target) | ||
{ | ||
_popupSystem.PopupEntity(Loc.GetString("uncocoon-start-third-person", | ||
("target", target), | ||
("spider", Identity.Entity(uid, EntityManager))), | ||
uid, | ||
Shared.Popups.PopupType.MediumCaution); | ||
|
||
var delay = component.CocoonDelay / 2; | ||
|
||
var args = new DoAfterArgs(EntityManager, uid, delay, new UnCocoonDoAfterEvent(), uid, target: target) | ||
{ | ||
BreakOnMove = true, | ||
}; | ||
|
||
_doAfter.TryStartDoAfter(args); | ||
} | ||
|
||
private void OnCocEntInserted(EntityUid uid, CocoonComponent component, EntInsertedIntoContainerMessage args) | ||
{ | ||
_blindableSystem.UpdateIsBlind(args.Entity); | ||
EnsureComp<StunnedComponent>(args.Entity); | ||
|
||
if (TryComp<ReplacementAccentComponent>(args.Entity, out var currentAccent)) | ||
{ | ||
component.WasReplacementAccent = true; | ||
component.OldAccent = currentAccent.Accent; | ||
currentAccent.Accent = "mumble"; | ||
} | ||
else | ||
{ | ||
component.WasReplacementAccent = false; | ||
var replacement = EnsureComp<ReplacementAccentComponent>(args.Entity); | ||
replacement.Accent = "mumble"; | ||
} | ||
} | ||
|
||
private void OnCocEntRemoved(EntityUid uid, CocoonComponent component, EntRemovedFromContainerMessage args) | ||
{ | ||
if (component.WasReplacementAccent && TryComp<ReplacementAccentComponent>(args.Entity, out var replacement)) | ||
{ | ||
replacement.Accent = component.OldAccent; | ||
} | ||
else | ||
{ | ||
RemComp<ReplacementAccentComponent>(args.Entity); | ||
} | ||
|
||
RemComp<StunnedComponent>(args.Entity); | ||
_blindableSystem.UpdateIsBlind(args.Entity); | ||
} | ||
|
||
private void OnDamageChanged(EntityUid uid, CocoonComponent component, DamageChangedEvent args) | ||
{ | ||
if (!args.DamageIncreased) | ||
return; | ||
|
||
if (args.DamageDelta == null) | ||
return; | ||
|
||
var body = _itemSlots.GetItemOrNull(uid, BodySlot); | ||
|
||
if (body == null) | ||
return; | ||
|
||
var damage = args.DamageDelta * component.DamagePassthrough; | ||
_damageableSystem.TryChangeDamage(body, damage); | ||
} | ||
|
||
|
||
private void OnCocoonDoAfter(EntityUid uid, CocoonerComponent component, CocoonDoAfterEvent args) | ||
{ | ||
if (args.Handled || args.Cancelled || args.Args.Target == null) | ||
return; | ||
|
||
var spawnProto = HasComp<HumanoidAppearanceComponent>(args.Args.Target) ? "CocoonedHumanoid" : "CocoonSmall"; | ||
Transform(args.Args.Target.Value).AttachToGridOrMap(); | ||
var cocoon = Spawn(spawnProto, Transform(args.Args.Target.Value).Coordinates); | ||
|
||
if (!TryComp<ItemSlotsComponent>(cocoon, out var slots)) | ||
return; | ||
|
||
_itemSlots.SetLock(cocoon, BodySlot, false, slots); | ||
_itemSlots.TryInsert(cocoon, BodySlot, args.Args.Target.Value, args.Args.User); | ||
_itemSlots.SetLock(cocoon, BodySlot, true, slots); | ||
|
||
var impact = (spawnProto == "CocoonedHumanoid") ? LogImpact.High : LogImpact.Medium; | ||
|
||
_adminLogger.Add(LogType.Action, | ||
impact, | ||
$"{ToPrettyString(args.Args.User):player} cocooned {ToPrettyString(args.Args.Target.Value):target}"); | ||
args.Handled = true; | ||
} | ||
|
||
private void OnUnCocoonDoAfter(EntityUid uid, CocoonerComponent component, UnCocoonDoAfterEvent args) | ||
{ | ||
if (args.Handled || args.Cancelled || args.Args.Target == null) | ||
return; | ||
|
||
if (TryComp<ButcherableComponent>(args.Args.Target.Value, out var butcher)) | ||
{ | ||
var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom); | ||
var coords = Transform(args.Args.Target.Value).MapPosition; | ||
EntityUid popupEnt = default!; | ||
foreach (var proto in spawnEntities) | ||
{ | ||
popupEnt = Spawn(proto, coords.Offset(_robustRandom.NextVector2(0.25f))); | ||
} | ||
} | ||
|
||
_destructibleSystem.DestroyEntity(args.Args.Target.Value); | ||
|
||
_adminLogger.Add(LogType.Action, | ||
LogImpact.Low, | ||
$"{ToPrettyString(args.Args.User):player} uncocooned {ToPrettyString(args.Args.Target.Value):target}"); | ||
args.Handled = true; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Content.Server/Backmen/Traits/Specific/Giant/TraitGiantComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Content.Server.Backmen.Traits.Specific.Giant; | ||
|
||
[RegisterComponent] | ||
public sealed partial class TraitGiantComponent : Component | ||
{ | ||
[DataField] | ||
public float Scale { get; set; } | ||
} |
Oops, something went wrong.