Merge branch 'aperx' into main

This commit is contained in:
2025-01-30 16:49:14 +09:00
committed by GitHub
44 changed files with 533 additions and 604 deletions

View File

@@ -42,7 +42,7 @@ Commands.new("set-always-day", { "exp-commands_cheat.description-always-day" })
else
surface.always_day = state
end
game.print{ "exp-commands_cheat.always-day", format_player_name(player), surface.localised_name, surface.always_day }
game.print{ "exp-commands_cheat.always-day", format_player_name(player), surface.name, surface.always_day }
end)
--- Toggles friendly fire for your force or another
@@ -89,7 +89,7 @@ Commands.new("clear-pollution", { "exp-commands_cheat.description-clear-pollutio
:register(function(player, surface)
--- @cast surface LuaSurface
surface.clear_pollution()
game.print{ "exp-commands_cheat.clear-pollution", format_player_name(player), surface.localised_name }
game.print{ "exp-commands_cheat.clear-pollution", format_player_name(player), surface.name }
end)
--- Toggles pollution being enabled in the game

View File

@@ -20,11 +20,11 @@ Commands.new("kill", { "exp-commands_kill.description" })
if other_player == nil then
-- Can only be nil if the target is the player and they are already dead
return Commands.status.error{ "exp-commands_kill.already-dead" }
elseif other_player == player then
-- You can always kill yourself
other_player.character.die()
elseif highest_role(other_player).index < highest_role(player).index then
-- Can kill lower role players
elseif (other_player == player) or (highest_role(other_player).index < highest_role(player).index) then
-- You can always kill yourself or can kill lower role players
if script.active_mods["space-age"] then
other_player.surface.create_entity{ name = "lightning", position = { other_player.position.x, other_player.position.y - 16 }, target = other_player.character }
end
other_player.character.die()
else
return Commands.status.unauthorised{ "exp-commands_kill.lower-role" }

View File

@@ -10,7 +10,7 @@ Commands.new("lawnmower", { "exp-commands_lawnmower.description" })
:register(function(player, range)
--- @cast range number
local surface = player.surface
-- Intentionally left as player.position to allow use in remote view
local entities = surface.find_entities_filtered{ position = player.position, radius = range, type = "corpse" }
for _, entity in pairs(entities) do
@@ -18,7 +18,7 @@ Commands.new("lawnmower", { "exp-commands_lawnmower.description" })
entity.destroy()
end
end
local replace_tiles = {}
local tiles = surface.find_tiles_filtered{ position = player.position, radius = range, name = { "nuclear-ground" } }
for i, tile in pairs(tiles) do

View File

@@ -13,11 +13,16 @@ Commands.new("waterfill", { "exp-commands_waterfill.description" })
if Selection.is_selecting(player, SelectionName) then
Selection.stop(player)
return Commands.status.success{ "exp-commands_waterfill.exit" }
elseif player.get_item_count("cliff-explosives") == 0 then
return Commands.status.error{ "exp-commands_waterfill.requires-explosives" }
else
Selection.start(player, SelectionName)
return Commands.status.success{ "exp-commands_waterfill.enter" }
local item_count_cliff = player.get_item_count("cliff-explosives")
local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade"))
local item_count_total = item_count_cliff + item_count_craft
if item_count_total == 0 then
return player.print{ "exp-commands_waterfill.requires-explosives" }
else
Selection.start(player, SelectionName)
return player.print{ "exp-commands_waterfill.enter" }
end
end
end)
@@ -28,10 +33,12 @@ Selection.on_selection(SelectionName, function(event)
local player = game.players[event.player_index]
local surface = event.surface
--[[
if surface.planet and surface.planet ~= game.planets.nauvis then
player.print({ "exp-commands_waterfill.nauvis-only" }, Commands.print_settings.error)
return
end
]]
local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y)
if area_size > 1000 then
@@ -39,9 +46,12 @@ Selection.on_selection(SelectionName, function(event)
return
end
local item_count = player.get_item_count("cliff-explosives")
if item_count < area_size then
player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count }, Commands.print_settings.error)
local item_count_cliff = player.get_item_count("cliff-explosives")
local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade"))
local item_count_total = item_count_cliff + item_count_craft
if item_count_total < area_size then
player.print({ "exp-commands_waterfill.too-few-explosives", area_size, item_count_total }, Commands.print_settings.error)
return
end
@@ -59,7 +69,21 @@ Selection.on_selection(SelectionName, function(event)
surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0)
local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" }
player.remove_item{ name = "cliff-explosives", count = tile_count - remaining_tiles }
local t_diff = tile_count - remaining_tiles
if item_count_cliff >= t_diff then
player.remove_item{ name = "cliff-explosives", count = t_diff }
else
if item_count_cliff > 0 then
player.remove_item{ name = "cliff-explosives", count = item_count_cliff }
end
local item_count_needed = t_diff - item_count_cliff
if item_count_needed > 0 then
player.remove_item{ name = "explosives", count = 10 * item_count_needed }
player.remove_item{ name = "barrel", count = item_count_needed }
player.remove_item{ name = "grenade", count = item_count_needed }
end
end
if remaining_tiles > 0 then
player.print({ "exp-commands_waterfill.part-complete", tile_count, remaining_tiles }, Commands.print_settings.default)

View File

@@ -278,6 +278,6 @@ enter=Entered waterfill selection mode, select the area to fill with water.
exit=Exited waterfill selection mode.
nauvis-only=Can only waterfill on Nauvis, this may change in the future.
area-too-large=Selected area is too large, must be less than __1__ tiles, selected __2__.
too-few-explosives=Requires __1__ __ITEM__cliff-explosives__ you have __2__.
too-few-explosives=Requires __1__ __ITEM__cliff-explosives__ or its ingredients, you have __2__.
part-complete=__1__ tiles were filled with water, but entities are blocking __2__ tiles.
complete=__1__ tiles were filled with water.

View File

@@ -38,8 +38,8 @@ arg-surface=位面
arg-amount=數量
cheat-mode=作弊模式現在為 __1__
always-day=__1__ 把在 __2__ 的位面的永久白天設置為 __3__ 。
friendly-fire=__1__ 已為在 __2__ 的位面設定成 __3__ 。
research-all=__1__ 已為在 __2__ 的位面啟用所有科技 。
friendly-fire=__1__ 已為在 __2__ 的勢力設定成 __3__ 。
research-all=__1__ 已為在 __2__ 的勢力啟用所有科技 。
clear-pollution=__1__ 已為在 __2__ 的位面清除所有污染 。
pollution-enabled=__1__ 已設定污染為 __2__ 。
game-speed-set=__1__ 把遊戲速度改成 __2__ 。
@@ -278,6 +278,6 @@ enter=現在進入挖水區域選擇
exit=已進入挖水區域選擇
nauvis-only=只可在地星上填水,之後可能會再改變。
area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。
too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__你現在有 __2__ 個。
too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__ 或其材料,你現在有 __2__ 個。
part-complete=__1__ 格已填水,但有 __2__ 格有東西擋著。
complete=__1__ 格已經轉換好。

View File

@@ -38,8 +38,8 @@ arg-surface=位面
arg-amount=數量
cheat-mode=作弊模式現在為 __1__
always-day=__1__ 把在 __2__ 的位面的永久白天設置為 __3__ 。
friendly-fire=__1__ 已為在 __2__ 的位面設定成 __3__ 。
research-all=__1__ 已為在 __2__ 的位面啟用所有科技 。
friendly-fire=__1__ 已為在 __2__ 的勢力設定成 __3__ 。
research-all=__1__ 已為在 __2__ 的勢力啟用所有科技 。
clear-pollution=__1__ 已為在 __2__ 的位面清除所有污染 。
pollution-enabled=__1__ 已設定污染為 __2__ 。
game-speed-set=__1__ 把遊戲速度改成 __2__ 。
@@ -278,6 +278,6 @@ enter=現在進入挖水區域選擇
exit=已進入挖水區域選擇
nauvis-only=只可在地星上填水,之後可能會再改變。
area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。
too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__你現在有 __2__ 個。
too-few-explosives=需要 __1__ 個 __ITEM__cliff-explosives__ 或其材料,你現在有 __2__ 個。
part-complete=__1__ 格已填水,但有 __2__ 格有東西擋著。
complete=__1__ 格已經轉換好。