03-27-2017, 07:46 AM
(This post was last modified: 03-27-2017, 07:46 AM by Noah Buttes. Edited 1 time in total.)
There are some problems with some of the initial values for the variables on this thing.
If we take a look at some later bits of code, we find that these values create some odd behavior.
This causes some interesting results with newly spawned katanas.
A freshly spawned katana will spawn with its icons matching those of a sheathed katana, but if you smack someone with it, it will make stabbing noises like an unsheathed sword.
Even though its already sheathed, at least in apperance, you have to actually resheathe it once before you can unsheathe it.
The w_class is initially 3.0, but neither unsheathing nor resheathing the katana will restore it to this weight value. An unsheathed sword has a w_class of 4, and a katana replaced in its scabbard will have a w_class of 2. This means that a newly spawned katana is somehow bigger than the same katana once its been unsheathed and resheathed at least once.
Code:
icon_state = "Sheathed"
item_state = "SheathedHand"
hit_type = DAMAGE_BLUNT
var/sheathed = 1
w_class = 3.0
If we take a look at some later bits of code, we find that these values create some odd behavior.
Code:
if(sheathed)
var/mob/living/carbon/human/U = user
playsound(get_turf(U), pick('sound/effects/bloody_stab.ogg'), 70, 0, 0, max(0.7, min(1.2, 1.0 + (30 - U.bioHolder.age)/60)))
Code:
/obj/item/katana/attack_self(mob/user as mob)
if (user.bioHolder.HasEffect("clumsy") && prob(50))
user.visible_message("<span style=\"color:red\"><b>[user]</b> fumbles [src] and cuts \himself.</span>")
user.TakeDamage(user.hand == 1 ? "l_arm" : "r_arm", 5, 5)
take_bleeding_damage(user, user, 5)
src.sheathed = !( src.sheathed )
if (src.sheathed)
boutput(user, "<span style=\"color:blue\">The sword is now unsheathed</span>")
hit_type = DAMAGE_CUT
if(ishuman(user))
var/mob/living/carbon/human/U = user
if(U.gender == MALE) playsound(get_turf(U),"sound/weapons/swordsheath.ogg", 70, 0, 0, max(0.7, min(1.2, 1.0 + (30 - U.bioHolder.age)/60)))
else playsound(get_turf(U),"sound/weapons/swordsheath.ogg", 100, 0, 0, max(0.7, min(1.4, 1.0 + (30 - U.bioHolder.age)/50)))
src.force = 80
src.icon_state = "Katana"
src.item_state = "Katana"
src.w_class = 4
else
boutput(user, "<span style=\"color:blue\">The sword is now sheathed</span>")
hit_type = DAMAGE_BLUNT
if(ishuman(user))
var/mob/living/carbon/human/U = user
if(U.gender == MALE) playsound(get_turf(U),"sound/weapons/swordsheath.ogg", 70, 0, 0, max(0.7, min(1.2, 1.0 + (30 - U.bioHolder.age)/60)))
else playsound(get_turf(U),"sound/weapons/swordsheath.ogg", 100, 0, 0, max(0.7, min(1.4, 1.0 + (30 - U.bioHolder.age)/50)))
src.force = 1
src.icon_state = "Sheathed"
src.item_state = "SheathedHand"
src.w_class = 2
user.update_inhands()
src.add_fingerprint(user)
return
This causes some interesting results with newly spawned katanas.
A freshly spawned katana will spawn with its icons matching those of a sheathed katana, but if you smack someone with it, it will make stabbing noises like an unsheathed sword.
Even though its already sheathed, at least in apperance, you have to actually resheathe it once before you can unsheathe it.
The w_class is initially 3.0, but neither unsheathing nor resheathing the katana will restore it to this weight value. An unsheathed sword has a w_class of 4, and a katana replaced in its scabbard will have a w_class of 2. This means that a newly spawned katana is somehow bigger than the same katana once its been unsheathed and resheathed at least once.