Skip to content

Add an emitSound() JS function#4851

Merged
KJeff01 merged 2 commits intoWarzone2100:masterfrom
DARwins1:dr-9
Mar 1, 2026
Merged

Add an emitSound() JS function#4851
KJeff01 merged 2 commits intoWarzone2100:masterfrom
DARwins1:dr-9

Conversation

@DARwins1
Copy link
Member

@DARwins1 DARwins1 commented Feb 27, 2026

Adds a simple JS api function emitSound(), which plays a given sound file at the specified in-game coordinates.
E.g.

emitSound("lrgcan.ogg", 25, 50); // Plays the Heavy Cannon firing sound at x = 25, y = 50

EDIT: Coordinate arguments are now in whole tiles

@aubergineagain
Copy link
Contributor

Tile units pls. The conversion to world units can be done in the c++ side.

@KJeff01 KJeff01 added this to the 4.6.4 milestone Feb 28, 2026
@KJeff01 KJeff01 merged commit 7b42b87 into Warzone2100:master Mar 1, 2026
40 checks passed
@aco4
Copy link
Contributor

aco4 commented Mar 2, 2026

  1. Why tile units instead of world coordinates? Scripts will lose fine-grained control.
  2. If tile units is preferred, then the sound should be emitted from the center of the tile, not the corner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants