AI's that do not name themselves after 20 seconds will default to their starting name.

Added a direction finding algorithm for target, get_dir_to(). Mostly useful for positioning sprites in relation to a target. Such as energy beams, lines, and so on.
Changes to ninjas. Fixed a bunch of bugs and finished content. It is now possible to drag people with you when phase jaunting/shifting. Jaunting/shifting should also kill livestock, huggers, and damage mechs.
Renamed /obj/spell path to obj/proc_holder/spell in order to have a generic proc_holder category. For now it only works for the AI but can be expanded to other mobs.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1566 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
noisomehollow@lycos.com
2011-05-11 02:01:30 +00:00
parent eee1da7cd9
commit 1d8dea2337
29 changed files with 409 additions and 210 deletions
+20 -17
View File
@@ -1,6 +1,9 @@
var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
/obj/proc_holder
var/panel = "Debug"//What panel the proc holder needs to go on.
/obj/spell
var/list/spells = typesof(/obj/proc_holder/spell) //needed for the badmin verb for now
/obj/proc_holder/spell
name = "Spell"
desc = "A wizard spell"
density = 0
@@ -28,7 +31,7 @@ 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(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
/obj/proc_holder/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."
@@ -69,7 +72,7 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
return 1
/obj/spell/proc/invocation(mob/user = usr) //spelling the spell out and setting it on recharge/reducing charges amount
/obj/proc_holder/spell/proc/invocation(mob/user = usr) //spelling the spell out and setting it on recharge/reducing charges amount
switch(invocation_type)
if("shout")
@@ -81,12 +84,12 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
if("whisper")
usr.whisper(invocation)
/obj/spell/New()
/obj/proc_holder/spell/New()
..()
charge_counter = charge_max
/obj/spell/Click()
/obj/proc_holder/spell/Click()
..()
if(!cast_check())
@@ -94,15 +97,15 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
choose_targets()
/obj/spell/proc/choose_targets(mob/user = usr) //depends on subtype - /targeted or /aoe_turf
/obj/proc_holder/spell/proc/choose_targets(mob/user = usr) //depends on subtype - /targeted or /aoe_turf
return
/obj/spell/proc/start_recharge()
/obj/proc_holder/spell/proc/start_recharge()
while(charge_counter < charge_max)
sleep(1)
charge_counter++
/obj/spell/proc/perform(list/targets, recharge = 1) //if recharge is started is important for the trigger spells
/obj/proc_holder/spell/proc/perform(list/targets, recharge = 1) //if recharge is started is important for the trigger spells
before_cast(targets)
invocation()
spawn(0)
@@ -111,7 +114,7 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
cast(targets)
after_cast(targets)
/obj/spell/proc/before_cast(list/targets)
/obj/proc_holder/spell/proc/before_cast(list/targets)
if(overlay)
for(var/atom/target in targets)
var/location
@@ -127,7 +130,7 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
spawn(overlay_lifespan)
del(spell)
/obj/spell/proc/after_cast(list/targets)
/obj/proc_holder/spell/proc/after_cast(list/targets)
for(var/atom/target in targets)
var/location
if(istype(target,/mob))
@@ -150,10 +153,10 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
smoke.set_up(smoke_amt, 0, location) //no idea what the 0 is
smoke.start()
/obj/spell/proc/cast(list/targets)
/obj/proc_holder/spell/proc/cast(list/targets)
return
/obj/spell/proc/revert_cast() //resets recharge or readds a charge
/obj/proc_holder/spell/proc/revert_cast() //resets recharge or readds a charge
switch(charge_type)
if("recharge")
charge_counter = charge_max
@@ -163,15 +166,15 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
return
/obj/spell/targeted //can mean aoe for mobs (limited/unlimited number) or one target mob
/obj/proc_holder/spell/targeted //can mean aoe for mobs (limited/unlimited number) or one target mob
var/max_targets = 1 //leave 0 for unlimited targets in range, 1 for one selectable target in range, more for limited number of casts (can all target one guy, depends on target_ignore_prev) in range
var/target_ignore_prev = 1 //only important if max_targets > 1, affects if the spell can be cast multiple times at one person from one cast
var/include_user = 0 //if it includes usr in the target list
/obj/spell/aoe_turf //affects all turfs in view or range (depends)
/obj/proc_holder/spell/aoe_turf //affects all turfs in view or range (depends)
var/inner_radius = -1 //for all your ring spell needs
/obj/spell/targeted/choose_targets(mob/user = usr)
/obj/proc_holder/spell/targeted/choose_targets(mob/user = usr)
var/list/targets = list()
switch(selection_type)
@@ -239,7 +242,7 @@ var/list/spells = typesof(/obj/spell) //needed for the badmin verb for now
return
/obj/spell/aoe_turf/choose_targets(mob/user = usr)
/obj/proc_holder/spell/aoe_turf/choose_targets(mob/user = usr)
var/list/targets = list()
switch(selection_type)
+5 -5
View File
@@ -1,11 +1,11 @@
/obj/spell/targeted/area_teleport
/obj/proc_holder/spell/targeted/area_teleport
name = "Area teleport"
desc = "This spell teleports you to a type of area of your selection."
var/randomise_selection = 0 //if it lets the usr choose the teleport loc or picks it from the list
var/invocation_area = 1 //if the invocation appends the selected area
/obj/spell/targeted/area_teleport/perform(list/targets, recharge = 1)
/obj/proc_holder/spell/targeted/area_teleport/perform(list/targets, recharge = 1)
var/thearea = before_cast(targets)
if(!thearea || !cast_check(1))
revert_cast()
@@ -17,7 +17,7 @@
cast(targets,thearea)
after_cast(targets)
/obj/spell/targeted/area_teleport/before_cast(list/targets)
/obj/proc_holder/spell/targeted/area_teleport/before_cast(list/targets)
var/A = null
if(!randomise_selection)
@@ -29,7 +29,7 @@
return thearea
/obj/spell/targeted/area_teleport/cast(list/targets,area/thearea)
/obj/proc_holder/spell/targeted/area_teleport/cast(list/targets,area/thearea)
for(var/mob/target in targets)
var/list/L = list()
for(var/turf/T in get_area_turfs(thearea.type))
@@ -46,7 +46,7 @@
return
/obj/spell/targeted/area_teleport/invocation(area/chosenarea = null)
/obj/proc_holder/spell/targeted/area_teleport/invocation(area/chosenarea = null)
if(!invocation_area || !chosenarea)
..()
else
+3 -3
View File
@@ -1,4 +1,4 @@
/obj/spell/aoe_turf/conjure
/obj/proc_holder/spell/aoe_turf/conjure
name = "Conjure"
desc = "This spell conjures objs of the specified types in range."
@@ -9,7 +9,7 @@
var/summon_ignore_prev_spawn_points = 0 //if set to 1, each new object is summoned on a new spawn point
/*
/obj/spell/conjure
/obj/proc_holder/spell/conjure
name = "Summon Bigger Carp"
desc = "This spell conjures an elite carp."
@@ -25,7 +25,7 @@
var/summon_ignore_density = 0 //if set to 1, adds dense tiles to possible spawn places
var/summon_ignore_prev_spawn_points = 0 //if set to 1, each new object is summoned on a new spawn point
*/
/obj/spell/aoe_turf/conjure/cast(list/targets)
/obj/proc_holder/spell/aoe_turf/conjure/cast(list/targets)
for(var/turf/T in targets)
if(T.density && !summon_ignore_density)
+2 -2
View File
@@ -1,11 +1,11 @@
/obj/spell/targeted/emplosion
/obj/proc_holder/spell/targeted/emplosion
name = "Emplosion"
desc = "This spell emplodes an area."
var/emp_heavy = 2
var/emp_light = 3
/obj/spell/targeted/emplosion/cast(list/targets)
/obj/proc_holder/spell/targeted/emplosion/cast(list/targets)
for(var/mob/target in targets)
empulse(target.loc, emp_heavy, emp_light)
+2 -2
View File
@@ -1,4 +1,4 @@
/obj/spell/targeted/ethereal_jaunt
/obj/proc_holder/spell/targeted/ethereal_jaunt
name = "Ethereal Jaunt"
desc = "This spell creates your ethereal form, temporarily making you invisible and able to pass through walls."
@@ -12,7 +12,7 @@
var/jaunt_duration = 50 //in deciseconds
/obj/spell/targeted/ethereal_jaunt/cast(list/targets) //magnets, so mostly hardcoded
/obj/proc_holder/spell/targeted/ethereal_jaunt/cast(list/targets) //magnets, so mostly hardcoded
for(var/mob/target in targets)
spawn(0)
var/mobloc = get_turf(target.loc)
+2 -2
View File
@@ -1,4 +1,4 @@
/obj/spell/targeted/explosion
/obj/proc_holder/spell/targeted/explosion
name = "Explosion"
desc = "This spell explodes an area."
@@ -7,7 +7,7 @@
var/ex_light = 3
var/ex_flash = 4
/obj/spell/targeted/explosion/cast(list/targets)
/obj/proc_holder/spell/targeted/explosion/cast(list/targets)
for(var/mob/target in targets)
explosion(target.loc,ex_severe,ex_heavy,ex_light,ex_flash)
+2 -2
View File
@@ -1,4 +1,4 @@
/obj/spell/targeted/genetic
/obj/proc_holder/spell/targeted/genetic
name = "Genetic"
desc = "This spell inflicts a set of mutations and disabilities upon the target."
@@ -22,7 +22,7 @@
6th bit - fat
*/
/obj/spell/targeted/genetic/cast(list/targets)
/obj/proc_holder/spell/targeted/genetic/cast(list/targets)
for(var/mob/target in targets)
target.mutations |= mutations
+2 -2
View File
@@ -1,4 +1,4 @@
/obj/spell/targeted/inflict_handler
/obj/proc_holder/spell/targeted/inflict_handler
name = "Inflict Handler"
desc = "This spell blinds and/or destroys/damages/heals and/or weakens/stuns the target."
@@ -16,7 +16,7 @@
var/destroys = "none" //can be "none", "gib" or "disintegrate"
/obj/spell/targeted/inflict_handler/cast(list/targets)
/obj/proc_holder/spell/targeted/inflict_handler/cast(list/targets)
for(var/mob/living/target in targets)
switch(destroys)
+2 -2
View File
@@ -1,4 +1,4 @@
/obj/spell/aoe_turf/knock
/obj/proc_holder/spell/aoe_turf/knock
name = "Knock"
desc = "This spell opens nearby doors and does not require wizard garb."
@@ -9,7 +9,7 @@
invocation_type = "whisper"
range = 3
/obj/spell/aoe_turf/knock/cast(list/targets)
/obj/proc_holder/spell/aoe_turf/knock/cast(list/targets)
for(var/turf/T in targets)
for(var/obj/machinery/door/door in T.contents)
spawn(1)
+2 -2
View File
@@ -1,4 +1,4 @@
/obj/spell/targeted/mind_transfer
/obj/proc_holder/spell/targeted/mind_transfer
name = "Mind Transfer"
desc = "This spell allows the user to switch bodies with a target."
@@ -17,7 +17,7 @@
var/paralysis_amount_caster = 20 //how much the caster is paralysed for after the spell
var/paralysis_amount_victim = 20 //how much the victim is paralysed for after the spell
/obj/spell/targeted/mind_transfer/cast(list/targets,mob/user = usr) //magnets, so mostly hardcoded
/obj/proc_holder/spell/targeted/mind_transfer/cast(list/targets,mob/user = usr) //magnets, so mostly hardcoded
if(!targets.len)
user << "No mind found"
return
+6 -6
View File
@@ -1,4 +1,4 @@
/obj/spell/targeted/projectile
/obj/proc_holder/spell/targeted/projectile
name = "Projectile"
desc = "This spell summons projectiles which try to hit the targets."
@@ -11,7 +11,7 @@
var/proj_trail_icon = 'wizard.dmi'
var/proj_trail_icon_state = "trail"
var/proj_type = "/obj/spell/targeted" //IMPORTANT use only subtypes of this
var/proj_type = "/obj/proc_holder/spell/targeted" //IMPORTANT use only subtypes of this
var/proj_lingering = 0 //if it lingers or disappears upon hitting an obstacle
var/proj_homing = 1 //if it follows the target
@@ -21,16 +21,16 @@
var/proj_lifespan = 15 //in deciseconds * proj_step_delay
var/proj_step_delay = 1 //lower = faster
/obj/spell/targeted/projectile/cast(list/targets, mob/user = usr)
/obj/proc_holder/spell/targeted/projectile/cast(list/targets, mob/user = usr)
for(var/mob/target in targets)
spawn(0)
var/obj/spell/targeted/projectile
var/obj/proc_holder/spell/targeted/projectile
if(istext(proj_type))
var/projectile_type = text2path(proj_type)
projectile = new projectile_type(user)
if(istype(proj_type,/obj/spell))
projectile = new /obj/spell/targeted/trigger(user)
if(istype(proj_type,/obj/proc_holder/spell))
projectile = new /obj/proc_holder/spell/targeted/trigger(user)
projectile:linked_spells += proj_type
projectile.icon = proj_icon
projectile.icon_state = proj_icon_state
+6 -6
View File
@@ -1,28 +1,28 @@
/obj/spell/targeted/trigger
/obj/proc_holder/spell/targeted/trigger
name = "Trigger"
desc = "This spell triggers another spell or a few."
var/list/linked_spells = list() //those are just referenced by the trigger spell and are unaffected by it directly
var/list/starting_spells = list() //those are added on New() to contents from default spells and are deleted when the trigger spell is deleted to prevent memory leaks
/obj/spell/targeted/trigger/New()
/obj/proc_holder/spell/targeted/trigger/New()
..()
for(var/spell in starting_spells)
var/spell_to_add = text2path(spell)
new spell_to_add(src) //should result in adding to contents, needs testing
/obj/spell/targeted/trigger/Del()
/obj/proc_holder/spell/targeted/trigger/Del()
for(var/spell in contents)
del(spell)
..()
/obj/spell/targeted/trigger/cast(list/targets)
/obj/proc_holder/spell/targeted/trigger/cast(list/targets)
for(var/mob/target in targets)
for(var/obj/spell/spell in contents)
for(var/obj/proc_holder/spell/spell in contents)
spell.perform(list(target),0)
for(var/obj/spell/spell in linked_spells)
for(var/obj/proc_holder/spell/spell in linked_spells)
spell.perform(list(target),0)
return
+2 -2
View File
@@ -1,4 +1,4 @@
/obj/spell/targeted/turf_teleport
/obj/proc_holder/spell/targeted/turf_teleport
name = "Turf Teleport"
desc = "This spell teleports the target to the turf in range."
@@ -8,7 +8,7 @@
var/include_space = 0 //whether it includes space tiles in possible teleport locations
var/include_dense = 0 //whether it includes dense tiles in possible teleport locations
/obj/spell/targeted/turf_teleport/cast(list/targets)
/obj/proc_holder/spell/targeted/turf_teleport/cast(list/targets)
for(var/mob/target in targets)
var/list/turfs = new/list()
for(var/turf/T in range(target,outer_tele_radius))
+21 -21
View File
@@ -1,4 +1,4 @@
/obj/spell/targeted/projectile/magic_missile
/obj/proc_holder/spell/targeted/projectile/magic_missile
name = "Magic Missile"
desc = "This spell fires several, slow moving, magic projectiles at nearby targets."
@@ -14,7 +14,7 @@
proj_icon_state = "magicm"
proj_name = "a magic missile"
proj_lingering = 1
proj_type = "/obj/spell/targeted/inflict_handler/magic_missile"
proj_type = "/obj/proc_holder/spell/targeted/inflict_handler/magic_missile"
proj_lifespan = 20
proj_step_delay = 5
@@ -23,11 +23,11 @@
proj_trail_lifespan = 5
proj_trail_icon_state = "magicmd"
/obj/spell/targeted/inflict_handler/magic_missile
/obj/proc_holder/spell/targeted/inflict_handler/magic_missile
amt_weaken = 5
amt_dam_fire = 10
/obj/spell/targeted/genetic/mutate
/obj/proc_holder/spell/targeted/genetic/mutate
name = "Mutate"
desc = "This spell causes you to turn into a hulk and gain telekinesis for a short while."
@@ -43,7 +43,7 @@
mutations = 9
duration = 300
/obj/spell/targeted/inflict_handler/disintegrate
/obj/proc_holder/spell/targeted/inflict_handler/disintegrate
name = "Disintegrate"
desc = "This spell instantly kills somebody adjacent to you with the vilest of magick."
@@ -59,7 +59,7 @@
sparks_spread = 1
sparks_amt = 4
/obj/spell/targeted/smoke
/obj/proc_holder/spell/targeted/smoke
name = "Smoke"
desc = "This spell spawns a cloud of choking smoke at your location and does not require wizard garb."
@@ -74,7 +74,7 @@
smoke_spread = 2
smoke_amt = 10
/obj/spell/targeted/emplosion/disable_tech
/obj/proc_holder/spell/targeted/emplosion/disable_tech
name = "Disable Tech"
desc = "This spell disables all weapons, cameras and most other technology in range."
charge_max = 400
@@ -87,7 +87,7 @@
emp_heavy = 5
emp_light = 7
/obj/spell/targeted/turf_teleport/blink
/obj/proc_holder/spell/targeted/turf_teleport/blink
name = "Blink"
desc = "This spell randomly teleports you a short distance."
@@ -105,7 +105,7 @@
inner_tele_radius = 0
outer_tele_radius = 6
/obj/spell/targeted/area_teleport/teleport
/obj/proc_holder/spell/targeted/area_teleport/teleport
name = "Teleport"
desc = "This spell teleports you to a type of area of your selection."
@@ -120,7 +120,7 @@
smoke_spread = 1
smoke_amt = 5
/obj/spell/aoe_turf/conjure/forcewall
/obj/proc_holder/spell/aoe_turf/conjure/forcewall
name = "Forcewall"
desc = "This spell creates an unbreakable wall that lasts for 30 seconds and does not need wizard garb."
@@ -134,7 +134,7 @@
summon_type = list("/obj/forcefield")
summon_lifespan = 300
/obj/spell/aoe_turf/conjure/carp
/obj/proc_holder/spell/aoe_turf/conjure/carp
name = "Summon Bigger Carp"
desc = "This spell conjures an elite carp."
@@ -147,7 +147,7 @@
summon_type = list("/obj/livestock/spesscarp/elite")
/obj/spell/targeted/trigger/blind
/obj/proc_holder/spell/targeted/trigger/blind
name = "Blind"
desc = "This spell temporarily blinds a single person and does not require wizard garb."
@@ -158,17 +158,17 @@
invocation_type = "whisper"
message = "\blue Your eyes cry out in pain!"
starting_spells = list("/obj/spell/targeted/inflict_handler/blind","/obj/spell/targeted/genetic/blind")
starting_spells = list("/obj/proc_holder/spell/targeted/inflict_handler/blind","/obj/proc_holder/spell/targeted/genetic/blind")
/obj/spell/targeted/inflict_handler/blind
/obj/proc_holder/spell/targeted/inflict_handler/blind
amt_eye_blind = 10
amt_eye_blurry = 20
/obj/spell/targeted/genetic/blind
/obj/proc_holder/spell/targeted/genetic/blind
disabilities = 1
duration = 300
/obj/spell/targeted/projectile/fireball
/obj/proc_holder/spell/targeted/projectile/fireball
name = "Fireball"
desc = "This spell fires a fireball at a target and does not require wizard garb."
@@ -181,19 +181,19 @@
proj_icon_state = "fireball"
proj_name = "a fireball"
proj_lingering = 1
proj_type = "/obj/spell/targeted/trigger/fireball"
proj_type = "/obj/proc_holder/spell/targeted/trigger/fireball"
proj_lifespan = 200
proj_step_delay = 1
/obj/spell/targeted/trigger/fireball
starting_spells = list("/obj/spell/targeted/inflict_handler/fireball","/obj/spell/targeted/explosion/fireball")
/obj/proc_holder/spell/targeted/trigger/fireball
starting_spells = list("/obj/proc_holder/spell/targeted/inflict_handler/fireball","/obj/proc_holder/spell/targeted/explosion/fireball")
/obj/spell/targeted/inflict_handler/fireball
/obj/proc_holder/spell/targeted/inflict_handler/fireball
amt_dam_brute = 20
amt_dam_fire = 25
/obj/spell/targeted/explosion/fireball
/obj/proc_holder/spell/targeted/explosion/fireball
ex_severe = -1
ex_heavy = -1
ex_light = 2