All pastes #548574 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-07 19:42 UTC
rendered paste body
mob/players
	Write(savefile/F)
		overlays=null //remove all overlays and underlays, such as hair and clothing
		underlays=null
		icon=null //you can remove this line if you're not modifying the icon of a mob

		.=..()

		//now save the current location
		F["x"]<<x
		F["y"]<<y
		F["z"]<<z
		//WARNING: If this is an autosave or anything, you need to call checkIcons() afterwards or it will go awry.
	Read(savefile/F)
		.=..()

		var
			_x=F["x"]
			_y=F["y"]
			_z=F["z"]
		if(_x&&_y&&_z) loc=locate(_x,_y,_z)
		checkIcons()
	proc/checkIcons()
		... //you should re-apply all overlays etc. here

//seperator -- above and below are NOT the same. Note however that this is a demo.

mob/players
	var
		hair_style="spikey"
		hair_color //result of rgb()
	proc/checkIcons()
		if(hair_style=="spikey")
			var/icon/I=new(icon='icons/overlays/hair.dmi',icon_state="spikey")
			I.Blend(hair_color)
			overlays+=I