Droped items?

Place to get help with not working mods / modding interface.
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Droped items?

Post by ficolas »

Can we spawn items on the floor by the code? I think this was added in 0.3, but im not sure how or if we can do it.

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Droped items?

Post by kovarex »

Code: Select all

game.createentity{name="item-on-ground", position=game.player.character.position, stack={name="iron-plate"}}
I will work on the documentation for a whole day after the 0.4 release I promise :)

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Droped items?

Post by ficolas »

:) haha thanx

In my opinion, the best way to documentate things, is to write them in a note on your desktop while you are making it, because I allways forget something.

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Droped items?

Post by ficolas »

game.findentities doesnt find droped items :(
This makes transport belts be stuck when the code places more than one item at the same place :(

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Droped items?

Post by kovarex »

ficolas wrote:game.findentities doesnt find droped items :(
This makes transport belts be stuck when the code places more than one item at the same place :(
I can check later, but I doubt it.
To avoid collisions, it is better (and faster) to use game.canplaceentity

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Droped items?

Post by ficolas »

kovarex wrote:
ficolas wrote:game.findentities doesnt find droped items :(
This makes transport belts be stuck when the code places more than one item at the same place :(
I can check later, but I doubt it.
To avoid collisions, it is better (and faster) to use game.canplaceentity
But will that work with transport belts?

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Droped items?

Post by ficolas »

Also, how do I use canplaceentity? I tried by using a table ({x,y}) and it says string expected, got nil.

How can you tell if you can place an entity with just a string? dont you need a table with the position and the name of the entity? :S

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Droped items?

Post by rk84 »

Same way you create entity.

Code: Select all

if game.canplaceentity({ name = "iron-chest", position = {0,0}}) then
	game.createentity({ name = "iron-chest", position = {0,0}, force=game.player.force})
end
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

Post Reply

Return to “Modding help”