arx-tools / arx-level-generator

A node.js library for creating maps for the video game Arx Fatalis
MIT License
6 stars 0 forks source link

Find better names for Audio and Sound classes #34

Open meszaros-lajos-gyorgy opened 1 month ago

meszaros-lajos-gyorgy commented 1 month ago

Audio is like the Texture class, points to a binary resource, in this case a wav file Sound is a script utility class and it is there as a wrapper around the PLAY command with all its horrible flags.

Usually I have to use them both in the same place and it looks super confusing, you can't really tell just by the variables what the given content of the variable is or what is it used for:

import { Audio } from 'arx-level-generator'
import { Sound, SoundFlags } from 'arx-level-generator/scripting/classes'

const eatAudio = new Audio({
  filename: 'eat.wav',
  isNative: true,
  type: 'sfx',
})

const eatSound = new Sound(eatAudio.filename, SoundFlags.VaryPitch)

Technically the Sound class only cares about the filename of the Audio, so the Sound class doesn't really need an alternative name that is very close to the Audio class.

Could be renamed to AudioScript or SoundScript.

Similar thing needs to be done with the other script class too: Glow -> GlowScript?