Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caravan interrupts and more #296

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0c1a67b
something something caravan interrupts
Jan 22, 2025
24ccf4d
Added initial version of edit interrupt gui
Jan 23, 2025
9cee5bd
Interrupts are now properly added to and stored in caravans
Jan 23, 2025
5f9813e
Interrupts can now be renamed
Jan 23, 2025
fcc700e
Made interrupt gui relative (temporarily?)
Jan 24, 2025
3d420f2
Added interrupt edit button and added all core elements to interrupt …
Jan 24, 2025
be22f47
Interrupt schedule should now be rendered
Jan 25, 2025
f5d4b91
circuit condition static is now a free action
Jan 26, 2025
c7729f6
renamed prtotypes to caravan_prototypes
Jan 28, 2025
9987f11
Improved several caravan tasks, increased number of fuel slots
Jan 28, 2025
af5a39f
Implemented changing interrupt schedule
Jan 29, 2025
8641d14
Fixed shuffling schedule in caravan gui
Jan 30, 2025
1cece08
Interrupts now add temporary stops to the schedule
Jan 30, 2025
846ddd9
TODO
Jan 30, 2025
11257df
Improved fuel slot spacing to be consitent with train gui
Jan 30, 2025
acc4e8e
Separated building actions gui into a separate function, changed some…
Jan 30, 2025
32bddae
Melon does not know the difference between left and right
Jan 31, 2025
f5c6f7c
Some action refactoring
Jan 31, 2025
534f3ca
Added "specific food" action, bug fixes
Jan 31, 2025
e373b89
Fixed default actions
Feb 3, 2025
61c22bf
Open on map button in caravan gui and slightly improved gui
Feb 3, 2025
63aa0bb
Added localised name to caravan gui (only affects new caravans)
Feb 3, 2025
afb859f
Fixed clicking on schedule in interrupt gui, fixed interrupt data res…
Feb 3, 2025
b054a21
Fuel inventory now supports basic stack transfer actions
Feb 3, 2025
bc8cadf
"View on map" button now opens the position on the camera instead of …
Feb 5, 2025
a7265eb
New interrupt conditions, bugfixes
Feb 5, 2025
6f8fed8
Added "Allow interrupting other interrupts" functionality
Feb 8, 2025
cc179cd
Fixed caravans of all types being smaller than intended
Feb 8, 2025
7d9c222
Increased selection boxes of all caravan types to better match their …
Feb 8, 2025
e0d7a9a
Changed load/unload actions back to using goal amount and "wait until…
Feb 10, 2025
e771213
Fix bug with action shuffling
Feb 10, 2025
0ef5873
Fix actions not accounting for when goal is nil
Feb 10, 2025
647d1b2
Migrations
Feb 11, 2025
9f32a50
Gui improvements
Feb 12, 2025
ecaf4bf
Interrupt tooltips
Feb 12, 2025
2f52403
"Add interrupt" gui improvements
Feb 12, 2025
808414f
Implemented deleting interrupts
Feb 12, 2025
73262b5
Made interrupt play button functional
Feb 13, 2025
308321b
Interrupt window close button
Feb 13, 2025
3f7b3b0
Interrupts are now copy-pastable between caravans
Feb 14, 2025
e0c26ad
Fuel slot tooltips now show item tooltip if present
Feb 14, 2025
aeae057
Action validity check and bugfixes
Feb 14, 2025
8da697a
bugfixes
Feb 14, 2025
ef652d1
bugfixes
Feb 14, 2025
4478d1c
"at outpost" conditions, fixes
Feb 15, 2025
1f17d35
Updated valid actions
Feb 15, 2025
3f0b3a4
Migrations
Feb 15, 2025
a9a8a03
EN locale
Feb 15, 2025
98f7120
RU locale
Feb 15, 2025
7f20317
RU locale
Feb 15, 2025
f5434e5
UK locale
Feb 15, 2025
777f867
Locale fix
Feb 15, 2025
7773c95
Check that entity is an outpost for "at outpost" actions
Feb 15, 2025
72ce159
Changelog
Feb 15, 2025
38fe9a7
Merge branch 'master' into caravan_interrupt
notnotmelon Feb 24, 2025
453c763
Resolve crash when waiting at infinity chest.
notnotmelon Feb 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Date: ?
- Fixed crash starting a new game without AE. Resolves https://github.com/pyanodon/pybugreports/issues/831
- Fixed crash deleting a silo during rocket launch. Resolves https://github.com/pyanodon/pybugreports/issues/832
- Updated Ukrainian translation.
- Caravans schedules now support interrupts. Huge thank-you to O5M0 for the amazing PR. https://github.com/pyanodon/pyalienlife/pull/296
- Increased inventory size of caravans 1 -> 2 and aerial caravans 2 -> 4
- Improved many aspects of caravan GUI.
- Added new actions to caravans.
- Increased selction boxes of all caravans to fit better with the graphics.
---------------------------------------------------------------------------------------------------
Version: 3.0.34
Date: 2025-1-20
Expand Down
23 changes: 21 additions & 2 deletions locale/en/caravan.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ idle=Idle
[caravan-gui]
add-outpost=+ Add destination
add-action=+ Add action
entity-position=__1__ @ {__2__, __3__}
map-position={__1__, __2__}
entity-position=__1__ [__2__, __3__]
map-position=[gps=__1__,__2__] [__1__, __2__]
refocus=Refocus
favorite-foods-main=Favorite foods:\n__1__
favorite-foods-sub=__1__ __2__ → __3__ actions
Expand All @@ -37,10 +37,16 @@ current-action=Current action: __1__
current-destination=__1__m from __2__
more-items=__1__ more...
the-inventory-is-empty=The inventory is empty.
delete-interrupt=Delete interrupt
confirm-deletion=Are you sure?
cancel-deletion=Cancel deletion
caravan-inventory=Caravan inventory
not-specified=(Not specified)

[caravan-actions]
time-passed=Wait
store-food=Store food
store-specific-food=Store food until
fill-inventory=Fill cargo
empty-inventory=Empty cargo
item-count=Until caravan has exactly N items
Expand All @@ -50,6 +56,19 @@ circuit-condition=Circuit condition
circuit-condition-static=Circuit condition with static value
empty-autotrash=Collect all autotrash
traveling=Traveling
load-caravan=Load items until caravan has
unload-caravan=Unload items until caravan has
load-target=Load items until target has
unload-target=Unload items until target has
is-inventory-full=Inventory full
is-inventory-empty=Inventory empty
caravan-item-count=Cargo item count
target-item-count=Target item count
food-count=Food count
at-outpost=At specified outpost
not-at-outpost=Not at specified outpost
at-outpost2=at __1__
not-at-outpost2=not at __1__

[item-name]
caravan-control=Caravan control
Expand Down
23 changes: 21 additions & 2 deletions locale/ru/caravan.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ idle=Ожидание
[caravan-gui]
add-outpost=+ Добавить пункт назначения
add-action=+ Добавить действие
entity-position=__1__ @ {__2__, __3__}
map-position={__1__, __2__}
entity-position=__1__ [__2__, __3__]
map-position=[gps=__1__,__2__] [__1__, __2__]
refocus=Перефокусироваться
favorite-foods-main=Любимая еда:\n__1__
favorite-foods-sub=__1__ __2__ → __3__ действий
Expand All @@ -37,10 +37,16 @@ current-action=Текущее действие: __1__
current-destination=__1__ м от __2__
more-items=ещё __1__...
the-inventory-is-empty=Инвентарь пуст.
delete-interrupt=Удалить прерывание
confirm-deletion=Вы уверены?
cancel-deletion=Отменить удаление
caravan-inventory=Инвентарь каравана
not-specified=(Не указано)

[caravan-actions]
time-passed=Ждать
store-food=Запасать еду
store-specific-food=Запасать еду пока
fill-inventory=Заполнить грузом
empty-inventory=Выложить груз
item-count=Пока в караване не будет ровно N предметов
Expand All @@ -50,6 +56,19 @@ circuit-condition=Логическое условие
circuit-condition-static=Логическое условие с постоянной величиной
empty-autotrash=Собрать всё из ячеек для мусора
traveling=Путешествует
load-caravan=Загружать предметы пока в караване не будет
unload-caravan=Выгружать предметы пока в караване не будет
load-target=Загружать предметы пока у цели не будет
unload-target=Выгружать предметы пока у цели не будет
is-inventory-full=Инвентарь полон
is-inventory-empty=Инвентарь пуст
caravan-item-count=Количество предметов в караване
target-item-count=Количество предметов у цели
food-count=Количество еды
at-outpost=На указаном аванпосте
not-at-outpost=Не на указаном аванпосте
at-outpost2=на __1__
not-at-outpost2=не на __1__

[item-name]
caravan-control=Управление караваном
Expand Down
143 changes: 81 additions & 62 deletions locale/uk/caravan.cfg
Original file line number Diff line number Diff line change
@@ -1,63 +1,82 @@
[entity-name]
caravan=Караван
flyavan=Повітряний караван
nukavan=☢ Караван ☢
outpost=Караванна застава
outpost-aerial=Повітряна застава

[entity-description]
caravan=Повільна наземна істота з відсутністю свободи вибору (нікого вам не нагадує?). Не надто кмітливий, але надійний.
flyavan=Іноді ми заходимо занадто далеко. Сильно модифікована істота, створена з використанням генів земних китів та генома інопланетян, із заміною деяких органів та частин на аналогічний біомеханічний відповідник, що дозволяє плавати та перевозити вантаж.
nukavan=Тип каравану зі "спецдоставкою".
outpost=Склад речей та їжі для наземних караванів.
outpost-aerial=Склад речей та їжі для повітряних караванів.

[entity-status]
healthy=Здоровий
starved=Голодний
wounded=Поранений
idle=Очікує

[caravan-gui]
add-outpost=+ Додати пункт призначення
add-action=+ Додати дію
entity-position=__1__ @ {__2__, __3__}
map-position={__1__, __2__}
refocus=Перефокусувати
favorite-foods-main=Улюблений корм:\n__1__
favorite-foods-sub=__1__ __2__ → __3__ дій
wait=Дочекатись виконання
hello-my-name-is=[font=default-bold]Привіт, мене звати: [color=255,210,73]__1__[/color][/font]
caption=Менеджер караванів
empty=Це менеджер караванів. Тут ви бачите всі розміщені каравани та їхній поточний статус.
empty-2=Зараз у вас немає караванів.
open=Відкрити __1__
view-on-map=Переглянути на карті
current-action=Поточна дія: __1__
current-destination=__1__ м від __2__
more-items=ще __1__...
the-inventory-is-empty=Інвентар порожній.

[caravan-actions]
time-passed=Чекати
store-food=Запасати їжу
fill-inventory=Заповнити вантажем
empty-inventory=Розвантажити
item-count=Допоки караван не міститиме N предметів
inverse-item-count=Допоки у місці призначення не знаходитиметься N предметів
detonate=Підірвати
circuit-condition=Логічна умова
circuit-condition-static=Логічна умова із статичним значенням
empty-autotrash=Забрати все із сміттєвих слотів
traveling=Подорожує

[item-name]
caravan-control=Керування караваном
gastrocapacitor=Гастроконденсатор

[caravan-warnings]
no-destination=Пункт призначення було знищено для [item=__1__] @ [gps=__2__,__3__]

[virtual-signal-name]
caravan-map-tag=Мітка каравану на карті
[entity-name]
caravan=Караван
flyavan=Повітряний караван
nukavan=☢ Караван ☢
outpost=Караванна застава
outpost-aerial=Повітряна застава

[entity-description]
caravan=Повільна наземна істота з відсутністю свободи вибору (нікого вам не нагадує?). Не надто кмітливий, але надійний.
flyavan=Іноді ми заходимо занадто далеко. Сильно модифікована істота, створена з використанням генів земних китів та генома інопланетян, із заміною деяких органів та частин на аналогічний біомеханічний відповідник, що дозволяє плавати та перевозити вантаж.
nukavan=Тип каравану зі "спецдоставкою".
outpost=Склад речей та їжі для наземних караванів.
outpost-aerial=Склад речей та їжі для повітряних караванів.

[entity-status]
healthy=Здоровий
starved=Голодний
wounded=Поранений
idle=Очікує

[caravan-gui]
add-outpost=+ Додати пункт призначення
add-action=+ Додати дію
entity-position=__1__ [__2__, __3__]
map-position=[gps=__1__,__2__] [__1__, __2__]
refocus=Перефокусувати
favorite-foods-main=Улюблений корм:\n__1__
favorite-foods-sub=__1__ __2__ → __3__ дій
wait=Дочекатись виконання
hello-my-name-is=[font=default-bold]Привіт, мене звати: [color=255,210,73]__1__[/color][/font]
caption=Менеджер караванів
empty=Це менеджер караванів. Тут ви бачите всі розміщені каравани та їхній поточний статус.
empty-2=Зараз у вас немає караванів.
open=Відкрити __1__
view-on-map=Переглянути на карті
current-action=Поточна дія: __1__
current-destination=__1__ м від __2__
more-items=ще __1__...
the-inventory-is-empty=Інвентар порожній.
delete-interrupt=Видалити преривання
confirm-deletion=Підтвердити видалення?
cancel-deletion=Скасувати видалення
caravan-inventory=Інвентар каравана
not-specified=(Не вказано)

[caravan-actions]
time-passed=Чекати
store-food=Запасати їжу
store-specific-food=Запасати їжу допоки
fill-inventory=Заповнити вантажем
empty-inventory=Розвантажити
item-count=Допоки караван не міститиме N предметів
inverse-item-count=Допоки у місці призначення не знаходитиметься N предметів
detonate=Підірвати
circuit-condition=Логічна умова
circuit-condition-static=Логічна умова із статичним значенням
empty-autotrash=Забрати все із сміттєвих слотів
traveling=Подорожує
load-caravan=Завантажувати предмети допоки караван не містиме
unload-caravan=Розвантажувати предмети допоки караван не містиме
load-target=Завантажувати предмети допоки у місці призначення не знаходитиметься
unload-target=Розвантажувати предмети допоки у місці призначення не знаходитиметься
is-inventory-full=Інвентар повний
is-inventory-empty=Інвентар порожній
caravan-item-count=Кількість предметів у вантажі
target-item-count=Кількість предметів у місці призначення
food-count=Кількість їжі
at-outpost=У вказаної застави
not-at-outpost=Не у вказаної застави
at-outpost2=у __1__
not-at-outpost2=не у __1__

[item-name]
caravan-control=Керування караваном
gastrocapacitor=Гастроконденсатор

[caravan-warnings]
no-destination=Пункт призначення було знищено для [item=__1__] @ [gps=__2__,__3__]

[virtual-signal-name]
caravan-map-tag=Мітка каравану на карті
no-fuel=Паливо відсутнє
48 changes: 48 additions & 0 deletions migrations/caravan_interrupts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
for unit_number, caravan_data in pairs(storage.caravans or {}) do
caravan_data.interrupts = caravan_data.interrupts or {}

-- Increase fuel inventory sizes
local old_inventory = caravan_data.fuel_inventory
local new_inventory = game.create_inventory(#old_inventory * 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause issues. Caravans in previous versions had different inventory sizes than 1. I would recommend to instead import caravan-prototypes.lua from within the migration and set this value directly to prototype.fuel_size

for i = 1, #old_inventory do
new_inventory[i].set_stack(old_inventory[i])
end
caravan_data.fuel_inventory = new_inventory
old_inventory.destroy()

-- Set a name for old caravan inventories
local old_inventory = caravan_data.inventory
local new_inventory = game.create_inventory(#old_inventory, {"caravan-gui.caravan-inventory"})
for i = 1, #old_inventory do
new_inventory[i].set_stack(old_inventory[i])
end
caravan_data.inventory = new_inventory
old_inventory.destroy()

-- Replaces one actions with two new counterparts. This clutters the schedule ui a bit, but behaves identically to the old actions
for i, schedule in pairs(caravan_data.schedule or {}) do
for j, action in pairs(schedule.actions or {}) do
local replacements = {}
if action.type == "item-count" then
replacements[1] = "load-caravan"
replacements[2] = "unload-caravan"
end
if action.type == "inverse-item-count" then
replacements[1] = "load-target"
replacements[2] = "unload-target"
end
if #replacements > 0 then
action.type = replacements[1]
action.localised_name = {"caravan-actions."..replacements[1]}
local new_action = table.deepcopy(action)
new_action.type = replacements[2]
new_action.localised_name = {"caravan-actions."..replacements[2]}
table.insert(schedule.actions, j + 1, new_action)
if caravan_data.action_id > j then caravan_data.action_id = caravan_data.action_id + 1 end
end
if action.type == "store-food" then
action.async = true -- Old store food behaved as if async was true
end
end
end
end
4 changes: 1 addition & 3 deletions prototypes/creatures/caravan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ data:extend {{
healing_per_tick = 0.03,
collision_box = {{-0.45, -0.45}, {0.45, 0.45}},
selection_priority = 51,
selection_box = {{-1.1, -1.1}, {1.1, 1.1}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
attack_parameters = {
type = "projectile",
range = 0,
Expand Down Expand Up @@ -172,7 +172,6 @@ data:extend {{
frame_count = 30,
direction_count = 16,
shift = util.mul_shift(util.by_pixel(-0, -0)),
scale = _G.scale,
flags = {"no-scale"},
},
{
Expand All @@ -195,7 +194,6 @@ data:extend {{
frame_count = 30,
direction_count = 16,
shift = util.mul_shift(util.by_pixel(-0, -0), 0.5),
scale = _G.scale,
flags = {"no-scale"},
},
{
Expand Down
3 changes: 1 addition & 2 deletions prototypes/creatures/flying-caravan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ data:extend
collision_box = {{0, 0}, {0, 0}},
render_layer = "air-object",
collision_mask = {layers = {}, not_colliding_with_itself = true},
selection_box = {{-1.5, -3}, {1.5, 3}},
selection_box = {{-1.5, -4.5}, {1.5, 4.5}},
selection_priority = 51,
attack_parameters =
{
Expand Down Expand Up @@ -180,7 +180,6 @@ data:extend
frame_count = 50,
direction_count = 16,
shift = util.mul_shift(util.by_pixel(-0, -0)),
scale = _G.scale,
},
{
filenames =
Expand Down
3 changes: 1 addition & 2 deletions prototypes/creatures/nuka-caravan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ local unit = {
healing_per_tick = 0.01,
collision_box = {{-0.6, -0.6}, {0.6, 0.6}},
selection_priority = 51,
selection_box = {{-1, -1}, {1, 1}},
selection_box = {{-1, -1.5}, {1, 1.5}},
attack_parameters = {
type = "projectile",
range = 0,
Expand Down Expand Up @@ -167,7 +167,6 @@ local unit = {
frame_count = 26,
direction_count = 16,
shift = util.mul_shift(util.by_pixel(-0, -0)),
scale = _G.scale
},
{
filenames = {
Expand Down
Loading