Simple animals and turrets will now attack pods

This commit is contained in:
Markolie
2015-01-31 21:25:46 +01:00
parent 409dd8cfce
commit d9cf2a8bbe
6 changed files with 83 additions and 6 deletions
+1
View File
@@ -20,6 +20,7 @@ var/global/list/landmarks_list = list() //list of all landmarks created
var/global/list/surgery_steps = list() //list of all surgery steps |BS12
var/global/list/side_effects = list() //list of all medical sideeffects types by thier names |BS12
var/global/list/mechas_list = list() //list of all mechs. Used by hostile mobs target tracking.
var/global/list/spacepods_list = list() //list of all space pods. Used by hostile mobs target tracking.
var/global/list/joblist = list() //list of all jobstypes, minus borg and AI
var/global/list/flag_list = list() //list of flags during Nations gamemode
var/global/list/airlocks = list() //list of all airlocks
+27
View File
@@ -22,6 +22,10 @@
var/obj/mecha/Mech = O
if( Mech.occupant )
turretTargets |= Mech
else if( istype(O, /obj/spacepod) )
var/obj/spacepod/Pod = O
if( Pod.occupant || Pod.occupant2 )
turretTargets |= Pod
else if(istype(O,/mob/living/simple_animal))
turretTargets |= O
return 1
@@ -34,6 +38,8 @@
turretTargets -= O
else if( istype(O, /obj/mecha) )
turretTargets -= O
else if( istype(O, /obj/spacepod) )
turretTargets -= O
..()
return 1
@@ -139,6 +145,10 @@
var/obj/mecha/ME = T
if( ME.occupant )
return 1
else if( istype(T, /obj/spacepod) )
var/obj/spacepod/SP = T
if( SP.occupant || SP.occupant2 )
return 1
else if(istype(T,/mob/living/simple_animal))
var/mob/living/simple_animal/A = T
if( !A.stat )
@@ -156,6 +166,9 @@
for(var/obj/mecha/M in protected_area.turretTargets)
if(M.occupant)
new_targets += M
for(var/obj/spacepod/M in protected_area.turretTargets)
if(M.occupant)
new_targets += M
for(var/mob/living/simple_animal/M in protected_area.turretTargets)
if(!M.stat)
new_targets += M
@@ -575,6 +588,10 @@
var/obj/mecha/M = target
if(M.occupant)
return 1
else if(istype(target, /obj/spacepod))
var/obj/spacepod/S = target
if(S.occupant || S.occupant2)
return 1
return 0
@@ -606,6 +623,16 @@
if(!M.occupant)
continue //Don't shoot at empty mechs.
pos_targets += M
for(var/obj/spacepod/M in oview(scan_range, src))
if(M.occupant)
if(faction in M.occupant.faction)
continue
if(M.occupant2)
if(faction in M.occupant2.faction)
continue
if(!M.occupant && !M.occupant2)
continue //Don't shoot at empty mechs.
pos_targets += M
if(pos_targets.len)
target = pick(pos_targets)
return target
+30 -6
View File
@@ -26,7 +26,7 @@
var/hatch_open = 0
var/next_firetime = 0
var/list/pod_overlays
var/health = 100
var/health = 250
var/lights = 0
var/lights_power = 6
var/allow2enter = 1
@@ -50,6 +50,11 @@
pr_int_temp_processor = new /datum/global_iterator/pod_preserve_temp(list(src))
pr_give_air = new /datum/global_iterator/pod_tank_give_air(list(src))
equipment_system = new(src)
spacepods_list += src
/obj/spacepod/Destroy()
spacepods_list -= src
..()
/obj/spacepod/proc/update_icons()
if(!pod_overlays)
@@ -69,6 +74,23 @@
/obj/spacepod/bullet_act(var/obj/item/projectile/P)
if(P.damage && !P.nodamage)
deal_damage(P.damage)
/obj/spacepod/attack_animal(mob/living/simple_animal/user as mob)
if(user.melee_damage_upper == 0)
user.emote("[user.friendly] [src]")
else
var/damage = rand(user.melee_damage_lower, user.melee_damage_upper)
deal_damage(damage)
visible_message("\red <B>[user]</B> [user.attacktext] [src]!")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>attacked [src.name]</font>")
return
/obj/spacepod/attack_alien(mob/user as mob)
deal_damage(15)
playsound(src.loc, 'sound/weapons/slash.ogg', 50, 1, -1)
user << "\red You slash at the armored suit!"
visible_message("\red The [user] slashes at [src.name]'s armor!")
return
/obj/spacepod/proc/deal_damage(var/damage)
var/oldhealth = health
@@ -160,7 +182,9 @@
equipment_system.weapon_system.my_atom = src
return
/obj/spacepod/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/spacepod/attack_hand(mob/user as mob)
if(!hatch_open)
return ..()
@@ -222,7 +246,7 @@
name = "\improper security spacepod"
desc = "An armed security spacepod with reinforced armor plating."
icon_state = "pod_mil"
health = 150
health = 400
/obj/spacepod/sec/New()
..()
@@ -512,12 +536,12 @@
set category = "Spacepod"
set src = usr.loc
if(usr.ckey == src.occupant2.ckey)
if(occupant2 == src)
if(!allow2enter)
usr << "<span class='notice'>You can't unlock the doors from your seat. </span>"
usr << "<span class='notice'>You can't unlock the doors from your seat.</span>"
return
else
usr << "<span class='notice'>You can't lock the doors from your seat. </span>"
usr << "<span class='notice'>You can't lock the doors from your seat.</span>"
return
else
if(src.allow2enter)
@@ -71,6 +71,9 @@
for(var/obj/mecha/M in mechas_list)
if(get_dist(M, src) <= vision_range && can_see(src, M, vision_range))
L += M
for(var/obj/spacepod/S in spacepods_list)
if(get_dist(S, src) <= vision_range && can_see(src, S, vision_range))
L += S
return L
/mob/living/simple_animal/hostile/proc/FindTarget()//Step 2, filter down possible targets to things we actually care about
@@ -131,6 +134,10 @@
var/obj/mecha/M = the_target
if(M.occupant)//Just so we don't attack empty mechs
return 1
if(istype(the_target, /obj/spacepod))
var/obj/spacepod/S = the_target
if(S.occupant || S.occupant2)//Just so we don't attack empty mechs
return 1
return 0
/mob/living/simple_animal/hostile/proc/GiveTarget(var/new_target)//Step 4, give us our selected target
@@ -14,6 +14,11 @@
if(M.occupant)
stance = HOSTILE_STANCE_ATTACK
return A
else if(istype(A, /obj/spacepod))
var/obj/spacepod/M = A
if(M.occupant || M.occupant2)
stance = HOSTILE_STANCE_ATTACK
return A
/mob/living/simple_animal/hostile/retaliate/ListTargets()
if(!enemies.len)
@@ -43,6 +48,11 @@
if(M.occupant)
enemies |= M
enemies |= M.occupant
else if(istype(A, /obj/spacepod))
var/obj/spacepod/M = A
if(M.occupant || M.occupant2)
enemies |= M
enemies |= M.occupant
for(var/mob/living/simple_animal/hostile/retaliate/H in around)
var/retaliate_faction_check = 0
@@ -468,6 +468,10 @@
var/obj/mecha/M = target
if (M.occupant)
return 0
if (istype(target,/obj/spacepod))
var/obj/spacepod/S = target
if (S.occupant || S.occupant2)
return 0
return 1
/mob/living/simple_animal/update_fire()
@@ -526,4 +530,8 @@
var/obj/mecha/M = the_target
if (M.occupant)
return 0
if (istype(the_target, /obj/spacepod))
var/obj/spacepod/S = the_target
if (S.occupant || S.occupant2)
return 0
return 1