Ports /vg/'s spell system for the sake of cult porting.

Does offer a much more pleasant basis to work with in the future, if someone wishes to add more spell-like abilities.
This commit is contained in:
PsiOmega
2015-04-09 14:36:46 +02:00
parent e6f83f8fa2
commit 990530d118
85 changed files with 3135 additions and 1924 deletions

View File

@@ -51,17 +51,18 @@
var/drowsy = 0
var/agony = 0
var/embed = 0 // whether or not the projectile can embed itself in the mob
var/hitscan = 0 // whether the projectile should be hitscan
var/hitscan = 0 // whether the projectile should be hitscan
var/step_delay = 1 // the delay between iterations if not a hitscan projectile
// effect types to be used
var/muzzle_type
var/tracer_type
var/impact_type
var/datum/plot_vector/trajectory // used to plot the path of the projectile
var/datum/vector_loc/location // current location of the projectile in pixel space
var/matrix/effect_transform // matrix to rotate and scale projectile effects - putting it here so it doesn't
var/matrix/effect_transform // matrix to rotate and scale projectile effects - putting it here so it doesn't
// have to be recreated multiple times
//TODO: make it so this is called more reliably, instead of sometimes by bullet_act() and sometimes not
@@ -113,12 +114,12 @@
if(user == target) //Shooting yourself
user.bullet_act(src, target_zone)
on_impact(user)
del(src)
qdel(src)
return 0
if(targloc == curloc) //Shooting something in the same turf
target.bullet_act(src, target_zone)
on_impact(target)
del(src)
qdel(src)
return 0
original = target
@@ -256,7 +257,7 @@
density = 0
invisibility = 101
del(src)
qdel(src)
return 1
/obj/item/projectile/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
@@ -276,19 +277,20 @@
spawn while(src)
if(kill_count-- < 1)
on_impact(src.loc) //for any final impact behaviours
del(src)
qdel(src)
if((!( current ) || loc == current))
current = locate(min(max(x + xo, 1), world.maxx), min(max(y + yo, 1), world.maxy), z)
if((x == 1 || x == world.maxx || y == 1 || y == world.maxy))
del(src)
qdel(src)
return
trajectory.increment() // increment the current location
location = trajectory.return_location(location) // update the locally stored location data
if(!location)
del(src) // if it's left the world... kill it
qdel(src) // if it's left the world... kill it
before_move()
Move(location.return_turf())
if(first_step)
@@ -302,14 +304,20 @@
if(!(original in permutated))
Bump(original)
if(!hitscan)
sleep(1) //add delay between movement iterations if it's not a hitscan weapon
sleep(step_delay) //add delay between movement iterations if it's not a hitscan weapon
/obj/item/projectile/proc/process_step(first_step = 0)
/obj/item/projectile/proc/before_move()
/obj/item/projectile/proc/setup_trajectory()
// plot the initial trajectory
trajectory = new()
trajectory.setup(starting, original, pixel_x, pixel_y)
// generate this now since all visual effects the projectile makes can use it
effect_transform = new()
effect_transform.Scale(trajectory.return_hypotenuse(), 1)
@@ -321,7 +329,7 @@
if(ispath(muzzle_type))
var/obj/effect/projectile/M = new muzzle_type(get_turf(src))
if(istype(M))
M.set_transform(T)
M.pixel_x = location.pixel_x
@@ -331,7 +339,7 @@
/obj/item/projectile/proc/tracer_effect(var/matrix/M)
if(ispath(tracer_type))
var/obj/effect/projectile/P = new tracer_type(location.loc)
if(istype(P))
P.set_transform(M)
P.pixel_x = location.pixel_x
@@ -341,7 +349,7 @@
/obj/item/projectile/proc/impact_effect(var/matrix/M)
if(ispath(tracer_type))
var/obj/effect/projectile/P = new impact_type(location.loc)
if(istype(P))
P.set_transform(M)
P.pixel_x = location.pixel_x
@@ -411,5 +419,5 @@
trace.pass_flags = pass_flags //And the pass flags to that of the real projectile...
trace.firer = user
var/output = trace.process() //Test it!
del(trace) //No need for it anymore
qdel(trace) //No need for it anymore
return output //Send it back to the gun!

View File

@@ -79,8 +79,8 @@
A.randomize_appearance_for(H)
if(new_mob)
for (var/obj/effect/proc_holder/spell/S in M.spell_list)
new_mob.spell_list += new S.type
for (var/spell/S in M.spell_list)
new_mob.add_spell(new S.type)
new_mob.a_intent = "hurt"
if(M.mind)