mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-23 02:27:09 +01:00
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request So I decided to tweak xenohybrids some more <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> ## Why It's Good For The Game We love features <!-- Argue for the merits of your changes and how they benefit the game, especially if they are controversial and/or far reaching. If you can't actually explain WHY what you are doing will improve the game, then it probably isn't good for the game in the first place. --> ## Changelog <!-- If your PR modifies aspects of the game that can be concretely observed by players or admins you should add a changelog. If your change does NOT meet this description, remove this section. Be sure to properly mark your PRs to prevent unnecessary GBP loss. You can read up on GBP and it's effects on PRs in the tgstation guides for contributors. Please note that maintainers freely reserve the right to remove and add tags should they deem it appropriate. You can attempt to finagle the system all you want, but it's best to shoot for clear communication right off the bat. --> 🆑 add: Added a bunch of COMSIGnals to make the later work. add: Added new stealth ability for xenomorph hybrids /🆑 <!-- Both 🆑's are required for the changelog to work! You can put your name to the right of the first 🆑 if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. -->
83 lines
2.9 KiB
Plaintext
83 lines
2.9 KiB
Plaintext
//! shitcode in this file oop
|
|
/mob/living/throw_item(obj/item/I, atom/target, overhand = in_throw_mode == THROW_MODE_OVERHAND, neat = a_intent == INTENT_HELP, force = throw_impulse)
|
|
if(!I)
|
|
return FALSE
|
|
throw_mode_off()
|
|
// if we're not on a turf just don't
|
|
if(!isturf(loc) || !(isturf(target) || isturf(target.loc)) || QDELETED(I))
|
|
return FALSE
|
|
if(!can_throw_item(I, target))
|
|
return FALSE
|
|
if(is_in_inventory(I) && !can_unequip(I))
|
|
to_chat(src, SPAN_WARNING("You fail to throw [I] at [target]."))
|
|
return FALSE
|
|
// TODO: this entire override system is a bit complicated.
|
|
// can we make it better?
|
|
var/atom/movable/throwing = I.throw_resolve_actual(src)
|
|
// Seems Sanity checks are done.
|
|
SEND_SIGNAL(src, COMSIG_MOB_ON_THROW, I, target)
|
|
// overhand stuff
|
|
if(overhand)
|
|
var/delay = throwing.overhand_throw_delay(src)
|
|
visible_message(SPAN_WARNING("[src] starts preparing an overhand throw!"))
|
|
if(!do_after(src, delay))
|
|
return FALSE
|
|
// make sure they didn't bamboozle us.
|
|
if(QDELETED(throwing))
|
|
to_chat(src, SPAN_WARNING("You fail to throw [I] at [target]."))
|
|
return FALSE
|
|
// make sure there's no special behavior
|
|
if(!I.throw_resolve_override(throwing, src))
|
|
// drop item
|
|
if(is_in_inventory(I))
|
|
if(!drop_item_to_ground(I, INV_OP_SUPPRESS_SOUND))
|
|
to_chat(src, SPAN_WARNING("You fail to throw [I] at [target]."))
|
|
return FALSE
|
|
else
|
|
// just move it to our loc
|
|
I.forceMove(get_turf(src))
|
|
else
|
|
if(!isturf(throwing.loc))
|
|
CRASH("throw resolve override called but didn't move what we should throw to turf. this is bad practice.")
|
|
// but also make sure it's on the ground
|
|
if(!isturf(loc) || !(isturf(target) || isturf(target.loc)))
|
|
return FALSE
|
|
// point of no return
|
|
// special: make message first
|
|
if(overhand)
|
|
visible_message(SPAN_WARNING("[src] throws [throwing] overhand."))
|
|
else
|
|
visible_message(SPAN_WARNING("[src] has thrown [throwing]."))
|
|
I.throw_resolve_finalize(throwing, src)
|
|
// if the thing deleted itself, we didn't fail, it disappeared
|
|
if(QDELETED(throwing))
|
|
return TRUE
|
|
// point of no return but actually
|
|
|
|
var/impulse = throw_impulse
|
|
// overhand throws are weak
|
|
if(overhand)
|
|
impulse *= (1 / OVERHAND_THROW_FORCE_REDUCTION_FACTOR)
|
|
|
|
//! stupid shit
|
|
var/the_range = throwing.throw_range
|
|
if(ismob(throwing))
|
|
var/mob/M = throwing
|
|
the_range = round(M.throw_range * min(mob_size / M.mob_size, 1))
|
|
//! stupid shit end, refactor grabs when?
|
|
|
|
newtonian_move(get_dir(target, src))
|
|
|
|
throwing.throw_at(target, the_range, null, (a_intent != INTENT_HARM? THROW_AT_IS_NEAT : NONE) | (overhand? THROW_AT_OVERHAND : NONE), src, force = impulse)
|
|
|
|
trigger_aiming(TARGET_CAN_CLICK)
|
|
return TRUE
|
|
|
|
/mob/living/throw_at(atom/target, range, speed, flags, atom/thrower, datum/callback/on_hit, datum/callback/on_land, force)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
var/turf/T = get_turf(target)
|
|
if(ismob(thrower))
|
|
add_attack_logs(thrower, src, "Thrown via grab to [COORD(T)]")
|