Begins work on new AI.

This commit is contained in:
Neerti
2018-02-17 09:40:22 -05:00
parent fdc367a4b5
commit abb3a5f602
14 changed files with 760 additions and 7 deletions

View File

@@ -470,7 +470,8 @@
return 2
//just assume we can shoot through glass and stuff. No big deal, the player can just choose to not target someone
//on the other side of a window if it makes a difference. Or if they run behind a window, too bad.
return check_trajectory(target, user)
if(check_trajectory(target, user))
return 1 // Magic numbers are fun.
//called if there was no projectile to shoot
/obj/item/weapon/gun/proc/handle_click_empty(mob/user)

View File

@@ -416,6 +416,7 @@
yo = null
xo = null
var/result = 0 //To pass the message back to the gun.
var/atom/movable/result_ref = null // The thing that got hit that made the check return true.
/obj/item/projectile/test/Bump(atom/A as mob|obj|turf|area)
if(A == firer)
@@ -426,6 +427,7 @@
if(istype(A, /obj/structure/foamedmetal)) //Turrets can detect through foamed metal, but will have to blast through it. Similar to windows, if someone runs behind it, a person should probably just not shoot.
return
if(istype(A, /mob/living) || istype(A, /obj/mecha) || istype(A, /obj/vehicle))
result_ref = A
result = 2 //We hit someone, return 1!
return
result = 1
@@ -446,7 +448,8 @@
/obj/item/projectile/test/process(var/turf/targloc)
while(src) //Loop on through!
if(result)
return (result - 1)
return result_ref
// return (result - 1)
if((!( targloc ) || loc == targloc))
targloc = locate(min(max(x + xo, 1), world.maxx), min(max(y + yo, 1), world.maxy), z) //Finding the target turf at map edge
@@ -457,11 +460,13 @@
var/mob/living/M = locate() in get_turf(src)
if(istype(M)) //If there is someting living...
return 1 //Return 1
result_ref = M
return result_ref //Return 1
else
M = locate() in get_step(src,targloc)
if(istype(M))
return 1
result_ref = M
return result_ref
//Helper proc to check if you can hit them or not.
/proc/check_trajectory(atom/target as mob|obj, atom/firer as mob|obj, var/pass_flags=PASSTABLE|PASSGLASS|PASSGRILLE, flags=null)