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() usr.unset_machine()
return return
if( href_list["toggle"] ) if( href_list["toggle"] )
if(!active && !anchored)
usr << "\red The [src] needs to be firmly secured to the floor first."
return
active = !active active = !active
if( href_list["charge_rate"] ) if( href_list["charge_rate"] )
charge_rate = between(10000, charge_rate + text2num(href_list["charge_rate"]), max_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 //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 /obj/machinery/shield_gen
name = "shield generator" name = "bubble shield generator"
desc = "Machine that generates an impenetrable field of energy when activated." desc = "Machine that generates an impenetrable field of energy when activated."
icon = 'code/WorkInProgress/Cael_Aislinn/ShieldGen/shielding.dmi' icon = 'code/WorkInProgress/Cael_Aislinn/ShieldGen/shielding.dmi'
icon_state = "generator0" icon_state = "generator0"
@@ -180,6 +180,9 @@
usr.unset_machine() usr.unset_machine()
return return
else if( href_list["toggle"] ) else if( href_list["toggle"] )
if (!active && !anchored)
usr << "\red The [src] needs to be firmly secured to the floor first."
return
toggle() toggle()
else if( href_list["change_radius"] ) else if( href_list["change_radius"] )
field_radius = between(0, field_radius + text2num(href_list["change_radius"]), max_field_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() /obj/machinery/shield_gen/external/New()
..() ..()
//NOT MULTIZ COMPATIBLE
//Search for space turfs within range that are adjacent to a simulated turf. //Search for space turfs within range that are adjacent to a simulated turf.
/obj/machinery/shield_gen/external/get_shielded_turfs() /obj/machinery/shield_gen/external/get_shielded_turfs()
var var/list/out = list()
list
open = list(get_turf(src)) var/turf/gen_turf = get_turf(src)
closed = list() if (!gen_turf)
return
while(open.len)
for(var/turf/T in open) var/turf/T
for(var/turf/O in orange(1, T)) for (var/x_offset = -field_radius; x_offset <= field_radius; x_offset++)
if(get_dist(O,src) > field_radius) for (var/y_offset = -field_radius; y_offset <= field_radius; y_offset++)
continue T = locate(gen_turf.x + x_offset, gen_turf.y + y_offset, gen_turf.z)
var/add_this_turf = 0 if (istype(T, /turf/space))
if(istype(O,/turf/space)) //check neighbors of T
for(var/turf/simulated/G in orange(1, O)) if (locate(/turf/simulated/) in orange(1, T))
add_this_turf = 1 out += T
break return out
//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