Skip to content

Commit

Permalink
Some missing things
Browse files Browse the repository at this point in the history
  • Loading branch information
Void-Crew2@gm committed Apr 15, 2023
1 parent 4daabb2 commit 971a6ef
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
36 changes: 23 additions & 13 deletions Content.Server/ATLAS/Supermatter/EntitySystems/SupermatterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Robust.Server.GameObjects;
using Content.Shared.Atmos;
using Content.Shared.Damage;
using Content.Shared.Interaction;
using Content.Shared.Projectiles;
using Content.Shared.Tag;
using Content.Shared.Damage.Prototypes;
Expand Down Expand Up @@ -53,6 +54,7 @@ public override void Initialize()
base.Initialize();

SubscribeLocalEvent<SupermatterComponent, StartCollideEvent>(OnCollideEvent);
SubscribeLocalEvent<SupermatterComponent, InteractHandEvent>(OnHandInteract);
}

public override void Update(float frameTime)
Expand Down Expand Up @@ -400,6 +402,21 @@ private void Delamination(EntityUid uid, float frameTime, float damageArchived,

sMcomponent.FinalCountdown = false;
}
private void HandleSoundLoop(EntityUid uid, SupermatterComponent sMcomponent,DamageableComponent damageable)
{
var isAggressive = damageable.TotalDamage.Float() >= 50;
var smSound = isAggressive ? SuperMatterSound.Aggressive : SuperMatterSound.Calm;

if (sMcomponent.SmSound == smSound)
return;

sMcomponent.Stream?.Stop();
var sounds = isAggressive ? sMcomponent.DelamSound : sMcomponent.CalmSound;
var sound = _audio.GetSound(sounds);
var param = sounds.Params.WithLoop(true).WithVolume(5f).WithMaxDistance(20f);
sMcomponent.Stream = _audio.Play(sound, Filter.Pvs(uid), uid, false, param);
sMcomponent.SmSound = smSound;
}

/// <summary>
/// Determines if an entity can be dusted
Expand Down Expand Up @@ -442,20 +459,13 @@ private void OnCollideEvent(EntityUid uid, SupermatterComponent supermatter, ref
EntityManager.QueueDeleteEntity(target);
}

private void HandleSoundLoop(EntityUid uid, SupermatterComponent sMcomponent,DamageableComponent damageable)
private void OnHandInteract(EntityUid uid, SupermatterComponent supermatter, InteractHandEvent args)
{
var isAggressive = damageable.TotalDamage.Float() >= 50;
var smSound = isAggressive ? SuperMatterSound.Aggressive : SuperMatterSound.Calm;

if (sMcomponent.SmSound == smSound)
return;

sMcomponent.Stream?.Stop();
var sounds = isAggressive ? sMcomponent.DelamSound : sMcomponent.CalmSound;
var sound = _audio.GetSound(sounds);
var param = sounds.Params.WithLoop(true).WithVolume(5f).WithMaxDistance(20f);
sMcomponent.Stream = _audio.Play(sound, Filter.Pvs(uid), uid, false, param);
sMcomponent.SmSound = smSound;
var target = args.User;
supermatter.MatterPower += 200;
EntityManager.SpawnEntity("Ash", Transform(target).Coordinates);
_audio.Play(supermatter.DustSound, Filter.Pvs(uid), uid, false);
EntityManager.QueueDeleteEntity(target);
}
}
}
3 changes: 3 additions & 0 deletions Resources/Prototypes/ATLAS/supermatter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
- HighImpassable
- BulletImpassable
- InteractImpassable
- type: Transform
anchored: true
noRot: true
- type: CollisionWake
enabled: false
- type: Clickable
Expand Down

0 comments on commit 971a6ef

Please sign in to comment.