Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code bounty] Yautja Hunting Bow #7492

Draft
wants to merge 61 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
95ffcff
init
ihatethisengine Nov 1, 2024
ad755cd
stuff
ihatethisengine Nov 2, 2024
f728348
a
ihatethisengine Nov 3, 2024
2b2d19e
,
ihatethisengine Nov 3, 2024
eb7865f
icons sorted
ihatethisengine Nov 3, 2024
3bed18e
aaa
ihatethisengine Nov 3, 2024
f8ffbad
f
ihatethisengine Nov 3, 2024
10c11ff
a
ihatethisengine Nov 3, 2024
fd84558
f
ihatethisengine Nov 3, 2024
804d78d
a
ihatethisengine Nov 4, 2024
3d415f7
a
ihatethisengine Nov 4, 2024
e8763c0
c
ihatethisengine Nov 4, 2024
9600c27
pretty much done
ihatethisengine Nov 4, 2024
0252add
really
ihatethisengine Nov 4, 2024
39ef5d4
some stuff I forgot to add
ihatethisengine Nov 4, 2024
227e95b
effects
ihatethisengine Nov 4, 2024
7e096eb
Update code/datums/ammo/misc.dm
ihatethisengine Nov 4, 2024
c8ff79b
Apply suggestions from code review
ihatethisengine Nov 4, 2024
772ea3a
Update code/modules/cm_preds/yaut_weapons.dm
ihatethisengine Nov 4, 2024
61684f1
Update code/modules/cm_preds/yaut_weapons.dm
ihatethisengine Nov 4, 2024
30cf0b3
update
ihatethisengine Nov 4, 2024
8cf7a1c
Update code/modules/cm_preds/yaut_weapons.dm
ihatethisengine Nov 4, 2024
28d8946
Update code/modules/cm_preds/yaut_weapons.dm
ihatethisengine Nov 4, 2024
a4820ae
Update code/datums/ammo/misc.dm
ihatethisengine Nov 5, 2024
10c621e
Update code/datums/ammo/misc.dm
ihatethisengine Nov 5, 2024
a57f0ff
Update code/modules/mob/mob.dm
ihatethisengine Nov 7, 2024
f530b67
init
ihatethisengine Nov 1, 2024
e456214
stuff
ihatethisengine Nov 2, 2024
d03cb50
a
ihatethisengine Nov 3, 2024
5df78f0
,
ihatethisengine Nov 3, 2024
61ffc81
icons sorted
ihatethisengine Nov 3, 2024
efd2abd
aaa
ihatethisengine Nov 3, 2024
164b800
f
ihatethisengine Nov 3, 2024
8d1987b
a
ihatethisengine Nov 3, 2024
677f9dd
f
ihatethisengine Nov 3, 2024
3f9d810
a
ihatethisengine Nov 4, 2024
fae497b
a
ihatethisengine Nov 4, 2024
22ba68e
c
ihatethisengine Nov 4, 2024
11aac0f
pretty much done
ihatethisengine Nov 4, 2024
1b8f88a
really
ihatethisengine Nov 4, 2024
417a075
some stuff I forgot to add
ihatethisengine Nov 4, 2024
f593003
effects
ihatethisengine Nov 4, 2024
11bd1b2
Update code/datums/ammo/misc.dm
ihatethisengine Nov 4, 2024
af4d9eb
Apply suggestions from code review
ihatethisengine Nov 4, 2024
712e6fe
Update code/modules/cm_preds/yaut_weapons.dm
ihatethisengine Nov 4, 2024
9d5a918
Update code/modules/cm_preds/yaut_weapons.dm
ihatethisengine Nov 4, 2024
f98b637
update
ihatethisengine Nov 4, 2024
9327b52
Update code/modules/cm_preds/yaut_weapons.dm
ihatethisengine Nov 4, 2024
691664b
Update code/modules/cm_preds/yaut_weapons.dm
ihatethisengine Nov 4, 2024
9c16bb1
Update code/datums/ammo/misc.dm
ihatethisengine Nov 5, 2024
c022fe0
Update code/datums/ammo/misc.dm
ihatethisengine Nov 5, 2024
a3cb5ce
Update code/modules/mob/mob.dm
ihatethisengine Nov 7, 2024
b298731
Merge branch 'bow' of https://github.com/ihatethisengine/cmss13 into bow
ihatethisengine Nov 7, 2024
05115ab
Revert "Merge branch 'bow' of https://github.com/ihatethisengine/cmss…
ihatethisengine Nov 7, 2024
571cd91
Merge branch 'master' into bow
ihatethisengine Nov 7, 2024
0bdcd5f
Merge branch 'bow' of https://github.com/ihatethisengine/cmss13 into bow
ihatethisengine Nov 7, 2024
bc7c367
fix merge conf
ihatethisengine Nov 7, 2024
b8ad71c
review
ihatethisengine Nov 7, 2024
7383c7c
Merge branch 'master' into bow
ihatethisengine Nov 17, 2024
3202a57
eh
ihatethisengine Nov 17, 2024
2431e3b
fix
ihatethisengine Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions code/datums/ammo/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,90 @@
var/obj/item/weapon/gun/flare/flare_gun_fired_from = fired_projectile.shot_from
flare_gun_fired_from.last_signal_flare_name = signal_flare.name

/datum/ammo/arrow
name = "arrow"
ping = null //no bounce off.
damage_type = BRUTE
icon_state = "arrow"

damage = 110
penetration = 20
accuracy = HIT_ACCURACY_TIER_3
max_range = 14
shell_speed = AMMO_SPEED_TIER_3
flags_ammo_behavior = AMMO_SPECIAL_EMBED
shrapnel_chance = SHRAPNEL_CHANCE_TIER_10
shrapnel_type = /obj/item/arrow
handful_type = /obj/item/arrow
sound_hit = 'sound/weapons/pierce.ogg'
var/activated = FALSE

/datum/ammo/arrow/on_embed(mob/embedded_mob, obj/limb/target_organ, silent = FALSE)
if(!ishumansynth_strict(embedded_mob) || !istype(target_organ))
return
target_organ.embed(new shrapnel_type)

/datum/ammo/arrow/proc/drop_arrow(turf/T, obj/projectile/fired_projectile)
var/obj/item/arrow/arrow = new handful_type(T)
var/matrix/rotation = matrix()
rotation.Turn(fired_projectile.angle - 90)
arrow.apply_transform(rotation)

/datum/ammo/arrow/on_hit_mob(mob/mob,obj/projectile/projectile)
mob.apply_effect(1, STUN)
mob.apply_effect(3, DAZE)
if(!ishumansynth_strict(mob))
drop_arrow(get_turf(mob), projectile)
pushback(mob, projectile, 7)

/datum/ammo/arrow/on_hit_obj(obj/object,obj/projectile/projectile)
drop_arrow(get_turf(projectile), projectile)

/datum/ammo/arrow/on_hit_turf(turf/turf, obj/projectile/projectile)
if(turf.density && isturf(projectile.loc))
drop_arrow(projectile.loc, projectile)
else
drop_arrow(turf, projectile)

/datum/ammo/arrow/do_at_max_range(obj/projectile/projectile, mob/firer)
drop_arrow(get_turf(projectile), projectile)

/datum/ammo/arrow/expl
activated = TRUE
handful_type = /obj/item/arrow/expl
damage_type = BURN
flags_ammo_behavior = AMMO_HITS_TARGET_TURF
shrapnel_chance = 0
var/datum/effect_system/smoke_spread/smoke
ihatethisengine marked this conversation as resolved.
Show resolved Hide resolved

/datum/ammo/arrow/expl/New()
. = ..()
smoke = new()

/datum/ammo/arrow/expl/on_hit_mob(mob/mob,obj/projectile/projectile)
cell_explosion(get_turf(mob), 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, get_turf(mob))
smoke.start()

/datum/ammo/arrow/expl/on_hit_obj(obj/object,obj/projectile/projectile)
cell_explosion(get_turf(projectile), 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, get_turf(projectile))
smoke.start()
/datum/ammo/arrow/expl/on_hit_turf(turf/turf, obj/projectile/projectile)
if(turf.density && isturf(projectile.loc))
cell_explosion(get_turf(projectile), 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, get_turf(projectile))
smoke.start()
else
cell_explosion(turf, 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, turf)
smoke.start()

/datum/ammo/arrow/expl/do_at_max_range(obj/projectile/projectile, mob/firer)
cell_explosion(get_turf(projectile), 150, 50, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, projectile.weapon_cause_data)
smoke.set_up(1, get_turf(projectile))
smoke.start()

/datum/ammo/flare/starshell
name = "starshell ash"
icon_state = "starshell_bullet"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ GLOBAL_LIST_INIT(cm_vending_equipment_yautja, list(
list("The Agile Drone", 0, /obj/item/falcon_drone, MARINE_CAN_BUY_POUCH, VENDOR_ITEM_REGULAR),
list("The Purifying Smart-Disc", 0, /obj/item/explosive/grenade/spawnergrenade/smartdisc, MARINE_CAN_BUY_POUCH, VENDOR_ITEM_REGULAR),
list("The Steadfast Shield", 0, /obj/item/weapon/shield/riot/yautja, MARINE_CAN_BUY_POUCH, VENDOR_ITEM_REGULAR),
list("The Firm Bow", 0, /obj/item/storage/belt/gun/quiver/full, MARINE_CAN_BUY_POUCH, VENDOR_ITEM_REGULAR),

list("Clothing Accessory (CHOOSE 1)", 0, null, null, null),
list("Third-Cape", 0, /obj/item/clothing/yautja_cape/third, MARINE_CAN_BUY_ACCESSORY, VENDOR_ITEM_REGULAR),
Expand Down Expand Up @@ -66,6 +67,7 @@ GLOBAL_LIST_INIT(cm_vending_elder_yautja, list(
list("The Agile Drone", 0, /obj/item/falcon_drone, MARINE_CAN_BUY_POUCH, VENDOR_ITEM_REGULAR),
list("The Purifying Smart-Disc", 0, /obj/item/explosive/grenade/spawnergrenade/smartdisc, MARINE_CAN_BUY_POUCH, VENDOR_ITEM_REGULAR),
list("The Steadfast Shield", 0, /obj/item/weapon/shield/riot/yautja, MARINE_CAN_BUY_POUCH, VENDOR_ITEM_REGULAR),
list("The Firm Bow", 0, /obj/item/storage/belt/gun/quiver/full, MARINE_CAN_BUY_POUCH, VENDOR_ITEM_REGULAR),

list("Clothing Accessory (CHOOSE 1)", 0, null, null, null),
list("Third-Cape", 0, /obj/item/clothing/yautja_cape/third, MARINE_CAN_BUY_ACCESSORY, VENDOR_ITEM_REGULAR),
Expand Down
160 changes: 160 additions & 0 deletions code/modules/cm_preds/yaut_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,166 @@
user.update_power_display(perc)
return TRUE

/obj/item/weapon/gun/bow
name = "hunting bow"
desc = "An abnormal-sized weapon with an exeptionally tight string. Requires extraordinary strength to draw."
icon = 'icons/obj/items/hunter/pred_gear.dmi'
icon_state = "bow"
item_state = "bow"
item_icons = list(
WEAR_L_HAND = 'icons/mob/humans/onmob/hunter/items_lefthand.dmi',
WEAR_R_HAND = 'icons/mob/humans/onmob/hunter/items_righthand.dmi'
)
current_mag = /obj/item/ammo_magazine/internal/bow
reload_sound = 'sound/weapons/gun_shotgun_shell_insert.ogg'
fire_sound = 'sound/weapons/bow_shot.ogg'
aim_slowdown = 0
flags_equip_slot = SLOT_BLOCK_SUIT_STORE
flags_gun_features = GUN_INTERNAL_MAG|GUN_CAN_POINTBLANK|GUN_WIELDED_FIRING_ONLY|GUN_UNUSUAL_DESIGN
gun_category = GUN_CATEGORY_HEAVY
muzzle_flash = null
w_class = SIZE_LARGE
explo_proof = TRUE
unacidable = TRUE
flags_item = TWOHANDED|ITEM_PREDATOR

/obj/item/weapon/gun/bow/Initialize(mapload, spawn_empty)
. = ..(mapload, TRUE) //is there a better way?
update_icon()

/obj/item/weapon/gun/bow/set_gun_config_values()
..()
set_fire_delay(FIRE_DELAY_TIER_7)
accuracy_mult = BASE_ACCURACY_MULT
scatter = 0
recoil = RECOIL_AMOUNT_TIER_4

/obj/item/weapon/gun/bow/reload_into_chamber(mob/user)
. = ..()
update_icon()

/obj/item/weapon/gun/bow/unload(mob/user)
if(!current_mag || !current_mag.current_rounds)
return
var/obj/item/arrow/unloaded_arrow = new ammo.handful_type(get_turf(src))
playsound(user, reload_sound, 25, TRUE)
current_mag.current_rounds--
if(user)
to_chat(user, SPAN_NOTICE("You unload [unloaded_arrow] from [src]."))
user.put_in_hands(unloaded_arrow)
update_icon()


/obj/item/weapon/gun/bow/update_icon()
..()
if (!current_mag || current_mag.current_rounds == 0 || !istype(ammo, /datum/ammo/arrow))
return
var/datum/ammo/arrow/arrow = ammo
if (arrow.activated)
icon_state = "bow_expl"
else
icon_state = "bow_loaded"

/obj/item/weapon/gun/bow/attackby(obj/item/attacking_item, mob/user)
if(!istype(attacking_item, /obj/item/arrow))
to_chat(user, SPAN_WARNING("That's not an arrow!"))
return
if(!current_mag || current_mag.current_rounds == 1)
return to_chat(user, SPAN_WARNING("[src] is already loaded!"))
var/obj/item/arrow/attacking_arrow = attacking_item
if (user.r_hand != src && user.l_hand != src)
to_chat(user, SPAN_WARNING("You need to hold [src] in your hand in order to nock [attacking_arrow]!"))
return
if (!isyautja(user))
to_chat(user, SPAN_WARNING("You're not nearly strong enough to pull back [src]'s drawstring!"))
return
ammo = GLOB.ammo_list[attacking_arrow.ammo_datum]
playsound(user, reload_sound, 25, 1)
to_chat(user, SPAN_NOTICE("You nock [attacking_arrow] onto [src]."))
current_mag.current_rounds++
qdel(attacking_arrow)
update_icon()

/obj/item/weapon/gun/bow/dropped(mob/user)
. = ..()
if(!current_mag || !current_mag.current_rounds)
return
to_chat(user, SPAN_WARNING("The projectile falls out of [src]!"))
unload()

/obj/item/weapon/gun/bow/click_empty(mob/user)
return

/obj/item/ammo_magazine/internal/bow
name = "bow internal magazine"
caliber = "arrow"
max_rounds = 1
default_ammo = /datum/ammo/arrow

/obj/item/arrow
name = "arrow"
w_class = SIZE_SMALL
icon = 'icons/obj/items/hunter/pred_gear.dmi'
icon_state = "arrow"
item_state = "arrow"
sharp = IS_SHARP_ITEM_ACCURATE
edge = TRUE
force = 20
explo_proof = TRUE
unacidable = TRUE

var/activated = FALSE
var/ammo_datum = /datum/ammo/arrow

/obj/item/arrow/expl
name = "\improper activated arrow"
activated = TRUE
icon_state = "arrow_expl"
ammo_datum = /datum/ammo/arrow/expl

/obj/item/arrow/attack_self(mob/user)
. = ..()
if (!isyautja(user))
to_chat(user, SPAN_NOTICE("You attempt to [activated ? "deactivate" : "activate"] [src], but nothing happens."))
return
if (activated)
activated = FALSE
icon_state = "arrow"
ammo_datum = /datum/ammo/arrow
to_chat(user, SPAN_NOTICE("You deactivate [src]."))
return
activated = TRUE
icon_state = "arrow_expl"
ammo_datum = /datum/ammo/arrow/expl
to_chat(user, SPAN_NOTICE("You activate [src]."))


/obj/item/storage/belt/gun/quiver
name = "quiver strap"
desc = "A strap that can hold a bow with a quiver for arrows."
storage_slots = 8
max_storage_space = 20
icon_state = "quiver"
item_state = "s_marinebelt"
flags_equip_slot = SLOT_WAIST|SLOT_SUIT_STORE
max_w_class = SIZE_LARGE
icon = 'icons/obj/items/hunter/pred_gear.dmi'
item_icons = list(
WEAR_WAIST = 'icons/mob/humans/onmob/hunter/pred_gear.dmi',
WEAR_J_STORE = 'icons/mob/humans/onmob/hunter/pred_gear.dmi'
)
can_hold = list(
/obj/item/weapon/gun/bow,
/obj/item/arrow,
)
explo_proof = TRUE
unacidable = TRUE

/obj/item/storage/belt/gun/quiver/full/fill_preset_inventory()
handle_item_insertion(new /obj/item/weapon/gun/bow())
for(var/i = 1 to storage_slots - 1)
new /obj/item/arrow(src)

#undef FLAY_STAGE_SCALP
#undef FLAY_STAGE_STRIP
#undef FLAY_STAGE_SKIN
6 changes: 3 additions & 3 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ note dizziness decrements automatically in the mob's Life() proc.
return FALSE
to_chat(usr, SPAN_WARNING("You attempt to get a good grip on [selection] in [src]'s body."))

if(!do_after(usr, 80 * usr.get_skill_duration_multiplier(SKILL_SURGERY), INTERRUPT_ALL, BUSY_ICON_FRIENDLY))
if(!do_after(usr, 20 * selection.w_class * usr.get_skill_duration_multiplier(SKILL_SURGERY), INTERRUPT_ALL, BUSY_ICON_FRIENDLY))
return
if(!selection || !src || !usr || !istype(selection))
return
Expand Down Expand Up @@ -805,8 +805,8 @@ note dizziness decrements automatically in the mob's Life() proc.
affected.add_bleeding(I, TRUE)
affected.wounds += I
H.custom_pain("Something tears wetly in your [affected] as [selection] is pulled free!", 1)

selection.forceMove(get_turf(src))
playsound(loc, 'sound/weapons/bladeslice.ogg', 25)
usr.put_in_hands(selection)
return TRUE

///Can this mob resist (default FALSE)
Expand Down
Binary file modified icons/mob/humans/onmob/hunter/items_lefthand.dmi
Binary file not shown.
Binary file modified icons/mob/humans/onmob/hunter/items_righthand.dmi
Binary file not shown.
Binary file modified icons/mob/humans/onmob/hunter/pred_gear.dmi
Binary file not shown.
Binary file modified icons/obj/items/hunter/pred_gear.dmi
Binary file not shown.
Binary file modified icons/obj/items/weapons/projectiles.dmi
Binary file not shown.
Binary file added sound/weapons/bow_shot.ogg
Binary file not shown.
Loading