Merge branch 'release' of https://github.com/VOREStation/VOREStation into izac-voreupdate

All conflicts resolved

Signed-off-by: izac112 <izac10@live.com>
This commit is contained in:
izac112
2020-05-06 21:51:07 +02:00
1099 changed files with 63850 additions and 118586 deletions

View File

@@ -5,7 +5,8 @@
use_power = USE_POWER_ACTIVE
active_power_usage = 20000 //20kW, apropriate for machine that keeps massive cross-Zlevel wireless network operational.
idle_power_usage = 100
icon_state = "bus"
icon = 'icons/obj/stationobjs_vr.dmi' //VOREStation Add
icon_state = "ntnet" //VOREStation Edit
anchored = 1
density = 1
circuit = /obj/item/weapon/circuitboard/ntnet_relay
@@ -31,10 +32,12 @@
return 1
/obj/machinery/ntnet_relay/update_icon()
//VOREStation Edit
if(operable())
icon_state = "bus"
icon_state = initial(icon_state)
else
icon_state = "bus_off"
icon_state = "[initial(icon_state)]_off"
//VOREStation Edit End
/obj/machinery/ntnet_relay/process()
if(operable())

View File

@@ -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

View File

@@ -1,9 +1,9 @@
/obj/item/modular_computer/examine(var/mob/user)
. = ..()
if(damage > broken_damage)
to_chat(user, "<span class='danger'>It is heavily damaged!</span>")
. += "<span class='danger'>It is heavily damaged!</span>"
else if(damage)
to_chat(user, "It is damaged.")
. += "It is damaged."
/obj/item/modular_computer/proc/break_apart()
visible_message("\The [src] breaks apart!")

View File

@@ -38,7 +38,7 @@
power_usage += tesla_link.passive_charging_rate
battery_module.battery.give(tesla_link.passive_charging_rate * CELLRATE)
A.use_power(power_usage, EQUIP)
A.use_power_oneoff(power_usage, EQUIP)
return TRUE
// Handles power-related things, such as battery interaction, recharging, shutdown when it's discharged

View File

@@ -15,6 +15,7 @@
hard_drive.store_file(new/datum/computer_file/program/atmos_control())
hard_drive.store_file(new/datum/computer_file/program/rcon_console())
hard_drive.store_file(new/datum/computer_file/program/camera_monitor())
hard_drive.store_file(new/datum/computer_file/program/shutoff_monitor())
// Medical
/obj/item/modular_computer/console/preset/medical/install_default_programs()

View File

@@ -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)

View File

@@ -0,0 +1,63 @@
/datum/computer_file/program/shutoff_monitor
filename = "shutoffmonitor"
filedesc = "Shutoff Valve Monitoring"
nanomodule_path = /datum/nano_module/shutoff_monitor
program_icon_state = "atmos_control"
program_key_state = "atmos_key"
program_menu_icon = "wrench"
extended_desc = "This program allows for remote monitoring and control of emergency shutoff valves."
required_access = access_engine
requires_ntnet = 1
network_destination = "shutoff valve control computer"
size = 5
var/has_alert = 0
/datum/nano_module/shutoff_monitor
name = "Shutoff Valve Monitoring"
/datum/nano_module/shutoff_monitor/Topic(ref, href_list)
if(..())
return 1
if(href_list["toggle_enable"])
var/obj/machinery/atmospherics/valve/shutoff/S = locate(href_list["toggle_enable"])
if(!istype(S))
return 0
S.close_on_leaks = !S.close_on_leaks
return 1
if(href_list["toggle_open"])
var/obj/machinery/atmospherics/valve/shutoff/S = locate(href_list["toggle_open"])
if(!istype(S))
return 0
if(S.open)
S.close()
else
S.open()
return 1
/datum/nano_module/shutoff_monitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
var/list/data = host.initial_data()
var/list/valves = list()
for(var/obj/machinery/atmospherics/valve/shutoff/S in GLOB.shutoff_valves)
valves.Add(list(list(
"name" = S.name,
"enabled" = S.close_on_leaks,
"open" = S.open,
"x" = S.x,
"y" = S.y,
"z" = S.z,
"ref" = "\ref[S]"
)))
data["valves"] = valves
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "shutoff_monitor.tmpl", "Shutoff Valve Monitoring", 627, 700, state = state)
if(host.update_layout()) // This is necessary to ensure the status bar remains updated along with rest of the UI.
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)

View File

@@ -77,6 +77,7 @@
data["SM_power"] = active.power
data["SM_ambienttemp"] = air.temperature
data["SM_ambientpressure"] = air.return_pressure()
data["SM_EPR"] = active.get_epr()
//data["SM_EPR"] = active.get_epr()
if(air.total_moles)
data["SM_gas_O2"] = round(100*air.gas["oxygen"]/air.total_moles,0.01)

View File

@@ -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)

View File

@@ -46,7 +46,7 @@
to_chat(user, "<span class='warning'>The crew monitor doesn't seem like it'll work here.</span>")
if(program)
program.kill_program()
else if(ui)
if(ui)
ui.close()
return

View File

@@ -4,7 +4,7 @@
nanomodule_path = /datum/nano_module/program/ship/nav
program_icon_state = "helm"
program_key_state = "generic_key"
program_menu_icon = "search"
program_menu_icon = "pin-s"
extended_desc = "Displays a ship's location in the sector."
required_access = null
requires_ntnet = 1

View File

@@ -75,11 +75,11 @@
/obj/item/weapon/computer_hardware/examine(var/mob/user)
. = ..()
if(damage > damage_failure)
to_chat(user, "<span class='danger'>It seems to be severely damaged!</span>")
. += "<span class='danger'>It seems to be severely damaged!</span>"
else if(damage > damage_malfunction)
to_chat(user, "<span class='notice'>It seems to be damaged!</span>")
. += "<span class='notice'>It seems to be damaged!</span>"
else if(damage)
to_chat(user, "It seems to be slightly damaged.")
. += "It seems to be slightly damaged."
// Damages the component. Contains necessary checks. Negative damage "heals" the component.
/obj/item/weapon/computer_hardware/take_damage(var/amount)

View File

@@ -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!