0.6.0: module inserter support, artillery turret support, rail block

visualization toggle
This commit is contained in:
Peter 2019-03-29 20:32:01 +08:00
parent 08fd8b76d1
commit eb1e141cd6
16 changed files with 175 additions and 27 deletions

View File

@ -1,47 +1,61 @@
---------------------------------------------------------------------------------------------------
Version: 0.6.0
Date: 2019-03-29
Features:
- Toggle artillery works with artillery turrets now
- Added shortcut for rail block visualization
- Add mod support for module inserter
---------------------------------------------------------------------------------------------------
Version: 0.5.0
Date: 23. 03. 2019
Date: 2019-03-23
Features:
- Add selection tool to disable rail artillery
- Add a shortcut for the tree/rock deconstruction planner
- Customizable tile grid overlay, with adjustable widths & more
- Add a shortcut for the tree/rock deconstruction planner
- Customizable tile grid overlay, with adjustable widths & more
- Add mod support for max rate calculator
Bugfixes:
- Fixed conflict with Nanobots mod. When both are installed the Nanobots mod takes priority over this mod.
---------------------------------------------------------------------------------------------------
Version: 0.4.0
Date: 10. 03. 2019
Date: 2019-03-16
Features:
- Add toggle shortcut for personal-laser-defense
- Add a shortcut for the discharge-defense-remote
- Add mod support for oupost planner, YARM and orbital ion cannon
- Add a shortcut for the discharge-defense-remote
- Add mod support for oupost planner, YARM and orbital ion cannon
Bugfixes:
- Toggle buttons visually work properly
- Using the lamp toggle on a god controller no longer crashes the game
---------------------------------------------------------------------------------------------------
Version: 0.3.0
Date: 10. 03. 2019
Date: 2019-03-10
Features:
- Added distress beacon and ultra zoom button
Bugfixes:
- Fix another equipment grid issue found in playtesting
---------------------------------------------------------------------------------------------------
Version: 0.2.2
Date: 10. 03. 2019
Date: 2019-03-10
Bugfixes:
- Fixed issue with gridless armor
---------------------------------------------------------------------------------------------------
Version: 0.2.1
Date: 09. 03. 2019
Date: 2019-03-09
Bugfixes:
- Fixed issue with the disabled item equipment generation
---------------------------------------------------------------------------------------------------
Version: 0.2.0
Date: 09. 03. 2019
Date: 2019-03-09
Features:
- Added toggle shortcuts for night-vision-equipment, belt-immunity-equipment and the flashlight
---------------------------------------------------------------------------------------------------
Version: 0.1.0
Date: 08. 03. 2019
Date: 2019-03-08
Features:
- Added shortcut for the artillery-targeting-remote
- Added shortcut for the artillery-targeting-remote

View File

@ -65,6 +65,20 @@ local function toggle_light(player)
player.print({"", {"error.error-message-box-title"}, ": ", {"player-doesnt-exist", {"gui.character"}}, " (", {"controller.god"}, "): ", {"entity-name.small-lamp"}, " ", {"gui-mod-info.status-disabled"}})
end
end
local function toggle_rail(player)
if global.toggle_rail[player.index] == nil then
global.toggle_rail[player.index] = false
end
if global.toggle_rail[player.index] == true then
player.game_view_settings.show_rail_block_visualisation = false
global.toggle_rail[player.index] = false
player.set_shortcut_toggled("rail-block-visualization-toggle", false)
elseif global.toggle_rail[player.index] == false then
player.game_view_settings.show_rail_block_visualisation = true
global.toggle_rail[player.index] = true
player.set_shortcut_toggled("rail-block-visualization-toggle", true)
end
end
local function update_inventory(event) -- removes spare remotes
local item_prototypes = game.item_prototypes
@ -86,6 +100,9 @@ local function update_inventory(event) -- removes spare remotes
if item_prototypes["max-rate-calculator"] then
inventory.remove("max-rate-calculator")
end
if item_prototypes["module-inserter"] then
inventory.remove("module-inserter")
end
end
end
@ -167,7 +184,13 @@ end
local function artillery_swap(wagon,new_name)
local shellname = {}
local shellcount = {}
local inventory = table.deepcopy(wagon.get_inventory(defines.inventory.artillery_wagon_ammo))
local inventory
if wagon.type == "artillery-wagon" then
inventory = table.deepcopy(wagon.get_inventory(defines.inventory.artillery_wagon_ammo))
elseif wagon.type == "artillery-turret" then
inventory = table.deepcopy(wagon.get_inventory(defines.inventory.artillery_turret_ammo))
end
for i=1,(#inventory) do
if inventory[i].valid_for_read then
shellname[#shellname+1] = inventory[i].name
@ -207,12 +230,13 @@ local function jam_artillery(event)
local j = 0
for _, wagon in pairs(event.entities) do
local name = wagon.name
if wagon.valid and wagon.type == "artillery-wagon" and not (string.sub(name,1,9) == "disabled-") then
local type = wagon.type
if wagon.valid and (type == "artillery-wagon" or type == "artillery-turret") and not (string.sub(name,1,9) == "disabled-") then
i=i+1
local new_name = ("disabled-" .. name)
local new_wagon = artillery_swap(wagon,new_name)
rendering.draw_sprite{sprite="virtual-signal.signal-disabled", x_scale=1.5, y_scale=1.5, target_offset={0.0,-0.5}, render_layer="entity-info-icon", target=new_wagon, surface=new_wagon.surface, forces={new_wagon.force}}
elseif wagon.valid and wagon.type == "artillery-wagon" and (string.sub(name,1,9) == "disabled-") then
rendering.draw_sprite{sprite="virtual-signal.signal-disabled", x_scale=1.5, y_scale=1.5, target_offset={0.0,-0.5}, render_layer="entity-info-icon-above", target=new_wagon, surface=new_wagon.surface, forces={new_wagon.force}}
elseif wagon.valid and (type == "artillery-wagon" or type == "artillery-turret") and (string.sub(name,1,9) == "disabled-") then
j=j+1
local new_name = (string.sub(name,10,#name))
artillery_swap(wagon,new_name)
@ -220,11 +244,11 @@ local function jam_artillery(event)
end
if game.is_multiplayer() == true then
if i ~= 0 and j == 0 then
player.force.print("Player " .. player.name .. " on surface " .. player.surface.name .. " has disabled " .. i .. " artillery wagons")
player.force.print("Player " .. player.name .. " on surface " .. player.surface.name .. " has disabled " .. i .. " artillery")
elseif i == 0 and j ~= 0 then
player.force.print("Player " .. player.name .. " on surface " .. player.surface.name .. " has enabled " .. j .. " artillery wagons")
player.force.print("Player " .. player.name .. " on surface " .. player.surface.name .. " has enabled " .. j .. " artillery")
elseif i ~= 0 and j ~= 0 then
player.force.print("Player " .. player.name .. " on surface " .. player.surface.name .. " has enabled " .. j .. " and disabled " .. i .. " artillery wagons")
player.force.print("Player " .. player.name .. " on surface " .. player.surface.name .. " has enabled " .. j .. " and disabled " .. i .. " artillery")
end
end
end
@ -303,6 +327,9 @@ local function initialize()
if global.shortcuts_light == nil then
global.shortcuts_light = {}
end
if global.toggle_rail == nil then
global.toggle_rail = {}
end
if global.shortcuts_armor == nil then
global.shortcuts_armor = {}
end
@ -360,6 +387,8 @@ local function shortcut_type(event)
end
elseif prototype_name == "flashlight-toggle" then
toggle_light(game.players[event.player_index])
elseif prototype_name == "rail-block-visualization-toggle" then
toggle_rail(game.players[event.player_index])
elseif prototype_name == "signal-flare" then
local player = game.players[event.player_index]
if settings.global["disable-zoom"].value == true then
@ -376,8 +405,9 @@ script.on_event(defines.events.on_player_main_inventory_changed, update_inventor
script.on_event(defines.events.on_player_created, function(event)
local player = game.players[event.player_index]
player.set_shortcut_toggled("flashlight-toggle", true)
player.set_shortcut_toggled("rail-block-visualization-toggle", false)
if not game.active_mods["Nanobots"] then
player.set_shortcut_toggled("flashlight-toggle", true)
player.set_shortcut_available("night-vision-equipment", false)
player.set_shortcut_available("belt-immunity-equipment", false)
player.set_shortcut_available("active-defense-equipment", false)

View File

@ -111,9 +111,15 @@ data:extend({
local disabled_turret = {}
local disabled_turret_item = {}
local disabled_gun = {}
local disable_turret_list = {
"artillery-wagon",
}
local disable_turret_list = {}
if settings.startup["artillery-toggle"].value == "both" then
disable_turret_list = {"artillery-wagon", "artillery-turret",}
elseif settings.startup["artillery-toggle"].value == "artillery-wagon" then
disable_turret_list = {"artillery-wagon"}
elseif settings.startup["artillery-toggle"].value == "artillery-turret" then
disable_turret_list = {"artillery-turret"}
end
for i=1,(#disable_turret_list) do
for _, entity in pairs(data.raw[disable_turret_list[i]]) do
@ -122,6 +128,9 @@ for i=1,(#disable_turret_list) do
local name = disabled_turret[i].name
local gun = disabled_turret[i].gun
disabled_turret_item[i] = util.table.deepcopy(data.raw["item-with-entity-data"][name])
if disabled_turret_item[i] == nil then
disabled_turret_item[i] = util.table.deepcopy(data.raw["item"][name])
end
if disabled_turret_item[i] == nil then
disabled_turret_item[i] = util.table.deepcopy(data.raw["item-with-entity-data"]["artillery-wagon"])
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

View File

@ -1,10 +1,10 @@
{
"name": "Shortcuts",
"version": "0.5.0",
"version": "0.6.0",
"factorio_version": "0.17",
"title": "Shortcuts",
"author": "npc_strider(morley376)",
"contact": "",
"homepage": "http://steamcommunity.com/id/morley376",
"description": "Adds a host of useful shortcuts to improve QOL. Shortcuts for the artillery remote, discharge defense remote, tree deconstructor, and toggles for equipment and the player lamp. Additionally adds in a customizable grid overlay, far zoom and a artillery wagon toggle. Mod support for YARM, orbital ion cannon, outpost planner and max rate calculator. Suggest any new shortcut ideas to the discussion page."
"description": "Adds a host of useful shortcuts to improve QOL. Shortcuts for the artillery remote, discharge defense remote, tree deconstructor, and toggles for equipment, rail blocks and the player lamp. Additionally adds in a customizable grid overlay, far zoom and a artillery wagon toggle. Mod support for module inserter, orbital ion cannon, outpost planner and max rate calculator. Suggest any new shortcut ideas to the discussion page."
}

View File

@ -70,5 +70,15 @@ data:extend({
localised_name = {"", {"gui-control-behavior-modes.enable-disable"}, " ", {"technology-name.military"}, " ", {"entity-name.beacon"}},
setting_type = "runtime-global",
default_value = true,
},
--startup
{
type = "string-setting",
name = "artillery-toggle",
localised_name = {"", {"item-name.artillery-wagon-cannon"}, " ", {"gui-mod-info.toggle"}, " ", {"description.decorative-type"}},
setting_type = "startup",
allowed_values = {"both", "artillery-wagon", "artillery-turret"},
default_value = "both"
}
})

View File

@ -1,3 +1,13 @@
local disable_turret_list = {}
if settings.startup["artillery-toggle"].value == "both" then
disable_turret_list = {"artillery-wagon", "artillery-turret",}
elseif settings.startup["artillery-toggle"].value == "artillery-wagon" then
disable_turret_list = {"artillery-wagon"}
elseif settings.startup["artillery-toggle"].value == "artillery-turret" then
disable_turret_list = {"artillery-turret"}
end
data:extend(
{
-- for the artillery toggle
@ -17,11 +27,11 @@ data:extend(
alt_selection_mode = {"blueprint"},
selection_cursor_box_type = "copy",
alt_selection_cursor_box_type = "copy",
entity_type_filters = {"artillery-wagon"},
entity_type_filters = disable_turret_list,
tile_filters = {"lab-dark-1"},
entity_filter_mode = "whitelist",
tile_filter_mode = "whitelist",
alt_entity_type_filters = {"artillery-wagon"},
alt_entity_type_filters = disable_turret_list,
alt_tile_filters = {"lab-dark-1"},
alt_entity_filter_mode = "whitelist",
alt_tile_filter_mode = "whitelist",
@ -96,6 +106,40 @@ data:extend(
flags = {"icon"}
},
},
{
type = "shortcut",
name = "rail-block-visualization-toggle",
order = "a[rail-block-visualization-toggle]",
action = "lua",
localised_name = {"gui-interface-settings.show-rail-block-visualization"},
style = "default",
technology_to_unlock = "railway",
toggleable = true,
icon =
{
filename = "__Shortcuts__/graphics/rail-block-visualization-toggle-x32.png",
priority = "extra-high-no-scale",
size = 32,
scale = 1,
flags = {"icon"}
},
small_icon =
{
filename = "__Shortcuts__/graphics/rail-block-visualization-toggle-x24.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
disabled_small_icon =
{
filename = "__Shortcuts__/graphics/rail-block-visualization-toggle-x24-white.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
},
{
type = "shortcut",
name = "artillery-jammer-remote",
@ -308,6 +352,7 @@ data:extend(
-- }
})
-- legacy for older version of YARM (newer versions have the shortcut built in)
if mods["YARM"] and data.raw["item"]["resource-monitor"] and data.raw["technology"]["resource-monitoring"] then
data:extend(
{
@ -467,6 +512,46 @@ data:extend(
})
end
if mods["ModuleInserter"] and data.raw["selection-tool"]["module-inserter"] then
data:extend(
{
{
type = "shortcut",
name = "module-inserter",
order = "a[module-inserter]",
action = "create-blueprint-item",
localised_name = {"item-name.module-inserter"},
item_to_create = "module-inserter",
technology_to_unlock = "modules",
style = "blue",
icon =
{
filename = "__Shortcuts__/graphics/module-inserter-x32-white.png",
priority = "extra-high-no-scale",
size = 32,
scale = 1,
flags = {"icon"}
},
small_icon =
{
filename = "__Shortcuts__/graphics/module-inserter-x24.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
disabled_small_icon =
{
filename = "__Shortcuts__/graphics/module-inserter-x24-white.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
}
})
end
if not mods["Nanobots"] then
data:extend(
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 19 KiB

BIN
image5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB