@@ -29,6 +29,9 @@ module.exports = { | |||||
if (blueprint.faction) | if (blueprint.faction) | ||||
this.faction = blueprint.faction; | this.faction = blueprint.faction; | ||||
if (blueprint.range) | |||||
this.range = blueprint.range; | |||||
//TODO: Why don't we move if faction is null? | //TODO: Why don't we move if faction is null? | ||||
if (!this.has('faction')) | if (!this.has('faction')) | ||||
return; | return; | ||||
@@ -2,7 +2,10 @@ module.exports = async (cpnSocial, targetName) => { | |||||
const { obj } = cpnSocial; | const { obj } = cpnSocial; | ||||
const { instance: { objects, physics }, syncer } = obj; | const { instance: { objects, physics }, syncer } = obj; | ||||
const target = objects.find(o => o.name && o.name.toLowerCase().includes(targetName.toLowerCase())); | |||||
if (typeof(targetName) !== 'string') | |||||
return; | |||||
const target = objects.find(o => o.name?.toLowerCase().includes(targetName.toLowerCase())); | |||||
if (!target) | if (!target) | ||||
return; | return; | ||||
@@ -24,7 +24,17 @@ module.exports = { | |||||
const partyIds = obj.components.find(c => c.type === 'social')?.party; | const partyIds = obj.components.find(c => c.type === 'social')?.party; | ||||
if (partyIds) { | if (partyIds) { | ||||
const partyLeader = cons.players.find(p => partyIds.includes(p.id) && p.components.find(c => c.type === 'social')?.isPartyLeader); | |||||
const partyLeader = cons.players.find(p => { | |||||
if (!partyIds.includes(p.id)) | |||||
return false; | |||||
const cpnSocial = p.components.find(c => c.type === 'social'); | |||||
if (!cpnSocial) | |||||
return false; | |||||
return cpnSocial.isPartyLeader; | |||||
}); | |||||
if (partyLeader?.zoneName === zoneName) | if (partyLeader?.zoneName === zoneName) | ||||
zoneId = partyLeader.zoneId; | zoneId = partyLeader.zoneId; | ||||