mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-10 10:01:48 +00:00
limit the number of entities in initEntity
This commit is contained in:
parent
b5328463a4
commit
308fc5c8a0
1 changed files with 2 additions and 0 deletions
|
|
@ -13,6 +13,8 @@ const Vec3 = require("vec3").Vec3;
|
|||
|
||||
module.exports.server=function(serv,options) {
|
||||
serv.initEntity = (type, entityType, world, position) => {
|
||||
if(Object.keys(serv.entities).length>options["max-entities"])
|
||||
throw new Error("Too many mobs !");
|
||||
serv.entityMaxId++;
|
||||
const entity = new Entity(serv.entityMaxId);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue