Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
Autumn, 15 Nov 2026 - @709.70
Forum Activity: Three Stars ~ Boop! The forum will close in 291.beats! Random | Recent Posts | Guild Recents
News: :seal: Thank you for today! :seal: Guild Events: Noir-vember TTRPG game jam
+  MelonLand Forum
|-+  Da Web Revival
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  Main Street Persistent Object Removal


« previous next »
Pages: [1] Print Embed
Author Topic: Main Street Persistent Object Removal  (Read 112 times)
Bobble
Newbie ⚓︎
*
View Profile WWW


wait im egg
⛺︎ My Room
Itch.io: My Games

Guild Memberships:
Artifacts:
black n cyan yappin kittayJoined 2026!
« on: Autumn, 14 Nov 2026 @977 » Toggle Font Embed

I was testing creation of Main Street objects in my everyone room, when someone else created some and left without deleting them.

How does one remove persistent objects that do not belong to the user? I am calling
Code
Street.clearRoom();
which only removes the objects I created.

The console logs the warning:
Code
Sync server error: NOT_YOURS - You can't remove that object

Logged
mrparker
Jr. Member ⚓︎
**
View Profile WWW


⛺︎ My Room
OS: macOS, Windows 11

Guild Memberships:
Artifacts:
Visited on Melon's 10th Anniversary!lighthouse keeper artemisUserJoined 2026!
« Reply #1 on: Today at @049 » Embed

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:

Code
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.

Logged

i love cats!
Bobble
Newbie ⚓︎
*
View Profile WWW


wait im egg
⛺︎ My Room
Itch.io: My Games

Guild Memberships:
Artifacts:
black n cyan yappin kittayJoined 2026!
« Reply #2 on: Today at @237 » Toggle Font Embed

I have discovered that if a street object does not have owner data attached to it, it can be deleted by anyone! :omg:
Street objects created without passing an object to the data parameter get default data which includes owner information. If an object is passed, it completely replaces the default data.

nope this is not true I was just tired oops :drat:

« Last Edit: Today at @696 by Bobble » Logged
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Guide | Rules | Whos a Mod? | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
@000 Melon
Land
Forum Art Hub Chat Webring Explore Random Recent Tenement Arcade Want to Login or Join ? Web Craft Guide Graphic Catalogue Wiki Help I'm Lost! Link Land Newsletters Image Stream Minecraft: Online
Zap!
Passport Sites tamaNOTchi Asatte Add your site?
Aero Archive Onio Cafe 32 Bit Cafe Status Cafe