Files
VOREStation/code/game/objects/items/weapons/material/material_weapons.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

119 lines
3.7 KiB
Plaintext

// SEE code/modules/materials/materials.dm FOR DETAILS ON INHERITED DATUM.
// This class of weapons takes force and appearance data from a material datum.
// They are also fragile based on material data and many can break/smash apart.
/obj/item/weapon/material
health = 10
hitsound = 'sound/weapons/bladeslice.ogg'
gender = NEUTER
throw_speed = 3
throw_range = 7
w_class = ITEMSIZE_NORMAL
sharp = 0
edge = 0
item_icons = list(
slot_l_hand_str = 'icons/mob/items/lefthand_material.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_material.dmi',
)
var/applies_material_colour = 1
var/unbreakable
var/force_divisor = 0.5
var/thrown_force_divisor = 0.5
var/default_material = DEFAULT_WALL_MATERIAL
var/material/material
var/drops_debris = 1
/obj/item/weapon/material/New(var/newloc, var/material_key)
..(newloc)
if(!material_key)
material_key = default_material
set_material(material_key)
if(!material)
qdel(src)
return
matter = material.get_matter()
if(matter.len)
for(var/material_type in matter)
if(!isnull(matter[material_type]))
matter[material_type] *= force_divisor // May require a new var instead.
/obj/item/weapon/material/get_material()
return material
/obj/item/weapon/material/proc/update_force()
if(edge || sharp)
force = material.get_edge_damage()
else
force = material.get_blunt_damage()
force = round(force*force_divisor)
throwforce = round(material.get_blunt_damage()*thrown_force_divisor)
//spawn(1)
// world << "[src] has force [force] and throwforce [throwforce] when made from default material [material.name]"
/obj/item/weapon/material/proc/set_material(var/new_material)
material = get_material_by_name(new_material)
if(!material)
qdel(src)
else
name = "[material.display_name] [initial(name)]"
health = round(material.integrity/10)
if(applies_material_colour)
color = material.icon_colour
if(material.products_need_process())
processing_objects |= src
update_force()
/obj/item/weapon/material/Destroy()
processing_objects -= src
..()
/obj/item/weapon/material/apply_hit_effect()
..()
if(!unbreakable)
if(material.is_brittle())
health = 0
else if(!prob(material.hardness))
health--
check_health()
/obj/item/weapon/material/proc/check_health(var/consumed)
if(health<=0)
shatter(consumed)
/obj/item/weapon/material/proc/shatter(var/consumed)
var/turf/T = get_turf(src)
T.visible_message("<span class='danger'>\The [src] [material.destruction_desc]!</span>")
if(istype(loc, /mob/living))
var/mob/living/M = loc
M.drop_from_inventory(src)
playsound(src, "shatter", 70, 1)
if(!consumed && drops_debris) material.place_shard(T)
qdel(src)
/*
Commenting this out pending rebalancing of radiation based on small objects.
/obj/item/weapon/material/process()
if(!material.radioactivity)
return
for(var/mob/living/L in range(1,src))
L.apply_effect(round(material.radioactivity/30),IRRADIATE,0)
*/
/*
// Commenting this out while fires are so spectacularly lethal, as I can't seem to get this balanced appropriately.
/obj/item/weapon/material/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
TemperatureAct(exposed_temperature)
// This might need adjustment. Will work that out later.
/obj/item/weapon/material/proc/TemperatureAct(temperature)
health -= material.combustion_effect(get_turf(src), temperature, 0.1)
check_health(1)
/obj/item/weapon/material/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W,/obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(material.ignition_point && WT.remove_fuel(0, user))
TemperatureAct(150)
else
return ..()
*/