0.7.4: Fix for 0.17.35 player/character naming conventions and equipment

bugs
This commit is contained in:
Peter 2019-05-06 18:42:37 +08:00
parent 6d851b27d0
commit 1c86ef7e0e
6 changed files with 48 additions and 61 deletions

View File

@ -1,3 +1,11 @@
---------------------------------------------------------------------------------------------------
Version: 0.7.4
Date: 2019-05-06
Bugfixes:
- Removed redundant AAI shortcuts (The recipe hiding functionality is still functional for this mod as it still creates recipes even though the shortcut can create infinite remotes)
- Fixed valid issue for equipment
- Fixed issue with new 0.17.35 player/character naming conventions
---------------------------------------------------------------------------------------------------
Version: 0.7.3
Date: 2019-04-15

View File

@ -0,0 +1,2 @@
sed -i -e 's/\t/ /g' -e 's/\s*$//' changelog.txt
#from factorioforums: https://forums.factorio.com/viewtopic.php?f=25&t=67140

View File

@ -10,7 +10,7 @@ require("util")
local function update_armor(event)
local player = game.players[event.player_index]
local power_armor = player.get_inventory(defines.inventory.player_armor)
local power_armor = player.get_inventory(defines.inventory.character_armor)
if power_armor and power_armor ~= nil and power_armor.valid then
if power_armor[1].valid_for_read then
if power_armor[1].grid and power_armor[1].grid.valid and power_armor[1].grid.width > 0 then
@ -88,40 +88,6 @@ 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
-- 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)
@ -157,21 +123,26 @@ local function reset_state(event, toggle) -- verifies placement of equipment and
update_armor(event)
local player = game.players[event.player_index]
local grid = global.shortcuts_armor[game.players[event.player_index].index]
if grid then
if grid and grid.valid then
local equipment = event.equipment
if equipment and toggle == 1 then --place
local type = equipment.type
if type == "night-vision-equipment" or type == "belt-immunity-equipment" or (type == "active-defense-equipment" and game.equipment_prototypes["disabledinactive-" .. equipment.name] == nil) then
for _, equipment in pairs(grid.equipment) do
local setting = settings.startup[type]
if setting and setting.value then
for _, equipment in pairs(grid.equipment) do -- Enable all of a type of equipment, even if only one is placed in the grid.
if equipment.valid and equipment.type == type then
enable_it(player, equipment, grid, type)
end
end
end
end
elseif equipment and toggle == 2 then --take
local type = game.equipment_prototypes[equipment].type
local name = game.equipment_prototypes[equipment].name
if type == "night-vision-equipment" or type == "belt-immunity-equipment" or type == "active-defense-equipment" then
local setting = settings.startup[type]
if setting and setting.value then
local value = false
for _, equipment in pairs(grid.equipment) do
if equipment.type == type and equipment.valid then
@ -189,15 +160,19 @@ local function reset_state(event, toggle) -- verifies placement of equipment and
player.set_shortcut_toggled(type, false)
end
end
end
elseif toggle == 0 then --armor place
false_shortcuts(player)
for _, equipment in pairs(grid.equipment) do
local type = equipment.type
if equipment.valid and type == "night-vision-equipment" or type == "belt-immunity-equipment" or (type == "active-defense-equipment" and game.equipment_prototypes["disabledinactive-" .. equipment.name] == nil) then
local setting = settings.startup[type]
if setting and setting.value then
enable_it(player, equipment, grid, equipment.type)
end
end
end
end
else
false_shortcuts(player)
end

View File

@ -54,10 +54,10 @@ if mods["ModuleInserter"] and data.raw["selection-tool"]["module-inserter"] and
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
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
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
end

View File

@ -1,10 +1,11 @@
{
"name": "Shortcuts",
"version": "0.7.3",
"version": "0.7.4",
"factorio_version": "0.17",
"title": "Shortcuts",
"author": "npc_strider(morley376)",
"contact": "",
"homepage": "http://steamcommunity.com/id/morley376",
"dependencies": ["base >= 0.17.35"],
"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

@ -194,6 +194,7 @@ data:extend({
})
-- Since we cannot conditionally extend mod settings, we have to implement them whether the mod is enabled or not :(
-- This can break the localization of the shortcut if the mod is not installed
data:extend(
{
{
@ -202,25 +203,25 @@ data:extend(
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,
default_value = false,
order = "zz"
},
{
type = "bool-setting",
name = "path-remote-control",
localised_name = {"", {"item-name.path-remote-control"}, " ", {"gui-mod-info.toggle"}},
localised_name = {"", {"item-name.path-remote-control"}, " ", {"gui-mod-info.toggle"}, " (LEGACY AAI)"},
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,
default_value = false,
order = "zz"
},
{
type = "bool-setting",
name = "unit-remote-control",
localised_name = {"", {"item-name.unit-remote-control"}, " ", {"gui-mod-info.toggle"}},
localised_name = {"", {"item-name.unit-remote-control"}, " ", {"gui-mod-info.toggle"}, " (LEGACY AAI)"},
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,
default_value = false,
order = "zz"
},
{