septor / Buildaria

(This project is no longer maintained) Buildaria is a Terraria mod meant to make building easier and faster.
13 stars 10 forks source link

Extra safety measures - delete current inventory on quit. #9

Closed scaryguy334 closed 13 years ago

scaryguy334 commented 13 years ago

On quit the current player inventory, armour slots, and safe1 and safe2 should be deleted.

This is to prevent people using buildaria to create a new character, stack their inventory with the overstacking items, then quit/save and then go onto join a multiplayer server with normal terraira/otherwise with the character.

scaryguy334 commented 13 years ago

Maybe even vanity slots? (which is actually also considered as a armor slot, like the accessories, which I found when trying to place them into my various inventories) 0 - 10 head, body, legs, acc1,acc2,acc3,acc4,acc5 vanhead,vanbody,vanlegs.

I think the things are called bank (20 slots each if i remember so probably 0-19) bank1

inventory (however large the inventory is on a player

armour (goes from 0-10

scaryguy334 commented 13 years ago

So probably just turn all of them into "trash slots" temporarily if it is possible to make something happen to the player on quit. No clue if thats doable though =(

This was the trash slot code below? Except that the 'if' that preceeds that only applied to slot 10.

player[myPlayer].inventory[i].SetDefaults(0); player[myPlayer].inventory[i].name = ""; player[myPlayer].inventory[i].stack = 0; player[myPlayer].inventory[i].UpdateItem(0);

So probably just apply the same to the others.

player[myPlayer].armour

player[myPlayer].bank

player[myPlayer].bank2

scaryguy334 commented 13 years ago

So probably just turn all of them into "trash slots" temporarily if it is possible to make something happen to the player on quit. No clue if thats doable though =(

This was the trash slot code below? Except that the 'if' that preceeds that only applied to slot 10.

player[myPlayer].inventory[i].SetDefaults(0); player[myPlayer].inventory[i].name = ""; player[myPlayer].inventory[i].stack = 0; player[myPlayer].inventory[i].UpdateItem(0);

So probably just apply the same to the others.

player[myPlayer].armour

player[myPlayer].bank

player[myPlayer].bank2

septor commented 13 years ago

This is actually a good idea that never occurred to me. Probably even drop the characters stats back to default too.

I'll look into this further. Possibly try to get it in for 1.8.

scaryguy334 commented 13 years ago

If it does get done i'd probably throw it down as a unlisted change

scaryguy334 commented 13 years ago

If it does get done i'd probably throw it down as a unlisted change, so people dont see it and try to backtrack to use older versions to do this.

septor commented 13 years ago

Touche.

scaryguy334 commented 13 years ago

or a non direct way of saying hmmm... perhaps just 'improved inventory system" ;p

septor commented 13 years ago

There does not seem to be a way to process code on logout, but there is a way to run code on game exit.

This warrants further investigation, not even so much for this feature.