1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-11-06 09:09:26 +02:00

Changing a user group member now updates a lua parsable file in the script output folder #42

- update regulars/mods list
- cleaned up config
This commit is contained in:
Valansch
2017-09-09 22:56:28 +02:00
parent e989c8e37f
commit 05d24c94c3
4 changed files with 128 additions and 118 deletions

View File

@@ -1,46 +1,15 @@
local function apply_config() global.scenario = {}
if not global.scenario.config.enable_radar then global.scenario.variables = {}
game.forces["player"].recipes["radar"].enabled = false global.scenario.variables.time_set_moment = 0
end global.scenario.variables.current_month = 1
end global.scenario.variables.current_day = 1
global.scenario.variables.current_h = 0
Event.register(-1, function() global.scenario.variables.current_m = 0
global.scenario = {} global.scenario.variables.days_passed = 0
global.scenario.variables = {} global.scenario.variables.mods = require "locale.resources.mods"
global.scenario.variables.time_set_moment = 0 global.scenario.variables.regulars = require "locale.resources.regulars"
global.scenario.variables.current_month = 1 global.scenario.variables.player_positions = {}
global.scenario.variables.current_day = 1 global.scenario.variables.player_walk_distances = {}
global.scenario.variables.current_h = 0 global.scenario.config = {}
global.scenario.variables.current_m = 0 global.scenario.custom_functions = {}
global.scenario.variables.days_passed = 0 global.scenario.config.nuke_min_time_hours = 3 --how long a player must be on the server to be allowed to use the nuke
global.scenario.variables.mods = require "locale.resources.mods"
global.scenario.variables.regulars = require "locale.resources.regulars"
global.scenario.variables.player_positions = {}
global.scenario.variables.player_walk_distances = {}
global.scenario.config = {}
global.scenario.config.announcements_enabled = false -- if true announcements will be shown
global.scenario.config.announcement_delay = 1000 -- number of seconds between each announcement
global.scenario.config.score_delay = 8 -- delay in seconds before hiding rocket score window (0 = never show)
global.scenario.config.autolaunch_default = false -- default autolaunch option
global.scenario.config.logistic_research_enabled = true -- if true then research for requesters and active providers will be enabled.
global.scenario.config.enable_radar = true
global.scenario.config.mapsettings = global.scenario.config.mapsettings or {}
global.scenario.config.mapsettings.cross_width = 200 -- total width of cross
global.scenario.config.mapsettings.spiral_land_width = 70 -- width of land in spiral
global.scenario.config.mapsettings.spiral_water_width = 70 -- width of water in spiral
global.scenario.custom_functions = {}
global.scenario.config.nuke_min_time_hours = 3 --how long a player must be on the server to be allowed to use the nuke
apply_config()
end)
local function on_research_started(event)
if not global.scenario.config.logistic_research_enabled then
if event.research.name == "logistic-robotics" then
game.forces["player"].current_research = nil
end
end
end
Event.register(defines.events.on_research_started, on_research_started)

View File

@@ -1,5 +1,9 @@
return return
{ {
dpoba = "", ["dpoba"] = "",
masjazZ = "", ["masjazZ"] = "",
} ["-slug-"] = "",
["mbas"] = "",
["selen"] = "",
["Sholvo"] = "",
}

View File

@@ -1,65 +1,94 @@
return return
{ {
helpower2 = "", ["helpower2"] = "",
rorror = "", ["rorror"] = "",
Medival3 = "", ["Medival3"] = "",
dpoba = "", ["dpoba"] = "",
settdigger = "", ["settdigger"] = "",
Cheeselicker = "", ["Cheeselicker"] = "",
cpaca0 = "", ["cpaca0"] = "",
UTIDI = "", ["UTIDI"] = "",
JokerOfTheZ = "", ["JokerOfTheZ"] = "",
saltlands = "", ["saltlands"] = "",
Maniah = "", ["Maniah"] = "",
COOL = "", ["COOL"] = "",
boail = "", ["boail"] = "",
hunter117x = "", ["hunter117x"] = "",
TonyTroll = "", ["TonyTroll"] = "",
rorror = "", ["HighInFiberOptics"] = "",
HighInFiberOptics = "", ["Atoms"] = "",
Atoms = "", ["adlmr"] = "",
adlmr = "", ["rayijin"] = "",
rayijin = "", ["Sephir"] = "",
Sephir = "", ["inator1192"] = "",
inator1192 = "", ["TeZwo"] = "",
TeZwo = "", ["neumond"] = "",
neumond = "", ["bhenoa"] = "",
bhenoa = "", ["JBC363"] = "",
JBC363 = "", ["Kaig3n"] = "",
Kaig3n = "", ["Factorioio"] = "",
Factorioio = "", ["Bawz"] = "",
Bawz = "", ["CrazyStephen"] = "",
CrazyStephen = "", ["eithel"] = "",
eithel = "", ["Coyote101"] = "",
Coyote101 = "", ["jedifan"] = "",
jedifan = "", ["xsidd"] = "",
xsidd = "", ["MaxTheSpunkyMunk"] = "",
MaxTheSpunkyMunk = "", ["Tarpon907"] = "",
Tarpon907 = "", ["BigHamster"] = "",
BigHamster = "", ["sir"] = "",
sir = "", ["Arnietom"] = "",
Arnietom = "", ["Animal"] = "",
Animal = "", ["banakeg"] = "",
banakeg = "", ["philip017"] = "",
philip017 = "", ["NinjrKillr"] = "",
NinjrKillr = "", ["MarckHardt"] = "",
MarckHardt = "", ["BrainClot"] = "",
BrainClot = "", ["blzz"] = "",
blzz = "", ["WatchingHawk"] = "",
WatchingHawk = "", ["farcear"] = "",
farcear = "", ["selen"] = "",
selen = "", ["trekie4747"] = "",
trekie4747 = "", ["Gizan"] = "",
Gizan = "", ["Slastraf"] = "",
Slastraf = "", ["zacman0510"] = "",
zacman0510 = "", ["TheOrangeAngle"] = "",
TheOrangeAngle = "", ["williambellwisdo"] = "",
williambellwisdo = "", ["Extraxyz"] = "",
Extraxyz = "", ["markupolionCZ"] = "",
markupolionCZ = "", ["BJHunter"] = "",
BJHunter = "", ["ZTX"] = "",
ZTX = "", ["bigglesthepirate"] = "",
bigglesthepirate = "", ["g-h-o-s-t"] = "",
["-slug-"] = "", ["wekkka"] = "",
["g-h-o-s-t"] = "", ["Beelzemon"] = "",
["rododendro"] = "",
["mrkoss"] = "",
["koretego"] = "",
["cogito123"] = "",
["palulukan"] = "",
["RadianRaze"] = "",
["kostrahb"] = "",
["mafisch3"] = "",
["cydes"] = "",
["ccaspanello"] = "",
["WickVitaminC"] = "",
["Farcear"] = "",
["Newcott"] = "",
["craigrood"] = "",
["lillepallt"] = "",
["skykittena"] = "",
["rico2403"] = "",
["Claude47"] = "",
["MrSjaakBraak"] = "",
["Heretek"] = "",
["Factorian12321"] = "",
["steponitnicejob"] = "",
["cchpucky"] = "",
["rulerofdabacon"] = "",
["TCP"] = "",
["Marucan"] = "",
["TWLTriston"] = "",
["Bemm"] = "",
["lordxleasy"] = "",
} }

View File

@@ -1,5 +1,13 @@
function change_entry(name, position, action) function update_group(position)
game.write_file("privilege_changes.txt", "[" .. format_time(game.tick) .. "] " .. position .. ": " .. action .. " " .. name .. "\n", true) local file = position .. ".lua"
game.write_file(file, "return\n{\n", false)
local group = global.scenario.variables[position]
local line = ""
for player_name,_ in pairs(group) do
line = string.format('["%s"] = "",\n', player_name)
game.write_file(file, line, true)
end
game.write_file(file, "}", true)
end end
function get_actor() function get_actor()
@@ -21,8 +29,8 @@ function add_regular(player_name)
else else
if game.players[player_name] then if game.players[player_name] then
game.print(actor .. " promoted " .. player_name .. " to regular.") game.print(actor .. " promoted " .. player_name .. " to regular.")
change_entry(player_name, "regulars", "add")
global.scenario.variables.regulars[player_name] = "" global.scenario.variables.regulars[player_name] = ""
update_group("regulars")
else else
player_print(player_name .. " does not exist.") player_print(player_name .. " does not exist.")
end end
@@ -35,8 +43,8 @@ function add_mod(player_name)
else else
if game.players[player_name] then if game.players[player_name] then
game.print(actor .. " promoted " .. player_name .. " to moderator.") game.print(actor .. " promoted " .. player_name .. " to moderator.")
change_entry(player_name, "regulars", "remove")
global.scenario.variables.mods[player_name] = "" global.scenario.variables.mods[player_name] = ""
update_group("mods")
else else
player_print(player_name .. " does not exist.") player_print(player_name .. " does not exist.")
end end
@@ -47,14 +55,14 @@ function remove_regular(player_name)
local actor = get_actor() local actor = get_actor()
if is_regular(player_name) then game.print(player_name .. " was demoted from regular by " .. actor .. ".") end if is_regular(player_name) then game.print(player_name .. " was demoted from regular by " .. actor .. ".") end
global.scenario.variables.regulars[player_name] = nil global.scenario.variables.regulars[player_name] = nil
change_entry(player_name, "mods ", "add") update_group("regulars")
end end
function remove_mod(player_name) function remove_mod(player_name)
local actor = get_actor() local actor = get_actor()
if is_mod(player_name) then game.print(player_name .. " was demoted from mod by " .. actor .. ".") end if is_mod(player_name) then game.print(player_name .. " was demoted from mod by " .. actor .. ".") end
global.scenario.variables.mods[player_name] = nil global.scenario.variables.mods[player_name] = nil
change_entry(player_name, "mods ", "remove") update_group("mods")
end end
function print_regulars() function print_regulars()