Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/impstation/imp-station-14
Browse files Browse the repository at this point in the history
…into antag-selection-rework
  • Loading branch information
formlessnameless committed Jan 20, 2025
2 parents 11ad8bb + 88a01df commit ce32e72
Show file tree
Hide file tree
Showing 112 changed files with 63,405 additions and 2,470 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,12 @@ private void OnExamineSolution(Entity<ExaminableSolutionComponent> entity, ref E
return;
}

var colorHex = solution.GetColor(PrototypeManager)
.ToHexNoAlpha(); //TODO: If the chem has a dark color, the examine text becomes black on a black background, which is unreadable.
// IMP, luminosity must be at least 0.3
var colorHSL = Color.ToHsl(solution.GetColor(PrototypeManager));
colorHSL.Z = (float) Math.Max(colorHSL.Z, 0.4);

var colorHex = Color.FromHsl(colorHSL)
.ToHexNoAlpha();
var messageString = "shared-solution-container-component-on-examine-main-text";

using (args.PushGroup(nameof(ExaminableSolutionComponent)))
Expand Down Expand Up @@ -922,10 +926,14 @@ private FormattedMessage GetSolutionExamine(Solution solution)

foreach (var (proto, quantity) in sortedReagentPrototypes)
{
// IMP, luminosity must be at least 0.4
var colorHSL = Color.ToHsl(proto.SubstanceColor);
colorHSL.Z = (float) Math.Max(colorHSL.Z, 0.4);

msg.PushNewline();
msg.AddMarkupOrThrow(Loc.GetString("scannable-solution-chemical"
, ("type", proto.LocalizedName)
, ("color", proto.SubstanceColor.ToHexNoAlpha())
, ("color", Color.FromHsl(colorHSL).ToHexNoAlpha())
, ("amount", quantity)));
}

Expand Down
45 changes: 43 additions & 2 deletions Content.Shared/Doors/Systems/SharedDoorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Network;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
//imp edit start
using Content.Shared.Fluids;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Components.SolutionManager;
using Robust.Shared.Containers;
using Robust.Shared.Random;
//imp edit end

namespace Content.Shared.Doors.Systems;

Expand All @@ -45,7 +51,12 @@ public abstract partial class SharedDoorSystem : EntitySystem
[Dependency] protected readonly SharedPopupSystem Popup = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
[Dependency] private readonly SharedPowerReceiverSystem _powerReceiver = default!;

//imp edit start
[Dependency] private readonly SharedPuddleSystem _puddle = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly IRobustRandom _random = default!;
//imp edit end

[ValidatePrototypeId<TagPrototype>]
public const string DoorBumpTag = "DoorBumpOpener";
Expand Down Expand Up @@ -219,6 +230,36 @@ protected void OnActivate(EntityUid uid, DoorComponent door, ActivateInWorldEven
if (!TryToggleDoor(uid, door, args.User, predicted: true))
_pryingSystem.TryPry(uid, args.User, out _);

//imp edit start
//If the door has a bucket propped onto it and is being opened, get the bucket as container
if (_container.TryGetContainer(uid, "bucket", out BaseContainer? container) && door.State == DoorState.Opening)
{
//Foreach in case we ever implement multiple buckets I guess
//Also saves me from checking if the bucket exists
foreach (var bucket in container.ContainedEntities)
{
//Get the chems inside the bucket's container as solution
if (!_solutionContainerSystem.TryGetDrainableSolution(bucket, out var soln, out var solution))
{
//Special case : if the bucket is here but its solution container compnent was removed by an admin or something
//Just drop the bucket and return
_container.RemoveEntity(uid, bucket, null, null, null, true, false, null, _random.NextAngle());
args.Handled = true;
return;
}

//Splash the solution onto the player
_puddle.TrySplashSpillAt(bucket, Transform(uid).Coordinates, solution, out _);

//Remove the solution from the bucket
_solutionContainerSystem.RemoveAllSolution(soln.Value);

//Drop the bucket on the floor
_container.RemoveEntity(uid, bucket, null, null, null, true, false, null, _random.NextAngle());
}
}
//imp edit end

args.Handled = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Foldable;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Components; // imp edit
using Content.Shared.Item;
using Content.Shared.Lock;
using Content.Shared.Movement.Events;
Expand Down Expand Up @@ -358,7 +359,7 @@ public bool CanOpen(EntityUid user, EntityUid target, bool silent = false, Share
if (!ResolveStorage(target, ref component))
return false;

if (!HasComp<HandsComponent>(user))
if (!HasComp<HandsComponent>(user) && !HasComp<ComplexInteractionComponent>(user)) // imp edit - can add ComplexInteractionComponent to entities to allow them to do certain actions without hands
return false;

if (_weldable.IsWelded(target))
Expand Down
19 changes: 19 additions & 0 deletions Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public override void Initialize()
SubscribeLocalEvent<TetheredComponent, BuckleAttemptEvent>(OnTetheredBuckleAttempt);
SubscribeLocalEvent<TetheredComponent, UpdateCanMoveEvent>(OnTetheredUpdateCanMove);
SubscribeLocalEvent<TetheredComponent, EntGotInsertedIntoContainerMessage>(OnTetheredContainerInserted);
SubscribeLocalEvent<TetheredComponent, ThrownEvent>(OnTetheredThrown); // imp

InitializeForce();
}
Expand Down Expand Up @@ -77,6 +78,24 @@ private void OnTetheredUpdateCanMove(EntityUid uid, TetheredComponent component,
args.Cancel();
}

// Imp edit, prevents abusing throwing damage with items that repeatedly throw (i.e. gas tanks)
private void OnTetheredThrown(Entity<TetheredComponent> ent, ref ThrownEvent args)
{
var tetherer = ent.Comp.Tetherer;

if (TryComp<TetherGunComponent>(tetherer, out var tetherGun))
{
StopTether(tetherer, tetherGun);
return;
}

if (TryComp<ForceGunComponent>(tetherer, out var forceGun))
{
StopTether(tetherer, forceGun);
return;
}
}

public override void Update(float frameTime)
{
base.Update(frameTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public sealed partial class DamageOtherOnHitComponent : Component
[DataField, AutoNetworkedField]
public float MeleeDamageMultiplier = 1f;

/// <summary>
/// The minimum velocity required to deal damage.
/// </summary>
[DataField, AutoNetworkedField]
public float MinVelocity = 1f;

/// <summary>
/// The sound to play when this entity hits on a throw.
/// If null, attempts to retrieve the HitSound from MeleeWeaponComponent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private void OnItemToggleMapInit(EntityUid uid, ItemToggleDamageOtherOnHitCompon

private void OnDoHit(EntityUid uid, DamageOtherOnHitComponent component, ThrowDoHitEvent args)
{
if (HasComp<DamageOtherOnHitImmuneComponent>(args.Target))
if (HasComp<DamageOtherOnHitImmuneComponent>(args.Target) || !TryComp<PhysicsComponent>(uid, out var physics))
return;

if (HasComp<PacifiedComponent>(args.Component.Thrower)
Expand All @@ -104,6 +104,10 @@ private void OnDoHit(EntityUid uid, DamageOtherOnHitComponent component, ThrowDo
if (component.HitQuantity >= component.MaxHitQuantity)
return;

// Ignore thrown items that are too slow
if (physics.LinearVelocity.LengthSquared() < component.MinVelocity)
return;

var modifiedDamage = _damageable.TryChangeDamage(args.Target, GetDamage(uid, component, args.Component.Thrower),
component.IgnoreResistances, origin: args.Component.Thrower);

Expand All @@ -123,24 +127,21 @@ private void OnDoHit(EntityUid uid, DamageOtherOnHitComponent component, ThrowDo
if (HasComp<StaminaComponent>(args.Target) && TryComp<StaminaDamageOnHitComponent>(uid, out var stamina))
_stamina.TakeStaminaDamage(args.Target, stamina.Damage, source: uid, sound: stamina.Sound);

if (TryComp<PhysicsComponent>(uid, out var body) && body.LinearVelocity.LengthSquared() > 0f)
if (physics.LinearVelocity.LengthSquared() > 0f)
{
var direction = body.LinearVelocity.Normalized();
var direction = physics.LinearVelocity.Normalized();
_sharedCameraRecoil.KickCamera(args.Target, direction);
}

// TODO: If more stuff touches this then handle it after.
if (TryComp<PhysicsComponent>(uid, out var physics))
{
_thrownItem.LandComponent(args.Thrown, args.Component, physics, false);
_thrownItem.LandComponent(args.Thrown, args.Component, physics, false);

if (!HasComp<EmbeddableProjectileComponent>(args.Thrown))
{
var newVelocity = physics.LinearVelocity;
newVelocity.X = -newVelocity.X / 4;
newVelocity.Y = -newVelocity.Y / 4;
_physics.SetLinearVelocity(uid, newVelocity, body: physics);
}
if (!HasComp<EmbeddableProjectileComponent>(args.Thrown))
{
var newVelocity = physics.LinearVelocity;
newVelocity.X = -newVelocity.X / 4;
newVelocity.Y = -newVelocity.Y / 4;
_physics.SetLinearVelocity(uid, newVelocity, body: physics);
}

component.HitQuantity += 1;
Expand Down
5 changes: 0 additions & 5 deletions Resources/Audio/StationEvents/attributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
copyright: "Created by Bolgarich"
source: "https://www.youtube.com/watch?v=SzEp2nv6oZ4"

- files: ["clearly_nuclear.ogg"]
license: "CC-BY-3.0"
copyright: "Created by mryikes"
source: "https://www.youtube.com/watch?v=chix8uz-oUQ"

- files: ["sound_station_14.ogg"]
license: "CC-BY-3.0"
copyright: "Created by Donchan"
Expand Down
Binary file removed Resources/Audio/StationEvents/clearly_nuclear.ogg
Binary file not shown.
5 changes: 5 additions & 0 deletions Resources/Audio/_Impstation/StationEvents/attributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,8 @@
license: "Custom"
copyright: "Shoot 'Em by Washboard Rhythm Kings"
source: "https://www.youtube.com/watch?v=hx01Bt5BHaM"

- files: ["blatantly_nuclear.ogg"]
license: "Custom"
copyright: "Blatantly Nuclear by mrjajkes is licensed under the following terms: free use and modification with proper credit to the original creator, excluding usage by FulpStation, White Dream, Wizard's Den, and any ERP/sexually-oriented servers, or for commercial use unless granted permission by the author. For commercial use, please contact the author to discuss details."
source: "https://www.youtube.com/watch?v=f5URIS00IIc"
Binary file not shown.
Binary file added Resources/Audio/_Impstation/Weapons/funbaton.ogg
Binary file not shown.
Loading

0 comments on commit ce32e72

Please sign in to comment.