mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-15 12:31:09 +00:00
store portal and destroy the whole portal when destroying one portal block, progress on #79
This commit is contained in:
parent
0ea7fcf40d
commit
d49fd8b775
2 changed files with 18 additions and 1 deletions
|
|
@ -22,9 +22,24 @@ module.exports.player=function(player,serv)
|
|||
var frames=await detectFrame(player.world,referencePosition,direction);
|
||||
if(frames.length==0)
|
||||
return;
|
||||
var air=getAir(frames[0]);
|
||||
var air=frames[0].air;
|
||||
air.forEach(pos => player.setBlock(pos,90,(frames[0].bottom[0].x-frames[0].bottom[1].x)!=0 ? 1 : 2));
|
||||
player.world.portals.push(frames[0]);
|
||||
}
|
||||
};
|
||||
|
||||
player.on("dug",({position,block}) => {
|
||||
if(block.name=="portal")
|
||||
{
|
||||
var p=player.world.portals.filter(portal => portal.air.reduce((acc,pos) => acc || pos.equals(position),false));
|
||||
if(p.length>0)
|
||||
{
|
||||
p[0]
|
||||
.air
|
||||
.filter(ap => !ap.equals(position))
|
||||
.forEach(ap => serv.setBlock(player.world,ap,0,0));
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
var directionToVector=[new Vec3(0,-1,0),new Vec3(0,1,0),new Vec3(0,0,-1),new Vec3(0,0,1),new Vec3(-1,0,0),new Vec3(1,0,0)];
|
||||
|
|
@ -17,6 +17,8 @@ module.exports.server=function(serv,{regionFolder,generation={"name":"diamond_sq
|
|||
// WILL BE REMOVED WHEN ACTUALLY IMPLEMENTED
|
||||
serv.overworld.blockEntityData = {};
|
||||
serv.netherworld.blockEntityData = {};
|
||||
serv.overworld.portals = [];
|
||||
serv.netherworld.portals = [];
|
||||
//////////////
|
||||
|
||||
serv.pregenWorld = (world, size=3) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue