Skip to content

Commit

Permalink
finalize 0.7.3
Browse files Browse the repository at this point in the history
* localise ghost names
* add decon/upgrade canceling via right click
* uodate changelog
  • Loading branch information
LevFendi committed Feb 7, 2024
1 parent 786f933 commit 3ccd9d9
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 17 deletions.
18 changes: 9 additions & 9 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Version 0.7.3 BETA

Release pending.
Released on February 7th, 2024.

In this intermediate update the launcher has been improved so that it reads punctuation key names as intended, and translates key names when localization is used. In addition, the update brings support for the deconstruction planner and the upgrade planner, and the basics for blueprint support. For the full blueprint support plan, read the section for upcoming features.

## New features

- Deconstruction planner support
* Press "ALT + D" to hold a decontruction planner in hand. Press "LEFT BRACKET" with the planner in hand to mark the start point and end point of the selection area for deconstruction. You can cancel the ongoing selection by clearing your hand before marking the end point.
* Press "ALT + D" to hold a decontruction planner in hand. Press "LEFT BRACKET" with the planner in hand to mark the start point and end point of the selection area for deconstruction. The order is given when the selection ends. You can cancel the ongoing selection by clearing your hand before marking the end point, or press "Z" to undo the order if it was your last action.
* To cancel deconstruction orders for an area being selected, finish the selection by pressing "RIGHT BRACKET" instead.
* Info: The deconstruction planner is useful for picking up large areas of entities with the help of construction robots. You can use the deconstruction planner item to select an area and mark all entities inside for deconstruction. The selection includes player built structures but also trees and rocks. These marked entities will stop working and get picked up by available construction robots that can reach them, and be taken to logistic storage chests.
* Note: If you are near the area and have your own construction robots in your personal roboport, they will join the deconstruction and take their picked up items into your inventory.
* Note: You can undo the deconstruction order by pressing "CONTROL + Z" if it was the last action performed.

- Upgrade planner support
* Press "ALT + U" to hold an upgrade planner in hand. Press "LEFT BRACKET" with the planner in hand to mark the start point and end point of the selection area for upgrading. You can cancel the ongoing selection by clearing your hand before marking the end point.
* Press "ALT + U" to hold an upgrade planner in hand. Press "LEFT BRACKET" with the planner in hand to mark the start point and end point of the selection area for upgrading. The order is given when the selection ends. You can cancel the ongoing selection by clearing your hand before marking the end point, or press "Z" to undo the order if it was your last action.
* To cancel upgrade orders for an area being selected, finish the selection by pressing "RIGHT BRACKET" instead.
* Info: The upgrade planner is useful for upgrading large areas of buildings with the help of construction robots. A building being marked for an upgrade means that there is a request made for it to be replaced with its higher tier version. For example, transport belts being upgraded would request for fast transport belts. If the upgraded versions of marked buildings can be found in a logistic network, construction robots will take them and replace the buildings and then take the picked up old buildings to logistic storage. Upgrade requests remain active indefinitely and they do not pause building operation.
* Note: Your personal roboport can do this too using your own inventory for supply and dropoff instead of the logistic network.
* Note: You can undo the upgrade order by pressing "CONTROL + Z" if it was the last action performed.

- Experimental preview of blueprint support (work in progress)
* Press "ALT + B" to hold an empty blueprint in hand. Press "LEFT BRACKET" with the planner in hand to mark the start point and end point of the selection area for upgrading. You can cancel the ongoing selection by clearing your hand before marking the end point.
Expand All @@ -42,6 +42,8 @@ In this intermediate update the launcher has been improved so that it reads punc

- Direction names are now given by the game, which may be localised.

- Ghost names are now localised and read more quickly.

## Bug fixes

- Fixed a launcher crash due to incorrect keybind naming.
Expand All @@ -60,10 +62,8 @@ In this intermediate update the launcher has been improved so that it reads punc
* Possibly other features such as upgrading entities within the blueprint.
* Possibly allowing the blueprint selection to include placed tiles.

- More planner orders supported
* Canceling deconstruction orders or upgrade orders via area selection.
* Ordering downgrades using the upgrade planner via area selection.

- Press a key to review information about the area being selected right now, before finishing the selection.
* This can include the area size and affected entity count.

# Version 0.7.2 BETA

Expand Down
83 changes: 81 additions & 2 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ function ent_info(pindex, ent, description)
result = result .. ", x " .. ent.amount
end
if ent.name == "entity-ghost" then
result = result .. " for " .. ent.ghost_name .. ", "
result = localising.get(ent.ghost_prototype, pindex) .. " " .. localising.get(ent, pindex)
elseif ent.name == "straight-rail" or ent.name == "curved-rail" then
return rail_ent_info(pindex, ent, description)
end
Expand Down Expand Up @@ -8378,9 +8378,11 @@ script.on_event("click-hand", function(event)
--If holding a repair pack, try to use it (will not work on enemies)
repair_pack_used(ent,pindex)
elseif stack.is_blueprint and stack.is_blueprint_setup() then
--Paste a ready blueprint
players[pindex].last_held_blueprint = stack
paste_blueprint(pindex)
elseif stack.is_blueprint and not stack.is_blueprint_setup() then
--Select blueprint
local pex = players[pindex]
if pex.bp_selecting ~= true then
pex.bp_selecting = true
Expand All @@ -8392,6 +8394,7 @@ script.on_event("click-hand", function(event)
create_blueprint(pindex, pex.bp_select_point_1, pex.bp_select_point_2)
end
elseif stack.is_deconstruction_item then
--Mark deconstruction
local pex = players[pindex]
if pex.bp_selecting ~= true then
pex.bp_selecting = true
Expand All @@ -8413,6 +8416,7 @@ script.on_event("click-hand", function(event)
printout(decon_counter .. " entities marked to be deconstructed.", pindex)
end
elseif stack.is_upgrade_item then
--Mark upgrade
local pex = players[pindex]
if pex.bp_selecting ~= true then
pex.bp_selecting = true
Expand All @@ -8431,7 +8435,7 @@ script.on_event("click-hand", function(event)
ent_counter = ent_counter + 1
end
end
printout(ent_counter .. " entities marked to be upgraded.", pindex) --****upgrade cancel and decon cancel how?
printout(ent_counter .. " entities marked to be upgraded.", pindex)
end
elseif stack.prototype ~= nil and (stack.prototype.name == "capsule" or stack.prototype.type == "capsule") then
--If holding a capsule type, e.g. cliff explosives or robot capsules, or remotes, try to use it at the cursor position (no feedback about successful usage)
Expand All @@ -8456,6 +8460,81 @@ script.on_event("click-hand", function(event)
end
end)

--Right click actions with items in hand
script.on_event("click-hand-right", function(event)
pindex = event.player_index
if not check_for_player(pindex) then
return
end
local p = game.get_player(pindex)
if players[pindex].last_click_tick == event.tick then
return
end
if players[pindex].in_menu then
return
else
--Not in a menu
local stack = game.get_player(pindex).cursor_stack
local ent = get_selected_ent(pindex)

if stack and stack.valid_for_read and stack.valid then
players[pindex].last_click_tick = event.tick
else
return
end

--If something is in hand...
if stack.prototype ~= nil and (stack.prototype.place_result ~= nil or stack.prototype.place_as_tile_result ~= nil) and stack.name ~= "offshore-pump" then
--Laterdo here: build as ghost
elseif stack.is_blueprint and stack.is_blueprint_setup() then
--Paste blueprint
players[pindex].last_held_blueprint = stack
paste_blueprint(pindex)
elseif stack.is_blueprint and not stack.is_blueprint_setup() then
--Select blueprint
local pex = players[pindex]
if pex.bp_selecting ~= true then
pex.bp_selecting = true
pex.bp_select_point_1 = pex.cursor_pos
printout("Started blueprint selection at " .. math.floor(pex.cursor_pos.x) .. "," .. math.floor(pex.cursor_pos.y) , pindex)
else
pex.bp_selecting = false
pex.bp_select_point_2 = pex.cursor_pos
create_blueprint(pindex, pex.bp_select_point_1, pex.bp_select_point_2)
end
elseif stack.is_deconstruction_item then
--Cancel deconstruction
local pex = players[pindex]
if pex.bp_selecting ~= true then
pex.bp_selecting = true
pex.bp_select_point_1 = pex.cursor_pos
printout("Started deconstruction selection at " .. math.floor(pex.cursor_pos.x) .. "," .. math.floor(pex.cursor_pos.y) , pindex)
else
pex.bp_selecting = false
pex.bp_select_point_2 = pex.cursor_pos
--Cancel area for deconstruction
local left_top, right_bottom = get_top_left_and_bottom_right(pex.bp_select_point_1, pex.bp_select_point_2)
p.surface.cancel_deconstruct_area{area={left_top, right_bottom}, force=p.force, player=p, item=p.cursor_stack}
printout("Canceled deconstruction in selected area", pindex)
end
elseif stack.is_upgrade_item then
local pex = players[pindex]
if pex.bp_selecting ~= true then
pex.bp_selecting = true
pex.bp_select_point_1 = pex.cursor_pos
printout("Started upgrading selection at " .. math.floor(pex.cursor_pos.x) .. "," .. math.floor(pex.cursor_pos.y) , pindex)
else
pex.bp_selecting = false
pex.bp_select_point_2 = pex.cursor_pos
--Cancel area for upgrading
local left_top, right_bottom = get_top_left_and_bottom_right(pex.bp_select_point_1, pex.bp_select_point_2)
p.surface.cancel_upgrade_area{area={left_top, right_bottom}, force=p.force, player=p, item=p.cursor_stack}
printout("Canceled upgrading in selected area", pindex)
end
end
end
end)

--Left click actions with no menu and no items in hand
script.on_event("click-entity", function(event)
pindex = event.player_index
Expand Down
19 changes: 13 additions & 6 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -968,36 +968,43 @@ data:extend({

{
type = "custom-input",
name = "click-menu-right",
name = "leftbracket-key-id",
key_sequence = "LEFTBRACKET",
consuming = "none"
},

{
type = "custom-input",
name = "rightbracket-key-id",
key_sequence = "RIGHTBRACKET",
consuming = "none"
},

{
type = "custom-input",
name = "leftbracket-key-id",
name = "click-menu",
key_sequence = "LEFTBRACKET",
consuming = "none"
},

{
type = "custom-input",
name = "rightbracket-key-id",
name = "click-menu-right",
key_sequence = "RIGHTBRACKET",
consuming = "none"
},

{
type = "custom-input",
name = "click-menu",
name = "click-hand",
key_sequence = "LEFTBRACKET",
consuming = "none"
},

{
type = "custom-input",
name = "click-hand",
key_sequence = "LEFTBRACKET",
name = "click-hand-right",
key_sequence = "RIGHTBRACKET",
consuming = "none"
},

Expand Down
2 changes: 2 additions & 0 deletions worker-robots.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,8 @@ function get_blueprint_info(stack, in_hand)
end
result = result .. signal.signal.name
end

result = result .. ", " .. stack.get_blueprint_entity_count() .. " entities in total "
--game.print(result)
return result
end
Expand Down

0 comments on commit 3ccd9d9

Please sign in to comment.