Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Isaacg

Any way to change land into ocean?

Recommended Posts

Isaacg    159

Interesting idea. I think the walls would be pretty laggy, though, since the game calculates collision for each wall independently. The only way to really get around that it remove the terrain outside of where the walls are now, and then remove the walls-- that way the game is using the more efficient collision detection around the edges of the land.

 

I added this function in consolecommands.lua for this purpose:

function c_setTile(newType)

    local pos = TheInput:GetWorldPosition()

    local x, y = TheWorld.Map:GetTileCoordsAtPoint(pos.x, pos.y, pos.z)

    local oldType = TheWorld.Map:GetTileAtPoint(pos.x, pos.y, pos.z)

    TheWorld.Map:SetTile(x, y, newType)

    TheWorld.Map:RebuildLayer(oldType, x, y)

    TheWorld.Map:RebuildLayer(newType, x, y)

    TheWorld.minimap.MiniMap:RebuildLayer(oldType, x, y)

    TheWorld.minimap.MiniMap:RebuildLayer(newType, x, y)

end

To remove the land (set it to water), use:

c_setTile(1)

(it applies it at the tile closest to the mouse).

 

Unfortunately you have to restart the server before it recalculates the edges of the land, though.

 

Thanks Zillvr and Rez, it worked :-)

c_setTile(1) = Ocean

c_setTile(0) = Land

Share this post


Link to post
Share on other sites
Isaacg    159

Is there any way to make shortcuts for commands, for example deleting an object is TheInput:GetWorldEntityUnderMouse():Remove()
Can I rewrite or add a shortcut to it so that it is like c_delete?

Share this post


Link to post
Share on other sites
Petzi    28

Is there any way to make shortcuts for commands, for example deleting an object is TheInput:GetWorldEntityUnderMouse():Remove()

Can I rewrite or add a shortcut to it so that it is like c_delete?

 

Looking at what rezecib did, you can probably do something similar, like this:

function c_delete()    TheInput:GetWorldEntityUnderMouse():Remove()end

Share this post


Link to post
Share on other sites
Isaacg    159

Another question, how to do I change existing maps settings (like only winter or only night into default)

Share this post


Link to post
Share on other sites
rezecib    3,142
Also can I bind console commands to a hotkey? Would be great
Look at debugkeys. It's not normally active (it's something the devs use, I believe), but that is basically a bunch of console commands bound to F#-keys.

 

Another question, how to do I change existing maps settings (like only winter or only night into default)
That... I'm not sure. It might be possible, but I don't know. Look at clock and see what events it's listening to, then try pushing them :p 

Share this post


Link to post
Share on other sites
MelissaH33    3

Old thread, but bumping it back up!  Is this still working?  I gave it a try and the server rebooted just after the settile console command.  No errors in log, just a reboot and the tile didn't change.  Desperately trying to make a griefer island and can't figure it out! No errors in the consolecommands.lua. 

Share this post


Link to post
Share on other sites