Guest User

multisignal-stickers.diff

a guest
Jul 8th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.55 KB | None | 0 0
  1. ---
  2. control.lua           | 39 ++++++++++++++++++++++++---------------
  3.  prototypes/entity.lua |  2 +-
  4.  2 files changed, 25 insertions(+), 16 deletions(-)
  5.  
  6. diff --git a/control.lua b/control.lua
  7. index 3bd844e..2e1bd7c 100644
  8. --- a/control.lua
  9. +++ b/control.lua
  10. @@ -1110,10 +1110,10 @@ local function carContents(car)
  11.          reqs[filter] = (reqs[filter] or 0) + game.item_prototypes[filter].stack_size
  12.        end
  13.      end
  14. -    for k,r in pairs(reqs) do
  15. -      local c = contents[k] or 0
  16. -      if r > c then
  17. -        contents[k] = c - r
  18. +    for key,required in pairs(reqs) do
  19. +      local contentCount = contents[key] or 0
  20. +      if required > contentCount then
  21. +        contents[key] = contentCount - required
  22.        end
  23.      end
  24.    end
  25. @@ -1724,23 +1724,32 @@ local function runCar(car)
  26.  
  27.    -- Check tile sitcker for re-direction
  28.    if cell.sticker ~= nil then
  29. +    local ignoreSticker = true
  30.      local control = cell.sticker.get_control_behavior()
  31. +
  32.      if control.enabled then
  33. -      local signal = control.get_signal(1)
  34. -      if signal ~= nil then
  35. -        if signal.signal ~= nil then
  36. -          -- sticker is set; check arrow
  37. -          contentsAndSignals()
  38. -          local name = signal.signal.name
  39. -          if contents[name] == nil or contents[name] == 0 then
  40. -            pathDirection = carDirection
  41. +      for slot = 1, control.signals_count do
  42. +        if ignoreSticker == true then
  43. +          local signal = control.get_signal(slot)
  44. +          if signal ~= nil then
  45. +            if signal.signal ~= nil then
  46. +              -- sticker is set; check arrow
  47. +              contentsAndSignals()
  48. +              local name = signal.signal.name
  49. +              if contents[name] == nil or contents[name] == 0 then
  50. +                -- check next signal
  51. +              else
  52. +                ignoreSticker = false
  53. +              end
  54. +            end
  55.            end
  56. -        else
  57. -          -- sticker is not set; ignore arrow
  58. -          pathDirection = carDirection
  59.          end
  60.        end
  61.      end
  62. +
  63. +    if ignoreSticker == true then
  64. +      pathDirection = carDirection
  65. +    end
  66.    end
  67.  
  68.    -- Restrict group paths
  69. diff --git a/prototypes/entity.lua b/prototypes/entity.lua
  70. index 11565cb..95a1073 100644
  71. --- a/prototypes/entity.lua
  72. +++ b/prototypes/entity.lua
  73. @@ -600,7 +600,7 @@ data:extend({
  74.      icon_size = 32,
  75.      tile_width = 1,
  76.      tile_height = 1,
  77. -    item_slot_count = 1,
  78. +    item_slot_count = 18,
  79.      sprites = {
  80.        north = {
  81.          filename = "__logicarts__/graphics/sticker.png",
  82. --
  83. 2.23.0
Advertisement
Add Comment
Please, Sign In to add comment