0.7.0: AAI support, autogen shortcuts.

See changelog.txt for rest of changes
This commit is contained in:
Peter 2019-04-14 15:16:32 +08:00
parent eb1e141cd6
commit 1321b3aadd
15 changed files with 1244 additions and 775 deletions

21
LICENSE.txt Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 npc_strider
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,3 +1,16 @@
---------------------------------------------------------------------------------------------------
Version: 0.7.0
Date: 2019-04-14
Features:
- Add mod support for AAI vehicles
- Ability to selectively disable/enable individaul settings from mod settings startup panel
- Dynamically generate shortcuts for any selection-tool
- Make use of "only-in-cursor" flag and remove relevant scripts (Should offer an insignificant performance boost when opening inventory)
- Added LICENSE.txt
Bugfixes:
- Add hidden flag (not property!) to automatically generated 'disabled' items (artillery and equipment)
- Fixed startup crash with technologies containing modded recipe effects
---------------------------------------------------------------------------------------------------
Version: 0.6.0
Date: 2019-03-29

View File

@ -80,40 +80,54 @@ local function toggle_rail(player)
end
end
local function update_inventory(event) -- removes spare remotes
local item_prototypes = game.item_prototypes
local inventory = game.players[event.player_index].get_inventory(defines.inventory.player_main)
if inventory and inventory.valid then
inventory.remove("artillery-targeting-remote")
inventory.remove("artillery-jammer-tool")
inventory.remove("discharge-defense-remote")
inventory.remove("shortcuts-deconstruction-planner")
if item_prototypes["resource-monitor"] then
inventory.remove("resource-monitor")
end
if item_prototypes["outpost-builder"] then
inventory.remove("outpost-builder")
end
if item_prototypes["ion-cannon-targeter"] then
inventory.remove("ion-cannon-targeter")
end
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
-- local function update_inventory(event) -- removes spare remotes
-- local item_prototypes = game.item_prototypes
-- local inventory = game.players[event.player_index].get_inventory(defines.inventory.player_main)
-- if inventory and inventory.valid then
-- if settings.startup["artillery-targeting-remote"].value == true then
-- inventory.remove("artillery-targeting-remote")
-- end
-- if settings.startup["artillery-jammer-remote"].value == true then
-- inventory.remove("artillery-jammer-tool")
-- end
-- if settings.startup["discharge-defense-remote"].value == true then
-- inventory.remove("discharge-defense-remote")
-- end
-- if settings.startup["tree-killer"].value == true then
-- inventory.remove("shortcuts-deconstruction-planner")
-- end
-- if item_prototypes["resource-monitor"] and settings.startup["resource-monitor"].value == true then
-- inventory.remove("resource-monitor")
-- end
-- if item_prototypes["outpost-builder"] and settings.startup["outpost-builder"].value == true then
-- inventory.remove("outpost-builder")
-- end
-- if item_prototypes["ion-cannon-targeter"] and settings.startup["ion-cannon-targeter"].value == true then
-- inventory.remove("ion-cannon-targeter")
-- end
-- if item_prototypes["max-rate-calculator"] and settings.startup["max-rate-calculator"].value == true then
-- inventory.remove("max-rate-calculator")
-- end
-- if item_prototypes["module-inserter"] and settings.startup["module-inserter"].value == true then
-- inventory.remove("module-inserter")
-- end
-- end
-- end
local function false_shortcuts(player) -- disables things
if settings.startup["night-vision-equipment"].value == true then
player.set_shortcut_available("night-vision-equipment", false)
player.set_shortcut_toggled("night-vision-equipment", false)
player.set_shortcut_available("belt-immunity-equipment", false)
player.set_shortcut_toggled("belt-immunity-equipment", false)
end
if settings.startup["active-defense-equipment"].value == true then
player.set_shortcut_available("active-defense-equipment", false)
player.set_shortcut_toggled("active-defense-equipment", false)
end
if settings.startup["belt-immunity-equipment"].value == true then
player.set_shortcut_available("belt-immunity-equipment", false)
player.set_shortcut_toggled("belt-immunity-equipment", false)
end
end
local function enable_it(player, equipment, grid, type) -- enables things
if grid.valid and equipment.valid then
@ -401,16 +415,26 @@ end
script.on_event(defines.events.on_lua_shortcut, shortcut_type)
script.on_event(defines.events.on_player_main_inventory_changed, update_inventory)
-- script.on_event(defines.events.on_player_main_inventory_changed, update_inventory)
script.on_event(defines.events.on_player_created, function(event)
local player = game.players[event.player_index]
if settings.startup["flashlight-toggle"].value == true then
player.set_shortcut_toggled("flashlight-toggle", true)
end
if settings.startup["rail-block-visualization-toggle"].value == true then
player.set_shortcut_toggled("rail-block-visualization-toggle", false)
end
if not game.active_mods["Nanobots"] then
if settings.startup["night-vision-equipment"].value == true then
player.set_shortcut_available("night-vision-equipment", false)
player.set_shortcut_available("belt-immunity-equipment", false)
end
if settings.startup["active-defense-equipment"].value == true then
player.set_shortcut_available("active-defense-equipment", false)
end
if settings.startup["belt-immunity-equipment"].value == true then
player.set_shortcut_available("belt-immunity-equipment", false)
end
else
player.print("WARNING: Shortcuts for modular equipment disabled as Nanobots is installed")
player.print("> Use the Nanobots hotkeys instead: \"Ctrl F1 - F7 Will toggle specific modular armor equipment on or off\"")

View File

@ -1,42 +1,74 @@
require("shortcuts")
local function hide_the_remote(recipe, technology)
data.raw["recipe"][recipe].hidden = true
data.raw["recipe"][recipe].ingredients ={{"iron-plate", 1}}
if technology ~= nil then
local effect = data.raw["technology"][technology].effects
local function hide_the_remote(recipe, technology, item)
if item then
if item.flags then
item.flags[#item.flags+1] = "only-in-cursor"
else
item.flags = {"only-in-cursor"}
end
end
local recipe_prototype = data.raw["recipe"][recipe]
local tech_prototype = data.raw["technology"][technology]
if recipe_prototype then
recipe_prototype.hidden = true
recipe_prototype.ingredients ={{"iron-plate", 1}}
if technology ~= nil and tech_prototype then
local effect = tech_prototype.effects
for i=1,(#effect) do
if effect[i].type == "unlock-recipe" then
if effect[i].recipe == recipe then
table.remove(effect, i)
return
end
end
end
end
end
end
hide_the_remote("artillery-targeting-remote", "artillery")
hide_the_remote("discharge-defense-remote", "discharge-defense-equipment")
if mods["YARM"] and data.raw["item"]["resource-monitor"] and data.raw["technology"]["resource-monitoring"] then
hide_the_remote("resource-monitor", "resource-monitoring")
if settings.startup["artillery-targeting-remote"].value == true then
hide_the_remote("artillery-targeting-remote", "artillery", data.raw["capsule"]["artillery-targeting-remote"])
end
if mods["OutpostPlanner"] and mods["PlannerCore"] and data.raw["selection-tool"]["outpost-builder"] then
hide_the_remote("outpost-builder", nil)
if settings.startup["discharge-defense-remote"].value == true then
hide_the_remote("discharge-defense-remote", "discharge-defense-equipment", data.raw["capsule"]["discharge-defense-remote"])
end
if mods["YARM"] and data.raw["item"]["resource-monitor"] and data.raw["technology"]["resource-monitoring"] and settings.startup["resource-monitor"].value == true then
hide_the_remote("resource-monitor", "resource-monitoring", data.raw["item"]["resource-monitor"])
end
if mods["OutpostPlanner"] and mods["PlannerCore"] and data.raw["selection-tool"]["outpost-builder"] and settings.startup["outpost-builder"].value == true then
hide_the_remote("outpost-builder", nil, data.raw["selection-tool"]["outpost-builder"])
end
if mods["Orbital Ion Cannon"] and data.raw["item"]["ion-cannon-targeter"] and data.raw["technology"]["orbital-ion-cannon"] and settings.startup["ion-cannon-targeter"].value == true then
hide_the_remote("ion-cannon-targeter", "orbital-ion-cannon", data.raw["item"]["ion-cannon-targeter"])
end
if mods["ModuleInserter"] and data.raw["selection-tool"]["module-inserter"] and settings.startup["module-inserter"].value == true then
hide_the_remote("module-inserter", "construction-robotics", data.raw["selection-tool"]["module-inserter"])
end
if mods["aai-programmable-vehicles"] then
if settings.startup["unit-remote-control"].value == true and data.raw["selection-tool"]["unit-remote-control"] then
hide_the_remote("unit-remote-control", nil, data.raw["selection-tool"]["unit-remote-control"])
end
if settings.startup["path-remote-control"].value == true and data.raw["selection-tool"]["path-remote-control"] then
hide_the_remote("path-remote-control", nil, data.raw["selection-tool"]["path-remote-control"])
end
if mods["Orbital Ion Cannon"] and data.raw["item"]["ion-cannon-targeter"] and data.raw["technology"]["orbital-ion-cannon"] then
hide_the_remote("ion-cannon-targeter", "orbital-ion-cannon")
end
local disabled_equipment = {}
local disabled_equipment_item = {}
local equipment_list = {
"night-vision-equipment",
"belt-immunity-equipment",
"active-defense-equipment",
}
if mods["Nanobots"] then
equipment_list = {}
local equipment_list = {}
if settings.startup["night-vision-equipment"].value == true then
equipment_list[#equipment_list+1] = "night-vision-equipment"
end
if settings.startup["belt-immunity-equipment"].value == true then
equipment_list[#equipment_list+1] = "belt-immunity-equipment"
end
if settings.startup["active-defense-equipment"].value == true then
equipment_list[#equipment_list+1] = "active-defense-equipment"
end
if not mods["Nanobots"] then
for i=1,(#equipment_list) do
for _, equipment in pairs(data.raw[equipment_list[i]]) do
@ -61,7 +93,7 @@ for i=1,(#equipment_list) do
if not data.raw["item"][equipment_list[i]] then --for mods which have a different item name compared to equipment name
disabled_equipment_item[i] = util.table.deepcopy(data.raw["item"]["night-vision-equipment"])
disabled_equipment_item[i].name = "disabled-" .. name
disabled_equipment_item[i].hidden = true
disabled_equipment_item[i].flags = {"hidden"}
disabled_equipment_item[i].placed_as_equipment_result = name
end
@ -71,7 +103,7 @@ for i=1,(#equipment_list) do
end
disabled_equipment_item[i].name = "disabled-" .. name
disabled_equipment_item[i].hidden = true
disabled_equipment_item[i].flags = {"hidden"}
-- disabled_equipment_item[i].localised_name = {"", {"equipment-name." .. name}, " (", {"gui-constant.off"}, ")"}
disabled_equipment_item[i].localised_description = {"item-description." .. name}
disabled_equipment_item[i].placed_as_equipment_result = name
@ -85,6 +117,8 @@ for i=1,(#disabled_equipment),1 do
end
end
end
data:extend({
{
type = "virtual-signal", -- TODO: placeholder, when removing, remember to remove localised name too!
@ -94,7 +128,6 @@ data:extend({
icon_size = 64,
subgroup = "virtual-signal-color",
order = "d[colors]-[9danger]",
hidden = true,
},
{
type = "virtual-signal",
@ -104,7 +137,6 @@ data:extend({
icon_size = 64,
subgroup = "virtual-signal-color",
order = "d[colors]-[9disabled]",
hidden = true,
}
})
@ -113,6 +145,7 @@ local disabled_turret_item = {}
local disabled_gun = {}
local disable_turret_list = {}
if settings.startup["artillery-jammer-remote"].value == true then
if settings.startup["artillery-toggle"].value == "both" then
disable_turret_list = {"artillery-wagon", "artillery-turret",}
elseif settings.startup["artillery-toggle"].value == "artillery-wagon" then
@ -136,10 +169,13 @@ for i=1,(#disable_turret_list) do
end
disabled_turret_item[i].name = "disabled-" .. name
disabled_turret_item[i].place_result = "disabled-" .. name
disabled_turret_item[i].flags = {"hidden"}
disabled_turret[i].name = "disabled-" .. name
disabled_turret[i].flags = {"hidden"}
disabled_turret[i].localised_name = {"", {"entity-name." .. entity.name}, " (", {"gui-constant.off"}, ")"}
disabled_gun[i] = util.table.deepcopy(data.raw["gun"][gun])
disabled_gun[i].name = "disabled-" .. gun
disabled_gun[i].flags = {"hidden"}
disabled_gun[i].tint = { r = 1.0, g = 0.0, b = 0.0, a = 1.0 }
disabled_gun[i].attack_parameters.range = 0
disabled_gun[i].attack_parameters.min_range = 0
@ -157,7 +193,83 @@ for i=1,(#disabled_turret),1 do
end
end
end
if settings.startup["tree-killer"].value == true then
local decon_spec = util.table.deepcopy(data.raw["deconstruction-item"]["deconstruction-planner"])
decon_spec.name = "shortcuts-deconstruction-planner"
decon_spec.localised_name = {"item-name.deconstruction-planner"}
decon_spec.flags = {"only-in-cursor"}
data:extend({decon_spec})
end
if settings.startup["autogen"].value == true then
-- create a post on the discussion page if you want your shortcut to be added to this blacklist.
local shortcut_blacklist = {
"selection-tool",
"max-rate-calculator",
"module-inserter",
"path-remote-control",
"unit-remote-control",
}
for _, tool in pairs(data.raw["selection-tool"]) do
local name = tool.name
local continue = true
for j, blacklist in pairs(shortcut_blacklist) do
if name == blacklist then
continue = false
break
end
end
if continue == true then
local create = true
for i, shortcut in pairs(data.raw["shortcut"]) do
if shortcut.action == "create-blueprint-item" and shortcut.item_to_create == name then
create = false
break
end
end
if create == true then
local shortcut = {
type = "shortcut",
name = name,
order = tool.order,
action = "create-blueprint-item",
localised_name = {"item-name." .. name},
item_to_create = name,
style = "default",
icon =
{
filename = tool.icon,
priority = "extra-high-no-scale",
size = tool.icon_size,
scale = 1,
flags = {"icon"}
},
small_icon =
{
filename = tool.icon,
priority = "extra-high-no-scale",
size = tool.icon_size,
scale = 1,
flags = {"icon"}
},
disabled_small_icon =
{
filename = tool.icon,
priority = "extra-high-no-scale",
size = tool.icon_size,
scale = 1,
flags = {"icon"}
},
}
data:extend({shortcut})
hide_the_remote(name, name, tool) -- only attempts to hide the selection-tool if the recipe/tech name matches the tool name - does not search all recipes for mention of the tool.
end
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

View File

@ -1,10 +1,10 @@
{
"name": "Shortcuts",
"version": "0.6.0",
"version": "0.7.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, 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."
"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. See mod portal FAQ page for a full list of shortcuts and supported mods. Suggest any new shortcut ideas to the discussion page."
}

View File

@ -79,6 +79,194 @@ data:extend({
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"
default_value = "both",
order = "a"
},
{
type = "bool-setting",
name = "autogen",
localised_name = {"", "Auto-", {"gui-new-game.create"}, " ", {"gui-update.mod"}, " shortcuts"},
localised_description = {"", {""}, "Automatically generate shortcuts for mods which are not officially supported by this mod through a script."},
setting_type = "startup",
default_value = true,
order = "a"
},
{ -- for each shortcut (to free up space for other modded shortcuts)
type = "bool-setting",
name = "artillery-targeting-remote",
localised_name = {"", {"item-name.artillery-targeting-remote"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "za"
},
{
type = "bool-setting",
name = "draw-grid",
localised_name = {"", {"gui.grid"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "za"
},
{
type = "bool-setting",
name = "rail-block-visualization-toggle",
localised_name = {"", {"gui-interface-settings.show-rail-block-visualization"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "za"
},
{
type = "bool-setting",
name = "artillery-jammer-remote",
localised_name = {"", {"gui-mod-info.toggle"}, " ", {"entity-name.artillery-wagon"}, " ", {"damage-type-name.fire"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "za"
},
{
type = "bool-setting",
name = "tree-killer",
localised_name = {"", {"item-name.deconstruction-planner"}, " (", {"gui-deconstruction.whitelist-trees-and-rocks"}, ") ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "za"
},
{
type = "bool-setting",
name = "discharge-defense-remote",
localised_name = {"", {"item-name.discharge-defense-remote"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "za"
},
{
type = "bool-setting",
name = "flashlight-toggle",
localised_name = {"", {"entity-name.small-lamp"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "za"
},
{
type = "bool-setting",
name = "big-zoom",
localised_name = {"", {"controls.alt-zoom-out"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "za"
},
{
type = "bool-setting",
name = "signal-flare",
localised_name = {"", {"technology-name.military"}, " ", {"entity-name.beacon"}, " (", {"description.force"}, " ", {"deconstruction-tile-mode.only"}, ") ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "za"
}
})
-- Since we cannot conditionally extend mod settings, we have to implement them whether the mod is enabled or not :(
data:extend(
{
{
type = "bool-setting",
name = "resource-monitor",
localised_name = {"", {"item-name.resource-monitor"}, " ", {"gui-mod-info.toggle"}, " (LEGACY YARM)"},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
},
{
type = "bool-setting",
name = "path-remote-control",
localised_name = {"", {"item-name.path-remote-control"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
},
{
type = "bool-setting",
name = "unit-remote-control",
localised_name = {"", {"item-name.unit-remote-control"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
},
{
type = "bool-setting",
name = "outpost-builder",
localised_name = {"", {"item-name.outpost-builder"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
},
{
type = "bool-setting",
name = "ion-cannon-targeter",
localised_name = {"", {"item-name.ion-cannon-targeter"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
},
{
type = "bool-setting",
name = "max-rate-calculator",
localised_name = {"", {"item-name.max-rate-calculator"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
},
{
type = "bool-setting",
name = "module-inserter",
localised_name = {"", {"item-name.module-inserter"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
},
{
type = "bool-setting",
name = "night-vision-equipment",
localised_name = {"", {"equipment-name.night-vision-equipment"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
},
{
type = "bool-setting",
name = "active-defense-equipment",
localised_name = {"", {"equipment-name.personal-laser-defense-equipment"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
},
{
type = "bool-setting",
name = "belt-immunity-equipment",
localised_name = {"", {"equipment-name.belt-immunity-equipment"}, " ", {"gui-mod-info.toggle"}},
localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup",
default_value = true,
order = "zz"
}
})

View File

@ -1,44 +1,7 @@
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
if settings.startup["artillery-targeting-remote"].value == true then
data:extend(
{
-- for the artillery toggle
{
type = "selection-tool",
name = "artillery-jammer-tool",
icon = "__Shortcuts__/graphics/artillery-jammer-remote.png",
icon_size = 32,
flags = {"hidden"},
subgroup = "other",
order = "c[automated-construction]-a[artillery-jammer-tool]",
stack_size = 1,
stackable = false,
selection_color = { r = 1, g = 0, b = 0 },
alt_selection_color = { r = 1, g = 0, b = 0 },
selection_mode = {"blueprint"},
alt_selection_mode = {"blueprint"},
selection_cursor_box_type = "copy",
alt_selection_cursor_box_type = "copy",
entity_type_filters = disable_turret_list,
tile_filters = {"lab-dark-1"},
entity_filter_mode = "whitelist",
tile_filter_mode = "whitelist",
alt_entity_type_filters = disable_turret_list,
alt_tile_filters = {"lab-dark-1"},
alt_entity_filter_mode = "whitelist",
alt_tile_filter_mode = "whitelist",
show_in_library = false,
always_include_tiles = false
},
-- all shortcuts
{
type = "shortcut",
name = "artillery-targeting-remote",
@ -73,6 +36,12 @@ data:extend(
flags = {"icon"}
},
},
})
end
if settings.startup["draw-grid"].value == true then
data:extend(
{
{
type = "shortcut",
name = "draw-grid",
@ -106,6 +75,12 @@ data:extend(
flags = {"icon"}
},
},
})
end
if settings.startup["rail-block-visualization-toggle"].value == true then
data:extend(
{
{
type = "shortcut",
name = "rail-block-visualization-toggle",
@ -140,6 +115,20 @@ data:extend(
flags = {"icon"}
},
},
})
end
if settings.startup["artillery-jammer-remote"].value == true then
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(
{
{
type = "shortcut",
name = "artillery-jammer-remote",
@ -174,6 +163,39 @@ data:extend(
flags = {"icon"}
},
},
{
type = "selection-tool",
name = "artillery-jammer-tool",
icon = "__Shortcuts__/graphics/artillery-jammer-remote.png",
icon_size = 32,
flags = {"hidden", "only-in-cursor"},
subgroup = "other",
order = "c[automated-construction]-a[artillery-jammer-tool]",
stack_size = 1,
stackable = false,
selection_color = { r = 1, g = 0, b = 0 },
alt_selection_color = { r = 1, g = 0, b = 0 },
selection_mode = {"blueprint"},
alt_selection_mode = {"blueprint"},
selection_cursor_box_type = "copy",
alt_selection_cursor_box_type = "copy",
entity_type_filters = disable_turret_list,
tile_filters = {"lab-dark-1"},
entity_filter_mode = "whitelist",
tile_filter_mode = "whitelist",
alt_entity_type_filters = disable_turret_list,
alt_tile_filters = {"lab-dark-1"},
alt_entity_filter_mode = "whitelist",
alt_tile_filter_mode = "whitelist",
show_in_library = false,
always_include_tiles = false
},
})
end
if settings.startup["tree-killer"].value == true then
data:extend(
{
{
type = "shortcut",
name = "tree-killer",
@ -207,6 +229,12 @@ data:extend(
flags = {"icon"}
},
},
})
end
if settings.startup["discharge-defense-remote"].value == true then
data:extend(
{
{
type = "shortcut",
name = "discharge-defense-remote",
@ -241,6 +269,12 @@ data:extend(
flags = {"icon"}
},
},
})
end
if settings.startup["flashlight-toggle"].value == true then
data:extend(
{
{
type = "shortcut",
name = "flashlight-toggle",
@ -274,6 +308,12 @@ data:extend(
flags = {"icon"}
},
},
})
end
if settings.startup["big-zoom"].value == true then
data:extend(
{
{
type = "shortcut",
name = "big-zoom",
@ -308,6 +348,12 @@ data:extend(
flags = {"icon"}
},
},
})
end
if settings.startup["signal-flare"].value == true then
data:extend(
{
{
type = "shortcut",
name = "signal-flare",
@ -342,6 +388,9 @@ data:extend(
flags = {"icon"}
},
},
})
end
-- Custom shortcut can be defined as follows:
-- {
-- type = "shortcut",
@ -350,10 +399,9 @@ data:extend(
-- toggleable = true, -- whether or not the shortcut button is a toggle button or not
-- order, localised_name, technology_to_unlock, icon, small_icon, disabled_icon, disabled_small_icon as above
-- }
})
-- 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
if mods["YARM"] and data.raw["item"]["resource-monitor"] and data.raw["technology"]["resource-monitoring"] and settings.startup["resource-monitor"].value == true then
data:extend(
{
{
@ -393,7 +441,7 @@ data:extend(
})
end
if mods["OutpostPlanner"] and mods["PlannerCore"] and data.raw["selection-tool"]["outpost-builder"] then
if mods["OutpostPlanner"] and mods["PlannerCore"] and data.raw["selection-tool"]["outpost-builder"] and settings.startup["outpost-builder"].value == true then
data:extend(
{
{
@ -433,7 +481,7 @@ data:extend(
})
end
if mods["Orbital Ion Cannon"] and data.raw["item"]["ion-cannon-targeter"] and data.raw["technology"]["orbital-ion-cannon"] then
if mods["Orbital Ion Cannon"] and data.raw["item"]["ion-cannon-targeter"] and data.raw["technology"]["orbital-ion-cannon"] and settings.startup["ion-cannon-targeter"].value == true then
data:extend(
{
{
@ -473,7 +521,7 @@ data:extend(
})
end
if mods["MaxRateCalculator"] and data.raw["selection-tool"]["max-rate-calculator"] then
if mods["MaxRateCalculator"] and data.raw["selection-tool"]["max-rate-calculator"] and settings.startup["max-rate-calculator"].value == true then
data:extend(
{
{
@ -512,7 +560,7 @@ data:extend(
})
end
if mods["ModuleInserter"] and data.raw["selection-tool"]["module-inserter"] then
if mods["ModuleInserter"] and data.raw["selection-tool"]["module-inserter"] and settings.startup["module-inserter"].value == true then
data:extend(
{
{
@ -552,7 +600,90 @@ data:extend(
})
end
if mods["aai-programmable-vehicles"] then
if settings.startup["unit-remote-control"].value == true and data.raw["selection-tool"]["unit-remote-control"] then
data:extend(
{
{
type = "shortcut",
name = "unit-remote-control",
order = "a[unit-remote-control]",
action = "create-blueprint-item",
localised_name = {"item-name.unit-remote-control"},
item_to_create = "unit-remote-control",
technology_to_unlock = "automobilism",
style = "blue",
icon =
{
filename = "__Shortcuts__/graphics/unit-remote-control-x32-white.png",
priority = "extra-high-no-scale",
size = 32,
scale = 1,
flags = {"icon"}
},
small_icon =
{
filename = "__Shortcuts__/graphics/unit-remote-control-x24.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
disabled_small_icon =
{
filename = "__Shortcuts__/graphics/unit-remote-control-x24-white.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
}
})
end
if settings.startup["path-remote-control"].value == true and data.raw["selection-tool"]["path-remote-control"] then
data:extend(
{
{
type = "shortcut",
name = "path-remote-control",
order = "a[path-remote-control]",
action = "create-blueprint-item",
localised_name = {"item-name.path-remote-control"},
item_to_create = "path-remote-control",
technology_to_unlock = "automobilism",
style = "blue",
icon =
{
filename = "__Shortcuts__/graphics/path-remote-control-x32-white.png",
priority = "extra-high-no-scale",
size = 32,
scale = 1,
flags = {"icon"}
},
small_icon =
{
filename = "__Shortcuts__/graphics/path-remote-control-x24.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
disabled_small_icon =
{
filename = "__Shortcuts__/graphics/path-remote-control-x24-white.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
}
})
end
end
if not mods["Nanobots"] then
if settings.startup["night-vision-equipment"].value == true then
data:extend(
{
{
@ -588,39 +719,12 @@ data:extend(
flags = {"icon"}
},
},
})
end
if settings.startup["active-defense-equipment"].value == true then
data:extend(
{
type = "shortcut",
name = "night-vision-equipment",
order = "a[night-vision-equipment]",
action = "lua",
localised_name = {"equipment-name.night-vision-equipment"},
technology_to_unlock = "night-vision-equipment",
toggleable = true,
icon =
{
filename = "__Shortcuts__/graphics/night-vision-toggle-x32.png",
priority = "extra-high-no-scale",
size = 32,
scale = 1,
flags = {"icon"}
},
small_icon =
{
filename = "__Shortcuts__/graphics/night-vision-toggle-x24.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
disabled_small_icon =
{
filename = "__Shortcuts__/graphics/night-vision-toggle-x24-white.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
},
{
type = "shortcut",
name = "active-defense-equipment",
@ -654,6 +758,12 @@ data:extend(
flags = {"icon"}
},
},
})
end
if settings.startup["belt-immunity-equipment"].value == true then
data:extend(
{
{
type = "shortcut",
name = "belt-immunity-equipment",
@ -689,3 +799,4 @@ data:extend(
}
})
end
end