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 Version: 0.7.3
Date: 2019-04-15 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 function update_armor(event)
local player = game.players[event.player_index] 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 and power_armor ~= nil and power_armor.valid then
if power_armor[1].valid_for_read 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 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
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 local function false_shortcuts(player) -- disables things
if settings.startup["night-vision-equipment"].value == true then if settings.startup["night-vision-equipment"].value == true then
player.set_shortcut_available("night-vision-equipment", false) player.set_shortcut_available("night-vision-equipment", false)
@ -157,14 +123,17 @@ local function reset_state(event, toggle) -- verifies placement of equipment and
update_armor(event) update_armor(event)
local player = game.players[event.player_index] local player = game.players[event.player_index]
local grid = global.shortcuts_armor[game.players[event.player_index].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 local equipment = event.equipment
if equipment and toggle == 1 then --place if equipment and toggle == 1 then --place
local type = equipment.type 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 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 equipment.valid and equipment.type == type then if setting and setting.value then
enable_it(player, equipment, grid, type) 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 end
end end
@ -172,21 +141,24 @@ local function reset_state(event, toggle) -- verifies placement of equipment and
local type = game.equipment_prototypes[equipment].type local type = game.equipment_prototypes[equipment].type
local name = game.equipment_prototypes[equipment].name local name = game.equipment_prototypes[equipment].name
if type == "night-vision-equipment" or type == "belt-immunity-equipment" or type == "active-defense-equipment" then if type == "night-vision-equipment" or type == "belt-immunity-equipment" or type == "active-defense-equipment" then
local value = false local setting = settings.startup[type]
for _, equipment in pairs(grid.equipment) do if setting and setting.value then
if equipment.type == type and equipment.valid then local value = false
if type ~= "active-defense-equipment" then for _, equipment in pairs(grid.equipment) do
value = true if equipment.type == type and equipment.valid then
break if type ~= "active-defense-equipment" then
elseif type == "active-defense-equipment" and game.equipment_prototypes["disabledinactive-" .. equipment.name] == nil then value = true
value = true break
break elseif type == "active-defense-equipment" and game.equipment_prototypes["disabledinactive-" .. equipment.name] == nil then
value = true
break
end
end end
end end
end if value == false then
if value == false then player.set_shortcut_available(type, false)
player.set_shortcut_available(type, false) player.set_shortcut_toggled(type, false)
player.set_shortcut_toggled(type, false) end
end end
end end
elseif toggle == 0 then --armor place elseif toggle == 0 then --armor place
@ -194,7 +166,10 @@ local function reset_state(event, toggle) -- verifies placement of equipment and
for _, equipment in pairs(grid.equipment) do for _, equipment in pairs(grid.equipment) do
local type = equipment.type 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 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
enable_it(player, equipment, grid, equipment.type) local setting = settings.startup[type]
if setting and setting.value then
enable_it(player, equipment, grid, equipment.type)
end
end end
end end
end 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"]) hide_the_remote("module-inserter", "construction-robotics", data.raw["selection-tool"]["module-inserter"])
end end
if mods["aai-programmable-vehicles"] then 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"]) hide_the_remote("unit-remote-control", nil, data.raw["selection-tool"]["unit-remote-control"])
end 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"]) hide_the_remote("path-remote-control", nil, data.raw["selection-tool"]["path-remote-control"])
end end
end end

View File

@ -1,10 +1,11 @@
{ {
"name": "Shortcuts", "name": "Shortcuts",
"version": "0.7.3", "version": "0.7.4",
"factorio_version": "0.17", "factorio_version": "0.17",
"title": "Shortcuts", "title": "Shortcuts",
"author": "npc_strider(morley376)", "author": "npc_strider(morley376)",
"contact": "", "contact": "",
"homepage": "http://steamcommunity.com/id/morley376", "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." "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 :( -- 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( data:extend(
{ {
{ {
@ -202,25 +203,25 @@ data:extend(
localised_name = {"", {"item-name.resource-monitor"}, " ", {"gui-mod-info.toggle"}, " (LEGACY YARM)"}, 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."}, localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup", setting_type = "startup",
default_value = true, default_value = false,
order = "zz" order = "zz"
}, },
{ {
type = "bool-setting", type = "bool-setting",
name = "path-remote-control", 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."}, localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup", setting_type = "startup",
default_value = true, default_value = false,
order = "zz" order = "zz"
}, },
{ {
type = "bool-setting", type = "bool-setting",
name = "unit-remote-control", 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."}, localised_description = {"", {""}, "Disable specific shortcuts to free up space for other modded shortcuts, or to slightly increase performance and load time."},
setting_type = "startup", setting_type = "startup",
default_value = true, default_value = false,
order = "zz" order = "zz"
}, },
{ {