Page 2 of 2

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Sun Jul 24, 2016 2:41 pm
by Sunnova
Small change to get it to work, I'm sure I didn't do it the best way.

Old

Code: Select all

        -- On a lower interval rate, look for chests behind the belt to copy item type
        if tick.tick % chest_detection_rate == 0 then
          x = belt.entity.position.x;
          y = belt.entity.position.y;
          if belt.entity.direction == 0 then
            y = y + 1;
          elseif belt.entity.direction == 2 then
            x = x - 1;
          elseif belt.entity.direction == 4 then
            y = y - 1;
          elseif belt.entity.direction == 6 then
            x = x + 1;
          end

          chests = belt.entity.surface.find_entities_filtered({area = {{x,y},{x,y}}, type="container"});
          if #chests > 0 then
            inventory = chests[1].get_inventory(defines.inventory.chest);
            if inventory ~= nil
            and inventory.valid == true 
            and inventory.is_empty() == false 
            and inventory[1].valid == true
            and inventory[1].valid_for_read == true then
              belt.item = inventory[1].name;
            end
          end
        end
New

Code: Select all


        -- On a lower interval rate, look for chests behind the belt to copy item type
        if tick.tick % chest_detection_rate == 0 then
          x = belt.entity.position.x;
          y = belt.entity.position.y;
          if belt.entity.direction == 0 then
            chests = belt.entity.surface.find_entities_filtered{area = {{x,y},{x,y+1}}, type="container"};
          elseif belt.entity.direction == 2 then
            chests = belt.entity.surface.find_entities_filtered{area = {{x-1,y},{x,y}}, type="container"};
        elseif belt.entity.direction == 4 then
            chests = belt.entity.surface.find_entities_filtered{area = {{x,y-1},{x,y}}, type="container"};
          elseif belt.entity.direction == 6 then
            chests = belt.entity.surface.find_entities_filtered{area = {{x,y},{x+1,y}}, type="container"};
          end

          if #chests > 0 then
            inventory = chests[1].get_inventory(defines.inventory.chest);
            if inventory ~= nil
            and inventory.valid == true 
            and inventory.is_empty() == false 
            and inventory[1].valid == true
            and inventory[1].valid_for_read == true then
              belt.item = inventory[1].name;
            end
          end
        end

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Sun Jul 24, 2016 2:52 pm
by barrykun
charmead wrote:Small change to get it to work, I'm sure I didn't do it the best way.


Thanks for that, I havnt been able to test 0.13.10 because the version is unplayable in Linux. I'll have to wait for 0.13.11 where it's gonna be fixed. I'll update this mod then

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Tue Jul 26, 2016 11:00 pm
by winkieman
This is the message I get
Error while running the eventhandler__spawn-belt__/control.lua:116:An area of zero size is not supported. Either don't define area to seach the entrire surface or use 'position'.
No idea what it means but crashes the game.

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Tue Jul 26, 2016 11:24 pm
by barrykun
winkieman wrote:This is the message I get
Error while running the eventhandler__spawn-belt__/control.lua:116:An area of zero size is not supported. Either don't define area to seach the entrire surface or use 'position'.
No idea what it means but crashes the game.
Its one of the scripting changes in the lua api, i saw it documented in the changelog. I'll update this mod asap when I get a chance to play 0.13.11 thanks for reporting the error!

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Wed Jul 27, 2016 1:47 pm
by barrykun
Alright I've updated the mod to 1.0.2 and fixed the error caused by 0.13.11

I did not run into any lag or freezing issues while testing so I did not implement what charmead posted as a fix, if anyone noticed the lag/freeezing still in 0.13.11+ please let me know

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Sat Nov 05, 2016 11:28 am
by DeadPlanet
First post on the forums and it a necro. Nice way to make an entrance, Planet!

That being said... Does this mod work in 0.14?
I wanna do some testing with set-ups and this would be a marvellous tool.

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Sat Nov 05, 2016 11:34 am
by barrykun
It should work fine yes. It's available in the ingame mod portal.

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Sun Nov 06, 2016 10:09 am
by DeadPlanet
I found it, thnx!

The only thing that I found that might be bugged, if you set a spawnbelt to spawn anything but Iron Ore and send out construction robots to demolish it, it'll keep grabbing the spawned items and leave the belt spawning stuff.
You have to manually go and pick it up.

Also, when using blueprints both spawn and vanish belts will do nothing after being placed by robots. They just sit there. Being belts. Acting like 'regular' belts. d;

I'll do some further testing and report back.

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Sun Nov 06, 2016 11:28 am
by barrykun
I am aware of the behaviour of having them placed by robots. Didn't think of the demolishing thing to be honest. I suppose it should stop spawning when marked as deconstruct.

Thanks for the feedback.

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Fri May 05, 2017 10:26 pm
by DeadPlanet
When you get a mail that something was posted in this thread and you find there's nothing new there... Now that is some weird stuff.

Re: [MOD 0.12.x] Spawn Belt 0.1.1

Posted: Sat May 06, 2017 2:56 pm
by Sunnova
DeadPlanet wrote:When you get a mail that something was posted in this thread and you find there's nothing new there... Now that is some weird stuff.
My fault, I had posted a question about using red wires in version 1.0.5 to control what is spawned on the belt, figured it out and deleted my post. Sorry about that.