From 1a51aefaac8684143a02203cb50e2acd2c4c3f4d Mon Sep 17 00:00:00 2001 From: Chinsky Date: Sat, 1 Jun 2013 04:05:33 +0400 Subject: [PATCH 1/3] Fixes #2922 Putting gun away now properly lowers aim. Prevents gun from going off if it's not in active hand. --- code/modules/projectiles/targeting.dm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/modules/projectiles/targeting.dm b/code/modules/projectiles/targeting.dm index 5480b83d847..a2aaa9dc163 100644 --- a/code/modules/projectiles/targeting.dm +++ b/code/modules/projectiles/targeting.dm @@ -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. From 793f472a4f2cccf067673c37b32a1ed690391ce0 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Sat, 1 Jun 2013 04:11:16 +0400 Subject: [PATCH 2/3] Should fix quite a few of false positives on gun targeting. Allows mob to click on turfs with empty hand. --- code/game/atoms.dm | 10 +++++++++- code/modules/projectiles/targeting.dm | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 99b56c346e0..f8001dbdc2b 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -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 diff --git a/code/modules/projectiles/targeting.dm b/code/modules/projectiles/targeting.dm index a2aaa9dc163..6507a2f66a1 100644 --- a/code/modules/projectiles/targeting.dm +++ b/code/modules/projectiles/targeting.dm @@ -163,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 Your character is being targeted. They have 2 seconds to stop any click or move actions. \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 ))" From 73578cb9cd0fcbbc206f957802bc90f8b0ac3d03 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Sat, 1 Jun 2013 06:31:15 +0400 Subject: [PATCH 3/3] Fixes #2926 Now master alarm in area polls all other alarms and sets area alert level to highest out of them. So no more green alarms opening lockdowns until they turn red too. --- code/game/machinery/alarm.dm | 77 ++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index f31746de802..1945be11a65 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -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 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)