Add travel
This commit is contained in:
parent
4ae350418b
commit
e43f6592a5
1 changed files with 11 additions and 2 deletions
|
|
@ -66,7 +66,15 @@ const getTravelTimeInHours = (
|
||||||
) => {
|
) => {
|
||||||
const distance = getLocationDistance(locationA, locationB);
|
const distance = getLocationDistance(locationA, locationB);
|
||||||
|
|
||||||
return (distance / getSpeed(player)) * 3600000;
|
return distance / getSpeed(player);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTravelTimeInMilliseconds = (
|
||||||
|
player: IPlayer,
|
||||||
|
locationA: ILocation,
|
||||||
|
locationB: ILocation,
|
||||||
|
) => {
|
||||||
|
return getTravelTimeInHours(player, locationA, locationB) * 3600000;
|
||||||
};
|
};
|
||||||
|
|
||||||
const startTravel = (
|
const startTravel = (
|
||||||
|
|
@ -82,7 +90,7 @@ const startTravel = (
|
||||||
() => {
|
() => {
|
||||||
finishTravel(player, newLocation, client, roomId);
|
finishTravel(player, newLocation, client, roomId);
|
||||||
},
|
},
|
||||||
getTravelTimeInHours(player, currentLocation, newLocation),
|
getTravelTimeInMilliseconds(player, currentLocation, newLocation),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -108,6 +116,7 @@ export {
|
||||||
getParentLocation,
|
getParentLocation,
|
||||||
hasLocation,
|
hasLocation,
|
||||||
getTravelTimeInHours,
|
getTravelTimeInHours,
|
||||||
|
getTravelTimeInMilliseconds,
|
||||||
startTravel,
|
startTravel,
|
||||||
finishTravel,
|
finishTravel,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue