Client Upload Part 2

RD Core / Commit #5

Commit Client Upload Part 2

Alex Alex committed 19/10/2026 00:06 main Patch
1,244 files +271,215 -0
A RD_Client/modules/client_sounds/sounds/utito.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sounds/sounds/wagon.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sounds/sounds/wand_attack.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sounds/sounds/waypoint.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sounds/sounds/weapon_attack.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sounds/sounds/woodcutting.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sounds/sounds/woodcutting_fail.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/player_sounds.lua +75-0 View file
@@ -0,0 +1,75 @@
1+local CODE = 107
2+
3+local soundChannels = {}
4+local maxChannels = 70
5+local channelTimers = {}
6+
7+
8+for i = 1, maxChannels do
9+ local channel = g_sounds.getChannel(SoundChannels["Spells" .. i])
10+ if channel then
11+ soundChannels[i] = channel
12+ else
13+ print("Failed to initialize sound channel " .. i)
14+ end
15+end
16+
17+function onExtendedOpcode(protocol, code, buffer)
18+
19+ local json_status, json_data = pcall(function()
20+ return json.decode(buffer)
21+ end)
22+
23+ if not json_status then
24+ print("Error decoding JSON: " .. json_data)
25+ return false
26+ end
27+
28+ local action = json_data.action
29+ local soundFile = json_data.data
30+
31+ local soundFilePath = "sounds/" .. soundFile
32+
33+ if g_resources.fileExists(soundFilePath) then
34+ playSound(soundFilePath)
35+ else
36+ print("Sound file does not exist: " .. soundFilePath)
37+ end
38+end
39+
40+function playSound(sound)
41+ local channel = findAvailableChannel()
42+ if not channel then
43+ print("No available sound channels.")
44+ return
45+ end
46+
47+ channel:play(sound, 0, 1.0)
48+ channel:setGain(1.0)
49+
50+ local duration = getSoundDuration(sound) or 3000
51+ channelTimers[channel] = scheduleEvent(function()
52+ channelTimers[channel] = nil
53+ end, duration)
54+end
55+
56+function findAvailableChannel()
57+ for _, channel in ipairs(soundChannels) do
58+ if not channelTimers[channel] then
59+ return channel
60+ end
61+ end
62+ return nil
63+end
64+
65+function getSoundDuration(sound)
66+ return 3000
67+end
68+
69+function init()
70+ ProtocolGame.registerExtendedOpcode(CODE, onExtendedOpcode)
71+end
72+
73+function terminate()
74+ ProtocolGame.unregisterExtendedOpcode(CODE)
75+end
A RD_Client/modules/client_sound_player/player_sounds.otmod +9-0 View file
@@ -0,0 +1,9 @@
1+Module
2+ name: client_sound_player
3+ description: Sound system
4+ author: Alexv45
5+ website: https://opengamescommunity.com
6+ autoload: true
7+ scripts: [ player_sounds ]
8+ @onLoad: init()
9+ @onUnload: terminate()
A RD_Client/modules/client_sound_player/sounds/alarm.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/amp.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/arcane.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/arcane_2.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/arcane_3.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/arcane_4.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/arcane_5.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/arcane_6.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/arrow_1.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/avalanche.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/berserk.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/blessing.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/block.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/blueberry.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/bomb_rune.ogg +0-0 View file
Binary file not shown.
A RD_Client/modules/client_sound_player/sounds/cancel_invisible.ogg +0-0 View file
Binary file not shown.
Top