From 1d56ff80dce9971e77079eae79846c58ef74b94b Mon Sep 17 00:00:00 2001 From: phil235 Date: Sat, 26 Sep 2015 13:21:20 +0200 Subject: [PATCH] Fixes runtimes with add_blood() and add_blood_list() Fixes formatting in the mech control console window. Fixes runtimes when building an AI (mind transfer from mmi to ai was called before the AI's hud_list was set) Fixes syndicate cyborg not starting with the correct module. Fixes syndiborg not being able to use their grenade launcher Fixes runtime with gun process_fire() (some code was reverted by accident) Fixes a runtime with hostile simple animal's PickTarget(). --- code/game/atoms.dm | 16 ++++++++-------- code/game/mecha/mecha_control_console.dm | 2 +- code/modules/mob/living/silicon/ai/ai.dm | 4 ++-- code/modules/mob/living/silicon/robot/robot.dm | 2 +- .../mob/living/simple_animal/hostile/hostile.dm | 4 ++-- code/modules/projectiles/gun.dm | 9 +++++---- .../projectiles/guns/projectile/launchers.dm | 1 + 7 files changed, 20 insertions(+), 18 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 373d98c3b36..b27f6223c94 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -280,22 +280,22 @@ var/list/blood_splatter_icons = list() //returns 1 if made bloody, returns 0 otherwise /atom/proc/add_blood(mob/living/carbon/M) + if(!M || !M.has_dna() || rejects_blood()) + return 0 if(ishuman(M)) var/mob/living/carbon/human/H = M if(NOBLOOD in H.dna.species.specflags) return 0 - if(rejects_blood() || !M.has_dna()) - return 0 return 1 /obj/add_blood(mob/living/carbon/M) - if(..() == 0) + if(!..()) return 0 return add_blood_list(M) /obj/item/add_blood(mob/living/carbon/M) - var/blood_count = blood_DNA == null ? 0 : blood_DNA.len - if(..() == 0) + var/blood_count = blood_DNA ? 0 : blood_DNA.len + if(!..()) return 0 //apply the blood-splatter overlay if it isn't already in there if(!blood_count && initial(icon) && initial(icon_state)) @@ -312,14 +312,14 @@ var/list/blood_splatter_icons = list() return 1 //we applied blood to the item /obj/item/clothing/gloves/add_blood(mob/living/carbon/M) - if(..() == 0) + if(!..()) return 0 transfer_blood = rand(2, 4) bloody_hands_mob = M return 1 /turf/simulated/add_blood(mob/living/carbon/human/M) - if(..() == 0) + if(!..()) return 0 var/obj/effect/decal/cleanable/blood/B = locate() in contents //check for existing blood splatter @@ -330,7 +330,7 @@ var/list/blood_splatter_icons = list() return 1 //we bloodied the floor /mob/living/carbon/human/add_blood(mob/living/carbon/M) - if(..() == 0) + if(!..()) return 0 add_blood_list(M) bloody_hands = rand(2, 4) diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm index cbd9075f608..ab7641dd681 100644 --- a/code/game/mecha/mecha_control_console.dm +++ b/code/game/mecha/mecha_control_console.dm @@ -77,7 +77,7 @@ Airtank: [M.return_pressure()]kPa
Pilot: [M.occupant||"None"]
Location: [get_area(M)||"Unknown"]
- Active equipment: [M.selected||"None"]"} + Active equipment: [M.selected||"None"]
"} if(istype(M, /obj/mecha/working/ripley)) var/obj/mecha/working/ripley/RM = M answer += "Used cargo space: [RM.cargo.len/RM.cargo_capacity*100]%
" diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index e39e59063dc..a8ff6fb6361 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -74,6 +74,7 @@ var/list/ai_list = list() var/obj/machinery/camera/portable/builtInCamera /mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0) + ..() rename_self("ai", 1) name = real_name anchored = 1 @@ -144,8 +145,7 @@ var/list/ai_list = list() builtInCamera = new /obj/machinery/camera/portable(src) builtInCamera.network = list("SS13") - ..() - return + /mob/living/silicon/ai/Destroy() ai_list -= src diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index d4cf25c2e3f..924ae2cb4db 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1134,7 +1134,7 @@ Your energy saw functions as a circular saw, but can be activated to deal more damage, and your operative pinpointer will find and locate fellow nuclear operatives. \ Help the operatives secure the disk at all costs!" -/mob/living/silicon/robot/syndicate/New(loc) +/mob/living/silicon/robot/syndicate/medical/New(loc) ..() module = new /obj/item/weapon/robot_module/syndicate_medical(src) spawn(5) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 12a73e8edc4..7d87854a7ca 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -94,14 +94,14 @@ return /mob/living/simple_animal/hostile/proc/PickTarget(list/Targets)//Step 3, pick amongst the possible, attackable targets - if(!Targets.len)//We didnt find nothin! - return if(target != null)//If we already have a target, but are told to pick again, calculate the lowest distance between all possible, and pick from the lowest distance targets for(var/atom/A in Targets) var/target_dist = get_dist(src, target) var/possible_target_distance = get_dist(src, A) if(target_dist < possible_target_distance) Targets -= A + if(!Targets.len)//We didnt find nothin! + return var/chosen_target = pick(Targets)//Pick the remaining targets (if any) at random return chosen_target diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 9252eb3eccf..02729e68ac9 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -138,7 +138,8 @@ var/mob/living/M = user if (M.disabilities & CLUMSY && prob(40)) user << "You shoot yourself in the foot with \the [src]!" - process_fire(user,user,0,params) + var/shot_leg = pick("l_leg", "r_leg") + process_fire(user,user,0,params, zone_override = shot_leg) M.drop_item() return @@ -182,7 +183,7 @@ return 0 -/obj/item/weapon/gun/proc/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, message = 1, params) +/obj/item/weapon/gun/proc/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, message = 1, params, zone_override) add_fingerprint(user) if(semicd) @@ -200,7 +201,7 @@ if( i>1 && !(src in get_both_hands(user))) //for burst firing break if(chambered) - if(!chambered.fire(target, user, params, , suppressed)) + if(!chambered.fire(target, user, params, , suppressed, zone_override)) shoot_with_empty_chamber(user) break else @@ -216,7 +217,7 @@ sleep(fire_delay) else if(chambered) - if(!chambered.fire(target, user, params, , suppressed)) + if(!chambered.fire(target, user, params, , suppressed, zone_override)) shoot_with_empty_chamber(user) return else diff --git a/code/modules/projectiles/guns/projectile/launchers.dm b/code/modules/projectiles/guns/projectile/launchers.dm index 0d9220733f1..ecd46e53e3f 100644 --- a/code/modules/projectiles/guns/projectile/launchers.dm +++ b/code/modules/projectiles/guns/projectile/launchers.dm @@ -25,6 +25,7 @@ icon = 'icons/mecha/mecha_equipment.dmi' icon_state = "mecha_grenadelnchr" mag_type = /obj/item/ammo_box/magazine/internal/cylinder/grenademulti + pin = /obj/item/device/firing_pin /obj/item/weapon/gun/projectile/revolver/grenadelauncher/cyborg/attack_self() return