Moves the areas procs all into the same file.

Comments out an if statement to supress a warning.
Although not yet located on the map, adds the code for gravity generators.
Actually enables attack logging by default, now.  


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2927 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
VivianFoxfoot@gmail.com
2012-01-08 08:47:54 +00:00
parent 1f29357168
commit 4ef0251aad
7 changed files with 248 additions and 91 deletions

View File

@@ -1,85 +0,0 @@
/area/Entered(A)
var/sound = null
var/musVolume = 25
sound = 'ambigen1.ogg'
if (ismob(A))
if (istype(A, /mob/dead/observer)) return
if (!A:ckey)
return
if(istype(A,/mob/living))
if(!A:lastarea)
A:lastarea = get_area(A:loc)
//world << "Entered new area [get_area(A:loc)]"
var/area/newarea = get_area(A:loc)
var/area/oldarea = A:lastarea
if((oldarea.has_gravity == 0) && (newarea.has_gravity == 1) && (A:m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together.
thunk(A)
A:lastarea = newarea
//if (A:ear_deaf) return
if (A && A:client && !A:client:ambience_playing && !A:client:no_ambi) // Ambience goes down here -- make sure to list each area seperately for ease of adding things in later, thanks! Note: areas next to each other should have the same sounds to prevent cutoff when possible.- LastyScratch
A:client:ambience_playing = 1
A << sound('shipambience.ogg', repeat = 1, wait = 0, volume = 35, channel = 2)
switch(src.name)
if ("Chapel") sound = pick('ambicha1.ogg','ambicha2.ogg','ambicha3.ogg','ambicha4.ogg')
if ("Morgue") sound = pick('ambimo1.ogg','ambimo2.ogg','title2.ogg')
if ("Space") sound = pick('ambispace.ogg','title2.ogg',)
if ("Engine Control") sound = pick('ambisin1.ogg','ambisin2.ogg','ambisin3.ogg','ambisin4.ogg')
if ("Atmospherics") sound = pick('ambiatm1.ogg')
if ("AI Sat Ext") sound = pick('ambiruntime.ogg','ambimalf.ogg')
if ("AI Satellite") sound = pick('ambimalf.ogg')
if ("AI Satellite Teleporter Room") sound = pick('ambiruntime.ogg','ambimalf.ogg')
if ("Bar") sound = pick('null.ogg')
if ("AI Upload Foyer") sound = pick('ambimalf.ogg', 'null.ogg')
if ("AI Upload Chamber") sound = pick('ambimalf.ogg','null.ogg')
if ("Mine")
sound = pick('ambimine.ogg')
musVolume = 25
else
sound = pick('ambiruntime.ogg','ambigen1.ogg','ambigen3.ogg','ambigen4.ogg','ambigen5.ogg','ambigen6.ogg','ambigen7.ogg','ambigen8.ogg','ambigen9.ogg','ambigen10.ogg','ambigen11.ogg','ambigen12.ogg','ambigen14.ogg')
if (prob(35))
if(A && A:client && !A:client:played)
A << sound(sound, repeat = 0, wait = 0, volume = musVolume, channel = 1)
A:client:played = 1
spawn(600)
if(A && A:client)
A:client:played = 0
/area/proc/thunk(mob)
if(istype(mob,/mob/living/carbon/human/)) // Only humans can wear magboots, so we give them a chance to.
if((istype(mob:shoes, /obj/item/clothing/shoes/magboots) && (mob:shoes.flags & NOSLIP)))
return
if(istype(get_turf(mob), /turf/space)) // Can't fall onto nothing.
return
if((istype(mob,/mob/living/carbon/human/)) && (mob:m_intent == "run")) // Only clumbsy humans can fall on their asses.
mob:AdjustStunned(5)
mob:AdjustWeakened(5)
else if (istype(mob,/mob/living/carbon/human/))
mob:AdjustStunned(2)
mob:AdjustWeakened(2)
mob << "Gravity!"
/area/proc/gravitychange(var/gravitystate = 0, var/area/A)
A.has_gravity = gravitystate
if(gravitystate)
for(var/mob/living/carbon/human/M in A)
thunk(M)

View File

@@ -1,3 +1,7 @@
// Areas.dm
// ===
/area/
var/global/global_uid = 0
@@ -27,7 +31,7 @@
power_light = 0
power_equip = 0
power_environ = 0
has_gravity = 0
//has_gravity = 0 // Space has gravity. Because.. because.
if(!requires_power)
power_light = 0//rastaf0
@@ -40,8 +44,7 @@
area_lights_luminosity = rand(6,9)
//sd_SetLuminosity(0) // *DAL*
if(is_type_in_list(src, the_station_areas))
has_gravity = 1
/*spawn(5)
@@ -273,3 +276,92 @@
master.used_light += amount
if(ENVIRON)
master.used_environ += amount
/area/Entered(A)
var/sound = null
var/musVolume = 25
sound = 'ambigen1.ogg'
if (ismob(A))
if (istype(A, /mob/dead/observer)) return
if (!A:ckey)
return
if(istype(A,/mob/living))
if(!A:lastarea)
A:lastarea = get_area(A:loc)
//world << "Entered new area [get_area(A:loc)]"
var/area/newarea = get_area(A:loc)
var/area/oldarea = A:lastarea
if((oldarea.has_gravity == 0) && (newarea.has_gravity == 1) && (A:m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together.
thunk(A)
A:lastarea = newarea
//if (A:ear_deaf) return
if (A && A:client && !A:client:ambience_playing && !A:client:no_ambi) // Ambience goes down here -- make sure to list each area seperately for ease of adding things in later, thanks! Note: areas next to each other should have the same sounds to prevent cutoff when possible.- LastyScratch
A:client:ambience_playing = 1
A << sound('shipambience.ogg', repeat = 1, wait = 0, volume = 35, channel = 2)
switch(src.name)
if ("Chapel") sound = pick('ambicha1.ogg','ambicha2.ogg','ambicha3.ogg','ambicha4.ogg')
if ("Morgue") sound = pick('ambimo1.ogg','ambimo2.ogg','title2.ogg')
if ("Space") sound = pick('ambispace.ogg','title2.ogg',)
if ("Engine Control") sound = pick('ambisin1.ogg','ambisin2.ogg','ambisin3.ogg','ambisin4.ogg')
if ("Atmospherics") sound = pick('ambiatm1.ogg')
if ("AI Sat Ext") sound = pick('ambiruntime.ogg','ambimalf.ogg')
if ("AI Satellite") sound = pick('ambimalf.ogg')
if ("AI Satellite Teleporter Room") sound = pick('ambiruntime.ogg','ambimalf.ogg')
if ("Bar") sound = pick('null.ogg')
if ("AI Upload Foyer") sound = pick('ambimalf.ogg', 'null.ogg')
if ("AI Upload Chamber") sound = pick('ambimalf.ogg','null.ogg')
if ("Mine")
sound = pick('ambimine.ogg')
musVolume = 25
else
sound = pick('ambiruntime.ogg','ambigen1.ogg','ambigen3.ogg','ambigen4.ogg','ambigen5.ogg','ambigen6.ogg','ambigen7.ogg','ambigen8.ogg','ambigen9.ogg','ambigen10.ogg','ambigen11.ogg','ambigen12.ogg','ambigen14.ogg')
if (prob(35))
if(A && A:client && !A:client:played)
A << sound(sound, repeat = 0, wait = 0, volume = musVolume, channel = 1)
A:client:played = 1
spawn(600)
if(A && A:client)
A:client:played = 0
/area/proc/gravitychange(var/gravitystate = 0, var/area/A)
A.has_gravity = gravitystate
for(var/area/SubA in A.related)
SubA.has_gravity = gravitystate
if(gravitystate)
for(var/mob/living/carbon/human/M in SubA)
thunk(M)
/area/proc/thunk(mob)
if(istype(mob,/mob/living/carbon/human/)) // Only humans can wear magboots, so we give them a chance to.
if((istype(mob:shoes, /obj/item/clothing/shoes/magboots) && (mob:shoes.flags & NOSLIP)))
return
if(istype(get_turf(mob), /turf/space)) // Can't fall onto nothing.
return
if((istype(mob,/mob/living/carbon/human/)) && (mob:m_intent == "run")) // Only clumbsy humans can fall on their asses.
mob:AdjustStunned(5)
mob:AdjustWeakened(5)
else if (istype(mob,/mob/living/carbon/human/))
mob:AdjustStunned(2)
mob:AdjustWeakened(2)
mob << "Gravity!"

View File

@@ -2202,7 +2202,7 @@ It can still be worn/put on as normal.
src.stat = 0
return
src.health = 100 - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() - src.getCloneLoss()
if(getFireLoss() > 100 && stat == DEAD)
//if(getFireLoss() > 100 && stat == DEAD)
// ChangeToHusk() // Commented out due to lasers and fire also husking you and making you unclonable.
return

View File

@@ -332,6 +332,10 @@
//First check to see if we can do things
if(restrained()) return 0
if(istype(src,/mob/living/carbon))
if(src.l_hand && src.r_hand)
return 0
var/dense_object = 0
for(var/turf/turf in oview(1,src))
if(istype(turf,/turf/space))
@@ -349,6 +353,8 @@
if((istype(turf,/turf/simulated/floor)) && (a.has_gravity == 0)) // No one else gets a chance.
continue
/*
if(istype(turf,/turf/simulated/floor) && (src.flags & NOGRAV))
continue

View File

@@ -0,0 +1,144 @@
// 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 = 'computer.dmi'
icon_state = "airtunnel0e"
anchored = 1
density = 1
var/obj/machinery/gravity_generator = null
/obj/machinery/gravity_generator/
name = "Gravitational Generator"
desc = "A device which produces a gravaton field when set up."
icon = '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_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.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_generator)
if(gravity_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_generator:localareas)
if(A.has_gravity && gravity_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_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.machine = null
usr << browse(null, "window=air_alarm")
return
if(href_list["gentoggle"])
if(gravity_generator:on)
gravity_generator:on = 0
for(var/area/A in gravity_generator:localareas)
var/obj/machinery/gravity_generator/G
for(G in world)
if((A.master in G.localareas) && (G.on))
break
if(!G)
A.gravitychange(0,A)
else
for(var/area/A in gravity_generator:localareas)
gravity_generator:on = 1
A.gravitychange(1,A)
src.updateUsrDialog()
return

View File

@@ -31,7 +31,7 @@ LOG_WHISPER
LOG_EMOTE
## log attack messages
## LOG_ATTACK
LOG_ATTACK
## log pda messages
LOG_PDA

View File

@@ -270,7 +270,6 @@
#include "code\defines\obj.dm"
#include "code\defines\turf.dm"
#include "code\defines\world.dm"
#include "code\defines\area\area.dm"
#include "code\defines\area\Space Station 13 areas.dm"
#include "code\defines\mob\dead\observer.dm"
#include "code\defines\mob\living\living.dm"
@@ -924,6 +923,7 @@
#include "code\modules\power\engine.dm"
#include "code\modules\power\generator.dm"
#include "code\modules\power\generator_type2.dm"
#include "code\modules\power\gravitygenerator.dm"
#include "code\modules\power\lighting.dm"
#include "code\modules\power\port_gen.dm"
#include "code\modules\power\power.dm"