This commit is contained in:
mwerezak
2014-08-10 03:42:13 -04:00
parent e1dc7d436b
commit 444d03a335
3 changed files with 23 additions and 35 deletions

View File

@@ -132,6 +132,9 @@
usr.unset_machine()
return
if( href_list["toggle"] )
if(!active && !anchored)
usr << "\red The [src] needs to be firmly secured to the floor first."
return
active = !active
if( href_list["charge_rate"] )
charge_rate = between(10000, charge_rate + text2num(href_list["charge_rate"]), max_charge_rate)

View File

@@ -6,7 +6,7 @@
//explosion damage is cumulative. if a tile is in range of light, medium and heavy damage, it will take a hit from all three
/obj/machinery/shield_gen
name = "shield generator"
name = "bubble shield generator"
desc = "Machine that generates an impenetrable field of energy when activated."
icon = 'code/WorkInProgress/Cael_Aislinn/ShieldGen/shielding.dmi'
icon_state = "generator0"
@@ -180,6 +180,9 @@
usr.unset_machine()
return
else if( href_list["toggle"] )
if (!active && !anchored)
usr << "\red The [src] needs to be firmly secured to the floor first."
return
toggle()
else if( href_list["change_radius"] )
field_radius = between(0, field_radius + text2num(href_list["change_radius"]), max_field_radius)

View File

@@ -7,39 +7,21 @@
/obj/machinery/shield_gen/external/New()
..()
//NOT MULTIZ COMPATIBLE
//Search for space turfs within range that are adjacent to a simulated turf.
/obj/machinery/shield_gen/external/get_shielded_turfs()
var
list
open = list(get_turf(src))
closed = list()
while(open.len)
for(var/turf/T in open)
for(var/turf/O in orange(1, T))
if(get_dist(O,src) > field_radius)
continue
var/add_this_turf = 0
if(istype(O,/turf/space))
for(var/turf/simulated/G in orange(1, O))
add_this_turf = 1
break
//uncomment this for structures (but not lattices) to be surrounded by shield as well
/*if(!add_this_turf)
for(var/obj/structure/S in orange(1, O))
if(!istype(S, /obj/structure/lattice))
add_this_turf = 1
break
if(add_this_turf)
for(var/obj/structure/S in O)
if(!istype(S, /obj/structure/lattice))
add_this_turf = 0
break*/
if(add_this_turf && !(O in open) && !(O in closed))
open += O
open -= T
closed += T
return closed
var/list/out = list()
var/turf/gen_turf = get_turf(src)
if (!gen_turf)
return
var/turf/T
for (var/x_offset = -field_radius; x_offset <= field_radius; x_offset++)
for (var/y_offset = -field_radius; y_offset <= field_radius; y_offset++)
T = locate(gen_turf.x + x_offset, gen_turf.y + y_offset, gen_turf.z)
if (istype(T, /turf/space))
//check neighbors of T
if (locate(/turf/simulated/) in orange(1, T))
out += T
return out