Files
Polaris/code/modules/holodeck/HolodeckControl.dm
Anewbe 0c0246e3fa Still more simple_mob conversions (#5523)
* Fixes 6 pAI faces

PAIs are no longer coded to only recognize 9 emotions. This enables the use of the neutral, silly, nose, smirk, exclamation points, and question mark faces as a pAI. Before, those buttons did nothing.

* Fixes the PDA Halogen Scanner's tendency to be number one.

* Unfolded pAIs can be picked up

Because who doesn't want a robotic cat on their head? Adds in the missing code to allow pAIs to actually be picked up, and held sprites for the newer 4 chassis options.

* Adds the Gigaphone, a suped-up Megaphone.

* Constant Chip has a sprite

* Fireaxe cabinets find their fireaxes in initialize(), rather than new()

* Speeds up alcohol

* fixed mining cloak not being in loadouts

* Admin Supermatter Setup now closes the monitoring room shutters (#5442)

* Admin Supermatter Setup now closes the monitoring room shutters

* Fixes a copy-paste error

* Begins work on lightning.

* Fixes #5447 (Deadspy submap not overwriting mapgen) (#5448)

* Map fix

* fixed deadspy.dmm

* Added Squid plushies of varying colours

I added a few Squid plushies in different colours, changing the files code/game/objects/items/toys.dm
and obj/toy.dmi

* Added hat functionality to Squid plushies

I added the ability to wear my Squid plushies as hats. They're damn good hats.

* Replaces Skrell namegen (#5453)

Created a first name list for Skrell, to replace the syllable assembler.

Created a surname list for Skrell to replace the syllable assembler.

Replaced the Skrell namegen with pre-written namelists, instead of the old syllable assembler.

* Mechoid makes mistakes. Fix telepathic gigaphones.

* Lets people be colorblind

Adds four types of colorblindness to the traits in the setup menu - protanopia, deuteranopia, tritanopia, and monochromacy. Previously, there were ones defined in the code, but not actually usable to players.

* Whoops, worded that wrong

* Adds beams to the Type var list for View Variables.

* Unfuck my Master

* Adds beams to the Type var selection in View Variables.

* Finishes thunderstorms.

* Adds logging.

* APC Sprite Change

- Port from Virgo recolored slightly to match closer to the old sprite
- Addition of directional sprites for the APCs

* Refactors supply controller.
Supply consoles now run nanoUI

* Missing '

* [Excitedly updates changelog]

* btw i use arc

* Removes supermatters from cave PoIs.

* Holomap Port

- Port of Holomaps from Virgo

* Changing species (via ling or admin button) should no longer ruin your HUD

* Converts most istype(thing,tool) procs into an appropriate thing.is_tool() format

* Removes empty file, gives the QM a control console again (Was replaced with an ordering console)

* Hopefully fixes some tool-conversion things

* Makes the Northern Star still compile

* Keeps NS up to date

* Taj and Unathi should have explorer mask sprites now

* Corgi rune now summons the corgi in a flash of harmless lightning

* Forces mech construction to work with the is_tool() procs

* Various things and floors no longer associate with dirt

* MultiZ falling tweaks

* Fixes the clusterbang grenade

* Added new hairstyles

* Added new hairstyles

* Fixes spelling of Strike in Lightning Strike admin verb

* I don't know how we keep breaking falling

* Hallucinations now use the old system again, but with the more modern components.

* Ambience Refactor (#5476)

* Refactors how ambience is assigned, removes bad ambience, ports good ambience from tg

* Apparently that file is still used, not worth the salt to remove it.

* Changelog

* The speed-related chem effects are no longer a one-or-none affair, oxy causes slowdown

* Corrects noted issues

* Add some missing sprites for xenoarch excavation.

* Become thwarted, thot.

* Fixes the Ultra AC2's burstfire bug.

* The Major Bill's shuttle is actually contagious now.

* penguins are from earth

capitalize this, anewbe, i dare you

* Mechoid's a butt

* Adds new job/department specific teshari clothing to the loadout (#5481)

* adding the new department specific teshari outfits

* Slightly cleans up hooded suit code (#5471)

* FBPs can have brute damage repaired externally again

* Windoors fix

* Cleans up some largecrate code

* Weather refactor.

* NanoUI makes me sad.

* Drinking more booze gets you drunk faster

* Ports the supermatter grenade, supporting code

* May or may not make movement seem smoother

* Fixes the Sleepy Ring

* Partially ports the GLOB system

* Fixes the bug(s) that allow meat bodies to have metal brains

* ports VOREStation/VOREStation#4165 - i forgot to check if advanced who was a thing here

* Optimizes supply UI

* Transfer shuttle grammar fixes

* Fixes borked E and W fish sprites

* Fixes incorrect ETA in crew transfer announcement

* Mech Mini 'Revamp'. Will need playtesting. (#5480)

* Exosuits are now capable of holding more equipment, of specific types.

* Tweaks regarding feedback in staffside thread, other concerns.

* Tweak to be more consistent. Why did the Odysseus have two universals. Tweak to weapon restriction on Med - > Odyss

* Weapons only fit in universal combat slots.

* Adds smart magazine, magazine functionality

* Adds a new subset of grenades that shoot projectiles

* Low alpha now makes HUDs and tooltips not show up on you

* Fixes a UI bug with emptying currently-open bags into smartfridges...hopefully. (#5515)

* Update smartfridge.dm

* actually indicates which line solves the bug

* Adds a whole bunch of Exosuit weapons and other miscellaneous parts.

* Minifrags now use the small fragments mainly as they should.

* Iced beer no longer freezes you to 3 degrees C, which is enough to seriously burn a Skrell. Seriously, that's weird.

* Touch stuff in reference to responses.

* NanoUI now processes again

* Converts more simple_animal mobs to simple_mob

* Submap correction
2018-08-28 11:25:33 -07:00

381 lines
12 KiB
Plaintext

/obj/machinery/computer/HolodeckControl
name = "holodeck control console"
desc = "A computer used to control a nearby holodeck."
icon_keyboard = "tech_key"
icon_screen = "holocontrol"
use_power = 1
active_power_usage = 8000 //8kW for the scenery + 500W per holoitem
var/item_power_usage = 500
var/area/linkedholodeck = null
var/area/target = null
var/active = 0
var/list/holographic_objs = list()
var/list/holographic_mobs = list()
var/damaged = 0
var/safety_disabled = 0
var/mob/last_to_emag = null
var/last_change = 0
var/last_gravity_change = 0
var/area/projection_area = /area/holodeck/alphadeck
var/current_program
var/powerdown_program = "Turn Off"
var/default_program = "Empty Court"
var/list/supported_programs = list(
"Empty Court" = new/datum/holodeck_program(/area/holodeck/source_emptycourt, list('sound/music/THUNDERDOME.ogg')),
"Boxing Ring" = new/datum/holodeck_program(/area/holodeck/source_boxingcourt, list('sound/music/THUNDERDOME.ogg')),
"Basketball" = new/datum/holodeck_program(/area/holodeck/source_basketball, list('sound/music/THUNDERDOME.ogg')),
"Thunderdome" = new/datum/holodeck_program(/area/holodeck/source_thunderdomecourt, list('sound/music/THUNDERDOME.ogg')),
"Beach" = new/datum/holodeck_program(/area/holodeck/source_beach),
"Desert" = new/datum/holodeck_program(/area/holodeck/source_desert,
list(
'sound/effects/wind/wind_2_1.ogg',
'sound/effects/wind/wind_2_2.ogg',
'sound/effects/wind/wind_3_1.ogg',
'sound/effects/wind/wind_4_1.ogg',
'sound/effects/wind/wind_4_2.ogg',
'sound/effects/wind/wind_5_1.ogg'
)
),
"Snowfield" = new/datum/holodeck_program(/area/holodeck/source_snowfield,
list(
'sound/effects/wind/wind_2_1.ogg',
'sound/effects/wind/wind_2_2.ogg',
'sound/effects/wind/wind_3_1.ogg',
'sound/effects/wind/wind_4_1.ogg',
'sound/effects/wind/wind_4_2.ogg',
'sound/effects/wind/wind_5_1.ogg'
)
),
"Space" = new/datum/holodeck_program(/area/holodeck/source_space,
list(
'sound/ambience/ambispace.ogg',
'sound/music/main.ogg',
'sound/music/space.ogg',
'sound/music/traitor.ogg',
)
),
"Picnic Area" = new/datum/holodeck_program(/area/holodeck/source_picnicarea, list('sound/music/title2.ogg')),
"Theatre" = new/datum/holodeck_program(/area/holodeck/source_theatre),
"Meetinghall" = new/datum/holodeck_program(/area/holodeck/source_meetinghall),
"Courtroom" = new/datum/holodeck_program(/area/holodeck/source_courtroom, list('sound/music/traitor.ogg')),
"Turn Off" = new/datum/holodeck_program(/area/holodeck/source_plating, list())
)
var/list/restricted_programs = list(
"Burnoff Test Simulation" = new/datum/holodeck_program(/area/holodeck/source_burntest, list()),
"Wildlife Simulation" = new/datum/holodeck_program(/area/holodeck/source_wildlife, list())
)
/obj/machinery/computer/HolodeckControl/attack_ai(var/mob/user as mob)
return src.attack_hand(user)
/obj/machinery/computer/HolodeckControl/attack_hand(var/mob/user as mob)
if(..())
return
user.set_machine(src)
ui_interact(user)
/**
* Display the NanoUI window for the Holodeck Computer.
*
* See NanoUI documentation for details.
*/
/obj/machinery/computer/HolodeckControl/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
user.set_machine(src)
var/list/data = list()
var/program_list[0]
var/restricted_program_list[0]
for(var/P in supported_programs)
program_list[++program_list.len] = P
for(var/P in restricted_programs)
restricted_program_list[++restricted_program_list.len] = P
data["supportedPrograms"] = program_list
data["restrictedPrograms"] = restricted_program_list
data["currentProgram"] = current_program
if(issilicon(user))
data["isSilicon"] = 1
else
data["isSilicon"] = null
data["safetyDisabled"] = safety_disabled
data["emagged"] = emagged
if(linkedholodeck.has_gravity)
data["gravity"] = 1
else
data["gravity"] = null
ui = GLOB.nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "holodeck.tmpl", src.name, 400, 550)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(20)
/obj/machinery/computer/HolodeckControl/Topic(href, href_list)
if(..())
return 1
if((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
usr.set_machine(src)
if(href_list["program"])
var/prog = href_list["program"]
if(prog in (supported_programs + restricted_programs))
if(loadProgram(prog))
current_program = prog
else if(href_list["AIoverride"])
if(!issilicon(usr))
return
if(safety_disabled && emagged)
return //if a traitor has gone through the trouble to emag the thing, let them keep it.
safety_disabled = !safety_disabled
update_projections()
if(safety_disabled)
message_admins("[key_name_admin(usr)] overrode the holodeck's safeties")
log_game("[key_name(usr)] overrided the holodeck's safeties")
else
message_admins("[key_name_admin(usr)] restored the holodeck's safeties")
log_game("[key_name(usr)] restored the holodeck's safeties")
else if(href_list["gravity"])
toggleGravity(linkedholodeck)
src.add_fingerprint(usr)
GLOB.nanomanager.update_uis(src)
/obj/machinery/computer/HolodeckControl/emag_act(var/remaining_charges, var/mob/user as mob)
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
last_to_emag = user //emag again to change the owner
if (!emagged)
emagged = 1
safety_disabled = 1
update_projections()
user << "<span class='notice'>You vastly increase projector power and override the safety and security protocols.</span>"
user << "Warning. Automatic shutoff and derezing protocols have been corrupted. Please call [using_map.company_name] maintenance and do not use the simulator."
log_game("[key_name(usr)] emagged the Holodeck Control Computer")
return 1
return
/obj/machinery/computer/HolodeckControl/proc/update_projections()
if (safety_disabled)
item_power_usage = 2500
for(var/obj/item/weapon/holo/esword/H in linkedholodeck)
H.damtype = BRUTE
else
item_power_usage = initial(item_power_usage)
for(var/obj/item/weapon/holo/esword/H in linkedholodeck)
H.damtype = initial(H.damtype)
for(var/mob/living/simple_mob/animal/space/carp/holodeck/C in holographic_mobs)
C.set_safety(!safety_disabled)
if (last_to_emag)
C.friends = list(last_to_emag)
/obj/machinery/computer/HolodeckControl/New()
..()
current_program = powerdown_program
linkedholodeck = locate(projection_area)
if(!linkedholodeck)
world << "<span class='danger'>Holodeck computer at [x],[y],[z] failed to locate projection area.</span>"
//This could all be done better, but it works for now.
/obj/machinery/computer/HolodeckControl/Destroy()
emergencyShutdown()
..()
/obj/machinery/computer/HolodeckControl/ex_act(severity)
emergencyShutdown()
..()
/obj/machinery/computer/HolodeckControl/power_change()
var/oldstat
..()
if (stat != oldstat && active && (stat & NOPOWER))
emergencyShutdown()
/obj/machinery/computer/HolodeckControl/process()
for(var/item in holographic_objs) // do this first, to make sure people don't take items out when power is down.
if(!(get_turf(item) in linkedholodeck))
derez(item, 0)
if (!safety_disabled)
for(var/mob/living/simple_mob/animal/space/carp/holodeck/C in holographic_mobs)
if (get_area(C.loc) != linkedholodeck)
holographic_mobs -= C
C.derez()
if(!..())
return
if(active)
use_power(item_power_usage * (holographic_objs.len + holographic_mobs.len))
if(!checkInteg(linkedholodeck))
damaged = 1
loadProgram(powerdown_program, 0)
active = 0
use_power = 1
for(var/mob/M in range(10,src))
M.show_message("The holodeck overloads!")
for(var/turf/T in linkedholodeck)
if(prob(30))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(2, 1, T)
s.start()
T.ex_act(3)
T.hotspot_expose(1000,500,1)
/obj/machinery/computer/HolodeckControl/proc/derez(var/obj/obj , var/silent = 1)
holographic_objs.Remove(obj)
if(obj == null)
return
if(isobj(obj))
var/mob/M = obj.loc
if(ismob(M))
M.remove_from_mob(obj)
if(!silent)
var/obj/oldobj = obj
visible_message("The [oldobj.name] fades away!")
qdel(obj)
/obj/machinery/computer/HolodeckControl/proc/checkInteg(var/area/A)
for(var/turf/T in A)
if(istype(T, /turf/space))
return 0
return 1
//Why is it called toggle if it doesn't toggle?
/obj/machinery/computer/HolodeckControl/proc/togglePower(var/toggleOn = 0)
if(toggleOn)
loadProgram(default_program, 0)
else
loadProgram(powerdown_program, 0)
if(!linkedholodeck.has_gravity)
linkedholodeck.gravitychange(1,linkedholodeck)
active = 0
use_power = 1
/obj/machinery/computer/HolodeckControl/proc/loadProgram(var/prog, var/check_delay = 1)
if(!prog)
return
var/datum/holodeck_program/HP
if(prog in supported_programs)
HP = supported_programs[prog]
else if(prog in restricted_programs)
HP = restricted_programs[prog]
if(!HP)
return
var/area/A = locate(HP.target)
if(!A)
return
if(check_delay)
if(world.time < (last_change + 25))
if(world.time < (last_change + 15))//To prevent super-spam clicking, reduced process size and annoyance -Sieve
return 0
for(var/mob/M in range(3,src))
M.show_message("<b>ERROR. Recalibrating projection apparatus.</b>")
last_change = world.time
return 0
last_change = world.time
active = 1
use_power = 2
for(var/item in holographic_objs)
derez(item)
for(var/mob/living/simple_mob/animal/space/carp/holodeck/C in holographic_mobs)
holographic_mobs -= C
C.derez()
for(var/obj/effect/decal/cleanable/blood/B in linkedholodeck)
qdel(B)
holographic_objs = A.copy_contents_to(linkedholodeck , 1)
for(var/obj/holo_obj in holographic_objs)
holo_obj.alpha *= 0.8 //give holodeck objs a slight transparency
if(HP.ambience)
linkedholodeck.forced_ambience = HP.ambience
else
linkedholodeck.forced_ambience = list()
for(var/mob/living/M in mobs_in_area(linkedholodeck))
if(M.mind)
linkedholodeck.play_ambience(M)
linkedholodeck.sound_env = A.sound_env
spawn(30)
for(var/obj/effect/landmark/L in linkedholodeck)
if(L.name=="Atmospheric Test Start")
spawn(20)
var/turf/T = get_turf(L)
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(2, 1, T)
s.start()
if(T)
T.temperature = 5000
T.hotspot_expose(50000,50000,1)
if(L.name=="Holocarp Spawn")
holographic_mobs += new /mob/living/simple_mob/animal/space/carp/holodeck(L.loc)
if(L.name=="Holocarp Spawn Random")
if (prob(4)) //With 4 spawn points, carp should only appear 15% of the time.
holographic_mobs += new /mob/living/simple_mob/animal/space/carp/holodeck(L.loc)
update_projections()
return 1
/obj/machinery/computer/HolodeckControl/proc/toggleGravity(var/area/A)
if(world.time < (last_gravity_change + 25))
if(world.time < (last_gravity_change + 15))//To prevent super-spam clicking
return
for(var/mob/M in range(3,src))
M.show_message("<b>ERROR. Recalibrating gravity field.</b>")
last_change = world.time
return
last_gravity_change = world.time
active = 1
use_power = 1
if(A.has_gravity)
A.gravitychange(0,A)
else
A.gravitychange(1,A)
/obj/machinery/computer/HolodeckControl/proc/emergencyShutdown()
//Turn it back to the regular non-holographic room
loadProgram(powerdown_program, 0)
if(!linkedholodeck.has_gravity)
linkedholodeck.gravitychange(1,linkedholodeck)
active = 0
use_power = 1