1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Game is now local

This commit is contained in:
grilledham 2018-09-22 23:25:13 +01:00
parent d232add93f
commit f1ef10beb6
37 changed files with 50 additions and 15 deletions

View File

@ -1,5 +1,6 @@
local Event = require "utils.event"
local Utils = require "utils.utils"
local Game = require 'utils.game'
global.original_last_users_by_ent_pos = {}

View File

@ -3,6 +3,7 @@
local Event = require 'utils.event'
local Token = require 'utils.global_token'
local Gui = require 'utils.gui'
local Game = require 'utils.game'
local function getBlueprintCursorStack(player)
local cursor = player.cursor_stack

View File

@ -1,4 +1,5 @@
local Event = require "utils.event"
local Game = require 'utils.game'
Event.add(defines.events.on_player_died, function (event)
local player = event.player_index

View File

@ -1,4 +1,4 @@
_DEBUG = false
_DEBUG = true
MARKET_ITEM = 'coin'
global.scenario = {}

View File

@ -1,7 +1,9 @@
require 'config'
require 'utils.utils'
require 'utils.list_utils'
require 'game'
local Game = require 'utils.game'
require 'user_groups'
require 'custom_commands'
require 'base_data'
@ -29,6 +31,7 @@ require 'paint'
require 'score'
require 'popup'
local Event = require 'utils.event'
local Donators = require 'resources.donators'

View File

@ -2,6 +2,7 @@ local Event = require 'utils.event'
local Global = require 'utils.global'
local Task = require 'utils.Task'
local Token = require 'utils.global_token'
local Game = require 'utils.game'
local player_corpses = {}

View File

@ -3,6 +3,7 @@ local Event = require 'utils.event'
local Token = require 'utils.global_token'
local UserGroups = require 'user_groups'
local Utils = require 'utils.utils'
local Game = require 'utils.game'
--local Antigrief = require 'antigrief'
function player_print(str)
@ -247,7 +248,7 @@ local function regular(cmd)
end
local function afk()
for _, v in pairs(Game.players) do
for _, v in pairs(game.players) do
if v.afk_time > 300 then
local time = ' '
if v.afk_time > 21600 then
@ -624,7 +625,7 @@ end
local function admin_chat(cmd)
if not game.player or game.player.admin then --admins AND server
for _, p in pairs(Game.players) do
for _, p in pairs(game.players) do
if p.admin then
local tag = ''
if game.player.tag and game.player.tag ~= '' then

View File

@ -20,6 +20,7 @@ local Event = require 'utils.event'
local Token = require 'utils.global_token'
local Task = require 'utils.Task'
local PlayerStats = require 'player_stats'
local Game = require 'utils.game'
local Market_items = require 'resources.market_items'
local market_item = Market_items.market_item

View File

@ -1,6 +1,7 @@
global.follows = {}
global.follows.n_entries = 0
local Utils = require "utils.utils"
local Game = require 'utils.game'
function get_direction(follower, target)
local delta_x = target.position.x - follower.position.x

View File

@ -3,6 +3,7 @@ local Token = require 'utils.global_token'
local Gui = require 'utils.gui'
local Task = require 'utils.Task'
local Global = require 'utils.global'
local Game = require 'utils.game'
local chests = {}
local chests_next = {}

View File

@ -2,6 +2,7 @@ local Gui = require 'utils.gui'
local Global = require 'utils.global'
local Event = require 'utils.event'
local UserGroups = require 'user_groups'
local Game = require 'utils.game'
local normal_color = {r = 1, g = 1, b = 1}
local focus_color = {r = 1, g = 0.55, b = 0.1}

View File

@ -16,7 +16,7 @@ random game events // earthquake, biters, rock treasure, messages
local simplex_noise = require 'map_gen.shared.simplex_noise'
local Event = require 'utils.event'
local market_items = require "map_gen.combined.cave_miner.market_items"
local Game = require 'utils.game'
local Info = require 'info'

View File

@ -1,4 +1,5 @@
local Event = require 'utils.event'
local Game = require 'utils.game'
global.allowed_entites = {
['transport-belt'] = true,

View File

@ -1,4 +1,5 @@
local Event = require 'utils.event'
local Game = require 'utils.game'
global.allowed_landfill_tiles = {}

View File

@ -1,4 +1,5 @@
local Event = require "utils.event"
local Game = require 'utils.game'
Event.on_init(function()

View File

@ -4,6 +4,7 @@ require("rso_config")
require("util")
require("rso_resource_config")
local Utils = require "utils.utils"
local Game = require 'utils.game'
local MB=require "metaball"
local drand = require 'drand'

View File

@ -2,6 +2,7 @@ local Gui = require 'utils.gui'
local Event = require 'utils.event'
local Global = require 'utils.global'
local PlayerStats = require 'player_stats'
local Game = require 'utils.game'
local Public = {}

View File

@ -1,4 +1,5 @@
local Event = require 'utils.event'
local Game = require 'utils.game'
local mines_factor = 1

View File

@ -1,6 +1,7 @@
local Event = require "utils.event"
local UserGroups = require "user_groups"
local Utils = require "utils.utils"
local Game = require 'utils.game'
function allowed_to_nuke(player)
if type(player) == "table" then

View File

@ -1,5 +1,6 @@
local Event = require 'utils.event'
local Gui = require 'utils.gui'
local Game = require 'utils.game'
local brush_tool = 'refined-hazard-concrete'

View File

@ -1,4 +1,5 @@
local Event = require 'utils.event'
local Game = require 'utils.game'
local player_colors = {
['grilledham'] = {

View File

@ -6,6 +6,7 @@ local UserGroups = require 'user_groups'
local PlayerStats = require 'player_stats'
local Utils = require 'utils.utils'
local Report = require 'report'
local Game = require 'utils.game'
local poke_messages = require 'resources.poke_messages'
local player_sprites = require 'resources.player_sprites'

View File

@ -1,5 +1,6 @@
local Event = require 'utils.event'
local Global = require 'utils.global'
local Game = require 'utils.game'
local player_last_position = {}
local player_walk_distances = {}

View File

@ -2,6 +2,7 @@ local Gui = require 'utils.gui'
local Global = require 'utils.global'
local Event = require 'utils.event'
local UserGroups = require 'user_groups'
local Game = require 'utils.game'
local default_poll_duration = 300 * 60 -- in ticks
local duration_max = 3600 -- in seconds

View File

@ -67,7 +67,7 @@ local function entity_destroyed(event)
end
local function alert(reactor)
for _, p in pairs(Game.players) do
for _, p in pairs(game.players) do
p.add_custom_alert(
reactor,
{type = 'item', name = 'nuclear-reactor'},

View File

@ -2,6 +2,7 @@ local Module = {}
local Gui = require("utils.gui")
local Utils = require("utils.utils");
local Game = require 'utils.game'
local report_frame_name = Gui.uid_name()
local report_close_button_name = Gui.uid_name()
local report_tab_button_name = Gui.uid_name()
@ -77,14 +78,14 @@ function Module.report(reporting_player, reported_player, message)
table.insert(global.reports, {reporting_player_index = reporting_player.index, reported_player_index = reported_player.index, message = message, tick = game.tick})
local notified = false
for _,p in pairs(Game.players) do
for _,p in pairs(game.players) do
if p.admin and p.connected then
Module.show_reports(p)
if p.afk_time < 3600 then notified = true end
end
end
if not notified then
for _,p in pairs(Game.players) do
for _,p in pairs(game.players) do
if p.admin then
Module.show_reports(p)
end

View File

@ -1,4 +1,5 @@
local Event = require "utils.event"
local Game = require 'utils.game'
if not global.score_rockets_launched then global.score_rockets_launched = 0 end

View File

@ -1,4 +1,5 @@
local Event = require "utils.event"
local Game = require 'utils.game'
global.player_spawns = {} -- player_index to spawn_name
global.spawns = {} -- spawn_name to x, y, player_online_count

View File

@ -2,6 +2,7 @@ local Event = require 'utils.event'
local Gui = require 'utils.gui'
local Global = require 'utils.global'
local UserGroups = require 'user_groups'
local Game = require 'utils.game'
local deafult_verb = 'expanded'
@ -242,7 +243,7 @@ local function draw_main_frame(player)
end
local function redraw_main_frame()
for _, p in pairs(Game.players) do
for _, p in pairs(game.players) do
local main_frame = p.gui.left[main_frame_name]
if main_frame and main_frame.valid then
local content = main_frame[main_frame_content_name]
@ -458,7 +459,7 @@ Gui.on_click(
local tag = '[' .. tag_name .. ']'
for _, player in pairs(Game.players) do
for _, player in pairs(game.players) do
if player.valid and player.tag == tag then
change_player_tag(player, '')
@ -611,7 +612,7 @@ Gui.on_click(
local old_tag = '[' .. old_name .. ']'
for _, p in pairs(Game.players) do
for _, p in pairs(game.players) do
if p.valid and p.tag == old_tag then
change_player_tag(p, tag_name, true)

View File

@ -3,6 +3,7 @@ local Gui = require 'utils.gui'
local Global = require 'utils.global'
local UserGroups = require 'user_groups'
local Utils = require 'utils.utils'
local Game = require 'utils.game'
local normal_color = {r = 1, g = 1, b = 1}
local focus_color = {r = 1, g = 0.55, b = 0.1}

View File

@ -3,6 +3,7 @@ local Market_items = require 'resources.market_items'
local Global = require 'utils.global'
local Donators = require 'resources.donators'
local UserGroups = require 'user_groups'
local Game = require 'utils.game'
local train_perk_flag = Donators.donator_perk_flags.train
local saviour_token_name = 'small-plane' -- item name for what saves players

View File

@ -1,4 +1,5 @@
local Event = require 'utils.event'
local Game = require 'utils.game'
local function player_built_entity(event)
local entity = event.created_entity

View File

@ -3,6 +3,7 @@ local Donators = require 'resources.donators'
global.donators = Donators.donators
local Event = require 'utils.event'
local Utils = require 'utils.utils'
local Game = require 'utils.game'
local Module = {}

View File

@ -8,12 +8,12 @@ local init_data = {}
function Global.register(tbl, callback)
local token = Token.register_global(tbl)
table.insert(load_data, {tbl = tbl, callback = callback, token = token})
table.insert(load_data, {callback = callback, token = token})
end
function Global.register_init(tbl, init_handler, callback)
local token = Token.register_global(tbl)
table.insert(load_data, {tbl = tbl, callback = callback, token = token})
table.insert(load_data, {callback = callback, token = token})
table.insert(init_data, {token = token, init_handler = init_handler, callback = callback})
end

View File

@ -1,5 +1,6 @@
local Token = require 'utils.global_token'
local Event = require 'utils.event'
local Game = require 'utils.game'
local Gui = {}

View File

@ -1,4 +1,5 @@
local Module = {}
local Game = require 'utils.game'
Module.distance = function(pos1, pos2)
local dx = pos2.x - pos1.x
@ -23,7 +24,7 @@ function math.clamp(num, min, max)
end
Module.print_except = function(msg, player)
for _, p in pairs(Game.players) do
for _, p in pairs(game.players) do
if p.connected and p ~= player then
p.print(msg)
end
@ -31,7 +32,7 @@ Module.print_except = function(msg, player)
end
Module.print_admins = function(msg)
for _, p in pairs(Game.players) do
for _, p in pairs(game.players) do
if p.connected and p.admin then
p.print(msg)
end

View File

@ -2,6 +2,7 @@ local Event = require 'utils.event'
local Token = require 'utils.global_token'
local Task = require 'utils.Task'
local PlayerStats = require 'player_stats'
local Game = require 'utils.game'
local market_items = require 'resources.market_items'