mirror of
https://github.com/Aurorastation/Aurora-Old.git
synced 2026-07-14 09:12:27 +01:00
906f9e20bc
- Addition of Gravity Field Generators - Added animation for when floating - Toggle Gravity in Secrets menu only works when a Grav Gen is on the station - New debug verb to reset the gravity on the whole server Because of the way this has been implemented, any Grav Gen on any zLevel will affect the station level only. I would need to rewrite the whole movement/gravity system as well. Something I think can be saved for when we switch from station to outpost. Mapping info: At the start of round there doesn't need to be one on the station as the original gravity system will be running when the round starts. As soon as a Grav Gen has been spawned and it has started up (Done automatically if already on map or spawned using the /station/admin version) It will take over all gravity simulation. The main object: /obj/machinery/gravity_field_generator/main The one to be place on a map at round start: /obj/machinery/gravity_field_generator/main/station The one admins should spawn if they need/want to spawn one: /obj/machinery/gravity_field_generator/main/station/admin
140 lines
3.9 KiB
Plaintext
140 lines
3.9 KiB
Plaintext
// It.. uses a lot of power. Everything under power is engineering stuff, at least.
|
|
|
|
/obj/machinery/computer/gravity_control_computer
|
|
name = "Gravity Generator Control"
|
|
desc = "A computer to control a local gravity generator. Qualified personnel only."
|
|
icon = 'icons/obj/computer.dmi'
|
|
icon_state = "airtunnel0e"
|
|
anchored = 1
|
|
density = 1
|
|
var/obj/machinery/gravity_field_generator = null
|
|
|
|
|
|
/obj/machinery/gravity_generator/
|
|
name = "Gravitational Generator"
|
|
desc = "A device which produces a gravaton field when set up."
|
|
icon = 'icons/obj/singularity.dmi'
|
|
icon_state = "TheSingGen"
|
|
anchored = 1
|
|
density = 1
|
|
use_power = 1
|
|
idle_power_usage = 200
|
|
active_power_usage = 1000
|
|
var/on = 1
|
|
var/list/localareas = list()
|
|
var/effectiverange = 25
|
|
|
|
// Borrows code from cloning computer
|
|
/obj/machinery/computer/gravity_control_computer/New()
|
|
..()
|
|
spawn(5)
|
|
updatemodules()
|
|
return
|
|
return
|
|
|
|
/obj/machinery/gravity_generator/New()
|
|
..()
|
|
spawn(5)
|
|
locatelocalareas()
|
|
return
|
|
return
|
|
|
|
/obj/machinery/computer/gravity_control_computer/proc/updatemodules()
|
|
src.gravity_field_generator = findgenerator()
|
|
|
|
/obj/machinery/gravity_generator/proc/locatelocalareas()
|
|
for(var/area/A in range(src,effectiverange))
|
|
if(A.name == "Space")
|
|
continue // No (de)gravitizing space.
|
|
if(A.master && !( A.master in localareas) )
|
|
localareas += A.master
|
|
|
|
/obj/machinery/computer/gravity_control_computer/proc/findgenerator()
|
|
var/obj/machinery/gravity_generator/foundgenerator = null
|
|
for(dir in list(NORTH,EAST,SOUTH,WEST))
|
|
//world << "SEARCHING IN [dir]"
|
|
foundgenerator = locate(/obj/machinery/gravity_generator/, get_step(src, dir))
|
|
if (!isnull(foundgenerator))
|
|
//world << "FOUND"
|
|
break
|
|
return foundgenerator
|
|
|
|
|
|
/obj/machinery/computer/gravity_control_computer/attack_paw(mob/user as mob)
|
|
return attack_hand(user)
|
|
|
|
/obj/machinery/computer/gravity_control_computer/attack_ai(mob/user as mob)
|
|
return attack_hand(user)
|
|
|
|
/obj/machinery/computer/gravity_control_computer/attack_hand(mob/user as mob)
|
|
user.set_machine(src)
|
|
add_fingerprint(user)
|
|
|
|
if(stat & (BROKEN|NOPOWER))
|
|
return
|
|
|
|
updatemodules()
|
|
|
|
var/dat = "<h3>Generator Control System</h3>"
|
|
//dat += "<font size=-1><a href='byond://?src=\ref[src];refresh=1'>Refresh</a></font>"
|
|
if(gravity_field_generator)
|
|
if(gravity_field_generator:on)
|
|
dat += "<font color=green><br><tt>Gravity Status: ON</tt></font><br>"
|
|
else
|
|
dat += "<font color=red><br><tt>Gravity Status: OFF</tt></font><br>"
|
|
|
|
dat += "<br><tt>Currently Supplying Gravitons To:</tt><br>"
|
|
|
|
for(var/area/A in gravity_field_generator:localareas)
|
|
if(A.has_gravity && gravity_field_generator:on)
|
|
dat += "<tt><font color=green>[A]</tt></font><br>"
|
|
|
|
else if (A.has_gravity)
|
|
dat += "<tt><font color=yellow>[A]</tt></font><br>"
|
|
|
|
else
|
|
dat += "<tt><font color=red>[A]</tt></font><br>"
|
|
|
|
dat += "<br><tt>Maintainence Functions:</tt><br>"
|
|
if(gravity_field_generator:on)
|
|
dat += "<a href='byond://?src=\ref[src];gentoggle=1'><font color=red> TURN GRAVITY GENERATOR OFF. </font></a>"
|
|
else
|
|
dat += "<a href='byond://?src=\ref[src];gentoggle=1'><font color=green> TURN GRAVITY GENERATOR ON. </font></a>"
|
|
|
|
else
|
|
dat += "No local gravity generator detected!"
|
|
|
|
user << browse(dat, "window=gravgen")
|
|
onclose(user, "gravgen")
|
|
|
|
|
|
/obj/machinery/computer/gravity_control_computer/Topic(href, href_list)
|
|
set background = 1
|
|
..()
|
|
|
|
if ( (get_dist(src, usr) > 1 ))
|
|
if (!istype(usr, /mob/living/silicon))
|
|
usr.unset_machine()
|
|
usr << browse(null, "window=air_alarm")
|
|
return
|
|
|
|
if(href_list["gentoggle"])
|
|
if(gravity_field_generator:on)
|
|
gravity_field_generator:on = 0
|
|
|
|
for(var/area/A in gravity_field_generator:localareas)
|
|
var/obj/machinery/gravity_field_generator/main/G
|
|
for(G in machines)
|
|
if((A.master in G.localareas) && (G.on))
|
|
break
|
|
if(!G)
|
|
A.gravitychange(0,A)
|
|
|
|
|
|
else
|
|
for(var/area/A in gravity_field_generator:localareas)
|
|
gravity_field_generator:on = 1
|
|
A.gravitychange(1,A)
|
|
|
|
src.updateUsrDialog()
|
|
return |