Improvised Sword (#7243)

You can now build improvised swords. The hilt determines the integrity thereof, while the blade determines the damage it does.

Additionally, it also adds a var that sets whether the material item uses its material name or not.
This commit is contained in:
Geeves
2019-10-26 14:12:51 +03:00
committed by Erki
parent 2b6425c7df
commit cdfa04c24e
9 changed files with 121 additions and 2 deletions
@@ -11,6 +11,7 @@
sharp = 0
edge = 0
var/use_material_name = TRUE // Does the finished item put the material name in front of it?
var/applies_material_colour = 1
var/unbreakable
var/force_divisor = 0.5
@@ -50,7 +51,8 @@
if(!material)
qdel(src)
else
name = "[material.display_name] [initial(name)]"
if(use_material_name)
name = "[material.display_name] [initial(name)]"
health = round(material.integrity/10)
if(applies_material_colour)
color = material.icon_colour
@@ -149,4 +149,78 @@
icon_state = "amohdan_sword"
item_state = "amohdan_sword"
contained_sprite = 1
slot_flags = SLOT_BELT
slot_flags = SLOT_BELT
// improvised sword
/obj/item/weapon/material/sword/improvised_sword
name = "selfmade sword"
desc = "A crudely made, rough looking sword. Still appears to be quite deadly."
icon = 'icons/obj/weapons.dmi'
icon_state = "improvsword"
item_state = "improvsword"
var/obj/item/weapon/material/hilt //what is the handle made of?
force_divisor = 0.3
slot_flags = SLOT_BELT
/obj/item/weapon/material/sword/improvised_sword/apply_hit_effect()
. = ..()
if(!unbreakable)
if(hilt.material.is_brittle())
health = 0
else if(!prob(hilt.material.hardness))
health--
check_health()
/obj/item/weapon/material/sword/improvised_sword/proc/assignDescription()
if(hilt)
desc = "A crudely made, rough looking sword. Still appears to be quite deadly. It has a blade of [src.material], and a hilt of [hilt.material]."
else
desc = "A crudely made, rough looking sword. Still appears to be quite deadly. It has a blade of [src.material]."
// the things needed to create the above
/obj/item/weapon/material/sword_hilt
name = "hilt"
desc = "A hilt without a blade, quite useless."
icon = 'icons/obj/weapons_build.dmi'
icon_state = "swordhilt"
unbreakable = TRUE
force_divisor = 0.05
thrown_force_divisor = 0.2
/obj/item/weapon/material/sword_hilt/attackby(var/obj/O, mob/user)
if(istype(O, /obj/item/weapon/material/sword_blade))
var/obj/item/weapon/material/sword_blade/blade = O
var/obj/item/weapon/material/sword/improvised_sword/new_sword = new(src.loc, blade.material.name)
new_sword.hilt = src
user.drop_from_inventory(src,new_sword)
user.drop_from_inventory(blade,new_sword)
user.put_in_hands(new_sword)
qdel(blade)
qdel(src)
new_sword.assignDescription()
else
..()
/obj/item/weapon/material/sword_blade
name = "blade"
desc = "A blade without a hilt, don't cut yourself!"
icon = 'icons/obj/weapons_build.dmi'
icon_state = "swordblade"
unbreakable = TRUE
force_divisor = 0.20
thrown_force_divisor = 0.3
/obj/item/weapon/material/sword_blade/attackby(var/obj/O, mob/user)
if(istype(O, /obj/item/weapon/material/sword_hilt))
var/obj/item/weapon/material/sword_hilt/hilt = O
var/obj/item/weapon/material/sword/improvised_sword/new_sword = new(src.loc, src.material.name)
new_sword.hilt = hilt.material
new_sword.assignDescription()
user.drop_from_inventory(src,new_sword)
user.drop_from_inventory(hilt,new_sword)
user.put_in_hands(new_sword)
qdel(hilt)
qdel(src)
new_sword.assignDescription()
else
..()