mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Add UAV, UAV software
Design placed in mechfab
This commit is contained in:
@@ -418,7 +418,7 @@
|
||||
BITSET(hud_updateflag, WANTED_HUD)
|
||||
if(istype(usr,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/U = usr
|
||||
U.handle_regular_hud_updates()
|
||||
U.handle_hud_list()
|
||||
if(istype(usr,/mob/living/silicon/robot))
|
||||
var/mob/living/silicon/robot/U = usr
|
||||
U.handle_regular_hud_updates()
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
|
||||
..()
|
||||
|
||||
if(life_tick%30==15)
|
||||
hud_updateflag = 1022
|
||||
if(life_tick % 30)
|
||||
hud_updateflag = (1 << TOTAL_HUDS) - 1
|
||||
|
||||
voice = GetVoice()
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
else if(stat == DEAD && !stasis)
|
||||
handle_defib_timer()
|
||||
|
||||
if(!handle_some_updates())
|
||||
if(skip_some_updates())
|
||||
return //We go ahead and process them 5 times for HUD images and other stuff though.
|
||||
|
||||
//Update our name based on whether our face is obscured/disfigured
|
||||
@@ -99,10 +99,10 @@
|
||||
|
||||
pulse = handle_pulse()
|
||||
|
||||
/mob/living/carbon/human/proc/handle_some_updates()
|
||||
/mob/living/carbon/human/proc/skip_some_updates()
|
||||
if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle
|
||||
return 0
|
||||
return 1
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/mob/living/carbon/human/breathe()
|
||||
if(!inStasisNow())
|
||||
@@ -951,7 +951,7 @@
|
||||
|
||||
//DO NOT CALL handle_statuses() from this proc, it's called from living/Life() as long as this returns a true value.
|
||||
/mob/living/carbon/human/handle_regular_status_updates()
|
||||
if(!handle_some_updates())
|
||||
if(skip_some_updates())
|
||||
return 0
|
||||
|
||||
if(status_flags & GODMODE) return 0
|
||||
@@ -1292,8 +1292,11 @@
|
||||
else
|
||||
bodytemp.icon_state = "temp0"
|
||||
|
||||
if(blinded) overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
|
||||
else clear_fullscreens()
|
||||
if(blinded)
|
||||
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
|
||||
|
||||
else if(!machine)
|
||||
clear_fullscreens()
|
||||
|
||||
if(disabilities & NEARSIGHTED) //this looks meh but saves a lot of memory by not requiring to add var/prescription
|
||||
if(glasses) //to every /obj/item
|
||||
@@ -1395,11 +1398,12 @@
|
||||
|
||||
if(machine)
|
||||
var/viewflags = machine.check_eye(src)
|
||||
machine.apply_visual(src)
|
||||
if(viewflags < 0)
|
||||
reset_view(null, 0)
|
||||
else if(viewflags && !looking_elsewhere)
|
||||
sight |= viewflags
|
||||
else
|
||||
machine.apply_visual(src)
|
||||
else if(eyeobj)
|
||||
if(eyeobj.owner != src)
|
||||
|
||||
|
||||
@@ -173,13 +173,11 @@
|
||||
if(ear_damage < 100)
|
||||
adjustEarDamage(-0.05,-1)
|
||||
|
||||
//this handles hud updates. Calls update_vision() and handle_hud_icons()
|
||||
/mob/living/handle_regular_hud_updates()
|
||||
if(!client)
|
||||
return 0
|
||||
..()
|
||||
|
||||
handle_vision()
|
||||
handle_darksight()
|
||||
handle_hud_icons()
|
||||
|
||||
|
||||
@@ -110,8 +110,8 @@
|
||||
|
||||
|
||||
/client/Move(n, direct)
|
||||
if(!mob)
|
||||
return // Moved here to avoid nullrefs below
|
||||
//if(!mob) // Clients cannot have a null mob, as enforced by byond
|
||||
// return // Moved here to avoid nullrefs below
|
||||
|
||||
if(mob.control_object) Move_object(direct)
|
||||
|
||||
@@ -166,8 +166,11 @@
|
||||
if(!mob.canmove)
|
||||
return
|
||||
|
||||
//if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV))
|
||||
// if(!mob.Process_Spacemove(0)) return 0
|
||||
//Relaymove could handle it
|
||||
if(mob.machine)
|
||||
var/result = mob.machine.relaymove(mob, direct)
|
||||
if(result)
|
||||
return result
|
||||
|
||||
if(!mob.lastarea)
|
||||
mob.lastarea = get_area(mob.loc)
|
||||
@@ -218,10 +221,6 @@
|
||||
return
|
||||
return mob.buckled.relaymove(mob,direct)
|
||||
|
||||
if(istype(mob.machine, /obj/machinery))
|
||||
if(mob.machine.relaymove(mob,direct))
|
||||
return
|
||||
|
||||
if(mob.pulledby || mob.buckled) // Wheelchair driving!
|
||||
if(istype(mob.loc, /turf/space))
|
||||
return // No wheelchair driving in space
|
||||
|
||||
@@ -255,6 +255,18 @@
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/modular_computer/apply_visual(var/mob/user)
|
||||
if(active_program)
|
||||
return active_program.apply_visual(user)
|
||||
|
||||
/obj/item/modular_computer/remove_visual(var/mob/user)
|
||||
if(active_program)
|
||||
return active_program.remove_visual(user)
|
||||
|
||||
/obj/item/modular_computer/relaymove(var/mob/user, direction)
|
||||
if(active_program)
|
||||
return active_program.relaymove(user, direction)
|
||||
|
||||
/obj/item/modular_computer/proc/set_autorun(program)
|
||||
if(!hard_drive)
|
||||
return
|
||||
|
||||
@@ -203,8 +203,12 @@
|
||||
|
||||
/datum/computer_file/program/apply_visual(mob/M)
|
||||
if(NM)
|
||||
NM.apply_visual(M)
|
||||
return NM.apply_visual(M)
|
||||
|
||||
/datum/computer_file/program/remove_visual(mob/M)
|
||||
if(NM)
|
||||
NM.remove_visual(M)
|
||||
return NM.remove_visual(M)
|
||||
|
||||
/datum/computer_file/program/proc/relaymove(var/mob/M, direction)
|
||||
if(NM)
|
||||
return NM.relaymove(M, direction)
|
||||
@@ -0,0 +1,266 @@
|
||||
/obj/item/modular_computer
|
||||
var/list/paired_uavs //Weakrefs, don't worry about it!
|
||||
|
||||
/datum/computer_file/program/uav
|
||||
filename = "rigger"
|
||||
filedesc = "UAV Control"
|
||||
nanomodule_path = /datum/nano_module/uav
|
||||
program_icon_state = "comm_monitor"
|
||||
program_key_state = "generic_key"
|
||||
program_menu_icon = "link"
|
||||
extended_desc = "This program allows remote control of certain drones, but only when paired with this device."
|
||||
size = 12
|
||||
available_on_ntnet = 1
|
||||
//requires_ntnet = 1
|
||||
|
||||
/datum/nano_module/uav
|
||||
name = "UAV Control program"
|
||||
var/obj/item/device/uav/current_uav = null //The UAV we're watching
|
||||
var/signal_strength = 0 //Our last signal strength report (cached for a few seconds)
|
||||
var/signal_test_counter = 0 //How long until next signal strength check
|
||||
var/list/viewers //Who's viewing a UAV through us
|
||||
var/adhoc_range = 30 //How far we can operate on a UAV without NTnet
|
||||
|
||||
/datum/nano_module/uav/Destroy()
|
||||
if(LAZYLEN(viewers))
|
||||
for(var/weakref/W in viewers)
|
||||
var/M = W.resolve()
|
||||
if(M)
|
||||
unlook(M)
|
||||
. = ..()
|
||||
|
||||
/datum/nano_module/uav/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, state = default_state)
|
||||
var/list/data = host.initial_data()
|
||||
|
||||
if(current_uav)
|
||||
if(QDELETED(current_uav))
|
||||
set_current(null)
|
||||
else if(signal_test_counter-- <= 0)
|
||||
signal_strength = get_signal_to(current_uav)
|
||||
if(!signal_strength)
|
||||
set_current(null)
|
||||
else // Don't reset counter until we find a UAV that's actually in range we can stay connected to
|
||||
signal_test_counter = 20
|
||||
|
||||
data["current_uav"] = null
|
||||
if(current_uav)
|
||||
data["current_uav"] = list("status" = current_uav.get_status_string(), "power" = current_uav.state == 1 ? 1 : null)
|
||||
data["signal_strength"] = signal_strength ? signal_strength >= 2 ? "High" : "Low" : "None"
|
||||
data["in_use"] = LAZYLEN(viewers)
|
||||
|
||||
var/list/paired_map = list()
|
||||
var/obj/item/modular_computer/mc_host = nano_host()
|
||||
if(istype(mc_host))
|
||||
for(var/puav in mc_host.paired_uavs)
|
||||
var/weakref/wr = puav
|
||||
var/obj/item/device/uav/U = wr.resolve()
|
||||
paired_map[++paired_map.len] = list("name" = "[U ? U.nickname : "!!Missing!!"]", "uavref" = "\ref[U]")
|
||||
|
||||
data["paired_uavs"] = paired_map
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "mod_uav.tmpl", "UAV Control", 600, 500, state = state)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/datum/nano_module/uav/Topic(var/href, var/href_list = list(), var/datum/topic_state/state)
|
||||
if((. = ..()))
|
||||
return
|
||||
state = state || DefaultTopicState() || global.default_state
|
||||
if(CanUseTopic(usr, state, href_list) == STATUS_INTERACTIVE)
|
||||
CouldUseTopic(usr)
|
||||
return OnTopic(usr, href_list, state)
|
||||
CouldNotUseTopic(usr)
|
||||
return TRUE
|
||||
|
||||
/datum/nano_module/uav/proc/OnTopic(var/mob/user, var/list/href_list)
|
||||
if(href_list["switch_uav"])
|
||||
var/obj/item/device/uav/U = locate(href_list["switch_uav"]) //This is a \ref to the UAV itself
|
||||
if(!istype(U))
|
||||
to_chat(usr,"<span class='warning'>Something is blocking the connection to that UAV. In-person investigation is required.</span>")
|
||||
return TOPIC_NOACTION
|
||||
|
||||
if(!get_signal_to(U))
|
||||
to_chat(usr,"<span class='warning'>The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV.</span>")
|
||||
return TOPIC_NOACTION
|
||||
|
||||
set_current(U)
|
||||
return TOPIC_REFRESH
|
||||
|
||||
if(href_list["del_uav"])
|
||||
var/refstring = href_list["del_uav"] //This is a \ref to the UAV itself
|
||||
var/obj/item/modular_computer/mc_host = nano_host()
|
||||
//This is so we can really scrape up any weakrefs that can't resolve
|
||||
for(var/weakref/wr in mc_host.paired_uavs)
|
||||
if(wr.ref == refstring)
|
||||
if(current_uav?.weakref == wr)
|
||||
set_current(null)
|
||||
LAZYREMOVE(mc_host.paired_uavs, wr)
|
||||
|
||||
else if(href_list["view_uav"])
|
||||
if(!current_uav)
|
||||
return TOPIC_NOACTION
|
||||
|
||||
if(current_uav.check_eye(user) < 0)
|
||||
to_chat(usr,"<span class='warning'>The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV.</span>")
|
||||
else
|
||||
viewing_uav(user) ? unlook(user) : look(user)
|
||||
return TOPIC_NOACTION
|
||||
|
||||
else if(href_list["power_uav"])
|
||||
if(!current_uav)
|
||||
return TOPIC_NOACTION
|
||||
else if(current_uav.toggle_power())
|
||||
//Clean up viewers faster
|
||||
if(LAZYLEN(viewers))
|
||||
for(var/weakref/W in viewers)
|
||||
var/M = W.resolve()
|
||||
if(M)
|
||||
unlook(M)
|
||||
return TOPIC_REFRESH
|
||||
|
||||
/datum/nano_module/uav/proc/DefaultTopicState()
|
||||
return global.default_state
|
||||
|
||||
/datum/nano_module/uav/proc/CouldNotUseTopic(mob/user)
|
||||
. = ..()
|
||||
unlook(user)
|
||||
|
||||
/datum/nano_module/uav/proc/CouldUseTopic(mob/user)
|
||||
. = ..()
|
||||
if(viewing_uav(user))
|
||||
look(user)
|
||||
|
||||
/datum/nano_module/uav/proc/set_current(var/obj/item/device/uav/U)
|
||||
if(current_uav == U)
|
||||
return
|
||||
|
||||
signal_strength = 0
|
||||
current_uav = U
|
||||
|
||||
if(LAZYLEN(viewers))
|
||||
for(var/weakref/W in viewers)
|
||||
var/M = W.resolve()
|
||||
if(M)
|
||||
if(current_uav)
|
||||
to_chat(M, "<span class='warning'>You're disconnected from the UAV's camera!</span>")
|
||||
unlook(M)
|
||||
else
|
||||
look(M)
|
||||
|
||||
////
|
||||
//// Finding signal strength between us and the UAV
|
||||
////
|
||||
/datum/nano_module/uav/proc/get_signal_to(var/atom/movable/AM)
|
||||
// Following roughly the ntnet signal levels
|
||||
// 0 is none
|
||||
// 1 is weak
|
||||
// 2 is strong
|
||||
var/obj/item/modular_computer/host = nano_host() //Better not add this to anything other than modular computers.
|
||||
if(!istype(host))
|
||||
return
|
||||
var/our_signal = host.get_ntnet_status() //1 low, 2 good, 3 wired, 0 none
|
||||
var/their_z = get_z(AM)
|
||||
|
||||
//If we have no NTnet connection don't bother getting theirs
|
||||
if(!our_signal)
|
||||
if(get_z(host) == their_z && (get_dist(host, AM) < adhoc_range))
|
||||
return 1 //We can connect (with weak signal) in same z without ntnet, within 30 turfs
|
||||
else
|
||||
return 0
|
||||
|
||||
var/list/zlevels_in_range = using_map.get_map_levels(their_z, FALSE)
|
||||
var/list/zlevels_in_long_range = using_map.get_map_levels(their_z, TRUE) - zlevels_in_range
|
||||
var/their_signal = 0
|
||||
for(var/relay in ntnet_global.relays)
|
||||
var/obj/machinery/ntnet_relay/R = relay
|
||||
if(!R.operable())
|
||||
continue
|
||||
if(R.z == their_z)
|
||||
their_signal = 2
|
||||
break
|
||||
if(R.z in zlevels_in_range)
|
||||
their_signal = 2
|
||||
break
|
||||
if(R.z in zlevels_in_long_range)
|
||||
their_signal = 1
|
||||
break
|
||||
|
||||
if(!their_signal) //They have no NTnet at all
|
||||
if(get_z(host) == their_z && (get_dist(host, AM) < adhoc_range))
|
||||
return 1 //We can connect (with weak signal) in same z without ntnet, within 30 turfs
|
||||
else
|
||||
return 0
|
||||
else
|
||||
return max(our_signal, their_signal)
|
||||
|
||||
////
|
||||
//// UAV viewer handling
|
||||
////
|
||||
/datum/nano_module/uav/proc/viewing_uav(mob/user)
|
||||
return (weakref(user) in viewers)
|
||||
|
||||
/datum/nano_module/uav/proc/look(var/mob/user)
|
||||
if(issilicon(user)) //Too complicated for me to want to mess with at the moment
|
||||
to_chat(user, "<span class='warning'>Regulations prevent you from controlling several corporeal forms at the same time!</span>")
|
||||
return
|
||||
|
||||
if(!current_uav)
|
||||
return
|
||||
|
||||
user.set_machine(nano_host())
|
||||
user.reset_view(current_uav)
|
||||
current_uav.add_master(user)
|
||||
LAZYDISTINCTADD(viewers, weakref(user))
|
||||
|
||||
/datum/nano_module/uav/proc/unlook(var/mob/user)
|
||||
user.unset_machine()
|
||||
user.reset_view()
|
||||
if(current_uav)
|
||||
current_uav.remove_master(user)
|
||||
LAZYREMOVE(viewers, weakref(user))
|
||||
|
||||
/datum/nano_module/uav/check_eye(var/mob/user)
|
||||
if(get_dist(user, nano_host()) > 1 || user.blinded || !current_uav)
|
||||
unlook(user)
|
||||
return -1
|
||||
|
||||
var/viewflag = current_uav.check_eye(user)
|
||||
if (viewflag < 0) //camera doesn't work
|
||||
unlook(user)
|
||||
return -1
|
||||
|
||||
return viewflag
|
||||
|
||||
////
|
||||
//// Relaying movements to the UAV
|
||||
////
|
||||
/datum/nano_module/uav/relaymove(var/mob/user, direction)
|
||||
if(current_uav)
|
||||
return current_uav.relaymove(user, direction, signal_strength)
|
||||
|
||||
////
|
||||
//// The effects when looking through a UAV
|
||||
////
|
||||
/datum/nano_module/uav/apply_visual(var/mob/M)
|
||||
if(!M.client)
|
||||
return
|
||||
if(weakref(M) in viewers)
|
||||
M.overlay_fullscreen("fishbed",/obj/screen/fullscreen/fishbed)
|
||||
M.overlay_fullscreen("scanlines",/obj/screen/fullscreen/scanline)
|
||||
|
||||
if(signal_strength <= 1)
|
||||
M.overlay_fullscreen("whitenoise",/obj/screen/fullscreen/noise)
|
||||
else
|
||||
M.clear_fullscreen("whitenoise", 0)
|
||||
else
|
||||
remove_visual(M)
|
||||
|
||||
/datum/nano_module/uav/remove_visual(mob/M)
|
||||
if(!M.client)
|
||||
return
|
||||
M.clear_fullscreen("fishbed",0)
|
||||
M.clear_fullscreen("scanlines",0)
|
||||
M.clear_fullscreen("whitenoise",0)
|
||||
@@ -39,6 +39,27 @@ var/global/ntnet_card_uid = 1
|
||||
icon_state = "netcard_advanced"
|
||||
hardware_size = 1
|
||||
|
||||
/obj/item/weapon/computer_hardware/network_card/quantum
|
||||
name = "quantum NTNet network card"
|
||||
desc = "A network card that can connect to NTnet from anywhere, using quantum entanglement."
|
||||
long_range = 1
|
||||
origin_tech = list(TECH_DATA = 6, TECH_ENGINEERING = 7)
|
||||
power_usage = 200 // Infinite range but higher power usage.
|
||||
icon_state = "netcard_advanced"
|
||||
hardware_size = 1
|
||||
|
||||
/obj/item/weapon/computer_hardware/network_card/quantum/get_signal(var/specific_action = 0)
|
||||
if(!holder2)
|
||||
return 0
|
||||
|
||||
if(!enabled)
|
||||
return 0
|
||||
|
||||
if(!check_functionality() || !ntnet_global || is_banned())
|
||||
return 0
|
||||
|
||||
return 2
|
||||
|
||||
/obj/item/weapon/computer_hardware/network_card/wired
|
||||
name = "wired NTNet network card"
|
||||
desc = "An advanced network card for usage with standard NTNet frequencies. This one also supports wired connection."
|
||||
@@ -82,7 +103,8 @@ var/global/ntnet_card_uid = 1
|
||||
var/holderz = get_z(holder2)
|
||||
if(!holderz) //no reception in nullspace
|
||||
return 0
|
||||
var/list/zlevels_in_range = using_map.get_map_levels(holderz, long_range)
|
||||
var/list/zlevels_in_range = using_map.get_map_levels(holderz, FALSE)
|
||||
var/list/zlevels_in_long_range = using_map.get_map_levels(holderz, TRUE) - zlevels_in_range
|
||||
var/best = 0
|
||||
for(var/relay in ntnet_global.relays)
|
||||
var/obj/machinery/ntnet_relay/R = relay
|
||||
@@ -91,11 +113,16 @@ var/global/ntnet_card_uid = 1
|
||||
continue
|
||||
//We're on the same z
|
||||
if(R.z == holderz)
|
||||
best = 2
|
||||
best = 2 //Every network card gets high signal on the same z as the relay
|
||||
break // No point in going further
|
||||
//Not on the same z but within range anyway
|
||||
if(R.z in zlevels_in_range)
|
||||
best = 1
|
||||
best = long_range ? 2 : 1 //High-power network cards get good signal further away
|
||||
break
|
||||
//Only in long range
|
||||
if(long_range && (R.z in zlevels_in_long_range))
|
||||
best = 1 //High-power network cards can get low signal even at long range
|
||||
break
|
||||
return best
|
||||
return 0 // No computer!
|
||||
|
||||
|
||||
@@ -62,3 +62,6 @@
|
||||
|
||||
/datum/proc/update_layout()
|
||||
return FALSE
|
||||
|
||||
/datum/nano_module/proc/relaymove(var/mob/user, direction)
|
||||
return FALSE
|
||||
|
||||
@@ -1030,3 +1030,12 @@
|
||||
req_tech = list(TECH_MATERIAL = 7, TECH_ENGINEERING = 5, TECH_MAGNET = 5, TECH_POWER = 6, TECH_ILLEGAL = 3, TECH_BLUESPACE = 4, TECH_ARCANE = 2, TECH_PRECURSOR = 3)
|
||||
materials = list(MAT_DURASTEEL = 5000, MAT_GRAPHITE = 3000, MAT_MORPHIUM = 1500, MAT_OSMIUM = 1500, MAT_PHORON = 1750, MAT_VERDANTIUM = 3000, MAT_SUPERMATTER = 2000)
|
||||
build_path = /obj/item/rig_module/teleporter
|
||||
|
||||
/datum/design/item/mechfab/uav/basic
|
||||
name = "UAV - Recon Skimmer"
|
||||
id = "recon_skimmer"
|
||||
build_path = /obj/item/device/uav
|
||||
time = 20
|
||||
req_tech = list(TECH_MATERIAL = 6, TECH_ENGINEERING = 5, TECH_PHORON = 3, TECH_MAGNET = 4, TECH_POWER = 6)
|
||||
materials = list(DEFAULT_WALL_MATERIAL = 10000, "glass" = 6000, "silver" = 4000)
|
||||
|
||||
Reference in New Issue
Block a user