From 4ef0251aad7f554a084d55d87bd5a7c57d055b00 Mon Sep 17 00:00:00 2001 From: "VivianFoxfoot@gmail.com" Date: Sun, 8 Jan 2012 08:47:54 +0000 Subject: [PATCH] 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 --- code/defines/area/area.dm | 85 ----------- code/game/area/areas.dm | 98 +++++++++++- code/modules/mob/living/carbon/human/human.dm | 2 +- code/modules/mob/mob_movement.dm | 6 + code/modules/power/gravitygenerator.dm | 144 ++++++++++++++++++ config/config.txt | 2 +- tgstation.dme | 2 +- 7 files changed, 248 insertions(+), 91 deletions(-) delete mode 100644 code/defines/area/area.dm create mode 100644 code/modules/power/gravitygenerator.dm diff --git a/code/defines/area/area.dm b/code/defines/area/area.dm deleted file mode 100644 index 2d030c66cb..0000000000 --- a/code/defines/area/area.dm +++ /dev/null @@ -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) - - diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index ce9bb22637..88de1d8ba6 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -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!" + diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2bbf93bfc0..5cb5159b53 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -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 diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 5bcb2e12d7..02df91f3d4 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -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 diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm new file mode 100644 index 0000000000..b60f18e686 --- /dev/null +++ b/code/modules/power/gravitygenerator.dm @@ -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 = "

Generator Control System

" + //dat += "Refresh" + if(gravity_generator) + if(gravity_generator:on) + dat += "
Gravity Status: ON

" + else + dat += "
Gravity Status: OFF

" + + dat += "
Currently Supplying Gravitons To:
" + + for(var/area/A in gravity_generator:localareas) + if(A.has_gravity && gravity_generator:on) + dat += "[A]
" + + else if (A.has_gravity) + dat += "[A]
" + + else + dat += "[A]
" + + dat += "
Maintainence Functions:
" + if(gravity_generator:on) + dat += " TURN GRAVITY GENERATOR OFF. " + else + dat += " TURN GRAVITY GENERATOR ON. " + + 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 \ No newline at end of file diff --git a/config/config.txt b/config/config.txt index 19de255b3a..7e4ab713c9 100644 --- a/config/config.txt +++ b/config/config.txt @@ -31,7 +31,7 @@ LOG_WHISPER LOG_EMOTE ## log attack messages -## LOG_ATTACK +LOG_ATTACK ## log pda messages LOG_PDA diff --git a/tgstation.dme b/tgstation.dme index 7f6340f6b3..4c6001ef57 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -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"