From deb60ae3093c85e71cddb45b4d7abd680c0a1f27 Mon Sep 17 00:00:00 2001 From: xxalpha Date: Thu, 24 Sep 2015 03:08:28 +0100 Subject: [PATCH] Replaced /proc/is_sharp() with /obj/item/proc/is_sharp(). --- code/__DEFINES/misc.dm | 7 +++- code/__HELPERS/unsorted.dm | 37 +------------------ code/game/objects/items.dm | 4 ++ .../game/objects/items/stacks/sheets/glass.dm | 1 + code/game/objects/items/weapons/kitchen.dm | 1 + .../objects/items/weapons/melee/energy.dm | 4 ++ code/game/objects/items/weapons/twohanded.dm | 2 + code/game/objects/items/weapons/weaponry.dm | 1 + code/modules/clothing/glasses/glasses.dm | 11 ++++-- code/modules/clothing/glasses/hud.dm | 1 + code/modules/events/spacevine.dm | 2 +- .../food&drinks/drinks/drinks/bottle.dm | 1 + code/modules/food&drinks/food/snacks.dm | 10 ++--- code/modules/hydroponics/grown.dm | 2 +- code/modules/hydroponics/growninedible.dm | 2 +- code/modules/hydroponics/hydroitemdefines.dm | 1 + code/modules/mining/mine_items.dm | 1 + .../mob/living/simple_animal/simple_animal.dm | 2 +- code/modules/surgery/tools.dm | 2 + 19 files changed, 42 insertions(+), 50 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 9c9d1da8b9d..53b9724d1ac 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -267,4 +267,9 @@ var/list/bloody_footprints_cache = list() //Turf wet states #define TURF_DRY 0 #define TURF_WET_WATER 1 -#define TURF_WET_LUBE 2 \ No newline at end of file +#define TURF_WET_LUBE 2 + +//Object/Item sharpness +#define IS_BLUNT 0 +#define IS_SHARP 1 +#define IS_SHARP_ACCURATE 2 \ No newline at end of file diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index cb817850ac4..3f60c75d796 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1158,41 +1158,6 @@ var/global/list/common_tools = list( else return 0 -//Is this even used for anything besides balloons? Yes I took out the W:lit stuff because : really shouldnt be used. -/proc/is_sharp(obj/item/W) // For the record, WHAT THE HELL IS THIS METHOD OF DOING IT? - var/list/sharp_things_1 = list(\ - /obj/item/weapon/circular_saw,\ - /obj/item/weapon/shovel,\ - /obj/item/weapon/shard,\ - /obj/item/weapon/broken_bottle,\ - /obj/item/weapon/twohanded/fireaxe,\ - /obj/item/weapon/hatchet,\ - /obj/item/weapon/throwing_star,\ - /obj/item/clothing/glasses/sunglasses/garb,\ - /obj/item/clothing/glasses/sunglasses/gar,\ - /obj/item/clothing/glasses/hud/security/sunglasses/gars,\ - /obj/item/clothing/glasses/meson/gar,\ - /obj/item/weapon/twohanded/spear,\ - /obj/item/weapon/melee/energy/sword/cyborg/saw) - - //Because is_sharp is used for food or something. - var/list/sharp_things_2 = list(\ - /obj/item/weapon/kitchen/knife,\ - /obj/item/weapon/scalpel) - - if(is_type_in_list(W,sharp_things_1)) - return 1 - - if(is_type_in_list(W,sharp_things_2)) - return 2 //cutting food - - if(istype(W, /obj/item/weapon/melee/energy)) - var/obj/item/weapon/melee/energy/E = W - if(E.active) - return 1 - else - return 0 - /proc/is_pointed(obj/item/W) if(istype(W, /obj/item/weapon/pen)) return 1 @@ -1208,7 +1173,7 @@ var/global/list/common_tools = list( //For objects that should embed, but make no sense being is_sharp or is_pointed() //e.g: rods /proc/can_embed(obj/item/W) - if(is_sharp(W)) + if(W.is_sharp()) return 1 if(is_pointed(W)) return 1 diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index c3f7d22fe8a..9b25f1515f5 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -89,6 +89,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s ) var/flags_cover = 0 //for flags such as GLASSESCOVERSEYES + var/sharpness = IS_BLUNT /obj/item/proc/check_allowed_items(atom/target, not_inside, target_self) if(((src in target) && !target_self) || ((!istype(target.loc, /turf)) && (!istype(target, /turf)) && (not_inside)) || is_type_in_list(target, can_be_placed_into)) @@ -494,3 +495,6 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s S.remove_from_storage(src,newLoc) return 1 return 0 + +/obj/item/proc/is_sharp() + return sharpness \ No newline at end of file diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index ea30f89c7b5..fc922adb1fb 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -268,6 +268,7 @@ attack_verb = list("stabbed", "slashed", "sliced", "cut") hitsound = 'sound/weapons/bladeslice.ogg' var/cooldown = 0 + sharpness = IS_SHARP /obj/item/weapon/shard/suicide_act(mob/user) user.visible_message(pick("[user] is slitting \his wrists with the shard of glass! It looks like \he's trying to commit suicide.", \ diff --git a/code/game/objects/items/weapons/kitchen.dm b/code/game/objects/items/weapons/kitchen.dm index 510371f094f..15893990d48 100644 --- a/code/game/objects/items/weapons/kitchen.dm +++ b/code/game/objects/items/weapons/kitchen.dm @@ -61,6 +61,7 @@ materials = list(MAT_METAL=12000) origin_tech = "materials=1" attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") + sharpness = IS_SHARP_ACCURATE /obj/item/weapon/kitchen/knife/suicide_act(mob/user) user.visible_message(pick("[user] is slitting \his wrists with the [src.name]! It looks like \he's trying to commit suicide.", \ diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index 4e2fe6f2ae3..16f8e6768ad 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -15,6 +15,9 @@ /obj/item/weapon/melee/energy/rejects_blood() return 1 +/obj/item/weapon/melee/energy/is_sharp() + return active * sharpness + /obj/item/weapon/melee/energy/axe name = "energy axe" desc = "An energised battle axe." @@ -117,6 +120,7 @@ hitcost = 75 //Costs more because it's not intended to be a murderbone weapon item_color = null w_class = 3 + sharpness = IS_SHARP /obj/item/weapon/melee/energy/sword/cyborg/saw/New() ..() diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 06285181170..02a2971ef92 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -162,6 +162,7 @@ force_wielded = 24 // Was 18, Buffed - RobRichards/RR attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut") hitsound = 'sound/weapons/bladeslice.ogg' + sharpness = IS_SHARP /obj/item/weapon/twohanded/fireaxe/update_icon() //Currently only here to fuck with the on-mob icons. icon_state = "fireaxe[wielded]" @@ -301,6 +302,7 @@ flags = NOSHIELD hitsound = 'sound/weapons/bladeslice.ogg' attack_verb = list("attacked", "poked", "jabbed", "torn", "gored") + sharpness = IS_SHARP /obj/item/weapon/twohanded/spear/update_icon() icon_state = "spearglass[wielded]" diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm index 85a24a4155d..a1d88f2a246 100644 --- a/code/game/objects/items/weapons/weaponry.dm +++ b/code/game/objects/items/weapons/weaponry.dm @@ -146,6 +146,7 @@ w_class = 2 embed_chance = 100 embedded_fall_chance = 0 //Hahaha! + sharpness = IS_SHARP //5*(2*4) = 5*8 = 45, 45 damage if you hit one person with all 5 stars. //Not counting the damage it will do while embedded (2*4 = 8, at 15% chance) diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 4de50095af8..4c62bffe9dc 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -29,6 +29,7 @@ throw_speed = 4 attack_verb = list("sliced") hitsound = 'sound/weapons/bladeslice.ogg' + sharpness = IS_SHARP /obj/item/clothing/glasses/science name = "Science Goggles" @@ -103,6 +104,7 @@ throw_speed = 4 attack_verb = list("sliced") hitsound = 'sound/weapons/bladeslice.ogg' + sharpness = IS_SHARP /obj/item/clothing/glasses/sunglasses/garb/supergarb desc = "Believe in us humans." @@ -122,6 +124,7 @@ throw_speed = 4 attack_verb = list("sliced") hitsound = 'sound/weapons/bladeslice.ogg' + sharpness = IS_SHARP /obj/item/clothing/glasses/sunglasses/gar/supergar desc = "We evolve past the person we were a minute before. Little by little we advance with each turn. That's how a drill works!" @@ -247,7 +250,7 @@ name = "sunglasses" icon_state = "sun" item_state = "sunglasses" - if("Medical HUD") + if("Medical HUD") name = "Health Scanner HUD" desc = "A heads-up display that scans the humans in view and provides accurate data about their health status." icon_state = "healthhud" @@ -257,11 +260,11 @@ desc = "Used by engineering and mining staff to see basic structural and terrain layouts through walls, regardless of lighting condition." icon_state = "meson" item_state = "meson" - if("Science Goggles") + if("Science Goggles") name = "Science Goggles" desc = "A pair of snazzy goggles used to protect against chemical spills." icon_state = "purple" - item_state = "glasses" + item_state = "glasses" if("Glasses") name = "Prescription Glasses" desc = "Made by Nerd. Co." @@ -287,4 +290,4 @@ name = "gar glasses" icon_state = "gar" item_state = "gar" - + diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index c6ac3201107..be1957c3931 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -85,6 +85,7 @@ throw_speed = 4 attack_verb = list("sliced") hitsound = 'sound/weapons/bladeslice.ogg' + sharpness = IS_SHARP /obj/item/clothing/glasses/hud/security/sunglasses/gars/supergars name = "giga HUD gar glasses" diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 1cb5307147c..cfa875551df 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -362,7 +362,7 @@ qdel(B) qdel(src) - else if(is_sharp(W)) + else if(W.is_sharp()) qdel(src) else if(istype(W, /obj/item/weapon/weldingtool)) diff --git a/code/modules/food&drinks/drinks/drinks/bottle.dm b/code/modules/food&drinks/drinks/drinks/bottle.dm index ddbd708c367..d9f66a0052a 100644 --- a/code/modules/food&drinks/drinks/drinks/bottle.dm +++ b/code/modules/food&drinks/drinks/drinks/bottle.dm @@ -144,6 +144,7 @@ hitsound = 'sound/weapons/bladeslice.ogg' attack_verb = list("stabbed", "slashed", "attacked") var/icon/broken_outline = icon('icons/obj/drinks.dmi', "broken") + sharpness = IS_SHARP /obj/item/weapon/reagent_containers/food/drinks/bottle/gin name = "Griffeater Gin" diff --git a/code/modules/food&drinks/food/snacks.dm b/code/modules/food&drinks/food/snacks.dm index 326387e3971..e4a790d5404 100644 --- a/code/modules/food&drinks/food/snacks.dm +++ b/code/modules/food&drinks/food/snacks.dm @@ -150,9 +150,9 @@ var/obj/item/weapon/reagent_containers/food/snacks/customizable/C = new custom_food_type(get_turf(src)) C.initialize_custom_food(src, S, user) return 0 - if(is_sharp(W)) - var/sharpness = is_sharp(W) - if(slice(sharpness, W, user)) + var/sharp = W.is_sharp() + if(sharp) + if(slice(sharp, W, user)) return 1 //Called when you finish tablecrafting a snack. @@ -176,7 +176,7 @@ return 1 var/slices_lost = 0 - if (accuracy > 1) + if (accuracy >= IS_SHARP_ACCURATE) user.visible_message( \ "[user] slices [src].", \ "You slice [src]." \ @@ -278,7 +278,7 @@ /obj/item/weapon/reagent_containers/food/snacks/store/attackby(obj/item/weapon/W, mob/user, params) ..() if(W.w_class <= 2 & !istype(W, /obj/item/weapon/reagent_containers/food/snacks)) //can't slip snacks inside, they're used for custom foods. - if(is_sharp(W)) + if(W.is_sharp()) return 0 if(stored_item) return 0 diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index daf06bb781f..3723a221dab 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -487,7 +487,7 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/pumpkin/attackby(obj/item/weapon/W as obj, mob/user as mob, params) ..() - if(is_sharp(W)) + if(W.is_sharp()) user.show_message("You carve a face into [src]!", 1) new /obj/item/clothing/head/hardhat/pumpkinhead (user.loc) qdel(src) diff --git a/code/modules/hydroponics/growninedible.dm b/code/modules/hydroponics/growninedible.dm index 129f099be22..e016b244338 100644 --- a/code/modules/hydroponics/growninedible.dm +++ b/code/modules/hydroponics/growninedible.dm @@ -302,7 +302,7 @@ /obj/item/weapon/grown/corncob/attackby(obj/item/weapon/grown/W, mob/user, params) ..() - if(is_sharp(W)) + if(W.is_sharp()) user << "You use [W] to fashion a pipe out of the corn cob!" new /obj/item/clothing/mask/cigarette/pipe/cobpipe (user.loc) user.unEquip(src) diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm index a2c5a001a3e..6e5a45843d4 100644 --- a/code/modules/hydroponics/hydroitemdefines.dm +++ b/code/modules/hydroponics/hydroitemdefines.dm @@ -87,6 +87,7 @@ origin_tech = "materials=2;combat=1" attack_verb = list("chopped", "torn", "cut") hitsound = 'sound/weapons/bladeslice.ogg' + sharpness = IS_SHARP /obj/item/weapon/hatchet/suicide_act(mob/user) user.visible_message("[user] is chopping at \himself with the [src.name]! It looks like \he's trying to commit suicide.") diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index ca013ea9fc3..976a019913c 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -136,6 +136,7 @@ materials = list(MAT_METAL=50) origin_tech = "materials=1;engineering=1" attack_verb = list("bashed", "bludgeoned", "thrashed", "whacked") + sharpness = IS_SHARP /obj/item/weapon/shovel/spade name = "spade" diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 36055b70011..b772a616808 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -366,7 +366,7 @@ if((butcher_results) && (stat == DEAD)) user.changeNext_move(CLICK_CD_MELEE) - var/sharpness = is_sharp(O) + var/sharpness = O.is_sharp() if(sharpness) user << "You begin to butcher [src]..." playsound(loc, 'sound/weapons/slice.ogg', 50, 1, -1) diff --git a/code/modules/surgery/tools.dm b/code/modules/surgery/tools.dm index 7186a9b1365..d783434c582 100644 --- a/code/modules/surgery/tools.dm +++ b/code/modules/surgery/tools.dm @@ -61,6 +61,7 @@ origin_tech = "materials=1;biotech=1" attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") hitsound = 'sound/weapons/bladeslice.ogg' + sharpness = IS_SHARP_ACCURATE /obj/item/weapon/scalpel/suicide_act(mob/user) user.visible_message(pick("[user] is slitting \his wrists with [src]! It looks like \he's trying to commit suicide.", \ @@ -85,6 +86,7 @@ materials = list(MAT_METAL=10000, MAT_GLASS=6000) origin_tech = "materials=1;biotech=1" attack_verb = list("attacked", "slashed", "sawed", "cut") + sharpness = IS_SHARP /obj/item/weapon/surgical_drapes name = "surgical drapes"