mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 17:14:47 +01:00
0b0c5ea91e
## About The Pull Request Extends the part of the crafting unit test that ensures consistency between the total mats of the components of a recipe (or rather, the result of said recipe) and a generic instance of the same type as its result, previously only implemented on food recipes. ## Why It's Good For The Game This ensures a degree of consistency with the material composition of various objects in the game. I couldn't do it in the original PR as that one was too big already and it took months to get it merged, and have the relative bugs fixed. Currently a WIP as I slowly deal with the unit test reports. ## Changelog 🆑 refactor: Follow-up to the crafting/material refactor from months ago. All objects crafted with stacks now inherit their mat composition (not necessarily the effects and color) by default, while previously only a few things like chair, sinks and toilets did. Report any object looking or behaving weirdly as a result. fix: The material composition of ammo boxes is no longer a 1/10 of what it's supposed to be. It was a shitty hack to make it harder to recycle empty ammo boxes. Instead, they lose materials as they're emptied now. /🆑
92 lines
2.8 KiB
Plaintext
92 lines
2.8 KiB
Plaintext
/obj/structure/punching_bag
|
|
name = "punching bag"
|
|
desc = "A punching bag. Can you get to speed level 4???"
|
|
icon = 'icons/obj/fluff/gym_equipment.dmi'
|
|
icon_state = "punchingbag"
|
|
anchored = TRUE
|
|
layer = ABOVE_MOB_LAYER
|
|
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 2.5)
|
|
///List of sounds that can be played when punched.
|
|
var/static/list/hit_sounds = list(
|
|
'sound/items/weapons/genhit1.ogg',
|
|
'sound/items/weapons/genhit2.ogg',
|
|
'sound/items/weapons/genhit3.ogg',
|
|
'sound/items/weapons/punch1.ogg',
|
|
'sound/items/weapons/punch2.ogg',
|
|
'sound/items/weapons/punch3.ogg',
|
|
'sound/items/weapons/punch4.ogg',
|
|
)
|
|
|
|
/obj/structure/punching_bag/Initialize(mapload)
|
|
. = ..()
|
|
|
|
AddElement( \
|
|
/datum/element/contextual_screentip_bare_hands, \
|
|
lmb_text = "Punch", \
|
|
)
|
|
|
|
var/static/list/tool_behaviors
|
|
if(!tool_behaviors)
|
|
tool_behaviors = string_assoc_nested_list(list(
|
|
TOOL_CROWBAR = list(
|
|
SCREENTIP_CONTEXT_RMB = "Deconstruct",
|
|
),
|
|
|
|
TOOL_WRENCH = list(
|
|
SCREENTIP_CONTEXT_RMB = "Anchor",
|
|
),
|
|
))
|
|
AddElement(/datum/element/contextual_screentip_tools, tool_behaviors)
|
|
|
|
/obj/structure/punching_bag/attack_hand(mob/living/user, list/modifiers)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
flick("[icon_state]-punch", src)
|
|
playsound(loc, pick(hit_sounds), 25, TRUE, -1)
|
|
|
|
if(!iscarbon(user))
|
|
return
|
|
|
|
var/is_heavy_gravity = user.has_gravity() > STANDARD_GRAVITY
|
|
|
|
var/stamina_exhaustion = 3
|
|
if(ishuman(user))
|
|
var/mob/living/carbon/human/boxer = user
|
|
var/obj/item/clothing/gloves/boxing/boxing_gloves = boxer.get_item_by_slot(ITEM_SLOT_GLOVES)
|
|
if(istype(boxing_gloves))
|
|
stamina_exhaustion = 2
|
|
if (is_heavy_gravity)
|
|
stamina_exhaustion *= 1.5
|
|
|
|
var/obj/item/organ/cyberimp/chest/spine/potential_spine = user.get_organ_slot(ORGAN_SLOT_SPINE)
|
|
if(istype(potential_spine))
|
|
stamina_exhaustion *= potential_spine.athletics_boost_multiplier
|
|
|
|
if(HAS_TRAIT(user, TRAIT_STRENGTH)) //The strong get reductions to stamina damage taken while exercising
|
|
stamina_exhaustion *= 0.5
|
|
|
|
user.adjust_stamina_loss(stamina_exhaustion)
|
|
user.mind?.adjust_experience(/datum/skill/athletics, is_heavy_gravity ? 0.6 : 0.3)
|
|
user.apply_status_effect(/datum/status_effect/exercised)
|
|
|
|
/obj/structure/punching_bag/wrench_act_secondary(mob/living/user, obj/item/tool)
|
|
tool.play_tool_sound(src)
|
|
balloon_alert(user, anchored ? "unsecured" : "secured")
|
|
anchored = !anchored
|
|
return TRUE
|
|
|
|
/obj/structure/punching_bag/crowbar_act_secondary(mob/living/user, obj/item/tool)
|
|
if(anchored)
|
|
balloon_alert(user, "still secured!")
|
|
return FALSE
|
|
tool.play_tool_sound(src)
|
|
balloon_alert(user, "deconstructing...")
|
|
if (!do_after(user, 10 SECONDS, target = src))
|
|
return FALSE
|
|
new /obj/item/stack/sheet/iron(get_turf(src), 2)
|
|
new /obj/item/stack/rods(get_turf(src))
|
|
new /obj/item/pillow(get_turf(src))
|
|
qdel(src)
|
|
return TRUE
|