Files
CHOMPStation2/code/modules/mob/mob_transformation_simple.dm
Erthilo 28f7a58905 TG: - Added a rudimentary transformation section to the options panel (show player
panel verb). This allows rudimentary mob type changes to any mob. These are
however generic and non-mob-specific, as they only copy over some of the most
needed variables, such as the three name variables, dna and mind. They do not,
for instance, create a MMI for cyborgs. A note of this is also added to the
player panel.
- Once you click one of the links a popup will appear asking you whether you'd
like to delete the old mob of the player (yes or no) or cancel this
transformation.

Screenshot:
http://www.kamletos.si/options%20panel%20rudamentary%20transformation.PNG
Revision: r3534
Author: 	 baloh.matevz
2012-05-06 21:01:19 +01:00

54 lines
1.4 KiB
Plaintext

//This proc is the most basic of the procs. All it does is make a new mob on the same tile and transfer over a few variables.
//Returns the new mob
//Note that this proc does NOT do MMI related stuff!
/mob/proc/change_mob_type(var/new_type = null, var/turf/location = null, var/new_name = null as text, var/delete_old_mob = 0 as num)
if(istype(src,/mob/new_player))
usr << "\red cannot convert players who have not entered yet."
return
if(!new_type)
new_type = input("Mob type path:", "Mob type") as text|null
if(istext(new_type))
new_type = text2path(new_type)
if( !ispath(new_type) )
usr << "Invalid type path (new_type = [new_type]) in change_mob_type(). Contact a coder."
return
if( new_type == /mob/new_player )
usr << "\red cannot convert into a new_player mob type."
return
var/mob/M = null
if( !isnull(location) && isturf(location))
M = new new_type( location )
else
M = new new_type( src.loc )
if(!M || !ismob(M))
usr << "Type path is not a mob (new_type = [new_type]) in change_mob_type(). Contact a coder."
return
if( istext(new_name) )
M.name = new_name
M.original_name = new_name
M.real_name = new_name
else
M.name = src.name
M.original_name = src.original_name
M.real_name = src.real_name
M.dna = src.dna
M.ckey = src.ckey
if(mind)
mind.transfer_to(M)
if(delete_old_mob)
spawn(1)
del(src)
return M