mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-05 11:10:44 +00:00
add /attach <carrierId> <attachedId> to attach an entity on an other one
will be used to make a attach function and in vanilla uses later
This commit is contained in:
parent
57ff06a805
commit
04ab50b7d8
1 changed files with 22 additions and 0 deletions
|
|
@ -120,6 +120,28 @@ module.exports.player=function(player,serv){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
player.commands.add({
|
||||||
|
base: 'attach',
|
||||||
|
info: 'attach an entity on an other entity',
|
||||||
|
usage: '/attach <carrierId> <attachedId>',
|
||||||
|
parse(str) {
|
||||||
|
var pars=str.split(' ');
|
||||||
|
if(pars.length!=2)
|
||||||
|
return false;
|
||||||
|
var [carrierId,attachedId]=pars.map(a => parseInt(a));
|
||||||
|
return {carrierId:carrierId,attachedId:attachedId};
|
||||||
|
},
|
||||||
|
action({carrierId,attachedId}) {
|
||||||
|
var p={
|
||||||
|
entityId:attachedId,
|
||||||
|
vehicleId:carrierId,
|
||||||
|
leash:false
|
||||||
|
};
|
||||||
|
player._client.write('attach_entity',p);
|
||||||
|
player._writeOthersNearby('attach_entity',p);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
player.spawnEntity = entity => {
|
player.spawnEntity = entity => {
|
||||||
player._client.write(entity.spawnPacketName, entity.getSpawnPacket());
|
player._client.write(entity.spawnPacketName, entity.getSpawnPacket());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue