From 112fb5433e9dc1920e8d5e71359aea8ef41812bb Mon Sep 17 00:00:00 2001 From: Erthilo Date: Tue, 29 May 2012 00:33:25 +0100 Subject: [PATCH] TG: - Some runtime-prevention tweaks so that impatient coders don't just break everything somewhere down the line. Revision: r3665 Author: baloh.matevz --- code/defines/obj.dm | 15 ++++++- code/defines/obj/clothing.dm | 12 ------ code/defines/obj/weapon.dm | 20 +++++----- .../objects/items/weapons/implants/implant.dm | 40 +++++++++++-------- code/game/objects/items/weapons/paint.dm | 3 +- code/game/objects/radio/headset.dm | 1 - code/modules/DetectiveWork/detective_work.dm | 38 ++++++++++-------- code/modules/clothing/head/hats.dm | 1 - code/modules/clothing/suit.dm | 2 +- .../living/carbon/alien/humanoid/humanoid.dm | 9 +++-- .../mob/living/carbon/alien/larva/larva.dm | 9 +++-- code/modules/mob/living/carbon/human/human.dm | 24 +++++------ .../living/carbon/human/human_attackhand.dm | 12 +++--- .../mob/living/carbon/human/human_defense.dm | 9 +++-- code/modules/mob/living/carbon/human/life.dm | 16 +++++++- .../mob/living/carbon/metroid/metroid.dm | 12 +++--- .../mob/living/carbon/monkey/monkey.dm | 12 +++--- code/modules/paperwork/stamps.dm | 2 +- 18 files changed, 134 insertions(+), 103 deletions(-) diff --git a/code/defines/obj.dm b/code/defines/obj.dm index da9e82092fa..8a9a6eb2085 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -422,7 +422,6 @@ var/burning = null var/hitsound = null var/w_class = 3.0 - var/protective_temperature = 0 // Placing this here to avoid runtime errors, due to tiny items being allowed on ears and being queried for this variable flags = FPRINT | TABLEPASS var/slot_flags = 0 //This is used to determine on which slots an item can fit. pass_flags = PASSTABLE @@ -430,6 +429,20 @@ // causeerrorheresoifixthis var/obj/item/master = null + //Since any item can now be a piece of clothing, this has to be put here so all items share it. + var/see_face = 1.0 + var/color = null + var/body_parts_covered = 0 //see setup.dm for appropriate bit flags + var/protective_temperature = 0 + var/heat_transfer_coefficient = 1 //0 prevents all transfers, 1 is invisible + var/gas_transfer_coefficient = 1 // for leaking gas from turf to mask and vice-versa (for masks right now, but at some point, i'd like to include space helmets) + var/permeability_coefficient = 1 // for chemicals/diseases + var/siemens_coefficient = 1 // for electrical admittance/conductance (electrocution checks and shit) + var/slowdown = 0 // How much clothing is slowing you down. Negative values speeds you up + var/canremove = 1 //Mostly for Ninja code at this point but basically will not allow the item to be removed if set to 0. /N + var/armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) + var/list/allowed = null //suit storage stuff. + /obj/item/device icon = 'device.dmi' diff --git a/code/defines/obj/clothing.dm b/code/defines/obj/clothing.dm index 334c90e2c43..d41b065923c 100644 --- a/code/defines/obj/clothing.dm +++ b/code/defines/obj/clothing.dm @@ -4,19 +4,7 @@ name = "clothing" // var/obj/item/clothing/master = null - var/see_face = 1.0 - var/color = null - var/body_parts_covered = 0 //see setup.dm for appropriate bit flags - - var/heat_transfer_coefficient = 1 //0 prevents all transfers, 1 is invisible - var/gas_transfer_coefficient = 1 // for leaking gas from turf to mask and vice-versa (for masks right now, but at some point, i'd like to include space helmets) - var/permeability_coefficient = 1 // for chemicals/diseases - var/siemens_coefficient = 1 // for electrical admittance/conductance (electrocution checks and shit) - var/slowdown = 0 // How much clothing is slowing you down. Negative values speeds you up - var/canremove = 1 //Mostly for Ninja code at this point but basically will not allow the item to be removed if set to 0. /N - - var/armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index dfa013f0325..e2313386644 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -386,7 +386,7 @@ origin_tech = "combat=3" /obj/item/weapon/melee/energy/sword - var/color + color name = "energy sword" desc = "It cuts AND cooks at the same time!" icon_state = "sword0" @@ -476,7 +476,7 @@ w_class = 1.0 throw_speed = 2 throw_range = 10 - var/color = "white" + color = "white" /obj/item/weapon/bedsheet/blue icon_state = "sheetblue" @@ -763,7 +763,7 @@ icon = 'power.dmi' icon_state = "coil_red" var/amount = MAXCOIL - var/color = "red" + color = "red" desc = "A coil of power cable." throwforce = 10 w_class = 2.0 @@ -1026,12 +1026,12 @@ throw_range = 15 layer = 4 var/list/stamped - var/see_face = 1 - var/body_parts_covered = HEAD - var/heat_transfer_coefficient = 0.99 - var/gas_transfer_coefficient = 1 - var/permeability_coefficient = 0.99 - var/siemens_coefficient = 0.80 + see_face = 1 + body_parts_covered = HEAD + heat_transfer_coefficient = 0.99 + gas_transfer_coefficient = 1 + permeability_coefficient = 0.99 + siemens_coefficient = 0.80 var/iteration /obj/item/weapon/directions @@ -1701,7 +1701,7 @@ eternal248: Found broken and buggy Z-levels 7-12, ended up leading to my discove throw_speed = 7 throw_range = 15 m_amt = 60 - var/color = "cargo" + color = "cargo" /obj/item/weapon/stamp/captain name = "captain's rubber stamp" diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm index 6c0fd9a6bcc..1fad31c0210 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -3,22 +3,31 @@ desc = "An implant. Not usually seen outside a body." icon = 'items.dmi' icon_state = "implant" - var - implanted = null - mob/imp_in = null - color = "b" - allow_reagents = 0 - proc - trigger(emote, source as mob) - activate() - implanted(source as mob) - get_data() - hear(message, source as mob) + var/implanted = null + var/mob/imp_in = null + color = "b" + var/allow_reagents = 0 + + proc/trigger(emote, source as mob) + return + + proc/activate() + return + + proc/implanted(source as mob) + return + + proc/get_data() + return + + proc/hear(message, source as mob) + return trigger(emote, source as mob) return + activate() return @@ -37,6 +46,7 @@ implanted(source as mob) return + get_data() return "No information available" @@ -48,9 +58,8 @@ /obj/item/weapon/implant/uplink name = "uplink implant" desc = "A micro-telecrystal implant which allows for instant transportation of equipment." - var - activation_emote = "chuckle" - obj/item/device/uplink/radio/uplink = null + var/activation_emote = "chuckle" + var/obj/item/device/uplink/radio/uplink = null New() @@ -77,8 +86,7 @@ /obj/item/weapon/implant/tracking name = "tracking implant" desc = "An implant which relays information to the appropriate tracking computer." - var - id = 1.0 + var/id = 1.0 get_data() diff --git a/code/game/objects/items/weapons/paint.dm b/code/game/objects/items/weapons/paint.dm index 3e92b39a56a..e41e65e6eee 100644 --- a/code/game/objects/items/weapons/paint.dm +++ b/code/game/objects/items/weapons/paint.dm @@ -63,14 +63,13 @@ var/global/list/cached_icons = list() remover paint_type = "remover" - /* /obj/item/weapon/paint name = "Paint Can" desc = "Used to recolor floors and walls. Can not be removed by the janitor." icon = 'items.dmi' icon_state = "paint_neutral" - var/color = "FFFFFF" + color = "FFFFFF" item_state = "paintcan" w_class = 3.0 diff --git a/code/game/objects/radio/headset.dm b/code/game/objects/radio/headset.dm index b0e18b3769a..a2f5e140144 100644 --- a/code/game/objects/radio/headset.dm +++ b/code/game/objects/radio/headset.dm @@ -6,7 +6,6 @@ g_amt = 0 m_amt = 75 subspace_transmission = 1 - protective_temperature = 0 canhear_range = 1 // can't hear headsets from very far away slot_flags = SLOT_EARS diff --git a/code/modules/DetectiveWork/detective_work.dm b/code/modules/DetectiveWork/detective_work.dm index 55a18aa3e34..7d5f0fc246d 100644 --- a/code/modules/DetectiveWork/detective_work.dm +++ b/code/modules/DetectiveWork/detective_work.dm @@ -3,10 +3,11 @@ atom/var/list/suit_fibers atom/proc/add_fibers(mob/living/carbon/human/M) - if(M.gloves) - if(M.gloves.transfer_blood) //bloodied gloves transfer blood to touched objects - if(add_blood(M.gloves.bloody_hands_mob)) //only reduces the bloodiness of our gloves if the item wasn't already bloody - M.gloves.transfer_blood-- + if(M.gloves && istype(M.gloves,/obj/item/clothing/)) + var/obj/item/clothing/gloves/G = M.gloves + if(G.transfer_blood) //bloodied gloves transfer blood to touched objects + if(add_blood(G.bloody_hands_mob)) //only reduces the bloodiness of our gloves if the item wasn't already bloody + G.transfer_blood-- else if(M.bloody_hands) if(add_blood(M.bloody_hands_mob)) M.bloody_hands-- @@ -613,10 +614,11 @@ turf/Exited(mob/living/carbon/human/M) M.track_blood-- src.add_bloody_footprints(M.track_blood_mob,1,M.dir,get_tracks(M),M.track_blood_type) else if(istype(M,/mob/living/carbon/human)) - if(M.shoes) - if(M.shoes.track_blood > 0) - M.shoes.track_blood-- - src.add_bloody_footprints(M.shoes.track_blood_mob,1,M.dir,M.shoes.name,M.shoes.track_blood_type) // And bloody tracks end here + if(M.shoes && istype(M.shoes,/obj/item/clothing/shoes)) + var/obj/item/clothing/shoes/S = M.shoes + if(S.track_blood > 0) + S.track_blood-- + src.add_bloody_footprints(S.track_blood_mob,1,M.dir,S.name,S.track_blood_type) // And bloody tracks end here . = ..() turf/Entered(mob/living/carbon/human/M) if(istype(M,/mob/living) && !istype(M,/mob/living/carbon/metroid)) @@ -631,10 +633,11 @@ turf/Entered(mob/living/carbon/human/M) M.track_blood-- src.add_bloody_footprints(M.track_blood_mob,0,M.dir,get_tracks(M),M.track_blood_type) else if(istype(M,/mob/living/carbon/human)) - if(M.shoes && !istype(src,/turf/space)) - if(M.shoes.track_blood > 0) - M.shoes.track_blood-- - src.add_bloody_footprints(M.shoes.track_blood_mob,0,M.dir,M.shoes.name,M.shoes.track_blood_type) + if(M.shoes && istype(M.shoes,/obj/item/clothing/shoes) && !istype(src,/turf/space)) + var/obj/item/clothing/shoes/S = M.shoes + if(S.track_blood > 0) + S.track_blood-- + src.add_bloody_footprints(S.track_blood_mob,0,M.dir,S.name,S.track_blood_type) for(var/obj/effect/decal/cleanable/B in src) @@ -649,11 +652,12 @@ turf/Entered(mob/living/carbon/human/M) track_type = "oil" if(istype(M,/mob/living/carbon/human)) - if(M.shoes) - M.shoes.add_blood(B.blood_owner) - M.shoes.track_blood_mob = B.blood_owner - M.shoes.track_blood = max(M.shoes.track_blood,8) - M.shoes.track_blood_type = track_type + if(M.shoes && istype(M.shoes,/obj/item/clothing/shoes)) + var/obj/item/clothing/shoes/S = M.shoes + S.add_blood(B.blood_owner) + S.track_blood_mob = B.blood_owner + S.track_blood = max(S.track_blood,8) + S.track_blood_type = track_type else M.add_blood(B.blood_owner) M.track_blood_mob = B.blood_owner diff --git a/code/modules/clothing/head/hats.dm b/code/modules/clothing/head/hats.dm index f600c2cc011..8f3e4aaafe2 100644 --- a/code/modules/clothing/head/hats.dm +++ b/code/modules/clothing/head/hats.dm @@ -4,7 +4,6 @@ icon = 'hats.dmi' body_parts_covered = HEAD slot_flags = SLOT_HEAD - var/list/allowed = list() /obj/item/clothing/head/cakehat name = "cake-hat" diff --git a/code/modules/clothing/suit.dm b/code/modules/clothing/suit.dm index 67d8cb22680..8156dc337d8 100644 --- a/code/modules/clothing/suit.dm +++ b/code/modules/clothing/suit.dm @@ -3,6 +3,6 @@ name = "suit" var/fire_resist = T0C+100 flags = FPRINT | TABLEPASS - var/list/allowed = list(/obj/item/weapon/tank/emergency_oxygen) + allowed = list(/obj/item/weapon/tank/emergency_oxygen) armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) slot_flags = SLOT_OCLOTHING diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index bd1da4e2990..0ded1e87667 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -601,11 +601,12 @@ ..() - if(M.gloves) - if(M.gloves.cell) + if(M.gloves && istype(M.gloves,/obj/item/clothing/gloves)) + var/obj/item/clothing/gloves/G = M.gloves + if(G.cell) if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. - if(M.gloves.cell.charge >= 2500) - M.gloves.cell.charge -= 2500 + if(G.cell.charge >= 2500) + G.cell.charge -= 2500 Weaken(5) if (stuttering < 5) diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 5e0a8156a7b..fd53c50f56d 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -367,11 +367,12 @@ ..() - if(M.gloves) - if(M.gloves.cell) + if(M.gloves && istype(M.gloves,/obj/item/clothing/gloves)) + var/obj/item/clothing/gloves/G = M.gloves + if(G.cell) if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. - if(M.gloves.cell.charge >= 2500) - M.gloves.cell.charge -= 2500 + if(G.cell.charge >= 2500) + G.cell.charge -= 2500 Weaken(5) if (stuttering < 5) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 271c6613e5c..26767b93681 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -27,19 +27,19 @@ var/list/skills = null // var/b_type - var/obj/item/clothing/suit/wear_suit = null - var/obj/item/clothing/under/w_uniform = null - var/obj/item/clothing/shoes/shoes = null - var/obj/item/weapon/belt = null - var/obj/item/clothing/gloves/gloves = null - var/obj/item/clothing/glasses/glasses = null - var/obj/item/clothing/head/head = null - var/obj/item/clothing/ears/l_ear = null - var/obj/item/clothing/ears/r_ear = null + var/obj/item/wear_suit = null + var/obj/item/w_uniform = null + var/obj/item/shoes = null + var/obj/item/belt = null + var/obj/item/gloves = null + var/obj/item/glasses = null + var/obj/item/head = null + var/obj/item/l_ear = null + var/obj/item/r_ear = null var/obj/item/weapon/card/id/wear_id = null - var/obj/item/weapon/r_store = null - var/obj/item/weapon/l_store = null - var/obj/item/weapon/s_store = null + var/obj/item/r_store = null + var/obj/item/l_store = null + var/obj/item/s_store = null var/icon/stand_icon = null var/icon/lying_icon = null diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 0e4eef42825..55f60c1555a 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -9,11 +9,13 @@ visible_message("\red [M] attempted to touch [src]!") return 0 - if(M.gloves) - if(M.gloves.cell) - if(M.a_intent == "hurt") - if(M.gloves.cell.charge >= 2500) - M.gloves.cell.charge -= 2500 + + if(M.gloves && istype(M.gloves,/obj/item/clothing/gloves)) + var/obj/item/clothing/gloves/G = M.gloves + if(G.cell) + if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. + if(G.cell.charge >= 2500) + G.cell.charge -= 2500 visible_message("\red [src] has been touched with the stun gloves by [M]!") M.attack_log += text("\[[time_stamp()]\] Stungloved [src.name] ([src.ckey])") src.attack_log += text("\[[time_stamp()]\] Has been stungloved by [M.name] ([M.ckey])") diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index df20678c13d..ead97f7ece0 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -153,10 +153,11 @@ emp_act if(H.wear_suit) H.wear_suit.add_blood(src) else if(H.w_uniform) H.w_uniform.add_blood(src) if(H.shoes) H.shoes.add_blood(src) - if (H.gloves) - H.gloves.add_blood(H) - H.gloves.transfer_blood = 2 - H.gloves.bloody_hands_mob = H + if (H.gloves && istype(H.gloves,/obj/item/clothing/gloves)) + var/obj/item/clothing/gloves/G = H.gloves + G.add_blood(H) + G.transfer_blood = 2 + G.bloody_hands_mob = H else H.add_blood(H) H.bloody_hands = 2 diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 4e705911348..df90a16d75f 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1334,8 +1334,20 @@ else blind.layer = 0 - if ((disabilities & 1 && ((glasses && !glasses.prescription) || !glasses)) || (glasses && glasses.prescription && !(disabilities & 1))) - client.screen += hud_used.vimpaired + if(disabilities & 1) + if(!glasses) + client.screen += hud_used.vimpaired + else if (glasses && istype(glasses,/obj/item/clothing/glasses)) + var/obj/item/clothing/glasses/G = glasses + if(!G.prescription) + client.screen += hud_used.vimpaired + else + client.screen += hud_used.vimpaired + else + if(glasses && istype(glasses,/obj/item/clothing/glasses)) + var/obj/item/clothing/glasses/G = glasses + if(G.prescription) + client.screen += hud_used.vimpaired if (eye_blurry) client.screen += hud_used.blurry diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index 912b88aa8c4..85590d06d21 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -384,7 +384,7 @@ for(var/mob/O in viewers(src, null)) if ((O.client && !( O.blinded ))) O.show_message(text("\red [M.name] has bit [src]!"), 1) - bruteloss += rand(1, 3) + adjustBruteLoss(rand(1, 3)) updatehealth() return @@ -463,11 +463,13 @@ - if(M.gloves) - if(M.gloves.cell) + + if(M.gloves && istype(M.gloves,/obj/item/clothing/gloves)) + var/obj/item/clothing/gloves/G = M.gloves + if(G.cell) if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. - if(M.gloves.cell.charge >= 2500) - M.gloves.cell.charge -= 2500 + if(G.cell.charge >= 2500) + G.cell.charge -= 2500 for(var/mob/O in viewers(src, null)) if ((O.client && !( O.blinded ))) O.show_message("\red [src] has been touched with the stun gloves by [M]!", 1, "\red You hear someone fall.", 2) diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 688ad10eafc..ad85a5e6d0c 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -210,11 +210,13 @@ if (istype(loc, /turf) && istype(loc.loc, /area/start)) M << "No attacking people at spawn, you jackass." return - if(M.gloves) - if(M.gloves.cell) - if(M.a_intent == "hurt") - if(M.gloves.cell.charge >= 2500) - M.gloves.cell.charge -= 2500 + + if(M.gloves && istype(M.gloves,/obj/item/clothing/gloves)) + var/obj/item/clothing/gloves/G = M.gloves + if(G.cell) + if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. + if(G.cell.charge >= 2500) + G.cell.charge -= 2500 Weaken(5) if (stuttering < 5) stuttering = 5 diff --git a/code/modules/paperwork/stamps.dm b/code/modules/paperwork/stamps.dm index 18a5e9e2feb..60a34babe83 100644 --- a/code/modules/paperwork/stamps.dm +++ b/code/modules/paperwork/stamps.dm @@ -10,7 +10,7 @@ throw_speed = 7 throw_range = 15 m_amt = 60 - var/color = "cargo" + color = "cargo" pressure_resistance = 5 /obj/item/weapon/stamp/captain