Initial commit
commit
26112c6631
|
@ -0,0 +1,11 @@
|
|||
# libclamity
|
||||
This is a dragonfire CSM (might work partly with vanilla minetest as well) that includes utilities to make clientmods specifically for Clamity Anarchy and it's modset.
|
||||
|
||||
Current features:
|
||||
- Chat message parsing
|
||||
|
||||
Planned features:
|
||||
- Death message parsing
|
||||
- Parsing of /me output
|
||||
- Get / set skin
|
||||
- Badge parsing
|
|
@ -0,0 +1,22 @@
|
|||
local libclamity = {}
|
||||
|
||||
function libclamity.parse_chat_message(rawmsg)
|
||||
local msg = minetest.strip_colors(rawmsg)
|
||||
local nameidx = msg:find("<")
|
||||
local first_byte = rawmsg:byte(1)
|
||||
if nameidx and (first_byte == 60 or first_byte == 27) then
|
||||
local idx = msg:find(">")
|
||||
local player = msg:sub(nameidx + 1, idx - 1)
|
||||
local sidx = idx + 2
|
||||
if msg:sub(idx + 1, idx + 1) == ":" then
|
||||
sidx = sidx + 1
|
||||
end
|
||||
local message = msg:sub(sidx, #msg)
|
||||
local discord = first_byte == 27 and rawmsg:sub(2, 12) == "(c@#63d269)" and nameidx == 1
|
||||
return {
|
||||
player = player,
|
||||
message = message,
|
||||
discord = discord,
|
||||
}
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue