Skip to content

Commit

Permalink
Companion Drone compatibility #307
Browse files Browse the repository at this point in the history
  • Loading branch information
KiwiHawk committed Nov 19, 2023
1 parent 12650b0 commit 43bcb1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions SeaBlock/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Date: ???
- Fixed Exoplanetary Studies Lab recipe not including previous lab tier #303
- Fixed Wind Turbine energy production graph #304
- Fixed Washing Plant pipe arrow #305
- Fixed Companion Drone multiplayer compatibility #307
---------------------------------------------------------------------------------------------------
Version: 0.5.13
Date: 14.07.2023
Changes:
- Milestones mod compatibility #292
Expand Down
17 changes: 11 additions & 6 deletions SeaBlock/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,17 @@ if script.active_mods["Companion_Drones"] then
if s then
local companions = s.find_entities_filtered({ name = "companion" })
for _, companion in pairs(companions) do
companion.remove_item("coal")
companion.insert("wood-pellets")
local grid = companion.grid
for _, item in pairs(grid.equipment) do
if (item.name == "companion-defense-equipment") or (item.name == "companion-shield-equipment") then
grid.take({ equipment = item })
local inventory = companion.get_main_inventory()
local i = companion.remove_item("coal")
-- Only do drone inventory cleanup if coal is found
-- Else players will get free wood pellets any time a new player joins
if i > 0 then
companion.insert("wood-pellets")
local grid = companion.grid
for _, item in pairs(grid.equipment) do
if (item.name == "companion-defense-equipment") or (item.name == "companion-shield-equipment") then
grid.take({ equipment = item })
end
end
end
end
Expand Down

0 comments on commit 43bcb1d

Please sign in to comment.