chore: safety
This commit is contained in:
parent
d227502553
commit
6b5ea8d18a
|
@ -122,7 +122,7 @@ export default () => class Mobile extends decorate(Trait) {
|
|||
},
|
||||
|
||||
moveToward: (entity, duration) => {
|
||||
if (duration <= 0) {
|
||||
if (!entity.is('Positioned') || duration <= 0) {
|
||||
return undefined;
|
||||
}
|
||||
const calculateMovement = () => Vector.normalize(
|
||||
|
|
|
@ -121,15 +121,18 @@ export default () => class Positioned extends decorate(Trait) {
|
|||
methods() {
|
||||
return {
|
||||
|
||||
pointAround: (radius, angle) => (
|
||||
Vector.add(
|
||||
pointAround: (radius, angle) => {
|
||||
if (!this.entity.is('Positioned')) {
|
||||
return [0, 0];
|
||||
}
|
||||
return Vector.add(
|
||||
this.entity.position,
|
||||
[
|
||||
radius * Math.cos(angle),
|
||||
radius * -Math.sin(angle),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
setPosition: (position) => {
|
||||
this.trackedPosition = position;
|
||||
|
|
Loading…
Reference in New Issue
Block a user