public NormalSourceVoice(SoundSystem system, WaveFormat format) { this.system = system; sourceVoice = new SourceVoice(system.AudioDevice, format); sourceVoice.StreamEnd += new EventHandler(sourceVoice_StreamEnd); defaultOutputMatrix = sourceVoice.GetOutputMatrix(sourceVoice.VoiceDetails.InputChannels, system.DeviceDetails.OutputFormat.Channels); }
private void OnInteractHand(EntityUid uid, KnockedDownComponent knocked, InteractHandEvent args) { if (args.Handled || knocked.HelpTimer > 0f) { return; } // Set it to half the help interval so helping is actually useful... knocked.HelpTimer = knocked.HelpInterval / 2f; _statusEffectSystem.TryRemoveTime(uid, "KnockedDown", TimeSpan.FromSeconds(knocked.HelpInterval)); SoundSystem.Play(Filter.Pvs(uid), knocked.StunAttemptSound.GetSound(), uid, AudioHelpers.WithVariation(0.05f)); knocked.Dirty(); args.Handled = true; }
private void OnUse(EntityUid uid, DrinkComponent component, UseInHandEvent args) { if (args.Handled) { return; } if (!component.Opened) { //Do the opening stuff like playing the sounds. SoundSystem.Play(Filter.Pvs(args.User), component.OpenSounds.GetSound(), args.User, AudioParams.Default); SetOpen(uid, true, component); return; } args.Handled = TryDrink(args.User, args.User, component); }
public void Ioc_ResolvingRegisteredObjectsWithRegisteredObjectConstructors_ObjectWasResolve() { //arrange Ioc container = new Ioc(); ISpeakers logitech = new Speakers(); ICdPlayer pioneer = new CdPlayer(); ISoundSystem onkio = new SoundSystem(logitech, pioneer); container.Register <ISpeakers, Speakers>(); container.Register <ICdPlayer, CdPlayer>(); container.Register <ISoundSystem, SoundSystem>(); //act var actual = container.Resolve <ISoundSystem>(); //assert Assert.IsType(onkio.GetType(), actual); }
private void Spark() { if (RobustRandom.NextFloat() <= SparkChance) { if (!_foundTile || _targetGrid == default || (!EntityManager.EntityExists(_targetGrid) ? EntityLifeStage.Deleted : EntityManager.GetComponent <MetaDataComponent>(_targetGrid).EntityLifeStage) >= EntityLifeStage.Deleted || !_atmosphere.IsSimulatedGrid(_targetGrid)) { return; } // Don't want it to be so obnoxious as to instantly murder anyone in the area but enough that // it COULD start potentially start a bigger fire. _atmosphere.HotspotExpose(_targetGrid, _targetTile, 700f, 50f, true); SoundSystem.Play("/Audio/Effects/sparks4.ogg", Filter.Pvs(_targetCoords), _targetCoords); } }
public static void FlashAreaHelper(IEntity source, float range, float duration, string?sound = null) { foreach (var entity in IoCManager.Resolve <IEntityLookup>().GetEntitiesInRange(source.Transform.Coordinates, range)) { if (!entity.TryGetComponent(out FlashableComponent? flashable) || !source.InRangeUnobstructed(entity, range, CollisionGroup.Opaque)) { continue; } flashable.Flash(duration); } if (!string.IsNullOrEmpty(sound)) { SoundSystem.Play(Filter.Pvs(source), sound, source.Transform.Coordinates); } }
/// <summary> /// Triggers when the host receives damage which puts the host in either critical or killed state /// </summary> private void OnHostStateChange(EntityUid uid, GuardianHostComponent component, MobStateChangedEvent args) { if (component.HostedGuardian == null) { return; } if (args.CurrentMobState.IsCritical()) { _popupSystem.PopupEntity(Loc.GetString("guardian-critical-warn"), component.HostedGuardian.Value, Filter.Entities(component.HostedGuardian.Value)); SoundSystem.Play(Filter.Entities(component.HostedGuardian.Value), "/Audio/Effects/guardian_warn.ogg", component.HostedGuardian.Value); } else if (args.CurrentMobState.IsDead()) { SoundSystem.Play(Filter.Pvs(uid), "/Audio/Voice/Human/malescream_guardian.ogg", uid, AudioHelpers.WithVariation(0.20f)); EntityManager.RemoveComponent <GuardianHostComponent>(uid); } }
private void TurnOff(StunbatonComponent comp) { if (!comp.Activated) { return; } if (TryComp <AppearanceComponent>(comp.Owner, out var appearance) && TryComp <ItemComponent>(comp.Owner, out var item)) { _item.SetHeldPrefix(comp.Owner, "off", item); appearance.SetData(ToggleVisuals.Toggled, false); } SoundSystem.Play(comp.SparksSound.GetSound(), Filter.Pvs(comp.Owner), comp.Owner, AudioHelpers.WithVariation(0.25f)); comp.Activated = false; }
public void Down(StandingStateComponent component, bool playSound = true, bool dropHeldItems = true) { if (!component.Standing) { return; } var entity = component.Owner; var uid = entity.Uid; // This is just to avoid most callers doing this manually saving boilerplate // 99% of the time you'll want to drop items but in some scenarios (e.g. buckling) you don't want to. // We do this BEFORE downing because something like buckle may be blocking downing but we want to drop hand items anyway // and ultimately this is just to avoid boilerplate in Down callers + keep their behavior consistent. if (dropHeldItems) { Get <SharedHandsSystem>().DropHandItems(entity, false); } var msg = new DownAttemptEvent(); EntityManager.EventBus.RaiseLocalEvent(uid, msg); if (msg.Cancelled) { return; } component.Standing = false; component.Dirty(); EntityManager.EventBus.RaiseLocalEvent(uid, new DownedEvent()); // Seemed like the best place to put it if (entity.TryGetComponent(out SharedAppearanceComponent? appearance)) { appearance.SetData(RotationVisuals.RotationState, RotationState.Horizontal); } // Currently shit is only downed by server but when it's predicted we can probably only play this on server / client if (playSound) { SoundSystem.Play(Filter.Pvs(entity), component.DownSoundCollection.GetSound(), entity, AudioHelpers.WithVariation(0.25f)); } }
public void CloseStorage(EntityUid uid, EntityStorageComponent?component = null) { if (!Resolve(uid, ref component)) { return; } component.Open = false; var targetCoordinates = new EntityCoordinates(uid, component.EnteringOffset); var entities = _lookup.GetEntitiesInRange(targetCoordinates, component.EnteringRange, LookupFlags.Approximate); var ev = new StorageBeforeCloseEvent(uid, entities); RaiseLocalEvent(uid, ev, true); var count = 0; foreach (var entity in ev.Contents) { if (!ev.BypassChecks.Contains(entity)) { if (!CanFit(entity, uid, component.Whitelist)) { continue; } } if (!AddToContents(entity, uid, component)) { continue; } count++; if (count >= component.Capacity) { break; } } ModifyComponents(uid, component); SoundSystem.Play(component.CloseSound.GetSound(), Filter.Pvs(uid), uid); component.LastInternalOpenAttempt = default; RaiseLocalEvent(uid, new StorageAfterCloseEvent()); }
private void HighPressureMovements(GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile) { // TODO ATMOS finish this if (tile.PressureDifference > 15) { if (_spaceWindSoundCooldown == 0) { var coordinates = tile.GridIndices.ToEntityCoordinates(tile.GridIndex, _mapManager); if (!string.IsNullOrEmpty(SpaceWindSound)) { SoundSystem.Play(Filter.Pvs(coordinates), SpaceWindSound, coordinates, AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100))); } } } foreach (var entity in Get <GridTileLookupSystem>().GetEntitiesIntersecting(tile.GridIndex, tile.GridIndices)) { if (!entity.TryGetComponent(out IPhysBody? physics) || !entity.IsMovedByPressure(out var pressure) || entity.IsInContainer()) { continue; } var pressureMovements = physics.Owner.EnsureComponent <MovedByPressureComponent>(); if (pressure.LastHighPressureMovementAirCycle < gridAtmosphere.UpdateCounter) { pressureMovements.ExperiencePressureDifference(gridAtmosphere.UpdateCounter, tile.PressureDifference, tile.PressureDirection, 0, tile.PressureSpecificTarget?.GridIndices.ToEntityCoordinates(tile.GridIndex, _mapManager) ?? EntityCoordinates.Invalid); } } if (tile.PressureDifference > 100) { // TODO ATMOS Do space wind graphics here! } _spaceWindSoundCooldown++; if (_spaceWindSoundCooldown > 75) { _spaceWindSoundCooldown = 0; } }
public bool TryScream(EntityUid uid, VocalComponent?component = null) { if (!Resolve(uid, ref component, false)) { return(false); } if (!_blocker.CanSpeak(uid)) { return(false); } var sex = Sex.Male; //the default is male because requiring humanoid appearance for this is dogshit if (TryComp(uid, out HumanoidAppearanceComponent? humanoid)) { sex = humanoid.Sex; } if (_random.Prob(component.WilhelmProbability)) { SoundSystem.Play(component.Wilhelm.GetSound(), Filter.Pvs(uid), uid, component.AudioParams); return(true); } var scale = (float)_random.NextGaussian(1, VocalComponent.Variation); var pitchedParams = component.AudioParams.WithPitchScale(scale); switch (sex) { case Sex.Male: SoundSystem.Play(component.MaleScream.GetSound(), Filter.Pvs(uid), uid, pitchedParams); break; case Sex.Female: SoundSystem.Play(component.FemaleScream.GetSound(), Filter.Pvs(uid), uid, pitchedParams); break; default: throw new ArgumentOutOfRangeException(); } return(true); }
private static void Initialize(EngineConfiguration configuration) { // Create the scripting interface first so any other component can register their cvars/commands. ScriptingInterface = SystemFactory.CreateScriptingInterface(); // Register cvars/commands that are required by the engine. RegisterCvars(configuration); RegisterCommands(); // Create the file system now so that the client/server dlls can be loaded. FileSystem = SystemFactory.CreateFileSystem(); if (HasServer) { server = LoadDLL <IServer>("fs_server"); server.Initialize(); } if (HasClient) { client = LoadDLL <IClient>("fs_client"); client.Initialize(); } ResourceManager = SystemFactory.CreateResourceManager(); SoundSystem = SystemFactory.CreateSoundSystem(); Window = SystemFactory.CreateWindow(); Renderer = SystemFactory.CreateRenderer(); Timer = SystemFactory.CreateTimer(); if (HasServer) { server.Load(); } if (HasClient) { Renderer.Initialize(); client.Load(); SoundSystem.Initialize(); } }
private bool TurnOn(IEntity user) { if (Activated) { return(false); } if (Cell == null) { if (TurnOnFailSound != null) { SoundSystem.Play(Filter.Pvs(Owner), TurnOnFailSound, Owner); } Owner.PopupMessage(user, Loc.GetString("handheld-light-component-cell-missing-message")); UpdateLightAction(); return(false); } // To prevent having to worry about frame time in here. // Let's just say you need a whole second of charge before you can turn it on. // Simple enough. if (Wattage > Cell.CurrentCharge) { if (TurnOnFailSound != null) { SoundSystem.Play(Filter.Pvs(Owner), TurnOnFailSound, Owner); } Owner.PopupMessage(user, Loc.GetString("handheld-light-component-cell-dead-message")); UpdateLightAction(); return(false); } Activated = true; UpdateLightAction(); SetState(true); Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this)); if (TurnOnSound != null) { SoundSystem.Play(Filter.Pvs(Owner), TurnOnSound, Owner); } return(true); }
async Task <bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { var item = eventArgs.Using; if (!item.TryGetComponent(out MeleeWeaponComponent? meleeWeaponComponent)) { return(false); } Owner.GetComponent <IDamageableComponent>().ChangeDamage(DamageType.Blunt, meleeWeaponComponent.Damage, false, item); if (!item.TryGetComponent(out PickaxeComponent? pickaxeComponent)) { return(true); } SoundSystem.Play(Filter.Pvs(Owner), pickaxeComponent.MiningSound.GetSound(), Owner, AudioParams.Default); return(true); }
/// <summary> /// Teleports the user to the clicked location /// </summary> /// <param name="args"></param> private void OnTeleportSpell(TeleportSpellEvent args) { if (args.Handled) { return; } var transform = Transform(args.Performer); if (transform.MapID != args.Target.MapId) { return; } transform.WorldPosition = args.Target.Position; transform.AttachToGridOrMap(); SoundSystem.Play(args.BlinkSound.GetSound(), Filter.Pvs(args.Target), args.Performer, AudioParams.Default.WithVolume(args.BlinkVolume)); args.Handled = true; }
private void TurnOff(StunbatonComponent comp) { if (!comp.Activated) { return; } if (!comp.Owner.TryGetComponent <SpriteComponent>(out var sprite) || !comp.Owner.TryGetComponent <ItemComponent>(out var item)) { return; } SoundSystem.Play(Filter.Pvs(comp.Owner), comp.SparksSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f)); item.EquippedPrefix = "off"; // TODO stunbaton visualizer sprite.LayerSetState(0, "stunbaton_off"); comp.Activated = false; }
// TODO AUDIO PREDICT Figure out a better way to handle sound and prediction. For now, this works well enough? // // Currently a client will predict when a door is going to close automatically. So any client in PVS range can just // play their audio locally. Playing it server-side causes an odd delay, while in shared it causes double-audio. // // But if we just do that, then if a door is closed prematurely as the result of an interaction (i.e., using "E" on // an open door), then the audio would only be played for the client performing the interaction. // // So we do this: // - Play audio client-side IF the closing is being predicted (auto-close or predicted interaction) // - Server assumes automated closing is predicted by clients and does not play audio unless otherwise specified. // - Major exception is player interactions, which other players cannot predict // - In that case, send audio to all players, except possibly the interacting player if it was a predicted // interaction. /// <summary> /// Selectively send sound to clients, taking care to not send the double-audio. /// </summary> /// <param name="uid">The audio source</param> /// <param name="sound">The sound</param> /// <param name="predictingPlayer">The user (if any) that instigated an interaction</param> /// <param name="predicted">Whether this interaction would have been predicted. If the predicting player is null, /// this assumes it would have been predicted by all players in PVS range.</param> protected override void PlaySound(EntityUid uid, string sound, AudioParams audioParams, EntityUid?predictingPlayer, bool predicted) { // If this sound would have been predicted by all clients, do not play any audio. if (predicted && predictingPlayer == null) { return; } var filter = Filter.Pvs(uid); if (predicted) { // This interaction is predicted, but only by the instigating user, who will have played their own sounds. filter.RemoveWhereAttachedEntity(e => e == predictingPlayer); } // send the sound to players. SoundSystem.Play(filter, sound, uid, audioParams); }
/// <summary> /// Called once as soon as an event is active. /// Can also be used for some initial setup. /// </summary> public virtual void Announce() { IoCManager.Resolve <IAdminLogManager>() .Add(LogType.EventAnnounced, $"Event announce: {Name}"); if (AnnounceEvent && StartAnnouncement != null) { var chatSystem = IoCManager.Resolve <IEntitySystemManager>().GetEntitySystem <ChatSystem>(); chatSystem.DispatchGlobalStationAnnouncement(StartAnnouncement, playDefaultSound: false, colorOverride: Color.Gold); } if (AnnounceEvent && StartAudio != null) { SoundSystem.Play(StartAudio.GetSound(), Filter.Broadcast(), AudioParams); } Announced = true; Running = true; }
public void ToggleLight(UnpoweredFlashlightComponent flashlight) { if (!EntityManager.TryGetComponent(flashlight.Owner, out PointLightComponent? light)) { return; } flashlight.LightOn = !flashlight.LightOn; light.Enabled = flashlight.LightOn; if (EntityManager.TryGetComponent(flashlight.Owner, out AppearanceComponent? appearance)) { appearance.SetData(UnpoweredFlashlightVisuals.LightOn, flashlight.LightOn); } SoundSystem.Play(Filter.Pvs(light.Owner), flashlight.ToggleSound.GetSound(), flashlight.Owner); RaiseLocalEvent(flashlight.Owner, new LightToggleEvent(flashlight.LightOn)); }
private void OnHealingComplete(EntityUid uid, DamageableComponent component, HealingCompleteEvent args) { if (TryComp <StackComponent>(args.Component.Owner, out var stack) && stack.Count < 1) { return; } if (component.DamageContainerID is not null && !component.DamageContainerID.Equals(component.DamageContainerID)) { return; } if (args.Component.BloodlossModifier != 0) { // Heal some bloodloss damage. _bloodstreamSystem.TryModifyBleedAmount(uid, args.Component.BloodlossModifier); } var healed = _damageable.TryChangeDamage(uid, args.Component.Damage, true); // Reverify that we can heal the damage. if (healed == null) { return; } _stacks.Use(args.Component.Owner, 1, stack); if (uid != args.User) { _logs.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed {EntityManager.ToPrettyString(uid):target} for {healed.Total:damage} damage"); } else { _logs.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed themselves for {healed.Total:damage} damage"); } if (args.Component.HealingEndSound != null) { SoundSystem.Play(Filter.Pvs(uid, entityManager: EntityManager), args.Component.HealingEndSound.GetSound(), uid, AudioHelpers.WithVariation(0.125f).WithVolume(-5f)); } }
/// <summary> /// /// </summary> /// <param name="puddleUid">Puddle to which we add</param> /// <param name="addedSolution">Solution that is added to puddleComponent</param> /// <param name="sound">Play sound on overflow</param> /// <param name="checkForOverflow">Overflow on encountered values</param> /// <param name="puddleComponent">Optional resolved PuddleComponent</param> /// <returns></returns> public bool TryAddSolution(EntityUid puddleUid, Solution addedSolution, bool sound = true, bool checkForOverflow = true, PuddleComponent?puddleComponent = null) { if (!Resolve(puddleUid, ref puddleComponent)) { return(false); } if (addedSolution.TotalVolume == 0 || !_solutionContainerSystem.TryGetSolution(puddleComponent.Owner, puddleComponent.SolutionName, out var puddleSolution)) { return(false); } var result = _solutionContainerSystem .TryMixAndOverflow(puddleComponent.Owner, puddleSolution, addedSolution, puddleComponent.OverflowVolume, out var overflowSolution); if (checkForOverflow && overflowSolution != null) { _fluidSpreaderSystem.AddOverflowingPuddle(puddleComponent, overflowSolution); } if (!result) { return(false); } RaiseLocalEvent(puddleComponent.Owner, new SolutionChangedEvent(), true); if (!sound) { return(true); } SoundSystem.Play(puddleComponent.SpillSound.GetSound(), Filter.Pvs(puddleComponent.Owner), puddleComponent.Owner); return(true); }
private void OnInteractHand(EntityUid uid, PoweredLightComponent light, InteractHandEvent args) { if (args.Handled) { return; } // check if light has bulb to eject var bulbUid = GetBulb(uid, light); if (bulbUid == null) { return; } // check if it's possible to apply burn damage to user var userUid = args.User.Uid; if (EntityManager.TryGetComponent(userUid, out HeatResistanceComponent? heatResist) && EntityManager.TryGetComponent(bulbUid.Value, out LightBulbComponent? lightBulb)) { // get users heat resistance var res = heatResist.GetHeatResistance(); // check heat resistance against user var burnedHand = light.CurrentLit && res < lightBulb.BurningTemperature; if (burnedHand) { // apply damage to users hands and show message with sound var burnMsg = Loc.GetString("powered-light-component-burn-hand"); _popupSystem.PopupEntity(burnMsg, uid, Filter.Entities(userUid)); _damageableSystem.TryChangeDamage(userUid, light.Damage); SoundSystem.Play(Filter.Pvs(uid), light.BurnHandSound.GetSound(), uid); args.Handled = true; return; } } // all checks passed // just try to eject bulb args.Handled = EjectBulb(uid, userUid, light) != null; }
protected override void Initialize() { this.IsMouseVisible = true; //Get Systems RenderSystem = SystemManager.Instance.GetSystem <RenderSystem>(); LoadContentSystem = SystemManager.Instance.GetSystem <LoadContentSystem>(); InputHandlerSystem = SystemManager.Instance.GetSystem <InputHandler>(); TankMovementSystem = SystemManager.Instance.GetSystem <TankMovementSystem>(); TitlesafeRenderSystem = SystemManager.Instance.GetSystem <TitlesafeRenderSystem>(); CollisionSystem = SystemManager.Instance.GetSystem <CollisionSystem>(); CameraFollowSystem = SystemManager.Instance.GetSystem <CameraSceneSystem>(); LightSystems = SystemManager.Instance.GetSystem <FlashlightSystem>(); MoveSystem = SystemManager.Instance.GetSystem <MoveSystem>(); CollisionResolveSystem = SystemManager.Instance.GetSystem <CollisionResolveSystem>(); WallCollisionSystem = SystemManager.Instance.GetSystem <WallCollisionSystem>(); AISystem = SystemManager.Instance.GetSystem <AISystem>(); EnemyCollisionSystem = SystemManager.Instance.GetSystem <EnemyCollisionSystem>(); AnimationSystem = SystemManager.Instance.GetSystem <AnimationSystem>(); SoundSystem = SystemManager.Instance.GetSystem <SoundSystem>(); WeaponSystem = SystemManager.Instance.GetSystem <WeaponSystem>(); BulletCollisionSystem = SystemManager.Instance.GetSystem <BulletCollisionSystem>(); HealthSystem = SystemManager.Instance.GetSystem <HealthSystem>(); TempGameEnder = new TempGameEnder(); //Init systems that require initialization TankMovementSystem.Start(); WallCollisionSystem.Start(); SoundSystem.Start(); WeaponSystem.Start(); EnemyCollisionSystem.Start(); BulletCollisionSystem.Start(); _gameDependencies.GameContent = this.Content; _gameDependencies.SpriteBatch = new SpriteBatch(GraphicsDevice); // just quickly done for FPS testing spriteBatch = _gameDependencies.SpriteBatch; _gameDependencies.Game = this; CreateTestEntities(); base.Initialize(); }
/// <summary> /// Called once when the station event ends for any reason. /// </summary> public override void Ended() { AdminLogManager.Add(LogType.EventStopped, $"Event ended: {Configuration.Id}"); if (Configuration is not StationEventRuleConfiguration ev) { return; } if (ev.EndAnnouncement != null) { ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(ev.EndAnnouncement), playSound: false, colorOverride: Color.Gold); } if (ev.EndAudio != null) { SoundSystem.Play(ev.EndAudio.GetSound(), Filter.Broadcast(), ev.EndAudio.Params); } }
public bool TurnOff(bool makeNoise = true) { if (!Activated) { return(false); } SetState(false); Activated = false; UpdateLightAction(); Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this)); if (makeNoise) { SoundSystem.Play(Filter.Pvs(Owner), TurnOffSound.GetSound(), Owner); } return(true); }
//Rubber-band snapping items into player's hands, originally was a workaround, later found it works quite well with stuns //Not sure if needs fixing public void DoInstantAction(InstantActionEventArgs args) { var caster = args.Performer; if (!caster.TryGetComponent(out HandsComponent? handsComponent)) { caster.PopupMessage(Loc.GetString("spell-fail-no-hands")); return; } if (!EntitySystem.Get <ActionBlockerSystem>().CanInteract(caster)) { return; } // TODO: Nix when we get EntityPrototype serializers if (!IoCManager.Resolve <IPrototypeManager>().HasIndex <EntityPrototype>(ItemProto)) { Logger.Error($"Invalid prototype {ItemProto} supplied for {nameof(GiveItemSpell)}"); return; } // TODO: Look this is shitty and ideally a test would do it var spawnedProto = caster.EntityManager.SpawnEntity(ItemProto, caster.Transform.MapPosition); if (!spawnedProto.TryGetComponent(out ItemComponent? itemComponent)) { Logger.Error($"Tried to use {nameof(GiveItemSpell)} but prototype has no {nameof(ItemComponent)}?"); spawnedProto.Delete(); return; } args.PerformerActions?.Cooldown(args.ActionType, Cooldowns.SecondsFromNow(CoolDown)); if (CastMessage != null) { caster.PopupMessageEveryone(CastMessage); } handsComponent.PutInHandOrDrop(itemComponent); SoundSystem.Play(Filter.Pvs(caster), CastSound.GetSound(), caster); }
private void HandleUserCommands(IRCMessage pMessageInfo) { if (pMessageInfo.userName.Contains("bot")) { return; } SyncPool.Init(); bool SpeakText = true; if (VoteSystem.HandleMessages(pMessageInfo)) { SpeakText = false; } if (UserManager.IsSpeachBannedUser(pMessageInfo.userName)) { SpeakText = false; } if (UserManager.HandleMessages(pMessageInfo)) { SpeakText = false; } if (SoundSystem.HandleMessages(pMessageInfo)) { SpeakText = false; } if (pMessageInfo.message.Trim().StartsWith("!")) { SpeakText = false; } if (SpeakText) { SyncPool.SpeakText(pMessageInfo); } ConsoleWrite(pMessageInfo); }
public void DisconnectFromInternals(GasTankComponent component, EntityUid?owner = null) { if (!component.IsConnected) { return; } component.IsConnected = false; _actions.SetToggled(component.ToggleAction, false); _internals.DisconnectTank(GetInternalsComponent(component, owner)); component.DisconnectStream?.Stop(); if (component.DisconnectSound != null) { component.DisconnectStream = SoundSystem.Play(component.DisconnectSound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner, component.DisconnectSound.Params); } UpdateUserInterface(component); }
void SetCameraEnabled(Camera cam, bool enabled) { if (enabled) { RenderSettings.UpdateCameraSettings(cam); } cam.enabled = enabled; var audioListener = cam.GetComponent <AudioListener>(); if (audioListener != null) { audioListener.enabled = enabled; if (SoundSystem != null) { SoundSystem.SetCurrentListener(enabled ? audioListener : null); } } }
private void OnBoundUIClosed(EntityUid uid, ServerStorageComponent storageComp, BoundUIClosedEvent args) { if (TryComp <ActorComponent>(args.Session.AttachedEntity, out var actor) && actor?.PlayerSession != null) { CloseNestedInterfaces(uid, actor.PlayerSession, storageComp); } // If UI is closed for everyone if (!_uiSystem.IsUiOpen(uid, args.UiKey)) { storageComp.IsOpen = false; UpdateStorageVisualization(uid, storageComp); if (storageComp.StorageCloseSound is not null) { SoundSystem.Play(storageComp.StorageCloseSound.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid, storageComp.StorageCloseSound.Params); } } }
/** * @brief Get the default sound devices for the specified sound system. * * @see TeamTalk.GetDefaultSoundDevices() */ public static bool GetDefaultSoundDevicesEx(SoundSystem nSndSystem, ref int lpnInputDeviceID, ref int lpnOutputDeviceID) { return TTDLL.TT_GetDefaultSoundDevicesEx(nSndSystem, ref lpnInputDeviceID, ref lpnOutputDeviceID); }
public Stream(SoundSystem system, bool is3DSound) { this.system = system; this.is3DSound = is3DSound; }
public Sound(SoundSystem soundSystem, bool is3D) { this.soundSystem = soundSystem; Is3DSound = is3D; }
void Start() { Debug.Log("OMG YOU CREATED ME"); _gunPivotObject = transform.Find("ShootPivot").gameObject; _bulletPool = GameObject.Find("BulletPool").GetComponent<Pool>(); _soundScript = GameObject.Find("SoundsParent").GetComponent<SoundSystem>(); }
public void Init(AudioDevice audioDevice, Vector2 minMaxDistance, int nSoundChannels, JMOD.CustomReadFileMethodDelegate customReadFileMethod) { SoundSystem = new SoundSystem(minMaxDistance, nSoundChannels, customReadFileMethod); AudioDevice = audioDevice; SystemGlue = new JMODSystem(SoundSystem); }
public SoundGroup(SoundSystem system, string name) { this.system = system; this.Name = name; this.Volume = 1f; }
public JMODSystem(SoundSystem system) { System = system; }