Fixes pkborg fields not updating location or draining power

This commit is contained in:
CitadelStationBot
2017-05-21 22:28:20 -05:00
parent 5fd5e32628
commit 1dcad5fa0e
5 changed files with 41 additions and 11 deletions

View File

@@ -33,6 +33,7 @@
var/process_edge_turfs = FALSE //Don't do this either unless it's absolutely necessary, you can just track what things are inside manually or on the initial setup.
var/setup_edge_turfs = FALSE //Setup edge turfs/all field turfs. Set either or both to ON when you need it, it's defaulting to off unless you do to save CPU.
var/setup_field_turfs = FALSE
var/use_host_turf = FALSE //For fields from items carried on mobs to check turf instead of loc...
var/list/turf/field_turfs = list()
var/list/turf/edge_turfs = list()
@@ -90,8 +91,19 @@
for(var/turf/T in field_turfs)
cleanup_field_turf(T)
/datum/proximity_monitor/advanced/proc/check_movement()
if(!use_host_turf)
if(host.loc != last_host_loc)
last_host_loc = host.loc
return TRUE
else
if(get_turf(host) != last_host_loc)
last_host_loc = get_turf(host)
return TRUE
return FALSE
/datum/proximity_monitor/advanced/proc/recalculate_field(ignore_movement_check = FALSE) //Call every time the field moves (done automatically if you use update_center) or a setup specification is changed.
if(!(ignore_movement_check || ((host.loc != last_host_loc) && (field_shape != FIELD_NO_SHAPE))))
if(!(ignore_movement_check || check_movement()) && (field_shape != FIELD_NO_SHAPE))
return
update_new_turfs()
var/list/turf/needs_setup = field_turfs_new.Copy()
@@ -173,7 +185,6 @@
/datum/proximity_monitor/advanced/proc/update_new_turfs()
if(!istype(host))
return FALSE
last_host_loc = host.loc
var/turf/center = get_turf(host)
field_turfs_new = list()
edge_turfs_new = list()

View File

@@ -15,9 +15,11 @@
var/static/image/southwest_corner = image('icons/effects/fields.dmi', icon_state = "projectile_dampen_southwest")
var/static/image/northeast_corner = image('icons/effects/fields.dmi', icon_state = "projectile_dampen_northeast")
var/static/image/southeast_corner = image('icons/effects/fields.dmi', icon_state = "projectile_dampen_southeast")
var/static/image/generic_edge = image('icons/effects/fields.dmi', icon_state = "projectile_dampen_generic")
var/obj/item/borg/projectile_dampen/projector = null
var/list/obj/item/projectile/tracked
var/list/obj/item/projectile/staging
use_host_turf = TRUE
/datum/proximity_monitor/advanced/peaceborg_dampener/New()
tracked = list()
@@ -71,6 +73,8 @@
return southeast_corner
if(SOUTHWEST)
return southwest_corner
else
return generic_edge
/datum/proximity_monitor/advanced/peaceborg_dampener/proc/capture_projectile(obj/item/projectile/P, track_projectile = TRUE)
if(P in tracked)

View File

@@ -7,6 +7,7 @@
alpha = 0
invisibility = INVISIBILITY_ABSTRACT
flags = ABSTRACT|ON_BORDER
mouse_opacity = 0
var/datum/proximity_monitor/advanced/parent = null
/obj/effect/abstract/proximity_checker/advanced/Initialize(mapload, _monitor)