baloh.matevz@gmail.com
2012-05-21 00:04:08 +00:00
parent ce63ae2247
commit 3394098496
21 changed files with 630 additions and 302 deletions
+20 -13
View File
@@ -79,18 +79,25 @@
src.closer.screen_loc = text("[],[]", mx, my)
return
/obj/item/weapon/secstorage/proc/orient2hud(mob/user as mob)
//This proc draws out the inventory and places the items on it. It uses the standard position.
/obj/item/weapon/secstorage/proc/standard_orient_objs()
var/rows = 0
var/cols = 6
var/cx = 4
var/cy = 2+rows
src.boxes.screen_loc = text("4:16,2:16 to [4+cols]:16,[2+rows]:16")
for(var/obj/O in src.contents)
O.screen_loc = text("[cx]:16,[cy]:16")
O.layer = 20
cx++
if (cx > (4+cols))
cx = 4
cy--
src.closer.screen_loc = text("11:16,2:16")
return
if (src == user.l_hand)
src.orient_objs(3, 11, 3, 4)
else
if (src == user.r_hand)
src.orient_objs(1, 11, 1, 4)
else
if (src == user.back)
src.orient_objs(4, 10, 4, 3)
else
src.orient_objs(7, 8, 10, 7)
/obj/item/weapon/secstorage/proc/orient2hud(mob/user as mob)
standard_orient_objs()
return
/obj/item/weapon/secstorage/attackby(obj/item/weapon/W as obj, mob/user as mob)
@@ -154,7 +161,7 @@
/obj/item/weapon/secstorage/dropped(mob/user as mob)
src.orient_objs(7, 8, 10, 7)
standard_orient_objs()
return
/obj/item/weapon/secstorage/MouseDrop(over_object, src_location, over_location)
@@ -252,6 +259,6 @@
src.closer.icon_state = "x"
src.closer.layer = 20
spawn( 5 )
src.orient_objs(7, 8, 10, 7)
standard_orient_objs()
return
return
+23 -26
View File
@@ -62,11 +62,11 @@
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 (Right hand slot on the map) being 1,1.
//The numbers are calculated from the bottom-left The bottom-left slot being 1,1.
/obj/item/weapon/storage/proc/orient_objs(tx, ty, mx, my)
var/cx = tx
var/cy = ty
src.boxes.screen_loc = text("[tx],[ty] to [mx],[my]")
src.boxes.screen_loc = text("[tx]:,[ty] to [mx],[my]")
for(var/obj/O in src.contents)
O.screen_loc = text("[cx],[cy]")
O.layer = 20
@@ -77,23 +77,29 @@
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/weapon/storage/proc/standard_orient_objs(var/rows,var/cols)
var/cx = 4
var/cy = 2+rows
src.boxes.screen_loc = text("4:16,2:16 to [4+cols]:16,[2+rows]:16")
for(var/obj/O in src.contents)
O.screen_loc = text("[cx]:16,[cy]:16")
O.layer = 20
cx++
if (cx > (4+cols))
cx = 4
cy--
src.closer.screen_loc = text("[4+cols+1]:16,2:16")
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/weapon/storage/proc/orient2hud(mob/user as mob)
var/mob/living/carbon/human/H = user
var/col_num = 0
var/row_count = min(7,storage_slots) -1 //For belts, the meanings of the two variables are inverted, so we don't have to declare new ones
//var/mob/living/carbon/human/H = user
var/row_num = 0
var/col_count = min(7,storage_slots) -1
if (contents.len > 7)
col_num = round((contents.len-1) / 7) // 7 is the maximum allowed column height for r_hand, l_hand and back storage items.
if (src == user.l_hand)
src.orient_objs(3-col_num, 3+row_count, 3, 3)
else if(src == user.r_hand)
src.orient_objs(1, 3+row_count, 1+col_num, 3)
else if(src == user.back)
src.orient_objs(4-col_num, 3+row_count, 4, 3)
else if(istype(user, /mob/living/carbon/human) && src == H.belt)//only humans have belts
src.orient_objs(1, 3+col_num, 1+row_count, 3)
else
src.orient_objs(5, 10+col_num, 5 + row_count, 10)
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.
@@ -183,11 +189,6 @@
return
/obj/item/weapon/storage/dropped(mob/user as mob)
var/col_num = 0
var/row_count = min(7,storage_slots) -1
if (contents.len > 7)
col_num = round((contents.len-1) / 7) // 7 is the maximum allowed column height for r_hand, l_hand and back storage items.
src.orient_objs(5, 10+col_num, 5 + row_count, 10)
return
/obj/item/weapon/storage/MouseDrop(over_object, src_location, over_location)
@@ -241,11 +242,7 @@
src.closer.master = src
src.closer.icon_state = "x"
src.closer.layer = 20
spawn( 5 )
var/row_count = min(7,storage_slots) -1
var/col_num = round((storage_slots - 1) / 7) // 7 is the maximum allowed column height for r_hand, l_hand and back storage items. -Yvarov
src.orient_objs(5, 10+col_num, 5 + row_count, 10)
return
orient2hud()
return
/obj/item/weapon/storage/emp_act(severity)