Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial split from total automization
- Loading branch information
0 parents
commit 110976e
Showing
53 changed files
with
4,893 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
handler = require("script/event_handler") | ||
names = require("shared") | ||
util = require("script/script_util") | ||
|
||
--error(serpent.block(defines.events)) | ||
|
||
local libs = { | ||
debug = require "script/debug", | ||
auto_request = require("script/auto_request"), | ||
construction_done = require("script/construction_drone"), | ||
freeplay_interface = require("script/freeplay_interface"), | ||
} | ||
|
||
|
||
remote.add_interface("tf", {get = function(func) func(libs) end}) | ||
remote.add_interface("debug", {dump = function() log(serpent.block(global)) end}) | ||
|
||
libs.debug.libs = libs | ||
|
||
local on_event = function(event) | ||
--local tick = game.tick | ||
--log(tick.. " | Control on_event triggered")s | ||
for name, lib in pairs (libs) do | ||
if lib.on_event then | ||
--log(tick.. " | Running on_Event for lib "..name) | ||
lib.on_event(event) | ||
end | ||
end | ||
end | ||
|
||
local register_events = function(libraries) | ||
|
||
local all_events = {} | ||
|
||
for lib_name, lib in pairs (libraries) do | ||
if lib.get_events then | ||
local lib_events = lib.get_events() | ||
for k, handler in pairs (lib_events) do | ||
all_events[k] = all_events[k] or {} | ||
all_events[k][lib_name] = handler | ||
end | ||
else | ||
--error(lib_name.." needs to have a get events function cmon lets be reasonable now ok I know its some boiler plate etc. but its alright its more efficient") | ||
end | ||
end | ||
|
||
for event, handlers in pairs (all_events) do | ||
local action | ||
action = function(event) | ||
for k, handler in pairs (handlers) do | ||
handler(event) | ||
end | ||
end | ||
script.on_event(event, action) | ||
end | ||
|
||
end | ||
|
||
local on_init = function() | ||
--game.speed = settings.startup["game-speed"].value | ||
for name, lib in pairs (libs) do | ||
if lib.on_init then | ||
lib.on_init() | ||
end | ||
end | ||
register_events(libs) | ||
end | ||
|
||
local on_load = function() | ||
for name, lib in pairs (libs) do | ||
if lib.on_load then | ||
lib.on_load() | ||
end | ||
end | ||
register_events(libs) | ||
end | ||
|
||
local on_configuration_changed = function(data) | ||
for name, lib in pairs (libs) do | ||
if lib.on_configuration_changed then | ||
lib.on_configuration_changed(data) | ||
end | ||
end | ||
end | ||
|
||
script.on_init(on_init) | ||
|
||
script.on_load(on_load) | ||
|
||
script.on_configuration_changed(on_configuration_changed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
util = require "data/tf_util/tf_util" | ||
names = require("shared") | ||
require "data/hotkeys" | ||
require "data/units/units" | ||
require "data/entities/entities" | ||
|
||
data.raw["player"]["player"].collision_mask = util.ground_unit_collision_mask() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
local require = function(name) return require("data/entities/"..name) end | ||
require("logistic_beacon/logistic_beacon") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
local name = names.entities.logistic_beacon | ||
local path = util.path("data/entities/logistic_beacon/") | ||
|
||
local beacon = util.copy(data.raw["roboport"]["roboport"]) | ||
beacon.name = name | ||
beacon.localised_name = name | ||
beacon.icon = path.."logistic_beacon_icon.png" | ||
beacon.icon_size = 150 | ||
beacon.energy_source = | ||
{ | ||
type = "void", | ||
usage_priority = "secondary-input", | ||
input_flow_limit = "1J", | ||
buffer_capacity = "1J" | ||
} | ||
beacon.recharge_minimum = "0J" | ||
beacon.energy_usage = "0J" | ||
beacon.charging_energy = "1MW" | ||
beacon.logistics_radius = 3 | ||
beacon.logistics_connection_distance = 16 | ||
beacon.construction_radius = 16 | ||
beacon.charge_approach_distance = 0 | ||
beacon.robot_slots_count = 0 | ||
beacon.material_slots_count = 0 | ||
beacon.stationing_offset = {0, 0} | ||
beacon.charging_offsets = {} | ||
beacon.order = name | ||
beacon.collision_box = {{-0.8, -0.8}, {0.8, 0.8}} | ||
beacon.selection_box = {{-1, -1}, {1, 1}} | ||
beacon.base_animation = | ||
{ | ||
layers = | ||
{ | ||
{ | ||
filename = path.."logistic_beacon.png", | ||
priority = "low", | ||
width = 1104/8, | ||
height = 159, | ||
line_length = 8, | ||
frame_count = 8, | ||
shift = util.by_pixel(1, -16), | ||
animation_speed = 0.5, | ||
scale = 0.5 | ||
} | ||
} | ||
} | ||
beacon.base = util.empty_sprite() | ||
beacon.base_patch = util.empty_sprite() | ||
beacon.door_animation_up = util.empty_sprite() | ||
beacon.door_animation_down = util.empty_sprite() | ||
beacon.minable.result = name | ||
|
||
local item = util.copy(data.raw.item.roboport) | ||
item.name = name | ||
item.localised_name = name | ||
item.place_result = name | ||
item.icon = path.."logistic_beacon_icon.png" | ||
item.icon_size = 150 | ||
item.stack_size = 20 | ||
|
||
local recipe = { | ||
type = "recipe", | ||
name = name, | ||
localised_name = name, | ||
category = data.raw.recipe["roboport"].category, | ||
enabled = false, | ||
ingredients = | ||
{ | ||
{"iron-plate", 15}, | ||
{"iron-gear-wheel", 5}, | ||
{"electronic-circuit", 10}, | ||
}, | ||
energy_required = 1, | ||
result = name | ||
} | ||
|
||
data:extend | ||
{ | ||
beacon, | ||
item, | ||
recipe | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
local hotkeys = names.hotkeys | ||
|
||
local shoo = | ||
{ | ||
type = "custom-input", | ||
name = hotkeys.shoo, | ||
localised_names = hotkeys.shoo, | ||
key_sequence = "SHIFT + ]", | ||
consuming = "game-only" | ||
} | ||
|
||
data:extend | ||
{ | ||
shoo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
data.raw["map-gen-presets"].default["pvp-ribbonworld"] = | ||
{ | ||
order = "aa", | ||
basic_settings = | ||
{ | ||
autoplace_controls = | ||
{ | ||
coal = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
["copper-ore"] = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
["crude-oil"] = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
["uranium-ore"] = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
["iron-ore"] = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
stone = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
trees = | ||
{ | ||
frequency = 5, | ||
richness = 1, | ||
size = 0.1 | ||
}, | ||
}, | ||
terrain_segmentation = 2, | ||
water = 1.4, | ||
starting_area = 2, | ||
height = 16 * 32 | ||
} | ||
} | ||
|
||
data.raw["map-gen-presets"].default["pvp-arena"] = | ||
{ | ||
order = "ab", | ||
basic_settings = | ||
{ | ||
autoplace_controls = | ||
{ | ||
coal = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
["copper-ore"] = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
["crude-oil"] = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
["uranium-ore"] = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
["iron-ore"] = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
stone = | ||
{ | ||
frequency = 3, | ||
size = 0.5, | ||
richness = 2 | ||
}, | ||
trees = | ||
{ | ||
frequency = 5, | ||
richness = 1, | ||
size = 0.1 | ||
}, | ||
}, | ||
terrain_segmentation = 2, | ||
water = 1.4, | ||
starting_area = 1.2, | ||
width = 32 * 48, | ||
height = 32 * 48 | ||
} | ||
} |
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.