• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Clean Map tfs 1.2

Lucas Rodriguez

New Member
Joined
Sep 2, 2020
Messages
37
Reaction score
1
Hello Friends. i have this :


local shutdownAtServerSave = true
local cleanMapAtServerSave = false

local function serverSave()
if shutdownAtServerSave then
Game.setGameState(GAME_STATE_SHUTDOWN)
else
Game.setGameState(GAME_STATE_CLOSED)

if cleanMapAtServerSave then
cleanMap()
end

Game.setGameState(GAME_STATE_NORMAL)
end
end

local function secondServerSaveWarning()
broadcastMessage("Server is saving game in one minute.Please log out.", MESSAGE_STATUS_WARNING)
addEvent(serverSave, 60000)
end

local function firstServerSaveWarning()
broadcastMessage("Server is saving game in 3 minutes.", MESSAGE_STATUS_WARNING)
addEvent(secondServerSaveWarning, 120000)
end

function onTime(interval)
broadcastMessage("Server is saving game in 15 minutes.", MESSAGE_STATUS_WARNING)
Game.setGameState(GAME_STATE_STARTUP)
addEvent(firstServerSaveWarning, 720000)
return not shutdownAtServerSave
end


Restart ot ok, but clean map too .... i don't wanna clean map! THANKS
 
tfs doesn't store map items unless you modify it to do so, it would require several code changes, I remember people brought up this topic already, but I couldn't find it
 
tfs doesn't store map items unless you modify it to do so, it would require several code changes, I remember people brought up this topic already, but I couldn't find it

I implemented this on my server based on acomment you made about coping the clean() function and copying how the SaveHouseTiles function works. :)
 
I implemented this on my server based on acomment you made about coping the clean() function and copying how the SaveHouseTiles function works. :)
Good luck if you ever have any considerable amount of players. Your db will blow up
 
Good luck if you ever have any considerable amount of players. Your db will blow up
Assuming it's done properly, I would 'tag' each item with a date/time.
If X amount of days / server saves have passed and the item hasn't moved/changed, then I'd delete the item.

That way there would be some of the desired object permanence, but wouldn't remain forever.
 
You're going to want to make sure you skip saving items loaded from the map file, otherwise you're going to end up with duplicates of everything everywhere

It otherwise looks like how I've implemented it.

HOW can I skip saving saved items from the map file?

In this case, if I use SaveMap (as I use it in my antirollback) would it also save the map items on the ground? I would also like a globalevents ServerSave to clear the map from time to time.
 
HOW can I skip saving saved items from the map file?

In this case, if I use SaveMap (as I use it in my antirollback) would it also save the map items on the ground? I would also like a globalevents ServerSave to clear the map from time to time.
it doesn't make sense:

  • you want to save items
  • you want to clean items

🤔
 
You're going to want to make sure you skip saving items loaded from the map file, otherwise you're going to end up with duplicates of everything everywhere

It otherwise looks like how I've implemented it.

it doesn't make sense:

  • you want to save items
  • you want to clean items

🤔

Yes, I want to save the items.
But from time to time I would like to clean it so it doesn't get too heavy. I thought about copiling two TFS, so I could use TFS with normal SaveServer when I wanted to clean.
 
Yes, I want to save the items.
But from time to time I would like to clean it so it doesn't get too heavy. I thought about copiling two TFS, so I could use TFS with normal SaveServer when I wanted to clean.
well do you know anything about coding cpp? because it's going to be a bunch of source edits.
Post automatically merged:

HOW can I skip saving saved items from the map file?

In this case, if I use SaveMap (as I use it in my antirollback) would it also save the map items on the ground? I would also like a globalevents ServerSave to clear the map from time to time.
Dont save items. where isLoadedFromMap is true.
 
Back
Top