Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rocket Launch Setting #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Teleporters",
"version": "1.0.5",
"version": "1.0.6",
"title": "Teleporters",
"author": "Klonan",
"contact": "",
Expand Down
6 changes: 5 additions & 1 deletion locale/en/teleporters.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ name-teleporter=Name teleporter
teleporter-network=Teleporter network
cant-add-tag=You can not add a chart tag with the teleporter icon.
cant-change-icon=You can not modify a teleporter chart tags icon.
search=__CONTROL__focus-search__
search=__CONTROL__focus-search__
[mod-setting-name]
teleporters-rockets-generate-new-surfaces=Launching rockets generated new surfaces
[mod-setting-description]
teleporters-rockets-generate-new-surfaces=Enabling this will generate a new surface with random ore settings (therefore not balanced) and place a teleporter on said surface when a rocket is launched.
8 changes: 6 additions & 2 deletions script/teleporters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ local make_teleporter_gui = function(player, source)
end

table.sort(sorted, function(a, b)
if recent[a.unit_number] and recent[b.unit_number] then
if recent[a.unit_number] and recent[b.unit_number] then
return recent[a.unit_number] > recent[b.unit_number]
end

Expand Down Expand Up @@ -780,10 +780,14 @@ teleporters.events =
[defines.events.on_chart_tag_added] = on_chart_tag_added,

[defines.events.on_trigger_created_entity] = on_trigger_created_entity,
[defines.events.on_rocket_launched] = on_rocket_launched
-- [defines.events.on_rocket_launched] = on_rocket_launched

}

if settings.startup["teleporters-rockets-generate-new-surfaces"].value then
teleporters.events[defines.events.on_rocket_launched] = on_rocket_launched
end

teleporters.on_init = function()
global.teleporters = global.teleporters or data
end
Expand Down
8 changes: 8 additions & 0 deletions settings.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

local rockets_generate_new_surfaces = {
type = "bool-setting",
name = "teleporters-rockets-generate-new-surfaces",
setting_type = "startup",
default_value = false
}
data:extend{rockets_generate_new_surfaces}