mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 03:31:10 +00:00
Blah, blah...
This commit is contained in:
parent
18a56b51b0
commit
4219435bb7
8 changed files with 114 additions and 3 deletions
21
lib/playerPlugins/border.js
Normal file
21
lib/playerPlugins/border.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
module.exports=inject;
|
||||||
|
|
||||||
|
function inject(serv, player)
|
||||||
|
{
|
||||||
|
//WIP: Does't work
|
||||||
|
player._client.write('world_border', {
|
||||||
|
action: 3,
|
||||||
|
x: 0,
|
||||||
|
z: 0,
|
||||||
|
old_radius: 15,
|
||||||
|
new_radius: 15,
|
||||||
|
speed: 10000000,
|
||||||
|
portalBoundary: 15,
|
||||||
|
warning_time: 5,
|
||||||
|
warning_blocks: 15
|
||||||
|
});
|
||||||
|
player._client.write('world_border', {
|
||||||
|
action: 0,
|
||||||
|
radius: 15
|
||||||
|
});
|
||||||
|
}
|
||||||
21
lib/playerPlugins/chest.js
Normal file
21
lib/playerPlugins/chest.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
var vec3 = require("vec3");
|
||||||
|
|
||||||
|
module.exports=inject;
|
||||||
|
|
||||||
|
function inject(serv, player)
|
||||||
|
{
|
||||||
|
player._client.on('block_place', function (packet) {
|
||||||
|
var referencePosition=new vec3(packet.location.x,packet.location.y,packet.location.z);
|
||||||
|
var id = serv.world.getBlock(referencePosition).type;
|
||||||
|
player.system(player.entity.id);
|
||||||
|
if(id==54)
|
||||||
|
player._client.write("open_window",{
|
||||||
|
windowId:165,
|
||||||
|
inventoryType:"minecraft:chest",
|
||||||
|
windowTitle:JSON.stringify("Chest"),
|
||||||
|
slotCount:26
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
//player.emit("chat",packet.message);
|
||||||
|
}
|
||||||
|
|
@ -14,10 +14,40 @@ function inject(serv, player)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
heldItem = inventory[36+heldItemSlot];
|
heldItem = inventory[36+heldItemSlot];
|
||||||
|
player._writeOthers("entity_equipment",{
|
||||||
|
entityId:player.entity.id,
|
||||||
|
slot:0,
|
||||||
|
item:heldItem
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
player._client.on("set_creative_slot", function (packet) {
|
player._client.on("set_creative_slot", function (packet) {
|
||||||
inventory[packet.slot]=packet.item;
|
inventory[packet.slot]=packet.item;
|
||||||
|
if (packet.slot==5)
|
||||||
|
player._writeOthers("entity_equipment",{
|
||||||
|
entityId:player.entity.id,
|
||||||
|
slot:4,
|
||||||
|
item:packet.item
|
||||||
|
});
|
||||||
|
if (packet.slot==6)
|
||||||
|
player._writeOthers("entity_equipment",{
|
||||||
|
entityId:player.entity.id,
|
||||||
|
slot:3,
|
||||||
|
item:packet.item
|
||||||
|
});
|
||||||
|
if (packet.slot==7)
|
||||||
|
player._writeOthers("entity_equipment",{
|
||||||
|
entityId:player.entity.id,
|
||||||
|
slot:2,
|
||||||
|
item:packet.item
|
||||||
|
});
|
||||||
|
if (packet.slot==8)
|
||||||
|
player._writeOthers("entity_equipment",{
|
||||||
|
entityId:player.entity.id,
|
||||||
|
slot:1,
|
||||||
|
item:packet.item
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
player.heldItem = heldItem;
|
player.heldItem = heldItem;
|
||||||
|
|
|
||||||
6
lib/playerPlugins/signs.js
Normal file
6
lib/playerPlugins/signs.js
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
module.exports=inject;
|
||||||
|
|
||||||
|
function inject(serv, player)
|
||||||
|
{
|
||||||
|
//WIP: temporary removed
|
||||||
|
}
|
||||||
11
lib/playerPlugins/stats.js
Normal file
11
lib/playerPlugins/stats.js
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
module.exports=inject;
|
||||||
|
|
||||||
|
function inject(serv, player)
|
||||||
|
{
|
||||||
|
player._client.on('client_command', function (packet) {
|
||||||
|
if(packet.payload==1){
|
||||||
|
//WIP: dummy
|
||||||
|
player.system ("WIP, press ESC");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,10 @@ function inject(serv, player)
|
||||||
function chat(message) {
|
function chat(message) {
|
||||||
player._client.write('chat', { message: JSON.stringify(message), position: 0 });
|
player._client.write('chat', { message: JSON.stringify(message), position: 0 });
|
||||||
}
|
}
|
||||||
|
function system(message) {
|
||||||
|
player._client.write('chat', { message: JSON.stringify(message), position: 2 });
|
||||||
|
}
|
||||||
|
|
||||||
player.chat=chat;
|
player.chat=chat;
|
||||||
|
player.system=system;
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,13 @@ function inject(serv,player)
|
||||||
|
|
||||||
player.getOthers = function() {
|
player.getOthers = function() {
|
||||||
return serv.players.filter(function (otherPlayer) {
|
return serv.players.filter(function (otherPlayer) {
|
||||||
return otherPlayer != player
|
return otherPlayer != player;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
player._writeAll=function(packetName, packetFields) {
|
||||||
|
serv.players.forEach(function (player) {
|
||||||
|
player._client.write(packetName, packetFields);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -9,7 +9,19 @@ function inject(serv,player)
|
||||||
var referencePosition=new vec3(packet.location.x,packet.location.y,packet.location.z);
|
var referencePosition=new vec3(packet.location.x,packet.location.y,packet.location.z);
|
||||||
var directionVector=directionToVector[packet.direction];
|
var directionVector=directionToVector[packet.direction];
|
||||||
var placedPosition=referencePosition.plus(directionVector);
|
var placedPosition=referencePosition.plus(directionVector);
|
||||||
player.changeBlock(placedPosition,packet.heldItem.blockId);
|
if(packet.heldItem.blockId!=323){
|
||||||
|
player.changeBlock(placedPosition,packet.heldItem.blockId);
|
||||||
|
}else if(packet.direction==1){
|
||||||
|
serv.setBlock(placedPosition, 63);
|
||||||
|
player._client.write('open_sign_entity', {
|
||||||
|
location:placedPosition
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
serv.setBlock(placedPosition, 68);
|
||||||
|
player._client.write('open_sign_entity', {
|
||||||
|
location:placedPosition
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue