mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-30 23:17:53 +02:00
minor tweaks
This commit is contained in:
parent
834770cea2
commit
b5990868e4
@ -172,8 +172,8 @@ local antigrief_functions = {
|
||||
|
||||
local fortress_functions = {
|
||||
['comfy_panel_disable_fullness'] = function(event)
|
||||
local WPT = package.loaded['maps.mountain_fortress_v3.table']
|
||||
local this = WPT.get()
|
||||
local Fullness = package.loaded['modules.check_fullness']
|
||||
local this = Fullness.get()
|
||||
if event.element.switch_state == 'left' then
|
||||
this.fullness_enabled = true
|
||||
get_actor(event, '{Fullness}', 'has enabled the inventory fullness function.')
|
||||
@ -432,10 +432,11 @@ local build_config_gui = (function(player, frame)
|
||||
label.style.horizontal_align = 'left'
|
||||
label.style.vertical_align = 'bottom'
|
||||
label.style.font_color = Color.green
|
||||
local WPT = package.loaded['maps.mountain_fortress_v3.table']
|
||||
local this = WPT.get()
|
||||
|
||||
local Fullness = package.loaded['modules.check_fullness']
|
||||
local full = Fullness.get()
|
||||
switch_state = 'right'
|
||||
if this.fullness_enabled then
|
||||
if full.fullness_enabled then
|
||||
switch_state = 'left'
|
||||
end
|
||||
add_switch(
|
||||
@ -448,6 +449,8 @@ local build_config_gui = (function(player, frame)
|
||||
|
||||
scroll_pane.add({type = 'line'})
|
||||
|
||||
local WPT = package.loaded['maps.mountain_fortress_v3.table']
|
||||
local this = WPT.get()
|
||||
switch_state = 'right'
|
||||
if this.offline_players_enabled then
|
||||
switch_state = 'left'
|
||||
|
@ -7,11 +7,11 @@ commands.add_command(
|
||||
'spaghetti',
|
||||
'Does spaghett.',
|
||||
function(cmd)
|
||||
local p_modifer = Modifiers.get_table()
|
||||
local p_modifer = Modifiers.get_table()
|
||||
local player = game.player
|
||||
local _a = p_modifer
|
||||
local param = tostring(cmd.parameter)
|
||||
local force = game.forces["player"]
|
||||
local force = game.forces['player']
|
||||
local p
|
||||
|
||||
if player then
|
||||
@ -21,82 +21,92 @@ commands.add_command(
|
||||
p("[ERROR] You're not admin!", Color.fail)
|
||||
return
|
||||
end
|
||||
else
|
||||
else
|
||||
p = log
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if param == nil then player.print("[ERROR] Arguments are true/false", Color.yellow) return end
|
||||
if param == "true" then
|
||||
if not _a.spaghetti_are_you_sure then
|
||||
_a.spaghetti_are_you_sure = true
|
||||
player.print("Spaghetti is not enabled, run this command again to enable spaghett", Color.yellow)
|
||||
return
|
||||
end
|
||||
if _a.spaghetti_enabled == true then player.print("Spaghetti is already enabled.", Color.yellow) return end
|
||||
game.print("The world has been spaghettified!", Color.success)
|
||||
force.technologies["logistic-system"].enabled = false
|
||||
force.technologies["construction-robotics"].enabled = false
|
||||
force.technologies["logistic-robotics"].enabled = false
|
||||
force.technologies["robotics"].enabled = false
|
||||
force.technologies["personal-roboport-equipment"].enabled = false
|
||||
force.technologies["personal-roboport-mk2-equipment"].enabled = false
|
||||
force.technologies["character-logistic-trash-slots-1"].enabled = false
|
||||
force.technologies["character-logistic-trash-slots-2"].enabled = false
|
||||
force.technologies["auto-character-logistic-trash-slots"].enabled = false
|
||||
force.technologies["worker-robots-storage-1"].enabled = false
|
||||
force.technologies["worker-robots-storage-2"].enabled = false
|
||||
force.technologies["worker-robots-storage-3"].enabled = false
|
||||
force.technologies["character-logistic-slots-1"].enabled = false
|
||||
force.technologies["character-logistic-slots-2"].enabled = false
|
||||
force.technologies["character-logistic-slots-3"].enabled = false
|
||||
force.technologies["character-logistic-slots-4"].enabled = false
|
||||
force.technologies["character-logistic-slots-5"].enabled = false
|
||||
force.technologies["character-logistic-slots-6"].enabled = false
|
||||
force.technologies["worker-robots-speed-1"].enabled = false
|
||||
force.technologies["worker-robots-speed-2"].enabled = false
|
||||
force.technologies["worker-robots-speed-3"].enabled = false
|
||||
force.technologies["worker-robots-speed-4"].enabled = false
|
||||
force.technologies["worker-robots-speed-5"].enabled = false
|
||||
force.technologies["worker-robots-speed-6"].enabled = false
|
||||
_a.spaghetti_enabled = true
|
||||
elseif param == "false" then
|
||||
if _a.spaghetti_enabled == false or _a.spaghetti_enabled == nil then player.print("Spaghetti is already disabled.", Color.yellow) return end
|
||||
game.print("The world is no longer spaghett!", Color.yellow)
|
||||
force.technologies["logistic-system"].enabled = true
|
||||
force.technologies["construction-robotics"].enabled = true
|
||||
force.technologies["logistic-robotics"].enabled = true
|
||||
force.technologies["robotics"].enabled = true
|
||||
force.technologies["personal-roboport-equipment"].enabled = true
|
||||
force.technologies["personal-roboport-mk2-equipment"].enabled = true
|
||||
force.technologies["character-logistic-trash-slots-1"].enabled = true
|
||||
force.technologies["character-logistic-trash-slots-2"].enabled = true
|
||||
force.technologies["auto-character-logistic-trash-slots"].enabled = true
|
||||
force.technologies["worker-robots-storage-1"].enabled = true
|
||||
force.technologies["worker-robots-storage-2"].enabled = true
|
||||
force.technologies["worker-robots-storage-3"].enabled = true
|
||||
force.technologies["character-logistic-slots-1"].enabled = true
|
||||
force.technologies["character-logistic-slots-2"].enabled = true
|
||||
force.technologies["character-logistic-slots-3"].enabled = true
|
||||
force.technologies["character-logistic-slots-4"].enabled = true
|
||||
force.technologies["character-logistic-slots-5"].enabled = true
|
||||
force.technologies["character-logistic-slots-6"].enabled = true
|
||||
force.technologies["worker-robots-speed-1"].enabled = true
|
||||
force.technologies["worker-robots-speed-2"].enabled = true
|
||||
force.technologies["worker-robots-speed-3"].enabled = true
|
||||
force.technologies["worker-robots-speed-4"].enabled = true
|
||||
force.technologies["worker-robots-speed-5"].enabled = true
|
||||
force.technologies["worker-robots-speed-6"].enabled = true
|
||||
_a.spaghetti_enabled = false
|
||||
end
|
||||
end)
|
||||
if param == nil then
|
||||
player.print('[ERROR] Arguments are true/false', Color.yellow)
|
||||
return
|
||||
end
|
||||
if param == 'true' then
|
||||
if not _a.spaghetti_are_you_sure then
|
||||
_a.spaghetti_are_you_sure = true
|
||||
player.print('Spaghetti is not enabled, run this command again to enable spaghett', Color.yellow)
|
||||
return
|
||||
end
|
||||
if _a.spaghetti_enabled == true then
|
||||
player.print('Spaghetti is already enabled.', Color.yellow)
|
||||
return
|
||||
end
|
||||
game.print('The world has been spaghettified!', Color.success)
|
||||
force.technologies['logistic-system'].enabled = false
|
||||
force.technologies['construction-robotics'].enabled = false
|
||||
force.technologies['logistic-robotics'].enabled = false
|
||||
force.technologies['robotics'].enabled = false
|
||||
force.technologies['personal-roboport-equipment'].enabled = false
|
||||
force.technologies['personal-roboport-mk2-equipment'].enabled = false
|
||||
force.technologies['character-logistic-trash-slots-1'].enabled = false
|
||||
force.technologies['character-logistic-trash-slots-2'].enabled = false
|
||||
force.technologies['auto-character-logistic-trash-slots'].enabled = false
|
||||
force.technologies['worker-robots-storage-1'].enabled = false
|
||||
force.technologies['worker-robots-storage-2'].enabled = false
|
||||
force.technologies['worker-robots-storage-3'].enabled = false
|
||||
force.technologies['character-logistic-slots-1'].enabled = false
|
||||
force.technologies['character-logistic-slots-2'].enabled = false
|
||||
force.technologies['character-logistic-slots-3'].enabled = false
|
||||
force.technologies['character-logistic-slots-4'].enabled = false
|
||||
force.technologies['character-logistic-slots-5'].enabled = false
|
||||
force.technologies['character-logistic-slots-6'].enabled = false
|
||||
force.technologies['worker-robots-speed-1'].enabled = false
|
||||
force.technologies['worker-robots-speed-2'].enabled = false
|
||||
force.technologies['worker-robots-speed-3'].enabled = false
|
||||
force.technologies['worker-robots-speed-4'].enabled = false
|
||||
force.technologies['worker-robots-speed-5'].enabled = false
|
||||
force.technologies['worker-robots-speed-6'].enabled = false
|
||||
_a.spaghetti_enabled = true
|
||||
elseif param == 'false' then
|
||||
if _a.spaghetti_enabled == false or _a.spaghetti_enabled == nil then
|
||||
player.print('Spaghetti is already disabled.', Color.yellow)
|
||||
return
|
||||
end
|
||||
game.print('The world is no longer spaghett!', Color.yellow)
|
||||
force.technologies['logistic-system'].enabled = true
|
||||
force.technologies['construction-robotics'].enabled = true
|
||||
force.technologies['logistic-robotics'].enabled = true
|
||||
force.technologies['robotics'].enabled = true
|
||||
force.technologies['personal-roboport-equipment'].enabled = true
|
||||
force.technologies['personal-roboport-mk2-equipment'].enabled = true
|
||||
force.technologies['character-logistic-trash-slots-1'].enabled = true
|
||||
force.technologies['character-logistic-trash-slots-2'].enabled = true
|
||||
force.technologies['auto-character-logistic-trash-slots'].enabled = true
|
||||
force.technologies['worker-robots-storage-1'].enabled = true
|
||||
force.technologies['worker-robots-storage-2'].enabled = true
|
||||
force.technologies['worker-robots-storage-3'].enabled = true
|
||||
force.technologies['character-logistic-slots-1'].enabled = true
|
||||
force.technologies['character-logistic-slots-2'].enabled = true
|
||||
force.technologies['character-logistic-slots-3'].enabled = true
|
||||
force.technologies['character-logistic-slots-4'].enabled = true
|
||||
force.technologies['character-logistic-slots-5'].enabled = true
|
||||
force.technologies['character-logistic-slots-6'].enabled = true
|
||||
force.technologies['worker-robots-speed-1'].enabled = true
|
||||
force.technologies['worker-robots-speed-2'].enabled = true
|
||||
force.technologies['worker-robots-speed-3'].enabled = true
|
||||
force.technologies['worker-robots-speed-4'].enabled = true
|
||||
force.technologies['worker-robots-speed-5'].enabled = true
|
||||
force.technologies['worker-robots-speed-6'].enabled = true
|
||||
_a.spaghetti_enabled = false
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
commands.add_command(
|
||||
'generate_map',
|
||||
'Pregenerates map.',
|
||||
function(cmd)
|
||||
local p_modifer = Modifiers.get_table()
|
||||
local _a = p_modifer
|
||||
local p_modifer = Modifiers.get_table()
|
||||
local _a = p_modifer
|
||||
local player = game.player
|
||||
local param = tonumber(cmd.parameter)
|
||||
local p
|
||||
@ -108,40 +118,50 @@ commands.add_command(
|
||||
p("[ERROR] You're not admin!", Color.fail)
|
||||
return
|
||||
end
|
||||
else
|
||||
else
|
||||
p = log
|
||||
end
|
||||
end
|
||||
end
|
||||
if param == nil then
|
||||
player.print('[ERROR] Must specify radius!', Color.fail)
|
||||
return
|
||||
end
|
||||
if param > 50 then
|
||||
player.print('[ERROR] Value is too big.', Color.fail)
|
||||
return
|
||||
end
|
||||
if param == nil then player.print("[ERROR] Must specify radius!", Color.fail) return end
|
||||
if param > 50 then player.print("[ERROR] Value is too big.", Color.fail) return end
|
||||
|
||||
if not _a.generate_map then
|
||||
if not _a.generate_map then
|
||||
_a.generate_map = true
|
||||
player.print("[WARNING] This command will make the server LAG, run this command again if you really want to do this!", Color.yellow)
|
||||
player.print(
|
||||
'[WARNING] This command will make the server LAG, run this command again if you really want to do this!',
|
||||
Color.yellow
|
||||
)
|
||||
return
|
||||
end
|
||||
local radius = param
|
||||
local surface = game.players[1].surface
|
||||
if surface.is_chunk_generated({radius, radius}) then
|
||||
game.print("Map generation done!", Color.success)
|
||||
_a.generate_map = nil
|
||||
return
|
||||
end
|
||||
surface.request_to_generate_chunks({0,0}, radius)
|
||||
surface.force_generate_chunk_requests()
|
||||
for _, pl in pairs(game.connected_players) do
|
||||
pl.play_sound{path="utility/new_objective", volume_modifier=1}
|
||||
end
|
||||
game.print("Map generation done!", Color.success)
|
||||
_a.generate_map = nil
|
||||
end)
|
||||
local surface = game.players[1].surface
|
||||
if surface.is_chunk_generated({radius, radius}) then
|
||||
game.print('Map generation done!', Color.success)
|
||||
_a.generate_map = nil
|
||||
return
|
||||
end
|
||||
surface.request_to_generate_chunks({0, 0}, radius)
|
||||
surface.force_generate_chunk_requests()
|
||||
for _, pl in pairs(game.connected_players) do
|
||||
pl.play_sound {path = 'utility/new_objective', volume_modifier = 1}
|
||||
end
|
||||
game.print('Map generation done!', Color.success)
|
||||
_a.generate_map = nil
|
||||
end
|
||||
)
|
||||
|
||||
commands.add_command(
|
||||
'dump_layout',
|
||||
'Dump the current map-layout.',
|
||||
function()
|
||||
local p_modifer = Modifiers.get_table()
|
||||
local _a = p_modifer
|
||||
local p_modifer = Modifiers.get_table()
|
||||
local _a = p_modifer
|
||||
local player = game.player
|
||||
local p
|
||||
|
||||
@ -152,65 +172,69 @@ commands.add_command(
|
||||
p("[ERROR] You're not admin!", Color.warning)
|
||||
return
|
||||
end
|
||||
else
|
||||
else
|
||||
p = log
|
||||
end
|
||||
end
|
||||
end
|
||||
if not _a.dump_layout then
|
||||
if not _a.dump_layout then
|
||||
_a.dump_layout = true
|
||||
player.print("[WARNING] This command will make the server LAG, run this command again if you really want to do this!", Color.yellow)
|
||||
player.print(
|
||||
'[WARNING] This command will make the server LAG, run this command again if you really want to do this!',
|
||||
Color.yellow
|
||||
)
|
||||
return
|
||||
end
|
||||
local surface = game.players[1].surface
|
||||
game.write_file("layout.lua", "" , false)
|
||||
local surface = game.players[1].surface
|
||||
game.write_file('layout.lua', '', false)
|
||||
|
||||
local area = {
|
||||
left_top = {x = 0, y = 0},
|
||||
right_bottom = {x = 32, y = 32}
|
||||
}
|
||||
local area = {
|
||||
left_top = {x = 0, y = 0},
|
||||
right_bottom = {x = 32, y = 32}
|
||||
}
|
||||
|
||||
local entities = surface.find_entities_filtered{area = area}
|
||||
local tiles = surface.find_tiles_filtered{area = area}
|
||||
local entities = surface.find_entities_filtered {area = area}
|
||||
local tiles = surface.find_tiles_filtered {area = area}
|
||||
|
||||
for _, e in pairs(entities) do
|
||||
local str = "{position = {x = " .. e.position.x
|
||||
str = str .. ", y = "
|
||||
str = str .. e.position.y
|
||||
str = str .. '}, name = "'
|
||||
str = str .. e.name
|
||||
str = str .. '", direction = '
|
||||
str = str .. tostring(e.direction)
|
||||
str = str .. ', force = "'
|
||||
str = str .. e.force.name
|
||||
str = str .. '"},'
|
||||
if e.name ~= "character" then
|
||||
game.write_file("layout.lua", str .. '\n' , true)
|
||||
end
|
||||
end
|
||||
for _, e in pairs(entities) do
|
||||
local str = '{position = {x = ' .. e.position.x
|
||||
str = str .. ', y = '
|
||||
str = str .. e.position.y
|
||||
str = str .. '}, name = "'
|
||||
str = str .. e.name
|
||||
str = str .. '", direction = '
|
||||
str = str .. tostring(e.direction)
|
||||
str = str .. ', force = "'
|
||||
str = str .. e.force.name
|
||||
str = str .. '"},'
|
||||
if e.name ~= 'character' then
|
||||
game.write_file('layout.lua', str .. '\n', true)
|
||||
end
|
||||
end
|
||||
|
||||
game.write_file("layout.lua",'\n' , true)
|
||||
game.write_file("layout.lua",'\n' , true)
|
||||
game.write_file("layout.lua",'Tiles: \n' , true)
|
||||
game.write_file('layout.lua', '\n', true)
|
||||
game.write_file('layout.lua', '\n', true)
|
||||
game.write_file('layout.lua', 'Tiles: \n', true)
|
||||
|
||||
for _, t in pairs(tiles) do
|
||||
local str = "{position = {x = " .. t.position.x
|
||||
str = str .. ", y = "
|
||||
str = str .. t.position.y
|
||||
str = str .. '}, name = "'
|
||||
str = str .. t.name
|
||||
str = str .. '"},'
|
||||
game.write_file("layout.lua", str .. '\n' , true)
|
||||
player.print("Dumped layout as file: layout.lua", Color.success)
|
||||
end
|
||||
_a.dump_layout = false
|
||||
end)
|
||||
for _, t in pairs(tiles) do
|
||||
local str = '{position = {x = ' .. t.position.x
|
||||
str = str .. ', y = '
|
||||
str = str .. t.position.y
|
||||
str = str .. '}, name = "'
|
||||
str = str .. t.name
|
||||
str = str .. '"},'
|
||||
game.write_file('layout.lua', str .. '\n', true)
|
||||
player.print('Dumped layout as file: layout.lua', Color.success)
|
||||
end
|
||||
_a.dump_layout = false
|
||||
end
|
||||
)
|
||||
|
||||
commands.add_command(
|
||||
'creative',
|
||||
'Enables creative_mode.',
|
||||
function()
|
||||
local p_modifer = Modifiers.get_table()
|
||||
local _a = p_modifer
|
||||
local p_modifer = Modifiers.get_table()
|
||||
local _a = p_modifer
|
||||
local player = game.player
|
||||
local p
|
||||
|
||||
@ -221,54 +245,61 @@ commands.add_command(
|
||||
p("[ERROR] You're not admin!", Color.fail)
|
||||
return
|
||||
end
|
||||
else
|
||||
else
|
||||
p = log
|
||||
end
|
||||
end
|
||||
end
|
||||
if not _a.creative_are_you_sure then
|
||||
if not _a.creative_are_you_sure then
|
||||
_a.creative_are_you_sure = true
|
||||
player.print("[WARNING] This command will enable creative/cheat-mode for all connected players, run this command again if you really want to do this!", Color.yellow)
|
||||
player.print(
|
||||
'[WARNING] This command will enable creative/cheat-mode for all connected players, run this command again if you really want to do this!',
|
||||
Color.yellow
|
||||
)
|
||||
return
|
||||
end
|
||||
if _a.creative_enabled == true then
|
||||
player.print('[ERROR] Creative/cheat-mode is already active!', Color.fail)
|
||||
return
|
||||
end
|
||||
if _a.creative_enabled == true then player.print("[ERROR] Creative/cheat-mode is already active!", Color.fail) return end
|
||||
|
||||
game.print(player.name .. " has activated creative-mode!", Color.warning)
|
||||
Server.to_discord_bold(table.concat{'[Creative] ' .. player.name .. ' has activated creative-mode!'})
|
||||
game.print(player.name .. ' has activated creative-mode!', Color.warning)
|
||||
Server.to_discord_bold(table.concat {'[Creative] ' .. player.name .. ' has activated creative-mode!'})
|
||||
|
||||
for k, v in pairs(game.connected_players) do
|
||||
v.cheat_mode = true
|
||||
v.insert{name="power-armor-mk2", count = 1}
|
||||
if v.character ~= nil then
|
||||
local p_armor = v.get_inventory(5)[1].grid
|
||||
p_armor.put({name = "fusion-reactor-equipment"})
|
||||
p_armor.put({name = "fusion-reactor-equipment"})
|
||||
p_armor.put({name = "fusion-reactor-equipment"})
|
||||
p_armor.put({name = "exoskeleton-equipment"})
|
||||
p_armor.put({name = "exoskeleton-equipment"})
|
||||
p_armor.put({name = "exoskeleton-equipment"})
|
||||
p_armor.put({name = "energy-shield-mk2-equipment"})
|
||||
p_armor.put({name = "energy-shield-mk2-equipment"})
|
||||
p_armor.put({name = "energy-shield-mk2-equipment"})
|
||||
p_armor.put({name = "energy-shield-mk2-equipment"})
|
||||
p_armor.put({name = "personal-roboport-mk2-equipment"})
|
||||
p_armor.put({name = "night-vision-equipment"})
|
||||
p_armor.put({name = "battery-mk2-equipment"})
|
||||
p_armor.put({name = "battery-mk2-equipment"})
|
||||
local item = game.item_prototypes
|
||||
local i = 0
|
||||
for _k, _v in pairs(item) do
|
||||
i = i + 1
|
||||
if _k and _v.type ~= "mining-tool" then
|
||||
_a[k].character_inventory_slots_bonus["creative"] = tonumber(i)
|
||||
v.character_inventory_slots_bonus = _a[k].character_inventory_slots_bonus["creative"]
|
||||
v.insert{name=_k, count=_v.stack_size}
|
||||
v.print("Inserted all base items.", Color.success)
|
||||
_a.creative_enabled = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
v.cheat_mode = true
|
||||
v.insert {name = 'power-armor-mk2', count = 1}
|
||||
if v.character ~= nil then
|
||||
local p_armor = v.get_inventory(5)[1].grid
|
||||
p_armor.put({name = 'fusion-reactor-equipment'})
|
||||
p_armor.put({name = 'fusion-reactor-equipment'})
|
||||
p_armor.put({name = 'fusion-reactor-equipment'})
|
||||
p_armor.put({name = 'exoskeleton-equipment'})
|
||||
p_armor.put({name = 'exoskeleton-equipment'})
|
||||
p_armor.put({name = 'exoskeleton-equipment'})
|
||||
p_armor.put({name = 'energy-shield-mk2-equipment'})
|
||||
p_armor.put({name = 'energy-shield-mk2-equipment'})
|
||||
p_armor.put({name = 'energy-shield-mk2-equipment'})
|
||||
p_armor.put({name = 'energy-shield-mk2-equipment'})
|
||||
p_armor.put({name = 'personal-roboport-mk2-equipment'})
|
||||
p_armor.put({name = 'night-vision-equipment'})
|
||||
p_armor.put({name = 'battery-mk2-equipment'})
|
||||
p_armor.put({name = 'battery-mk2-equipment'})
|
||||
local item = game.item_prototypes
|
||||
local i = 0
|
||||
for _k, _v in pairs(item) do
|
||||
i = i + 1
|
||||
if _k and _v.type ~= 'mining-tool' then
|
||||
_a[k].character_inventory_slots_bonus['creative'] = tonumber(i)
|
||||
v.character_inventory_slots_bonus = _a[k].character_inventory_slots_bonus['creative']
|
||||
v.insert {name = _k, count = _v.stack_size}
|
||||
v.print('Inserted all base items.', Color.success)
|
||||
_a.creative_enabled = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
commands.add_command(
|
||||
'clear-corpses',
|
||||
@ -277,30 +308,37 @@ commands.add_command(
|
||||
local player = game.player
|
||||
local trusted = Session.get_trusted_table()
|
||||
local param = tonumber(cmd.parameter)
|
||||
local p
|
||||
|
||||
if player then
|
||||
if player ~= nil then
|
||||
p = player.print
|
||||
if not trusted[player.name] then
|
||||
if not player.admin then
|
||||
p("[ERROR] Only admins and trusted weebs are allowed to run this command!", Color.fail)
|
||||
return
|
||||
end
|
||||
end
|
||||
else
|
||||
p = log
|
||||
end
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
if param == nil then player.print("[ERROR] Must specify radius!", Color.fail) return end
|
||||
if param > 500 then player.print("[ERROR] Value is too big.", Color.fail) return end
|
||||
local pos = player.position
|
||||
local p = player.print
|
||||
if not trusted[player.name] then
|
||||
if not player.admin then
|
||||
p('[ERROR] Only admins and trusted weebs are allowed to run this command!', Color.fail)
|
||||
return
|
||||
end
|
||||
end
|
||||
if param == nil then
|
||||
player.print('[ERROR] Must specify radius!', Color.fail)
|
||||
return
|
||||
end
|
||||
if param < 0 then
|
||||
player.print('[ERROR] Value is too low.', Color.fail)
|
||||
return
|
||||
end
|
||||
if param > 500 then
|
||||
player.print('[ERROR] Value is too big.', Color.fail)
|
||||
return
|
||||
end
|
||||
local pos = player.position
|
||||
|
||||
local radius = {{x = (pos.x + -param), y = (pos.y + -param)}, {x = (pos.x + param), y = (pos.y + param)}}
|
||||
for _, entity in pairs(player.surface.find_entities_filtered{area = radius, type = "corpse"}) do
|
||||
if entity.corpse_expires then
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
player.print("Cleared biter-corpses.", Color.success)
|
||||
end)
|
||||
for _, entity in pairs(player.surface.find_entities_filtered {area = radius, type = 'corpse'}) do
|
||||
if entity.corpse_expires then
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
player.print('Cleared biter-corpses.', Color.success)
|
||||
end
|
||||
)
|
||||
|
@ -1010,6 +1010,7 @@ local on_player_or_robot_built_tile = function(event)
|
||||
end
|
||||
end
|
||||
|
||||
Event.add_event_filter(defines.events.on_entity_damaged, {filter = 'final-damage-amount', comparison = '>', value = 0})
|
||||
Event.add(defines.events.on_entity_damaged, on_entity_damaged)
|
||||
Event.add(defines.events.on_player_repaired_entity, on_player_repaired_entity)
|
||||
Event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|
||||
|
@ -55,9 +55,6 @@ function Public.explosive_bullets(event)
|
||||
if not weapon.valid_for_read or not ammo.valid_for_read then
|
||||
return
|
||||
end
|
||||
if weapon.name ~= 'pistol' then
|
||||
return
|
||||
end
|
||||
if
|
||||
ammo.name ~= 'firearm-magazine' and ammo.name ~= 'piercing-rounds-magazine' and
|
||||
ammo.name ~= 'uranium-rounds-magazine'
|
||||
|
@ -222,7 +222,7 @@ end
|
||||
|
||||
local function is_around_train(data)
|
||||
local entity = data.entity
|
||||
local aura = 60
|
||||
local aura = data.aura + 20
|
||||
local loco = data.locomotive.position
|
||||
local area = {
|
||||
left_top = {x = loco.x - aura, y = loco.y - aura},
|
||||
@ -1630,11 +1630,13 @@ function Public.is_around_train(entity)
|
||||
end
|
||||
|
||||
local surface = game.surfaces[active_surface_index]
|
||||
local aura = WPT.get('locomotive_xp_aura')
|
||||
|
||||
local data = {
|
||||
locomotive = locomotive,
|
||||
surface = surface,
|
||||
entity = entity
|
||||
entity = entity,
|
||||
aura = aura
|
||||
}
|
||||
|
||||
local success = is_around_train(data)
|
||||
|
@ -1,4 +1,5 @@
|
||||
local Server = require 'utils.server'
|
||||
local Session = require 'utils.datastore.session_data'
|
||||
local Modifers = require 'player_modifiers'
|
||||
local WPT = require 'maps.mountain_fortress_v3.table'
|
||||
|
||||
@ -50,6 +51,7 @@ local function equip_players(player_starting_items, data)
|
||||
end
|
||||
else
|
||||
data.players[player.index] = nil
|
||||
Session.clear_player(player)
|
||||
game.remove_offline_players({player.index})
|
||||
end
|
||||
end
|
||||
|
@ -55,6 +55,14 @@ function Public.enable_fullness(value)
|
||||
return this.fullness_enabled
|
||||
end
|
||||
|
||||
function Public.get(key)
|
||||
if key then
|
||||
return this[key]
|
||||
else
|
||||
return this
|
||||
end
|
||||
end
|
||||
|
||||
local check_fullness = Public.check_fullness
|
||||
|
||||
Event.add(
|
||||
|
@ -155,9 +155,9 @@ local function poll_difficulty(player)
|
||||
b.style.font = 'heading-2'
|
||||
b.style.minimal_width = 160
|
||||
b.tooltip = this.tooltip[i]
|
||||
if this.difficulties[i].disabled then
|
||||
--[[ if this.difficulties[i].disabled then
|
||||
b.enabled = false
|
||||
end
|
||||
end ]]
|
||||
end
|
||||
local b = frame.add({type = 'label', caption = '- - - - - - - - - - - - - - - - - -'})
|
||||
local b =
|
||||
@ -226,12 +226,6 @@ end
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
local player_count = #game.connected_players
|
||||
if player_count >= 20 then
|
||||
this.difficulties[1].disabled = true
|
||||
this.tooltip[1] = 'Too many players connected!'
|
||||
end
|
||||
|
||||
if game.tick < this.difficulty_poll_closing_timeout then
|
||||
if not this.difficulty_player_votes[player.name] then
|
||||
poll_difficulty(player)
|
||||
|
@ -276,7 +276,7 @@ function Public.extra_settings(player)
|
||||
one_punch_gui_input.enabled = false
|
||||
one_punch_gui_input.tooltip = 'Enabled globally.'
|
||||
else
|
||||
if rpg_t[player.index].level <= 50 then
|
||||
if rpg_t[player.index].level <= 30 then
|
||||
one_punch_gui_input.enabled = false
|
||||
one_punch_gui_input.tooltip = 'Level requirement: 30\nChecked = true\nUnchecked = false'
|
||||
else
|
||||
|
@ -14,9 +14,9 @@ local votejail = {}
|
||||
local votefree = {}
|
||||
local settings = {
|
||||
playtime_for_vote = 25920000, -- 5 days
|
||||
playtime_for_instant_jail = 103680000 -- 20 days
|
||||
playtime_for_instant_jail = 103680000, -- 20 days
|
||||
votejail_count = 5
|
||||
}
|
||||
local votejail_count = 5
|
||||
local set_data = Server.set_data
|
||||
local try_get_data = Server.try_get_data
|
||||
local concat = table.concat
|
||||
@ -231,7 +231,7 @@ local vote_to_jail = function(player, griefer)
|
||||
votejail[griefer].index = votejail[griefer].index + 1
|
||||
Utils.print_to(player, 'You have voted to jail player ' .. griefer .. '.')
|
||||
if
|
||||
votejail[griefer].index >= votejail_count or
|
||||
votejail[griefer].index >= settings.votejail_count or
|
||||
(votejail[griefer].index == #game.connected_players - 1 and
|
||||
#game.connected_players > votejail[griefer].index)
|
||||
then
|
||||
@ -254,7 +254,7 @@ local vote_to_free = function(player, griefer)
|
||||
|
||||
Utils.print_to(player, 'You have voted to free player ' .. griefer .. '.')
|
||||
if
|
||||
votefree[griefer].index >= votejail_count or
|
||||
votefree[griefer].index >= settings.votejail_count or
|
||||
(votefree[griefer].index == #game.connected_players - 1 and
|
||||
#game.connected_players > votefree[griefer].index)
|
||||
then
|
||||
|
@ -4,8 +4,6 @@ local Token = require 'utils.token'
|
||||
local Server = require 'utils.server'
|
||||
local Event = require 'utils.event'
|
||||
local table = require 'utils.table'
|
||||
local Print = require('utils.print_override')
|
||||
local raw_print = Print.raw_print
|
||||
|
||||
local session_data_set = 'sessions'
|
||||
local session = {}
|
||||
@ -71,6 +69,7 @@ local try_upload_data =
|
||||
local new_time = old_time_ingame + player.online_time - online_track[key]
|
||||
if new_time <= 0 then
|
||||
new_time = old_time_ingame + player.online_time
|
||||
online_track[key] = 0
|
||||
print('[ERROR] ' .. key .. ' had new time set as negative value: ' .. new_time)
|
||||
return
|
||||
end
|
||||
@ -160,6 +159,21 @@ function Public.get_trusted_table()
|
||||
return trusted
|
||||
end
|
||||
|
||||
--- Clears a given player from the session tables.
|
||||
-- @param LuaPlayer
|
||||
function Public.clear_player(player)
|
||||
local name = player.name
|
||||
if session[name] then
|
||||
session[name] = nil
|
||||
end
|
||||
if online_track[name] then
|
||||
online_track[name] = nil
|
||||
end
|
||||
if trusted[name] then
|
||||
trusted[name] = nil
|
||||
end
|
||||
end
|
||||
|
||||
Event.add(
|
||||
defines.events.on_player_joined_game,
|
||||
function(event)
|
||||
|
Loading…
Reference in New Issue
Block a user