v 0.3.0: add military-beacon (distress flare) and ultra zoom
BIN
2019-03-10 13-58-59.mov
Normal file
BIN
2019-03-10 13-58-59.mov.gif
Normal file
After Width: | Height: | Size: 1.6 MiB |
|
@ -1,5 +1,5 @@
|
||||||
local function update_armor(event)
|
local function update_armor(event)
|
||||||
player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
power_armor = player.get_inventory(defines.inventory.player_armor)
|
power_armor = player.get_inventory(defines.inventory.player_armor)
|
||||||
if power_armor and power_armor.valid then
|
if power_armor and power_armor.valid then
|
||||||
if power_armor[1].valid_for_read then
|
if power_armor[1].valid_for_read then
|
||||||
|
@ -12,25 +12,26 @@ end
|
||||||
|
|
||||||
local function update_state(event, equipment_type)
|
local function update_state(event, equipment_type)
|
||||||
update_armor(event)
|
update_armor(event)
|
||||||
player = game.players[event.player_index].index
|
local grid = global.shortcuts_armor[game.players[event.player_index].index]
|
||||||
local grid = global.shortcuts_armor[player]
|
if grid then
|
||||||
for _, equipment in pairs(grid.equipment) do
|
for _, equipment in pairs(grid.equipment) do
|
||||||
if equipment.valid and equipment.type == equipment_type then
|
if equipment.valid and equipment.type == equipment_type then
|
||||||
local name = equipment.name
|
local name = equipment.name
|
||||||
local position = equipment.position
|
local position = equipment.position
|
||||||
local energy = equipment.energy
|
local energy = equipment.energy
|
||||||
if not (string.sub(equipment.name,1,9) == "disabled-") then
|
if not (string.sub(equipment.name,1,9) == "disabled-") then
|
||||||
grid.take(equipment)
|
grid.take(equipment)
|
||||||
local new_equipment = grid.put{name="disabled-" .. name, position=position}
|
local new_equipment = grid.put{name="disabled-" .. name, position=position}
|
||||||
if new_equipment and new_equipment.valid then
|
if new_equipment and new_equipment.valid then
|
||||||
new_equipment.energy = energy
|
new_equipment.energy = energy
|
||||||
|
end
|
||||||
|
elseif (string.sub(equipment.name,1,9) == "disabled-") then
|
||||||
|
grid.take(equipment)
|
||||||
|
local new_equipment = grid.put{name=(string.sub(name,10,#name)), position=position}
|
||||||
|
if new_equipment and new_equipment.valid then
|
||||||
|
new_equipment.energy = energy
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif (string.sub(equipment.name,1,9) == "disabled-") then
|
|
||||||
grid.take(equipment)
|
|
||||||
local new_equipment = grid.put{name=(string.sub(name,10,#name)), position=position}
|
|
||||||
if new_equipment and new_equipment.valid then
|
|
||||||
new_equipment.energy = energy
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -49,13 +50,35 @@ local function toggle_light(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function toggle_type(event)
|
local function shortcut_type(event)
|
||||||
if event.prototype_name == "night-vision-toggle" then
|
local prototype_name = event.prototype_name
|
||||||
|
if prototype_name == "night-vision-toggle" then
|
||||||
update_state(event, "night-vision-equipment")
|
update_state(event, "night-vision-equipment")
|
||||||
elseif event.prototype_name == "belt-immunity-toggle" then
|
elseif prototype_name == "belt-immunity-toggle" then
|
||||||
update_state(event, "belt-immunity-equipment")
|
update_state(event, "belt-immunity-equipment")
|
||||||
elseif event.prototype_name == "flashlight-toggle" then
|
elseif prototype_name == "flashlight-toggle" then
|
||||||
toggle_light(game.players[event.player_index])
|
toggle_light(game.players[event.player_index])
|
||||||
|
elseif prototype_name == "big-zoom" then
|
||||||
|
local player = game.players[event.player_index]
|
||||||
|
if settings.global["disable-zoom"].value == true then
|
||||||
|
player.zoom = settings.get_player_settings(player)["zoom-level"].value
|
||||||
|
else
|
||||||
|
player.print({"", {"error.error-message-box-title"}, ": ", {"controls.alt-zoom-out"}, " ", {"gui-mod-info.status-disabled"}})
|
||||||
|
end
|
||||||
|
elseif prototype_name == "signal-flare" then
|
||||||
|
local player = game.players[event.player_index]
|
||||||
|
if settings.global["disable-zoom"].value == true then
|
||||||
|
player.force.print({"", "[img=virtual-signal.signal-danger] [color=1,0.1,0.1]", {"entity-name.player"}, " " .. player.name .. " [gps=" .. math.floor(player.position.x+0.5) .. "," .. math.floor(player.position.y+0.5) .. "][/color] [img=virtual-signal.signal-danger]"})
|
||||||
|
else
|
||||||
|
player.print({"", {"error.error-message-box-title"}, ": ", {"technology-name.military"}, " ", {"entity-name.beacon"}, " ", {"gui-mod-info.status-disabled"}})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function remove_remote(event)
|
||||||
|
local trash = game.players[event.player_index].get_inventory(defines.inventory.player_main)
|
||||||
|
if trash and trash.valid then
|
||||||
|
trash.remove("artillery-targeting-remote")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -72,7 +95,9 @@ script.on_event(defines.events.on_player_armor_inventory_changed, update_armor)
|
||||||
script.on_event(defines.events.on_player_placed_equipment, update_armor)
|
script.on_event(defines.events.on_player_placed_equipment, update_armor)
|
||||||
script.on_event(defines.events.on_player_removed_equipment, update_armor)
|
script.on_event(defines.events.on_player_removed_equipment, update_armor)
|
||||||
|
|
||||||
script.on_event(defines.events.on_lua_shortcut, toggle_type)
|
script.on_event(defines.events.on_lua_shortcut, shortcut_type)
|
||||||
|
|
||||||
|
script.on_event(defines.events.on_player_main_inventory_changed, remove_remote)
|
||||||
|
|
||||||
script.on_init(initialize)
|
script.on_init(initialize)
|
||||||
script.on_configuration_changed(initialize)
|
script.on_configuration_changed(initialize)
|
|
@ -1,4 +1,5 @@
|
||||||
require("shortcuts")
|
require("shortcuts")
|
||||||
|
|
||||||
data.raw["recipe"]["artillery-targeting-remote"].hidden = true
|
data.raw["recipe"]["artillery-targeting-remote"].hidden = true
|
||||||
local effect = data.raw["technology"]["artillery"].effects
|
local effect = data.raw["technology"]["artillery"].effects
|
||||||
for i=1,(#effect) do
|
for i=1,(#effect) do
|
||||||
|
@ -34,6 +35,7 @@ for i=1,(#equipment_list) do
|
||||||
disabled_equipment_item[i] = util.table.deepcopy(data.raw["item"]["night-vision-equipment"])
|
disabled_equipment_item[i] = util.table.deepcopy(data.raw["item"]["night-vision-equipment"])
|
||||||
end
|
end
|
||||||
disabled_equipment_item[i].name = newname
|
disabled_equipment_item[i].name = newname
|
||||||
|
disabled_equipment_item[i].hidden = true
|
||||||
disabled_equipment_item[i].localised_name = {"", {"equipment-name." .. name}, " (", {"gui-constant.off"}, ")"}
|
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].localised_description = {"item-description." .. name}
|
||||||
disabled_equipment_item[i].placed_as_equipment_result = newname
|
disabled_equipment_item[i].placed_as_equipment_result = newname
|
||||||
|
@ -43,4 +45,17 @@ end
|
||||||
for i=1,(#disabled_equipment),1 do
|
for i=1,(#disabled_equipment),1 do
|
||||||
data:extend({disabled_equipment_item[i]})
|
data:extend({disabled_equipment_item[i]})
|
||||||
data:extend({disabled_equipment[i]})
|
data:extend({disabled_equipment[i]})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local warning = {
|
||||||
|
type = "virtual-signal", -- TODO: placeholder, when removing, remember to remove localised name too!
|
||||||
|
name = "signal-danger",
|
||||||
|
localised_name = {"gui-alert-tooltip.title"},
|
||||||
|
icon = "__core__/graphics/danger-icon.png",
|
||||||
|
icon_size = 64,
|
||||||
|
subgroup = "virtual-signal-color",
|
||||||
|
order = "d[colors]-[9danger]",
|
||||||
|
hidden = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
data:extend{(warning)}
|
BIN
Shortcuts/graphics/big-zoom-x24-white.png
Normal file
After Width: | Height: | Size: 977 B |
BIN
Shortcuts/graphics/big-zoom-x24.png
Normal file
After Width: | Height: | Size: 910 B |
BIN
Shortcuts/graphics/big-zoom-x32-white.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
Shortcuts/graphics/big-zoom-x32.png
Normal file
After Width: | Height: | Size: 959 B |
BIN
Shortcuts/graphics/danger-icon.png
Normal file
After Width: | Height: | Size: 694 B |
BIN
Shortcuts/graphics/signal-flare-x24-white.png
Normal file
After Width: | Height: | Size: 713 B |
BIN
Shortcuts/graphics/signal-flare-x24.png
Normal file
After Width: | Height: | Size: 706 B |
BIN
Shortcuts/graphics/signal-flare-x32-white.png
Normal file
After Width: | Height: | Size: 693 B |
BIN
Shortcuts/graphics/signal-flare-x32.png
Normal file
After Width: | Height: | Size: 689 B |
BIN
Shortcuts/graphics/u1F50D.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Shortcuts",
|
"name": "Shortcuts",
|
||||||
"version": "0.2.2",
|
"version": "0.3.0",
|
||||||
"factorio_version": "0.17",
|
"factorio_version": "0.17",
|
||||||
"title": "Shortcuts",
|
"title": "Shortcuts",
|
||||||
"author": "npc_strider(morley376)",
|
"author": "npc_strider(morley376)",
|
||||||
|
|
25
Shortcuts/settings.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
data:extend({
|
||||||
|
{
|
||||||
|
type = "double-setting",
|
||||||
|
name = "zoom-level",
|
||||||
|
localised_name = {"", {"controls.alt-zoom-out"}, " ", {"description.module-bonus-limit"}},
|
||||||
|
setting_type = "runtime-per-user",
|
||||||
|
default_value = 0.1,
|
||||||
|
minimum_value = 0.0,
|
||||||
|
maximum_value = 16.0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "bool-setting",
|
||||||
|
name = "disable-zoom",
|
||||||
|
localised_name = {"", {"gui-control-behavior-modes.enable-disable"}, " ", {"controls.alt-zoom-out"}},
|
||||||
|
setting_type = "runtime-global",
|
||||||
|
default_value = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "bool-setting",
|
||||||
|
name = "disable-flare",
|
||||||
|
localised_name = {"", {"gui-control-behavior-modes.enable-disable"}, " ", {"technology-name.military"}, " ", {"entity-name.beacon"}},
|
||||||
|
setting_type = "runtime-global",
|
||||||
|
default_value = true,
|
||||||
|
}
|
||||||
|
})
|
|
@ -132,6 +132,73 @@ data:extend(
|
||||||
flags = {"icon"}
|
flags = {"icon"}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type = "shortcut",
|
||||||
|
name = "big-zoom",
|
||||||
|
order = "a[big-zoom]",
|
||||||
|
technology_to_unlock = "optics",
|
||||||
|
action = "lua",
|
||||||
|
localised_name = {"controls.alt-zoom-out"},
|
||||||
|
toggleable = true,
|
||||||
|
style = "blue",
|
||||||
|
icon =
|
||||||
|
{
|
||||||
|
filename = "__Shortcuts__/graphics/big-zoom-x32-white.png",
|
||||||
|
priority = "extra-high-no-scale",
|
||||||
|
size = 32,
|
||||||
|
scale = 1,
|
||||||
|
flags = {"icon"}
|
||||||
|
},
|
||||||
|
small_icon =
|
||||||
|
{
|
||||||
|
filename = "__Shortcuts__/graphics/big-zoom-x24.png",
|
||||||
|
priority = "extra-high-no-scale",
|
||||||
|
size = 24,
|
||||||
|
scale = 1,
|
||||||
|
flags = {"icon"}
|
||||||
|
},
|
||||||
|
disabled_small_icon =
|
||||||
|
{
|
||||||
|
filename = "__Shortcuts__/graphics/big-zoom-x24-white.png",
|
||||||
|
priority = "extra-high-no-scale",
|
||||||
|
size = 24,
|
||||||
|
scale = 1,
|
||||||
|
flags = {"icon"}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "shortcut",
|
||||||
|
name = "signal-flare",
|
||||||
|
order = "a[signal-flare]",
|
||||||
|
action = "lua",
|
||||||
|
localised_name = {"", {"technology-name.military"}, " ", {"entity-name.beacon"}, " (", {"description.force"}, " ", {"deconstruction-tile-mode.only"}, ")"},
|
||||||
|
toggleable = true,
|
||||||
|
style = "red",
|
||||||
|
icon =
|
||||||
|
{
|
||||||
|
filename = "__Shortcuts__/graphics/signal-flare-x32-white.png",
|
||||||
|
priority = "extra-high-no-scale",
|
||||||
|
size = 32,
|
||||||
|
scale = 1,
|
||||||
|
flags = {"icon"}
|
||||||
|
},
|
||||||
|
small_icon =
|
||||||
|
{
|
||||||
|
filename = "__Shortcuts__/graphics/signal-flare-x24.png",
|
||||||
|
priority = "extra-high-no-scale",
|
||||||
|
size = 24,
|
||||||
|
scale = 1,
|
||||||
|
flags = {"icon"}
|
||||||
|
},
|
||||||
|
disabled_small_icon =
|
||||||
|
{
|
||||||
|
filename = "__Shortcuts__/graphics/signal-flare-x24-white.png",
|
||||||
|
priority = "extra-high-no-scale",
|
||||||
|
size = 24,
|
||||||
|
scale = 1,
|
||||||
|
flags = {"icon"}
|
||||||
|
},
|
||||||
|
},
|
||||||
-- Custom shortcut can be defined as follows:
|
-- Custom shortcut can be defined as follows:
|
||||||
-- {
|
-- {
|
||||||
-- type = "shortcut",
|
-- type = "shortcut",
|
||||||
|
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 8.5 KiB |
BIN
image3.png
Normal file
After Width: | Height: | Size: 53 KiB |