Add Build 42 World Atmosphere Pack mod

This commit is contained in:
steav310 committed 2026-10-20 15:27:09 -07:00
commit 4a2c21594c
21 files changed
+218

No files matched your search

@@ -0,0 +1,81 @@
-- All timing and playback happen on the player's client; no world sound is emitted.
local SOUND_NAME = "WorldAtmosphereCue"
local MIN_WAIT_MINUTES = 30
local MAX_WAIT_MINUTES = 60
local CHECK_INTERVAL_MS = 1000
local nextPlayAt = nil
local lastCheckAt = 0
local playingId = nil
local tickRegistered = false
local nativeMusicMuted = false
local function scheduleNext(now)
nextPlayAt = now + ZombRandBetween(MIN_WAIT_MINUTES, MAX_WAIT_MINUTES + 1) * 60000
end
local function onTick()
if not getPlayer() then return end
local now = getTimestampMs()
if now - lastCheckAt < CHECK_INTERVAL_MS then return end
lastCheckAt = now
local soundManager = getSoundManager()
local emitter = soundManager:getUIEmitter()
if playingId then
if emitter:isPlaying(playingId) then
soundManager:setMusicVolume(0)
emitter:setVolume(playingId, getCore():getOptionMusicVolume() / 10)
return
end
playingId = nil
if nativeMusicMuted then
soundManager:setMusicVolume(getCore():getOptionMusicVolume() / 10)
nativeMusicMuted = false
end
scheduleNext(now)
return
end
if not nextPlayAt or now < nextPlayAt then return end
-- The script sound selects a random clip. The UI emitter needs explicit
-- per-sound volume to follow the game's music slider.
playingId = emitter:playSound(SOUND_NAME)
nextPlayAt = nil
if playingId and playingId ~= 0 then
emitter:set3D(playingId, false)
emitter:setVolume(playingId, getCore():getOptionMusicVolume() / 10)
soundManager:setMusicVolume(0)
nativeMusicMuted = true
else
playingId = nil
scheduleNext(now)
end
end
local function onDisconnect()
local soundManager = getSoundManager()
if playingId then
soundManager:getUIEmitter():stopSound(playingId)
end
if nativeMusicMuted then
soundManager:setMusicVolume(getCore():getOptionMusicVolume() / 10)
nativeMusicMuted = false
end
playingId = nil
nextPlayAt = nil
end
local function onGameStart()
scheduleNext(getTimestampMs())
if not tickRegistered then
Events.OnTick.Add(onTick)
tickRegistered = true
end
end
Events.OnGameStart.Add(onGameStart)
Events.OnDisconnect.Add(onDisconnect)
Events.OnMainMenuEnter.Add(onDisconnect)
@@ -0,0 +1,85 @@
module WorldAtmospherePack
{
sound WorldAtmosphereCue
{
category = Music,
master = Music,
is3D = false,
loop = false,
clip
{
file = media/sound/WorldAtmospherePack/track1.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track2.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track3.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track4.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track5.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track6.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track7.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track8.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track9.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track10.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track11.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track12.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track13.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track14.ogg,
volume = 1.0,
}
clip
{
file = media/sound/WorldAtmospherePack/track15.ogg,
volume = 1.0,
}
}
}
@@ -0,0 +1,3 @@
name=World Atmosphere Pack
id=WorldAtmospherePack
description=Subtle additions to the world atmosphere.
+45
View File
@@ -0,0 +1,45 @@
Build 42 World Atmosphere Pack setup
1. The 15 tracks from MusicOGGFolder are included as track1.ogg through
track15.ogg under:
Contents/mods/WorldAtmospherePack/42/media/sound/WorldAtmospherePack/
Do not publish music unless you have permission to redistribute it on
Steam Workshop, even if the Workshop item is friends-only.
2. To add more songs, duplicate a clip { ... } block in
Contents/mods/WorldAtmospherePack/42/media/scripts/WorldAtmosphereSounds.txt,
changing its file path to each new .ogg. The game randomly selects a clip.
All songs should be normalized to a similar loudness. Keep paths and casing exact.
3. Change MIN_WAIT_MINUTES and MAX_WAIT_MINUTES near the top of
Contents/mods/WorldAtmospherePack/42/media/lua/client/WorldAtmospherePack.lua
to adjust the real-time gap after each song finishes. A currently playing
song is never interrupted by this mod. Each connected player has an
independent random schedule.
4. The installed upload copy is at
%UserProfile%/Zomboid/Workshop/WorldAtmospherePack (not the game's Workshop
install directory). The Desktop source folder retains its old folder name;
its mod ID and all packaged content use WorldAtmospherePack. Keep only ONE
installed copy enabled. Test the native
Options > Audio > Music slider at zero and while changing it mid-song on
your exact Build 42 version. The mod applies this slider to its playing
track through the UI emitter once per second. Native game music is muted
while a custom track plays and restored to the slider setting afterward.
5. The 256x256 preview.png was resized from the image in your Pictures folder.
Only publish artwork if you have permission to redistribute it. Use the
game's main-menu Workshop > Create and update items uploader. Choose visibility
(the template starts friends-only) and note the numeric Workshop ID.
If you move the project out of this folder, work on just ONE copy.
6. In the dedicated server's Zomboid/Server/<servername>.ini set:
WorkshopItems=<numeric Workshop ID>
Mods=WorldAtmospherePack
Append with semicolons if other mods are configured, then restart the server.
Clients joining the server will be prompted to download Workshop content.
References:
https://pzwiki.net/wiki/Mod_structure
https://pzwiki.net/wiki/Uploading_mods
https://pz-wiki-modding.github.io/PZ-API-Docs/scripts/sound.html
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

+4
View File
@@ -0,0 +1,4 @@
version=1
title=World Atmosphere Pack
description=Lightweight world atmosphere additions for Build 42.
visibility=1