Git Product home page Git Product logo

factorio-sync-sound-manager's Introduction

factorio-sync-sound-manager - synchronous playback of sounds and music for the entity(static ones)

ru desctiption

Settings

All settings actually start with fssm-.

  • use simple sound system(use_simple_sound_system): Don't create ghost entities for sync playing sound.
  • debug: Enable event and activity logging.
  • sync-machine-state-with-emitter: If enabled, the mod will poll all machines once a second about their status (running/stopped) and, depending on the option, turn on/off the emitter. If you find that this slows down your game, then turn off this setting. The mod does nothing else except check and control.
  • (hidden)fssm-parent_name: internal name of the parent emitter

API - data stage

requiring:

local fssm = require("__factorio-sync-sound-manager__/prototypes/api")

examples:

-- changing the sound for a particular entity.
fssm.applyNewSound(data.raw["assembling-machine"]["assembling-machine-1"], "__my-mod__/my-sound.ogg")

-- changing the sound for a particular entity with custom volume.
fssm.applyNewSound(data.raw["assembling-machine"]["assembling-machine-1"], "__my-mod__/my-sound.ogg", 0.7)

-- just the registration of the entity
fssm.registerPrototype(proto)
  • fssm.applyNewSound(proto, sound_path, volume):
    • Applies sound to the prototype(replaces with the specified), also calls registerPrototype(proto). Useful if you need to completely owerride the sound to yours.
    • Parameters:
      • proto: any entity from data.raw.
      • sound_path: path to the sound, e.g. __base__/sound/silence-1sec.ogg. docs
      • volume(optional): [0 - 1], the volume of the sound, if not specified: proto.working_sound.sound.volume or 1 will be taken. docs
    • Returns: result of registerPrototype call
  • fssm.registerPrototype(proto): Registers a prototype(entity) in this mod
    • The main method by which my mod understands which entities it will be working with.
    • Important points for modders(especially if you're bypassing the applyNewSound function or don't want to use my functions at all at the datа stage):
      • In order for the runtime part of the mod to find the entnty-emitter correspondence, the following emitter name format must be observed: soundEmitterName..'__'..proto.name.
      • You can use settings.startup["fssm-parent_name"].value to get the parent name. proto is an entity in data.raw.
      • I suggest on the working_sound.persistent parameter to set true on your copy of the emitter. but not necessary, however then there is no point in this mod.
      • when calling this function, the parameter working_sound.persistent in the emitter object is set to true
    • Parameters:
      • proto: any entity from data.raw.
      • (hidden, in the object properties)proto.working_sound.speacker_audible_distance_modifier: sets the audible_distance_modifier for the speaker if specified
    • Returns: the emitter object that was added to data.raw

factorio-sync-sound-manager's People

Contributors

asvdvl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.