temporary solution for 4dF
parent
dfbcacdd5f
commit
ca6df6134d
|
@ -49,6 +49,9 @@ LEFT_INDENT = 0.01
|
||||||
TOP_INDENT = 0.92
|
TOP_INDENT = 0.92
|
||||||
FONT_WIDTH = 12
|
FONT_WIDTH = 12
|
||||||
FONT_HEIGHT = 28
|
FONT_HEIGHT = 28
|
||||||
|
|
||||||
|
fudge_levels = {"-","terrible--","terrible-","terrible", "poor", "mediocre", "fair", "good", "great", "superb", "legendary", "legendary+", "legendary++","like Allah"}
|
||||||
|
|
||||||
-- config zone }}}
|
-- config zone }}}
|
||||||
|
|
||||||
firsthud = nil
|
firsthud = nil
|
||||||
|
@ -132,12 +135,54 @@ minetest.register_on_chat_message(function(name, message)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- dices
|
-- dices
|
||||||
dice = string.match(message, "d(%d+)")
|
dice = string.match(message, "^d(%d+).*")
|
||||||
if dice=="4" or dice=="6" or dice=="8" or dice=="10" or dice=="12" or dice=="20" then
|
if dice=="4" or dice=="6" or dice=="8" or dice=="10" or dice=="12" or dice=="20" then
|
||||||
fmt = "*** %s rolls d"..dice.." and the result is %s ***"
|
fmt = "*** %s rolls d"..dice.." and the result is %s ***"
|
||||||
color = DICE_COLOR
|
color = DICE_COLOR
|
||||||
submes = math.random(dice)
|
submes = math.random(dice)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Temporary solution for 4dF
|
||||||
|
fudge_dice_tmp = string.match(message, "^4dF (.*)$")
|
||||||
|
if fudge_dice_tmp~=nil then
|
||||||
|
for key, val in pairs(fudge_levels) do
|
||||||
|
fudge_level = string.match(fudge_dice_tmp, "^("..val..".*)")
|
||||||
|
fudge_level_key = key
|
||||||
|
|
||||||
|
if fudge_level~=nil then
|
||||||
|
diff = 0
|
||||||
|
signs = ""
|
||||||
|
|
||||||
|
for i = 1, 4 do
|
||||||
|
rand = math.random(3)
|
||||||
|
if rand == 1 then
|
||||||
|
diff=diff+1
|
||||||
|
signs = signs.."+"
|
||||||
|
elseif rand == 2 then
|
||||||
|
diff=diff-1
|
||||||
|
signs = signs.."-"
|
||||||
|
else
|
||||||
|
signs = signs.."="
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
fmt = "*** %s rolls 4df ("..signs..") from "..fudge_level.." and the result is %s ***"
|
||||||
|
color = DICE_COLOR
|
||||||
|
|
||||||
|
fudge_level_key = fudge_level_key+diff
|
||||||
|
|
||||||
|
if fudge_level_key<1 then
|
||||||
|
fudge_level_key = 1
|
||||||
|
elseif fudge_level_key>#fudge_levels then
|
||||||
|
fudge_level_key = #fudge_levels
|
||||||
|
end
|
||||||
|
|
||||||
|
submes = fudge_levels[fudge_level_key]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if not submes then
|
if not submes then
|
||||||
submes = message
|
submes = message
|
||||||
end
|
end
|
||||||
|
@ -155,6 +200,7 @@ minetest.register_on_chat_message(function(name, message)
|
||||||
elseif minetest.check_player_privs(pls[i]:get_player_name(), {gm=true}) then
|
elseif minetest.check_player_privs(pls[i]:get_player_name(), {gm=true}) then
|
||||||
sendMessage(pls[i], string.format(fmt, name, submes), GMSPY_COLOR)
|
sendMessage(pls[i], string.format(fmt, name, submes), GMSPY_COLOR)
|
||||||
end
|
end
|
||||||
|
print(string.format(fmt, name, submes))
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue