mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Fixes a couple issues with extremely outdated copypaste coat code (#12801)
* Fixes a couple issues with extremely outdated copypaste coat code (fixes #4621) * Clickdrag behaves more like a regular storage item
This commit is contained in:
committed by
Pieter-Jan Briers
parent
01809c3143
commit
2e7b420eab
@@ -70,9 +70,6 @@
|
||||
if(istype(master, /obj/item/weapon/storage))
|
||||
var/obj/item/weapon/storage/S = master
|
||||
S.close(usr)
|
||||
else if(istype(master,/obj/item/clothing/suit/storage))
|
||||
var/obj/item/clothing/suit/storage/S = master
|
||||
S.close(usr)
|
||||
else if(istype(master, /obj/item/device/rcd))
|
||||
var/obj/item/device/rcd/rcd = master
|
||||
rcd.show_default(usr)
|
||||
|
||||
@@ -21,6 +21,14 @@
|
||||
var/obj/item/weapon/storage/S=O
|
||||
L += S.return_inv()
|
||||
|
||||
else if(istype(O,/obj/item/clothing/accessory/storage))
|
||||
var/obj/item/clothing/accessory/storage/S=O
|
||||
L += S.hold.return_inv()
|
||||
|
||||
else if(istype(O,/obj/item/clothing/suit/storage))
|
||||
var/obj/item/clothing/suit/storage/S=O
|
||||
L += S.hold.return_inv()
|
||||
|
||||
else if(istype(O,/obj/item/weapon/gift))
|
||||
var/obj/item/weapon/gift/G = O
|
||||
L += G.gift
|
||||
@@ -30,9 +38,8 @@
|
||||
else if(istype(O,/obj/item/delivery))
|
||||
var/obj/item/delivery/D = O
|
||||
for(var/atom/movable/wrapped in D) //Under normal circumstances, there will be only one thing in it, but not all circumstances are normal
|
||||
L += wrapped
|
||||
if(istype(wrapped, /obj/item/weapon/storage)) //this should never happen
|
||||
L += get_contents(wrapped)
|
||||
L += get_contents(wrapped)
|
||||
|
||||
return L
|
||||
|
||||
/datum/theft_objective/proc/check_completion(datum/mind/owner)
|
||||
@@ -212,7 +219,7 @@
|
||||
var/found_amount = 0
|
||||
for(var/obj/I in all_items) //Check for items
|
||||
if(istype(I, typepath))
|
||||
|
||||
|
||||
//Stealing the cheap autoinjector doesn't count
|
||||
if(istype(I, /obj/item/weapon/reagent_containers/hypospray/autoinjector))
|
||||
continue
|
||||
@@ -312,4 +319,4 @@
|
||||
typepath = /obj/item/stack/sheet/mineral/uranium
|
||||
min=10
|
||||
max=30
|
||||
step=5
|
||||
step=5
|
||||
|
||||
@@ -1,169 +1,55 @@
|
||||
/obj/item/clothing/suit/storage
|
||||
body_parts_covered = FULL_TORSO|ARMS
|
||||
|
||||
var/obj/item/weapon/storage/internal/hold
|
||||
var/list/can_only_hold = new/list() //List of objects which this item can store (if set, it can't store anything else)
|
||||
var/list/cant_hold = new/list() //List of objects which this item can't store (even if it's in the can_only_hold list)
|
||||
var/fits_max_w_class = W_CLASS_SMALL //Max size of objects that this object can store (in effect even if can_only_hold is set)
|
||||
var/max_combined_w_class = 4 //The sum of the w_classes of all the items in this storage item.
|
||||
var/storage_slots = 2 //The number of storage slots in this container.
|
||||
var/obj/screen/storage/boxes = null
|
||||
var/obj/screen/close/closer = null
|
||||
body_parts_covered = FULL_TORSO|ARMS
|
||||
|
||||
|
||||
/obj/item/clothing/suit/storage/proc/return_inv()
|
||||
|
||||
|
||||
var/list/L = list( )
|
||||
|
||||
L += src.contents
|
||||
|
||||
for(var/obj/item/weapon/storage/S in src)
|
||||
L += S.return_inv()
|
||||
for(var/obj/item/weapon/gift/G in src)
|
||||
L += G.gift
|
||||
if (istype(G.gift, /obj/item/weapon/storage))
|
||||
L += G.gift:return_inv()
|
||||
return L
|
||||
|
||||
/obj/item/clothing/suit/storage/proc/show_to(mob/user as mob)
|
||||
user.client.screen -= src.boxes
|
||||
user.client.screen -= src.closer
|
||||
user.client.screen -= src.contents
|
||||
user.client.screen += src.boxes
|
||||
user.client.screen += src.closer
|
||||
user.client.screen += src.contents
|
||||
user.s_active = src
|
||||
return
|
||||
|
||||
/obj/item/clothing/suit/storage/proc/hide_from(mob/user as mob)
|
||||
|
||||
|
||||
if(!user.client)
|
||||
return
|
||||
user.client.screen -= src.boxes
|
||||
user.client.screen -= src.closer
|
||||
user.client.screen -= src.contents
|
||||
return
|
||||
|
||||
/obj/item/clothing/suit/storage/proc/close(mob/user as mob)
|
||||
|
||||
|
||||
src.hide_from(user)
|
||||
user.s_active = null
|
||||
return
|
||||
|
||||
//This proc draws out the inventory and places the items on it. tx and ty are the upper left tile and mx, my are the bottm right.
|
||||
//The numbers are calculated from the bottom-left The bottom-left slot being 1,1.
|
||||
/obj/item/clothing/suit/storage/proc/orient_objs(tx, ty, mx, my)
|
||||
var/cx = tx
|
||||
var/cy = ty
|
||||
src.boxes.screen_loc = text("[tx],[ty] to [mx],[my]")
|
||||
for(var/obj/O in src.contents)
|
||||
O.screen_loc = text("[cx],[cy]")
|
||||
O.hud_layerise()
|
||||
cx++
|
||||
if (cx > mx)
|
||||
cx = tx
|
||||
cy--
|
||||
src.closer.screen_loc = text("[mx+1],[my]")
|
||||
return
|
||||
|
||||
//This proc draws out the inventory and places the items on it. It uses the standard position.
|
||||
/obj/item/clothing/suit/storage/proc/standard_orient_objs(var/rows,var/cols)
|
||||
var/cx = 4
|
||||
var/cy = 2+rows
|
||||
src.boxes.screen_loc = text("4:[WORLD_ICON_SIZE/2],2:[WORLD_ICON_SIZE/2] to [4+cols]:[WORLD_ICON_SIZE/2],[2+rows]:[WORLD_ICON_SIZE/2]")
|
||||
for(var/obj/O in src.contents)
|
||||
O.screen_loc = text("[cx]:[WORLD_ICON_SIZE/2],[cy]:[WORLD_ICON_SIZE/2]")
|
||||
O.hud_layerise()
|
||||
cx++
|
||||
if (cx > (4+cols))
|
||||
cx = 4
|
||||
cy--
|
||||
src.closer.screen_loc = text("[4+cols+1]:[WORLD_ICON_SIZE/2],2:[WORLD_ICON_SIZE/2]")
|
||||
return
|
||||
|
||||
//This proc determins the size of the inventory to be displayed. Please touch it only if you know what you're doing.
|
||||
/obj/item/clothing/suit/storage/proc/orient2hud(mob/user as mob)
|
||||
//var/mob/living/carbon/human/H = user
|
||||
var/row_num = 0
|
||||
var/col_count = min(7,storage_slots) -1
|
||||
if (contents.len > 7)
|
||||
row_num = round((contents.len-1) / 7) // 7 is the maximum allowed width.
|
||||
src.standard_orient_objs(row_num,col_count)
|
||||
return
|
||||
|
||||
//This proc is called when you want to place an item into the storage item.
|
||||
/obj/item/clothing/suit/storage/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/weapon/evidencebag) && src.loc != user)
|
||||
return
|
||||
|
||||
/obj/item/clothing/suit/storage/New()
|
||||
..()
|
||||
if(isrobot(user))
|
||||
if(isMoMMI(user))
|
||||
var/mob/living/silicon/robot/mommi/M = user
|
||||
if(M.is_in_modules(W))
|
||||
to_chat(user, "<span class='notice'>You can't throw away something built into you.</span>")
|
||||
return //Mommis cant give away their modules but can place other items
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You're a robot. No.</span>")
|
||||
return //Robots can't interact with storage items.
|
||||
hold = new (src)
|
||||
hold.name = name //So that you don't just put things into "the storage"
|
||||
hold.master_item = src
|
||||
hold.can_only_hold = can_only_hold
|
||||
hold.cant_hold = cant_hold
|
||||
hold.fits_max_w_class = fits_max_w_class
|
||||
hold.max_combined_w_class = max_combined_w_class
|
||||
hold.storage_slots = storage_slots
|
||||
|
||||
if(src.loc == W)
|
||||
return //Means the item is already in the storage item
|
||||
/obj/item/clothing/suit/storage/Destroy()
|
||||
if(hold)
|
||||
qdel(hold)
|
||||
hold = null
|
||||
return ..()
|
||||
|
||||
if(contents.len >= storage_slots)
|
||||
to_chat(user, "<span class='warning'>The [src] is full, make some space.</span>")
|
||||
return //Storage item is full
|
||||
/obj/item/clothing/suit/storage/attack_hand(mob/user)
|
||||
if(user == src.loc)
|
||||
return hold.attack_hand(user)
|
||||
else
|
||||
return ..()
|
||||
|
||||
if(can_only_hold.len)
|
||||
var/ok = 0
|
||||
for(var/A in can_only_hold)
|
||||
if(istype(W, text2path(A) ))
|
||||
ok = 1
|
||||
break
|
||||
if(!ok)
|
||||
to_chat(user, "<span class='warning'>The [src] cannot hold \the [W].</span>")
|
||||
return
|
||||
/obj/item/clothing/suit/storage/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
hold.attackby(W,user)
|
||||
return 1
|
||||
|
||||
for(var/A in cant_hold) //Check for specific items which this container can't hold.
|
||||
if(istype(W, text2path(A) ))
|
||||
to_chat(user, "<span class='warning'>The [src] cannot hold \the [W].</span>")
|
||||
return
|
||||
|
||||
if (W.w_class > fits_max_w_class)
|
||||
to_chat(user, "<span class='warning'>The [W] is too big for \the [src].</span>")
|
||||
return
|
||||
|
||||
var/sum_w_class = W.w_class
|
||||
for(var/obj/item/I in contents)
|
||||
sum_w_class += I.w_class //Adds up the combined w_classes which will be in the storage item if the item is added to it.
|
||||
|
||||
if(sum_w_class > max_combined_w_class)
|
||||
to_chat(user, "<span class='warning'>The [src] is full, make some space.</span>")
|
||||
return
|
||||
|
||||
if(W.w_class >= src.w_class && (istype(W, /obj/item/weapon/storage)))
|
||||
if(!istype(src, /obj/item/weapon/storage/backpack/holding)) //bohs should be able to hold backpacks again. The override for putting a boh in a boh is in backpack.dm.
|
||||
to_chat(user, "<span class='warning'>The [src] cannot hold \the [W] as it's a storage item of the same size.</span>")
|
||||
return //To prevent the stacking of the same sized items.
|
||||
|
||||
user.u_equip(W,1)
|
||||
playsound(get_turf(src), "rustle", 50, 1, -5)
|
||||
W.forceMove(src)
|
||||
if ((user.client && user.s_active != src))
|
||||
user.client.screen -= W
|
||||
src.orient2hud(user)
|
||||
//W.dropped(user)
|
||||
add_fingerprint(user)
|
||||
show_to(user)
|
||||
/obj/item/clothing/suit/storage/emp_act(severity)
|
||||
hold.emp_act(severity)
|
||||
..()
|
||||
|
||||
/obj/item/clothing/suit/storage/MouseDrop(atom/over_object)
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/M = usr
|
||||
if(ishuman(usr) || ismonkey(usr))
|
||||
var/mob/M = usr
|
||||
if (!( istype(over_object, /obj/screen/inventory) ))
|
||||
return ..()
|
||||
|
||||
if(!(src.loc == usr) || (src.loc && src.loc.loc == usr))
|
||||
return
|
||||
|
||||
playsound(get_turf(src), "rustle", 50, 1, -5)
|
||||
if (M.wear_suit == src && !M.incapacitated() && Adjacent(M))
|
||||
if (!M.incapacitated())
|
||||
var/obj/screen/inventory/OI = over_object
|
||||
|
||||
if(OI.hand_index && M.put_in_hand_check(src, OI.hand_index))
|
||||
@@ -171,55 +57,6 @@
|
||||
M.put_in_hand(OI.hand_index, src)
|
||||
M.update_inv_wear_suit()
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
return
|
||||
if( (over_object == usr && in_range(src, usr) || usr.contents.Find(src)) && usr.s_active)
|
||||
usr.s_active.close(usr)
|
||||
src.show_to(usr)
|
||||
return
|
||||
|
||||
/obj/item/clothing/suit/storage/attack_paw(mob/user as mob)
|
||||
//playsound(get_turf(src), "rustle", 50, 1, -5) // what
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/item/clothing/suit/storage/attack_hand(mob/user as mob)
|
||||
playsound(get_turf(src), "rustle", 50, 1, -5)
|
||||
src.orient2hud(user)
|
||||
if (src.loc == user)
|
||||
if (user.s_active)
|
||||
user.s_active.close(user)
|
||||
src.show_to(user)
|
||||
else
|
||||
..()
|
||||
for(var/mob/M in range(1))
|
||||
if (M.s_active == src)
|
||||
src.close(M)
|
||||
src.add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/clothing/suit/storage/New()
|
||||
. = ..()
|
||||
boxes = getFromPool(/obj/screen/storage)
|
||||
boxes.name = "storage"
|
||||
boxes.master = src
|
||||
boxes.icon_state = "block"
|
||||
boxes.screen_loc = "7,7 to 10,8"
|
||||
boxes.layer = HUD_BASE_LAYER
|
||||
closer = getFromPool(/obj/screen/close)
|
||||
closer.master = src
|
||||
closer.icon_state = "x"
|
||||
closer.layer = HUD_ITEM_LAYER
|
||||
orient2hud()
|
||||
|
||||
/obj/item/clothing/suit/emp_act(severity)
|
||||
if(!istype(src.loc, /mob/living))
|
||||
for(var/obj/O in contents)
|
||||
O.emp_act(severity)
|
||||
..()
|
||||
/*
|
||||
/obj/item/clothing/suit/hear_talk(mob/M, var/msg)
|
||||
for (var/atom/A in src)
|
||||
if(istype(A,/obj/))
|
||||
var/obj/O = A
|
||||
O.hear_talk(M, msg)
|
||||
*/
|
||||
usr.attack_hand(src)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
desc = "Used to hold things when you don't have enough hands for that."
|
||||
icon_state = "webbing"
|
||||
_color = "webbing"
|
||||
var/slots = 3
|
||||
var/storage_slots = 3
|
||||
var/list/can_only_hold = list() //I would add the other storage item variables, but nothing would use them yet, so there's no point.
|
||||
var/list/cant_hold = list("/obj/item/clothing/accessory/storage", "/obj/item/clothing/under") //NO RECURSION
|
||||
var/obj/item/weapon/storage/internal/hold
|
||||
@@ -14,7 +14,7 @@
|
||||
hold = new (src)
|
||||
hold.name = name //So that you don't just put things into "the storage"
|
||||
hold.master_item = src
|
||||
hold.storage_slots = slots
|
||||
hold.storage_slots = storage_slots
|
||||
hold.can_only_hold = can_only_hold
|
||||
hold.cant_hold = cant_hold
|
||||
|
||||
@@ -73,28 +73,28 @@
|
||||
desc = "Sturdy mess of synthcotton belts and buckles. Made to be worn by medical personnel"
|
||||
icon_state = "vest_white"
|
||||
_color = "vest_white"
|
||||
slots = 4
|
||||
storage_slots = 4
|
||||
|
||||
/obj/item/clothing/accessory/storage/black_vest
|
||||
name = "black webbing vest"
|
||||
desc = "Robust black synthcotton vest with lots of pockets to hold whatever you need, but cannot hold in hands."
|
||||
icon_state = "vest_black"
|
||||
_color = "vest_black"
|
||||
slots = 5
|
||||
storage_slots = 5
|
||||
|
||||
/obj/item/clothing/accessory/storage/brown_vest
|
||||
name = "brown webbing vest"
|
||||
desc = "Worn brownish synthcotton vest with lots of pockets to unload your hands."
|
||||
icon_state = "vest_brown"
|
||||
_color = "vest_brown"
|
||||
slots = 5
|
||||
storage_slots = 5
|
||||
|
||||
/obj/item/clothing/accessory/storage/bandolier
|
||||
name = "bandolier"
|
||||
desc = "A bandolier designed with eight pouches for diffrent ammunition types."
|
||||
icon_state = "bandolier"
|
||||
_color = "bandolier"
|
||||
slots = 8
|
||||
storage_slots = 8
|
||||
can_only_hold = list("/obj/item/ammo_casing", "/obj/item/projectile/bullet", "/obj/item/ammo_storage/magazine", "/obj/item/ammo_storage/speedloader", "/obj/item/weapon/rcd_ammo", "/obj/item/weapon/grenade")
|
||||
|
||||
/obj/item/clothing/accessory/storage/knifeharness
|
||||
@@ -102,7 +102,7 @@
|
||||
desc = "A heavily decorated harness of sinew and leather with two knife-loops."
|
||||
icon_state = "unathiharness2"
|
||||
_color = "unathiharness2"
|
||||
slots = 2
|
||||
storage_slots = 2
|
||||
can_only_hold = list("/obj/item/weapon/hatchet", "/obj/item/weapon/kitchen/utensil/knife")
|
||||
|
||||
/obj/item/clothing/accessory/storage/neorussian
|
||||
|
||||
@@ -402,9 +402,9 @@
|
||||
for(var/obj/item/weapon/storage/S in src.contents) //Check for storage items
|
||||
L += get_contents(S)
|
||||
for(var/obj/item/clothing/suit/storage/S in src.contents)//Check for labcoats and jackets
|
||||
L += get_contents(S)
|
||||
L += get_contents(S.hold)
|
||||
for(var/obj/item/clothing/accessory/storage/S in src.contents)//Check for holsters
|
||||
L += get_contents(S)
|
||||
L += get_contents(S.hold)
|
||||
for(var/obj/item/weapon/gift/G in src.contents) //Check for gift-wrapped items
|
||||
L += G.gift
|
||||
if(istype(G.gift, /obj/item/weapon/storage))
|
||||
|
||||
Reference in New Issue
Block a user