Jump to content

Rebuild World Border ?


Recommended Posts

Hi there, it's been a month that I've started a little mod... You can use it to place Turfs over water so it rebuild the Turf you want over it, like this :

1bv930.jpg.dedc1fa8d927c0da3252f3eda69271c6.jpg

My issue is that when you place the Turf, the ground type will be changed, but the border will still the same, which occur two problems :

- You can fall in water, cause there is no border to stop you

- The worst is that you actually CAN'T go on the turf you placed next to a shore cause the border is blocking you from reaching it

What I have1bv930.thumb.jpg.2eab655e441290695c6b61db70d5900d.jpg1bv930.thumb.jpg.d81cd81c4537ad8cf06672bca7360e72.jpgWhat I need

As far, the only way to reload the border around the turf I have is to reload your world, and things will be fine again, but I don't really expect that players and myself have to do that for every single turf :/

This is the function used to place the turf

local function ondeploy(inst, pt, deployer)
	if deployer ~= nil and deployer.SoundEmitter ~= nil then
		deployer.SoundEmitter:PlaySound("dontstarve/wilson/dig")
	end

	local map = TheWorld.Map
	local original_tile_type = map:GetTileAtPoint(pt:Get())
	local x, y = map:GetTileCoordsAtPoint(pt:Get())
	if x ~= nil and y ~= nil then
		map:SetTile(x, y, GROUND.FOREST)
		map:RebuildLayer(original_tile_type, x, y)
		map:RebuildLayer(GROUND.FOREST, x, y)
	end

	local minimap = TheWorld.minimap.MiniMap
	minimap:RebuildLayer(original_tile_type, x, y)
	minimap:RebuildLayer(GROUND.FOREST, x, y)
	
	inst.components.stackable:Get():Remove()
end

So, if someone is aware for a method to reload the borders to a turf (if it exist) I'm all ears to learn this forbidden knowledge. Thanks for the help !

Edited by ADM
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...