Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiplacon authored Sep 8, 2022
1 parent 225d375 commit a208af3
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 5 deletions.
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
---------------------------------------------------------------------------------------------------
Version: 1.1.2
Date: 9/7/2022
Changes:
- Placing a Zipline Terminal now adds a marker on the map for it. Recommended by obfuscatedgenerated
Bugfixes:
- Fixed crash when the automatic zipline path finder tried to path through an electric pole ghost
- Fixed that logistics requests/trash wouldn't carry over when getting on/off ziplines. Reported by obfuscatedgenerated
---------------------------------------------------------------------------------------------------
Version: 1.1.1
Date: 9/2/2022
Additions:
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "RenaiTransportation",
"version": "1.1.1",
"version": "1.1.2",
"title": "Renai Transportation",
"author": "Kiplacon",
"factorio_version": "1.1",
Expand Down
7 changes: 7 additions & 0 deletions migrations/RT-1.1.2.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
for each, terminalStuff in pairs(global.ZiplineTerminals) do
if (terminalStuff.entity.valid) then
terminalStuff.tag = terminalStuff.entity.force.add_chart_tag(terminalStuff.entity.surface, {position=terminalStuff.entity.position, text=terminalStuff.name, icon={type="item", name="RTZiplineTerminalItem"}})
else
global.ZiplineTerminals[each] = nil
end
end
15 changes: 15 additions & 0 deletions script/MiscFunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ function SwapToGhost(player)
OG.get_inventory(defines.inventory.character_armor).clear()
OG.get_inventory(defines.inventory.character_trash).clear()
NEWHOST.cursor_stack.transfer_stack(OG.cursor_stack)
for i = 1, OG.request_slot_count do
local thing = OG.get_personal_logistic_slot(i)
NEWHOST.set_personal_logistic_slot(i, thing)
OG.clear_personal_logistic_slot(i)
end
---------- redo crafting queue -----------
if (TheList ~= nil) then
for i = #TheList, 1, -1 do
Expand Down Expand Up @@ -147,6 +152,11 @@ function SwapBackFromGhost(player, FlyingItem)
end
player.character.cursor_stack.transfer_stack(OG2.cursor_stack)
FlyingItem.SwapBack.character_inventory_slots_bonus = FlyingItem.SwapBack.character_inventory_slots_bonus-10000
for i = 1, OG2.request_slot_count do
local thing = OG2.get_personal_logistic_slot(i)
FlyingItem.SwapBack.set_personal_logistic_slot(i, thing)
OG2.clear_personal_logistic_slot(i)
end
---------- redo crafting queue -----------
if (TheList ~= nil) then
for i = #TheList, 1, -1 do
Expand Down Expand Up @@ -209,6 +219,11 @@ function SwapBackFromGhost(player, FlyingItem)
end
player.character.cursor_stack.transfer_stack(OG2.cursor_stack)
player.character.character_inventory_slots_bonus = player.character.character_inventory_slots_bonus-10000
for i = 1, OG2.request_slot_count do
local thing = OG2.get_personal_logistic_slot(i)
PlayerProperties.SwapBack.set_personal_logistic_slot(i, thing)
OG2.clear_personal_logistic_slot(i)
end
---------- redo crafting queue -----------
if (TheList ~= nil) then
for i = #TheList, 1, -1 do
Expand Down
13 changes: 9 additions & 4 deletions script/event/ClickGUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ local function FindPath(finish, start)
end

for each, neighbor in pairs(current.entity.neighbours["copper"]) do
local FromStart = current.FromStart + DistanceBetween(current.entity.position, neighbor.position)
if (analyzed[neighbor.unit_number] == nil and (#neighbor.neighbours["copper"] > 1 or neighbor.unit_number == finish.unit_number) and (possibilities[neighbor.unit_number] == nil or possibilities[neighbor.unit_number].FromStart > FromStart)) then
local difficulty = FromStart + DistanceBetween(neighbor.position, finish.position)
possibilities[neighbor.unit_number] = {entity=neighbor, FromStart=FromStart, FromFinish=DistanceBetween(neighbor.position, finish.position), difficulty=difficulty, parent=current.entity}
if (neighbor.type ~= "entity-ghost" and neighbor.type == "electric-pole") then
local FromStart = current.FromStart + DistanceBetween(current.entity.position, neighbor.position)
if (analyzed[neighbor.unit_number] == nil and (#neighbor.neighbours["copper"] > 1 or neighbor.unit_number == finish.unit_number) and (possibilities[neighbor.unit_number] == nil or possibilities[neighbor.unit_number].FromStart > FromStart)) then
local difficulty = FromStart + DistanceBetween(neighbor.position, finish.position)
possibilities[neighbor.unit_number] = {entity=neighbor, FromStart=FromStart, FromFinish=DistanceBetween(neighbor.position, finish.position), difficulty=difficulty, parent=current.entity}
end
end
end
end
Expand Down Expand Up @@ -92,6 +94,9 @@ ClickableStuff = {
local header = event.element.parent
local TerminalName = event.element.parent.TerminalName.text
global.ZiplineTerminals[event.element.parent.parent.tags.ID].name = TerminalName
if (global.ZiplineTerminals[event.element.parent.parent.tags.ID].tag.valid) then
global.ZiplineTerminals[event.element.parent.parent.tags.ID].tag.text = TerminalName
end
event.element.parent.TerminalName.destroy()
event.element.destroy()
header.add{type="label", name="TerminalName", caption=TerminalName}.style.font = "heading-1"
Expand Down
2 changes: 2 additions & 0 deletions script/event/entity_built.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ local function entity_built(event)

elseif (entity.name == "RTZiplineTerminal") then
global.ZiplineTerminals[entity.unit_number] = {entity=entity, name=game.backer_names[math.random(1, #game.backer_names)]}
local tag = entity.force.add_chart_tag(entity.surface, {position=entity.position, text=global.ZiplineTerminals[entity.unit_number].name, icon={type="item", name="RTZiplineTerminalItem"}})
global.ZiplineTerminals[entity.unit_number].tag = tag
end
end

Expand Down

0 comments on commit a208af3

Please sign in to comment.