Skip to content

Commit

Permalink
1.1.29 MD2R Compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
randomflyingtaco committed Jun 1, 2023
1 parent 315c482 commit ed1b406
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Version: 1.1.29
Features:
- Added a new recipe to use high-temperature steam for quicker Liquid Tiberium production
- Added compatibility for P.U.M.P. (Thanks to Ferlonas and Xcone for the pull request)
- Added compatibility for Mining Drones 2.0 Remastered
---------------------------------------------------------------------------------------------------
Version: 1.1.28
Bugfixes:
Expand Down
15 changes: 13 additions & 2 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ script.on_init(function()
-- will stagnate instead of increasing with each new node found but updates will continue to happen for all fields.
global.minUpdateInterval = 1
global.intervalBetweenNodeUpdates = 18000
global.lastRescan = 0
global.tibPerformanceMultiplier = 1
global.tibFastForward = 1
global.tibGrowing = true
Expand Down Expand Up @@ -109,6 +110,7 @@ script.on_init(function()
for _, oreName in pairs(global.oreTypes) do
for i = 1,100 do
global.exemptDamageNames[oreName.."mining-drone"..i] = true
global.exemptDamageNames[oreName.."-mining-drone-"..i] = true --MD2R formatting
end
end
-- Immunity for AAI Miners
Expand Down Expand Up @@ -564,6 +566,12 @@ function doUpgradeConversions(data)
wall.destructible = false
end
end
for _, oreName in pairs(global.oreTypes) do
for i = 1,100 do
global.exemptDamageNames[oreName.."-mining-drone-"..i] = true --MD2R formatting
end
end
global.lastRescan = 0
end

if (data["mod_changes"]["Factorio-Tiberium"] and data["mod_changes"]["Factorio-Tiberium"]["new_version"]) and
Expand Down Expand Up @@ -1036,8 +1044,9 @@ commands.add_command("tibGrowAllNodes",
PlaceOre(global.tibGrowthNodeList[i], placements)
end
end
if game.active_mods["Mining-Drones-Tiberium"] then
if remote.interfaces["mining_drones"] and remote.interfaces["mining_drones"]["rescan_all_depots"] then
remote.call("mining_drones", "rescan_all_depots")
global.lastRescan = game.tick
end
game.player.print({"", timer, " end of tibGrowAllNodes"})
end
Expand Down Expand Up @@ -1306,8 +1315,10 @@ script.on_event(defines.events.on_tick, function(event)
if surface.count_entities_filtered{area = areaAroundPosition(position), name = treeBlockers} == 0 then
createBlossomTree(surface, position)
end
if game.active_mods["Mining-Drones-Tiberium"] then
-- 10 second cooldown on API call to avoid spam once you get to 100+ nodes
if (global.lastRescan + 600 < game.tick) and remote.interfaces["mining_drones"] and remote.interfaces["mining_drones"]["rescan_all_depots"] then
remote.call("mining_drones", "rescan_all_depots")
global.lastRescan = game.tick
end
else
removeNodeFromGrowthList(node)
Expand Down

0 comments on commit ed1b406

Please sign in to comment.