- Another fix for turrets.

ATTENTION MAPPERS! If turret control thingy is not in the same area as the turrets, set its control_area variable to either area name or area typepath.
If it's in the same area, you can leave control_area null.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1505 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
panurgomatic
2011-04-28 03:35:58 +00:00
parent ece54689dc
commit 011fc30295
2 changed files with 18 additions and 12 deletions

View File

@@ -150,7 +150,7 @@
if(src.cover==null)
src.cover = new /obj/machinery/turretcover(src.loc)
protected_area = get_protected_area()
if(!protected_area || protected_area.turretTargets.len<=0 || !enabled)
if(!enabled || !protected_area || protected_area.turretTargets.len<=0)
if(!isDown() && !isPopping())
popDown()
return
@@ -283,8 +283,21 @@
var/enabled = 1
var/lethal = 0
var/locked = 1
var/control_area //can be area name, path or nothing.
req_access = list(access_ai_upload)
/obj/machinery/turretid/New()
..()
if(!control_area)
control_area = get_area(src)
else if(istext(control_area))
for(var/area/A in world)
if(A.name && A.name==control_area)
control_area = A
break
//don't have to check if control_area is path, since get_area_all_atoms can take path.
return
/obj/machinery/turretid/attackby(obj/item/weapon/W, mob/user)
if(stat & BROKEN) return
if (istype(user, /mob/living/silicon))
@@ -370,16 +383,9 @@
else
icon_state = "motion0"
var/loc = src.loc
if (istype(loc, /turf))
loc = loc:loc
if (!istype(loc, /area))
world << text("Turret badly positioned - loc.loc is [loc].")
return
var/area/area = loc
for (var/obj/machinery/turret/aTurret in get_area_all_atoms(area))
aTurret.setState(enabled, lethal)
if(control_area)
for (var/obj/machinery/turret/aTurret in get_area_all_atoms(control_area))
aTurret.setState(enabled, lethal)

View File

@@ -3381,7 +3381,7 @@
"bna" = (/obj/machinery/atmospherics/pipe/manifold{dir = 8},/obj/grille,/turf/space,/area)
"bnb" = (/obj/machinery/atmospherics/pipe/simple{dir = 4},/obj/machinery/atmospherics/pipe/simple,/obj/grille,/obj/grille,/turf/space,/area)
"bnc" = (/obj/machinery/atmospherics/pipe/manifold,/turf/simulated/wall/r_wall,/area/turret_protected/ai_upload_foyer)
"bnd" = (/obj/machinery/light/small,/obj/machinery/turretid{pixel_x = -24},/obj/machinery/ai_status_display{pixel_y = -28},/obj/machinery/camera{c_tag = "AI Upload Foyer"; dir = 1},/obj/machinery/atmospherics/pipe/simple{dir = 4},/obj/landmark/start{name = "Cyborg"},/turf/simulated/floor{dir = 0; icon_state = "blue"},/area/turret_protected/ai_upload_foyer)
"bnd" = (/obj/machinery/light/small,/obj/machinery/turretid{control_area = "AI Upload Chamber"; pixel_x = -24},/obj/machinery/ai_status_display{pixel_y = -28},/obj/machinery/camera{c_tag = "AI Upload Foyer"; dir = 1},/obj/machinery/atmospherics/pipe/simple{dir = 4},/obj/landmark/start{name = "Cyborg"},/turf/simulated/floor{dir = 0; icon_state = "blue"},/area/turret_protected/ai_upload_foyer)
"bne" = (/obj/machinery/atmospherics/pipe/simple{dir = 4},/obj/cable{d1 = 1; d2 = 2; icon_state = "1-2"; tag = "Streight"},/obj/cable{d1 = 2; d2 = 4; icon_state = "2-4"; tag = "90Curve"},/turf/simulated/floor{dir = 0; icon_state = "blue"},/area/turret_protected/ai_upload_foyer)
"bnf" = (/obj/machinery/light/small,/obj/machinery/power/apc{dir = 4; name = "Upload Foyer APC"; pixel_x = 27; pixel_y = -2},/obj/cable{d2 = 8; icon_state = "0-8"},/obj/machinery/atmospherics/pipe/simple{dir = 4},/obj/landmark/start{name = "Cyborg"},/turf/simulated/floor{dir = 0; icon_state = "blue"},/area/turret_protected/ai_upload_foyer)
"bng" = (/obj/machinery/atmospherics/pipe/simple{dir = 9},/turf/simulated/wall/r_wall,/area/security/nuke_storage)