Files
Bubberstation/code/datums/mutations/sight.dm
SmArtKar ad111f4950 Spacemove refactor - Newtonian physics (#84869)
## About The Pull Request

This PR significantly enhances how zero-g movement works. Its no longer
locked to one of 8 directions, everything now has inertia and is
affected by weight. This means that throwing a piece of wire will no
longer completely reverse your movement direction, and that being thrown
out of mass driver no longer will slow you down to a halt at some point.

This leads to following gameplay changes:
* Guns now accelerate you. Ballistics have higher acceleration than
lasers, and higher calibers have higher acceleration than smaller ones.
This means that firing full-auto weapons in zero-g will make you drift
and accelerate significantly. While this can be a hilarious way to
travel in space, it makes using them trickier.
* Impacting a wall or an object while moving at high speeds will cause
you to violently crash into it as if you were thrown. Careful when
exploring!
* Jetpacks now have inertia. Changes introduced in #84712 have been
mostly reverted, although speed buff has been reduced to 0.3 instead of
0.5 (although this is compensated by new movement mechanics, so overall
speed should be roughly equal). All MODsuit jetpacks now possess the
speed boost. Advanced MODsuit jets (which has also been added back) and
captain's jetpack instead have higher acceleration and stabilization
power, providing much more precise control over your movement.
* Firing guns while moving on a jetpack will partially negate your
pack's acceleration, slowing you down. Non-advanced jetpacks'
stabilization is not enough to compensate for heavy caliber weaponry as
sniper rifles, shotguns or rocket launchers.
* You no longer instantly decelerate upon sliding along a wall. Instead,
it may take a few tiles if you are moving at extreme speeds. Passing
over lattices still allows you to grab onto them!

As space movement is angle-based instead of dir-based now, its much more
smooth than before due to using new movement logic.

Example of jetpack stabilization in action:

https://github.com/tgstation/tgstation/assets/44720187/6761a4fd-b7de-4523-97ea-38144b8aab41

And, of course, you can do this now.

![jetpack_500](https://github.com/tgstation/tgstation/assets/44720187/37b11cd8-2bd1-4640-ae0c-5e0cc505bf52)

**This pull request requires extensive gameplay testing before
merging**, as a large amount of numbers have been picked arbitrarily in
an attempt to keep consistency with previous behavior (guns and
normal-sized items applying 1 drift force, which is equal to what
everything applied before this PR). Jetpacks and impacts may also
require adjustments as to not be frustrating to use.

Closes #85165

## Why It's Good For The Game

Zero-G refactor - currently our zero-g movement is rather ugly and can
be uncomfortable to work with. A piece of cable being able to accelerate
you the same as a duffelbag full of items when thrown makes no sense,
and so does instantly changing directions. Inertia-based version is
smoother and more intuitive. This also makes being thrown into space
more of a hazard (possibly opening the door for explosive
decompressions?)
Jetpack inertia and gun changes - this is mostly a consequence of
inertia-based movement. However, zero-g combat being preferred during
modes like warops was an issue due to it negatively affecting everyone
without jetpacks which are in limited supply onboard. This reverts the
mobility changes which severely impacted space exploration, while making
zero-g combat more dangerous and having it require more skill to be a
viable option.

## What's left

- [x] Refactor moth wings to use jetpack code
- [x] Refactor functional wings to use jetpack code
- [x] Locate and fix a recursion runtime that sometimes occurs upon
splattering against a wall
- [x] Add craftable tethers and modify engineering MOD tethers to use
the same system

## Changelog
🆑
add: You can now craft tether anchors, which can be secured with a
wrench and attached to with right click. They won't let you drift into
space and you can adjust tether length/cut it via lmb/rmb/ctrl click on
the wire.
add: MOD tethers now remotely place and connect to tether anchors
instead of throwing you at where they landed.
balance: MOD tethers can now be used in gravity
balance: Jetpacks are now inertia-based. 
balance: Guns can accelerate you significantly in zero-g.
balance: All jetpacks now give you equal speed buff, however advanced
MOD ion jets and captain's jetpack have higher acceleration/deceleration
values.
refactor: Refactored zero-g movement to be inertia-based and utilize
angles instead of directions.
/🆑
2024-09-26 02:49:54 -07:00

202 lines
7.1 KiB
Plaintext

//Nearsightedness restricts your vision by several tiles.
/datum/mutation/human/nearsight
name = "Near Sightness"
desc = "The holder of this mutation has poor eyesight."
instability = NEGATIVE_STABILITY_MODERATE
quality = MINOR_NEGATIVE
text_gain_indication = span_danger("You can't see very well.")
/datum/mutation/human/nearsight/on_acquiring(mob/living/carbon/human/owner)
if(..())
return
owner.become_nearsighted(GENETIC_MUTATION)
/datum/mutation/human/nearsight/on_losing(mob/living/carbon/human/owner)
if(..())
return
owner.cure_nearsighted(GENETIC_MUTATION)
///Blind makes you blind. Who knew?
/datum/mutation/human/blind
name = "Blindness"
desc = "Renders the subject completely blind."
instability = NEGATIVE_STABILITY_MAJOR
quality = NEGATIVE
text_gain_indication = span_danger("You can't seem to see anything.")
/datum/mutation/human/blind/on_acquiring(mob/living/carbon/human/owner)
if(..())
return
owner.become_blind(GENETIC_MUTATION)
/datum/mutation/human/blind/on_losing(mob/living/carbon/human/owner)
if(..())
return
owner.cure_blind(GENETIC_MUTATION)
///Thermal Vision lets you see mobs through walls
/datum/mutation/human/thermal
name = "Thermal Vision"
desc = "The user of this genome can visually perceive the unique human thermal signature."
quality = POSITIVE
difficulty = 18
text_gain_indication = span_notice("You can see the heat rising off of your skin...")
text_lose_indication = span_notice("You can no longer see the heat rising off of your skin...")
instability = POSITIVE_INSTABILITY_MAJOR // thermals aren't station equipment
synchronizer_coeff = 1
power_coeff = 1
energy_coeff = 1
power_path = /datum/action/cooldown/spell/thermal_vision
/datum/mutation/human/thermal/on_losing(mob/living/carbon/human/owner)
if(..())
return
// Something went wront and we still have the thermal vision from our power, no cheating.
if(HAS_TRAIT_FROM(owner, TRAIT_THERMAL_VISION, GENETIC_MUTATION))
REMOVE_TRAIT(owner, TRAIT_THERMAL_VISION, GENETIC_MUTATION)
owner.update_sight()
/datum/mutation/human/thermal/modify()
. = ..()
var/datum/action/cooldown/spell/thermal_vision/to_modify = .
if(!istype(to_modify)) // null or invalid
return
to_modify.eye_damage = 10 * GET_MUTATION_SYNCHRONIZER(src)
to_modify.thermal_duration = 10 SECONDS * GET_MUTATION_POWER(src)
/datum/action/cooldown/spell/thermal_vision
name = "Activate Thermal Vision"
desc = "You can see thermal signatures, at the cost of your eyesight."
button_icon = 'icons/mob/actions/actions_changeling.dmi'
button_icon_state = "augmented_eyesight"
cooldown_time = 25 SECONDS
spell_requirements = NONE
/// How much eye damage is given on cast
var/eye_damage = 10
/// The duration of the thermal vision
var/thermal_duration = 10 SECONDS
/datum/action/cooldown/spell/thermal_vision/Remove(mob/living/remove_from)
REMOVE_TRAIT(remove_from, TRAIT_THERMAL_VISION, GENETIC_MUTATION)
remove_from.update_sight()
return ..()
/datum/action/cooldown/spell/thermal_vision/is_valid_target(atom/cast_on)
return isliving(cast_on) && !HAS_TRAIT(cast_on, TRAIT_THERMAL_VISION)
/datum/action/cooldown/spell/thermal_vision/cast(mob/living/cast_on)
. = ..()
ADD_TRAIT(cast_on, TRAIT_THERMAL_VISION, GENETIC_MUTATION)
cast_on.update_sight()
to_chat(cast_on, span_info("You focus your eyes intensely, as your vision becomes filled with heat signatures."))
addtimer(CALLBACK(src, PROC_REF(deactivate), cast_on), thermal_duration)
/datum/action/cooldown/spell/thermal_vision/proc/deactivate(mob/living/cast_on)
if(QDELETED(cast_on) || !HAS_TRAIT_FROM(cast_on, TRAIT_THERMAL_VISION, GENETIC_MUTATION))
return
REMOVE_TRAIT(cast_on, TRAIT_THERMAL_VISION, GENETIC_MUTATION)
cast_on.update_sight()
to_chat(cast_on, span_info("You blink a few times, your vision returning to normal as a dull pain settles in your eyes."))
if(iscarbon(cast_on))
var/mob/living/carbon/carbon_cast_on = cast_on
carbon_cast_on.adjustOrganLoss(ORGAN_SLOT_EYES, eye_damage)
///X-ray Vision lets you see through walls.
/datum/mutation/human/xray
name = "X Ray Vision"
desc = "A strange genome that allows the user to see between the spaces of walls." //actual x-ray would mean you'd constantly be blasting rads, which might be fun for later //hmb
text_gain_indication = span_notice("The walls suddenly disappear!")
instability = POSITIVE_INSTABILITY_MAJOR
locked = TRUE
/datum/mutation/human/xray/on_acquiring(mob/living/carbon/human/owner)
if(..())
return
ADD_TRAIT(owner, TRAIT_XRAY_VISION, GENETIC_MUTATION)
owner.update_sight()
/datum/mutation/human/xray/on_losing(mob/living/carbon/human/owner)
if(..())
return
REMOVE_TRAIT(owner, TRAIT_XRAY_VISION, GENETIC_MUTATION)
owner.update_sight()
///Laser Eyes lets you shoot lasers from your eyes!
/datum/mutation/human/laser_eyes
name = "Laser Eyes"
desc = "Reflects concentrated light back from the eyes."
quality = POSITIVE
locked = TRUE
difficulty = 16
text_gain_indication = span_notice("You feel pressure building up behind your eyes.")
layer_used = FRONT_MUTATIONS_LAYER
limb_req = BODY_ZONE_HEAD
/datum/mutation/human/laser_eyes/New(class_ = MUT_OTHER, timer, datum/mutation/human/copymut)
..()
if(!(type in visual_indicators))
visual_indicators[type] = list(mutable_appearance('icons/mob/effects/genetics.dmi', "lasereyes", -FRONT_MUTATIONS_LAYER))
/datum/mutation/human/laser_eyes/on_acquiring(mob/living/carbon/human/H)
. = ..()
if(.)
return
RegisterSignal(H, COMSIG_MOB_ATTACK_RANGED, PROC_REF(on_ranged_attack))
/datum/mutation/human/laser_eyes/on_losing(mob/living/carbon/human/H)
. = ..()
if(.)
return
UnregisterSignal(H, COMSIG_MOB_ATTACK_RANGED)
/datum/mutation/human/laser_eyes/get_visual_indicator()
return visual_indicators[type][1]
///Triggers on COMSIG_MOB_ATTACK_RANGED. Does the projectile shooting.
/datum/mutation/human/laser_eyes/proc/on_ranged_attack(mob/living/carbon/human/source, atom/target, modifiers)
SIGNAL_HANDLER
if(!source.combat_mode)
return
to_chat(source, span_warning("You shoot with your laser eyes!"))
source.changeNext_move(CLICK_CD_RANGE)
source.newtonian_move(get_angle(source, target))
var/obj/projectile/beam/laser/laser_eyes/LE = new(source.loc)
LE.firer = source
LE.def_zone = ran_zone(source.zone_selected)
LE.preparePixelProjectile(target, source, modifiers)
INVOKE_ASYNC(LE, TYPE_PROC_REF(/obj/projectile, fire))
playsound(source, 'sound/items/weapons/taser2.ogg', 75, TRUE)
///Projectile type used by laser eyes
/obj/projectile/beam/laser/laser_eyes
name = "beam"
icon = 'icons/mob/effects/genetics.dmi'
icon_state = "eyelasers"
/datum/mutation/human/illiterate
name = "Illiterate"
desc = "Causes a severe case of Aphasia that prevents reading or writing."
instability = NEGATIVE_STABILITY_MAJOR
quality = NEGATIVE
text_gain_indication = span_danger("You feel unable to read or write.")
text_lose_indication = span_danger("You feel able to read and write again.")
/datum/mutation/human/illiterate/on_acquiring(mob/living/carbon/human/owner)
if(..())
return
ADD_TRAIT(owner, TRAIT_ILLITERATE, GENETIC_MUTATION)
/datum/mutation/human/illiterate/on_losing(mob/living/carbon/human/owner)
if(..())
return
REMOVE_TRAIT(owner, TRAIT_ILLITERATE, GENETIC_MUTATION)