mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
-Added a new global list. Cameras will hold every camera created and is kept up to date by the Camera's New() and Del(). Much faster than having everything loop the world. AI camera movement seems faster too.
-Fixed Issue 415 -Tweaked creating new cameras. When you create a camera from a camera assembly, it will now auto detect the direction it should be in. I also added a confirmation message which allows you to re choose the direction with up to 5 chances; to avoid infinite loops. -Made the New Player Options window a little bit slimmer. -Forgot to add a changelog for my last commit. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4096 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -1202,7 +1202,7 @@
|
||||
|
||||
/obj/item/weapon/camera_bug/attack_self(mob/usr as mob)
|
||||
var/list/cameras = new/list()
|
||||
for (var/obj/machinery/camera/C in world)
|
||||
for (var/obj/machinery/camera/C in Cameras)
|
||||
if (C.bugged && C.status)
|
||||
cameras.Add(C)
|
||||
if (length(cameras) == 0)
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
var/global/list/obj/machinery/camera/Cameras = list()
|
||||
|
||||
/obj/machinery/camera/New()
|
||||
Cameras += src
|
||||
..()
|
||||
|
||||
/obj/machinery/camera/Del()
|
||||
Cameras -= src
|
||||
..()
|
||||
|
||||
|
||||
// Double clicking turfs to move to nearest camera
|
||||
|
||||
@@ -143,7 +153,7 @@
|
||||
if (closestDist > 7 || closestDist == -1)
|
||||
//check other cameras
|
||||
var/obj/machinery/camera/closest = C
|
||||
for(var/obj/machinery/camera/C2 in world)
|
||||
for(var/obj/machinery/camera/C2 in Cameras)
|
||||
if (C2.network == src.network)
|
||||
if (C2.z == target.z)
|
||||
zmatched = 1
|
||||
@@ -191,10 +201,14 @@
|
||||
if (stat == 2)
|
||||
return
|
||||
|
||||
// If they cancel then just put them back to their old camera
|
||||
var/obj/machinery/camera/tempC = src.current
|
||||
user.machine = src
|
||||
src.current = null
|
||||
switchCamera(null)
|
||||
|
||||
var/list/L = list()
|
||||
for (var/obj/machinery/camera/C in world)
|
||||
for (var/obj/machinery/camera/C in Cameras)
|
||||
L.Add(C)
|
||||
|
||||
camera_sort(L)
|
||||
@@ -208,11 +222,15 @@
|
||||
var/t = input(user, "Which camera should you change to?") as null|anything in D
|
||||
|
||||
if (!t || t == "Cancel")
|
||||
switchCamera(null)
|
||||
if(tempC && tempC.status)
|
||||
src.current = tempC
|
||||
switchCamera(null)
|
||||
else
|
||||
src.current = null
|
||||
switchCamera(null)
|
||||
return 0
|
||||
|
||||
var/obj/machinery/camera/C = D[t]
|
||||
|
||||
switchCamera(C)
|
||||
|
||||
return
|
||||
@@ -383,6 +401,24 @@
|
||||
O.reset_view(null)
|
||||
O << "The screen bursts into static."
|
||||
|
||||
/atom/proc/auto_turn()
|
||||
//Automatically turns based on nearby walls.
|
||||
var/turf/simulated/wall/T = null
|
||||
for(var/i = 1, i <= 8; i += i)
|
||||
T = get_ranged_target_turf(src, i, 1)
|
||||
if(!isnull(T) && istype(T))
|
||||
//If someone knows a better way to do this, let me know. -Giacom
|
||||
switch(i)
|
||||
if(NORTH)
|
||||
src.dir = SOUTH
|
||||
if(SOUTH)
|
||||
src.dir = NORTH
|
||||
if(WEST)
|
||||
src.dir = EAST
|
||||
if(EAST)
|
||||
src.dir = WEST
|
||||
break
|
||||
|
||||
//Return a working camera that can see a given mob
|
||||
//or null if none
|
||||
/proc/seen_by_camera(var/mob/M)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
user.machine = src
|
||||
|
||||
var/list/L = list()
|
||||
for (var/obj/machinery/camera/C in world)
|
||||
for (var/obj/machinery/camera/C in Cameras)
|
||||
L.Add(C)
|
||||
|
||||
camera_sort(L)
|
||||
@@ -57,6 +57,8 @@
|
||||
|
||||
if(C)
|
||||
if ((get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) || !( C.status )) && (!istype(user, /mob/living/silicon/ai)))
|
||||
if(!C.status)
|
||||
src.current = null
|
||||
return 0
|
||||
else
|
||||
src.current = C
|
||||
|
||||
@@ -152,15 +152,29 @@
|
||||
if(istype(W, /obj/item/weapon/screwdriver))
|
||||
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
|
||||
user << "\blue You connect the lense."
|
||||
var/B
|
||||
var/obj/machinery/camera/B = null
|
||||
if(motion == 1)
|
||||
B = new /obj/machinery/camera/motion( src.loc )
|
||||
else
|
||||
B = new /obj/machinery/camera( src.loc )
|
||||
B:network = "SS13"
|
||||
B:network = input(usr, "Which network would you like to connect this camera to?", "Set Network", "SS13")
|
||||
direct = input(user, "Direction?", "Assembling Camera", null) in list( "NORTH", "EAST", "SOUTH", "WEST" )
|
||||
B:dir = text2dir(direct)
|
||||
// To prevent people exploiting the fact that it doesn't delete the assembly until the user is done
|
||||
// entering the camera options.
|
||||
src.loc = B
|
||||
|
||||
//Auto detect walls and turn camera based on wall locations.
|
||||
B.auto_turn()
|
||||
|
||||
B.network = "SS13"
|
||||
B.network = input(usr, "Which network would you like to connect this camera to?", "Set Network", "SS13")
|
||||
|
||||
for(var/i = 5; i >= 0; i -= 1)
|
||||
direct = input(user, "Direction?", "Assembling Camera", null) in list("LEAVE IT", "NORTH", "EAST", "SOUTH", "WEST" )
|
||||
if(direct != "LEAVE IT")
|
||||
B.dir = text2dir(direct)
|
||||
if(i != 0)
|
||||
var/confirm = alert(user, "Is this what you want? Chances Remaining: [i]", "Confirmation", "Yes", "No")
|
||||
if(confirm == "Yes")
|
||||
break
|
||||
del(src)
|
||||
|
||||
prime()
|
||||
|
||||
@@ -57,7 +57,7 @@ var/intercom_range_display_status = 0
|
||||
del(C)
|
||||
|
||||
if(camera_range_display_status)
|
||||
for(var/obj/machinery/camera/C in world)
|
||||
for(var/obj/machinery/camera/C in Cameras)
|
||||
new/obj/effect/debugging/camera_range(C.loc)
|
||||
feedback_add_details("admin_verb","mCRD") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
@@ -73,7 +73,7 @@ var/intercom_range_display_status = 0
|
||||
|
||||
var/list/obj/machinery/camera/CL = list()
|
||||
|
||||
for(var/obj/machinery/camera/C in world)
|
||||
for(var/obj/machinery/camera/C in Cameras)
|
||||
CL += C
|
||||
|
||||
var/output = {"<B>CAMERA ANNOMALITIES REPORT</B><HR>
|
||||
|
||||
@@ -269,12 +269,12 @@
|
||||
var/mob/living/silicon/ai/A = locate(href_list["track2"])
|
||||
if(A && target)
|
||||
|
||||
A:cameraFollow = target
|
||||
A.cameraFollow = target
|
||||
A << text("Now tracking [] on camera.", target.name)
|
||||
if (usr.machine == null)
|
||||
usr.machine = usr
|
||||
|
||||
while (usr:cameraFollow == target)
|
||||
while (src.cameraFollow == target)
|
||||
usr << "Target is not on or near any active cameras on the station. We'll check again in 5 seconds (unless you use the cancel-camera verb)."
|
||||
sleep(40)
|
||||
continue
|
||||
@@ -356,17 +356,16 @@
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/switchCamera(var/obj/machinery/camera/C)
|
||||
usr:cameraFollow = null
|
||||
if (!C)
|
||||
|
||||
src.cameraFollow = null
|
||||
if (!C || stat == 2 || !C.status || C.network != network)
|
||||
machine = null
|
||||
reset_view(null)
|
||||
return 0
|
||||
if (stat == 2 || !C.status || C.network != network) return 0
|
||||
|
||||
// ok, we're alive, camera is good and in our network...
|
||||
|
||||
machine = src
|
||||
src:current = C
|
||||
src.current = C
|
||||
reset_view(C)
|
||||
return 1
|
||||
|
||||
@@ -429,7 +428,7 @@
|
||||
set name = "Cancel Camera View"
|
||||
reset_view(null)
|
||||
machine = null
|
||||
src:cameraFollow = null
|
||||
src.cameraFollow = null
|
||||
|
||||
//Replaces /mob/living/silicon/ai/verb/change_network() in ai.dm & camera.dm
|
||||
//Adds in /mob/living/silicon/ai/proc/ai_network_change() instead
|
||||
@@ -439,14 +438,14 @@
|
||||
set name = "Change Camera Network"
|
||||
reset_view(null)
|
||||
machine = null
|
||||
src:cameraFollow = null
|
||||
src.cameraFollow = null
|
||||
var/cameralist[0]
|
||||
|
||||
if(usr.stat == 2)
|
||||
usr << "You can't change your camera network because you are dead!"
|
||||
return
|
||||
|
||||
for (var/obj/machinery/camera/C in world)
|
||||
for (var/obj/machinery/camera/C in Cameras)
|
||||
if(!C.status)
|
||||
continue
|
||||
if(C.network == "AI Satellite")
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
var/area/A = get_area(old)
|
||||
var/list/old_types = dd_text2list("[A.type]", "/")
|
||||
|
||||
for(var/obj/machinery/camera/current in world)
|
||||
for(var/obj/machinery/camera/current in Cameras)
|
||||
if(user.network != current.network) continue
|
||||
if(!current.status) continue // ignore disabled cameras
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
usr << "You can't change your camera network because you are dead!"
|
||||
return
|
||||
|
||||
for (var/obj/machinery/camera/C in world)
|
||||
for (var/obj/machinery/camera/C in Cameras)
|
||||
if(!C.status)
|
||||
continue
|
||||
else
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
output += "</div>"
|
||||
|
||||
src << browse(output,"window=playersetup;size=250x240;can_close=0")
|
||||
src << browse(output,"window=playersetup;size=210x240;can_close=0")
|
||||
return
|
||||
|
||||
proc/Playmusic()
|
||||
|
||||
Reference in New Issue
Block a user