mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-04 09:42:30 +02:00
Factorio 2.0 update (#1436)
* Init Factorio 2.0 update * add credits * fix test module * I know luackeck, I know * Fixes * Fix bad event.player_index handling * Hotfixes * Remove all filter inserters * Migrate removed items * Deprecating spidertron control and landfill features
This commit is contained in:
parent
cd0a5292a4
commit
26e1c28dc0
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
/map_selection.lua
|
||||
.vscode
|
216
.luacheckrc
216
.luacheckrc
@ -202,7 +202,7 @@ stds.factorio_control = {
|
||||
"get_player_settings",
|
||||
startup = {read_only = false, other_fields = true},
|
||||
global = {read_only = false, other_fields = true},
|
||||
player = {read_only = false, other_fields = true},
|
||||
player_default = {read_only = false, other_fields = true},
|
||||
},
|
||||
},
|
||||
|
||||
@ -211,21 +211,25 @@ stds.factorio_control = {
|
||||
script = {
|
||||
fields = {
|
||||
'active_mods',
|
||||
'feature_flags',
|
||||
'get_event_handler',
|
||||
'get_event_order',
|
||||
'level',
|
||||
'mod_name',
|
||||
'on_configuration_changed',
|
||||
'raise_event',
|
||||
'raise_biter_base_built',
|
||||
'raise_console_chat',
|
||||
'raise_event',
|
||||
'raise_market_item_purchased',
|
||||
'raise_player_crafted_item',
|
||||
'raise_player_fast_transferred',
|
||||
'raise_biter_base_built',
|
||||
'raise_market_item_purchased',
|
||||
'raise_script_built',
|
||||
'raise_script_destroy',
|
||||
'raise_script_revive',
|
||||
'raise_script_set_tiles',
|
||||
'get_event_handler',
|
||||
'mod_name',
|
||||
'get_event_order',
|
||||
'register_on_entity_destroyed'
|
||||
'raise_script_teleported',
|
||||
'register_metatable',
|
||||
'register_on_object_destroyed',
|
||||
},
|
||||
other_fields = false,
|
||||
},
|
||||
@ -339,6 +343,25 @@ stds.factorio_control = {
|
||||
}
|
||||
},
|
||||
|
||||
helpers = {
|
||||
other_fields = false,
|
||||
read_only = true,
|
||||
fields = {
|
||||
"check_prototype_translations",
|
||||
"decode_string",
|
||||
"direction_to_string",
|
||||
"encode_string",
|
||||
"evaluate_expression",
|
||||
"is_valid_sound_path",
|
||||
"is_valid_sprite_path",
|
||||
"json_to_table",
|
||||
"parse_map_exchange_string",
|
||||
"remove_path",
|
||||
"table_to_json",
|
||||
"write_file",
|
||||
}
|
||||
},
|
||||
|
||||
-- @game@: Main object through which most of the API is accessed.
|
||||
-- It is, however, not available inside handlers registered with @script.on_load@.
|
||||
-- (http://lua-api.factorio.com/latest/LuaGameScript.html)
|
||||
@ -348,102 +371,156 @@ stds.factorio_control = {
|
||||
fields = {
|
||||
"auto_save",
|
||||
"ban_player",
|
||||
"check_consistency",
|
||||
"check_prototype_translations",
|
||||
"count_pipe_groups",
|
||||
"check_consistency",
|
||||
"create_force",
|
||||
"create_profiler",
|
||||
"create_random_generator",
|
||||
"create_surface",
|
||||
"delete_surface",
|
||||
"desync_players",
|
||||
"direction_to_string",
|
||||
"disable_replay",
|
||||
"disable_tips_and_tricks",
|
||||
"draw_resource_selection",
|
||||
"enable_tip_triggers_in_custom_scenarios",
|
||||
"force_crc",
|
||||
"get_active_entities_count",
|
||||
"get_entity_by_tag",
|
||||
"get_entity_by_unit_number",
|
||||
"get_filtered_entity_prototypes",
|
||||
"get_map_exchange_string",
|
||||
"get_player",
|
||||
"get_surface",
|
||||
"get_vehicles",
|
||||
"help",
|
||||
"is_demo",
|
||||
"is_multiplayer",
|
||||
"is_valid_sound_path",
|
||||
"json_to_table",
|
||||
"kick_player",
|
||||
"merge_forces",
|
||||
"mute_player",
|
||||
"planet",
|
||||
"planets",
|
||||
"play_sound",
|
||||
"print",
|
||||
"print_stack_size",
|
||||
"print",
|
||||
"purge_player",
|
||||
"regenerate_entity",
|
||||
"reload_mods",
|
||||
"reload_script",
|
||||
"remove_offline_players",
|
||||
"remove_path",
|
||||
"reset_game_state",
|
||||
"reset_time_played",
|
||||
"save_atlas",
|
||||
"server_save",
|
||||
"set_game_state",
|
||||
"set_lose_ending_info",
|
||||
"set_win_ending_info",
|
||||
"show_message_dialog",
|
||||
"table_to_json",
|
||||
"take_screenshot",
|
||||
"take_technology_screenshot",
|
||||
"technology_notifications_enabled",
|
||||
"train_manager",
|
||||
"unban_player",
|
||||
"unmute_player",
|
||||
"write_file",
|
||||
|
||||
active_mods = {read_only = true, other_fields = true},
|
||||
ammo_category_prototypes = {read_only = true, other_fields = true},
|
||||
autoplace_control_prototypes = {read_only = true, other_fields = true},
|
||||
|
||||
backer_names = {read_only = true, other_fields = true},
|
||||
blueprints = {read_only = true, other_fields = true},
|
||||
connected_players = {read_only = true, other_fields = true},
|
||||
custom_input_prototypes = {read_only = true, other_fields = true},
|
||||
damage_prototypes = {read_only = true, other_fields = true},
|
||||
decorative_prototypes = {read_only = true, other_fields = true},
|
||||
default_map_gen_settings = {read_only = true, other_fields = true},
|
||||
difficulty = {read_only = true, other_fields = true},
|
||||
difficulty_settings = {read_only = true, other_fields = true},
|
||||
enemy_has_vision_on_land_mines = {read_only = false, other_fields = false},
|
||||
entity_prototypes = {read_only = true, other_fields = true},
|
||||
equipment_grid_prototypes = {read_only = true, other_fields = true},
|
||||
equipment_prototypes = {read_only = true, other_fields = true},
|
||||
finished = {read_only = true, other_fields = true},
|
||||
fluid_prototypes = {read_only = true, other_fields = true},
|
||||
finished_but_continuing = {read_only = true, other_fields = false},
|
||||
forces = {read_only = true, other_fields = true},
|
||||
item_prototypes = {read_only = true, other_fields = true},
|
||||
map_settings = {read_only = true, other_fields = true},
|
||||
mod_setting_prototypes = {read_only = true, other_fields = true},
|
||||
noise_layer_prototypes = {read_only = true, other_fields = true},
|
||||
permissions = {read_only = true, other_fields = true},
|
||||
player = {read_only = true, other_fields = true},
|
||||
players = {read_only = true, other_fields = true},
|
||||
recipe_prototypes = {read_only = true, other_fields = true},
|
||||
speed = {read_only = false, other_fields = false},
|
||||
styles = {read_only = true, other_fields = true},
|
||||
surfaces = {read_only = true, other_fields = true},
|
||||
technology_prototypes = {read_only = true, other_fields = true},
|
||||
tick = {read_only = true, other_fields = true},
|
||||
tick_paused = {read_only = false, other_fields = false},
|
||||
ticks_played = {read_only = true, other_fields = true},
|
||||
ticks_to_run = {read_only = false, other_fields = false},
|
||||
tile_prototypes = {read_only = true, other_fields = true},
|
||||
virtual_signal_prototypes = {read_only = true, other_fields = true},
|
||||
finished_but_continuing = {read_only = true, other_fields = false}
|
||||
},
|
||||
},
|
||||
|
||||
prototypes = {
|
||||
other_fields = false,
|
||||
read_only = true,
|
||||
fields = {
|
||||
"get_achievement_filtered",
|
||||
"get_decorative_filtered",
|
||||
"get_entity_filtered",
|
||||
"get_equipment_filtered",
|
||||
"get_fluid_filtered",
|
||||
"get_history",
|
||||
"get_item_filtered",
|
||||
"get_mod_setting_filtered",
|
||||
"get_recipe_filtered",
|
||||
"get_technology_filtered",
|
||||
"get_tile_filtered",
|
||||
achievement = {read_only = true, other_fields = true},
|
||||
active_trigger = {read_only = true, other_fields = true},
|
||||
airborne_pollutant = {read_only = true, other_fields = true},
|
||||
ammo_category = {read_only = true, other_fields = true},
|
||||
asteroid_chunk = {read_only = true, other_fields = true},
|
||||
autoplace_control = {read_only = true, other_fields = true},
|
||||
burner_usage = {read_only = true, other_fields = true},
|
||||
collision_layer = {read_only = true, other_fields = true},
|
||||
custom_event = {read_only = true, other_fields = true},
|
||||
custom_input = {read_only = true, other_fields = true},
|
||||
damage = {read_only = true, other_fields = true},
|
||||
decorative = {read_only = true, other_fields = true},
|
||||
entity = {read_only = true, other_fields = true},
|
||||
equipment = {read_only = true, other_fields = true},
|
||||
equipment_category = {read_only = true, other_fields = true},
|
||||
equipment_grid = {read_only = true, other_fields = true},
|
||||
fluid = {read_only = true, other_fields = true},
|
||||
font = {read_only = true, other_fields = true},
|
||||
fuel_category = {read_only = true, other_fields = true},
|
||||
item = {read_only = true, other_fields = true},
|
||||
item_group = {read_only = true, other_fields = true},
|
||||
item_subgroup = {read_only = true, other_fields = true},
|
||||
map_gen_preset = {read_only = true, other_fields = true},
|
||||
mod_setting = {read_only = true, other_fields = true},
|
||||
module_category = {read_only = true, other_fields = true},
|
||||
named_noise_expression = {read_only = true, other_fields = true},
|
||||
named_noise_function = {read_only = true, other_fields = true},
|
||||
particle = {read_only = true, other_fields = true},
|
||||
procession = {read_only = true, other_fields = true},
|
||||
procession_layer_inheritance_group = {read_only = true, other_fields = true},
|
||||
quality = {read_only = true, other_fields = true},
|
||||
recipe_category = {read_only = true, other_fields = true},
|
||||
resource_category = {read_only = true, other_fields = true},
|
||||
shortcut = {read_only = true, other_fields = true},
|
||||
space_connection = {read_only = true, other_fields = true},
|
||||
space_location = {read_only = true, other_fields = true},
|
||||
style = {read_only = true, other_fields = true},
|
||||
surface = {read_only = true, other_fields = true},
|
||||
surface_property = {read_only = true, other_fields = true},
|
||||
technology = {read_only = true, other_fields = true},
|
||||
tile = {read_only = true, other_fields = true},
|
||||
trivial_smoke = {read_only = true, other_fields = true},
|
||||
virtual_signal = {read_only = true, other_fields = true},
|
||||
"max_beacon_supply_area_distance",
|
||||
"max_electric_pole_connection_distance",
|
||||
"max_electric_pole_supply_area_distance",
|
||||
"max_force_distraction_chunk_distance",
|
||||
"max_force_distraction_distance",
|
||||
"max_gate_activation_distance",
|
||||
"max_inserter_reach_distance",
|
||||
"max_pipe_to_ground_distance",
|
||||
"max_underground_belt_distance",
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
globals = {
|
||||
-- @global@: The global dictionary, useful for storing data persistent across a save-load cycle.
|
||||
-- Writing access is given to the mod-id field (for mod-wise saved data).
|
||||
-- (http://lua-api.factorio.com/latest/Global.html)
|
||||
"global",
|
||||
"storage",
|
||||
|
||||
-- @MOD@: Keep it organized, use this variable for anything that "NEEDS" to be global for some reason.
|
||||
"MOD"
|
||||
@ -896,7 +973,8 @@ stds.factorio_defines = {
|
||||
'editor',
|
||||
'ghost',
|
||||
'god',
|
||||
'spectator'
|
||||
'spectator',
|
||||
'remote',
|
||||
}
|
||||
},
|
||||
deconstruction_item = {
|
||||
@ -963,14 +1041,22 @@ stds.factorio_defines = {
|
||||
},
|
||||
direction = {
|
||||
fields = {
|
||||
'east',
|
||||
'north',
|
||||
'northeast',
|
||||
'northwest',
|
||||
'south',
|
||||
'southeast',
|
||||
'southwest',
|
||||
'west'
|
||||
'north',
|
||||
'northnortheast',
|
||||
'northeast',
|
||||
'eastnortheast',
|
||||
'east',
|
||||
'eastsoutheast',
|
||||
'southeast',
|
||||
'southsoutheast',
|
||||
'south',
|
||||
'southsouthwest',
|
||||
'southwest',
|
||||
'westsouthwest',
|
||||
'west',
|
||||
'westnorthwest',
|
||||
'northwest',
|
||||
'northnorthwest',
|
||||
}
|
||||
},
|
||||
distraction = {
|
||||
@ -1017,6 +1103,7 @@ stds.factorio_defines = {
|
||||
},
|
||||
events = {
|
||||
fields = {
|
||||
'on_achievement_gained',
|
||||
'on_ai_command_completed',
|
||||
'on_area_cloned',
|
||||
'on_biter_base_built',
|
||||
@ -1038,7 +1125,6 @@ stds.factorio_defines = {
|
||||
'on_entity_cloned',
|
||||
'on_entity_damaged',
|
||||
'on_entity_died',
|
||||
'on_entity_destroyed',
|
||||
'on_entity_renamed',
|
||||
'on_entity_settings_pasted',
|
||||
'on_entity_spawned',
|
||||
@ -1061,6 +1147,7 @@ stds.factorio_defines = {
|
||||
'on_marked_for_upgrade',
|
||||
'on_market_item_purchased',
|
||||
'on_mod_item_opened',
|
||||
'on_object_destroyed',
|
||||
'on_picked_up_item',
|
||||
'on_player_alt_selected_area',
|
||||
'on_player_ammo_inventory_changed',
|
||||
@ -1074,6 +1161,7 @@ stds.factorio_defines = {
|
||||
'on_player_cheat_mode_disabled',
|
||||
'on_player_cheat_mode_enabled',
|
||||
'on_player_configured_blueprint',
|
||||
'on_player_controller_changed',
|
||||
'on_player_crafted_item',
|
||||
'on_player_created',
|
||||
'on_player_cursor_stack_changed',
|
||||
@ -1089,6 +1177,7 @@ stds.factorio_defines = {
|
||||
'on_player_joined_game',
|
||||
'on_player_kicked',
|
||||
'on_player_left_game',
|
||||
'on_player_locale_changed',
|
||||
'on_player_main_inventory_changed',
|
||||
'on_player_mined_entity',
|
||||
'on_player_mined_item',
|
||||
@ -1097,8 +1186,8 @@ stds.factorio_defines = {
|
||||
'on_player_pipette',
|
||||
'on_player_placed_equipment',
|
||||
'on_player_promoted',
|
||||
'on_player_removed',
|
||||
'on_player_removed_equipment',
|
||||
'on_player_removed',
|
||||
'on_player_repaired_entity',
|
||||
'on_player_respawned',
|
||||
'on_player_rotated_entity',
|
||||
@ -1111,6 +1200,7 @@ stds.factorio_defines = {
|
||||
'on_player_unbanned',
|
||||
'on_player_unmuted',
|
||||
'on_player_used_capsule',
|
||||
'on_player_used_spidertron_remote',
|
||||
'on_post_entity_died',
|
||||
'on_pre_chunk_deleted',
|
||||
'on_pre_entity_settings_pasted',
|
||||
@ -1121,6 +1211,7 @@ stds.factorio_defines = {
|
||||
'on_pre_player_mined_item',
|
||||
'on_pre_player_removed',
|
||||
'on_pre_robot_exploded_cliff',
|
||||
'on_pre_scenario_finished',
|
||||
'on_pre_surface_cleared',
|
||||
'on_pre_surface_deleted',
|
||||
'on_put_item',
|
||||
@ -1130,9 +1221,9 @@ stds.factorio_defines = {
|
||||
'on_robot_built_entity',
|
||||
'on_robot_built_tile',
|
||||
'on_robot_exploded_cliff',
|
||||
'on_robot_mined',
|
||||
'on_robot_mined_entity',
|
||||
'on_robot_mined_tile',
|
||||
'on_robot_mined',
|
||||
'on_robot_pre_mined',
|
||||
'on_rocket_launch_ordered',
|
||||
'on_rocket_launched',
|
||||
@ -1141,6 +1232,12 @@ stds.factorio_defines = {
|
||||
'on_script_trigger_effect',
|
||||
'on_sector_scanned',
|
||||
'on_selected_entity_changed',
|
||||
'on_space_platform_built_entity',
|
||||
'on_space_platform_built_tile',
|
||||
'on_space_platform_mined_entity',
|
||||
'on_space_platform_mined_item',
|
||||
'on_space_platform_mined_tile',
|
||||
'on_space_platform_pre_mined',
|
||||
'on_surface_cleared',
|
||||
'on_surface_created',
|
||||
'on_surface_deleted',
|
||||
@ -1153,12 +1250,13 @@ stds.factorio_defines = {
|
||||
'on_train_schedule_changed',
|
||||
'on_trigger_created_entity',
|
||||
'on_trigger_fired_artillery',
|
||||
'on_undo_applied',
|
||||
'on_unit_added_to_group',
|
||||
'on_unit_group_created',
|
||||
'on_unit_removed_from_group',
|
||||
'script_raised_built',
|
||||
'script_raised_destroy',
|
||||
'script_raised_revive'
|
||||
'script_raised_revive',
|
||||
}
|
||||
},
|
||||
flow_precision_index = {
|
||||
@ -1605,11 +1703,17 @@ stds.factorio_defines = {
|
||||
'secondary_right_split_line'
|
||||
}
|
||||
},
|
||||
wire_connection_id = {
|
||||
wire_connector_id = {
|
||||
fields = {
|
||||
'electric_pole',
|
||||
'power_switch_left',
|
||||
'power_switch_right'
|
||||
'circuit_red',
|
||||
'circuit_green',
|
||||
'combinator_input_red',
|
||||
'combinator_input_green',
|
||||
'combinator_output_red',
|
||||
'combinator_output_green',
|
||||
'pole_copper',
|
||||
'power_switch_left_copper',
|
||||
'power_switch_right_copper',
|
||||
}
|
||||
},
|
||||
wire_type = {
|
||||
|
@ -9,7 +9,7 @@ cp -rf Refactorio/RedMew working_copy
|
||||
echo "Removing git files"
|
||||
rm -rf working_copy/.??*
|
||||
echo "Writing the version file"
|
||||
echo "global.redmew_version='$DATE_FORMATTED-$COMMIT_SHA'" > working_copy/resources/version.lua
|
||||
echo "storage.redmew_version='$DATE_FORMATTED-$COMMIT_SHA'" > working_copy/resources/version.lua
|
||||
echo "Contents of the version file:"
|
||||
cat working_copy/resources/version.lua
|
||||
echo "Copying map_selection.lua.sample to map_selection.lua"
|
||||
|
22
config.lua
22
config.lua
@ -3,7 +3,7 @@ _CHEATS = false
|
||||
_DUMP_ENV = false
|
||||
local currency = 'coin'
|
||||
|
||||
global.config = {
|
||||
storage.config = {
|
||||
-- adds a GUI listing the scenario features, the rules, and the details of the current map
|
||||
map_info = {
|
||||
enabled = true,
|
||||
@ -49,7 +49,7 @@ global.config = {
|
||||
player_colors = {
|
||||
enabled = true
|
||||
},
|
||||
-- saves players' lives if they have a player-port in their inventory, also adds the player-port to the market and must therefor be loaded first
|
||||
-- saves players' lives if they have a 'simple-entity-with-owner' in their inventory, also adds the 'simple-entity-with-owner' to the market and must therefor be loaded first
|
||||
train_saviour = {
|
||||
enabled = true
|
||||
},
|
||||
@ -58,9 +58,9 @@ global.config = {
|
||||
enabled = false,
|
||||
cost = 100
|
||||
},
|
||||
-- Allows removing landfill using the deconstruction planner.
|
||||
-- Allows removing landfill using the deconstruction planner. Built-in for 2.0
|
||||
landfill_remover = {
|
||||
enabled = true,
|
||||
enabled = false,
|
||||
-- The tile that is used to replace landfill when it is removed.
|
||||
revert_tile = 'water-mud'
|
||||
},
|
||||
@ -97,6 +97,7 @@ global.config = {
|
||||
-- the global score trackers to show
|
||||
global_to_show = {
|
||||
'satellites-launched',
|
||||
'rockets-launched',
|
||||
'aliens-killed',
|
||||
'built-by-players',
|
||||
'built-by-robots',
|
||||
@ -211,7 +212,7 @@ global.config = {
|
||||
{name = 'substation', count = 50},
|
||||
{name = 'roboport', count = 10},
|
||||
{name = 'infinity-chest', count = 10},
|
||||
{name = 'player-port', count = 2},
|
||||
{name = 'simple-entity-with-owner', count = 2},
|
||||
{name = 'coin', count = 20000},
|
||||
{name = 'infinity-pipe', count = 10},
|
||||
{name = 'heat-interface', count = 10},
|
||||
@ -337,16 +338,12 @@ global.config = {
|
||||
backer_name = true,
|
||||
-- gives locos placed a random color
|
||||
random_train_color = true,
|
||||
-- gives players entity ghosts (from destruction like biter attacks) before the required research is complete
|
||||
ghosts_before_research = true,
|
||||
-- adds craftable loaders.
|
||||
loaders = true,
|
||||
-- turns on entity info aka alt-mode on first joining
|
||||
set_alt_on_create = true,
|
||||
-- prevents personal construction robots from being mined by other players
|
||||
save_bots = true,
|
||||
-- enable research_queue
|
||||
research_queue = true,
|
||||
-- pick up item an inserter put on the ground, when the inserter is mined
|
||||
inserter_drops_pickup = true
|
||||
},
|
||||
@ -435,12 +432,13 @@ global.config = {
|
||||
},
|
||||
research_printer = {
|
||||
enabled = true,
|
||||
print_to_force = true, -- print a message to force chat when that force finishes a new research.
|
||||
print_to_force = false, -- print a message to force chat when that force finishes a new research.
|
||||
print_to_discord = true, -- print a message to the discord channel when the player force finishes a new research.
|
||||
ignore_script = false -- ignore researches unlocked by commands or by code.
|
||||
},
|
||||
-- Control groups of spiders with a decon planner. Built-in for 2.0
|
||||
spidertron_group_control = {
|
||||
enabled = true
|
||||
enabled = false
|
||||
},
|
||||
donator = {
|
||||
donator_perks = {
|
||||
@ -476,4 +474,4 @@ global.config = {
|
||||
}
|
||||
}
|
||||
|
||||
return global.config
|
||||
return storage.config
|
||||
|
@ -77,9 +77,9 @@ local function add_regular(args, player)
|
||||
|
||||
local success = Rank.increase_player_rank_to(target_name, Ranks.regular)
|
||||
if success then
|
||||
game.print({'admin_commands.regular_add_success', actor, target_name}, Color.info)
|
||||
game.print({'admin_commands.regular_add_success', actor, target_name}, {color = Color.info})
|
||||
if maybe_target_player then
|
||||
maybe_target_player.print({'admin_commands.regular_add_notify_target'}, Color.warning)
|
||||
maybe_target_player.print({'admin_commands.regular_add_notify_target'}, {color = Color.warning})
|
||||
end
|
||||
else
|
||||
Game.player_print({'admin_commands.regular_add_fail', target_name, Rank.get_player_rank_name(target_name)}, Color.fail, player)
|
||||
@ -98,9 +98,9 @@ local function remove_regular(args, player)
|
||||
|
||||
if Rank.equal(target_name, Ranks.regular) then
|
||||
local _, new_rank = Rank.reset_player_rank(target_name)
|
||||
game.print({'admin_commands.regular_remove_success', actor, target_name, new_rank}, Color.info)
|
||||
game.print({'admin_commands.regular_remove_success', actor, target_name, new_rank}, {color = Color.info})
|
||||
if maybe_target_player then
|
||||
maybe_target_player.print({'admin_commands.regular_remove_notify_target'}, Color.warning)
|
||||
maybe_target_player.print({'admin_commands.regular_remove_notify_target'}, {color = Color.warning})
|
||||
end
|
||||
else
|
||||
local rank_name = Rank.get_player_rank_name(target_name)
|
||||
@ -121,16 +121,16 @@ local function probation_add(args, player)
|
||||
if Rank.equal(target_name, Ranks.admin) then
|
||||
Game.player_print({'admin_commands.probation_add_fail_admin'}, Color.fail, player)
|
||||
if maybe_target_player then
|
||||
maybe_target_player.print({'admin_commands.probation_warn_admin', actor}, Color.warning)
|
||||
maybe_target_player.print({'admin_commands.probation_warn_admin', actor}, {color = Color.warning})
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local success = Rank.decrease_player_rank_to(target_name, Ranks.probation)
|
||||
if success then
|
||||
game.print({'admin_commands.probation_add_success', actor, target_name}, Color.info)
|
||||
game.print({'admin_commands.probation_add_success', actor, target_name}, {color = Color.info})
|
||||
if maybe_target_player then
|
||||
maybe_target_player.print({'admin_commands.probation_add_notify_target'}, Color.warning)
|
||||
maybe_target_player.print({'admin_commands.probation_add_notify_target'}, {color = Color.warning})
|
||||
end
|
||||
else
|
||||
Game.player_print({'admin_commands.probation_add_fail', target_name}, Color.fail, player)
|
||||
@ -149,9 +149,9 @@ local function probation_remove(args, player)
|
||||
|
||||
if Rank.equal(target_name, Ranks.probation) then
|
||||
Rank.reset_player_rank(target_name)
|
||||
game.print({'admin_commands.probation_remove_success', actor, target_name}, Color.info)
|
||||
game.print({'admin_commands.probation_remove_success', actor, target_name}, {color = Color.info})
|
||||
if maybe_target_player then
|
||||
maybe_target_player.print({'admin_commands.probation_remove_notify_target'}, Color.warning)
|
||||
maybe_target_player.print({'admin_commands.probation_remove_notify_target'}, {color = Color.warning})
|
||||
end
|
||||
else
|
||||
Game.player_print({'admin_commands.probation_remove_fail', target_name}, Color.fail, player)
|
||||
@ -191,14 +191,14 @@ end
|
||||
--- Creates a rectangle of water below an admin
|
||||
local function pool(_, player)
|
||||
local t = {}
|
||||
local p = player.position
|
||||
local p = player.physical_position
|
||||
for x = p.x - 3, p.x + 3 do
|
||||
for y = p.y + 2, p.y + 7 do
|
||||
table.insert(t, {name = 'water', position = {x, y}})
|
||||
end
|
||||
end
|
||||
player.surface.set_tiles(t)
|
||||
player.surface.create_entity {name = 'fish', position = {p.x + 0.5, p.y + 5}}
|
||||
player.physical_surface.set_tiles(t)
|
||||
player.physical_surface.create_entity {name = 'fish', position = {p.x + 0.5, p.y + 5}}
|
||||
Game.player_print({'admin_commands.create_pool'}, Color.success, player)
|
||||
end
|
||||
|
||||
@ -212,12 +212,12 @@ local function invoke(args, player)
|
||||
return
|
||||
end
|
||||
|
||||
local pos = player.surface.find_non_colliding_position('character', player.position, 50, 1)
|
||||
local pos = player.physical_surface.find_non_colliding_position('character', player.physical_position, 50, 1)
|
||||
if not pos then
|
||||
Game.player_print({'admin_commands.invoke_fail_no_location'}, player)
|
||||
return
|
||||
end
|
||||
target.teleport({pos.x, pos.y}, player.surface)
|
||||
target.teleport({pos.x, pos.y}, player.physical_surface)
|
||||
game.print({'admin_commands.invoke_announce', target.name})
|
||||
end
|
||||
|
||||
@ -233,7 +233,12 @@ local function teleport_player(args, player)
|
||||
|
||||
local target_name = target.name
|
||||
local surface = target.surface
|
||||
local pos = surface.find_non_colliding_position('character', target.position, 50, 1)
|
||||
local position = target.position
|
||||
if target.is_player() then
|
||||
position = target.physical_position
|
||||
surface = target.physical_surface
|
||||
end
|
||||
local pos = surface.find_non_colliding_position('character', position, 50, 1)
|
||||
if not pos then
|
||||
Game.player_print({'admin_commands.tp_fail_no_location'}, Color.fail, player)
|
||||
return
|
||||
@ -249,12 +254,13 @@ local function teleport_location(_, player)
|
||||
Game.player_print({'admin_commands.tp_ent_fail_no_ent'}, Color.fail, player)
|
||||
return
|
||||
end
|
||||
local pos = player.surface.find_non_colliding_position('character', player.selected.position, 50, 1)
|
||||
local surface = player.selected.surface
|
||||
local pos = surface.find_non_colliding_position('character', player.selected.position, 50, 1)
|
||||
if not pos then
|
||||
Game.player_print({'admin_commands.tp_fail_no_location'}, Color.fail, player)
|
||||
return
|
||||
end
|
||||
player.teleport(pos)
|
||||
player.teleport(pos, surface)
|
||||
Game.player_print({'admin_commands.tp_end_success'}, Color.success, player)
|
||||
end
|
||||
|
||||
@ -263,13 +269,13 @@ local function built_entity(event)
|
||||
local index = event.player_index
|
||||
|
||||
if tp_players[index] then
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
|
||||
if not entity or not entity.valid or entity.type ~= 'entity-ghost' then
|
||||
return
|
||||
end
|
||||
|
||||
game.get_player(index).teleport(entity.position)
|
||||
game.get_player(index).teleport(entity.position, entity.surface)
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
@ -303,9 +309,9 @@ end
|
||||
--- Revives ghosts around the player
|
||||
local function revive_ghosts(args, player)
|
||||
local radius = args.radius
|
||||
local pos = player.position
|
||||
local pos = player.physical_position
|
||||
local count = 0
|
||||
for _, e in pairs(player.surface.find_entities_filtered {area = {{pos.x - radius, pos.y - radius}, {pos.x + radius, pos.y + radius}}, type = 'entity-ghost'}) do
|
||||
for _, e in pairs(player.physical_surface.find_entities_filtered {area = {{pos.x - radius, pos.y - radius}, {pos.x + radius, pos.y + radius}}, type = 'entity-ghost'}) do
|
||||
e.revive()
|
||||
count = count + 1
|
||||
end
|
||||
|
@ -2,12 +2,12 @@ local Event = require 'utils.event'
|
||||
local Utils = require 'utils.core'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
|
||||
global.original_last_users_by_ent_pos = {}
|
||||
storage.original_last_users_by_ent_pos = {}
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
global.ag_surface = game.create_surface('antigrief', {autoplace_controls = {coal = {frequency = 'normal', richness = 'normal', size = 'none'}, ['copper-ore'] = {frequency = 'normal', richness = 'normal', size = 'none'}, ['crude-oil'] = {frequency = 'normal', richness = 'normal', size = 'none'}, desert = {frequency = 'normal', richness = 'normal', size = 'none'}, dirt = {frequency = 'normal', richness = 'normal', size = 'none'}, ['enemy-base'] = {frequency = 'normal', richness = 'normal', size = 'none'}, grass = {frequency = 'normal', richness = 'normal', size = 'none'}, ['iron-ore'] = {frequency = 'normal', richness = 'normal', size = 'none'}, sand = {frequency = 'normal', richness = 'normal', size = 'none'}, stone = {frequency = 'normal', richness = 'normal', size = 'none'}, trees = {frequency = 'normal', richness = 'normal', size = 'none'}, ['uranium-ore'] = {frequency = 'normal', richness = 'normal', size = 'none'}}, cliff_settings = {cliff_elevation_0 = 1024, cliff_elevation_interval = 10, name = 'cliff'}, height = 2000000, peaceful_mode = false, seed = 3461559752, starting_area = 'very-low', starting_points = {{x = 0, y = 0}}, terrain_segmentation = 'normal', water = 'normal', width = 2000000})
|
||||
global.ag_surface.always_day = true
|
||||
storage.ag_surface = game.create_surface('antigrief', {autoplace_controls = {coal = {frequency = 'normal', richness = 'normal', size = 'none'}, ['copper-ore'] = {frequency = 'normal', richness = 'normal', size = 'none'}, ['crude-oil'] = {frequency = 'normal', richness = 'normal', size = 'none'}, desert = {frequency = 'normal', richness = 'normal', size = 'none'}, dirt = {frequency = 'normal', richness = 'normal', size = 'none'}, ['enemy-base'] = {frequency = 'normal', richness = 'normal', size = 'none'}, grass = {frequency = 'normal', richness = 'normal', size = 'none'}, ['iron-ore'] = {frequency = 'normal', richness = 'normal', size = 'none'}, sand = {frequency = 'normal', richness = 'normal', size = 'none'}, stone = {frequency = 'normal', richness = 'normal', size = 'none'}, trees = {frequency = 'normal', richness = 'normal', size = 'none'}, ['uranium-ore'] = {frequency = 'normal', richness = 'normal', size = 'none'}}, cliff_settings = {cliff_elevation_0 = 1024, cliff_elevation_interval = 10, name = 'cliff'}, height = 2000000, peaceful_mode = false, seed = 3461559752, starting_area = 'very-low', starting_points = {{x = 0, y = 0}}, terrain_segmentation = 'normal', water = 'normal', width = 2000000})
|
||||
storage.ag_surface.always_day = true
|
||||
end
|
||||
)
|
||||
|
||||
@ -63,10 +63,10 @@ local function on_entity_changed(event)
|
||||
return
|
||||
end --Freebees for admins
|
||||
if entity.last_user ~= player and entity.force == player.force then --commented out to be able to debug
|
||||
place_entity_on_surface(entity, global.ag_surface, true, event.player_index)
|
||||
place_entity_on_surface(entity, storage.ag_surface, true, event.player_index)
|
||||
end
|
||||
if entity.last_user then
|
||||
global.original_last_users_by_ent_pos[get_position_str(entity.position)] = entity.last_user.index
|
||||
storage.original_last_users_by_ent_pos[get_position_str(entity.position)] = entity.last_user.index
|
||||
end
|
||||
end
|
||||
|
||||
@ -98,7 +98,7 @@ Event.add(
|
||||
return
|
||||
end
|
||||
|
||||
local ag_entities = global.ag_surface.find_entities_filtered {position = entity.position}
|
||||
local ag_entities = storage.ag_surface.find_entities_filtered {position = entity.position}
|
||||
--If a player has rotated twice we want to preserve the original state.
|
||||
if #ag_entities == 0 or not ag_entities[1].last_user or ag_entities[1].last_user ~= entity.last_user then
|
||||
--Mock entity us used because the api doesnt support pre_player_rotated entity.
|
||||
@ -124,12 +124,12 @@ Event.add(
|
||||
function(event)
|
||||
--is a player on the same force as the destroyed object
|
||||
if event.entity and event.entity.valid and event.entity.force.name == 'player' and event.cause and event.cause.force == event.entity.force and event.cause.type == 'character' then
|
||||
local new_entity = place_entity_on_surface(event.entity, global.ag_surface, true, event.cause.player)
|
||||
local new_entity = place_entity_on_surface(event.entity, storage.ag_surface, true, event.cause.player)
|
||||
if new_entity and event.entity.type == 'container' then
|
||||
local items = event.entity.get_inventory(defines.inventory.chest).get_contents()
|
||||
if items then
|
||||
for item, n in pairs(items) do
|
||||
new_entity.insert {name = item, count = n}
|
||||
for _, item_stack in pairs(items) do
|
||||
new_entity.insert(item_stack)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -143,7 +143,7 @@ Event.add(
|
||||
defines.events.on_marked_for_deconstruction,
|
||||
function(event)
|
||||
if event.entity.last_user then
|
||||
global.original_last_users_by_ent_pos[get_position_str(event.entity.position)] = event.entity.last_user.index
|
||||
storage.original_last_users_by_ent_pos[get_position_str(event.entity.position)] = event.entity.last_user.index
|
||||
end
|
||||
end
|
||||
)
|
||||
@ -160,7 +160,7 @@ Module.undo =
|
||||
|
||||
--Remove all items from all surfaces that player placed an entity on
|
||||
for _, surface in pairs(game.surfaces) do
|
||||
if surface ~= global.ag_surface then
|
||||
if surface ~= storage.ag_surface then
|
||||
for _, e in ipairs(surface.find_entities_filtered {force = player.force.name}) do
|
||||
if e.last_user == player then
|
||||
e.destroy()
|
||||
@ -169,26 +169,26 @@ Module.undo =
|
||||
end
|
||||
end
|
||||
|
||||
for _, e in ipairs(global.ag_surface.find_entities_filtered {}) do
|
||||
for _, e in ipairs(storage.ag_surface.find_entities_filtered {}) do
|
||||
if e.last_user == player then
|
||||
--Place removed entity IF no collision is detected
|
||||
local last_user = global.original_last_users_by_ent_pos[get_position_str(e.position)]
|
||||
local last_user = storage.original_last_users_by_ent_pos[get_position_str(e.position)]
|
||||
local new_entity = place_entity_on_surface(e, RS.get_surface(), false, last_user)
|
||||
--Transfer items
|
||||
if new_entity then
|
||||
local event_player = Utils.ternary(new_entity.last_user, new_entity.last_user, game.player)
|
||||
local event = {created_entity = new_entity, player_index = event_player.index, stack = {}}
|
||||
local event = {entity = new_entity, player_index = event_player.index, consumed_items = {}}
|
||||
script.raise_event(defines.events.on_built_entity, event)
|
||||
|
||||
if e.type == 'container' then
|
||||
local items = e.get_inventory(defines.inventory.chest).get_contents()
|
||||
if items then
|
||||
for item, n in pairs(items) do
|
||||
new_entity.insert {name = item, count = n}
|
||||
for _, item_stack in pairs(items) do
|
||||
new_entity.insert(item_stack)
|
||||
end
|
||||
end
|
||||
end
|
||||
e.destroy() --destory entity only if a new entity was created
|
||||
e.destroy() --destroy entity only if a new entity was created
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -196,16 +196,16 @@ end
|
||||
|
||||
Module.antigrief_surface_tp = function()
|
||||
if game.player then
|
||||
if game.player.surface == global.ag_surface then
|
||||
if game.player.surface == storage.ag_surface then
|
||||
game.player.teleport(game.player.position, RS.get_surface())
|
||||
else
|
||||
game.player.teleport(game.player.position, global.ag_surface)
|
||||
game.player.teleport(game.player.position, storage.ag_surface)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Module.count_removed_entities = function(player)
|
||||
return #Utils.find_entities_by_last_user(player, global.ag_surface)
|
||||
return #Utils.find_entities_by_last_user(player, storage.ag_surface)
|
||||
end
|
||||
|
||||
return Module
|
||||
|
@ -91,7 +91,7 @@ local biter_spawn_token =
|
||||
surface = RS.get_surface()
|
||||
player_force = game.forces.player
|
||||
|
||||
enemy_force.evolution_factor = 1
|
||||
enemy_force.set_evolution_factor(1, surface)
|
||||
|
||||
local p_spawn = player_force.get_spawn_position(surface)
|
||||
local group = surface.create_unit_group {position = p_spawn}
|
||||
@ -134,7 +134,7 @@ function Public.begin_apocalypse(_, player)
|
||||
end
|
||||
|
||||
primitives.apocalypse_now = true
|
||||
game.print({'apocalypse.apocalypse_begins'}, Color.pink)
|
||||
game.print({'apocalypse.apocalypse_begins'}, {color = Color.pink})
|
||||
Task.set_timeout(1, biter_spawn_token, {})
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,14 @@
|
||||
-- This adds a button that stashes/sorts your inventory into nearby chests in some kind of intelligent way
|
||||
-- made by mewmew
|
||||
-- modified by gerkiz & RedRafe
|
||||
-- source: https://github.com/ComfyFactory/ComfyFactorio/blob/develop/modules/autostash.lua
|
||||
-- ======================================================= --
|
||||
|
||||
local Color = require 'resources.color_presets'
|
||||
local Global = require 'utils.global'
|
||||
local Event = require 'utils.event'
|
||||
local Game = require 'utils.game'
|
||||
local Global = require 'utils.global'
|
||||
local LP = require 'utils.logistic_point'
|
||||
|
||||
local floor = math.floor
|
||||
|
||||
@ -22,6 +30,16 @@ Global.register(this, function(tbl) this = tbl end)
|
||||
|
||||
local bps_blacklist = { ['blueprint-book'] = true, ['blueprint'] = true }
|
||||
|
||||
local function container_has_requests(chest)
|
||||
local requests = 0
|
||||
if chest.type == 'logistic-container' then
|
||||
local lp = chest.get_logistic_point(defines.logistic_member_index.logistic_container)
|
||||
local filters = LP.get_filters(lp)
|
||||
requests = #filters
|
||||
end
|
||||
return requests > 0
|
||||
end
|
||||
|
||||
local function create_floaty_text(surface, position, name, count)
|
||||
if this.floating_text_y_offsets[position.x .. '_' .. position.y] then
|
||||
this.floating_text_y_offsets[position.x .. '_' .. position.y] =
|
||||
@ -29,10 +47,10 @@ local function create_floaty_text(surface, position, name, count)
|
||||
else
|
||||
this.floating_text_y_offsets[position.x .. '_' .. position.y] = 0
|
||||
end
|
||||
surface.create_entity({
|
||||
name = 'flying-text',
|
||||
Game.create_local_flying_text({
|
||||
surface = surface,
|
||||
position = { position.x, position.y + this.floating_text_y_offsets[position.x .. '_' .. position.y] },
|
||||
text = { '', '-', count, ' ', game.item_prototypes[name].localised_name },
|
||||
text = { '', '-', count, ' ', prototypes.item[name].localised_name },
|
||||
color = { r = 255, g = 255, b = 255 },
|
||||
})
|
||||
end
|
||||
@ -134,7 +152,7 @@ local function get_nearby_chests(player, a, furnace, wagon)
|
||||
local r_square = r * r
|
||||
local chests, inventories = {}, {}
|
||||
local size_of_chests = 0
|
||||
local area = { { player.position.x - r, player.position.y - r }, { player.position.x + r, player.position.y + r } }
|
||||
local area = { { player.physical_position.x - r, player.physical_position.y - r }, { player.physical_position.x + r, player.physical_position.y + r } }
|
||||
|
||||
area = a or area
|
||||
|
||||
@ -157,14 +175,14 @@ local function get_nearby_chests(player, a, furnace, wagon)
|
||||
forces = { player.force, 'neutral' }
|
||||
end
|
||||
|
||||
for _, e in pairs(player.surface.find_entities_filtered({ type = container_type, area = area, force = forces })) do
|
||||
if ((player.position.x - e.position.x) ^ 2 + (player.position.y - e.position.y) ^ 2) <= r_square then
|
||||
for _, e in pairs(player.physical_surface.find_entities_filtered({ type = container_type, area = area, force = forces })) do
|
||||
if ((player.physical_position.x - e.position.x) ^ 2 + (player.physical_position.y - e.position.y) ^ 2) <= r_square then
|
||||
i = i + 1
|
||||
containers[i] = e
|
||||
end
|
||||
end
|
||||
|
||||
containers = sort_entities_by_distance(player.position, containers)
|
||||
containers = sort_entities_by_distance(player.physical_position, containers)
|
||||
for _, entity in pairs(containers) do
|
||||
size_of_chests = size_of_chests + 1
|
||||
chests[size_of_chests] = entity
|
||||
@ -321,18 +339,15 @@ local function insert_into_wagon_filtered(stack, chests, name, floaty_text_list)
|
||||
for chestnr, chest in pairs(chests.chest) do
|
||||
if chest.type == 'logistic-container' then
|
||||
local chest_inventory = chests.inventory[chestnr]
|
||||
for index = 1, chest.request_slot_count do
|
||||
if chest_inventory.can_insert(stack) then
|
||||
if chest.get_request_slot(index) ~= nil then
|
||||
local n = chest.get_request_slot(index)
|
||||
if n and n.name == name then
|
||||
local inserted_count = chest_inventory.insert(stack)
|
||||
stack.count = stack.count - inserted_count
|
||||
prepare_floaty_text(floaty_text_list, chest.surface, chest.position, name, inserted_count)
|
||||
if stack.count <= 0 then
|
||||
return chestnr
|
||||
end
|
||||
end
|
||||
local lp = chest.get_logistic_point(defines.logistic_member_index.logistic_container)
|
||||
local filters = LP.get_filters(lp)
|
||||
for _, filter in pairs(filters) do
|
||||
if filter.value.name == name then
|
||||
local inserted_count = chest_inventory.insert(stack)
|
||||
stack.count = stack.count - inserted_count
|
||||
prepare_floaty_text(floaty_text_list, chest.surface, chest.position, name, inserted_count)
|
||||
if stack.count <= 0 then
|
||||
return chestnr
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -360,18 +375,15 @@ local function insert_item_into_chest(stack, chests, filtered_chests, name, floa
|
||||
for chestnr, chest in pairs(chests.chest) do
|
||||
if chest.type == 'logistic-container' then
|
||||
local chest_inventory = chests.inventory[chestnr]
|
||||
for index = 1, chest.request_slot_count do
|
||||
if chest_inventory.can_insert(stack) then
|
||||
if chest.get_request_slot(index) ~= nil then
|
||||
local n = chest.get_request_slot(index)
|
||||
if n and n.name == name then
|
||||
local inserted_count = chest_inventory.insert(stack)
|
||||
stack.count = stack.count - inserted_count
|
||||
prepare_floaty_text(floaty_text_list, chest.surface, chest.position, name, inserted_count)
|
||||
if stack.count <= 0 then
|
||||
return chestnr
|
||||
end
|
||||
end
|
||||
local lp = chest.get_logistic_point(defines.logistic_member_index.logistic_container)
|
||||
local filters = LP.get_filters(lp)
|
||||
for _, filter in pairs(filters) do
|
||||
if filter.value.name == name then
|
||||
local inserted_count = chest_inventory.insert(stack)
|
||||
stack.count = stack.count - inserted_count
|
||||
prepare_floaty_text(floaty_text_list, chest.surface, chest.position, name, inserted_count)
|
||||
if stack.count <= 0 then
|
||||
return chestnr
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -381,7 +393,7 @@ local function insert_item_into_chest(stack, chests, filtered_chests, name, floa
|
||||
-- Attempt to store in chests that already have the same item.
|
||||
for chestnr, chest in pairs(chests.chest) do
|
||||
if container[chest.type] then
|
||||
if chest.request_slot_count and chest.request_slot_count > 0 then
|
||||
if container_has_requests(chest) then
|
||||
goto continue
|
||||
end
|
||||
local chest_inventory = chests.inventory[chestnr]
|
||||
@ -402,7 +414,7 @@ local function insert_item_into_chest(stack, chests, filtered_chests, name, floa
|
||||
-- Attempt to store in empty chests.
|
||||
for chestnr, chest in pairs(filtered_chests.chest) do
|
||||
if container[chest.type] then
|
||||
if chest.request_slot_count and chest.request_slot_count > 0 then
|
||||
if container_has_requests(chest) then
|
||||
goto continue
|
||||
end
|
||||
local chest_inventory = filtered_chests.inventory[chestnr]
|
||||
@ -422,13 +434,13 @@ local function insert_item_into_chest(stack, chests, filtered_chests, name, floa
|
||||
end
|
||||
end
|
||||
|
||||
local item_prototypes = game.item_prototypes
|
||||
local item_prototypes = prototypes.item
|
||||
|
||||
-- Attempt to store in chests with same item subgroup.
|
||||
local item_subgroup = game.item_prototypes[name].subgroup.name
|
||||
local item_subgroup = prototypes.item[name].subgroup.name
|
||||
if item_subgroup then
|
||||
for chestnr, chest in pairs(filtered_chests.chest) do
|
||||
if chest.request_slot_count and chest.request_slot_count > 0 then
|
||||
if container_has_requests(chest) then
|
||||
goto continue
|
||||
end
|
||||
if container[chest.type] then
|
||||
@ -438,8 +450,8 @@ local function insert_item_into_chest(stack, chests, filtered_chests, name, floa
|
||||
end
|
||||
local content = chest_inventory.get_contents()
|
||||
if chest_inventory.can_insert(stack) then
|
||||
for equal_name, _ in pairs(content) do
|
||||
local t = item_prototypes[equal_name]
|
||||
for item_stack, _ in pairs(content) do
|
||||
local t = item_prototypes[item_stack.name]
|
||||
if t and t.subgroup.name == item_subgroup then
|
||||
local inserted_count = chest_inventory.insert(stack)
|
||||
stack.count = stack.count - inserted_count
|
||||
@ -458,7 +470,7 @@ local function insert_item_into_chest(stack, chests, filtered_chests, name, floa
|
||||
-- Attempt to store in mixed chests.
|
||||
for chestnr, chest in pairs(filtered_chests.chest) do
|
||||
if container[chest.type] then
|
||||
if chest.request_slot_count and chest.request_slot_count > 0 then
|
||||
if container_has_requests(chest) then
|
||||
goto continue
|
||||
end
|
||||
local chest_inventory = filtered_chests.inventory[chestnr]
|
||||
@ -479,8 +491,8 @@ local function insert_item_into_chest(stack, chests, filtered_chests, name, floa
|
||||
end
|
||||
|
||||
local function whitelist()
|
||||
local resources = game.entity_prototypes
|
||||
local items = game.item_prototypes
|
||||
local resources = prototypes.entity
|
||||
local items = prototypes.item
|
||||
this.whitelist = {}
|
||||
for k, _ in pairs(resources) do
|
||||
if resources[k] and resources[k].type == 'resource' and resources[k].mineable_properties then
|
||||
@ -516,19 +528,19 @@ function Public.auto_stash(player, event)
|
||||
return
|
||||
end
|
||||
if not (player.character and player.character.valid) then
|
||||
player.print({'auto_stash.err_no_character'}, Color.warning)
|
||||
player.print({'auto_stash.err_no_character'}, {color = Color.warning})
|
||||
return
|
||||
end
|
||||
local inventory = player.get_main_inventory()
|
||||
if inventory.is_empty() then
|
||||
player.print({'auto_stash.err_no_inventory'}, Color.warning)
|
||||
player.print({'auto_stash.err_no_inventory'}, {color = Color.warning})
|
||||
return
|
||||
end
|
||||
|
||||
local floaty_text_list = {}
|
||||
local chests = { chest = {}, inventory = {} }
|
||||
local r = this.small_radius
|
||||
local area = { { player.position.x - r, player.position.y - r }, { player.position.x + r, player.position.y + r } }
|
||||
local area = { { player.physical_position.x - r, player.physical_position.y - r }, { player.physical_position.x + r, player.physical_position.y + r } }
|
||||
if ctrl then
|
||||
if button == defines.mouse_button_type.right and this.insert_into_furnace then
|
||||
chests = get_nearby_chests(player, nil, true, false)
|
||||
@ -543,7 +555,7 @@ function Public.auto_stash(player, event)
|
||||
end
|
||||
|
||||
if not chests.chest or not chests.chest[1] then
|
||||
player.print({'auto_stash.err_no_container'}, Color.warning)
|
||||
player.print({'auto_stash.err_no_container'}, {color = Color.warning})
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -24,7 +24,7 @@ Global.register_init(
|
||||
local fluid_ores = tbl.require_fluid_ores
|
||||
local pumpjack_map = tbl.pumpjack_resources_map
|
||||
|
||||
for name, entity in pairs(game.entity_prototypes) do
|
||||
for name, entity in pairs(prototypes.entity) do
|
||||
if entity.type == 'mining-drill' and entity.resource_categories['basic-solid'] then
|
||||
local radius = entity.mining_drill_radius
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
local Event = require 'utils.event'
|
||||
local Game = require 'utils.game'
|
||||
local Global = require 'utils.global'
|
||||
local Settings = require 'utils.redmew_settings'
|
||||
local pairs = pairs
|
||||
@ -50,7 +51,7 @@ function Public.set_player_ammo(player_index, name, value)
|
||||
end
|
||||
|
||||
local function entity_built(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
|
||||
if not entity.valid then
|
||||
return
|
||||
@ -98,9 +99,9 @@ local function entity_built(event)
|
||||
|
||||
local remaining_count = inventory.get_item_count(name)
|
||||
|
||||
player.surface.create_entity(
|
||||
Game.create_local_flying_text(
|
||||
{
|
||||
name = 'flying-text',
|
||||
surface = player.surface,
|
||||
position = entity.position,
|
||||
text = {'autofill.insert_item', inserted, Ammos.locale[name], remaining_count}
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
-- Charge your armor equipment from nearby accumulators!
|
||||
-- made by Hanakocz
|
||||
-- modified by RedRafe
|
||||
-- source: https://github.com/ComfyFactory/ComfyFactorio/blob/develop/modules/charging_station.lua
|
||||
-- ======================================================= --
|
||||
|
||||
local Color = require 'resources.color_presets'
|
||||
local Global = require 'utils.global'
|
||||
|
||||
@ -38,33 +44,33 @@ end
|
||||
|
||||
function Public.recharge(player)
|
||||
if not player.character then
|
||||
player.print({'battery_charge.err_no_character'}, Color.warning)
|
||||
player.print({'battery_charge.err_no_character'}, {color = Color.warning})
|
||||
return
|
||||
end
|
||||
local armor_inventory = player.get_inventory(defines.inventory.character_armor)
|
||||
if not armor_inventory.valid then
|
||||
player.print({'battery_charge.err_no_armor'}, Color.warning)
|
||||
player.print({'battery_charge.err_no_armor'}, {color = Color.warning})
|
||||
return
|
||||
end
|
||||
local armor = armor_inventory[1]
|
||||
if not armor.valid_for_read then
|
||||
player.print({'battery_charge.err_no_armor'}, Color.warning)
|
||||
player.print({'battery_charge.err_no_armor'}, {color = Color.warning})
|
||||
return
|
||||
end
|
||||
local grid = armor.grid
|
||||
if not grid or not grid.valid then
|
||||
player.print({'battery_charge.err_no_armor'}, Color.warning)
|
||||
player.print({'battery_charge.err_no_armor'}, {color = Color.warning})
|
||||
return
|
||||
end
|
||||
|
||||
local entities = player.surface.find_entities_filtered {
|
||||
local entities = player.physical_surface.find_entities_filtered {
|
||||
type = 'accumulator',
|
||||
force = player.force,
|
||||
position = player.position,
|
||||
position = player.physical_position,
|
||||
radius = this.radius,
|
||||
}
|
||||
if not entities or not next(entities) then
|
||||
player.print({'battery_charge.err_no_accumulators'}, Color.warning)
|
||||
player.print({'battery_charge.err_no_accumulators'}, {color = Color.warning})
|
||||
return
|
||||
end
|
||||
|
||||
@ -73,7 +79,7 @@ function Public.recharge(player)
|
||||
if piece.valid and piece.generator_power == 0 then
|
||||
local energy_needs = piece.max_energy - piece.energy
|
||||
if energy_needs > 0 then
|
||||
local energy = discharge_accumulators(player.surface, player.position, player.force, energy_needs)
|
||||
local energy = discharge_accumulators(player.physical_surface, player.physical_position, player.force, energy_needs)
|
||||
if energy > 0 then
|
||||
if piece.energy + energy >= piece.max_energy then
|
||||
piece.energy = piece.max_energy
|
||||
|
@ -10,14 +10,14 @@ local queue_pop = Queue.pop
|
||||
local queue_size = Queue.size
|
||||
|
||||
-- config table for the max queue size
|
||||
-- Change at runtime with /sc global.config.biter_corpse_remover.max_queue_size = 100
|
||||
local biter_corpse_remover = global.config.biter_corpse_remover
|
||||
-- Change at runtime with /sc storage.config.biter_corpse_remover.max_queue_size = 100
|
||||
local biter_corpse_remover = storage.config.biter_corpse_remover
|
||||
|
||||
local corpse_queue = Queue.new()
|
||||
|
||||
Global.register(corpse_queue, function(tbl)
|
||||
corpse_queue = tbl
|
||||
biter_corpse_remover = global.config.biter_corpse_remover
|
||||
biter_corpse_remover = storage.config.biter_corpse_remover
|
||||
end)
|
||||
|
||||
local function process_corpses(corpses)
|
||||
|
@ -89,20 +89,20 @@ local function mentions(event)
|
||||
end
|
||||
if admin_call and p.admin then
|
||||
local message = {'chat_triggers.mention_success', prefix, game.get_player(event.player_index).name, word}
|
||||
p.print(message, Color.yellow)
|
||||
p.print(message, {color = Color.yellow})
|
||||
p.play_sound {path = 'utility/new_objective', volume_modifier = 1}
|
||||
success = true
|
||||
end
|
||||
if not admin_call and (p.name:lower() == word_front_trim or p.name:lower() == word_back_trim or p.name:lower() == word_back_double_trim or p.name:lower() == word_front_back_trim) then
|
||||
if p.name == player.name then
|
||||
if _DEBUG then
|
||||
player.print({'chat_triggers.mention_fail_mention_self', prefix}, Color.red)
|
||||
player.print({'chat_triggers.mention_fail_mention_self', prefix}, {color = Color.red})
|
||||
end
|
||||
success = true
|
||||
break
|
||||
end
|
||||
|
||||
p.print({'chat_triggers.mention_success_target', prefix, player.name}, Color.yellow)
|
||||
p.print({'chat_triggers.mention_success_target', prefix, player.name}, {color = Color.yellow})
|
||||
p.play_sound {path = 'utility/new_objective', volume_modifier = 1}
|
||||
if p.character and p.character.valid then -- If player is dead and they don't have a character then they won't get the hovering notification.
|
||||
local message = {'chat_triggers.mention_success_target_floating', player.name}
|
||||
@ -110,7 +110,7 @@ local function mentions(event)
|
||||
end
|
||||
success = true
|
||||
if _DEBUG then
|
||||
player.print(prefix .. 'Successful mentioned ' .. p.name, Color.red)
|
||||
player.print(prefix .. 'Successful mentioned ' .. p.name, {color = Color.red})
|
||||
end
|
||||
break
|
||||
end
|
||||
@ -130,21 +130,21 @@ local function mentions(event)
|
||||
if missing_player_string ~= nil then
|
||||
missing_player_string = string.sub(missing_player_string, 1, (string.len(missing_player_string) - 2))
|
||||
if not_found > 1 then
|
||||
player.print({'chat_triggers.mention_not_found_plural', prefix, missing_player_string}, Color.yellow)
|
||||
player.print({'chat_triggers.mention_not_found_plural', prefix, missing_player_string}, {color = Color.yellow})
|
||||
else
|
||||
player.print({'chat_triggers.mention_not_found_singular', prefix, missing_player_string}, Color.yellow)
|
||||
player.print({'chat_triggers.mention_not_found_singular', prefix, missing_player_string}, {color = Color.yellow})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if global.config.hodor.enabled then
|
||||
if storage.config.hodor.enabled then
|
||||
Event.add(defines.events.on_console_chat, hodor)
|
||||
end
|
||||
|
||||
if global.config.auto_respond.enabled then
|
||||
if storage.config.auto_respond.enabled then
|
||||
Event.add(defines.events.on_console_chat, auto_respond)
|
||||
end
|
||||
|
||||
if global.config.mentions.enabled then
|
||||
if storage.config.mentions.enabled then
|
||||
Event.add(defines.events.on_console_chat, mentions)
|
||||
end
|
||||
|
@ -127,7 +127,7 @@ function Public.play_sound(tick, player, path, times, delay, initial_delay)
|
||||
if (not valid(player)) then
|
||||
return
|
||||
end
|
||||
if not game.is_valid_sound_path(path) then
|
||||
if not helpers.is_valid_sound_path(path) then
|
||||
debug_print('Provided SoundPath is invalid. Try opening /radio and browse for a valid path')
|
||||
return
|
||||
end
|
||||
@ -156,9 +156,9 @@ local remove_renderings =
|
||||
Token.register(
|
||||
function(renderings)
|
||||
for _, v in pairs(renderings) do
|
||||
if rendering.is_valid(v) then
|
||||
rendering.destroy(v)
|
||||
debug_print('Deleted rendering with id: ' .. v)
|
||||
if v.valid then
|
||||
debug_print('Deleted rendering with id: ' .. v.id)
|
||||
v.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -225,7 +225,7 @@ function Public.register_running_cutscene(player_index, identifier, final_transi
|
||||
character = player.character,
|
||||
terminate_func = cutscene_function.terminate_func,
|
||||
rendering = {},
|
||||
current_index = -1,
|
||||
current_index = 0,
|
||||
start_tick = 0
|
||||
}
|
||||
local running_cutscene = running_cutscenes[player_index]
|
||||
@ -284,7 +284,7 @@ function Public.register_running_cutscene(player_index, identifier, final_transi
|
||||
running_cutscene.auto_play_cutscene_checkbox = auto_play_cutscene_checkbox
|
||||
end
|
||||
|
||||
handler({player_index = player_index, waypoint_index = -1, tick = game.tick})
|
||||
handler({player_index = player_index, waypoint_index = 0, tick = game.tick})
|
||||
end
|
||||
|
||||
local function restart_cutscene(player_index, waypoints, start_index)
|
||||
@ -343,7 +343,7 @@ local function restart_cutscene(player_index, waypoints, start_index)
|
||||
if start_index then
|
||||
player.jump_to_cutscene_waypoint(start_index + 1)
|
||||
else
|
||||
start_index = -1
|
||||
start_index = 0
|
||||
end
|
||||
|
||||
handler({player_index = player_index, waypoint_index = start_index, tick = game.tick})
|
||||
@ -410,7 +410,7 @@ local reconnect_character =
|
||||
end
|
||||
)
|
||||
|
||||
function Public.terminate_cutscene(player_index, ticks,skip_btn_flag)
|
||||
function Public.terminate_cutscene(player_index, ticks, skip_btn_flag)
|
||||
local running_cutscene = running_cutscenes[player_index]
|
||||
if not running_cutscene then
|
||||
return
|
||||
@ -433,18 +433,18 @@ function Public.terminate_cutscene(player_index, ticks,skip_btn_flag)
|
||||
)
|
||||
end
|
||||
|
||||
function Public.register_rendering_id(player_index, tick, render_id)
|
||||
if type(render_id) ~= 'table' then
|
||||
render_id = {render_id}
|
||||
function Public.register_rendering(player_index, tick, render)
|
||||
if type(render) ~= 'table' then
|
||||
render = {render}
|
||||
end
|
||||
local running_cutscene = running_cutscenes[player_index]
|
||||
for _, id in pairs(render_id) do
|
||||
if rendering.is_valid(id) then
|
||||
for _, obj in pairs(render) do
|
||||
if obj.valid then
|
||||
if not waypoint_still_active(tick, player_index) then
|
||||
debug_print('The rendering with id ' .. id .. ' was not added. Destroying it instead')
|
||||
rendering.destroy(id)
|
||||
debug_print('The rendering with id ' .. obj.id .. ' was not added. Destroying it instead')
|
||||
obj.destroy()
|
||||
else
|
||||
table.insert(running_cutscene.rendering, id)
|
||||
table.insert(running_cutscene.rendering, obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -467,15 +467,15 @@ handler = function(event)
|
||||
if not running_cutscene then
|
||||
return
|
||||
end
|
||||
running_cutscene.current_index = waypoint_index + 1
|
||||
running_cutscene.current_index = waypoint_index
|
||||
running_cutscene.start_tick = tick
|
||||
|
||||
local update = running_cutscene.update
|
||||
if update then
|
||||
restart_cutscene(player_index, update, waypoint_index)
|
||||
restart_cutscene(player_index, update, waypoint_index - 1)
|
||||
return
|
||||
end
|
||||
local ticks = running_cutscene.waypoints[waypoint_index + 2]
|
||||
local ticks = running_cutscene.waypoints[waypoint_index + 1]
|
||||
if ticks then
|
||||
ticks = ticks.transition_time
|
||||
else
|
||||
@ -486,7 +486,7 @@ handler = function(event)
|
||||
if not func then
|
||||
return
|
||||
end
|
||||
local current_waypoint = running_cutscene.waypoints[waypoint_index + 2]
|
||||
local current_waypoint = running_cutscene.waypoints[waypoint_index + 1]
|
||||
if not current_waypoint or current_waypoint.terminate then
|
||||
Public.terminate_cutscene(player_index, ticks)
|
||||
return
|
||||
@ -500,19 +500,19 @@ handler = function(event)
|
||||
tick = tick
|
||||
}
|
||||
|
||||
debug_print('Waypoint_index ' .. waypoint_index + 1 .. ' (waypoint #' .. waypoint_index + 2 .. ') callback in ' .. ticks .. ' ticks')
|
||||
debug_print('Waypoint_index ' .. waypoint_index .. ' (waypoint #' .. waypoint_index + 1 .. ') callback in ' .. ticks .. ' ticks')
|
||||
|
||||
set_timeout_in_ticks(ticks, callback_function, {func = running_cutscene.func, player_index = player_index, waypoint_index = waypoint_index, params = params})
|
||||
set_timeout_in_ticks(ticks, callback_function, {func = running_cutscene.func, player_index = player_index, waypoint_index = waypoint_index - 1, params = params})
|
||||
end
|
||||
|
||||
function Public.goTo(player_index, waypoint_index)
|
||||
local running_cutscene = running_cutscenes[player_index]
|
||||
if waypoint_index < 0 or waypoint_index > #running_cutscene.waypoints - 2 then
|
||||
if waypoint_index < 1 or waypoint_index > #running_cutscene.waypoints - 1 then
|
||||
return false
|
||||
end
|
||||
Token.get(remove_renderings)(running_cutscene.rendering)
|
||||
game.get_player(player_index).jump_to_cutscene_waypoint(waypoint_index)
|
||||
handler({player_index = player_index, waypoint_index = waypoint_index - 1, tick = game.tick})
|
||||
handler({player_index = player_index, waypoint_index = waypoint_index, tick = game.tick})
|
||||
running_cutscene.current_index = waypoint_index
|
||||
return true
|
||||
end
|
||||
|
@ -120,7 +120,7 @@ local function text_background(settings, offset, player, percentages, size, numb
|
||||
end
|
||||
|
||||
function Public.draw_text(settings, offset, text, player, params, draw_background, fit_to_edge)
|
||||
local ids = {}
|
||||
local list = {}
|
||||
local player_resolution = player.display_resolution
|
||||
player_resolution.scale = player.display_scale
|
||||
local percentages = calculate_percentages(settings, player_resolution)
|
||||
@ -139,10 +139,10 @@ function Public.draw_text(settings, offset, text, player, params, draw_backgroun
|
||||
local size = text_height_in_tiles(scale, settings.player_zoom)
|
||||
|
||||
if draw_background == true then
|
||||
insert(ids, text_background(settings, offset, player, percentages, size, 1, params, fit_to_edge))
|
||||
insert(list, text_background(settings, offset, player, percentages, size, 1, params, fit_to_edge))
|
||||
end
|
||||
|
||||
local target = {x = player.position.x + offset.x, y = player.position.y + offset.y}
|
||||
local target = {x = player.physical_position.x + offset.x, y = player.physical_position.y + offset.y}
|
||||
|
||||
local color = params.color
|
||||
color = color and color or {r = 255, g = 255, b = 255}
|
||||
@ -200,12 +200,12 @@ function Public.draw_text(settings, offset, text, player, params, draw_backgroun
|
||||
|
||||
debug_print(rendering_params)
|
||||
|
||||
insert(ids, rendering.draw_text(rendering_params))
|
||||
return ids
|
||||
insert(list, rendering.draw_text(rendering_params))
|
||||
return list
|
||||
end
|
||||
|
||||
function Public.draw_multi_line_text(settings, offset, texts, player, params, draw_background, fit_to_edge)
|
||||
local ids = {}
|
||||
local list = {}
|
||||
local player_resolution = player.display_resolution
|
||||
player_resolution.scale = player.display_scale
|
||||
local percentages = calculate_percentages(settings, player_resolution)
|
||||
@ -223,15 +223,15 @@ function Public.draw_multi_line_text(settings, offset, texts, player, params, dr
|
||||
offset.y = offset.y - size * 0.5
|
||||
|
||||
if draw_background then
|
||||
insert(ids, text_background(settings, offset, player, percentages, size, #texts, params, fit_to_edge))
|
||||
insert(list, text_background(settings, offset, player, percentages, size, #texts, params, fit_to_edge))
|
||||
draw_background = -1
|
||||
end
|
||||
|
||||
for i = 1, #texts do
|
||||
insert(ids, Public.draw_text(settings, offset, texts[i], player, params, draw_background, fit_to_edge)[1])
|
||||
insert(list, Public.draw_text(settings, offset, texts[i], player, params, draw_background, fit_to_edge)[1])
|
||||
offset.y = offset.y + (size * 1.5)
|
||||
end
|
||||
return ids
|
||||
return list
|
||||
end
|
||||
|
||||
function Public.draw_rectangle(settings, offset, left_top, right_bottom, player, params, fit_to_edge)
|
||||
@ -248,8 +248,8 @@ function Public.draw_rectangle(settings, offset, left_top, right_bottom, player,
|
||||
right_bottom = fit_to_screen(percentages, right_bottom)
|
||||
end
|
||||
|
||||
local target_left = {x = player.position.x + left_top.x + offset.x, y = player.position.y + left_top.y + offset.y}
|
||||
local target_right = {x = player.position.x + right_bottom.x + offset.x, y = player.position.y + right_bottom.y + offset.y}
|
||||
local target_left = {x = player.physical_position.x + left_top.x + offset.x, y = player.physical_position.y + left_top.y + offset.y}
|
||||
local target_right = {x = player.physical_position.x + right_bottom.x + offset.x, y = player.physical_position.y + right_bottom.y + offset.y}
|
||||
|
||||
local color = params.color
|
||||
color = color and color or {}
|
||||
|
@ -11,8 +11,8 @@ local function player_died(event)
|
||||
return
|
||||
end
|
||||
|
||||
local pos = player.position
|
||||
local entities = player.surface.find_entities_filtered {
|
||||
local pos = player.physical_position
|
||||
local entities = player.physical_surface.find_entities_filtered {
|
||||
area = {{pos.x - 0.5, pos.y - 0.5}, {pos.x + 0.5, pos.y + 0.5}},
|
||||
name = 'character-corpse'
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ Declare.module({'features', 'death_corpse_tags'}, function()
|
||||
end)
|
||||
|
||||
local function fake_death(player, has_items)
|
||||
local surface = player.surface
|
||||
local position = player.position
|
||||
local surface = player.physical_surface
|
||||
local position = player.physical_position
|
||||
|
||||
local entity = surface.create_entity {
|
||||
name = 'character-corpse',
|
||||
@ -61,10 +61,10 @@ Declare.module({'features', 'death_corpse_tags'}, function()
|
||||
declare_test('corpse removed and empty message when corpse is empty', function(context)
|
||||
-- Arrange.
|
||||
local player = context.player
|
||||
player.teleport({5, 5})
|
||||
player.teleport({5, 5}, player.physical_surface)
|
||||
|
||||
context:add_teardown(function()
|
||||
player.teleport({0, 0})
|
||||
player.teleport({0, 0}, player.physical_surface)
|
||||
end)
|
||||
|
||||
local actual_text
|
||||
@ -83,7 +83,7 @@ Declare.module({'features', 'death_corpse_tags'}, function()
|
||||
DeathCorpseTags._player_died(event)
|
||||
|
||||
-- Assert.
|
||||
local corpses = player.surface.find_entities_filtered({name = 'character-corpse', position = player.position, radius = 1})
|
||||
local corpses = player.physical_surface.find_entities_filtered({name = 'character-corpse', position = player.physical_position, radius = 1})
|
||||
Assert.equal(0, #corpses)
|
||||
|
||||
local expected = {'death_corpse_tags.empty_corpse'}
|
||||
|
@ -12,7 +12,7 @@ local concat = table.concat
|
||||
local remove = table.remove
|
||||
local set_data = Server.set_data
|
||||
local random = math.random
|
||||
local config = global.config.donator
|
||||
local config = storage.config.donator
|
||||
|
||||
local donator_data_set = 'donators'
|
||||
local donators = {} -- global register
|
||||
@ -38,7 +38,7 @@ Global.register(
|
||||
donator_perks_perm = tbl.donator_perks_perm
|
||||
donator_perks_temp = tbl.donator_perks_temp
|
||||
donator_tiers = tbl.donator_tiers
|
||||
config = global.config.donator
|
||||
config = storage.config.donator
|
||||
end
|
||||
)
|
||||
|
||||
@ -71,7 +71,7 @@ local print_after_timeout =
|
||||
return
|
||||
end
|
||||
|
||||
game.print(data.message, player.chat_color)
|
||||
game.print(data.message, {color = player.chat_color})
|
||||
end
|
||||
)
|
||||
|
||||
@ -238,12 +238,12 @@ local function player_died(event)
|
||||
end
|
||||
|
||||
-- Generic: this person has died message
|
||||
game.print({'donator.death_message', player.name}, player.chat_color)
|
||||
game.print({'donator.death_message', player.name}, {color = player.chat_color})
|
||||
|
||||
-- Player's selected message
|
||||
local message = messages[random(count)]
|
||||
message = concat({'*** ', message, ' ***'})
|
||||
game.print(message, player.chat_color)
|
||||
game.print(message, {color = player.chat_color})
|
||||
end
|
||||
|
||||
local reset_run_speed =
|
||||
|
@ -6,7 +6,7 @@ local Color = require 'resources.color_presets'
|
||||
local Global = require 'utils.global'
|
||||
|
||||
local format = string.format
|
||||
local config = global.config.donator.donator_perks
|
||||
local config = storage.config.donator.donator_perks
|
||||
|
||||
|
||||
Global.register(
|
||||
@ -14,7 +14,7 @@ Global.register(
|
||||
config = config
|
||||
},
|
||||
function()
|
||||
config = global.config.donator.donator_perks
|
||||
config = storage.config.donator.donator_perks
|
||||
end
|
||||
)
|
||||
|
||||
|
@ -64,8 +64,8 @@ local function spawn_player_corpse(player, banned, timeout_minutes)
|
||||
return
|
||||
end
|
||||
|
||||
local position = player.position
|
||||
local corpse = player.surface.create_entity {
|
||||
local position = player.physical_position
|
||||
local corpse = player.physical_surface.create_entity {
|
||||
name = 'character-corpse',
|
||||
position = position,
|
||||
inventory_size = #inv_contents,
|
||||
|
@ -2,7 +2,7 @@ local Event = require 'utils.event'
|
||||
local Global = require 'utils.global'
|
||||
local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
local register_on_entity_destroyed = script.register_on_entity_destroyed
|
||||
local register_on_object_destroyed = script.register_on_object_destroyed
|
||||
|
||||
local Public = {}
|
||||
local turrets_map = {}
|
||||
@ -79,15 +79,15 @@ function Public.register(entity, refill_name)
|
||||
return
|
||||
end
|
||||
|
||||
local is_item = game.item_prototypes[refill_name] and true or false
|
||||
local is_fluid = game.fluid_prototypes[refill_name] and true or false
|
||||
local is_item = prototypes.item[refill_name] and true or false
|
||||
local is_fluid = prototypes.fluid[refill_name] and true or false
|
||||
local is_artillery = entity.prototype.type == Artillery.turret_name
|
||||
|
||||
if not (is_item or is_fluid or is_artillery) then
|
||||
return
|
||||
end
|
||||
|
||||
local destroy_id = register_on_entity_destroyed(entity)
|
||||
local destroy_id = register_on_object_destroyed(entity)
|
||||
local unit_id = entity.unit_number
|
||||
|
||||
local data = {
|
||||
@ -109,7 +109,7 @@ function Public.register(entity, refill_name)
|
||||
else
|
||||
data.item_stack = {
|
||||
name = data.refill,
|
||||
count = game.item_prototypes[data.refill].stack_size
|
||||
count = prototypes.item[data.refill].stack_size
|
||||
}
|
||||
end
|
||||
|
||||
@ -193,14 +193,14 @@ local function simulate_automatic_artillery(data)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_entity_destroyed(event)
|
||||
local function on_object_destroyed(event)
|
||||
local destroy_id = event.registration_number
|
||||
local unit_id = event.unit_number
|
||||
|
||||
register_map[destroy_id] = nil
|
||||
turrets_map[unit_id] = nil
|
||||
end
|
||||
Event.add(defines.events.on_entity_destroyed, on_entity_destroyed)
|
||||
Event.add(defines.events.on_object_destroyed, on_object_destroyed)
|
||||
|
||||
local function on_tick()
|
||||
if primitives.index ~= nil and turrets_map[primitives.index] == nil then
|
||||
|
@ -1,5 +1,6 @@
|
||||
-- A feature to add cute flying text of a fish when a player uses a fish to heal themselves. Useful for teamwork.
|
||||
local Event = require 'utils.event'
|
||||
local Game = require 'utils.game'
|
||||
|
||||
local function capsule_used(event)
|
||||
if event.item.name ~= "raw-fish" then
|
||||
@ -16,10 +17,10 @@ local function capsule_used(event)
|
||||
return
|
||||
end
|
||||
|
||||
player.surface.create_entity {
|
||||
name = 'tutorial-flying-text',
|
||||
Game.create_local_flying_text {
|
||||
surface = player.physical_surface,
|
||||
text = '[img=item.raw-fish]',
|
||||
position = {player.position.x,player.position.y-3} -- creates the fish just above players head
|
||||
position = {player.physical_position.x,player.physical_position.y-3} -- creates the fish just above players head
|
||||
}
|
||||
|
||||
end
|
||||
|
@ -61,7 +61,7 @@ local function get_valid_force(lua_force_or_name)
|
||||
return force
|
||||
end
|
||||
|
||||
if type(lua_force_or_name) ~= 'table' or not lua_force_or_name.valid or nil == lua_force_or_name.evolution_factor then
|
||||
if type(lua_force_or_name) ~= 'table' or not lua_force_or_name.valid then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -73,7 +73,7 @@ function Public.get_main_frame(player)
|
||||
local flow = frame.add { type = 'flow', direction = 'horizontal' }
|
||||
Gui.set_style(flow, { horizontal_spacing = 8, vertical_align = 'center', bottom_padding = 4 })
|
||||
|
||||
local label = flow.add { type = 'label', caption = 'Admin panel', style = 'heading_1_label' }
|
||||
local label = flow.add { type = 'label', caption = 'Admin panel', style = 'frame_title' }
|
||||
label.drag_target = frame
|
||||
|
||||
local dragger = flow.add { type = 'empty-widget', style = 'draggable_space_header' }
|
||||
@ -83,7 +83,7 @@ function Public.get_main_frame(player)
|
||||
flow.add {
|
||||
type = 'sprite-button',
|
||||
name = close_button_name,
|
||||
sprite = 'utility/close_white',
|
||||
sprite = 'utility/close',
|
||||
clicked_sprite = 'utility/close_black',
|
||||
style = 'close_button',
|
||||
tooltip = {'gui.close-instruction'}
|
||||
|
@ -83,8 +83,8 @@ function Actions.spank(target_name, source_player)
|
||||
if character.health > 5 then
|
||||
character.damage(5, 'player')
|
||||
end
|
||||
target_player.surface.create_entity { name = 'water-splash', position = target_player.position }
|
||||
game.print(source_player.name .. ' spanked ' .. target_player.name, Color.warning)
|
||||
target_player.physical_surface.create_entity { name = 'water-splash', position = target_player.physical_position }
|
||||
game.print(source_player.name .. ' spanked ' .. target_player.name, {color = Color.warning})
|
||||
end
|
||||
|
||||
-- == SURFACE =================================================================
|
||||
|
@ -30,7 +30,7 @@ local function draw_gui(player)
|
||||
this.last_lua_input[player.index] = this.last_lua_input[player.index] or ''
|
||||
this.last_lua_output[player.index] = this.last_lua_output[player.index] or ''
|
||||
|
||||
local info = canvas.add { type = 'frame', style = 'deep_frame_in_shallow_frame_for_tabs', direction = 'vertical' }
|
||||
local info = canvas.add { type = 'frame', style = 'deep_frame_in_shallow_frame', direction = 'vertical' }
|
||||
Gui.set_style(info, { padding = 12, horizontally_stretchable = true })
|
||||
info.add { type = 'label', caption = '[font=default-bold][color=green]Input:[/color][/font]' }
|
||||
info.add { type = 'label', caption = ' - no need to append `/c` at the beginning of the code' }
|
||||
|
@ -3,6 +3,7 @@ local Event = require 'utils.event'
|
||||
local Gui = require 'utils.gui'
|
||||
local math = require 'utils.math'
|
||||
local Surface = require 'features.gui.admin_panel.functions'.surface
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
|
||||
local main_button_name = Gui.uid_name()
|
||||
local slider_tag_name = Gui.uid_name()
|
||||
@ -187,7 +188,7 @@ local function draw_gui(player)
|
||||
value_step = 0.01,
|
||||
},
|
||||
format = '%.2f',
|
||||
value = game.forces.enemy.evolution_factor * 100,
|
||||
value = game.forces.enemy.get_evolution_factor(RS.get_surface_name()) * 100,
|
||||
tooltip = 'Current value, %',
|
||||
})
|
||||
make_slider(row_3, {
|
||||
@ -316,7 +317,7 @@ end)
|
||||
Gui.on_click(on_evolution_value, function(event)
|
||||
local element = event.element
|
||||
local value = update_slider(element)
|
||||
game.forces.enemy.evolution_factor = value / 100
|
||||
game.forces.enemy.set_evolution_factor(value / 100, RS.get_surface_name())
|
||||
end)
|
||||
|
||||
Gui.on_click(on_evolution_destroy_factor, function(event)
|
||||
|
@ -193,7 +193,6 @@ local function draw_gui(player)
|
||||
local textbox = row_3.add { type = 'text-box', text = generate_ban_text(player) }
|
||||
Gui.set_style(textbox, { minimal_width = 460, maximal_width = 460, minimal_height = 72, horizontally_stretchable = true, vertically_stretchable = true })
|
||||
textbox.word_wrap = true
|
||||
textbox.clear_and_focus_on_right_click = true
|
||||
|
||||
local flow_3 = row_3.add { type = 'flow', direction = 'horizontal' }
|
||||
Gui.add_pusher(flow_3)
|
||||
|
@ -46,18 +46,18 @@ local function create_camera(args, player)
|
||||
end
|
||||
|
||||
if not mainframe then
|
||||
mainframe = mainframeflow.add {type = 'frame', name = mainframeid, direction = 'vertical', style = 'captionless_frame'}
|
||||
mainframe = mainframeflow.add {type = 'frame', name = mainframeid, direction = 'vertical'}
|
||||
mainframe.visible = true
|
||||
end
|
||||
|
||||
local headerframe = mainframe.headerframe
|
||||
if not headerframe then
|
||||
mainframe.add {type = 'frame', name = 'headerframe', direction = 'horizontal', style = 'captionless_frame'}
|
||||
mainframe.add {type = 'frame', name = 'headerframe', direction = 'horizontal'}
|
||||
end
|
||||
|
||||
local cameraframe = mainframe.cameraframe
|
||||
if not cameraframe then
|
||||
mainframe.add {type = 'frame', name = 'cameraframe', style = 'captionless_frame'}
|
||||
mainframe.add {type = 'frame', name = 'cameraframe'}
|
||||
end
|
||||
|
||||
mainframe.add {type = 'label', caption = 'Following: ' .. target.name}
|
||||
@ -88,7 +88,7 @@ end
|
||||
local function camera_command(args, player)
|
||||
destroy_camera({player = player})
|
||||
-- Once the old camera is destroyed, check to see if we need to make a new one
|
||||
if global.config.camera_disabled then
|
||||
if storage.config.camera_disabled then
|
||||
player.print('The watch/camera function has been disabled for performance reasons.')
|
||||
return
|
||||
end
|
||||
@ -98,8 +98,8 @@ local function camera_command(args, player)
|
||||
end
|
||||
|
||||
local function update_camera_render(target, targetframe, zoom, size, visible)
|
||||
local position = {x = target.position.x, y = target.position.y - 0.5}
|
||||
local surface_index = target.surface.index
|
||||
local position = {x = target.physical_position.x, y = target.physical_position.y - 0.5}
|
||||
local surface_index = target.physical_surface.index
|
||||
local preview_size = size
|
||||
local camera = targetframe.camera
|
||||
|
||||
@ -153,7 +153,7 @@ local function update_camera_size(targetframe)
|
||||
end
|
||||
|
||||
local function on_tick()
|
||||
if global.config.camera_disabled then
|
||||
if storage.config.camera_disabled then
|
||||
return
|
||||
end
|
||||
for table_key, camera_table in pairs(camera_users) do
|
||||
|
@ -42,7 +42,7 @@ local ignore = {
|
||||
serpent = true,
|
||||
log = true,
|
||||
table_size = true,
|
||||
global = true,
|
||||
storage = true,
|
||||
remote = true,
|
||||
commands = true,
|
||||
settings = true,
|
||||
@ -51,7 +51,9 @@ local ignore = {
|
||||
util = true,
|
||||
mod_gui = true,
|
||||
game = true,
|
||||
rendering = true
|
||||
rendering = true,
|
||||
helpers = true,
|
||||
prototypes = true,
|
||||
}
|
||||
|
||||
local header_name = Gui.uid_name()
|
||||
|
@ -135,6 +135,6 @@ Command.add(
|
||||
end
|
||||
|
||||
value = dump(value)
|
||||
game.write_file('dump.lua', value, false, player_index)
|
||||
helpers.write_file('dump.lua', value, false, player_index)
|
||||
end
|
||||
)
|
||||
|
@ -25,14 +25,14 @@ local clear_filter_name = Gui.uid_name()
|
||||
-- global tables
|
||||
local enabled = {}
|
||||
local last_events = {}
|
||||
global.debug_event_view = {
|
||||
storage.debug_event_view = {
|
||||
enabled = enabled,
|
||||
last_events = last_events,
|
||||
filter = ''
|
||||
}
|
||||
|
||||
function Public.on_open_debug()
|
||||
local tbl = global.debug_event_view
|
||||
local tbl = storage.debug_event_view
|
||||
if tbl then
|
||||
enabled = tbl.enabled
|
||||
last_events = tbl.last_events
|
||||
@ -40,7 +40,7 @@ function Public.on_open_debug()
|
||||
enabled = {}
|
||||
last_events = {}
|
||||
|
||||
global.debug_event_view = {
|
||||
storage.debug_event_view = {
|
||||
enabled = enabled,
|
||||
last_events = last_events
|
||||
}
|
||||
@ -108,7 +108,7 @@ local function redraw_event_table(gui_table, filter)
|
||||
end
|
||||
|
||||
function Public.show(container)
|
||||
local filter = global.debug_event_view.filter
|
||||
local filter = storage.debug_event_view.filter
|
||||
|
||||
local main_frame_flow = container.add({type = 'flow', direction = 'vertical'})
|
||||
|
||||
@ -136,7 +136,7 @@ Gui.on_text_changed(
|
||||
|
||||
local filter = element.text:gsub(' ', '_')
|
||||
|
||||
global.debug_event_view.filter = filter
|
||||
storage.debug_event_view.filter = filter
|
||||
element.text = filter
|
||||
|
||||
gui_table.clear()
|
||||
@ -153,7 +153,7 @@ Gui.on_click(
|
||||
local gui_table = data.gui_table
|
||||
|
||||
filter_textfield.text = ''
|
||||
global.debug_event_view.filter = ''
|
||||
storage.debug_event_view.filter = ''
|
||||
|
||||
gui_table.clear()
|
||||
redraw_event_table(gui_table, '')
|
||||
|
@ -16,7 +16,7 @@ local right_panel_name = Gui.uid_name()
|
||||
local input_text_box_name = Gui.uid_name()
|
||||
local refresh_name = Gui.uid_name()
|
||||
|
||||
Public.name = 'global'
|
||||
Public.name = 'storage'
|
||||
|
||||
function Public.show(container)
|
||||
local main_flow = container.add {type = 'flow', direction = 'horizontal'}
|
||||
@ -25,7 +25,7 @@ function Public.show(container)
|
||||
local left_panel_style = left_panel.style
|
||||
left_panel_style.width = 300
|
||||
|
||||
for key, _ in pairs(global) do
|
||||
for key, _ in pairs(storage) do
|
||||
if not ignore[key] then
|
||||
local header =
|
||||
left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = tostring(key)}
|
||||
@ -93,7 +93,7 @@ Gui.on_click(
|
||||
input_text_box.text = concat {"global['", key, "']"}
|
||||
input_text_box.style.font_color = Color.black
|
||||
|
||||
local content = dump(global[key]) or 'nil'
|
||||
local content = dump(storage[key]) or 'nil'
|
||||
right_panel.text = content
|
||||
end
|
||||
)
|
||||
|
@ -212,7 +212,7 @@ Gui.on_click(
|
||||
|
||||
if selected_player_index then
|
||||
input_text_box.text =
|
||||
concat {'global.tokens[', Gui.token, '].data[', selected_player_index, '][', element_index, ']'}
|
||||
concat {'storage.tokens[', Gui.token, '].data[', selected_player_index, '][', element_index, ']'}
|
||||
else
|
||||
input_text_box.text = 'missing player'
|
||||
end
|
||||
|
@ -86,7 +86,7 @@ Gui.on_click(
|
||||
element.style.font_color = Color.orange
|
||||
data.selected_header = element
|
||||
|
||||
input_text_box.text = concat {'global.tokens[', token_id, ']'}
|
||||
input_text_box.text = concat {'storage.tokens[', token_id, ']'}
|
||||
input_text_box.style.font_color = Color.black
|
||||
|
||||
local content = dump(Token.get_global(token_id)) or 'nil'
|
||||
|
@ -3,7 +3,7 @@ local Command = require 'utils.command'
|
||||
local Ranks = require 'resources.ranks'
|
||||
local Scenario_Info = require 'features.gui.info'
|
||||
|
||||
local creators = global.config.map_info
|
||||
local creators = storage.config.map_info
|
||||
|
||||
local gui_frame = Gui.uid_name()
|
||||
local generate_tags = Gui.uid_name()
|
||||
|
@ -2,6 +2,7 @@ local Event = require 'utils.event'
|
||||
local Gui = require 'utils.gui'
|
||||
local Global = require 'utils.global'
|
||||
local Toast = require 'features.gui.toast'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local round = math.round
|
||||
local pairs = pairs
|
||||
local main_button_name = Gui.uid_name()
|
||||
@ -34,7 +35,7 @@ local function get_evolution_percentage()
|
||||
return 0
|
||||
end
|
||||
|
||||
local value = round(game.forces.enemy.evolution_factor * 1000) * 0.001
|
||||
local value = round(game.forces.enemy.get_evolution_factor(RS.get_surface_name()) * 1000) * 0.001
|
||||
if value < 0.001 then
|
||||
-- 0.00 won't be shown on the button as value
|
||||
return 0.001
|
||||
|
@ -10,7 +10,7 @@ local Color = require 'resources.color_presets'
|
||||
|
||||
local format = string.format
|
||||
|
||||
local config = global.config
|
||||
local config = storage.config
|
||||
local config_mapinfo = config.map_info
|
||||
local config_prewards = config.player_rewards
|
||||
|
||||
@ -416,7 +416,7 @@ local pages = {
|
||||
local market_label = grid.add {type = 'label', caption = {'info.softmods_market_text'}}
|
||||
market_label.style.single_line = false
|
||||
|
||||
grid.add {type = 'sprite', sprite = 'item/player-port'}
|
||||
grid.add {type = 'sprite', sprite = 'item/simple-entity-with-owner'}
|
||||
local train_savior = grid.add {type = 'label', caption = {'info.softmods_saviour_label'}}
|
||||
local train_savior_style = train_savior.style
|
||||
train_savior_style.font = 'default-listbox'
|
||||
@ -716,9 +716,7 @@ Gui.on_text_changed(editable_textbox_name, function(event)
|
||||
primitives.info_edited = true
|
||||
end)
|
||||
|
||||
Gui.on_custom_close(main_frame_name, function(event)
|
||||
close_main_frame(event.element, event.player)
|
||||
end)
|
||||
Gui.on_custom_close(main_frame_name, toggle)
|
||||
|
||||
Gui.allow_player_to_toggle_top_element_visibility(main_button_name)
|
||||
|
||||
|
@ -2,7 +2,7 @@ local Event = require 'utils.event'
|
||||
local Gui = require 'utils.gui'
|
||||
local Global = require 'utils.global'
|
||||
|
||||
local config = global.config.paint
|
||||
local config = storage.config.paint
|
||||
local default_fallback_hidden_tile = 'dirt-6'
|
||||
|
||||
local brush_tools = {
|
||||
@ -181,7 +181,7 @@ local function get_tile_localised_name(tile_name)
|
||||
return
|
||||
end
|
||||
|
||||
local proto = game.tile_prototypes[tile_name]
|
||||
local proto = prototypes.tile[tile_name]
|
||||
if proto then
|
||||
return proto.localised_name or proto.name
|
||||
end
|
||||
|
@ -403,9 +403,9 @@ local column_builders = {
|
||||
lines = lines + 1
|
||||
|
||||
if not prototype_locale_string_cache[name] then
|
||||
local prototype = game.entity_prototypes[name]
|
||||
local prototype = prototypes.entity[name]
|
||||
if not prototype then
|
||||
prototype = game.item_prototypes[name]
|
||||
prototype = prototypes.item[name]
|
||||
end
|
||||
prototype_locale_string_cache[name] = prototype and prototype.localised_name or {'', name}
|
||||
end
|
||||
@ -534,7 +534,7 @@ local function get_default_player_settings()
|
||||
report_heading_name,
|
||||
}
|
||||
|
||||
if global.config.player_list.show_coin_column then
|
||||
if storage.config.player_list.show_coin_column then
|
||||
table.insert(columns, 6, coin_heading_name)
|
||||
end
|
||||
|
||||
|
@ -257,7 +257,7 @@ local function redraw_poll_viewer_content(data)
|
||||
question_flow.add {
|
||||
type = 'sprite-button',
|
||||
name = poll_view_edit_name,
|
||||
sprite = 'utility/rename_icon_normal',
|
||||
sprite = 'utility/rename_icon',
|
||||
tooltip = 'Edit Poll.'
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,9 @@ local function show_popup(player, message, title_text, sprite_path, popup_name)
|
||||
if (popup) then
|
||||
Gui.destroy(popup)
|
||||
end
|
||||
frame = player.gui.center.add {name = 'Popup.' .. popup_name, type = 'frame', direction = 'vertical', style = 'captionless_frame'}
|
||||
frame = player.gui.center.add {name = 'Popup.' .. popup_name, type = 'frame', direction = 'vertical' }
|
||||
else
|
||||
frame = player.gui.center.add {type = 'frame', direction = 'vertical', style = 'captionless_frame'}
|
||||
frame = player.gui.center.add {type = 'frame', direction = 'vertical' }
|
||||
end
|
||||
|
||||
frame.style.minimal_width = 300
|
||||
|
@ -201,7 +201,7 @@ local function handler(event)
|
||||
if subname == 'radio_play:' then
|
||||
local path = string.sub(name, 12)
|
||||
local player = game.get_player(event.player_index)
|
||||
if (game.is_valid_sound_path(path)) then
|
||||
if (helpers.is_valid_sound_path(path)) then
|
||||
player.play_sound {path = path}
|
||||
return
|
||||
else
|
||||
|
@ -274,12 +274,7 @@ local function setting_set(event)
|
||||
element_data.previous_value = Settings.toScalar(setting_name, event.old_value)
|
||||
end
|
||||
|
||||
Gui.on_custom_close(
|
||||
main_frame_name,
|
||||
function(event)
|
||||
Gui.destroy(event.element)
|
||||
end
|
||||
)
|
||||
Gui.on_custom_close(main_frame_name, toggle)
|
||||
|
||||
Gui.allow_player_to_toggle_top_element_visibility(main_button_name)
|
||||
|
||||
|
@ -10,7 +10,7 @@ local ScoreTracker = require 'utils.score_tracker'
|
||||
local format_number = require 'util'.format_number
|
||||
local pairs = pairs
|
||||
local concat = table.concat
|
||||
local scores_to_show = global.config.score.global_to_show
|
||||
local scores_to_show = storage.config.score.global_to_show
|
||||
local set_timeout_in_ticks = Schedule.set_timeout_in_ticks
|
||||
local main_frame_name = Gui.uid_name()
|
||||
local main_button_name = Gui.uid_name()
|
||||
@ -111,11 +111,11 @@ local function score_show(top)
|
||||
local frame = top.add {
|
||||
type = 'frame',
|
||||
name = main_frame_name,
|
||||
style = 'finished_game_subheader_frame',
|
||||
style = 'subheader_frame',
|
||||
index = top[main_button_name].get_index_in_parent() + 1
|
||||
}
|
||||
frame.location = { x = 1, y = 38 }
|
||||
Gui.set_style(frame, { natural_height = Styles.default_top_element.style.minimal_height, height = Styles.default_top_element.style.minimal_height })
|
||||
Gui.set_style(frame, { natural_height = Styles.default_top_element.style.minimal_height, height = Styles.default_top_element.style.minimal_height, padding = 6 })
|
||||
|
||||
local score_table = frame.add {type = 'table', name = 'score_table', column_count = table_size(scores)}
|
||||
local style = score_table.style
|
||||
|
@ -175,7 +175,7 @@ local function draw_main_frame_content(parent)
|
||||
row.add {
|
||||
type = 'sprite-button',
|
||||
name = edit_tag_button_name,
|
||||
sprite = 'utility/rename_icon_normal',
|
||||
sprite = 'utility/rename_icon',
|
||||
tooltip = {'tag_group.edit_group'}
|
||||
}
|
||||
edit_button.style.top_padding = 0
|
||||
@ -636,7 +636,7 @@ Gui.on_click(
|
||||
path = type .. '/' .. data.choose.elem_value
|
||||
end
|
||||
|
||||
if path and not frame.gui.is_valid_sprite_path(path) then
|
||||
if path and not helpers.is_valid_sprite_path(path) then
|
||||
player.print({'tag_group.sprite_not_valid', path})
|
||||
return
|
||||
end
|
||||
|
@ -267,7 +267,7 @@ local function redraw_tasks(data, enabled)
|
||||
parent.add({type = 'flow'}).add {
|
||||
type = 'sprite-button',
|
||||
name = edit_task_button_name,
|
||||
sprite = 'utility/rename_icon_normal',
|
||||
sprite = 'utility/rename_icon',
|
||||
tooltip = edit_button_tooltip
|
||||
}
|
||||
edit_button.enabled = enabled
|
||||
@ -346,7 +346,7 @@ local function draw_main_frame(left, player)
|
||||
announcements_header_flow.add {
|
||||
type = 'sprite-button',
|
||||
name = announcements_edit_button_name,
|
||||
sprite = 'utility/rename_icon_normal',
|
||||
sprite = 'utility/rename_icon',
|
||||
tooltip = edit_announcements_button_tooltip
|
||||
}
|
||||
edit_announcements_button.enabled = enabled
|
||||
|
@ -86,7 +86,7 @@ local function toast_to(player, duration, sound)
|
||||
local flow_frame = frame_holder.add { type = 'flow', direction = 'vertical' }
|
||||
|
||||
local frame =
|
||||
flow_frame.add({type = 'frame', name = toast_frame_name, direction = 'vertical', style = 'captionless_frame'})
|
||||
flow_frame.add({type = 'frame', name = toast_frame_name, direction = 'vertical' })
|
||||
frame.style.width = 300
|
||||
|
||||
local container = frame.add({type = 'flow', name = toast_container_name, direction = 'horizontal'})
|
||||
|
@ -1,3 +1,4 @@
|
||||
local Game = require 'utils.game'
|
||||
local Global = require 'utils.global'
|
||||
local Event = require 'utils.event'
|
||||
local random = math.random
|
||||
@ -40,12 +41,12 @@ local function compute_fullness(player, position)
|
||||
local damage = ceil((warn_player.count / 2) * warn_player.count)
|
||||
if player.character.health >= damage then
|
||||
player.character.damage(damage, 'player', 'explosion')
|
||||
player.character.surface.create_entity({ name = 'water-splash', position = player.position })
|
||||
player.surface.create_entity({ name = 'flying-text', position = { position.x, position.y + 0.6 }, text = messages[random(#messages)], color = { r = 0.75, g = 0.0, b = 0.0 } })
|
||||
player.character.surface.create_entity({ name = 'water-splash', position = player.physical_position })
|
||||
Game.create_local_flying_text({ surface = player.surface, position = { position.x, position.y + 0.6 }, text = messages[random(#messages)], color = { r = 0.75, g = 0.0, b = 0.0 } })
|
||||
else
|
||||
player.character.die('enemy')
|
||||
is_player_warned(player, true)
|
||||
game.print(player.name .. ' should have emptied their pockets.', { r = 0.75, g = 0.0, b = 0.0 })
|
||||
game.print(player.name .. ' should have emptied their pockets.', {color = { r = 0.75, g = 0.0, b = 0.0 }})
|
||||
return free_slots
|
||||
end
|
||||
end
|
||||
@ -54,7 +55,7 @@ local function compute_fullness(player, position)
|
||||
end
|
||||
if free_slots > 1 then
|
||||
if floor(inventory_size / free_slots) == 10 then -- When player has 10% free slots
|
||||
player.surface.create_entity({ name = 'flying-text', position = { position.x, position.y + 0.6 }, text = 'You are feeling heavy', color = { r = 1.0, g = 0.5, b = 0.0 } })
|
||||
Game.create_local_flying_text({ surface = player.surface, position = { position.x, position.y + 0.6 }, text = 'You are feeling heavy', color = { r = 1.0, g = 0.5, b = 0.0 } })
|
||||
end
|
||||
end
|
||||
return free_slots
|
||||
|
@ -5,12 +5,13 @@ local Token = require 'utils.token'
|
||||
local Gui = require 'utils.gui'
|
||||
local Task = require 'utils.task'
|
||||
local Global = require 'utils.global'
|
||||
local Table = require 'utils.table'
|
||||
|
||||
local format = string.format
|
||||
|
||||
local chests = {}
|
||||
local chests_next = {}
|
||||
local config = global.config.infinite_storage_chest
|
||||
local config = storage.config.infinite_storage_chest
|
||||
|
||||
|
||||
Global.register(
|
||||
@ -31,7 +32,7 @@ function Module.create_chest(surface, position, storage)
|
||||
end
|
||||
|
||||
local function built_entity(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
if not entity or not entity.valid or entity.name ~= 'infinity-chest' then
|
||||
return
|
||||
end
|
||||
@ -42,7 +43,7 @@ local function built_entity(event)
|
||||
end
|
||||
|
||||
local function get_stack_size(name)
|
||||
local proto = game.item_prototypes[name]
|
||||
local proto = prototypes.item[name]
|
||||
if not proto then
|
||||
log('item prototype ' .. name .. ' not found')
|
||||
return 1
|
||||
@ -97,15 +98,16 @@ local function tick()
|
||||
chests[chest_id] = nil
|
||||
else
|
||||
local storage = chest_data.storage
|
||||
local inv = entity.get_inventory(1) --defines.inventory.chest
|
||||
local inv = entity.get_inventory(defines.inventory.chest)
|
||||
local contents = inv.get_contents()
|
||||
|
||||
for name, count in pairs(contents) do
|
||||
do_item(name, count, inv, storage)
|
||||
for _, item_stack in pairs(contents) do
|
||||
do_item(item_stack.name, item_stack.count, inv, storage)
|
||||
end
|
||||
|
||||
local dict = Table.array_to_dict(contents, 'name')
|
||||
for name, _ in pairs(storage) do
|
||||
if not contents[name] then
|
||||
if not dict[name] then
|
||||
do_item(name, 0, inv, storage)
|
||||
end
|
||||
end
|
||||
@ -114,7 +116,7 @@ end
|
||||
|
||||
local function create_chest_gui_content(frame, player, chest)
|
||||
local storage = chest.storage
|
||||
local inv = chest.entity.get_inventory(1).get_contents()
|
||||
local inv = Table.array_to_dict(chest.entity.get_inventory(defines.inventory.chest).get_contents(), 'name')
|
||||
|
||||
local grid = frame[chest_content_table_name]
|
||||
|
||||
@ -125,7 +127,7 @@ local function create_chest_gui_content(frame, player, chest)
|
||||
end
|
||||
|
||||
for name, count in pairs(storage) do
|
||||
local number = count + (inv[name] or 0)
|
||||
local number = count + (inv[name] and inv[name].count or 0)
|
||||
grid.add {
|
||||
type = 'sprite-button',
|
||||
sprite = 'item/' .. name,
|
||||
@ -136,12 +138,12 @@ local function create_chest_gui_content(frame, player, chest)
|
||||
}
|
||||
end
|
||||
|
||||
for name, count in pairs(inv) do
|
||||
for name, item_stack in pairs(inv) do
|
||||
if not storage[name] then
|
||||
grid.add {
|
||||
type = 'sprite-button',
|
||||
sprite = 'item/' .. name,
|
||||
number = count,
|
||||
number = item_stack.count,
|
||||
tooltip = name,
|
||||
--style = 'slot_button'
|
||||
enabled = false
|
||||
|
@ -1,3 +1,4 @@
|
||||
-- Module deprecated in 2.0, became a built-in feature
|
||||
-- This feature allows players to remove landfill.
|
||||
-- To use, create a deconstruction planner with the landfill tile filter and select tiles only mode.
|
||||
-- Use the decon planner within range of the landfill to remove it
|
||||
@ -7,7 +8,7 @@ local Rank = require 'features.rank_system'
|
||||
local Ranks = require 'resources.ranks'
|
||||
local table = require 'utils.table'
|
||||
local math = require 'utils.math'
|
||||
local config = global.config.landfill_remover
|
||||
local config = storage.config.landfill_remover
|
||||
|
||||
local Public = {}
|
||||
|
||||
|
@ -7,7 +7,7 @@ local Ranks = require 'resources.ranks'
|
||||
local LandfillRemover = require 'features.landfill_remover'
|
||||
|
||||
local main_inventory = defines.inventory.character_main
|
||||
local config = global.config.landfill_remover
|
||||
local config = storage.config.landfill_remover
|
||||
|
||||
local tile_items = {
|
||||
'stone-brick',
|
||||
|
@ -19,7 +19,7 @@ local clean_energy_interface = Token.register(function (params)
|
||||
entity.destroy()
|
||||
end)
|
||||
|
||||
if global.config.market.enabled then
|
||||
if storage.config.market.enabled then
|
||||
local new_items = {
|
||||
{
|
||||
name = 'welcome-package',
|
||||
@ -65,7 +65,7 @@ end
|
||||
|
||||
-- players cannot build anything, just place ghosts
|
||||
Event.add(defines.events.on_built_entity, function(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
if not entity or not entity.valid then
|
||||
return
|
||||
end
|
||||
@ -99,7 +99,9 @@ Event.add(defines.events.on_built_entity, function(event)
|
||||
return
|
||||
end
|
||||
|
||||
player.insert(event.stack)
|
||||
for _, stack in pairs(event.consumed_items.get_contents()) do
|
||||
player.insert(stack)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
@ -107,10 +109,10 @@ Command.add('lazy-bastard-bootstrap', {
|
||||
description = {'command_description.lazy_bastard_bootstrap'},
|
||||
required_rank = Ranks.admin,
|
||||
}, function(_, player)
|
||||
local surface = player.surface
|
||||
local surface = player.physical_surface
|
||||
local force = player.force
|
||||
|
||||
local pos = player.position
|
||||
local pos = player.physical_position
|
||||
pos.y = round(pos.y - 4)
|
||||
pos.x = round(pos.x)
|
||||
|
||||
|
@ -3,6 +3,7 @@ local Event = require 'utils.event'
|
||||
local Token = require 'utils.token'
|
||||
local Task = require 'utils.task'
|
||||
local Command = require 'utils.command'
|
||||
local Game = require 'utils.game'
|
||||
local Global = require 'utils.global'
|
||||
local Retailer = require 'features.retailer'
|
||||
local Ranks = require 'resources.ranks'
|
||||
@ -20,7 +21,7 @@ local pairs = pairs
|
||||
local round = math.round
|
||||
local random = math.random
|
||||
local format = string.format
|
||||
local market_config = global.config.market
|
||||
local market_config = storage.config.market
|
||||
local currency = market_config.currency
|
||||
local entity_drop_amount = market_config.entity_drop_amount
|
||||
|
||||
@ -124,12 +125,12 @@ local function fish_earned(event, amount)
|
||||
|
||||
local stack = {name = currency, count = amount}
|
||||
local inserted = player.insert(stack)
|
||||
player.surface.create_entity{name="flying-text", position = {player.position.x - 1, player.position.y}, text = "+" .. amount .. " [img=item.coin]", color = Color.gold, render_player_index = player.index}
|
||||
Game.create_local_flying_text{ surface = player.surface, position = {player.position.x - 1, player.position.y}, text = "+" .. amount .. " [img=item.coin]", color = Color.gold, render_player_index = player.index}
|
||||
|
||||
local diff = amount - inserted
|
||||
if diff > 0 then
|
||||
stack.count = diff
|
||||
player.surface.spill_item_stack(player.position, stack, true)
|
||||
player.surface.spill_item_stack{ position = player.position, stack = stack, enable_looted = true }
|
||||
end
|
||||
|
||||
change_for_player(player_index, coins_earned_name, amount)
|
||||
@ -154,7 +155,7 @@ end
|
||||
local spill_items =
|
||||
Token.register(
|
||||
function(data)
|
||||
data.surface.spill_item_stack(data.position, {name = currency, count = data.count}, true)
|
||||
data.surface.spill_item_stack{ position = data.position, stack = {name = currency, count = data.count}, enable_looted = true }
|
||||
end
|
||||
)
|
||||
|
||||
@ -308,7 +309,7 @@ local function player_created(event)
|
||||
return
|
||||
end
|
||||
|
||||
local count = global.config.player_rewards.info_player_reward and 1 or 10
|
||||
local count = storage.config.player_rewards.info_player_reward and 1 or 10
|
||||
player.insert {name = currency, count = count}
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,7 @@ local Rank = require 'features.rank_system'
|
||||
local Utils = require 'utils.core'
|
||||
local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
local Game = require 'utils.game'
|
||||
local Global = require 'utils.global'
|
||||
local Report = require 'features.report'
|
||||
local Popup = require 'features.gui.popup'
|
||||
@ -210,15 +211,15 @@ local function on_capsule_used(event)
|
||||
end
|
||||
|
||||
if item.name == 'artillery-targeting-remote' then
|
||||
player.surface.create_entity {
|
||||
name = 'flying-text',
|
||||
Game.create_local_flying_text {
|
||||
surface = player.surface,
|
||||
text = player.name,
|
||||
color = player.color,
|
||||
position = event.position
|
||||
}
|
||||
end
|
||||
|
||||
local nuke_control = global.config.nuke_control
|
||||
local nuke_control = storage.config.nuke_control
|
||||
if not nuke_control.enable_autokick and not nuke_control.enable_autoban then
|
||||
return
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ Global.register(data, function(tbl)
|
||||
data = tbl
|
||||
end)
|
||||
|
||||
local config = global.config.permissions
|
||||
local config = storage.config.permissions
|
||||
local Public = {}
|
||||
|
||||
-- defines.input_action listed at https://lua-api.factorio.com/latest/defines.html#defines.input_action
|
||||
|
@ -81,7 +81,7 @@ local function on_command(event)
|
||||
return
|
||||
end
|
||||
|
||||
player.print({'player_colors.gui_setting_reference_message'}, Color.success)
|
||||
player.print({'player_colors.gui_setting_reference_message'}, {color = Color.success})
|
||||
Settings.set(player_index, player_color_name, player.color)
|
||||
|
||||
local error = Settings.validate(player_chat_color_name, player.chat_color)
|
||||
|
@ -10,7 +10,7 @@ local get_random_weighted = table.get_random_weighted
|
||||
local Public = {}
|
||||
|
||||
function Public.show_start_up(player)
|
||||
local config = global.config.player_create
|
||||
local config = storage.config.player_create
|
||||
local p = player.print
|
||||
for _, message in pairs(config.join_messages) do
|
||||
p(message)
|
||||
@ -28,16 +28,16 @@ function Public.show_start_up(player)
|
||||
end
|
||||
|
||||
if _DEBUG and game.is_multiplayer() then
|
||||
game.print('THIS MULTIPLAYER MAP IS IN DEBUG!!!', Color.warning)
|
||||
game.print('THIS MULTIPLAYER MAP IS IN DEBUG!!!', {color = Color.warning})
|
||||
elseif _DEBUG then
|
||||
game.print("DON'T LAUNCH THIS MAP! DEBUG MODE IS ENABLED!!!", Color.warning)
|
||||
game.print("DON'T LAUNCH THIS MAP! DEBUG MODE IS ENABLED!!!", {color = Color.warning})
|
||||
elseif not _DEBUG and not game.is_multiplayer() then
|
||||
player.print('To change your name in single-player, open chat and type the following /c game.player.name = "your_name"', Color.info)
|
||||
player.print('To change your name in single-player, open chat and type the following /c game.player.name = "your_name"', {color = Color.info})
|
||||
end
|
||||
end
|
||||
|
||||
local function player_created(event)
|
||||
local config = global.config.player_create
|
||||
local config = storage.config.player_create
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
if not player or not player.valid then
|
||||
@ -79,7 +79,7 @@ if _CHEATS then
|
||||
)
|
||||
|
||||
local function player_created_cheat_mode(event)
|
||||
local config = global.config.player_create
|
||||
local config = storage.config.player_create
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
if not player or not player.valid then
|
||||
@ -110,10 +110,10 @@ if _CHEATS then
|
||||
if cheats.start_with_power_armor then
|
||||
player_insert({name = 'power-armor-mk2', count = 1})
|
||||
local armor_put = player.get_inventory(5)[1].grid.put
|
||||
armor_put({name = 'fusion-reactor-equipment'})
|
||||
armor_put({name = 'fusion-reactor-equipment'})
|
||||
armor_put({name = 'fusion-reactor-equipment'})
|
||||
armor_put({name = 'fusion-reactor-equipment'})
|
||||
armor_put({name = 'fission-reactor-equipment'})
|
||||
armor_put({name = 'fission-reactor-equipment'})
|
||||
armor_put({name = 'fission-reactor-equipment'})
|
||||
armor_put({name = 'fission-reactor-equipment'})
|
||||
armor_put({name = 'personal-roboport-mk2-equipment'})
|
||||
armor_put({name = 'personal-roboport-mk2-equipment'})
|
||||
armor_put({name = 'personal-laser-defense-equipment'})
|
||||
|
@ -1,5 +1,8 @@
|
||||
-- This module saves players' logistic requests slots between maps
|
||||
-- Dependencies
|
||||
|
||||
--TODO: Rewrite, feature deprecated for 2.0
|
||||
--[[
|
||||
local Command = require 'utils.command'
|
||||
local Event = require 'utils.event'
|
||||
local Game = require 'utils.game'
|
||||
@ -71,7 +74,7 @@ local function validate_entry(item, proto_table, player)
|
||||
return item
|
||||
end
|
||||
|
||||
player.print({'player_logistic_requests.incompatible_item', item.name}, Color.warning)
|
||||
player.print({'player_logistic_requests.incompatible_item', item.name}, {color = Color.warning})
|
||||
end
|
||||
|
||||
--- Sets the logistic request slots of a player.
|
||||
@ -90,7 +93,7 @@ local set_bars_callback =
|
||||
return
|
||||
end
|
||||
|
||||
local item_prototypes = game.item_prototypes
|
||||
local item_prototypes = prototypes.item
|
||||
local item
|
||||
for i = 1, logistic_slots do
|
||||
item = validate_entry(bars[i], item_prototypes, player)
|
||||
@ -195,7 +198,6 @@ local function delete_bars(_, player)
|
||||
end
|
||||
|
||||
-- Events
|
||||
|
||||
Event.add(Server.events.on_server_started, register_server_start_events)
|
||||
|
||||
-- Commands
|
||||
@ -226,3 +228,4 @@ Command.add(
|
||||
},
|
||||
delete_bars
|
||||
)
|
||||
]]
|
@ -58,7 +58,7 @@ local function validate_entry(item, proto_table, player)
|
||||
return item
|
||||
end
|
||||
|
||||
player.print({'player_quick_bars.incompatible_item', item}, Color.warning)
|
||||
player.print({'player_quick_bars.incompatible_item', item}, {color = Color.warning})
|
||||
end
|
||||
|
||||
--- Sets the quick bars of a player.
|
||||
@ -76,7 +76,7 @@ local set_bars_callback =
|
||||
return
|
||||
end
|
||||
|
||||
local item_prototypes = game.item_prototypes
|
||||
local item_prototypes = prototypes.item
|
||||
local item
|
||||
for i = 1, quickbar_slots do
|
||||
item = validate_entry(bars[i], item_prototypes, player)
|
||||
|
@ -1,5 +1,6 @@
|
||||
local Global = require 'utils.global'
|
||||
local Event = require 'utils.event'
|
||||
local SA = require 'utils.space_age'
|
||||
local ScoreTracker = require 'utils.score_tracker'
|
||||
require 'utils.table'
|
||||
|
||||
@ -22,6 +23,7 @@ local player_console_chats_name = 'player-console-chats'
|
||||
local player_items_crafted_name = 'player-items-crafted'
|
||||
local player_distance_walked_name = 'player-distance-walked'
|
||||
local satellites_launched_name = 'satellites-launched'
|
||||
local rockets_launched_name = 'rockets-launched'
|
||||
local player_units_killed_name = 'player-units-killed' -- biters and spitters
|
||||
local player_worms_killed_name = 'player-worms-killed'
|
||||
local player_spawners_killed_name = 'player-spawners-killed'
|
||||
@ -33,7 +35,7 @@ local player_resources_hand_mined_name = 'player_resources_hand_mined'
|
||||
local resources_hand_mined_name = 'resources_hand_mined'
|
||||
local resources_exhausted_name = 'resources_exhausted'
|
||||
|
||||
ScoreTracker.register(rocks_smashed_name, {'player_stats.rocks_smashed'}, '[img=entity.rock-huge]')
|
||||
ScoreTracker.register(rocks_smashed_name, {'player_stats.rocks_smashed'}, '[img=entity.huge-rock]')
|
||||
ScoreTracker.register(trees_cut_down_name, {'player_stats.trees_cut_down'}, '[img=entity.tree-02]')
|
||||
ScoreTracker.register(player_count_name, {'player_stats.player_count'})
|
||||
ScoreTracker.register(kills_by_trains_name, {'player_stats.kills_by_trains'}, '[img=item.locomotive]')
|
||||
@ -46,7 +48,10 @@ ScoreTracker.register(player_deaths_name, {'player_stats.player_deaths'})
|
||||
ScoreTracker.register(player_console_chats_name, {'player_stats.player_console_chats'})
|
||||
ScoreTracker.register(player_items_crafted_name, {'player_stats.player_items_crafted'})
|
||||
ScoreTracker.register(player_distance_walked_name, {'player_stats.player_distance_walked'})
|
||||
ScoreTracker.register(satellites_launched_name, {'player_stats.satellites_launched'}, '[img=item.satellite]')
|
||||
if not SA.enabled() then
|
||||
ScoreTracker.register(satellites_launched_name, {'player_stats.satellites_launched'}, '[img=item.satellite]')
|
||||
end
|
||||
ScoreTracker.register(rockets_launched_name, {'player_stats.rockets_launched'}, '[img=item.rocket-silo]')
|
||||
ScoreTracker.register(player_units_killed_name, {'player_stats.player_units_killed'})
|
||||
ScoreTracker.register(player_worms_killed_name, {'player_stats.player_worms_killed'})
|
||||
ScoreTracker.register(player_spawners_killed_name, {'player_stats.player_spawners_killed'})
|
||||
@ -110,7 +115,7 @@ end)
|
||||
local function player_created(event)
|
||||
local index = event.player_index
|
||||
|
||||
player_last_position[index] = game.get_player(index).position
|
||||
player_last_position[index] = game.get_player(index).physical_position
|
||||
player_death_causes[index] = {}
|
||||
change_for_global(player_count_name, 1)
|
||||
end
|
||||
@ -198,7 +203,7 @@ local function player_console_chat(event)
|
||||
end
|
||||
|
||||
local function player_built_entity(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
if not entity or not entity.valid then
|
||||
return
|
||||
end
|
||||
@ -301,7 +306,9 @@ local function rocket_launched(event)
|
||||
return
|
||||
end
|
||||
|
||||
local inventory = entity.get_inventory(defines.inventory.rocket)
|
||||
change_for_global(rockets_launched_name, 1)
|
||||
|
||||
local inventory = entity.get_inventory(defines.inventory.rocket_silo_rocket)
|
||||
if not inventory or not inventory.valid then
|
||||
return
|
||||
end
|
||||
@ -328,7 +335,7 @@ local function tick()
|
||||
if (p.afk_time < 30 or p.walking_state.walking) and p.vehicle == nil then
|
||||
local index = p.index
|
||||
local last_pos = player_last_position[index]
|
||||
local pos = p.position
|
||||
local pos = p.physical_position
|
||||
|
||||
local d_x = last_pos.x - pos.x
|
||||
local d_y = last_pos.y - pos.y
|
||||
@ -368,6 +375,7 @@ local Public = {
|
||||
player_console_chats_name = player_console_chats_name,
|
||||
player_items_crafted_name = player_items_crafted_name,
|
||||
player_distance_walked_name = player_distance_walked_name,
|
||||
rockets_launched_name = rockets_launched_name,
|
||||
satellites_launched_name = satellites_launched_name,
|
||||
player_units_killed_name = player_units_killed_name,
|
||||
player_worms_killed_name = player_worms_killed_name,
|
||||
|
@ -1,7 +1,7 @@
|
||||
local Event = require 'utils.event'
|
||||
local Global = require 'utils.global'
|
||||
|
||||
local config = global.config.popup_chat
|
||||
local config = storage.config.popup_chat
|
||||
local MIN_LIFETIME = config.min_lifetime or 06 * 60 -- 06s
|
||||
local MAX_LIFETIME = config.max_lifetime or 20 * 60 -- 20s
|
||||
local MIN_MESSAGE_LENGTH = config.min_length or 40
|
||||
@ -48,30 +48,29 @@ local function on_console_chat(event)
|
||||
return
|
||||
end
|
||||
|
||||
local popup_ID = data.popup_chat[index]
|
||||
if popup_ID then
|
||||
rendering.destroy(popup_ID)
|
||||
data.popup_chat[popup_ID] = nil
|
||||
local popup = data.popup_chat[index]
|
||||
if popup and popup.valid then
|
||||
popup.destroy()
|
||||
data.popup_chat[index] = nil
|
||||
end
|
||||
|
||||
local safe_message = get_safe_message(message)
|
||||
local color = player.color
|
||||
color.a = 0.9
|
||||
|
||||
popup_ID = rendering.draw_text({
|
||||
data.popup_chat[index] = rendering.draw_text({
|
||||
text = safe_message,
|
||||
surface = player.surface,
|
||||
target = player.character,
|
||||
target_offset = {0, -4},
|
||||
color = color,
|
||||
font = 'compilatron-message-font',
|
||||
font = 'compi',
|
||||
scale = 1.75,
|
||||
time_to_live = get_message_lifetime(safe_message),
|
||||
forces = { player.force },
|
||||
alignment = 'center',
|
||||
use_rich_text = true,
|
||||
})
|
||||
data.popup_chat[index] = popup_ID
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_console_chat, on_console_chat)
|
||||
|
@ -1,4 +1,7 @@
|
||||
-- Get random item stacks based off a budget
|
||||
-- modified by RedRafe
|
||||
-- source: https://github.com/ComfyFactory/ComfyFactorio/blob/develop/maps/expanse/price_raffle.lua
|
||||
-- ======================================================= --
|
||||
|
||||
-- @usage PriceRaffle
|
||||
--[[
|
||||
@ -53,6 +56,7 @@ local item_worths = {
|
||||
['burner-mining-drill'] = 8,
|
||||
['cannon-shell'] = 8,
|
||||
['car'] = 128,
|
||||
['cargo-landing-pad'] = 2048,
|
||||
['cargo-wagon'] = 256,
|
||||
['centrifuge'] = 2048,
|
||||
['chemical-plant'] = 128,
|
||||
@ -72,7 +76,6 @@ local item_worths = {
|
||||
['defender-capsule'] = 16,
|
||||
['destroyer-capsule'] = 256,
|
||||
['discharge-defense-equipment'] = 2048,
|
||||
['discharge-defense-remote'] = 32,
|
||||
['distractor-capsule'] = 128,
|
||||
['effectivity-module-2'] = 512,
|
||||
['effectivity-module-3'] = 2048,
|
||||
@ -97,16 +100,14 @@ local item_worths = {
|
||||
['fast-splitter'] = 64,
|
||||
['fast-transport-belt'] = 16,
|
||||
['fast-underground-belt'] = 64,
|
||||
['filter-inserter'] = 40,
|
||||
['firearm-magazine'] = 4,
|
||||
['flamethrower-ammo'] = 32,
|
||||
['flamethrower-turret'] = 2048,
|
||||
['flamethrower'] = 512,
|
||||
['fluid-wagon'] = 256,
|
||||
['flying-robot-frame'] = 128,
|
||||
['fusion-reactor-equipment'] = 8192,
|
||||
['fission-reactor-equipment'] = 8192,
|
||||
['gate'] = 16,
|
||||
['green-wire'] = 4,
|
||||
['grenade'] = 16,
|
||||
['gun-turret'] = 64,
|
||||
['hazard-concrete'] = 4,
|
||||
@ -171,17 +172,16 @@ local item_worths = {
|
||||
['rail-chain-signal'] = 16,
|
||||
['rail-signal'] = 16,
|
||||
['rail'] = 8,
|
||||
['red-wire'] = 4,
|
||||
['refined-concrete'] = 16,
|
||||
['refined-hazard-concrete'] = 16,
|
||||
['repair-pack'] = 8,
|
||||
['roboport'] = 2048,
|
||||
['rocket-control-unit'] = 256,
|
||||
['rocket-fuel'] = 256,
|
||||
['rocket-launcher'] = 128,
|
||||
['rocket-silo'] = 65536,
|
||||
['rocket'] = 8,
|
||||
['satellite'] = 32768,
|
||||
['selector-combinator'] = 16,
|
||||
['shotgun-shell'] = 4,
|
||||
['shotgun'] = 16,
|
||||
['slowdown-capsule'] = 16,
|
||||
@ -195,7 +195,6 @@ local item_worths = {
|
||||
['speed-module-3'] = 2048,
|
||||
['speed-module'] = 128,
|
||||
['splitter'] = 16,
|
||||
['stack-filter-inserter'] = 160,
|
||||
['stack-inserter'] = 128,
|
||||
['steam-engine'] = 32,
|
||||
['steam-turbine'] = 256,
|
||||
@ -272,7 +271,7 @@ function Public.roll_item_stack(remaining_budget, blacklist, value_blacklist)
|
||||
end
|
||||
end
|
||||
|
||||
local stack_size = game.item_prototypes[item_name].stack_size * 32
|
||||
local stack_size = prototypes.item[item_name].stack_size * 32
|
||||
|
||||
local item_count = 1
|
||||
|
||||
@ -354,7 +353,7 @@ local function add_recipe_products(recipe)
|
||||
name = name .. '-barrel'
|
||||
end
|
||||
|
||||
if game.item_prototypes[name] ~= nil then
|
||||
if prototypes.item[name] ~= nil then
|
||||
item_unlocked[name] = item_worths[name]
|
||||
if item_unlocked[name] ~= nil then
|
||||
table_insert(item_names, name)
|
||||
@ -402,7 +401,7 @@ Event.add(defines.events.on_research_finished, function(event)
|
||||
return
|
||||
end
|
||||
|
||||
for _, effect in pairs(technology.effects or {}) do
|
||||
for _, effect in pairs(technology.prototype.effects or {}) do
|
||||
if effect.recipe then
|
||||
add_recipe_products(game.forces.player.recipes[effect.recipe])
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ local Server = require 'features.server'
|
||||
local Ranks = require 'resources.ranks'
|
||||
local Colors = require 'resources.color_presets'
|
||||
|
||||
local config = global.config.rank_system
|
||||
local config = storage.config.rank_system
|
||||
local trust_time = config.time_for_trust
|
||||
local everyone_is_regular = config.everyone_is_regular
|
||||
|
||||
|
@ -10,7 +10,7 @@ local Global = require 'utils.global'
|
||||
local Ranks = require 'resources.ranks'
|
||||
local Color = require 'resources.color_presets'
|
||||
|
||||
local primitives = {reactors_enabled = global.config.reactor_meltdown.on_by_default}
|
||||
local primitives = {reactors_enabled = storage.config.reactor_meltdown.on_by_default}
|
||||
local wastelands = {}
|
||||
local reactors = {}
|
||||
|
||||
@ -122,7 +122,7 @@ local function check_reactors()
|
||||
table.remove(reactors, i)
|
||||
end
|
||||
end
|
||||
--global.last_reactor_warning = last_reactor_warning
|
||||
--storage.last_reactor_warning = last_reactor_warning
|
||||
end
|
||||
end
|
||||
|
||||
@ -156,11 +156,11 @@ local function on_tick()
|
||||
end
|
||||
|
||||
local function entity_build(event)
|
||||
if not event.created_entity.valid then
|
||||
if not event.entity.valid then
|
||||
return
|
||||
end
|
||||
if event.created_entity.name == 'nuclear-reactor' and event.created_entity.surface.name ~= 'antigrief' then
|
||||
table.insert(reactors, event.created_entity)
|
||||
if event.entity.name == 'nuclear-reactor' and event.entity.surface.name ~= 'antigrief' then
|
||||
table.insert(reactors, event.entity)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -8,7 +8,7 @@ local Donator = require 'features.donator'
|
||||
local Color = require 'resources.color_presets'
|
||||
local ScoreTracker = require 'utils.score_tracker'
|
||||
local format_number = require 'util'.format_number
|
||||
local player_data_to_show = global.config.redmew_commands.whois.player_data_to_show
|
||||
local player_data_to_show = storage.config.redmew_commands.whois.player_data_to_show
|
||||
local print_to_player = Game.player_print
|
||||
local concat = table.concat
|
||||
local tostring = tostring
|
||||
@ -30,7 +30,7 @@ local function do_fish_kill(player, suicide)
|
||||
return false
|
||||
end
|
||||
|
||||
local e = player.surface.create_entity { name = 'fish', position = player.position }
|
||||
local e = player.physical_surface.create_entity { name = 'fish', position = player.physical_position }
|
||||
c.die(player.force, e)
|
||||
|
||||
-- Don't want people killing themselves for free fish.
|
||||
@ -169,8 +169,8 @@ end
|
||||
|
||||
local function print_version()
|
||||
local version_str
|
||||
if global.redmew_version then
|
||||
version_str = global.redmew_version
|
||||
if storage.redmew_version then
|
||||
version_str = storage.redmew_version
|
||||
else
|
||||
version_str = { 'redmew_commands.print_version_from_source' }
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ local Task = require 'utils.task'
|
||||
local Rank = require 'features.rank_system'
|
||||
local Gui = require 'utils.gui'
|
||||
|
||||
local config = global.config.redmew_qol
|
||||
local config = storage.config.redmew_qol
|
||||
|
||||
-- Localized functions
|
||||
local random = math.random
|
||||
@ -28,7 +28,7 @@ end)
|
||||
|
||||
--- When placed, locomotives will get a random color
|
||||
local random_train_color = Token.register(function(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
if entity and entity.valid and entity.type == 'locomotive' then
|
||||
entity.color = Utils.random_RGB()
|
||||
end
|
||||
@ -37,7 +37,7 @@ end)
|
||||
--- If a newly placed entity is a provider or non-logi chest, set it to only have 1 slot available.
|
||||
-- If placed from a bp and the bp has restrictions on the chest, it takes priority.
|
||||
local restrict_chest = Token.register(function(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
if entity and entity.valid and (entity.name == 'logistic-chest-passive-provider' or entity.type == 'container') then
|
||||
local chest_inventory = entity.get_inventory(defines.inventory.chest)
|
||||
if #chest_inventory + 1 == chest_inventory.getbar() then
|
||||
@ -67,7 +67,7 @@ end
|
||||
|
||||
--- Changes the backer name on an entity that supports having a backer name.
|
||||
local change_backer_name = Token.register(function(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
if entity and entity.valid and entity.backer_name then
|
||||
entity.backer_name = pick_name() or entity.backer_name
|
||||
end
|
||||
@ -210,10 +210,6 @@ local function register_inserter_drops_pickup()
|
||||
end
|
||||
|
||||
local function on_init()
|
||||
-- Set player force's ghost_time_to_live to an hour. Giving the players ghosts before the research of robots is a nice QOL improvement.
|
||||
if config.ghosts_before_research then
|
||||
Public.set_ghost_ttl()
|
||||
end
|
||||
if config.loaders then
|
||||
Task.set_timeout_in_ticks(1, loader_check_token, nil)
|
||||
end
|
||||
@ -223,16 +219,6 @@ Event.on_init(on_init)
|
||||
|
||||
-- Public functions
|
||||
|
||||
--- Sets a ghost_time_to_live as a quality of life feature: now ghosts
|
||||
-- are created on death of entities before robot research
|
||||
-- @param force_name string with name of force
|
||||
-- @param time number of ticks for ghosts to live
|
||||
function Public.set_ghost_ttl(force_name, time)
|
||||
force_name = force_name or 'player'
|
||||
time = time or (30 * 60 * 60)
|
||||
game.forces[force_name].ghost_time_to_live = time
|
||||
end
|
||||
|
||||
--- Sets random_train_color on or off.
|
||||
-- @param enable <boolean> true to toggle on, false for off
|
||||
-- @return <boolean> Success/failure of command
|
||||
@ -347,12 +333,6 @@ if config.save_bots then
|
||||
Event.add(defines.events.on_selected_entity_changed, preserve_bot)
|
||||
end
|
||||
|
||||
if config.research_queue then
|
||||
Event.on_init(function()
|
||||
game.forces.player.research_queue_enabled = true
|
||||
end)
|
||||
end
|
||||
|
||||
local loader_crafter_frame_for_player_name = Gui.uid_name()
|
||||
local loader_crafter_frame_for_assembly_machine_name = Gui.uid_name()
|
||||
local player_craft_loader_1 = Gui.uid_name()
|
||||
@ -728,11 +708,11 @@ if config.loaders then
|
||||
end)
|
||||
|
||||
Event.add(defines.events.on_built_entity, function(event)
|
||||
loader_built(event.created_entity)
|
||||
loader_built(event.entity)
|
||||
end)
|
||||
|
||||
Event.add(defines.events.on_robot_built_entity, function(event)
|
||||
loader_built(event.created_entity)
|
||||
loader_built(event.entity)
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -253,7 +253,7 @@ end
|
||||
-- @param player <LuaPlayer|'<script>'|nil> the admin as LuaPlayer or '<script>' or server as nil
|
||||
function Module.jail(target_player, player)
|
||||
local print
|
||||
if type(player) == 'table' then
|
||||
if type(player) == 'userdata' then
|
||||
print = player.print
|
||||
else
|
||||
player = {name = player or '<server>'}
|
||||
@ -418,7 +418,7 @@ function Module.unjail(target_player, player)
|
||||
-- Let admin know it worked, let target know what's going on.
|
||||
Game.player_print(target_name .. ' has been returned to the default group. They have been advised of this.', Color.success, player)
|
||||
target_player.print(prefix)
|
||||
target_player.print('Your ability to perform actions has been restored', Color.light_green)
|
||||
target_player.print('Your ability to perform actions has been restored', {color = Color.light_green})
|
||||
target_player.print(prefix_e)
|
||||
Utils.print_admins(format('%s has been released from jail by %s', target_name, player.name))
|
||||
Utils.log_command(Utils.get_actor(), 'unjail', target_name)
|
||||
|
@ -2,7 +2,7 @@ local Event = require 'utils.event'
|
||||
local Server = require 'features.server'
|
||||
|
||||
local to_discord_bold = Server.to_discord_bold
|
||||
local config = global.config.research_printer
|
||||
local config = storage.config.research_printer
|
||||
local template = {'research_printer.research_finished', nil}
|
||||
|
||||
local function research_finished(event)
|
||||
|
@ -623,7 +623,7 @@ function Retailer.set_item(group_name, prototype)
|
||||
local name_label = prototype.name_label
|
||||
|
||||
if not name_label then
|
||||
local item_prototype = game.item_prototypes[item_name]
|
||||
local item_prototype = prototypes.item[item_name]
|
||||
name_label = item_prototype and item_prototype.localised_name
|
||||
end
|
||||
|
||||
|
@ -189,7 +189,7 @@ local transform_callback =
|
||||
return
|
||||
end
|
||||
|
||||
local returned_entries = global.transform_function(entries)
|
||||
local returned_entries = storage.transform_function(entries)
|
||||
|
||||
write_dataset(primitives.new_dataset, returned_entries)
|
||||
|
||||
@ -206,7 +206,7 @@ local function transform_data(args)
|
||||
return
|
||||
end
|
||||
|
||||
local transform_function = global.transform_function
|
||||
local transform_function = storage.transform_function
|
||||
if not transform_function then
|
||||
game.print('No transform function set')
|
||||
clear_primitives()
|
||||
@ -214,7 +214,7 @@ local function transform_data(args)
|
||||
end
|
||||
|
||||
if type(transform_function) ~= 'function' then
|
||||
game.print('global.transform_function does not contain a function')
|
||||
game.print('storage.transform_function does not contain a function')
|
||||
clear_primitives()
|
||||
return
|
||||
end
|
||||
@ -243,7 +243,7 @@ local transform_test_callback =
|
||||
return
|
||||
end
|
||||
|
||||
local transform_function = global.transform_function
|
||||
local transform_function = storage.transform_function
|
||||
if not transform_function then
|
||||
game.print('No transform function set.')
|
||||
clear_primitives()
|
||||
@ -251,20 +251,20 @@ local transform_test_callback =
|
||||
end
|
||||
|
||||
if type(transform_function) ~= 'function' then
|
||||
game.print('global.transform_function does not contain a function.')
|
||||
game.print('storage.transform_function does not contain a function.')
|
||||
clear_primitives()
|
||||
return
|
||||
end
|
||||
|
||||
local returned_entries = global.transform_function(entries)
|
||||
local returned_entries = storage.transform_function(entries)
|
||||
|
||||
clear_primitives()
|
||||
|
||||
global.transform_results = returned_entries
|
||||
storage.transform_results = returned_entries
|
||||
local result_str = table.inspect(returned_entries)
|
||||
game.print(result_str)
|
||||
log(result_str)
|
||||
game.print('Test complete. The results can be better seen in the log or in global.transform_results')
|
||||
game.print('Test complete. The results can be better seen in the log or in storage.transform_results')
|
||||
end
|
||||
)
|
||||
|
||||
|
@ -223,7 +223,7 @@ function Public.start_game(start_game_data)
|
||||
error('start_game_data must be a string or table')
|
||||
end
|
||||
|
||||
local json = game.table_to_json(data)
|
||||
local json = helpers.table_to_json(data)
|
||||
raw_print(start_game_tag .. json)
|
||||
end
|
||||
|
||||
@ -705,9 +705,9 @@ end
|
||||
-- but an easy way to at least establish a baseline.
|
||||
local function set_scenario_version()
|
||||
-- A 1 hour buffer is in place to account for potential playtime pre-upload.
|
||||
if game.tick < 216000 and not global.redmew_version then
|
||||
if game.tick < 216000 and not storage.redmew_version then
|
||||
local time_string = Timestamp.to_string(Public.get_current_time())
|
||||
global.redmew_version = string.format('Time of map launch: %s UTC', time_string)
|
||||
storage.redmew_version = string.format('Time of map launch: %s UTC', time_string)
|
||||
end
|
||||
end
|
||||
|
||||
@ -774,13 +774,13 @@ Event.add(defines.events.on_player_died, function(event)
|
||||
message[#message + 1] = ' has died.'
|
||||
end
|
||||
|
||||
local position = player.position
|
||||
local position = player.physical_position
|
||||
message[#message + 1] = ' [gps='
|
||||
message[#message + 1] = string.format('%.1f', position.x)
|
||||
message[#message + 1] = ','
|
||||
message[#message + 1] = string.format('%.1f', position.y)
|
||||
message[#message + 1] = ','
|
||||
message[#message + 1] = player.surface.name
|
||||
message[#message + 1] = player.physical_surface.name
|
||||
message[#message + 1] = ']'
|
||||
|
||||
message = concat(message)
|
||||
|
@ -4,7 +4,7 @@ local Token = require 'utils.token'
|
||||
local Server = require 'features.server'
|
||||
local Donator = require 'features.donator'
|
||||
|
||||
if global.config.poll.enabled then
|
||||
if storage.config.poll.enabled then
|
||||
local Event = require 'utils.event'
|
||||
|
||||
local function set_poll()
|
||||
|
@ -1,3 +1,4 @@
|
||||
-- Module deprecated in 2.0, became a built-in feature
|
||||
-- Functions to allow players to select a group of spidertrons with a deconstruction planner and then assign them to follow another spidertron
|
||||
local Event = require 'utils.event'
|
||||
local Global = require 'utils.global'
|
||||
@ -29,12 +30,12 @@ local function is_targetting_deconstruction_planner(cursor_stack)
|
||||
return false
|
||||
end
|
||||
|
||||
-- check if the player has given the decon planner an icon. This is how we will determine their intention
|
||||
if not cursor_stack.blueprint_icons or not cursor_stack.blueprint_icons[1] or not cursor_stack.blueprint_icons[1].signal.name then
|
||||
-- check if the player has given the deconstruction planner an icon. This is how we will determine their intention
|
||||
if not cursor_stack.preview_icons or not cursor_stack.preview_icons[1] or not cursor_stack.preview_icons[1].signal.name then
|
||||
return false
|
||||
end
|
||||
|
||||
local icon_name = cursor_stack.blueprint_icons[1].signal.name
|
||||
local icon_name = cursor_stack.preview_icons[1].signal.name
|
||||
if icon_name ~= "spidertron" then
|
||||
return false
|
||||
end
|
||||
@ -63,11 +64,9 @@ Event.add(defines.events.on_player_deconstructed_area , function(event)
|
||||
if width <= 1 and height <= 1 then
|
||||
local spidertrons = spider_army[player.name]
|
||||
if not spidertrons then
|
||||
player.surface.create_entity {
|
||||
name = 'flying-text',
|
||||
player.create_local_flying_text {
|
||||
text = {'spidertron_group_control.none_selected'},
|
||||
position = left_top,
|
||||
render_player_index = player.index
|
||||
}
|
||||
return
|
||||
end
|
||||
@ -81,11 +80,9 @@ Event.add(defines.events.on_player_deconstructed_area , function(event)
|
||||
spider_army[player.name] = {} -- clear spidertrons from table once they've been assigned to follow another spidey lad
|
||||
cursor_stack.label = "No [img=item.spidertron] selected. Drag the planner over [img=item.spidertron] you own."
|
||||
else
|
||||
player.surface.create_entity {
|
||||
name = 'flying-text',
|
||||
player.create_local_flying_text {
|
||||
text = {'spidertron_group_control.none_found'},
|
||||
position = left_top,
|
||||
render_player_index = player.index
|
||||
}
|
||||
end
|
||||
else -- else the area is bigger than 1x1 and so we assume the player is selecting which spiders to assign
|
||||
@ -115,11 +112,9 @@ Event.add(defines.events.on_player_deconstructed_area , function(event)
|
||||
cursor_stack.label = "Select a group of spidertrons that belong to you! 0 selected."
|
||||
end
|
||||
-- Flying text to appear at top left of selection area showing player how many spidertrons they selected
|
||||
player.surface.create_entity {
|
||||
name = 'flying-text',
|
||||
text = {'spidertron_group_control.spidertrons_selected',#spidertrons_valid},
|
||||
player.create_local_flying_text {
|
||||
text = {'spidertron_group_control.spidertrons_selected', #spidertrons_valid},
|
||||
position = left_top,
|
||||
render_player_index = player.index
|
||||
}
|
||||
end
|
||||
end)
|
||||
|
@ -7,8 +7,8 @@ local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
local train_perk_flag = DonatorPerks.train
|
||||
|
||||
local saviour_token_name = 'player-port' -- item name for what saves players
|
||||
local saviour_entity_token_name = 'player-port' -- entity name for the saviour_token_name, or nil if the item cannot be placed.
|
||||
local saviour_token_name = 'simple-entity-with-owner' -- item name for what saves players
|
||||
local saviour_entity_token_name = 'simple-entity-with-owner' -- entity name for the saviour_token_name, or nil if the item cannot be placed.
|
||||
local saviour_timeout = 180 -- number of ticks players are train immune after getting hit (roughly)
|
||||
|
||||
table.insert(market_items, 3, {
|
||||
@ -30,12 +30,12 @@ local train_types = {['locomotive'] = true, ['cargo-wagon'] = true, ['fluid-wago
|
||||
local function save_player(player)
|
||||
player.character.health = 1
|
||||
|
||||
local pos = player.surface.find_non_colliding_position('character', player.position, 100, 2)
|
||||
local pos = player.physical_surface.find_non_colliding_position('character', player.physical_position, 100, 2)
|
||||
if not pos then
|
||||
return
|
||||
end
|
||||
|
||||
player.teleport(pos, player.surface)
|
||||
player.teleport(pos, player.physical_surface)
|
||||
end
|
||||
|
||||
local function on_pre_death(event)
|
||||
@ -90,7 +90,7 @@ local delay_clear_cursor = Token.register(function(param)
|
||||
end)
|
||||
|
||||
local function built_entity(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
if not entity or not entity.valid then
|
||||
return
|
||||
end
|
||||
@ -108,12 +108,11 @@ local function built_entity(event)
|
||||
|
||||
local index = event.player_index
|
||||
local player = game.get_player(index)
|
||||
local stack = event.stack
|
||||
|
||||
entity.destroy()
|
||||
|
||||
if player and player.valid and not ghost and stack.valid then
|
||||
player.insert(stack)
|
||||
if player and player.valid and not ghost then
|
||||
for _, stack in pairs(event.consumed_items.get_contents()) do
|
||||
player.insert(stack)
|
||||
end
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
Task.set_timeout_in_ticks(1, delay_clear_cursor, {player = player})
|
||||
|
@ -65,7 +65,7 @@ entity_built_callback =
|
||||
)
|
||||
|
||||
local function entity_built(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
|
||||
if not entity.valid then
|
||||
return
|
||||
|
@ -6,7 +6,7 @@ crash_site_restart_abort=Zruší restart crashsite scénáře.
|
||||
dataset_copy=Zkopíruje dataset
|
||||
dataset_move=Přemístí dataset
|
||||
dataset_delete=Smaže dataset
|
||||
dataset_transform=Transformuje dataset a zapíše jej do cílového datasetu. Volá global.transform_function a odešle table zápisů, přičemž očekává table, který se vrátí.
|
||||
dataset_transform=Transformuje dataset a zapíše jej do cílového datasetu. Volá storage.transform_function a odešle table zápisů, přičemž očekává table, který se vrátí.
|
||||
dataset_transform_test=Ukáže výstupní dataset z transform operace. Viz /help dataset-transform pro více informací.
|
||||
report=Nahlásí uživatele správci
|
||||
kill=Zabije vás.
|
||||
|
@ -50,7 +50,7 @@ max_level=(MAX LEVEL)
|
||||
dataset_copy=Copies a dataset
|
||||
dataset_move=Moves a dataset
|
||||
dataset_delete=Deletes a dataset
|
||||
dataset_transform=Transforms a dataset and writes it to the target dataset. Calls global.transform_function and sends the table of entries while expecting a table to return.
|
||||
dataset_transform=Transforms a dataset and writes it to the target dataset. Calls storage.transform_function and sends the table of entries while expecting a table to return.
|
||||
dataset_transform_test=Shows the resulting data set from a transform operation. See /help dataset-transform for more information.
|
||||
report=Reports a user to admins
|
||||
kill=Will kill you.
|
||||
|
@ -157,6 +157,7 @@ player_console_chats=Player console chats
|
||||
player_items_crafted=Player items crafted
|
||||
player_distance_walked=Distance walked
|
||||
satellites_launched=Satellites launched
|
||||
rockets_launched=Rockets launched
|
||||
unknown_death_cause=Unknown
|
||||
|
||||
[cutscene_controller]
|
||||
|
@ -6,7 +6,7 @@ crash_site_restart_abort=Se aborta el reinicio del escenario crashsite.
|
||||
dataset_copy=Copia un conjunto de datos
|
||||
dataset_move=Mueve un conjunto de datos
|
||||
dataset_delete=Borre un conjunto de datos
|
||||
dataset_transform=Transforma un conjunto de datos y lo escribe al conjunto de datos de destino. Llama global.transform_function y envía la tabla de entradas mientras se espera que una tabla retorne.
|
||||
dataset_transform=Transforma un conjunto de datos y lo escribe al conjunto de datos de destino. Llama storage.transform_function y envía la tabla de entradas mientras se espera que una tabla retorne.
|
||||
dataset_transform_test=Muestra el conjunto de datos resultante de una operación de transformación. Vea /help dataset-transform para más información.
|
||||
report=Reporta a un usuario a los administradores
|
||||
kill=Lo matará.
|
||||
|
@ -6,7 +6,7 @@ crash_site_restart_abort=Pysäyttää uudelleen käynnistämisen crashsite senar
|
||||
dataset_copy=Kopio arvosta.
|
||||
dataset_move=Siirrä arvot.
|
||||
dataset_delete=Poista arvot.
|
||||
dataset_transform=Muuntaa tiedot ja kirjoittaa sen kohdetietoaineistoon. Soittaa global.transform_function ja lähettää taulukon merkintöjä odottaen taulukon palaavan.
|
||||
dataset_transform=Muuntaa tiedot ja kirjoittaa sen kohdetietoaineistoon. Soittaa storage.transform_function ja lähettää taulukon merkintöjä odottaen taulukon palaavan.
|
||||
dataset_transform_test=Näyttää muuntotoiminnosta saatavat tiedot. Katso lisätietoja /help dataset-muunnoksesta.
|
||||
report=Ilmoita käyttäjä ylläpitäjälle..
|
||||
kill=Voi tappaa sinut.
|
||||
|
@ -6,7 +6,7 @@ crash_site_restart_abort=Abandonne le redémarrage du scénario site du crash.
|
||||
dataset_copy=Copie un jeu de données
|
||||
dataset_move=Déplace un jeu de données
|
||||
dataset_delete=Efface un jeu de données
|
||||
dataset_transform=Transforme un jeu de données et l'écrit vers le jeu de données cible. Appelle global.transform_function et envoie la table des entrées pour obtenir une table en retour.
|
||||
dataset_transform=Transforme un jeu de données et l'écrit vers le jeu de données cible. Appelle storage.transform_function et envoie la table des entrées pour obtenir une table en retour.
|
||||
dataset_transform_test=Affiche le jeu de données résultant d'une opération de transformation. Voir /help dataset-transformation pour plus d'informations.
|
||||
report=Signale un utilisateur aux administrateurs
|
||||
kill=Vous tuera.
|
||||
|
@ -6,7 +6,7 @@ crash_site_restart_abort=Verlaat de herstart van het neerstort scenario.
|
||||
dataset_copy=Kopieert een dataset
|
||||
dataset_move=Verplaatst een dataset
|
||||
dataset_delete=Verwijdert een dataset
|
||||
dataset_transform=Transformeert een dataset en schrijft het naar de doeldataset. Roept de global.transform_function aan en stuurt de tabel met items en het verwacht dat een tabel weer zal terugkeren.
|
||||
dataset_transform=Transformeert een dataset en schrijft het naar de doeldataset. Roept de storage.transform_function aan en stuurt de tabel met items en het verwacht dat een tabel weer zal terugkeren.
|
||||
dataset_transform_test=Toont de resulterende data die is ingesteld uit een transformerende operatie. Zie /help-dataset-transform voor meer informatie.
|
||||
report=Rapporteert een gebruiker aan beheerders
|
||||
kill=Zal je vermoorden.
|
||||
|
@ -6,7 +6,7 @@ crash_site_restart_abort=Avbryter omstart av crashsite scenario.
|
||||
dataset_copy=Kopierer et datasett
|
||||
dataset_move=Flytter et datasett
|
||||
dataset_delete=Sletter et datasett
|
||||
dataset_transform=Omformer et datasett og skriver det til mål datasettet. Kaller global.transform_function og sender tabellen med oppføringer mens du forventer at en tabell skal returnere.
|
||||
dataset_transform=Omformer et datasett og skriver det til mål datasettet. Kaller storage.transform_function og sender tabellen med oppføringer mens du forventer at en tabell skal returnere.
|
||||
dataset_transform_test=Viser det resulterende datasettet fra en transformasjons operasjon. Se /help dataset-transform for mer informasjon.
|
||||
report=Rapporterer en bruker til admins
|
||||
kill=Vil drepe deg.
|
||||
|
@ -6,7 +6,7 @@ crash_site_restart_abort=Aborda o reinício do cenário de crashsite.
|
||||
dataset_copy=Copia um conjunto de dados
|
||||
dataset_move=Move um conjunto de dados
|
||||
dataset_delete=Excluir um conjunto de dados
|
||||
dataset_transform=Transforma um conjunto de dados e o escreve no conjunto de dados de destino. Chama global.Transform_function e envia a tabela de entradas enquanto esperando uma tabela como retorne.
|
||||
dataset_transform=Transforma um conjunto de dados e o escreve no conjunto de dados de destino. Chama storage.Transform_function e envia a tabela de entradas enquanto esperando uma tabela como retorne.
|
||||
dataset_transform_test=Mostra os dados resultantes de uma operação de transformação. Veja /help dataset-Transforme para mais informações.
|
||||
report=Relatar um usuário para administradores
|
||||
kill=Vai te matar.
|
||||
|
@ -27,7 +27,7 @@ max_level=(МАКС. УРОВЕНЬ)
|
||||
dataset_copy=Скопировать данные
|
||||
dataset_move=Переместить данные
|
||||
dataset_delete=Удалить данные
|
||||
dataset_transform=Преобразует набор данных и записывает его в целевой набор данных. Вызывает global.transform_function и посылает таблицу записей, ожидая возврата.
|
||||
dataset_transform=Преобразует набор данных и записывает его в целевой набор данных. Вызывает storage.transform_function и посылает таблицу записей, ожидая возврата.
|
||||
dataset_transform_test=Показывает результирующий набор данных из операции трансформации. Смотрите /help dataset-transform для получения дополнительной информации.
|
||||
report=Отправляет жалобу на пользователя админам
|
||||
kill=Убивает вас.
|
||||
|
@ -26,7 +26,7 @@ max_level=(МАКС. РІВЕНЬ)
|
||||
dataset_copy=Скопіювати дані
|
||||
dataset_move=Перемістити дані
|
||||
dataset_delete=Видалити дані
|
||||
dataset_transform=Перетворює набір даних і записує його в цільовий набір даних. Викликає global.transform_function і відправляє таблицю записів, чекаючи повернення таблиці.
|
||||
dataset_transform=Перетворює набір даних і записує його в цільовий набір даних. Викликає storage.transform_function і відправляє таблицю записів, чекаючи повернення таблиці.
|
||||
dataset_transform_test=Показує результати результатів, що містять в собі набір даних із операцій перетворення. Змінити/допомогти трансформацію набору даних для отримання додаткової інформації.
|
||||
report=Повідомити адміністратора про порушення
|
||||
kill=Може вбити вас.
|
||||
|
@ -27,7 +27,7 @@ max_level=(最大等级)
|
||||
dataset_copy=复制数据集
|
||||
dataset_move=移动数据集
|
||||
dataset_delete=删除数据集
|
||||
dataset_transform=转换数据集并将其写入目标数据集。调用global.transform_function并发送条目表,同时期望返回一个表。
|
||||
dataset_transform=转换数据集并将其写入目标数据集。调用storage.transform_function并发送条目表,同时期望返回一个表。
|
||||
dataset_transform_test=显示转换操作产生的数据集。请参阅/help dataset-transfer了解更多信息。
|
||||
report=将用户报告给管理员
|
||||
kill=将杀死你。
|
||||
|
@ -15,7 +15,7 @@ local ore_base_amounts = {
|
||||
}
|
||||
|
||||
local function init()
|
||||
global.perlin_noise_seed = RS.get_surface().map_gen_settings.seed
|
||||
storage.perlin_noise_seed = RS.get_surface().map_gen_settings.seed
|
||||
-- math.random(1000, 1000000)
|
||||
end
|
||||
|
||||
@ -47,7 +47,7 @@ return function(x, y, world)
|
||||
end
|
||||
end ]]
|
||||
|
||||
local seed = global.perlin_noise_seed
|
||||
local seed = storage.perlin_noise_seed
|
||||
|
||||
local noise_terrain_1 = perlin.noise(((x + seed) / 350), ((y + seed) / 350), 0)
|
||||
local noise_terrain_2 = perlin.noise(((x + seed) / 50), ((y + seed) / 50), 0)
|
||||
|
@ -7,11 +7,11 @@ local random_dense = {1.6, 0.8, 1, 0.6, 0.5} --ore density reference
|
||||
|
||||
local function run_ores_module_setup()
|
||||
local seed = RS.get_surface().map_gen_settings.seed
|
||||
if not global.ores_seed_A then
|
||||
global.ores_seed_A = seed
|
||||
if not storage.ores_seed_A then
|
||||
storage.ores_seed_A = seed
|
||||
end
|
||||
if not global.ores_seed_B then
|
||||
global.ores_seed_B = seed * 2
|
||||
if not storage.ores_seed_B then
|
||||
storage.ores_seed_B = seed * 2
|
||||
end
|
||||
end
|
||||
|
||||
@ -25,11 +25,11 @@ return function(x, y, world)
|
||||
|
||||
local distance_bonus = 100 + 0.4 * d_sq ^ 2.4 -- d ^ 1.2
|
||||
|
||||
local wiggle = 100 + perlin.noise((x * 0.005), (y * 0.005), global.ores_seed_A + 41) * 60
|
||||
local Ores_A = perlin.noise((x * 0.01), (y * 0.01), global.ores_seed_B + 57) * wiggle
|
||||
local wiggle = 100 + perlin.noise((x * 0.005), (y * 0.005), storage.ores_seed_A + 41) * 60
|
||||
local Ores_A = perlin.noise((x * 0.01), (y * 0.01), storage.ores_seed_B + 57) * wiggle
|
||||
|
||||
if Ores_A > 35 then --we place ores
|
||||
local Ores_B = perlin.noise((x * 0.02), (y * 0.02), global.ores_seed_B + 13) * wiggle
|
||||
local Ores_B = perlin.noise((x * 0.02), (y * 0.02), storage.ores_seed_B + 13) * wiggle
|
||||
local a = 5
|
||||
--
|
||||
if Ores_A < 76 then
|
||||
|
@ -298,9 +298,9 @@ local cities = {
|
||||
}
|
||||
|
||||
local function connect_line(s, e)
|
||||
local bitmap = global.bitmap
|
||||
local bitmap = storage.bitmap
|
||||
for i = s[1], e[1] do
|
||||
if global.bitmap[i] == nil then
|
||||
if storage.bitmap[i] == nil then
|
||||
bitmap[i] = {}
|
||||
end
|
||||
bitmap[i][s[2]] = 1
|
||||
@ -314,7 +314,7 @@ local function connect_line(s, e)
|
||||
end
|
||||
|
||||
local function on_init()
|
||||
global.bitmap = {}
|
||||
storage.bitmap = {}
|
||||
connect_line({6, -8}, {6, 0})
|
||||
connect_line({6, 0}, {11, 0})
|
||||
connect_line({9, 0}, {9, 9})
|
||||
@ -372,7 +372,7 @@ local function build_chunk(origin, dirs)
|
||||
end
|
||||
|
||||
local function is_on_grid(gx, gy)
|
||||
local bitmap = global.bitmap
|
||||
local bitmap = storage.bitmap
|
||||
if bitmap[gx] and bitmap[gx][gy] == 1 then
|
||||
return true
|
||||
else
|
||||
|
@ -3,7 +3,7 @@
|
||||
local Event = require "utils.event"
|
||||
|
||||
local function init()
|
||||
global.resource_cluster_truck = 0
|
||||
storage.resource_cluster_truck = 0
|
||||
end
|
||||
|
||||
Event.on_init(init)
|
||||
@ -20,7 +20,7 @@ return function(_, _, world)
|
||||
if not world.chunk then
|
||||
world.chunk = true
|
||||
|
||||
global.resource_cluster_truck = global.resource_cluster_truck + 1
|
||||
storage.resource_cluster_truck = storage.resource_cluster_truck + 1
|
||||
|
||||
world.ore_spawn = math.random(1, 6)
|
||||
|
||||
@ -33,7 +33,7 @@ return function(_, _, world)
|
||||
world.oil_amount = math.random(10000, 150000)
|
||||
end
|
||||
|
||||
if global.resource_cluster_truck % 2 == 0 then
|
||||
if storage.resource_cluster_truck % 2 == 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,7 @@ local remove = table.remove
|
||||
local insert = table.insert
|
||||
local format = string.format
|
||||
|
||||
local config = global.config
|
||||
local config = storage.config
|
||||
|
||||
local decs_amount = 255 -- Change to make decoratives more "opaque" (Min 0, Max 255)
|
||||
|
||||
@ -109,7 +109,7 @@ if config.market.enabled then
|
||||
local items_to_add = {
|
||||
{name = 'modular-armor', stack_limit = 1, player_limit = 1, price = 50},
|
||||
{name = 'power-armor', stack_limit = 1, player_limit = 1, price = 2000},
|
||||
{name = 'fusion-reactor-equipment', stack_limit = 1, player_limit = 1, price = 300},
|
||||
{name = 'fission-reactor-equipment', stack_limit = 1, player_limit = 1, price = 300},
|
||||
{name = 'energy-shield-equipment', stack_limit = 1, player_limit = 1, price = 350},
|
||||
{name = 'defender-capsule', stack_limit = 25, player_limit = 25, price = 1},
|
||||
{name = 'distractor-capsule', stack_limit = 50, player_limit = 50, price = 10},
|
||||
@ -120,7 +120,6 @@ if config.market.enabled then
|
||||
'tank-machine-gun',
|
||||
'artillery-wagon-cannon',
|
||||
'artillery-turret',
|
||||
'artillery-targeting-remote',
|
||||
'defender-capsule',
|
||||
'destroyer-capsule',
|
||||
'programmable-speaker',
|
||||
|
@ -13,7 +13,7 @@ ScenarioInfo.set_map_extra_info(
|
||||
'Only the native grasses are suitable to build on. Ores and trees have sunk into the sand, but biters have adapted to live happily in the barren landscape. Some even speak of a Hydra living deep within the desert. \n\n Map created by R. Nukem and Jayefuu, with help from grilledham and the rest of the Redmew admin team.'
|
||||
)
|
||||
--enable Hydra
|
||||
local hail_hydra = global.config.hail_hydra
|
||||
local hail_hydra = storage.config.hail_hydra
|
||||
hail_hydra.enabled = true
|
||||
--tweak hydra settings. Defualt settings are WAY too hard (circa 2019-02-22 hydra)
|
||||
--This section will need updated in the future pending changes to how hydra is configured (PR #795)
|
||||
@ -198,7 +198,7 @@ local Event = require 'utils.event'
|
||||
Event.add(
|
||||
defines.events.on_built_entity,
|
||||
function(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
if not entity or not entity.valid then
|
||||
return
|
||||
end
|
||||
@ -232,7 +232,9 @@ Event.add(
|
||||
end
|
||||
entity.destroy()
|
||||
if not ghost then
|
||||
p.insert(event.stack)
|
||||
for _, stack in pairs(event.consumed_items.get_contents()) do
|
||||
p.insert(stack)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,7 +8,7 @@ ScenarioInfo.set_map_description('You are Pinguins in Antarctica!')
|
||||
ScenarioInfo.set_map_extra_info('Watch out for Icebergs!')
|
||||
|
||||
--- Config
|
||||
local config = global.config
|
||||
local config = storage.config
|
||||
config.currency = nil
|
||||
config.market.enabled = false
|
||||
config.player_rewards.enabled = false
|
||||
@ -185,7 +185,7 @@ Command.add(
|
||||
mod.level_reset()
|
||||
end
|
||||
end
|
||||
game.print('Scenario reset!', Color.success)
|
||||
game.print('Scenario reset!', {color = Color.success})
|
||||
end
|
||||
)
|
||||
|
||||
@ -208,9 +208,9 @@ Command.add(
|
||||
msg = msg .. ' - ' .. mod.name
|
||||
end
|
||||
if player and player.valid then
|
||||
player.print(msg, Color.info)
|
||||
player.print(msg, {color = Color.info})
|
||||
else
|
||||
game.print(msg, Color.info)
|
||||
game.print(msg, {color = Color.info})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -231,7 +231,7 @@ Command.add(
|
||||
mod.level_set(mod.max_get())
|
||||
end
|
||||
end
|
||||
game.print('Scenario maxed out!', Color.warning)
|
||||
game.print('Scenario maxed out!', {color = Color.warning})
|
||||
end
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@ ScenarioInfo.set_map_description([[
|
||||
ScenarioInfo.set_map_extra_info('Watch out for Icebergs!')
|
||||
|
||||
--- Config
|
||||
local Config = global.config
|
||||
local Config = storage.config
|
||||
Config.paint.enabled = false
|
||||
Config.redmew_surface.enabled = false
|
||||
Config.currency = 'coin'
|
||||
@ -40,14 +40,12 @@ if _DEBUG then
|
||||
{name = 'iron-plate', count = 26 },
|
||||
{name = 'steel-chest', count = 12},
|
||||
{name = 'power-armor-mk2', count = 1},
|
||||
{name = 'fusion-reactor-equipment', count = 4},
|
||||
{name = 'fission-reactor-equipment', count = 4},
|
||||
{name = 'personal-roboport-mk2-equipment', count = 4},
|
||||
{name = 'battery-mk2-equipment', count = 4},
|
||||
{name = 'construction-robot', count = 50},
|
||||
{name = 'rocket-launcher', count = 1},
|
||||
{name = 'explosive-rocket', count = 200},
|
||||
{name = 'green-wire', count = 200},
|
||||
{name = 'red-wire', count = 200},
|
||||
{name = 'dungeon-support', count = 50},
|
||||
}
|
||||
else
|
||||
@ -283,7 +281,7 @@ Command.add(
|
||||
mod.level_reset()
|
||||
end
|
||||
end
|
||||
game.print('Scenario reset!', Color.success)
|
||||
game.print('Scenario reset!', {color = Color.success})
|
||||
end
|
||||
)
|
||||
|
||||
@ -306,9 +304,9 @@ Command.add(
|
||||
msg = msg .. ' - ' .. mod.name
|
||||
end
|
||||
if player and player.valid then
|
||||
player.print(msg, Color.info)
|
||||
player.print(msg, {color = Color.info})
|
||||
else
|
||||
game.print(msg, Color.info)
|
||||
game.print(msg, {color = Color.info})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -329,7 +327,7 @@ Command.add(
|
||||
mod.level_set(mod.max_get())
|
||||
end
|
||||
end
|
||||
game.print('Scenario maxed out!', Color.warning)
|
||||
game.print('Scenario maxed out!', {color = Color.warning})
|
||||
end
|
||||
)
|
||||
|
||||
|
@ -41,11 +41,11 @@ local function spawn_biters_nearby_players()
|
||||
|
||||
for _, player in pairs(game.players) do
|
||||
if (player and player.valid and _global.alt_biters_players[player.name]) then
|
||||
local position = player.position
|
||||
local position = player.physical_position
|
||||
|
||||
for i=1, UNIT_COUNT do
|
||||
local unit_index = math.random(1, #biters)
|
||||
player.surface.create_entity{
|
||||
player.physical_surface.create_entity{
|
||||
name = biters[unit_index],
|
||||
position = position,
|
||||
force = 'enemy',
|
||||
|
@ -34,7 +34,7 @@ local function change_quickbar_item()
|
||||
local max_attempts = 10
|
||||
while ((max_attempts > 0) and (not valid_item)) do
|
||||
rand_item = Item_list[math.random(1, #Item_list)]
|
||||
valid_item = (game.item_prototypes[rand_item] ~= nil)
|
||||
valid_item = (prototypes.item[rand_item] ~= nil)
|
||||
max_attempts = max_attempts - 1
|
||||
end
|
||||
if valid_item then
|
||||
|
@ -61,7 +61,7 @@ local TURRET_ACTIONS = {
|
||||
}
|
||||
|
||||
local function on_built_turret(event)
|
||||
local entity = event.created_entity
|
||||
local entity = event.entity
|
||||
if not (entity and entity.valid and entity.name) then
|
||||
-- Invalid entity
|
||||
return
|
||||
|
@ -27,7 +27,7 @@ local function damage_afk_players()
|
||||
if player.afk_time > ALLOWED_AFK_TIME then
|
||||
player.character.damage(BASE_DAMAGE * _global.level, 'enemy')
|
||||
if _global.level >= _global.max_level/2 then
|
||||
player.surface.create_entity({name = 'fire-flame', position = player.position})
|
||||
player.physical_surface.create_entity({name = 'fire-flame', position = player.physical_position})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user