Files
Bubberstation/code/modules/mining/aux_base_camera.dm
Cyberboss 9e1ef0ffe2 Global variable wrappers (#25325)
* Add the system for managed global variables

* Travis ban old globals

* So you CAN inline proccall, that's neat

* Fix that

* master.dm

* Remove the hack procs

* Move InitGlobals to the proper spot

* configuration.dm

* Fix the missing pre-slash

* clockcult.dm

* This is probably for the best

* Doy

* Fix shit

* Rest of the DEFINES tree

* Fix

* Use global. for access

* Update find_references_in_globals

Always hated that proc

Whoever made it must've bee a r e a l idiot...

* __HELPERS tree

* Move global initialization to master.

Fix the declaration

* database.dm

* Dat newline

* I said DECLARATIVE order!

* Here's something you can chew on @Iamgoofball

* game_modes.dm

* Fix this

* genetics.dm

* flavor_misc.dm

* More stuff

* Do it mso's way. Keep the controllers as global

* Make master actually see it

* Fix

* Finish _globalvars/lists

* Finish the rest of the _globalvars tree

* This is weird

* Migrate the controllers

* SLOTH -> GLOB

* Lighting globals

* round_start_time -> ticker

* PAI card list -> pai SS

* record_id_num -> static

* Diseases list -> SSdisease

* More disease globals to the SS

* More disease stuff

* Emote list

* Better and better

* Bluh

* So much stuff

* Ahh

* Wires

* dview

* station_areas

* Teleportlocs

* blood_splatter_icons

* Stuff and such

* More stuff

* RAD IO

* More stuff and such

* Blob shit

* Changeling stuff

* Add "Balance" to changelogs

* Balance for changelog compiler + Auto Tagging

* Update the PR template

* hivemind_bank

* Bip

* sacrificed

* Good shit

* Better define

* More cult shit

* Devil shit

* Gang shit

* > borers

Fix shit

* Rename the define

* Nuke

* Objectives

* Sandbox

* Multiverse sword

* Announce systems

* Stuff and such

* TC con

* Airlock

* doppllllerrrrrr

* holopads

* Shut up byond you inconsistent fuck

* Sneaky fuck

* Burp

* Bip

* Fixnshit

* Port without regard

* askdlfjs;

* asdfjasoidojfi

* Protected globals and more

* SO MANY

* ajsimkvahsaoisd

* akfdsiaopwimfeoiwafaw

* gsdfigjosidjfgiosdg

* AHHHHHHHHHHHHHHHHHHHHHHH!!!!!

* facerolll

* ASDFASDFASDF

* Removes the unused parts of dmm_suite

* WIP

* Fix quote

* asdfjauwfnkjs

* afwlunhskjfda

* asfjlaiwuefhaf

* SO CLOSE

* wwwweeeeeewwwww

* agdgmoewranwg

* HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!?

* Fix syntax errors

* 100 errors

* Another 100

* So many...

* Ugh

* More shit

* kilme

* Stuuuuuufffff

* ajrgmrlshio;djfa;sdkl

* jkbhkhjbmjvjmh

* soi soi soi

* butt

* TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING

* lllllllllllllllllllllllllllllllllllllllllll

* afsdijfiawhnflnjhnwsdfs

* yugykihlugk,kj

* time to go

* STUFFF!!!

* AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!

* ngoaijdjlfkamsdlkf

* Break time

* aufjsdklfalsjfi

* CONTROL KAY AND PRAY

* IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

* Goteem

* Fix testing mode

* This does not belong in this PR

* Convert it to a controller

* Eh, fuck this option

* Revert controllerization Ill do it some other time

* Fix

* Working controllerization

* FOR THE LOVE OF CHRIST PROTECT THE LOGS

* Protect admins and deadmins

* Use the inbuilt proc
2017-04-06 23:26:13 -06:00

274 lines
9.3 KiB
Plaintext

//Aux base construction console
/mob/camera/aiEye/remote/base_construction
name = "construction holo-drone"
move_on_shuttle = 1 //Allows any curious crew to watch the base after it leaves. (This is safe as the base cannot be modified once it leaves)
icon = 'icons/obj/mining.dmi'
icon_state = "construction_drone"
var/area/starting_area
/mob/camera/aiEye/remote/base_construction/Initialize()
..()
starting_area = get_area(loc)
/mob/camera/aiEye/remote/base_construction/setLoc(var/t)
var/area/curr_area = get_area(t)
if(curr_area == starting_area || istype(curr_area, /area/shuttle/auxillary_base))
return ..()
//While players are only allowed to build in the base area, but consoles starting outside the base can move into the base area to begin work.
/mob/camera/aiEye/remote/base_construction/relaymove(mob/user, direct)
dir = direct //This camera eye is visible as a drone, and needs to keep the dir updated
..()
/obj/item/weapon/rcd/internal //Base console's internal RCD. Roundstart consoles are filled, rebuilt cosoles start empty.
name = "internal RCD"
max_matter = 600 //Bigger container and faster speeds due to being specialized and stationary.
no_ammo_message = "<span class='warning'>Internal matter exhausted. Please add additional materials.</span>"
delay_mod = 0.5
/obj/machinery/computer/camera_advanced/base_construction
name = "base contruction console"
desc = "An industrial computer integrated with a camera-assisted rapid construction drone."
networks = list("SS13")
var/obj/item/weapon/rcd/internal/RCD //Internal RCD. The computer passes user commands to this in order to avoid massive copypaste.
circuit = /obj/item/weapon/circuitboard/computer/base_construction
off_action = new/datum/action/innate/camera_off/base_construction
var/datum/action/innate/aux_base/switch_mode/switch_mode_action = new //Action for switching the RCD's build modes
var/datum/action/innate/aux_base/build/build_action = new //Action for using the RCD
var/datum/action/innate/aux_base/airlock_type/airlock_mode_action = new //Action for setting the airlock type
var/datum/action/innate/aux_base/window_type/window_action = new //Action for setting the window type
var/datum/action/innate/aux_base/place_fan/fan_action = new //Action for spawning fans
var/fans_remaining = 0 //Number of fans in stock.
var/datum/action/innate/aux_base/install_turret/turret_action = new //Action for spawning turrets
var/turret_stock = 0 //Turrets in stock
var/obj/machinery/computer/auxillary_base/found_aux_console //Tracker for the Aux base console, so the eye can always find it.
icon_screen = "mining"
icon_keyboard = "rd_key"
light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/camera_advanced/base_construction/New()
..()
RCD = new /obj/item/weapon/rcd/internal(src)
/obj/machinery/computer/camera_advanced/base_construction/Initialize(mapload)
..()
if(mapload) //Map spawned consoles have a filled RCD and stocked special structures
RCD.matter = RCD.max_matter
fans_remaining = 4
turret_stock = 4
/obj/machinery/computer/camera_advanced/base_construction/CreateEye()
var/spawn_spot
for(var/obj/machinery/computer/auxillary_base/ABC in GLOB.machines)
if(istype(get_area(ABC), /area/shuttle/auxillary_base))
found_aux_console = ABC
break
if(found_aux_console)
spawn_spot = found_aux_console
else
spawn_spot = src
eyeobj = new /mob/camera/aiEye/remote/base_construction(get_turf(spawn_spot))
eyeobj.origin = src
/obj/machinery/computer/camera_advanced/base_construction/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weapon/rcd_ammo) || istype(W, /obj/item/stack/sheet))
RCD.attackby(W, user, params) //If trying to feed the console more materials, pass it along to the RCD.
else
return ..()
/obj/machinery/computer/camera_advanced/base_construction/Destroy()
qdel(RCD)
return ..()
/obj/machinery/computer/camera_advanced/base_construction/GrantActions(mob/living/user)
off_action.target = user
off_action.Grant(user)
switch_mode_action.target = src
switch_mode_action.Grant(user)
build_action.target = src
build_action.Grant(user)
airlock_mode_action.target = src
airlock_mode_action.Grant(user)
window_action.target = src
window_action.Grant(user)
fan_action.target = src
fan_action.Grant(user)
turret_action.target = src
turret_action.Grant(user)
eyeobj.invisibility = 0 //When the eye is in use, make it visible to players so they know when someone is building.
/datum/action/innate/aux_base //Parent aux base action
var/mob/living/C //Mob using the action
var/mob/camera/aiEye/remote/base_construction/remote_eye //Console's eye mob
var/obj/machinery/computer/camera_advanced/base_construction/B //Console itself
/datum/action/innate/aux_base/Activate()
if(!target)
return TRUE
C = owner
remote_eye = C.remote_control
B = target
if(!B.RCD) //The console must always have an RCD.
B.RCD = new /obj/item/weapon/rcd/internal(src) //If the RCD is lost somehow, make a new (empty) one!
/datum/action/innate/aux_base/proc/check_spot()
//Check a loction to see if it is inside the aux base at the station. Camera visbility checks omitted so as to not hinder construction.
var/turf/build_target = get_turf(remote_eye)
var/area/build_area = get_area(build_target)
if(!istype(build_area, /area/shuttle/auxillary_base))
to_chat(owner, "<span class='warning'>You can only build within the mining base!</span>")
return FALSE
if(build_target.z != ZLEVEL_STATION)
to_chat(owner, "<span class='warning'>The mining base has launched and can no longer be modified.</span>")
return FALSE
return TRUE
/datum/action/innate/camera_off/base_construction
name = "Log out"
/datum/action/innate/camera_off/base_construction/Activate()
if(!owner || !owner.remote_control)
return
var/mob/camera/aiEye/remote/base_construction/remote_eye =owner.remote_control
var/obj/machinery/computer/camera_advanced/base_construction/origin = remote_eye.origin
origin.switch_mode_action.Remove(target)
origin.build_action.Remove(target)
origin.airlock_mode_action.Remove(target)
origin.window_action.Remove(target)
origin.fan_action.Remove(target)
origin.turret_action.Remove(target)
remote_eye.invisibility = INVISIBILITY_MAXIMUM //Hide the eye when not in use.
..()
//*******************FUNCTIONS*******************
/datum/action/innate/aux_base/build
name = "Build"
button_icon_state = "build"
/datum/action/innate/aux_base/build/Activate()
if(..())
return
if(!check_spot())
return
var/atom/movable/rcd_target
var/turf/target_turf = get_turf(remote_eye)
//Find airlocks
rcd_target = locate(/obj/machinery/door/airlock) in target_turf
if(!rcd_target)
rcd_target = locate (/obj/structure) in target_turf
if(!rcd_target || !rcd_target.anchored)
rcd_target = target_turf
owner.changeNext_move(CLICK_CD_RANGE)
B.RCD.afterattack(rcd_target, owner, TRUE) //Activate the RCD and force it to work remotely!
playsound(target_turf, 'sound/items/Deconstruct.ogg', 60, 1)
/datum/action/innate/aux_base/switch_mode
name = "Switch Mode"
button_icon_state = "builder_mode"
/datum/action/innate/aux_base/switch_mode/Activate()
if(..())
return
var/list/buildlist = list("Walls and Floors" = 1,"Airlocks" = 2,"Deconstruction" = 3,"Windows and Grilles" = 4)
var/buildmode = input("Set construction mode.", "Base Console", null) in buildlist
B.RCD.mode = buildlist[buildmode]
to_chat(owner, "Build mode is now [buildmode].")
/datum/action/innate/aux_base/airlock_type
name = "Select Airlock Type"
button_icon_state = "airlock_select"
datum/action/innate/aux_base/airlock_type/Activate()
if(..())
return
B.RCD.change_airlock_setting()
datum/action/innate/aux_base/window_type
name = "Select Window Type"
button_icon_state = "window_select"
datum/action/innate/aux_base/window_type/Activate()
if(..())
return
B.RCD.toggle_window_type()
datum/action/innate/aux_base/place_fan
name = "Place Tiny Fan"
button_icon_state = "build_fan"
datum/action/innate/aux_base/place_fan/Activate()
if(..())
return
var/turf/fan_turf = get_turf(remote_eye)
if(!B.fans_remaining)
to_chat(owner, "<span class='warning'>[B] is out of fans!</span>")
return
if(!check_spot())
return
if(fan_turf.density)
to_chat(owner, "<span class='warning'>Fans may only be placed on a floor.</span>")
return
new /obj/structure/fans/tiny(fan_turf)
B.fans_remaining--
to_chat(owner, "<span class='notice'>Tiny fan placed. [B.fans_remaining] remaining.</span>")
playsound(fan_turf, 'sound/machines/click.ogg', 50, 1)
datum/action/innate/aux_base/install_turret
name = "Install Plasma Anti-Wildlife Turret"
button_icon_state = "build_turret"
datum/action/innate/aux_base/install_turret/Activate()
if(..())
return
if(!check_spot())
return
if(!B.turret_stock)
to_chat(owner, "<span class='warning'>Unable to construct additional turrets.</span>")
return
var/turf/turret_turf = get_turf(remote_eye)
if(is_blocked_turf(turret_turf))
to_chat(owner, "<span class='warning'>Location is obtructed by something. Please clear the location and try again.</span>")
return
var/obj/machinery/porta_turret/aux_base/T = new /obj/machinery/porta_turret/aux_base(turret_turf)
if(B.found_aux_console)
B.found_aux_console.turrets += T //Add new turret to the console's control
B.turret_stock--
to_chat(owner, "<span class='notice'>Turret installation complete!</span>")
playsound(turret_turf, 'sound/items/drill_use.ogg', 65, 1)