Merge pull request #2928 from comma/master

Couple of fixes
This commit is contained in:
Asanadas
2013-05-31 20:24:44 -07:00
3 changed files with 61 additions and 36 deletions
+9 -1
View File
@@ -550,8 +550,16 @@ its easier to just keep the beam vertical.
/atom/Click(location,control,params)
//world << "atom.Click() on [src] by [usr] : src.type is [src.type]"
if(!istype(src,/obj/item/weapon/gun))
var/acting_bad = 1 //Check for gun targeting code.
if (istype(src,/obj/item/weapon/gun)) //Allow people to lower weapon
acting_bad = 0
if (istype(src, /turf) && istype(usr,/mob/living/carbon/human)) //Allow people to turn around
var/mob/living/carbon/human/H = usr
if (!H.equipped())
acting_bad = 0
if(acting_bad)
usr.last_target_click = world.time
if(usr.client.buildmode)
build_click(usr, usr.client.buildmode, location, control, params, src)
return
+43 -34
View File
@@ -135,30 +135,7 @@
if(!istype(location)) return//returns if loc is not simulated
var/datum/gas_mixture/environment = location.return_air()
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
var/list/current_settings = TLV["pressure"]
var/environment_pressure = environment.return_pressure()
var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings)
current_settings = TLV["oxygen"]
var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, current_settings)
current_settings = TLV["carbon dioxide"]
var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, current_settings)
current_settings = TLV["plasma"]
var/plasma_dangerlevel = get_danger_level(environment.toxins*partial_pressure, current_settings)
current_settings = TLV["other"]
var/other_moles = 0.0
for(var/datum/gas/G in environment.trace_gases)
other_moles+=G.moles
var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, current_settings)
current_settings = TLV["temperature"]
var/temperature_dangerlevel = get_danger_level(environment.temperature, current_settings)
var/temperature_dangerlevel = get_danger_level(environment.temperature, TLV["temperature"])
//Handle temperature adjustment here.
if(temperature_dangerlevel || regulating_temperature)
//If it goes too far, we should adjust ourselves back before stopping.
@@ -194,18 +171,14 @@
"You hear a click as a faint electronic humming stops.")
var/old_danger_level = danger_level
danger_level = max(pressure_dangerlevel,
oxygen_dangerlevel,
co2_dangerlevel,
plasma_dangerlevel,
other_dangerlevel,
temperature_dangerlevel)
danger_level = overall_danger_level()
log_debug("Processing [name] : level - [danger_level]")
if (old_danger_level != danger_level)
apply_danger_level(danger_level)
if (alarm_area.master_air_alarm == src)
refresh_danger_level()
update_icon()
if (mode==AALARM_MODE_CYCLE && environment_pressure<ONE_ATMOSPHERE*0.05)
if (mode==AALARM_MODE_CYCLE && environment.return_pressure()<ONE_ATMOSPHERE*0.05)
mode=AALARM_MODE_FILL
apply_mode()
@@ -225,6 +198,33 @@
updateDialog()
return
proc/overall_danger_level()
var/turf/simulated/location = loc
if(!istype(location)) return//returns if loc is not simulated
var/datum/gas_mixture/environment = location.return_air()
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
var/environment_pressure = environment.return_pressure()
var/other_moles = 0.0
for(var/datum/gas/G in environment.trace_gases)
other_moles+=G.moles
var/pressure_dangerlevel = get_danger_level(environment_pressure, TLV["pressure"])
var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, TLV["oxygen"])
var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, TLV["carbon dioxide"])
var/plasma_dangerlevel = get_danger_level(environment.toxins*partial_pressure, TLV["plasma"])
var/temperature_dangerlevel = get_danger_level(environment.temperature, TLV["temperature"])
var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, TLV["other"])
return max(
pressure_dangerlevel,
oxygen_dangerlevel,
co2_dangerlevel,
plasma_dangerlevel,
other_dangerlevel,
temperature_dangerlevel
)
proc/master_is_operating()
return alarm_area.master_air_alarm && !(alarm_area.master_air_alarm.stat & (NOPOWER|BROKEN))
@@ -383,6 +383,15 @@
update_icon()
proc/refresh_danger_level()
var/level = 0
for (var/area/A in alarm_area.related)
for (var/obj/machinery/alarm/AA in A)
if ( !(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted)
if (AA.danger_level > level)
level = AA.danger_level
apply_danger_level(level)
proc/air_doors_close(manual)
var/area/A = get_area(src)
if(!A.master.air_doors_activated)
+9 -1
View File
@@ -25,6 +25,13 @@
user.client.remove_gun_icons()
return ..()
/obj/item/weapon/gun/equipped(var/mob/user, var/slot)
if (slot != slot_l_hand && slot != slot_r_hand)
stop_aim()
if (user.client)
user.client.remove_gun_icons()
return ..()
//Removes lock fro mall targets
/obj/item/weapon/gun/proc/stop_aim()
if(target)
@@ -69,6 +76,7 @@
if(!istype(M)) return
if(src != M.equipped())
stop_aim()
return
M.last_move_intent = world.time
if(load_into_chamber())
var/firing_check = in_chamber.check_fire(T,usr) //0 if it cannot hit them, 1 if it is capable of hitting, and 2 if a special check is preventing it from firing.
@@ -155,7 +163,7 @@ mob/living/proc/Targeted(var/obj/item/weapon/gun/I) //Self explanitory.
targeted_by += I
I.lock_time = world.time + 20 //Target has 2 second to realize they're targeted and stop (or target the opponent).
src << "((\red <b>Your character is being targeted. They have 2 seconds to stop any click or move actions.</b> \black While targeted, they may \
drag and drop items in or into the map, speak, and click on interface buttons. Clicking on the map, their items \
drag and drop items in or into the map, speak, and click on interface buttons. Clicking on the map objects (floors and walls are fine), their items \
(other than a weapon to de-target), or moving will result in being fired upon. \red The aggressor may also fire manually, \
so try not to get on their bad side.\black ))"