Merge pull request #4858 from mwerezak/webbing

Storage and Clothing/Accessory Changes and Cleanup
This commit is contained in:
Chinsky
2014-05-01 03:38:19 +04:00
19 changed files with 387 additions and 441 deletions
+36 -73
View File
@@ -134,6 +134,7 @@ BLIND // can't see anything
/obj/item/clothing/gloves/emp_act(severity)
if(cell)
//why is this not part of the powercell code?
cell.charge -= 1000 / severity
if (cell.charge < 0)
cell.charge = 0
@@ -151,6 +152,7 @@ BLIND // can't see anything
icon = 'icons/obj/clothing/hats.dmi'
body_parts_covered = HEAD
slot_flags = SLOT_HEAD
w_class = 2.0
//Mask
@@ -186,6 +188,7 @@ BLIND // can't see anything
slot_flags = SLOT_OCLOTHING
var/blood_overlay_type = "suit"
siemens_coefficient = 0.9
w_class = 3
//Spacesuit
//Note: Everything in modules/clothing/spacesuits should have the entire suit grouped together.
@@ -232,6 +235,7 @@ BLIND // can't see anything
flags = FPRINT | TABLEPASS
slot_flags = SLOT_ICLOTHING
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
w_class = 3
var/has_sensor = 1//For the crew computer 2 = unable to change mode
var/sensor_mode = 0
/*
@@ -246,17 +250,14 @@ BLIND // can't see anything
/obj/item/clothing/under/attackby(obj/item/I, mob/user)
if(hastie)
hastie.attackby(I, user)
return
if(!hastie && istype(I, /obj/item/clothing/tie))
user.drop_item()
hastie = I
I.loc = src
user << "<span class='notice'>You attach [I] to [src].</span>"
if (istype(hastie,/obj/item/clothing/tie/holster))
verbs += /obj/item/clothing/under/proc/holster
if (istype(hastie,/obj/item/clothing/tie/storage))
verbs += /obj/item/clothing/under/proc/storage
hastie.attach_to(src, user)
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
@@ -265,6 +266,32 @@ BLIND // can't see anything
return
..()
/obj/item/clothing/under/attack_hand(mob/user as mob)
//only forward to the attached accessory if the clothing is equipped (not in a storage)
if(hastie && src.loc == user)
hastie.attack_hand(user)
return
..()
//This is to allow people to take off suits when there is an attached accessory
/obj/item/clothing/under/MouseDrop(obj/over_object as obj)
if (ishuman(usr) || ismonkey(usr))
//makes sure that the clothing is equipped so that we can't drag it into our hand from miles away.
if (!(src.loc == usr))
return
if (!( usr.restrained() ) && !( usr.stat ))
switch(over_object.name)
if("r_hand")
usr.u_equip(src)
usr.put_in_r_hand(src)
if("l_hand")
usr.u_equip(src)
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
return
return
/obj/item/clothing/under/examine()
set src in view()
@@ -333,16 +360,7 @@ BLIND // can't see anything
if(usr.stat) return
if(hastie)
if (istype(hastie,/obj/item/clothing/tie/holster))
verbs -= /obj/item/clothing/under/proc/holster
if (istype(hastie,/obj/item/clothing/tie/storage))
verbs -= /obj/item/clothing/under/proc/storage
var/obj/item/clothing/tie/storage/W = hastie
if (W.hold)
W.hold.close(usr)
usr.put_in_hands(hastie)
hastie.remove(usr)
hastie = null
if(istype(loc, /mob/living/carbon/human))
@@ -353,59 +371,4 @@ BLIND // can't see anything
sensor_mode = pick(0,1,2,3)
..()
/obj/item/clothing/under/proc/holster()
set name = "Holster"
set category = "Object"
set src in usr
if(!istype(usr, /mob/living)) return
if(usr.stat) return
if (!hastie || !istype(hastie,/obj/item/clothing/tie/holster))
usr << "\red You need a holster for that!"
return
var/obj/item/clothing/tie/holster/H = hastie
if(!H.holstered)
if(!istype(usr.get_active_hand(), /obj/item/weapon/gun))
usr << "\blue You need your gun equiped to holster it."
return
var/obj/item/weapon/gun/W = usr.get_active_hand()
if (!W.isHandgun())
usr << "\red This gun won't fit in \the [H]!"
return
H.holstered = usr.get_active_hand()
usr.drop_item()
H.holstered.loc = src
usr.visible_message("\blue \The [usr] holsters \the [H.holstered].", "You holster \the [H.holstered].")
else
if(istype(usr.get_active_hand(),/obj) && istype(usr.get_inactive_hand(),/obj))
usr << "\red You need an empty hand to draw the gun!"
else
if(usr.a_intent == "hurt")
usr.visible_message("\red \The [usr] draws \the [H.holstered], ready to shoot!", \
"\red You draw \the [H.holstered], ready to shoot!")
else
usr.visible_message("\blue \The [usr] draws \the [H.holstered], pointing it at the ground.", \
"\blue You draw \the [H.holstered], pointing it at the ground.")
usr.put_in_hands(H.holstered)
H.holstered = null
/obj/item/clothing/under/proc/storage()
set name = "Look in storage"
set category = "Object"
set src in usr
if(!istype(usr, /mob/living)) return
if(usr.stat) return
if (!hastie || !istype(hastie,/obj/item/clothing/tie/storage))
usr << "\red You need something to store items in for that!"
return
var/obj/item/clothing/tie/storage/W = hastie
if (!istype(W.hold))
return
W.hold.loc = usr
W.hold.attack_hand(usr)
+1
View File
@@ -11,6 +11,7 @@
heat_protection = HEAD
max_heat_protection_temperature = HELMET_MAX_HEAT_PROTECTION_TEMPERATURE
siemens_coefficient = 0.7
w_class = 3
/obj/item/clothing/head/helmet/warden
name = "warden's hat"
@@ -24,6 +24,7 @@
flags_inv = (HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE)
icon_action_button = "action_welding"
siemens_coefficient = 0.9
w_class = 3
/obj/item/clothing/head/welding/attack_self()
toggle()
@@ -125,6 +126,7 @@
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
var/brightness_on = 2 //luminosity when on
var/on = 0
w_class = 3
attack_self(mob/user)
if(!isturf(user.loc))
@@ -114,12 +114,14 @@
icon_state = "slippers"
item_state = "slippers"
species_restricted = null
w_class = 2
/obj/item/clothing/shoes/slippers_worn
name = "worn bunny slippers"
desc = "Fluffy..."
icon_state = "slippers_worn"
item_state = "slippers_worn"
w_class = 2
/obj/item/clothing/shoes/laceup
name = "laceup shoes"
+5 -1
View File
@@ -206,10 +206,14 @@
user << "You relax your deathgrip on the flooring."
else
//make sure these can only be used when equipped.
if (!is_equipped())
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
if (H.shoes != src)
user << "You will have to put on the [src] before you can do that."
return
flags |= NOSLIP
magpulse = 1
canremove = 0 //kinda hard to take off magclaws when you are gripping them tightly.
+29
View File
@@ -0,0 +1,29 @@
/obj/item/clothing/suit/storage
var/obj/item/weapon/storage/internal/pockets
/obj/item/clothing/suit/storage/New()
..()
pockets = new/obj/item/weapon/storage/internal(src)
pockets.storage_slots = 2 //two slots
pockets.max_w_class = 2 //fit only pocket sized items
pockets.max_combined_w_class = 4
/obj/item/clothing/suit/storage/attack_hand(mob/user as mob)
if (pockets.handle_attack_hand(user))
..(user)
/obj/item/clothing/suit/storage/MouseDrop(obj/over_object as obj)
if (pockets.handle_mousedrop(usr, over_object))
..(over_object)
/obj/item/clothing/suit/storage/attackby(obj/item/W as obj, mob/user as mob)
..()
pockets.attackby(W, user)
/obj/item/clothing/suit/storage/emp_act(severity)
pockets.emp_act(severity)
..()
/obj/item/clothing/suit/storage/hear_talk(mob/M, var/msg)
pockets.hear_talk(M, msg)
..()
+156 -38
View File
@@ -8,6 +8,23 @@
flags = FPRINT | TABLEPASS
slot_flags = 0
w_class = 2.0
var/obj/item/clothing/under/has_suit = null //the suit the tie may be attached to
//when user attached an accessory to S
/obj/item/clothing/tie/proc/attach_to(obj/item/clothing/under/S, mob/user as mob)
if(!istype(S))
return
has_suit = S
loc = has_suit
user << "<span class='notice'>You attach [src] to [has_suit].</span>"
src.add_fingerprint(user)
/obj/item/clothing/tie/proc/remove(mob/user as mob)
if(!has_suit)
return
has_suit = null
usr.put_in_hands(src)
src.add_fingerprint(user)
/obj/item/clothing/tie/blue
name = "blue tie"
@@ -116,7 +133,7 @@
//Armbands
/obj/item/clothing/tie/armband
name = "red armband"
desc = "An fancy red armband!"
desc = "A fancy red armband!"
icon_state = "red"
item_color = "red"
@@ -156,6 +173,7 @@
icon_state = "medgreen"
item_color = "medgreen"
//holsters
/obj/item/clothing/tie/holster
name = "shoulder holster"
desc = "A handgun holster."
@@ -163,6 +181,105 @@
item_color = "holster"
var/obj/item/weapon/gun/holstered = null
//subtypes can override this to specify what can be holstered
/obj/item/clothing/tie/holster/proc/can_holster(obj/item/weapon/gun/W)
return W.isHandgun()
/obj/item/clothing/tie/holster/proc/holster(obj/item/I, mob/user as mob)
if(holstered)
user << "\red There is already a [holstered] holstered here!"
if (!istype(I, /obj/item/weapon/gun))
user << "\red Only guns can be holstered!"
var/obj/item/weapon/gun/W = I
if (!can_holster(W))
user << "\red This [W] won't fit in the [src]!"
return
holstered = W
user.drop_from_inventory(holstered)
holstered.loc = src
holstered.add_fingerprint(user)
user.visible_message("\blue [user] holsters the [holstered].", "You holster the [holstered].")
/obj/item/clothing/tie/holster/proc/unholster(mob/user as mob)
if(!holstered)
return
if(istype(user.get_active_hand(),/obj) && istype(user.get_inactive_hand(),/obj))
user << "\red You need an empty hand to draw the [holstered]!"
else
if(user.a_intent == "hurt")
usr.visible_message("\red [user] draws the [holstered], ready to shoot!", \
"\red You draw the [holstered], ready to shoot!")
else
user.visible_message("\blue [user] draws the [holstered], pointing it at the ground.", \
"\blue You draw the [holstered], pointing it at the ground.")
user.put_in_hands(holstered)
holstered.add_fingerprint(user)
holstered = null
/obj/item/clothing/tie/holster/attack_hand(mob/user as mob)
if (has_suit) //if we are part of a suit
if (holstered)
unholster(user)
return
..(user)
/obj/item/clothing/tie/holster/attackby(obj/item/W as obj, mob/user as mob)
holster(W, user)
/obj/item/clothing/tie/holster/emp_act(severity)
if (holstered)
holstered.emp_act(severity)
..()
/obj/item/clothing/tie/holster/examine()
set src in view()
..()
if (holstered)
usr << "A [holstered] is holstered here."
else
usr << "It is empty."
/obj/item/clothing/tie/holster/attach_to(obj/item/clothing/under/S, mob/user as mob)
..()
has_suit.verbs += /obj/item/clothing/tie/holster/verb/holster_verb
/obj/item/clothing/tie/holster/remove(mob/user as mob)
has_suit.verbs -= /obj/item/clothing/tie/holster/verb/holster_verb
..()
//For the holster hotkey
/obj/item/clothing/tie/holster/verb/holster_verb()
set name = "Holster"
set category = "Object"
set src in usr
if(!istype(usr, /mob/living)) return
if(usr.stat) return
var/obj/item/clothing/tie/holster/H = null
if (istype(src, /obj/item/clothing/tie/holster))
H = src
else if (istype(src, /obj/item/clothing/under))
var/obj/item/clothing/under/S = src
if (S.hastie)
H = S.hastie
if (!H)
usr << "/red Something is very wrong."
if(!H.holstered)
if(!istype(usr.get_active_hand(), /obj/item/weapon/gun))
usr << "\blue You need your gun equiped to holster it."
return
var/obj/item/weapon/gun/W = usr.get_active_hand()
H.holster(W, usr)
else
H.unholster(usr)
/obj/item/clothing/tie/holster/armpit
name = "shoulder holster"
desc = "A worn-out handgun holster. Perfect for concealed carry"
@@ -177,17 +294,43 @@
/obj/item/clothing/tie/storage
name = "load bearing equipment"
desc = "Used to hold things when you don't have enough hands for that."
desc = "Used to hold things when you don't have enough hands."
icon_state = "webbing"
item_color = "webbing"
var/slots = 3
var/obj/item/weapon/storage/pockets/hold
var/obj/item/weapon/storage/internal/hold
/obj/item/clothing/tie/storage/New()
hold = new /obj/item/weapon/storage/pockets(src)
hold.master_item = src
..()
hold = new/obj/item/weapon/storage/internal(src)
hold.storage_slots = slots
/obj/item/clothing/tie/storage/attack_hand(mob/user as mob)
if (has_suit) //if we are part of a suit
hold.open(user)
return
if (hold.handle_attack_hand(user)) //otherwise interact as a regular storage item
..(user)
/obj/item/clothing/tie/storage/MouseDrop(obj/over_object as obj)
if (has_suit)
return
if (hold.handle_mousedrop(usr, over_object))
..(over_object)
/obj/item/clothing/tie/storage/attackby(obj/item/W as obj, mob/user as mob)
hold.attackby(W, user)
/obj/item/clothing/tie/storage/emp_act(severity)
hold.emp_act(severity)
..()
/obj/item/clothing/tie/storage/hear_talk(mob/M, var/msg)
hold.hear_talk(M, msg)
..()
/obj/item/clothing/tie/storage/attack_self(mob/user as mob)
user << "<span class='notice'>You empty [src].</span>"
var/turf/T = get_turf(src)
@@ -196,18 +339,6 @@
hold.remove_from_storage(I, T)
src.add_fingerprint(user)
/obj/item/clothing/tie/storage/attackby(obj/item/weapon/W as obj, mob/user as mob)
hold.attackby(W,user)
src.add_fingerprint(user)
/obj/item/weapon/storage/pockets
name = "storage"
var/master_item //item it belongs to
/obj/item/weapon/storage/pockets/close(mob/user as mob)
..()
loc = master_item
/obj/item/clothing/tie/storage/webbing
name = "webbing"
desc = "Strudy mess of synthcotton belts and buckles, ready to share your burden."
@@ -311,27 +442,14 @@
item_color = "unathiharness2"
slots = 2
/obj/item/clothing/tie/storage/knifeharness/attackby(var/obj/item/O as obj, mob/user as mob)
..()
update()
/obj/item/clothing/tie/storage/knifeharness/proc/update()
var/count = 0
for(var/obj/item/I in hold)
if(istype(I,/obj/item/weapon/hatchet/unathiknife))
count++
if(count>2) count = 2
item_state = "unathiharness[count]"
icon_state = item_state
item_color = item_state
if(istype(loc, /obj/item/clothing))
var/obj/item/clothing/U = loc
if(istype(U.loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = U.loc
H.update_inv_w_uniform()
/obj/item/clothing/tie/storage/knifeharness/New()
..()
hold.max_combined_w_class = 4
hold.can_hold = list("/obj/item/weapon/hatchet/unathiknife",\
"/obj/item/weapon/kitchen/utensil/knife",\
"/obj/item/weapon/kitchen/utensil/pknife",\
"/obj/item/weapon/kitchenknife",\
"/obj/item/weapon/kitchenknife/ritual")
new /obj/item/weapon/hatchet/unathiknife(hold)
new /obj/item/weapon/hatchet/unathiknife(hold)
new /obj/item/weapon/hatchet/unathiknife(hold)