generated from fgardt/factorio-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added automatic portal deployment via https://github.com/fgardt…
- Loading branch information
1 parent
2881236
commit ce9c8b0
Showing
33 changed files
with
323 additions
and
10 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
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,47 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
Version: 1.1.6 | ||
Date: 9/4/20 | ||
Features: | ||
- Add seablock compatibality | ||
--------------------------------------------------------------------------------------------------- | ||
Version: 1.1.5 | ||
Date: 2020-07-13 | ||
Bugfixes: | ||
- Fixed error with Nauvis Day | ||
--------------------------------------------------------------------------------------------------- | ||
Version: 1.1.3 | ||
Date: 2020-06-29 | ||
Bugfixes: | ||
- Breaking platforms now gives the correct item | ||
--------------------------------------------------------------------------------------------------- | ||
Version: 1.1.2 | ||
Date: 2020-06-25 | ||
Changes: | ||
- Added setting to not replace landfill | ||
Bugfixes: | ||
- Landfill sprite is applied in final-fixes | ||
--------------------------------------------------------------------------------------------------- | ||
Version: 1.1.1 | ||
Date: 2020-06-25 | ||
Bugfixes: | ||
- Now overrites landfill technology instead of removing it | ||
- Teleporters compatibality | ||
--------------------------------------------------------------------------------------------------- | ||
Version: 1.1.0 | ||
Date: 2020-06-24 | ||
Major Changes: | ||
- Landfill is now replaced with platforms | ||
Bugfixes: | ||
- You can now stack platforms under other tiles | ||
- Tile ghosts no longer bug out the platforms | ||
- Deconstructing blueprint ghosts when they are over platforms no longer makes them unbreakable | ||
- You can no longer void things using platforms | ||
Changes: | ||
- Platforms now have a map color | ||
- Platforms take 3x as long to mine | ||
--------------------------------------------------------------------------------------------------- | ||
Version: 1.0.0 | ||
Date: 2020-06-22 | ||
Changes: | ||
- Update to .18 | ||
- Added (stole) spanish translation |
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,107 @@ | ||
local ceil = math.ceil | ||
|
||
local normal = settings.startup['replace-landfill'].value and 'landfill' or 'platform' | ||
local unbreakable = 'unbreakable-' .. normal | ||
|
||
script.on_event({defines.events.on_built_entity, defines.events.on_robot_built_entity}, function(event) | ||
local entity = event.created_entity | ||
|
||
if entity.type == 'tile-ghost' or entity.has_flag('placeable-off-grid') or entity.type == 'curved-rail' then return end | ||
|
||
local position = entity.position | ||
local surface = entity.surface | ||
|
||
local selection_box = entity.selection_box | ||
local top_left_x = ceil(selection_box.left_top.x * 2) / 2 | ||
local top_left_y = ceil(selection_box.left_top.y * 2) / 2 | ||
local right_bottom_x = ceil(selection_box.right_bottom.x * 2) / 2 | ||
local right_bottom_y = ceil(selection_box.right_bottom.y * 2) / 2 | ||
|
||
if top_left_x == right_bottom_x or top_left_y == right_bottom_y then return end | ||
|
||
local tiles = {} | ||
|
||
for _, tile in pairs(surface.find_tiles_filtered{area = {{top_left_x, top_left_y}, {right_bottom_x, right_bottom_y}}, name = normal}) do | ||
tiles[#tiles + 1] = {name = unbreakable, position = tile.position} | ||
end | ||
|
||
if tiles then surface.set_tiles(tiles) end | ||
end) | ||
|
||
local function on_destroy(event) | ||
local entity = event.entity | ||
|
||
if entity.type == 'tile-ghost' or entity.has_flag('placeable-off-grid') or entity.type == 'curved-rail' then return end | ||
|
||
local position = entity.position | ||
local surface = entity.surface | ||
|
||
local selection_box = entity.selection_box | ||
local top_left_x = ceil(selection_box.left_top.x * 2) / 2 | ||
local top_left_y = ceil(selection_box.left_top.y * 2) / 2 | ||
local right_bottom_x = ceil(selection_box.right_bottom.x * 2) / 2 | ||
local right_bottom_y = ceil(selection_box.right_bottom.y * 2) / 2 | ||
|
||
if top_left_x == right_bottom_x or top_left_y == right_bottom_y then return end | ||
|
||
local water_tiles = {} | ||
local ground_tiles = {} | ||
|
||
for _, tile in pairs(surface.find_tiles_filtered{area = {{top_left_x, top_left_y}, {right_bottom_x, right_bottom_y}}, name = unbreakable}) do | ||
local tile_position = tile.position | ||
water_tiles[#water_tiles + 1] = {name = 'water', position = tile_position} | ||
ground_tiles[#ground_tiles + 1] = {name = normal, position = tile_position} | ||
end | ||
|
||
surface.set_tiles(water_tiles, false, false, false, false) | ||
surface.set_tiles(ground_tiles) | ||
end | ||
|
||
script.on_event({defines.events.on_player_mined_entity, defines.events.on_robot_mined_entity, defines.events.on_entity_died, defines.events.script_raised_destroy}, on_destroy) | ||
script.on_event({defines.events.on_pre_ghost_deconstructed}, function(event) on_destroy{entity = event.ghost} end) | ||
|
||
script.on_event({defines.events.on_player_built_tile, defines.events.on_robot_built_tile}, function(event) | ||
if event.tile.name == normal then return end | ||
|
||
local surface = game.surfaces[event.surface_index] | ||
|
||
local tiles = {} | ||
local change_count = 0 | ||
|
||
for _, tile in pairs(event.tiles) do | ||
if tile.old_tile.name == normal then | ||
tiles[#tiles + 1] = {name = unbreakable, position = tile.position} | ||
tiles[#tiles + 1] = {name = event.tile.name, position = tile.position} | ||
change_count = change_count + 1 | ||
end | ||
end | ||
|
||
if change_count ~= 0 then | ||
surface.set_tiles(tiles) | ||
local entity = event.robot or game.players[event.player_index] | ||
entity.remove_item{name = normal, count = change_count} | ||
end | ||
end) | ||
|
||
script.on_event({defines.events.on_player_mined_tile, defines.events.on_robot_mined_tile}, function(event) | ||
local surface = game.surfaces[event.surface_index] | ||
|
||
for _, tile in pairs(event.tiles) do | ||
if tile.old_tile.name ~= normal then | ||
local tile_position = tile.position | ||
if surface.get_tile(tile_position).name == unbreakable then | ||
local place = true | ||
for _, entity in pairs(surface.find_entities{tile_position, {tile_position.x + 1, tile_position.y + 1}}) do | ||
if entity.has_flag('placeable-player') and entity.tags == nil and entity.type ~= 'tile-ghost' and not entity.has_flag('placeable-off-grid') and entity.type ~= 'curved-rail' then | ||
place = false | ||
break | ||
end | ||
end | ||
if place then | ||
surface.set_tiles({{name = 'water', position = tile_position}}, false, false, false, false) | ||
surface.set_tiles({{name = normal, position = tile_position}}) | ||
end | ||
end | ||
end | ||
end | ||
end) |
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,16 @@ | ||
local prefix = settings.startup['replace-landfill'].value and 'landfill' or 'platform' | ||
local technology = data.raw.technology[prefix] | ||
local item = data.raw.item[prefix] | ||
|
||
if prefix == 'landfill' then | ||
for _, v in ipairs(technology.effects) do | ||
if v.type == 'unlock-recipe' and v.recipe == 'landfill' then | ||
goto included | ||
end | ||
end | ||
technology.effects[#technology.effects + 1] = {type='unlock-recipe', recipe='landfill'} | ||
::included:: | ||
|
||
item.icon = '__platforms__/graphics/icons/platform.png' | ||
item.icon_size = 32 | ||
end |
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,74 @@ | ||
local theme = string.lower(settings.startup['platform-theme'].value) | ||
local prefix = settings.startup['replace-landfill'].value and 'landfill' or 'platform' | ||
|
||
local platform = table.deepcopy(data.raw.tile['stone-path']) | ||
platform.name = prefix | ||
platform.localised_name = {'tile-name.platform'} | ||
platform.minable.result = prefix | ||
platform.minable.mining_time = platform.minable.mining_time * 3 | ||
for i = 1, 3 do | ||
platform.variants.main[i].hr_version.picture = '__platforms__/graphics/terrain/hr-platform-' .. i .. '-' .. theme .. '.png' | ||
platform.variants.main[i].picture = '__platforms__/graphics/terrain/platform-' .. i .. '-' .. theme .. '.png' | ||
platform.variants.main[i].count = 1 | ||
platform.variants.main[i].hr_version.count = 1 | ||
end | ||
platform.variants.inner_corner.hr_version.picture = '__platforms__/graphics/terrain/hr-platform-inner-corner-' .. theme .. '.png' | ||
platform.variants.inner_corner.picture = '__platforms__/graphics/terrain/platform-inner-corner-' .. theme .. '.png' | ||
platform.variants.side.hr_version.picture = '__platforms__/graphics/terrain/hr-platform-side-' .. theme .. '.png' | ||
platform.variants.side.picture = '__platforms__/graphics/terrain/platform-side-' .. theme .. '.png' | ||
platform.can_be_part_of_blueprint = true | ||
platform.autoplace = nil | ||
platform.map_color = {r = 0.3, b = 0.32, g = 0.3} | ||
|
||
local immortal_platform = table.deepcopy(platform) | ||
immortal_platform.name = 'unbreakable-' .. prefix | ||
immortal_platform.minable = nil | ||
|
||
local technology = table.deepcopy(data.raw.technology['landfill']) | ||
technology.name = prefix | ||
technology.icon = '__platforms__/graphics/icons/platform-technology.png' | ||
technology.icon_size = 128 | ||
technology.localised_name = {'technology-name.platform'} | ||
technology.localised_description = {'technology-description.platform'} | ||
if prefix == 'platform' then | ||
technology.prerequisites = {'stone-wall', 'landfill'} | ||
technology.effects = {{type = 'unlock-recipe', recipe = 'platform'}} | ||
else | ||
technology.prerequisites[#technology.prerequisites + 1] = 'stone-wall' | ||
end | ||
|
||
data:extend{ | ||
{ | ||
type = 'recipe', | ||
name = prefix, | ||
enabled = data.raw.recipe['landfill'].enabled, | ||
energy_required = data.raw.recipe['landfill'].energy_required, | ||
ingredients = { | ||
{'iron-stick', 4}, | ||
{'steel-plate', 2}, | ||
{'stone-brick', 6} | ||
}, | ||
result = prefix | ||
}, | ||
{ | ||
icon = '__platforms__/graphics/icons/platform.png', | ||
icon_size = 32, | ||
name = prefix, | ||
order = data.raw.item['landfill'].order, | ||
place_as_tile = {condition = {'ground-tile'}, condition_size = 1, result = prefix}, | ||
stack_size = 1000, | ||
subgroup = 'terrain', | ||
type = 'item', | ||
localised_name = {'item-name.platform'} | ||
}, | ||
platform, | ||
immortal_platform, | ||
technology | ||
} | ||
|
||
if mods.SeaBlock then | ||
data.raw.recipe[prefix].enabled = true | ||
if prefix == platform then | ||
data.raw.technology[prefix] = nil | ||
end | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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 |
---|---|---|
@@ -1,12 +1,15 @@ | ||
{ | ||
"name": "[internal-mod-name]", | ||
"version": "0.0.0", | ||
"title": "[MOD DISPLAY NAME]", | ||
"author": "[YOUR MODS.FACTORIO.COM USERNAME]", | ||
"homepage": "[HOMEPAGE/REPO URL]", | ||
"description": "[SHORT DESCRIPTION]", | ||
"name": "platforms", | ||
"version": "1.1.7", | ||
"title": "Platforms", | ||
"author": "notnotmelon, kaueNP", | ||
"homepage": "https://github.com/notnotmelon/platforms", | ||
"description": "Allows you and your robots to build platforms. Platforms are placed on water, and act like landfill except that you can destroy platforms later to reclaim water tiles. They can also be put into a blueprint. Graphics from kaueNP.", | ||
"factorio_version": "1.1", | ||
"dependencies": [ | ||
"base" | ||
"base", | ||
"? SeaBlock", | ||
"(?) Teleporters", | ||
"(?) NauvisDay" | ||
] | ||
} |
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 |
---|---|---|
@@ -1,5 +1,25 @@ | ||
[mod-name] | ||
title=YOUR MOD TITLE | ||
platforms=Platforms | ||
|
||
[mod-description] | ||
description=YOUR MOD DESCRIPTION | ||
platforms=Allows you and your robots to build platforms. Platforms are placed on water, and act like landfill except that you can destroy platforms later to reclaim water tiles. They can also be put into a blueprint. Graphics from kaueNP. | ||
|
||
[item-name] | ||
platform=Platform | ||
|
||
[tile-name] | ||
platform=a floating platform | ||
|
||
[mod-setting-name] | ||
platform-theme=Platform theme | ||
replace-landfill=Replace landfill | ||
|
||
[mod-setting-description] | ||
platform-theme=Change the graphic style of your platforms.\nBrick: A tilable texture similar to the stone bricks from minecraft.\nGrid: A group of cobblestones enclosed in a paved border. | ||
replace-landfill=This mod replaces landfill with platforms by default. Use this setting to add landfill back to your game. | ||
|
||
[technology-name] | ||
platform=Platforms | ||
|
||
[technology-description] | ||
platform=Replaces water with land. Can be destroyed later |
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,19 @@ | ||
[item-name] | ||
platform=Platforma | ||
|
||
[tile-name] | ||
platform=una plataforma removible | ||
|
||
[mod-setting-name] | ||
platform-theme=Tema de la plataforma | ||
replace-landfill=Replace landfill | ||
|
||
[mod-setting-description] | ||
platform-theme=Cambia el estilo grafico de las plataformas.\nBrick: Una textura similar al de los ladrillos de piedra de from minecraft.\nGrid: Un grurpo de adoquines envueltos en un borde. | ||
replace-landfill=This mod replaces landfill with platforms by default. Use this setting to add landfill back to your game. | ||
|
||
[technology-name] | ||
platform=Platformas removibles | ||
|
||
[technology-description] | ||
platform=Plataformas removibles que permiten construir sobre agua, y despues permiten ser removidas. |
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,12 @@ | ||
{ | ||
"tile": [ | ||
["micromario-platform", "landfill"], | ||
["micromario-immortal-platform", "unbreakable-landfill"] | ||
], | ||
"item": [ | ||
["platform", "landfill"] | ||
], | ||
"recipe": [ | ||
["platform", "landfill"] | ||
] | ||
} |
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 @@ | ||
data:extend{ | ||
{ | ||
type = 'string-setting', | ||
name = 'platform-theme', | ||
setting_type = 'startup', | ||
default_value = 'Grid', | ||
allowed_values = {'Brick', 'Grid'} | ||
}, | ||
{ | ||
type = 'bool-setting', | ||
name = 'replace-landfill', | ||
setting_type = 'startup', | ||
default_value = true | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.