Game player build range

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Lukasecicek
Inserter
Inserter
Posts: 26
Joined: Mon Mar 11, 2013 9:42 am
Contact:

Game player build range

Post by Lukasecicek »

Hello, i did use the search button, but with no results...
I would like to make a simple mod making the player able to build at twice the range he can right now. I have found its somehow related to onbuiltentity, but i dont really have enough experience to make it work...

Can somebody point me in the right direction please?

drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: Game player build range

Post by drs9999 »

If the building range isn't defined on the player-definition, which I believe isn't otherwise you probably wouldn't ask ;) you have to use a workaround.

What I could imagine is using the OnPut-event, which doesn't depend on the building-range.
So you could do the following in the event:

Code: Select all

1) check if the event-position is inside the new custom build range
2) check if the item/entity that is currently attached to the cursor can be placed there (there is a mehtod for this)
3) use game.createentity to create the entity there and decrease the item-count in the player's inventory

if 1) or 2) fails: do nothing
Drawback is that the user don't receive any feedback if the cursor is currently inside the higher building range before he actually try to build the entity.

User avatar
Lukasecicek
Inserter
Inserter
Posts: 26
Joined: Mon Mar 11, 2013 9:42 am
Contact:

Re: Game player build range

Post by Lukasecicek »

Thank you very much, i will definetly try that approach, but it gets more complicated than i though :)

Post Reply

Return to “Modding help”