Just some code cleanup.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1511 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
uporotiy
2011-04-30 17:07:25 +00:00
parent 6564fec7e3
commit d2a2f27c12
3 changed files with 19 additions and 213 deletions

View File

@@ -28,21 +28,22 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
var/smoke_spread = 0 //1 - harmless, 2 - harmful
var/smoke_amt = 0 //cropped at 10
/obj/spell/proc/cast_check(mob/user = usr) //checks if the spell can be cast based on its settings
/obj/spell/proc/cast_check(skipcharge = 0,mob/user = usr) //checks if the spell can be cast based on its settings; skipcharge is used when an additional cast_check is called inside the spell
if(!(src in usr.spell_list))
usr << "\red You shouldn't have this spell! Something's wrong."
return 0
switch(charge_type)
if("recharge")
if(charge_counter < charge_max)
usr << "[name] is still recharging."
return 0
if("charges")
if(!charge_counter)
usr << "[name] has no charges left."
return 0
if(!skipcharge)
switch(charge_type)
if("recharge")
if(charge_counter < charge_max)
usr << "[name] is still recharging."
return 0
if("charges")
if(!charge_counter)
usr << "[name] has no charges left."
return 0
if(usr.stat && !stat_allowed)
usr << "Not when you're incapacitated."
@@ -59,11 +60,12 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
usr << "I don't feel strong enough without my hat."
return 0
switch(charge_type)
if("recharge")
charge_counter = 0 //doesn't start recharging until the targets selecting ends
if("charges")
charge_counter-- //returns the charge if the targets selecting fails
if(!skipcharge)
switch(charge_type)
if("recharge")
charge_counter = 0 //doesn't start recharging until the targets selecting ends
if("charges")
charge_counter-- //returns the charge if the targets selecting fails
return 1

View File

@@ -7,7 +7,7 @@
/obj/spell/targeted/area_teleport/perform(list/targets, recharge = 1)
var/thearea = before_cast(targets)
if(!thearea)
if(!thearea || !cast_check(1))
revert_cast()
return
invocation(thearea)

View File

@@ -872,200 +872,4 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(myseed.oneharvest)
planted = 0
dead = 0
updateicon()
/*
else if (href_list["clone"])
var/datum/data/record/C = locate(href_list["clone"])
//Look for that player! They better be dead!
var/mob/selected = find_dead_player("[C.fields["ckey"]]")
//Can't clone without someone to clone. Or a pod. Or if the pod is busy. Or full of gibs.
if ((!selected) || (!src.pod1) || (src.pod1.occupant) || (src.pod1.mess))
src.temp = "Unable to initiate cloning cycle." // most helpful error message in THE HISTORY OF THE WORLD
else if (src.pod1.growclone(selected, C.fields["name"], C.fields["UI"], C.fields["SE"], C.fields["mind"], C.fields["mrace"]))
src.temp = "Cloning cycle activated."
src.records.Remove(C)
del(C)
src.menu = 1
----
subject.dna.check_integrity()
var/datum/data/record/R = new /datum/data/record( )
R.fields["mrace"] = subject.mutantrace
R.fields["ckey"] = subject.ckey
R.fields["name"] = subject.real_name
R.fields["id"] = copytext(md5(subject.real_name), 2, 6)
R.fields["UI"] = subject.dna.uni_identity
R.fields["SE"] = subject.dna.struc_enzymes
//Add an implant if needed
var/obj/item/weapon/implant/health/imp =locate(/obj/item/weapon/implant/health, subject)
if (isnull(imp))
imp = new /obj/item/weapon/implant/health(subject)
imp.implanted = subject
R.fields["imp"] = "\ref[imp]"
//Update it if needed
else
R.fields["imp"] = "\ref[imp]"
if (!isnull(subject.mind)) //Save that mind so traitors can continue traitoring after cloning.
R.fields["mind"] = "\ref[subject.mind]"
src.records += R
src.temp = "Subject successfully scanned."
----
/obj/machinery/clonepod/proc/growclone(mob/ghost as mob, var/clonename, var/ui, var/se, var/mindref, var/mrace)
if (((!ghost) || (!ghost.client)) || src.mess || src.attempting)
return 0
src.attempting = 1 //One at a time!!
src.locked = 1
src.eject_wait = 1
spawn(30)
src.eject_wait = 0
src.occupant = new /mob/living/carbon/human(src)
ghost.client.mob = src.occupant
src.icon_state = "pod_1"
//Get the clone body ready
src.occupant.rejuv = 10
src.occupant.cloneloss += 190 //new damage var so you can't eject a clone early then stab them to abuse the current damage system --NeoFite
src.occupant.brainloss += 90
src.occupant.paralysis += 4
//Here let's calculate their health so the pod doesn't immediately eject them!!!
src.occupant.health = (src.occupant.bruteloss + src.occupant.toxloss + src.occupant.oxyloss + src.occupant.cloneloss)
src.occupant << "\blue <b>Clone generation process initiated.</b>"
src.occupant << "\blue This will take a moment, please hold."
if (clonename)
src.occupant.real_name = clonename
else
src.occupant.real_name = "clone" //No null names!!
var/datum/mind/clonemind = (locate(mindref) in ticker.minds)
if ((clonemind) && (istype(clonemind))) //Move that mind over!!
clonemind.transfer_to(src.occupant)
clonemind.original = src.occupant
else //welp
src.occupant.mind = new /datum/mind( )
src.occupant.mind.key = src.occupant.key
src.occupant.mind.current = src.occupant
src.occupant.mind.original = src.occupant
src.occupant.mind.transfer_to(src.occupant)
ticker.minds += src.occupant.mind
// -- Mode/mind specific stuff goes here
switch(ticker.mode.name)
if ("revolution")
if (src.occupant.mind in ticker.mode:revolutionaries)
ticker.mode:add_revolutionary(src.occupant.mind)
ticker.mode:update_all_rev_icons() //So the icon actually appears
if (src.occupant.mind in ticker.mode:head_revolutionaries)
ticker.mode:update_all_rev_icons()
if ("cult")
if (src.occupant.mind in ticker.mode:cult)
ticker.mode:add_cultist(src.occupant.mind)
ticker.mode:update_all_cult_icons() //So the icon actually appears
if ("changeling")
if (src.occupant.mind in ticker.mode:changelings)
src.occupant.make_changeling()
// -- End mode specific stuff
if (istype(ghost, /mob/dead/observer))
del(ghost) //Don't leave ghosts everywhere!!
if (!src.occupant.dna)
src.occupant.dna = new /datum/dna( )
if (ui)
src.occupant.dna.uni_identity = ui
updateappearance(src.occupant, ui)
if (se)
src.occupant.dna.struc_enzymes = se
randmutb(src.occupant) //Sometimes the clones come out wrong.
src.occupant:update_face()
src.occupant:update_body()
src.occupant:mutantrace = mrace
src.attempting = 0
return 1
//Grow clones to maturity then kick them out. FREELOADERS
/obj/machinery/clonepod/process()
if (stat & NOPOWER) //Autoeject if power is lost
if (src.occupant)
src.locked = 0
src.go_out()
return
if ((src.occupant) && (src.occupant.loc == src))
if((src.occupant.stat == 2) || (src.occupant.suiciding)) //Autoeject corpses and suiciding dudes.
src.locked = 0
src.go_out()
src.connected_message("Clone Rejected: Deceased.")
return
else if(src.occupant.health < src.heal_level)
src.occupant.paralysis = 4
//Slowly get that clone healed and finished.
src.occupant.cloneloss = max(src.occupant.cloneloss-1, 0)
//Premature clones may have brain damage.
src.occupant.brainloss = max(src.occupant.brainloss-1, 0)
//So clones don't die of oxyloss in a running pod.
if (src.occupant.reagents.get_reagent_amount("inaprovaline") < 30)
src.occupant.reagents.add_reagent("inaprovaline", 60)
//Also heal some oxyloss ourselves because inaprovaline is so bad at preventing it!!
src.occupant.oxyloss = max(src.occupant.oxyloss-2, 0)
use_power(7500) //This might need tweaking.
return
else if((src.occupant.health >= src.heal_level) && (!src.eject_wait))
src.connected_message("Cloning Process Complete.")
src.locked = 0
src.go_out()
return
else if ((!src.occupant) || (src.occupant.loc != src))
src.occupant = null
if (src.locked)
src.locked = 0
if (!src.mess)
icon_state = "pod_0"
use_power(200)
return
return
-----
Blood.data["donor"] = reference to human
---
else if(istype(W, /obj/item/weapon/reagent_containers/syringe))
var/obj/item/weapon/reagent_containers/syringe/S = W
user << "You inject the solution into the power cell."
if(S.reagents.has_reagent("plasma", 5))
rigged = 1
S.reagents.clear_reagents()
*/
updateicon()