mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
Camera code update, fix runtime
This commit is contained in:
@@ -190,7 +190,7 @@
|
||||
if(temp.len)
|
||||
L.Add(C)
|
||||
|
||||
camera_sort(L)
|
||||
cameranet.process_sort()
|
||||
|
||||
return L
|
||||
verify_machine(var/obj/machinery/camera/C,var/datum/file/camnet_key/key = null)
|
||||
|
||||
@@ -112,7 +112,7 @@ var/list/ai_list = list()
|
||||
if (istype(loc, /turf))
|
||||
verbs.Add(/mob/living/silicon/ai/proc/ai_network_change, \
|
||||
/mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change, \
|
||||
/mob/living/silicon/ai/proc/toggle_camera_light, /mob/living/silicon/ai/proc/botcall, /mob/living/silicon/ai/proc/control_integrated_radio, /mob/living/silicon/ai/proc/control_hud, /mob/living/silicon/ai/proc/change_arrival_message)
|
||||
/mob/living/silicon/ai/proc/toggle_camera_light, /mob/living/silicon/ai/proc/botcall, /mob/living/silicon/ai/proc/control_integrated_radio, /mob/living/silicon/ai/proc/control_hud, /mob/living/silicon/ai/proc/change_arrival_message, /mob/living/silicon/ai/proc/ai_store_location, /mob/living/silicon/ai/proc/ai_goto_location, /mob/living/silicon/ai/proc/ai_remove_location)
|
||||
|
||||
if(!safety)//Only used by AIize() to successfully spawn an AI.
|
||||
if (!B)//If there is no player/brain inside.
|
||||
@@ -127,7 +127,7 @@ var/list/ai_list = list()
|
||||
verbs.Remove(,/mob/living/silicon/ai/proc/ai_call_shuttle,/mob/living/silicon/ai/proc/ai_camera_track, \
|
||||
/mob/living/silicon/ai/proc/ai_camera_list, /mob/living/silicon/ai/proc/ai_network_change, \
|
||||
/mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change, \
|
||||
/mob/living/silicon/ai/proc/toggle_camera_light,/mob/living/silicon/ai/verb/pick_icon,/mob/living/silicon/ai/proc/control_hud)
|
||||
/mob/living/silicon/ai/proc/toggle_camera_light,/mob/living/silicon/ai/verb/pick_icon,/mob/living/silicon/ai/proc/control_hud, /mob/living/silicon/ai/proc/change_arrival_message)
|
||||
laws = new /datum/ai_laws/alienmov
|
||||
else
|
||||
B.brainmob.mind.transfer_to(src)
|
||||
@@ -631,8 +631,6 @@ var/list/ai_list = list()
|
||||
|
||||
/mob/living/silicon/ai/proc/switchCamera(var/obj/machinery/camera/C)
|
||||
|
||||
src.cameraFollow = null
|
||||
|
||||
if (!C || stat == 2) //C.can_use())
|
||||
return 0
|
||||
|
||||
@@ -706,7 +704,6 @@ var/list/ai_list = list()
|
||||
set category = "AI Commands"
|
||||
set name = "Jump To Network"
|
||||
unset_machine()
|
||||
src.cameraFollow = null
|
||||
var/cameralist[0]
|
||||
|
||||
if(usr.stat == 2)
|
||||
@@ -912,3 +909,52 @@ var/list/ai_list = list()
|
||||
src << "Accessing Subspace Transceiver control..."
|
||||
if (src.aiRadio)
|
||||
src.aiRadio.interact(src)
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/open_nearest_door(mob/living/target as mob)
|
||||
if(!istype(target)) return
|
||||
spawn(0)
|
||||
if(istype(target, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = target
|
||||
if(H.wear_id && istype(H.wear_id.GetID(), /obj/item/weapon/card/id/syndicate))
|
||||
src << "Unable to locate an airlock"
|
||||
return
|
||||
if(H.wear_id && istype(H.wear_id.GetID(), /obj/item/weapon/card/id/syndicate))
|
||||
src << "Unable to locate an airlock"
|
||||
return
|
||||
if(istype(H.head, /obj/item/clothing/head/helmet/space/space_ninja) && !H.head.canremove)
|
||||
src << "Unable to locate an airlock"
|
||||
return
|
||||
if(H.digitalcamo)
|
||||
src << "Unable to locate an airlock"
|
||||
return
|
||||
if (!near_camera(target))
|
||||
src << "Target is not near any active cameras."
|
||||
return
|
||||
var/obj/machinery/door/airlock/tobeopened
|
||||
var/dist = -1
|
||||
for(var/obj/machinery/door/airlock/D in range(3,target))
|
||||
if(!D.density) continue
|
||||
if(dist < 0)
|
||||
dist = get_dist(D, target)
|
||||
//world << dist
|
||||
tobeopened = D
|
||||
else
|
||||
if(dist > get_dist(D, target))
|
||||
dist = get_dist(D, target)
|
||||
//world << dist
|
||||
tobeopened = D
|
||||
//world << "found [tobeopened.name] closer"
|
||||
else
|
||||
//world << "[D.name] not close enough | [get_dist(D, target)] | [dist]"
|
||||
if(tobeopened)
|
||||
switch(alert(src, "Do you want to open \the [tobeopened] for [target]?","Doorknob_v2a.exe","Yes","No"))
|
||||
if("Yes")
|
||||
var/nhref = "src=\ref[tobeopened];aiEnable=7"
|
||||
tobeopened.Topic(nhref, params2list(nhref), tobeopened, 1)
|
||||
src << "\blue You've opened \the [tobeopened] for [target]."
|
||||
if("No")
|
||||
src << "\red You deny the request."
|
||||
else
|
||||
src << "\red You've failed to open an airlock for [target]"
|
||||
return
|
||||
@@ -54,6 +54,14 @@
|
||||
//Holopad
|
||||
if(ai.holo)
|
||||
ai.holo.move_hologram()
|
||||
|
||||
|
||||
/mob/aiEye/proc/getLoc()
|
||||
|
||||
if(ai)
|
||||
if(!isturf(ai.loc) || !ai.client)
|
||||
return
|
||||
return ai.eyeobj.loc
|
||||
|
||||
|
||||
/mob/aiEye/Move()
|
||||
|
||||
@@ -12,12 +12,19 @@
|
||||
|
||||
/obj/machinery/camera/New()
|
||||
..()
|
||||
cameranet.viewpoints += src //Camera must be added to global list of all cameras no matter what...
|
||||
//Camera must be added to global list of all cameras no matter what...
|
||||
if(cameranet.cameras_unsorted || !ticker)
|
||||
cameranet.viewpoints += src
|
||||
cameranet.cameras_unsorted = 1
|
||||
else
|
||||
dd_insertObjectList(cameranet.viewpoints, src)
|
||||
|
||||
var/list/open_networks = difflist(network,RESTRICTED_CAMERA_NETWORKS) //...but if all of camera's networks are restricted, it only works for specific camera consoles.
|
||||
if(open_networks.len) //If there is at least one open network, chunk is available for AI usage.
|
||||
cameranet.addViewpoint(src)
|
||||
|
||||
/obj/machinery/camera/Del()
|
||||
|
||||
cameranet.viewpoints -= src
|
||||
var/list/open_networks = difflist(network,RESTRICTED_CAMERA_NETWORKS)
|
||||
if(open_networks.len)
|
||||
|
||||
@@ -161,6 +161,14 @@ proc/hasorgans(A)
|
||||
|
||||
/proc/hsl2rgb(h, s, l)
|
||||
return
|
||||
|
||||
proc/hassensorlevel(A, var/level)
|
||||
var/mob/living/carbon/human/H = A
|
||||
if(istype(H) && istype(H.w_uniform, /obj/item/clothing/under))
|
||||
var/obj/item/clothing/under/U = H.w_uniform
|
||||
return U.sensor_mode >= level
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
/proc/check_zone(zone)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
json_writer
|
||||
proc
|
||||
WriteObject(list/L)
|
||||
WriteObject(list/L, cached_data = null)
|
||||
. = "{"
|
||||
var/i = 1
|
||||
for(var/k in L)
|
||||
@@ -9,6 +9,8 @@ json_writer
|
||||
. += {"\"[k]\":[write(val)]"}
|
||||
if(i++ < L.len)
|
||||
. += ","
|
||||
if(cached_data)
|
||||
. = copytext(., 1, lentext(.)) + ",\"cached\":[cached_data]}"
|
||||
.+= "}"
|
||||
|
||||
write(val)
|
||||
|
||||
@@ -7,6 +7,6 @@ proc
|
||||
var/static/json_reader/_jsonr = new()
|
||||
return _jsonr.ReadObject(_jsonr.ScanJson(json))
|
||||
|
||||
list2json(list/L)
|
||||
list2json(list/L, var/cached_data = null)
|
||||
var/static/json_writer/_jsonw = new()
|
||||
return _jsonw.WriteObject(L)
|
||||
return _jsonw.WriteObject(L, cached_data)
|
||||
|
||||
@@ -58,6 +58,9 @@ nanoui is used to open and update nano browser uis
|
||||
var/is_auto_updating = 0
|
||||
// the current status/visibility of the ui
|
||||
var/status = STATUS_INTERACTIVE
|
||||
|
||||
var/cached_data = null
|
||||
|
||||
|
||||
// Only allow users with a certain user.stat to get updates. Defaults to 0 (concious)
|
||||
var/allowed_user_stat = 0 // -1 = ignore, 0 = alive, 1 = unconcious or alive, 2 = dead concious or alive
|
||||
@@ -370,7 +373,7 @@ nanoui is used to open and update nano browser uis
|
||||
template_data_json = list2json(templates)
|
||||
|
||||
var/list/send_data = get_send_data(initial_data)
|
||||
var/initial_data_json = list2json(send_data)
|
||||
var/initial_data_json = list2json(send_data, cached_data)
|
||||
|
||||
var/url_parameters_json = list2json(list("src" = "\ref[src]"))
|
||||
|
||||
@@ -450,6 +453,17 @@ nanoui is used to open and update nano browser uis
|
||||
var/params = "\ref[src]"
|
||||
|
||||
winset(user, window_id, "on-close=\"nanoclose [params]\"")
|
||||
|
||||
/**
|
||||
* Appends already processed json txt to the list2json proc when setting initial-data and data pushes
|
||||
* Used for data that is fucking huge like manifests and camera lists that doesn't change often.
|
||||
* And we only want to process them when they change.
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
/datum/nanoui/proc/load_cached_data(var/data)
|
||||
cached_data = data
|
||||
return
|
||||
|
||||
/**
|
||||
* Push data to an already open UI window
|
||||
@@ -464,7 +478,7 @@ nanoui is used to open and update nano browser uis
|
||||
var/list/send_data = get_send_data(data)
|
||||
|
||||
//user << list2json(data) // used for debugging
|
||||
user << output(list2params(list(list2json(send_data))),"[window_id].browser:receiveUpdateData")
|
||||
user << output(list2params(list(list2json(send_data,cached_data))),"[window_id].browser:receiveUpdateData")
|
||||
|
||||
/**
|
||||
* This Topic() proc is called whenever a user clicks on a link within a Nano UI
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
P.internal_organs = list()
|
||||
P.internal_organs += src
|
||||
H.internal_organs_by_name[name] = src
|
||||
H.internal_organs |= src
|
||||
owner = H
|
||||
return
|
||||
|
||||
@@ -196,7 +197,7 @@
|
||||
src.damage += 0.2 * process_accuracy
|
||||
//Damaged one shares the fun
|
||||
else
|
||||
var/datum/organ/internal/O = pick(owner.internal_organs_by_name)
|
||||
var/datum/organ/internal/O = pick(owner.internal_organs)
|
||||
if(O)
|
||||
O.damage += 0.2 * process_accuracy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user