example update

This commit is contained in:
Evil Factory
2021-04-17 23:04:13 -03:00
parent e8c99c14eb
commit 5991eef8df
3 changed files with 15 additions and 9 deletions
@@ -6,7 +6,6 @@ traitormod.selectedCodeResponses = {}
traitormod.selectedCodePhrases = {} traitormod.selectedCodePhrases = {}
traitormod.enabled = true traitormod.enabled = true
traitormod.traitorShipEnabled = true
traitormod.roundGamemode = "" traitormod.roundGamemode = ""
local traitorAssignDelay = 0 local traitorAssignDelay = 0
@@ -255,7 +254,7 @@ Hook.Add("roundStart", "traitor_start", function()
local rng = Random.Range(0, 100) local rng = Random.Range(0, 100)
if rng < config.traitorShipChance and traitormod.traitorShipEnabled == true then if rng < config.traitorShipChance and config.traitorShipEnabled == true then
local amount = config.getAmountShipTraitors(#util.GetValidPlayers()) local amount = config.getAmountShipTraitors(#util.GetValidPlayers())
Game.Log("Infiltraiton Gamemode selected, Random = " .. rng, 6) Game.Log("Infiltraiton Gamemode selected, Random = " .. rng, 6)
@@ -269,7 +268,9 @@ Hook.Add("roundStart", "traitor_start", function()
Game.Log("Assasination Gamemode was selected, Random = " .. rng, 6) Game.Log("Assasination Gamemode was selected, Random = " .. rng, 6)
traitormod.roundGamemode = "Assasination" traitormod.roundGamemode = "Assasination"
traitormod.spawnTraitorShipAndHide() if config.traitorShipEnabled then
traitormod.spawnTraitorShipAndHide()
end
end end
for key, value in pairs(Player.GetAllClients()) do for key, value in pairs(Player.GetAllClients()) do
@@ -387,9 +388,9 @@ Hook.Add("chatMessage", "chatcommands", function(msg, client)
end end
if msg == "!toggletraitorship" then if msg == "!toggletraitorship" then
traitormod.traitorShipEnabled = not traitormod.traitorShipEnabled config.traitorShipEnabled = not config.traitorShipEnabled
if traitormod.traitorShipEnabled then if config.traitorShipEnabled then
Game.SendDirectChatMessage("", "Traitor Ship Enabled", nil, 1, Game.SendDirectChatMessage("", "Traitor Ship Enabled", nil, 1,
client) client)
else else
@@ -397,6 +398,8 @@ Hook.Add("chatMessage", "chatcommands", function(msg, client)
client) client)
end end
Game.OverrideRespawnSub(config.traitorShipEnabled)
return true return true
end end
@@ -5,7 +5,7 @@ local loadedpeople = {}
local config = dofile("lua/traitormod/traitorconfig.lua") local config = dofile("lua/traitormod/traitorconfig.lua")
local util = dofile("lua/traitormod/util.lua") local util = dofile("lua/traitormod/util.lua")
Game.OverrideRespawnSub(true) Game.OverrideRespawnSub(config.traitorShipEnabled)
Hook.Add("think", "traitorShip", function() Hook.Add("think", "traitorShip", function()
if respawnshuttle ~= nil then if respawnshuttle ~= nil then
+6 -3
View File
@@ -12,9 +12,12 @@ config.codewords = codewords
config.amountCodewords = 2 config.amountCodewords = 2
config.traitorSpawnDelay = 60 config.traitorSpawnDelay = 60
config.nextMissionDelay = 60 config.nextMissionDelay = 60
config.traitorShipEnabled = true -- set this to false for the respawn shuttles to work
config.traitorShipChance = 15 config.traitorShipChance = 15
config.traitorShipGodModeDistance = 4000 config.traitorShipGodModeDistance = 4000
-- Traitor Selection Options -- Traitor Selection Options
config.roundEndPercentageIncrease = 10 config.roundEndPercentageIncrease = 10
config.firstJoinPercentage = 10 config.firstJoinPercentage = 10
@@ -23,11 +26,11 @@ config.traitorPenalty = 5
-- >=12 players = 3 traitors, >=8 players = 2 traitors, default = 1 traitor -- >=12 players = 3 traitors, >=8 players = 2 traitors, default = 1 traitor
config.getAmountTraitors = function (amountClients) config.getAmountTraitors = function (amountClients)
if amountClients >= 12 then return 3 end if amountClients >= 12 then return 3 end -- if theres 12 or more players, 3 traitors will be selected
if amountClients >= 8 then return 2 end if amountClients >= 8 then return 2 end -- if theres 8 or more players, 2 traitors will be selected
return 1 return 1 -- if theres less than 8 players, there will only one traitor
end end
-- shipTraitors and normal traitors will be selected equally -- shipTraitors and normal traitors will be selected equally