Added more levels to bot difficulties consistent with omnibot's own naming (refs #77)
This commit is contained in:
parent
416b3bbbfc
commit
56d822b417
|
@ -16,12 +16,12 @@
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
|
|
||||||
local constants = require (wolfa_getLuaPath()..".util.constants")
|
local constants = require (wolfa_getLuaPath()..".util.constants")
|
||||||
local util = require (wolfa_getLuaPath()..".util.util")
|
|
||||||
local events = require (wolfa_getLuaPath()..".util.events")
|
local events = require (wolfa_getLuaPath()..".util.events")
|
||||||
local timers = require (wolfa_getLuaPath()..".util.timers")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
local bots = require (wolfa_getLuaPath()..".game.bots")
|
local timers = require (wolfa_getLuaPath()..".util.timers")
|
||||||
|
local util = require (wolfa_getLuaPath()..".util.util")
|
||||||
|
|
||||||
local voting = {}
|
local voting = {}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ function voting.allow(type, value)
|
||||||
et.trap_Cvar_Set("vote_allow_"..type, value)
|
et.trap_Cvar_Set("vote_allow_"..type, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
function voting.isallowed(type)
|
function voting.isAllowed(type)
|
||||||
return (allowed[type] == 1)
|
return (allowed[type] == 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,15 +43,15 @@ function voting.force(type)
|
||||||
voting.allow(type, 1)
|
voting.allow(type, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function voting.isforced(type)
|
function voting.isForced(type)
|
||||||
return (forced[type] == 1)
|
return (forced[type] == 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function voting.isrestricted(type)
|
function voting.isRestricted(type)
|
||||||
return (restricted[type] == 1)
|
return (restricted[type] == 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function voting.disablenextmap()
|
function voting.disableNextMap()
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dvote: ^9next map voting has automatically been disabled.\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dvote: ^9next map voting has automatically been disabled.\";")
|
||||||
|
|
||||||
voting.allow("nextmap", 0)
|
voting.allow("nextmap", 0)
|
||||||
|
@ -70,35 +70,35 @@ function voting.load()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function voting.oninit(levelTime, randomSeed, restartMap)
|
function voting.onGameInit(levelTime, randomSeed, restartMap)
|
||||||
voting.load()
|
voting.load()
|
||||||
|
|
||||||
if settings.get("g_voteNextMapTimeout") > 0 then
|
if settings.get("g_voteNextMapTimeout") > 0 then
|
||||||
voting.allow("nextmap", 1)
|
voting.allow("nextmap", 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
events.handle("onGameInit", voting.oninit)
|
events.handle("onGameInit", voting.onGameInit)
|
||||||
|
|
||||||
function voting.ongamestatechange(gameState)
|
function voting.onGameStateChange(gameState)
|
||||||
if gameState == 0 and settings.get("g_voteNextMapTimeout") > 0 then
|
if gameState == 0 and settings.get("g_voteNextMapTimeout") > 0 then
|
||||||
timers.add(voting.disablenextmap, settings.get("g_voteNextMapTimeout") * 1000, 1)
|
timers.add(voting.disableNextMap, settings.get("g_voteNextMapTimeout") * 1000, 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
events.handle("onGameStateChange", voting.ongamestatechange)
|
events.handle("onGameStateChange", voting.onGameStateChange)
|
||||||
|
|
||||||
function voting.oncallvote(clientId, type, args)
|
function voting.onCallvote(clientId, type, args)
|
||||||
if et.gentity_get(clientId, "sess.sessionTeam") == constants.TEAM_SPECTATORS or args[1] == "?" then
|
if et.gentity_get(clientId, "sess.sessionTeam") == constants.TEAM_SPECTATORS or args[1] == "?" then
|
||||||
return 0
|
return 0
|
||||||
elseif voting.isrestricted(type) and not auth.isPlayerAllowed(clientId, PERM_NOVOTELIMIT) then
|
elseif voting.isRestricted(type) and not auth.isPlayerAllowed(clientId, auth.PERM_NOVOTELIMIT) then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"callvote: you are not allowed to call this type of vote.\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"callvote: you are not allowed to call this type of vote.\";")
|
||||||
et.trap_SendServerCommand(clientId, "cp \"You are not allowed to call this type of vote.")
|
et.trap_SendServerCommand(clientId, "cp \"You are not allowed to call this type of vote.")
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
events.handle("onCallvote", voting.oncallvote)
|
events.handle("onCallvote", voting.onCallvote)
|
||||||
|
|
||||||
function voting.onpollfinish(passed, poll)
|
function voting.onPollFinish(passed, poll)
|
||||||
if passed then
|
if passed then
|
||||||
if poll == "enable bots" then
|
if poll == "enable bots" then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "needbots")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "needbots")
|
||||||
|
@ -119,22 +119,30 @@ function voting.onpollfinish(passed, poll)
|
||||||
elseif string.find(poll, "set bot difficulty") == 1 then
|
elseif string.find(poll, "set bot difficulty") == 1 then
|
||||||
local difficulty = string.sub(poll, 20)
|
local difficulty = string.sub(poll, 20)
|
||||||
|
|
||||||
if difficulty == "epic" then
|
if tonumber(difficulty) then
|
||||||
|
difficulty = tonumber(difficulty)
|
||||||
|
elseif difficulty == "uber" then
|
||||||
difficulty = 6
|
difficulty = 6
|
||||||
elseif difficulty == "hard" then
|
elseif difficulty == "professional" then
|
||||||
difficulty = 5
|
difficulty = 5
|
||||||
elseif difficulty == "normal" then
|
elseif difficulty == "standard" then
|
||||||
difficulty = 4
|
difficulty = 4
|
||||||
|
elseif difficulty == "easy frag" then
|
||||||
|
difficulty = 3
|
||||||
|
elseif difficulty == "poor" then
|
||||||
|
difficulty = 2
|
||||||
|
elseif difficulty == "very poor" then
|
||||||
|
difficulty = 1
|
||||||
|
elseif difficulty == "poorest" then
|
||||||
|
difficulty = 0
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "bot difficulty "..difficulty)
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "bot difficulty "..difficulty)
|
||||||
-- else
|
|
||||||
-- et.trap_SendConsoleCommand(et.EXEC_APPEND, command)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
events.handle("onPollFinish", voting.onpollfinish)
|
events.handle("onPollFinish", voting.onPollFinish)
|
||||||
|
|
||||||
return voting
|
return voting
|
||||||
|
|
|
@ -40,7 +40,7 @@ menuDef {
|
||||||
// right side buttons
|
// right side buttons
|
||||||
BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 68, .5*(WINDOW_WIDTH-18), 14, "PUTBOTS ALLIES", .24, 11, exec "cmd callvote poll put bots allies"; uiScript closeingame, voteFlag CV_SVF_POLL )
|
BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 68, .5*(WINDOW_WIDTH-18), 14, "PUTBOTS ALLIES", .24, 11, exec "cmd callvote poll put bots allies"; uiScript closeingame, voteFlag CV_SVF_POLL )
|
||||||
|
|
||||||
MULTILEFT( 8, 86+2, .80*(WINDOW_WIDTH-18), 10, "Bot difficulty:", .2, 8, "ui_poll", cvarStrList { "Epic"; "set bot difficulty epic"; "Hard"; "set bot difficulty hard"; "Normal"; "set bot difficulty normal" } voteflag CV_SVF_POLL, "Select the difficulty to vote on" )
|
MULTILEFT( 8, 86+2, .80*(WINDOW_WIDTH-18), 10, "Bot difficulty:", .2, 8, "ui_poll", cvarStrList { "Uber"; "set bot difficulty uber"; "Professional"; "set bot difficulty professional"; "Standard"; "set bot difficulty standard"; "Easy frag"; "set bot difficulty easy frag"; "Poor"; "set bot difficulty poor"; "Very poor"; "set bot difficulty very poor"; "Poorest"; "set bot difficulty poorest" } voteflag CV_SVF_POLL, "Select the difficulty to vote on" )
|
||||||
NAMEDBUTTONEXT( "bttnextBotDifficulty", 6+.80*(WINDOW_WIDTH-18)+6, 86, .20*(WINDOW_WIDTH-18), 14, "OK", .24, 11, uiScript votePoll; uiScript closeingame, voteflag CV_SVF_POLL )
|
NAMEDBUTTONEXT( "bttnextBotDifficulty", 6+.80*(WINDOW_WIDTH-18)+6, 86, .20*(WINDOW_WIDTH-18), 14, "OK", .24, 11, uiScript votePoll; uiScript closeingame, voteflag CV_SVF_POLL )
|
||||||
|
|
||||||
BUTTON( 6, WINDOW_HEIGHT-24, WINDOW_WIDTH-12, 18, "BACK", .3, 14, close ingame_vote_wolfadmin ; open ingame_vote )
|
BUTTON( 6, WINDOW_HEIGHT-24, WINDOW_WIDTH-12, 18, "BACK", .3, 14, close ingame_vote_wolfadmin ; open ingame_vote )
|
||||||
|
|
Loading…
Reference in New Issue