Files
Polaris/code/game/objects/items/weapons/weldbackpack.dm
Neerti 828dacf485 Centralizes weight class definitions
A lot of new defines are now in inventory_sizes.dm, which contains;
All the size identifiers (the thing that tells the game if something is bulky, or w/e).
Storage costs for all the sizes, which are exponents of two, as previously.
A few constants for inventory size.

Also changes all storage item's capacity definitions by basing it off of how many 'normal slots' exist for it.  This allows one to change the definition for all of the defines in the file, and everything will follow along without needing to change 500 files.  In testing, I made all ITEMSIZE_COST_* defines doubled, and nothing had broke.

The benefit of doing all of this is that it makes adding new weight classes in the future much simpler, and makes knowing how much space a container has easier, as seeing ITEMSIZE_COST_NORMAL * 7 means it can hold seven normal items.
2016-09-22 00:51:51 -04:00

53 lines
2.0 KiB
Plaintext

/obj/item/weapon/weldpack
name = "Welding kit"
desc = "A heavy-duty, portable welding fluid carrier."
slot_flags = SLOT_BACK
icon = 'icons/obj/storage.dmi'
icon_state = "welderpack"
w_class = ITEMSIZE_LARGE
var/max_fuel = 350
/obj/item/weapon/weldpack/New()
var/datum/reagents/R = new/datum/reagents(max_fuel) //Lotsa refills
reagents = R
R.my_atom = src
R.add_reagent("fuel", max_fuel)
/obj/item/weapon/weldpack/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/T = W
if(T.welding & prob(50))
message_admins("[key_name_admin(user)] triggered a fueltank explosion.")
log_game("[key_name(user)] triggered a fueltank explosion.")
user << "<span class='danger'>That was stupid of you.</span>"
explosion(get_turf(src),-1,0,2)
if(src)
qdel(src)
return
else
if(T.welding)
user << "<span class='danger'>That was close!</span>"
src.reagents.trans_to_obj(W, T.max_fuel)
user << "<span class='notice'>Welder refilled!</span>"
playsound(src.loc, 'sound/effects/refill.ogg', 50, 1, -6)
return
user << "<span class='warning'>The tank scoffs at your insolence. It only provides services to welders.</span>"
return
/obj/item/weapon/weldpack/afterattack(obj/O as obj, mob/user as mob, proximity)
if(!proximity) // this replaces and improves the get_dist(src,O) <= 1 checks used previously
return
if (istype(O, /obj/structure/reagent_dispensers/fueltank) && src.reagents.total_volume < max_fuel)
O.reagents.trans_to_obj(src, max_fuel)
user << "<span class='notice'>You crack the cap off the top of the pack and fill it back up again from the tank.</span>"
playsound(src.loc, 'sound/effects/refill.ogg', 50, 1, -6)
return
else if (istype(O, /obj/structure/reagent_dispensers/fueltank) && src.reagents.total_volume == max_fuel)
user << "<span class='warning'>The pack is already full!</span>"
return
/obj/item/weapon/weldpack/examine(mob/user)
..(user)
user << text("\icon[] [] units of fuel left!", src, src.reagents.total_volume)
return