STORAGE ITEMS UPDATE:

- All code is now standardized. No more copy-pasted code for each item individually.
- It is now possible to edit the following things with variables alone (ingame too):
  - Storage slots number: Ingame HUD support for up to 21 items.
  - Max w_class: the maximum w_class of items that the storage item can hold. Note that it will not be able to hold storage items of the same size as it is to prevent the stacking of storage items in eachother.
  - Can hold: List of items that the item can hold (old)
  - Can't hold: List of items that the item specifically can't hold. (Use in the same way as can_hold, not used at the moment)
- Syringe boxes are no longer listed as first aid kits. I don't think this will affect anything but who knows.
- The HUD interface for storage items is slightly changed. It's just the X button is positioned one tile to the right of the bottom-right-most tile. This is needed for the correct expanding of the HUD.

I THINK I applied all the changes to these settings for all the items that used copy-pasted and slightly altered code. If there are any anomalies anywhere, let me know. If you find any special attackby() procs that still remain, delete them or tell me about them. Thanks.

Also: I checked to make sure first aid bots and floorbots are constructable.

Also: Listing myself as Game Master in the svn copy of admins.txt so I don't have to do it manually every time I do a fresh checkout. I need this to access the mapping helpers and since it doesn't cause any effects to the game, I don't see any potential problems with this.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1683 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2011-06-12 03:47:43 +00:00
parent cc8acd41b1
commit b7c67f1df1
15 changed files with 113 additions and 176 deletions

View File

@@ -3,6 +3,7 @@
icon = 'items.dmi'
icon_state = "album"
item_state = "briefcase"
can_hold = list("/obj/item/weapon/photo",)
/obj/item/weapon/storage/photo_album/MouseDrop(obj/over_object as obj)
@@ -32,31 +33,7 @@
return
/obj/item/weapon/storage/photo_album/attackby(obj/item/weapon/W as obj, mob/user as mob)
//..()
if (src.contents.len >= 7)
return
if (!istype(W,/obj/item/weapon/photo))
user << "\red You can only put photos in a photo album."
return
var/t
for(var/obj/item/weapon/O in src)
t += O.w_class
playsound(src.loc, "rustle", 50, 1, -5)
user.u_equip(W)
W.loc = src
if ((user.client && user.s_active != src))
user.client.screen -= W
src.orient2hud(user)
W.dropped(user)
add_fingerprint(user)
for(var/mob/O in viewers(user, null))
O.show_message(text("\blue [] has added [] to []!", user, W, src), 1)
return
..()
/obj/item/weapon/camera_test
name = "camera"

View File

@@ -1068,6 +1068,20 @@
src.pixel_x = rand(-5, 5)
src.pixel_y = rand(-5, 5)
/obj/item/weapon/storage
icon = 'storage.dmi'
name = "storage"
var/list/can_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 (in effect only if can_hold isn't set)
var/max_w_class = 2 //Max size of objects that this object can store (in effect only if can_hold isn't set)
var/max_combined_w_class = 14 //The sum of the w_classes of all the items in this storage item.
var/storage_slots = 7 //The number of storage slots in this container.
var/obj/screen/storage/boxes = null
var/obj/screen/close/closer = null
w_class = 3.0
/*
/obj/item/weapon/storage/glassbox
name = "Glassware Box"
icon_state = "beakerbox"
@@ -1081,6 +1095,7 @@
new /obj/item/weapon/glass( src )
new /obj/item/weapon/glass( src )
new /obj/item/weapon/glass( src )
*/
/obj/item/weapon/storage/cupbox
name = "Paper-cup Box"

View File

@@ -49,19 +49,13 @@
)
flags = FPRINT | TABLEPASS | ONBELT
/obj/item/weapon/storage
icon = 'storage.dmi'
name = "storage"
var/list/can_hold = new/list()
var/obj/screen/storage/boxes = null
var/obj/screen/close/closer = null
w_class = 3.0
/obj/item/weapon/storage/backpack
name = "backpack"
icon_state = "backpack"
w_class = 4.0
flags = 259.0
max_w_class = 3
max_combined_w_class = 20
/obj/item/weapon/storage/pill_bottle
name = "pill bottle"
@@ -114,6 +108,8 @@
throw_speed = 1
throw_range = 4
w_class = 4.0
max_w_class = 3
max_combined_w_class = 16
/obj/item/weapon/storage/disk_kit
name = "data disks"
@@ -144,7 +140,7 @@
/obj/item/weapon/storage/firstaid/regular
icon_state = "firstaid"
/obj/item/weapon/storage/firstaid/syringes
/obj/item/weapon/storage/syringes
name = "Syringes"
desc = "A biohazard alert warning is printed on the box"
icon_state = "syringe"

View File

@@ -148,7 +148,7 @@
"/obj/item/weapon/reagent_containers/glass/bottle/antitoxin",
"/obj/item/weapon/reagent_containers/glass/bottle/inaprovaline",
"/obj/item/weapon/reagent_containers/glass/bottle/stoxin",
"/obj/item/weapon/storage/firstaid/syringes")
"/obj/item/weapon/storage/syringes")
cost = 10
containertype = "/obj/crate/medical"
containername = "Medical crate"
@@ -164,7 +164,7 @@
// "/obj/item/weapon/reagent_containers/glass/bottle/gbs", No. Just no.
"/obj/item/weapon/reagent_containers/glass/bottle/pierrot_throat",
"/obj/item/weapon/reagent_containers/glass/bottle/brainrot",
"/obj/item/weapon/storage/firstaid/syringes",
"/obj/item/weapon/storage/syringes",
"/obj/item/weapon/storage/beakerbox")
cost = 20
containertype = "/obj/crate/secure/weapon"

View File

@@ -362,7 +362,6 @@
/obj/item/weapon/storage/toolbox/mechanical/attackby(var/obj/item/stack/tile/steel/T, mob/user as mob)
..()
if(!istype(T, /obj/item/stack/tile/steel))
..()
return

View File

@@ -523,23 +523,16 @@
*/
/obj/item/weapon/storage/firstaid/attackby(var/obj/item/robot_parts/S, mob/user as mob)
//..()
if ((!istype(S, /obj/item/robot_parts/l_arm)) && (!istype(S, /obj/item/robot_parts/r_arm)))
if (src.contents.len >= 7)
return
if ((S.w_class >= 2 || istype(S, /obj/item/weapon/storage)))
return
..()
return
//Syringekit doesn't count EVER.
if(src.type == /obj/item/weapon/storage/firstaid/syringes)
return
//Making a medibot!
if(src.contents.len >= 1)
user << "\red You need to empty [src] out first!"
return
else
var/obj/item/weapon/firstaid_arm_assembly/A = new /obj/item/weapon/firstaid_arm_assembly
if(istype(src,/obj/item/weapon/storage/firstaid/fire))
A.skin = "ointment"
@@ -560,6 +553,7 @@
del(S)
del(src)
/obj/item/weapon/firstaid_arm_assembly/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if ((istype(W, /obj/item/device/healthanalyzer)) && (!src.build_step))

View File

@@ -11,7 +11,7 @@
//new /obj/item/weapon/reagent_containers/glass/bottle/stoxin( src )
//new /obj/item/weapon/reagent_containers/glass/bottle/stoxin( src )
//new /obj/item/weapon/reagent_containers/glass/bottle/toxin( src )
new /obj/item/weapon/storage/firstaid/syringes( src )
new /obj/item/weapon/storage/syringes( src )
new /obj/item/weapon/reagent_containers/dropper( src )
new /obj/item/weapon/reagent_containers/dropper( src )
new /obj/item/weapon/reagent_containers/glass/beaker( src )

View File

@@ -2,7 +2,6 @@
CONTAINS:
TOILET
*/
/obj/item/weapon/storage/toilet
name = "toilet"
w_class = 4.0
@@ -92,3 +91,6 @@ TOILET
for(var/mob/O in viewers(user, null))
O << text("\blue The toilet is clogged!")
return
*/

View File

@@ -35,35 +35,9 @@
return
/obj/item/weapon/storage/backpack/attackby(obj/item/weapon/W as obj, mob/user as mob)
//..()
if (src.contents.len >= 7)
return
if (W.w_class > 3 || src.loc == W)
if(W.w_class > 3)
user << "[W] is too big to fit into the backpack."
return
var/t
for(var/obj/item/weapon/O in src)
t += O.w_class
//Foreach goto(46)
t += W.w_class
if (t > 20)
user << "You cannot fit the item inside. (Remove larger classed items)"
return
playsound(src.loc, "rustle", 50, 1, -5)
user.u_equip(W)
W.loc = src
if ((user.client && user.s_active != src))
user.client.screen -= W
src.orient2hud(user)
W.dropped(user)
if (istype(W, /obj/item/weapon/gun/energy/crossbow)) return //STEALTHY
add_fingerprint(user)
for(var/mob/O in viewers(user, null))
O.show_message(text("\blue [] has added [] to []!", user, W, src), 1)
//Foreach goto(206)
return
..()
/obj/item/weapon/storage/backpack/holding
name = "Bag of Holding"
@@ -79,39 +53,13 @@
if(crit_fail)
user << "\red The Bluespace generator isn't working."
return
if(istype(W, /obj/item/weapon/storage/backpack/holding) && !W.crit_fail)
user << "\red The Bluespace interfaces of the two devices catastrophically malfunction!"
del(W)
new /obj/machinery/singularity (get_turf(src))
del(src)
return
if (src.contents.len >= 7)
user << "\red The Bluespace interface currently does not allow for more than 7 items to be stored. We're working on it! --R&D"
return
if (W.w_class > 3 || src.loc == W)
if(!failcheck(user))
return
var/t
for(var/obj/item/weapon/O in src)
t += O.w_class
//Foreach goto(46)
t += W.w_class
if (t > 20)
if(!failcheck(user))
return
playsound(src.loc, "rustle", 50, 1, -5)
user.u_equip(W)
W.loc = src
if ((user.client && user.s_active != src))
user.client.screen -= W
src.orient2hud(user)
W.dropped(user)
if (istype(W, /obj/item/weapon/gun/energy/crossbow)) return //STEALTHY
add_fingerprint(user)
for(var/mob/O in viewers(user, null))
O.show_message(text("\blue [] has added [] to []!", user, W, src), 1)
..()
proc/failcheck(mob/user as mob)
if (prob(src.reliability)) return 1 //No failure

View File

@@ -81,29 +81,5 @@
call(/obj/rune/proc/revealrunes)(src)
/obj/item/weapon/storage/bible/attackby(obj/item/weapon/W as obj, mob/user as mob)
//..()
if (istype(W, /obj/item/weapon/storage/bible))
return
if (src.contents.len >= 7)
return
if (W.w_class > 3)
return
var/t
for(var/obj/item/weapon/O in src)
t += O.w_class
//Foreach goto(46)
t += W.w_class
if (t > 5)
user << "You cannot fit the item inside. (Remove larger classed items)"
return
playsound(src.loc, "rustle", 50, 1, -5)
user.u_equip(W)
W.loc = src
if ((user.client && user.s_active != src))
user.client.screen -= W
src.orient2hud(user)
W.dropped(user)
add_fingerprint(user)
return
..()

View File

@@ -11,9 +11,8 @@
new /obj/item/weapon/reagent_containers/pill/kelotane( src ) //Replaced ointment with these since they actually work --Errorage
return
/obj/item/weapon/storage/firstaid/syringes/New()
/obj/item/weapon/storage/syringes/New()
..()
if (empty) return
new /obj/item/weapon/reagent_containers/syringe( src )
new /obj/item/weapon/reagent_containers/syringe( src )
new /obj/item/weapon/reagent_containers/syringe( src )

View File

@@ -48,54 +48,87 @@
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 (Right hand slot on the map) 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("[],[] to [],[]", tx, ty, 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.screen_loc = text("[cx],[cy]")
O.layer = 20
cx++
if (cx > mx)
cx = tx
cy--
//Foreach goto(56)
src.closer.screen_loc = text("[],[]", mx, my)
src.closer.screen_loc = text("[mx+1],[my]")
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
if (contents.len > 7)
if(contents.len % 7) //So having 14 items keeps them in 2 wors instead of 3
col_num = round(contents.len / 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, 11, 3, 4)
src.orient_objs(3-col_num, 3+row_count, 3, 3)
else if(src == user.r_hand)
src.orient_objs(1, 11, 1, 4)
src.orient_objs(1, 3+row_count, 1+col_num, 3)
else if(src == user.back)
src.orient_objs(4, 10, 4, 3)
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, 8, 3)
else
src.orient_objs(7, 8, 10, 7)
src.orient_objs(5, 10, 11, 10)
return
//This proc is called when you want to place an item into the storage item.
/obj/item/weapon/storage/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if(isrobot(user))
return
user << "\blue You're a robot. No."
return //Robots can't interact with storage items.
if(src.loc == W)
return //Means the item is already in the storage item
if(contents.len >= storage_slots)
user << "\red The [src] is full, make some space."
return //Storage item is full
if(can_hold.len)
var/ok = 0
for(var/A in can_hold)
if(istype(W, text2path(A) )) ok = 1
if(istype(W, text2path(A) ))
ok = 1
break
if(!ok)
user << "\red This container cannot hold [W]."
user << "\red This [src] cannot hold [W]."
return
if (src.contents.len >= 7)
for(var/A in cant_hold) //Check for specific items which this container can't hold.
if(istype(W, text2path(A) ))
user << "\red This [src] cannot hold [W]."
return
if ((W.w_class >= 3 || (istype(W, /obj/item/weapon/storage) && !istype(W, /obj/item/weapon/storage/pill_bottle)) || src.loc == W))
if (W.w_class > max_w_class)
user << "\red This [W] is too big for this [src]"
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)
user << "\red The [W] cannot fit in the [src]. Remove some items or add a smaller one.."
return
if ( W.w_class >= src.w_class && (istype(W, /obj/item/weapon/storage)))
user << "\red The [src] cannot hold [W] as it's a storage item of the same size."
return //To prevent the stacking of the same sized items.
user.u_equip(W)
W.loc = src
if ((user.client && user.s_active != src))
@@ -105,13 +138,12 @@
add_fingerprint(user)
if (istype(W, /obj/item/weapon/gun/energy/crossbow)) return //STEALTHY
for(var/mob/O in viewers(user, null))
O.show_message(text("\blue [] has added [] to []!", user, W, src), 1)
O.show_message(text("\blue [user] has added [W] to [src]!"))
//Foreach goto(139)
return
/obj/item/weapon/storage/dropped(mob/user as mob)
src.orient_objs(7, 8, 10, 7)
src.orient_objs(5,10,12,10)
return
/obj/item/weapon/storage/MouseDrop(over_object, src_location, over_location)
@@ -125,7 +157,6 @@
/obj/item/weapon/storage/attack_paw(mob/user as mob)
playsound(src.loc, "rustle", 50, 1, -5)
return src.attack_hand(user)
return
/obj/item/weapon/storage/attack_hand(mob/user as mob)
playsound(src.loc, "rustle", 50, 1, -5)
@@ -138,7 +169,6 @@
for(var/mob/M in range(1))
if (M.s_active == src)
src.close(M)
//Foreach goto(76)
src.orient2hud(user)
src.add_fingerprint(user)
return
@@ -156,7 +186,7 @@
src.closer.icon_state = "x"
src.closer.layer = 20
spawn( 5 )
src.orient_objs(7, 8, 10, 7)
src.orient_objs(5, 10, 12, 10)
return
return

View File

@@ -21,6 +21,6 @@ mario90900 - Game Admin
atomictroop - Game Admin
fateweaver - Game Admin
agouri - Game Admin
errorage - Game Admin
errorage - Game Master
uhangi - Trial Admin

View File

@@ -3559,7 +3559,7 @@
"bqw" = (/obj/machinery/atmospherics/pipe/simple{icon_state = "intact"; dir = 10; pixel_x = 0; level = 2; initialize_directions = 10},/turf/simulated/floor{icon_state = "white"},/area/medical/medbay)
"bqx" = (/obj/machinery/light{dir = 1},/obj/item/device/radio/intercom{pixel_y = 25},/turf/simulated/floor{icon_state = "white"},/area/medical/medbay)
"bqy" = (/obj/grille,/obj/window/reinforced,/obj/window/reinforced{dir = 4},/obj/window/reinforced{dir = 8},/obj/window/reinforced{dir = 1},/turf/simulated/floor/plating,/area/medical/medbay)
"bqz" = (/obj/table{dir = 10; icon_state = "tabledir"},/obj/item/weapon/storage/firstaid/syringes{pixel_y = 4; pixel_z = 4},/turf/simulated/floor{icon_state = "white"},/area/medical/medbay)
"bqz" = (/obj/table{dir = 10; icon_state = "tabledir"},/obj/item/weapon/storage/syringes{pixel_y = 4; pixel_z = 4},/turf/simulated/floor{icon_state = "white"},/area/medical/medbay)
"bqA" = (/obj/window/reinforced{dir = 4},/obj/window/reinforced{dir = 8},/obj/grille,/turf/simulated/floor/plating,/area/medical/surgery)
"bqB" = (/turf/simulated/floor{dir = 4; icon_state = "warning"},/area/medical/surgery)
"bqC" = (/turf/simulated/floor{icon_state = "white"},/area/medical/surgery)
@@ -3675,7 +3675,7 @@
"bsI" = (/obj/machinery/camera{c_tag = "Bar"; dir = 8; network = "SS13"},/obj/item/weapon/reagent_containers/food/drinks/shaker,/obj/table/reinforced{dir = 8; icon_state = "reinf_tabledir"},/turf/simulated/floor{icon_state = "bar"},/area/crew_quarters/bar)
"bsJ" = (/obj/machinery/atmospherics/unary/vent_scrubber{dir = 8; on = 1},/obj/secure_closet/medical3{pixel_x = -5},/turf/simulated/floor{dir = 5; icon_state = "warning"},/area/medical/medbay)
"bsK" = (/obj/machinery/light,/obj/landmark{name = "xeno_spawn"; pixel_x = -1},/obj/machinery/atmospherics/unary/vent_pump{on = 1},/turf/simulated/floor{icon_state = "white"},/area/medical/medbay)
"bsL" = (/obj/table{icon_state = "table_vertical"; dir = 1},/obj/item/weapon/storage/firstaid/syringes,/obj/item/weapon/storage/utilitybelt/medical{pixel_x = 4; pixel_y = -7},/turf/simulated/floor{icon_state = "white"},/area/medical/medbay)
"bsL" = (/obj/table{icon_state = "table_vertical"; dir = 1},/obj/item/weapon/storage/syringes,/obj/item/weapon/storage/utilitybelt/medical{pixel_x = 4; pixel_y = -7},/turf/simulated/floor{icon_state = "white"},/area/medical/medbay)
"bsM" = (/obj/machinery/light,/obj/item/device/radio/intercom{pixel_y = -25},/turf/simulated/floor{icon_state = "white"},/area/medical/medbay)
"bsN" = (/obj/secure_closet/medical2{pixel_x = 5},/turf/simulated/floor{dir = 8; icon_state = "warning"},/area/medical/medbay)
"bsO" = (/obj/machinery/atmospherics/portables_connector{dir = 1; name = "Connector Port (Air Supply)"},/obj/machinery/portable_atmospherics/canister/oxygen,/turf/simulated/floor{dir = 1; icon_state = "warning"},/area/medical/medbay)
@@ -4879,7 +4879,7 @@
"bPQ" = (/obj/machinery/atmospherics/pipe/manifold{color = "red"; dir = 4; icon_state = "manifold-r-f"; initialize_directions = 11; level = 1; name = "pipe manifold"},/turf/simulated/wall/r_wall,/area/crew_quarters/hor)
"bPR" = (/obj/machinery/alarm{dir = 4; icon_state = "alarm0"; pixel_x = -22},/obj/disposalpipe/segment{dir = 1},/turf/simulated/floor{icon_state = "white"},/area/medical/research{name = "Research Division"})
"bPS" = (/obj/machinery/atmospherics/unary/vent_pump{dir = 4; on = 1},/obj/disposalpipe/segment{dir = 1},/turf/simulated/floor{icon_state = "white"},/area/medical/research{name = "Research Division"})
"bPT" = (/obj/table{dir = 1; icon_state = "tabledir"},/obj/item/weapon/storage/firstaid/syringes,/turf/simulated/floor{icon_state = "white"},/area/medical/virology)
"bPT" = (/obj/table{dir = 1; icon_state = "tabledir"},/obj/item/weapon/storage/syringes,/turf/simulated/floor{icon_state = "white"},/area/medical/virology)
"bPU" = (/obj/table{dir = 1; icon_state = "tabledir"},/obj/item/weapon/reagent_containers/glass/bottle/flu_virion,/obj/item/weapon/reagent_containers/glass/bottle/cold{pixel_x = 6; pixel_y = -3},/obj/cable{d1 = 1; d2 = 2; icon_state = "1-2"; pixel_y = 0; tag = "Streight"},/turf/simulated/floor{icon_state = "white"},/area/medical/virology)
"bPV" = (/obj/table{dir = 1; icon_state = "tabledir"},/obj/item/weapon/storage/beakerbox,/turf/simulated/floor{icon_state = "white"},/area/medical/virology)
"bPW" = (/obj/table{dir = 1; icon_state = "tabledir"},/obj/item/weapon/hand_labeler,/turf/simulated/floor{icon_state = "white"},/area/medical/virology)

View File

@@ -130,6 +130,7 @@
#define FILE_DIR "icons/turf"
#define FILE_DIR "interface"
#define FILE_DIR "maps"
#define FILE_DIR "maps/backup"
#define FILE_DIR "sound"
#define FILE_DIR "sound/ambience"
#define FILE_DIR "sound/announcer"