Skip to content

Commit

Permalink
Merge PR DeltaV-Station#37 by Tetronamecronicus (MaxWell)
Browse files Browse the repository at this point in the history
MaxWellCM
  • Loading branch information
EndrAnimet authored May 23, 2024
2 parents 6585417 + 0104109 commit f6e47a4
Show file tree
Hide file tree
Showing 16 changed files with 175 additions and 1 deletion.
55 changes: 55 additions & 0 deletions Content.Server/Stray/AudioLoop/AudioLoopSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//AudioParams auSt = new AudioParams();
//auSt.Loop = true;
//AudioComponent audi = _audio.SetupAudio(uid, audiCom.fileName, auSt);
//audi.StartPlaying();
using Robust.Shared.Audio.Systems;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Components;
using Content.Shared.Interaction;
using Robust.Shared.Audio.Effects;
using Content.Shared.Stray.AudioLoop;
using JetBrains.Annotations;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;



namespace Content.Server.Stray.AudioLoop;

[UsedImplicitly]
public sealed class DiceSystem : SharedAudioLoopSystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;


public override void ActToggle(EntityUid uid, AudioLoopComponent audiCom, UseInHandEvent args){
audiCom.act = !audiCom.act;

if(audiCom.act==false){
_audio.Stop(audiCom.ent, audiCom.auC);
}else{
(EntityUid Entity, AudioComponent Component)? res = _audio.PlayPvs(audiCom.sound, uid, new AudioParams(0, 1, SharedAudioSystem.DefaultSoundRange, 3, 1, true, 0f));
if(res!=null){
audiCom.ent = res.Value.Entity;
audiCom.auC = res.Value.Component;
}
}
}

//public override void OnSpawn(EntityUid uid, AudioLoopComponent audiCom, MapInitEvent args){
// //AudioParams auSt = new(0, 1, SharedAudioSystem.DefaultSoundRange, 1, 1, true, 0f);//new AudioParams();
// //auSt.Loop = true;
// //auSt.RolloffFactor = 1;
// ////source.RolloffFactor = audioParams.RolloffFactor;
// //auSt.MaxDistance = 15;
// //auSt.ReferenceDistance = 1;
// //AudioComponent audi = _audio.SetupAudio(uid, audiCom.fileName, auSt);
// //audi.StartPlaying();
// (EntityUid Entity, AudioComponent Component)? res = _audio.PlayPvs(audiCom.sound, uid, new AudioParams(0, 1, SharedAudioSystem.DefaultSoundRange, 1, 1, true, 0f));
// if(res!=null){
// audiCom.ent = res.Value.Entity;
// audiCom.auC = res.Value.Component;
// }
//}

}
32 changes: 32 additions & 0 deletions Content.Shared/Stray/AudioLoop/AudioLoopComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//Audio/Items/drill_use.ogg
using System;
using System.Collections.Generic;
using System.Numerics;
using Robust.Shared.Audio.Effects;
using Robust.Shared.Audio.Sources;
using Robust.Shared.Audio.Systems;
using Robust.Shared.GameObjects;
using Content.Shared.Stray.AudioLoop;
using Robust.Shared.GameStates;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Components;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.ViewVariables;

namespace Content.Shared.Stray.AudioLoop;

/// <summary>
/// Stores the audio data for an audio entity.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), Access(typeof(SharedAudioLoopSystem))]
public sealed partial class AudioLoopComponent : Component
{
[DataField("sound",required: true)]
public SoundSpecifier sound { get; private set; }
public EntityUid ent;
public AudioComponent auC;
[AutoNetworkedField]
public bool act = false;
}
34 changes: 34 additions & 0 deletions Content.Shared/Stray/AudioLoop/SharedAudioLoopSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Robust.Shared.Audio.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Content.Shared.Interaction;
using Robust.Shared.Audio.Effects;
using Robust.Shared.GameObjects;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;

namespace Content.Shared.Stray.AudioLoop;

public abstract partial class SharedAudioLoopSystem : EntitySystem
{

public override void Initialize()
{
base.Initialize();
//_audio.
//InitializeEffect();
//ZOffset = CfgManager.GetCVar(CVars.AudioZOffset);
//Subs.CVar(CfgManager, CVars.AudioZOffset, SetZOffset);
//SubscribeLocalEvent<AudioComponent, ComponentGetStateAttemptEvent>(OnAudioGetStateAttempt);
//SubscribeLocalEvent<AudioLoopComponent, MapInitEvent>(OnSpawn);
SubscribeLocalEvent<AudioLoopComponent, UseInHandEvent>(ActToggle);
}
//(EntityUid uid, string? fileName, AudioParams? audioParams, TimeSpan? length = null)
//public virtual void OnSpawn(EntityUid uid, AudioLoopComponent audiCom, MapInitEvent args){
//
//}

public virtual void ActToggle(EntityUid uid, AudioLoopComponent audiCom, UseInHandEvent args){

}
}
Binary file not shown.
2 changes: 2 additions & 0 deletions Resources/Prototypes/Catalog/Fills/Crates/fun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- id: PlushieMoth
- id: PlushieMothRandom # Nyanotrasen - Random Moth Plushies
amount: 2
- id: ToyMaxwell
- id: PlushieArachind
- id: PlushiePenguin

Expand Down Expand Up @@ -308,6 +309,7 @@
- id: ClothingHeadHatMagician
- id: BeachBall
- id: ClothingShoesSkates
- id: ToyMaxwell

- type: entity
id: CrateFunBikeHornImplants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- PlushieSharkGrey
- ToyAmongPequeno
- ToyMouse
- ToyMaxwell # Stray Toy
- PlushieDiona
- PlushieMoth
- PlushieMothRandom # Nyanotrasen Random Moth Plushies
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
bodyType: Kinematic
- type: CustomGhosts
maxRandomIndex: 5
ckeys: ""
ckeys: Kotovasu
- type: Body
prototype: Aghost
- type: Access
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@
- id: GoldenBikeHorn
prob: 0.1
orGroup: GiftPool
#- id: ToyMaxwell # Stray Toy
# onGroup: GiftPool
- id: ToyRenault # DeltaV Toy, see Resources/Prototypes/DeltaV/Entities/Objects/Fun/toys.yml
orGroup: GiftPool
- id: ToySiobhan # DeltaV Toy, see Resources/Prototypes/DeltaV/Entities/Objects/Fun/toys.yml
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Objects/Decoration/present.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
orGroup: GiftPool
- id: PlushieArachind
orGroup: GiftPool
#- id: ToyMaxwell # Stray Toy
# onGroup: GiftPool
- id: ClothingNeckCloakMoth
orGroup: GiftPool
- id: ToyMouse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
- BeachBall
- PlushieMoth
- PlushieHampter
- ToyMaxwell # Stray Toy
- ToyRenault # DeltaV Toy, see Resources/Prototypes/DeltaV/Entities/Objects/Fun/toys.yml
- ToySiobhan # DeltaV Toy, see Resources/Prototypes/DeltaV/Entities/Objects/Fun/toys.yml
- PlushiePenguin
Expand Down
15 changes: 15 additions & 0 deletions Resources/Prototypes/Stray/Entities/Objects/Fun/toys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- type: entity
parent: BasePlushie
id: ToyMaxwell
name: Максвелл
description: "Игрушка Максвелла. По неизвестной причине постоянно крутится и издаёт музыку"
components:
- type: Sprite
sprite: Stray/Objects/Fun/toys.rsi
state: maxwell
- type: AudioLoop
sound:
path: /Audio/Stray/Fun/maxwell-the-cat-theme.ogg
#- type: EmitSoundOnSpawn
# sound:
# path: /Audio/Weapons/Guns/Gunshots/rocket_launcher.ogg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"name": "2",
"directions": 4
},

{
"name": "3",
"directions": 4
Expand Down Expand Up @@ -47,6 +48,9 @@
0.1
]
]
},
{
"name": "Kotovasu"
}
]
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions Resources/Textures/Stray/Objects/Fun/toys.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Made for DeltaV-Stray by boctonskuitea",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "maxwell",
"delays": [
[
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1
]
]
}
]
}

0 comments on commit f6e47a4

Please sign in to comment.