Hello,
So like I was hinting to in your room, you'll have to iterate through the objects, and define a time to expire them through code and only render the new objects.
So the code will be something like this, for when you render the objects people have left:
const timeToExpire = 3600 // the amount of seconds to allow an object to exist for, in this case an hour
// A simple helper function to determine the expired time for an object
// there is likely a simpler way to do this, but for now this works
const isObjectExpired = (obj) => {
// below does the following:
// converts the timestamp back into a date
// subtracts the current time from the object's creation time
// then, multiplies the sum from milliseconds into seconds to make the comparison
return ((new Date(Date.now()) - new Date(obj.createdAt)) * 0.001) >= timeToExpire
}
for (let object of Street.objects) {
if (isObjectExpired(object)) {
continue; // skip object render
}
// logic here to render the object here
}
The above will only render objects younger than 1 hour (3600 seconds). If it doesn't already, Melooon should consider allowing an admin or owner of a room to expire objects, or have objects expire automatically after some time (I think it might do this already?).
I understand why Melooon would make it so the server has authority to clear objects, as if he didn't do that it'd cause issues cause people could clear stuff from the room when people might not want that. The owner of the room however should be able to manually if they want, or to elect moderators to do it for them too.