Give BaseItem a landing sound (#14504)

This commit is contained in:
metalgearsloth
2023-03-11 19:26:01 +11:00
committed by GitHub
parent 33f388e66e
commit 1533e1b2b1
7 changed files with 38 additions and 22 deletions

View File

@@ -98,12 +98,12 @@ namespace Content.Shared.Sound
if (predict) if (predict)
{ {
_audioSystem.PlayPredicted(component.Sound, component.Owner, user, component.Sound.Params.AddVolume(-2f)); _audioSystem.PlayPredicted(component.Sound, component.Owner, user);
} }
else if (_netMan.IsServer) else if (_netMan.IsServer)
{ {
// don't predict sounds that client couldn't have played already // don't predict sounds that client couldn't have played already
_audioSystem.PlayPvs(component.Sound, component.Owner, component.Sound.Params.AddVolume(-2f)); _audioSystem.PlayPvs(component.Sound, component.Owner);
} }
} }
} }

View File

@@ -82,7 +82,7 @@ public sealed class ThrowingSystem : EntitySystem
if (time < FlyTime) if (time < FlyTime)
{ {
_thrownSystem.LandComponent(comp, physics); _thrownSystem.LandComponent(uid, comp, physics);
} }
else else
{ {
@@ -93,7 +93,7 @@ public sealed class ThrowingSystem : EntitySystem
if (physics.Deleted) if (physics.Deleted)
return; return;
_thrownSystem.LandComponent(comp, physics); _thrownSystem.LandComponent(uid, comp, physics);
}); });
} }
@@ -104,7 +104,7 @@ public sealed class ThrowingSystem : EntitySystem
_gravity.IsWeightless(user.Value, userPhysics)) _gravity.IsWeightless(user.Value, userPhysics))
{ {
var msg = new ThrowPushbackAttemptEvent(); var msg = new ThrowPushbackAttemptEvent();
RaiseLocalEvent(physics.Owner, msg); RaiseLocalEvent(uid, msg);
if (!msg.Cancelled) if (!msg.Cancelled)
_physics.ApplyLinearImpulse(user.Value, -impulseVector * pushbackRatio, body: userPhysics); _physics.ApplyLinearImpulse(user.Value, -impulseVector * pushbackRatio, body: userPhysics);

View File

@@ -8,6 +8,7 @@ using Robust.Shared.GameStates;
using Robust.Shared.Physics; using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics; using Robust.Shared.Physics.Dynamics;
using System.Linq; using System.Linq;
using Content.Shared.Sound.Components;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems; using Robust.Shared.Physics.Systems;
@@ -117,16 +118,17 @@ namespace Content.Shared.Throwing
EntityManager.RemoveComponent<ThrownItemComponent>(uid); EntityManager.RemoveComponent<ThrownItemComponent>(uid);
} }
public void LandComponent(ThrownItemComponent thrownItem, PhysicsComponent physics) public void LandComponent(EntityUid uid, ThrownItemComponent thrownItem, PhysicsComponent physics)
{ {
_physics.SetBodyStatus(physics, BodyStatus.OnGround); _physics.SetBodyStatus(physics, BodyStatus.OnGround);
if (thrownItem.Deleted || Deleted(thrownItem.Owner) || _containerSystem.IsEntityInContainer(thrownItem.Owner)) return; if (thrownItem.Deleted || Deleted(uid) || _containerSystem.IsEntityInContainer(uid))
return;
var landing = thrownItem.Owner; var landing = uid;
// Unfortunately we can't check for hands containers as they have specific names. // Unfortunately we can't check for hands containers as they have specific names.
if (thrownItem.Owner.TryGetContainerMan(out var containerManager) && if (uid.TryGetContainerMan(out var containerManager) &&
EntityManager.HasComponent<SharedHandsComponent>(containerManager.Owner)) EntityManager.HasComponent<SharedHandsComponent>(containerManager.Owner))
{ {
EntityManager.RemoveComponent(landing, thrownItem); EntityManager.RemoveComponent(landing, thrownItem);

View File

@@ -2,7 +2,23 @@
license: "CC-BY-NC-SA-3.0" license: "CC-BY-NC-SA-3.0"
copyright: "Amateur foley and audio editing by Bright0." copyright: "Amateur foley and audio editing by Bright0."
source: "https://github.com/Bright0" source: "https://github.com/Bright0"
- files: ["teleport_arrival.ogg", "teleport_departure.ogg"] - files: ["teleport_arrival.ogg", "teleport_departure.ogg"]
license: "CC-BY-SA-3.0" license: "CC-BY-SA-3.0"
copyright: "tgstation" copyright: "tgstation"
source: "https://github.com/tgstation/tgstation/commit/906fb0682bab6a0975b45036001c54f021f58ae7" source: "https://github.com/tgstation/tgstation/commit/906fb0682bab6a0975b45036001c54f021f58ae7"
- files: ["sadtrombone.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "sadtrombone.ogg taken from Citadel Station."
source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/35a1723e98a60f375df590ca572cc90f1bb80bd5"
- files: ["box_deploy.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "box_deploy.ogg taken from Citadel Station."
source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61"
- files: ["chime.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "chime.ogg taken from Citadel Station."
source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61"

Binary file not shown.

View File

@@ -32,11 +32,6 @@ bite.ogg take from https://github.com/tgstation/tgstation/commit/d4f678a1772007f
bone_rattle.ogg licensed under CC0 1.0 and taken from spookymodem at https://freesound.org/people/spookymodem/sounds/202102/ bone_rattle.ogg licensed under CC0 1.0 and taken from spookymodem at https://freesound.org/people/spookymodem/sounds/202102/
- files: ["sadtrombone.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "sadtrombone.ogg taken from Citadel Station."
source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/35a1723e98a60f375df590ca572cc90f1bb80bd5"
The following sounds are taken from TGstation github (licensed under CC by 3.0): The following sounds are taken from TGstation github (licensed under CC by 3.0):
demon_attack1.ogg: taken at https://github.com/tgstation/tgstation/commit/d4f678a1772007ff8d7eddd21cf7218c8e07bfc0 demon_attack1.ogg: taken at https://github.com/tgstation/tgstation/commit/d4f678a1772007ff8d7eddd21cf7218c8e07bfc0
@@ -49,12 +44,10 @@ pop.ogg licensed under CC0 1.0 by mirrorcult
box_deploy.ogg and chime.ogg taken from Citadel Station at commit: https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61 box_deploy.ogg and chime.ogg taken from Citadel Station at commit: https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61
- files: ["box_deploy.ogg"]
license: "CC-BY-NC-SA-3.0"
copyright: "box_deploy.ogg taken from Citadel Station."
source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61"
- files: ["chime.ogg"] - files:
license: "CC-BY-NC-SA-3.0" - "drop.ogg"
copyright: "chime.ogg taken from Citadel Station." license: "Royalty free"
source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61" copyright: "Sonniss.com - GDC 2016 - Game Audio Bundle - Levan Nadashvili - Soldier Footsteps - FS Concrete Soldier Crouch N02, mixed from stereo to mono"
# Do not add to this list, I only did the above because yaml scheme validator doesn't like custom licenses.

View File

@@ -10,6 +10,11 @@
- type: Clickable - type: Clickable
- type: InteractionOutline - type: InteractionOutline
- type: MovedByPressure - type: MovedByPressure
- type: EmitSoundOnLand
sound:
path: /Audio/Effects/drop.ogg
params:
volume: 2
- type: DamageOnHighSpeedImpact - type: DamageOnHighSpeedImpact
damage: damage:
types: types: