Add travel

This commit is contained in:
Aslan 2026-01-21 15:52:44 -05:00
parent 4ae350418b
commit e43f6592a5

View file

@ -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,
}; };