Starbound
26 평점
Invisible Doors
   
어워드
즐겨찾기
즐겨찾기됨
즐겨찾기 해제
파일 크기
게시일
21.323 KB
2016년 10월 18일 오전 9시 47분
1개의 변경 사항 ( 보기 )

다운로드 위해 구독하기
Invisible Doors

Weaver님의 1 모음집
Stuff Weaver Is Using Starbound
아이템 125개
설명
This is a variant of the invisible door (and hatch / trapdoor) that shows as nothing when open.

It does this by recording the background block you place it over and then mining them out. (Ideally it would store the blocks and drop them when you dismantle it, but that's a bit beyond me right now.)

Since it doesn't have a background when placed, it doesn't have any anchoring properties. This means you can place it in the air; however, you'll end up with a door that has air for both closed and open, which doesn't do a lot (it won't even block you then.

Here's a gfy of it being placed: https://gfycat.com/MeekCarefreeCrownofthornsstarfish
댓글 8
جو بلا أرجل 2017년 6월 20일 오전 6시 22분 
Where do you craft it?
RaveYard 2017년 1월 4일 오후 9시 53분 
This isn't meant to be insulting as in "this is useless" but I'm wondering what you literally use this for? It's really cool and the idea of this mechanic is awesome, but I'm wondering what context you'd planned to use it for in a building? I'd originally thought like... secret doors, but it looks like the back layer, so it'd just look like a tunnel that you couldn't walk through.
bk3000 2016년 10월 19일 오전 9시 48분 
actually kill
local pos = object.position()
because you don't need it
bk3000 2016년 10월 19일 오전 8시 34분 
If you use the automatic doors code, this would work for you.

"noAutomaticDoors" : true
"scripts" : ["scripts/weaver/inc_door.lua", "scripts/weaver/hiddenDoor.lua"]

hiddenDoor.lua could be nothing more than this


function initMaterialSpaces()
local bMats = {}

local pos = object.position()
for s, space in ipairs(storage.realSpaces) do
bMats[s] = world.material( space , "background") or "metamaterial:empty"
end

storage.matTableClosed = { {}, {} }
storage.matTableOpen = { {}, {} }

for i, spaces in ipairs(storage.spaces) do
table.insert(storage.matTableClosed[1], {spaces, bMats[i]})
end

storage.matTableClosed[2] = storage.matTableClosed[1]
end

Now that's gonna be hard to read without the indentation(thanks Steam) but it should do the job. And that should still work even if the automatic doors script changes a bit down the road.
bk3000 2016년 10월 19일 오전 8시 19분 
Never looked at that file before, but it doesn't actually delete any tiles. It reads the tiles in a very similar manor to what I typed out and uses object.setMaterialSpaces() to either place or remove the blocks.

Although it isn't a bad idea to use "metamaterial:empty" but I have a slicker way to use it than they did.
Weaver  [작성자] 2016년 10월 19일 오전 6시 11분 
You should be able to stuff the table in storage.something to make it persist in the save file. That's what CF's secretdoor.lua does for it's material tables as it is ... i think.

The bigger stumbling block was I couldn't locate a function to get the matitem for a given material name, so I went with the mining-damage-to-blocks thing to skip that step.

I do think I needed to get rid of the background blocks in some fasion though, since the point is to toggle between nothing/nothing and foreground/nothing. Ideally I'd be able to set the object to allow placing it on top of foreground blocks, turn the foreground blocks into a door, and just leave the background up to the user, but...
bk3000 2016년 10월 19일 오전 4시 01분 
You just can't format code on Steam... (shakes head)
bk3000 2016년 10월 19일 오전 4시 00분 
You don't actually have to mine the blocks out. You can just mimic them by scanning for the block, build material space table with that material, and switch it out when open/close.

I'm already doing that for my chameleon doors(blocks and objects mod). Feel free to borrow the code for your own implementation if you like. Although you're doing something a bit different with the background blocks instead of foreground.

Anyhow to make a table of the background blocks for later spawning

bMats = {}
local mat
local i = 1
local pos = object.position()
for s, space in ipairs(objects.spaces()) do
mat = world.material( {space[1] + pos[1], space[2] + pos[2] } , "background")
if mat then
bMats[i] = mat
i = i + 1
end

The thing is though Starbound will never save that table between sessions. So you're gonna loose your blocks if you don't destroy the door before quitting.