[Mob] The logout parydox. Client new/del and datums. in Developer Help
|
|
Allo all, so as usual ive been tweaking things and ive been doing some debugging with some mates on my game and some times it required logging out and since i didn't have any form of deleting in the actual logout the mobs always just stayed there. so i decided it go and pull up the logout/deathavoid code someone asked about awhile ago and pull it into play for my needs.
The following code as you will be able to see when posted below will on client/del save the player as a check and then create a new datum called logoutter this is just a simple datum that watches over the player mob until the time for deletion comes. anyway onto the code.
Code: First up we have the datum and client/del
client/Del() if(!istype(mob,/mob/human/player)) return mob.Save() new /logoutter(src.mob) mob.key = null
..()
logoutter var/mob/human/reffer New(mob/p) src.tag = "logoutter |[p.ckey]|[p.name]|" reffer = p world << "0.[reffer] = [reffer.x] - [reffer.y] - [reffer.z]" src.DelayedSaveDel(p) Del(client/c) if(c) world << "1.[reffer] = [reffer.x] - [reffer.y] - [reffer.z]" reffer.key = c.key world << "2.[reffer] = [reffer.x] - [reffer.y] - [reffer.z]" ..() proc/DelayedSaveDel(mob/P) spawn(100) P.Save() world << "[P] has Successfully logged out." del P del(src)
|
Code: next up is the load and other stuff.
client/proc/Load(playerslot, playername) var/savefile/F = new(savedir)
var/logoutter/loutter = locate("logoutter |[src.ckey]|[playername]|") if(loutter) loutter.Del(src) src << "System: You have reconnected to your mob." else F["/Slot[playerslot]"] >> src.mob world << "[src.mob]/[ckey] has Logged into the world"
|
Now im unsure if its clear in there in any case what is happening is when the mob regains a client it is meant to stay in the same location. instead it gets hurled back to the first available tile and im unsure why this is the case.
I have looked over most of my code and i cant seem to figure out why this is occuring.
If anyone has insight onto this or ways to improve this it would be greatly appreciated.
~Midget
|
Also, where do you call client/Load?