代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。

原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html


 1
 2一二七.用岩石种海洋(建造护城河)
 3
 4	MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/inv_rocks.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
 5
 6local function ondeploy(inst, pt, deployer)
 7	local ground = GetWorld()
 8	if ground then
 9	   local original_tile_type = ground.Map:GetTileAtPoint(pt.x, pt.y, pt.z)
10	   local x, y = ground.Map:GetTileCoordsAtPoint(pt.x, pt.y, pt.z)
11	   if x and y then
12		  ground.Map:SetTile(x,y, GROUND.IMPASSABLE)
13		  ground.Map:RebuildLayer( original_tile_type, x, y )
14		  ground.Map:RebuildLayer( GROUND.IMPASSABLE, x, y )
15	   end
16	   local minimap = TheSim:FindFirstEntityWithTag("minimap")
17	   if minimap then
18		  minimap.MiniMap:RebuildLayer( original_tile_type, x, y )
19		  minimap.MiniMap:RebuildLayer( GROUND.IMPASSABLE, x, y )
20	   end
21	end
22	inst.components.stackable:Get():Remove()
23end
24	inst:AddComponent("deployable")
25	inst.components.deployable.ondeploy = ondeploy
26	inst.components.deployable.min_spacing = 0
27	inst.components.deployable.placer = "gridplacer"
28
29	即可用岩石种海洋,建造护城河。如果对自己建的岛不满意,也可以用岩石修改哦。岩石种过海洋后,会保留岸边的贴图,存档退出后再进入游戏就正常了。不要将海洋建在路底下