Generate resources in play time.

Place to get help with not working mods / modding interface.
Post Reply
User avatar
AlexPhoenix
Fast Inserter
Fast Inserter
Posts: 149
Joined: Tue Feb 18, 2014 7:48 am
Contact:

Generate resources in play time.

Post by AlexPhoenix »

Hello again.
I wanna make something like resource surveing.
mainly i wanna do somethink like survey bot, but i didnot see that this is possible.

So i think about georadar.

But i cannot find, which event i must use to imitate something like scanning?(and also how to create resources)

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

Re: Generate resources in play time.

Post by ficolas »

What is a survey bot?
Also when do you want to trigger this... When placing something? When an amount of time has passed?

The command to create a resource is game.createentity{name=,position=}
where name is for example iron-ore.
Also to specify the amount of ore in that ore chunk I think it is richness the field.

User avatar
AlexPhoenix
Fast Inserter
Fast Inserter
Posts: 149
Joined: Tue Feb 18, 2014 7:48 am
Contact:

Re: Generate resources in play time.

Post by AlexPhoenix »

ficolas wrote:What is a survey bot?
Also when do you want to trigger this... When placing something? When an amount of time has passed?

The command to create a resource is game.createentity{name=,position=}
where name is for example iron-ore.
Also to specify the amount of ore in that ore chunk I think it is richness the field.
survey bot is bot with will scan surface for resources.
or with radar scanning, or just when new chunk generated.
will look to what i can to do.

with creating i found all i needed.
amount field is amount of ore.
dont try with oil yet.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Generate resources in play time.

Post by FreeER »

the onsectorscanned event will be raised when a radar scans and onchunkgenerated when new land is explorered, and you can find ores just like any other entity (using findentitiesfiltered{area, type="resource"}). you could create a new radar that looks like a survey bot and then move it using game.canplaceentity (so you don't land on other entities or in water) and bot.teleport(position), to find where to move it you could probably modify the A* code/algorithm from drs9999, found here. A simple entity that when placed near a bot spawns some buttons could be used to 'program' the bot for what to look for (by asking the player what resources they want to find). Oh, and you can use bot.energy=100000000 to make it act as if it has a battery (so it doesn't need to be connected to an electrical network).

User avatar
AlexPhoenix
Fast Inserter
Fast Inserter
Posts: 149
Joined: Tue Feb 18, 2014 7:48 am
Contact:

Re: Generate resources in play time.

Post by AlexPhoenix »

i found another thing which is difficult for me.

when i place resource at tile, i try to use findnoncollidingposition, but resource dont block place as i see.
so there is any functions with which i can easy(and fast) find position to place resource(line findnoncollidingposition do).

or i must write my own function?(then i need to check tiles, how?)



found on dorum about game.gettile.
so looks like i will start to write my own function.

Post Reply

Return to “Modding help”