Merge pull request #10101 from mwerezak/shards

Refactors obj flags and changes defined bitflag representation
This commit is contained in:
Chinsky
2015-08-20 19:47:58 +03:00
94 changed files with 1593 additions and 582 deletions
+2 -2
View File
@@ -198,11 +198,11 @@ steam.start() -- spawns the effect
if (istype(M))
return 0
if (M.internal != null)
if(M.wear_mask && (M.wear_mask.flags & AIRTIGHT))
if(M.wear_mask && (M.wear_mask.item_flags & AIRTIGHT))
return 0
if(istype(M,/mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(H.head && (H.head.flags & AIRTIGHT))
if(H.head && (H.head.item_flags & AIRTIGHT))
return 0
return 0
return 1
+12 -10
View File
@@ -25,9 +25,13 @@
var/action_button_name //It is also the text which gets displayed on the action button. If not set it defaults to 'Use [name]'. If it's not set, there'll be no button.
var/action_button_is_hands_free = 0 //If 1, bypass the restrained, lying, and stunned checks action buttons normally test for
//Since any item can now be a piece of clothing, this has to be put here so all items share it.
var/flags_inv //This flag is used to determine when items in someone's inventory cover others. IE helmets making it so you can't see glasses, etc.
//This flag is used to determine when items in someone's inventory cover others. IE helmets making it so you can't see glasses, etc.
//It should be used purely for appearance. For gameplay effects caused by items covering body parts, use body_parts_covered.
var/flags_inv = 0
var/body_parts_covered = 0 //see setup.dm for appropriate bit flags
var/item_flags = 0 //Miscellaneous flags pertaining to equippable objects.
//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
@@ -418,14 +422,12 @@ var/list/global/slot_flags_enumeration = list(
/obj/item/proc/eyestab(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
var/mob/living/carbon/human/H = M
if(istype(H) && ( \
(H.head && H.head.flags & HEADCOVERSEYES) || \
(H.wear_mask && H.wear_mask.flags & MASKCOVERSEYES) || \
(H.glasses && H.glasses.flags & GLASSESCOVERSEYES) \
))
// you can't stab someone in the eyes wearing a mask!
user << "<span class='warning'>You're going to need to remove the eye covering first.</span>"
return
if(istype(H))
for(var/obj/item/protection in list(H.head, H.wear_mask, H.glasses))
if(protection && (protection.body_parts_covered & EYES))
// you can't stab someone in the eyes wearing a mask!
user << "<span class='warning'>You're going to need to remove the eye covering first.</span>"
return
if(!M.has_eyes())
user << "<span class='warning'>You cannot locate any eyes on [M]!</span>"
@@ -51,7 +51,7 @@
var/mob/living/carbon/human/H = M //mob has protective eyewear
if(istype(H))
for(var/obj/item/clothing/C in list(H.head,H.wear_mask,H.glasses))
if(istype(C) && C.flags & (HEADCOVERSEYES|MASKCOVERSEYES|GLASSESCOVERSEYES))
if(istype(C) && (C.body_parts_covered & EYES))
user << "<span class='warning'>You're going to need to remove [C.name] first.</span>"
return
-1
View File
@@ -344,7 +344,6 @@
item_state = "sword0"
var/active = 0.0
w_class = 2.0
flags = NOSHIELD
attack_verb = list("attacked", "struck", "hit")
attack_self(mob/user as mob)
@@ -61,7 +61,6 @@
throw_speed = 1
throw_range = 3
w_class = 4
flags = NOSHIELD
slot_flags = SLOT_BACK
origin_tech = "materials=2;combat=2"
attack_verb = list("chopped", "sliced", "cut", "reaped")
@@ -61,8 +61,14 @@
return ..()
/obj/item/weapon/material/shard/Crossed(AM as mob|obj)
..()
if(ismob(AM))
var/mob/M = AM
if(M.buckled) //wheelchairs, office chairs, rollerbeds
return
M << "<span class='danger'>You step on \the [src]!</span>"
playsound(src.loc, 'sound/effects/glass_step.ogg', 50, 1) // not sure how to handle metal shards with sounds
if(ishuman(M))
@@ -71,18 +77,24 @@
if(H.species.siemens_coefficient<0.5) //Thick skin.
return
if( !H.shoes && ( !H.wear_suit || !(H.wear_suit.body_parts_covered & FEET) ) )
var/obj/item/organ/external/affecting = H.get_organ(pick("l_foot", "r_foot"))
if(!affecting)
if( H.shoes || ( H.wear_suit && (H.wear_suit.body_parts_covered & FEET) ) )
return
var/list/check = list("l_foot", "r_foot")
while(check.len)
var/picked = pick(check)
var/obj/item/organ/external/affecting = H.get_organ(picked)
if(affecting)
if(affecting.status & ORGAN_ROBOT)
return
if(affecting.take_damage(5, 0))
H.UpdateDamageIcon()
H.updatehealth()
if(!(H.species.flags & NO_PAIN))
H.Weaken(3)
return
if(affecting.status & ORGAN_ROBOT)
return
if(affecting.take_damage(5, 0))
H.UpdateDamageIcon()
H.updatehealth()
if(!(H.species && (H.species.flags & NO_PAIN)))
H.Weaken(3)
..()
check -= picked
return
// Preset types - left here for the code that uses them
/obj/item/weapon/material/shard/shrapnel/New(loc)
@@ -187,7 +187,6 @@
force_wielded = 30
wieldsound = 'sound/weapons/saberon.ogg'
unwieldsound = 'sound/weapons/saberoff.ogg'
flags = NOSHIELD
origin_tech = list(TECH_MAGNET = 3, TECH_ILLEGAL = 4)
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
sharp = 1
@@ -228,7 +227,6 @@
throw_speed = 3
edge = 1
sharp = 1
flags = NOSHIELD
hitsound = 'sound/weapons/bladeslice.ogg'
attack_verb = list("attacked", "poked", "jabbed", "torn", "gored")
default_material = "glass"
@@ -74,7 +74,7 @@
throw_speed = 1
throw_range = 5
w_class = 3
flags = CONDUCT | NOSHIELD | NOBLOODY
flags = CONDUCT | NOBLOODY
origin_tech = list(TECH_MAGNET = 3, TECH_COMBAT = 4)
attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut")
sharp = 1
@@ -110,7 +110,7 @@
throw_speed = 1
throw_range = 5
w_class = 2
flags = NOSHIELD | NOBLOODY
flags = NOBLOODY
origin_tech = list(TECH_MAGNET = 3, TECH_ILLEGAL = 4)
sharp = 1
edge = 1
@@ -181,7 +181,7 @@
throw_speed = 1
throw_range = 1
w_class = 4.0//So you can't hide it in your pocket or some such.
flags = NOSHIELD | NOBLOODY
flags = NOBLOODY
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
var/mob/living/creator
var/datum/effect/effect/system/spark_spread/spark_system
@@ -144,11 +144,11 @@
mask_check = 1
if(mask_check)
if(location.wear_mask && (location.wear_mask.flags & AIRTIGHT))
if(location.wear_mask && (location.wear_mask.item_flags & AIRTIGHT))
data["maskConnected"] = 1
else if(istype(location, /mob/living/carbon/human))
var/mob/living/carbon/human/H = location
if(H.head && (H.head.flags & AIRTIGHT))
if(H.head && (H.head.item_flags & AIRTIGHT))
data["maskConnected"] = 1
// update the ui if it exists, returns null if no ui is passed/found
@@ -192,11 +192,11 @@
else
var/can_open_valve
if(location.wear_mask && (location.wear_mask.flags & AIRTIGHT))
if(location.wear_mask && (location.wear_mask.item_flags & AIRTIGHT))
can_open_valve = 1
else if(istype(location,/mob/living/carbon/human))
var/mob/living/carbon/human/H = location
if(H.head && (H.head.flags & AIRTIGHT))
if(H.head && (H.head.item_flags & AIRTIGHT))
can_open_valve = 1
if(can_open_valve)
+8 -1
View File
@@ -73,7 +73,14 @@
return
if(istype(M, /mob/living/carbon/human) && ((H.head && H.head.flags & HEADCOVERSEYES) || (H.wear_mask && H.wear_mask.flags & MASKCOVERSEYES) || (H.glasses && H.glasses.flags & GLASSESCOVERSEYES)))
var/protected = 0
for(var/slot in list(slot_head, slot_wear_mask, slot_glasses))
var/obj/item/protection = M.get_equipped_item(slot)
if(istype(protection) && (protection.body_parts_covered & FACE))
protected = 1
break
if(protected)
M << "<span class='warning'>You get slammed in the face with the tray, against your mask!</span>"
if(prob(33))
src.add_blood(H)
@@ -8,7 +8,7 @@
/obj/structure/undies_wardrobe/attack_hand(mob/user as mob)
src.add_fingerprint(user)
var/mob/living/carbon/human/H = user
if(!ishuman(user) || (H.species && !(H.species.flags & HAS_UNDERWEAR)))
if(!ishuman(user) || (H.species && !(H.species.appearance_flags & HAS_UNDERWEAR)))
user << "<span class='warning'>Sadly there's nothing in here for you to wear.</span>"
return 0