Commit Graph

11 Commits

Author SHA1 Message Date
SkyratBot
5a496e9842 [MIRROR] Micro-Optimize keyLoop's self time (#26513)
* Micro-Optimize keyLoop's self time (#81464)

<!-- 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

This is a REALLY hot proc, takes up to like 2% of total cpu at highpop
Let's micro it then

First, clients do not go null at random. It's not predictable per say
but it is consistent.
We can use this understanding to remove a bunch of null checks here

For loops are expensive. So rather then doing one each keyLoop, let's
cache the client's intended move direction on the client. Simplifies
some other code too

There is no sense running a turn call if it would have no effect, let's
be more intelligent about this

## 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. -->

🆑
refactor: Fucks with how movement keys are handled. Please report any
bugs
/🆑

<!-- 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. -->

* Micro-Optimize keyLoop's self time

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2024-02-15 17:38:09 -05:00
SkyratBot
4ecf8128e1 [MIRROR] Changes the scope component to be appliable to other items and not just guns. Binocs and the Curator's mothic cap use it. [MDB IGNORE] (#25962)
* Changes the scope component to be appliable to other items and not just guns. Binocs and the Curator's mothic cap use it.

* Update moth.dm

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2024-01-04 21:40:24 -05:00
SkyratBot
067188d366 [MIRROR] Micro-optimize qdel by only permitting one parameter [MDB IGNORE] (#25889)
* Micro-optimize qdel by only permitting one parameter (#80628)

Productionizes #80615.

The core optimization is this:

```patch
-	var/hint = to_delete.Destroy(arglist(args.Copy(2))) // Let our friend know they're about to get fucked up.
+	var/hint = to_delete.Destroy(force) // Let our friend know they're about to get fucked up.
```

We avoid a heap allocation in the form of copying the args over to a new
list. A/B testing shows this results in 33% better overtime, and in a
real round shaving off a full second of self time and 0.4 seconds of
overtime--both of these would be doubled in the event this is merged as
the new proc was only being run 50% of the time.

* Micro-optimize qdel by only permitting one parameter

---------

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2023-12-29 14:41:12 +00:00
SkyratBot
0b958ddbe0 [MIRROR] Fixes a bug with the scope getting stuck on mobs that get dusted or ghost [MDB IGNORE] (#24404)
* Fixes a bug with the scope getting stuck on mobs that get dusted or ghost (#78941)

## About The Pull Request

If you ghost while mid-scope (or similarly, if you get dusted/your mob
gets deleted) the mob's cursor would get all messed up due to some
oversights. This just clears up some of these logic errors and ensures
everything gets cleaned up properly.

Fixes https://github.com/Skyrat-SS13/Skyrat-tg/issues/24189
Fixes https://github.com/tgstation/tgstation/issues/78756

## Why It's Good For The Game

Fixes a bug. I don't think scopes are even in use here but they are
downstream.

<details>
<summary>Deleted and being dusted resets perspective and cursor
properly</summary>

![dreamseeker_SSU4YnEK4n](https://github.com/Skyrat-SS13/Skyrat-tg/assets/13398309/dcaa5238-0067-4923-a956-24c6ba4aa2b3)

![dreamseeker_GZEhuSJSGS](https://github.com/Skyrat-SS13/Skyrat-tg/assets/13398309/2b88db21-6560-486d-94d3-9773fa543c50)

</details>

<details>
<summary>So does ghosting</summary>

![dreamseeker_7n3uXZvDSI](https://github.com/tgstation/tgstation/assets/13398309/08f6272d-baba-4e8e-ae0b-db23331982f7)

</details>

## Changelog

🆑
fix: being killed or ghosting while being scoped will no longer cause
the cursor offset to persist in a bugged state
/🆑

---------

Co-authored-by: san7890 <the@ san7890.com>

* Fixes a bug with the scope getting stuck on mobs that get dusted or ghost

---------

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: san7890 <the@ san7890.com>
2023-10-17 16:35:30 -07:00
SkyratBot
44c654d771 [MIRROR] fixes cursor catchers not working without widescreen [MDB IGNORE] (#22893)
* fixes cursor catchers not working without widescreen (#77372)

## About The Pull Request
apparently vis x and vis y dont exist unless the object is transformed

## Changelog
🆑
fix: sniper scope and kinesis should work without widescreen
/🆑

* fixes cursor catchers not working without widescreen

---------

Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com>
2023-08-05 19:36:50 -04:00
SkyratBot
6dfe17306c [MIRROR] Pulls apart the vestiges of components still hanging onto signals [MDB IGNORE] (#21738)
* Pulls apart the vestiges of components still hanging onto signals

* update modular

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
2023-06-18 13:18:23 +00:00
SkyratBot
9a594755f3 [MIRROR] Renames delta time to be a more obvious name [MDB IGNORE] (#20507)
* Renames delta time to be a more obvious name

* updates to our code

---------

Co-authored-by: oranges <email@oranges.net.nz>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2023-04-12 20:45:43 +01:00
SkyratBot
ac2b1d5ec7 [MIRROR] Restores Spell Card targetting behaviour [MDB IGNORE] (#19776)
* Restores Spell Card targetting behaviour (#73706)

## About The Pull Request

Fixes #52946

This has been broken ever since #44112 which apparently removed the proc
in this component which selected a target for performance reasons and
just... didn't replace it with anything else? So it's been bricked ever
since.

In order to restore the removed mouse tracking behaviour I implemented
the pattern used in scoped weapons and the kinesis module. As this was
the third thing I could find to use this code, I abstracted it out into
an object where most of the shared behaviour lives. I tested those
things too and they still seem to do what they used to.

Here it is in action:

https://user-images.githubusercontent.com/7483112/221954852-22244bb1-7c87-452d-a9b0-ebed81c4c1ef.mp4

Because this spell now applies a full screen overlay in order to
function, it's really begging for someone to make some touhou-style art
with cards and patterns around the edge of the screen while you are in
aiming mode, but I'm not going to be the one to make it.

I tidied this component up and refactored it as best I could while I was
reworking it to use a full screen overlay but I am... not totally
confident that it should be a component at all given that it keeps being
created and destroyed. But also it has worked that way for like four
years now, so who am I to say.

Oh yeah also the icon for this spell broke, so I fixed it.

## Why It's Good For The Game

Makes a reasonably terrible wizard spell marginally less bad.
Maybe now that this component works, some other things can use it?
If we make a fourth thing which follows your cursor it won't need to
copy/paste code around.

## Changelog

🆑
fix: Spell Cards from the Wizard spell will now home in somewhat on the
target nearest to your cursor.
fix: The Spell Cards spell now displays the correct icon instead of a
big red "error" text.
/🆑

* Restores Spell Card targetting behaviour

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
2023-03-11 15:15:26 +00:00
Zonespace
f7c26bbf25 515 Compat (#17465)
* ONLY SKYRAT CHANGES

* ACTUALLY SKYRAT CHANGES

* yolo, revert later

* Update alternate_byond_versions.txt

Co-authored-by: AnturK <AnturK@users.noreply.github.com>
2022-11-15 06:59:06 +00:00
SkyratBot
f3faa38e1c [MIRROR] (hopefully) improvements to use of scope and kinesis module [MDB IGNORE] (#17302)
* (hopefully) improvements to use of scope and kinesis module (#70934)

## About The Pull Request
so, scope and kinesis are the only things in the game (other than the
body zone selector) which use the function MouseMove. this tracks every
mouse movement, which meant we had to stuff a cooldown on it to not
calculate a ton of useless stuff. this time can misalign if you move
your mouse fast, not registering at all, as well as not working out with
the 0.2 second processing time of the things handling it (the scope
component and kinesis module)
instead of doing that, we are now keeping the mouse parameters as a
variable, which we update with every mousemove to the current
parameters. then we handle the calculations right as we need them (in
the kinesis/scope) module, rather than relying on mousemove cooldowns,
this should hopefully feel way better

## Why It's Good For The Game
😁

## Changelog
🆑
qol: sniper scopes and kinesis module should feel better to use
/🆑

* (hopefully) improvements to use of scope and kinesis module

* seconds

Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com>
Co-authored-by: tastyfish <crazychris32@gmail.com>
2022-11-04 12:55:05 -04:00
SkyratBot
f5e5c368fa [MIRROR] Adds a scope component, removes old zooming and adds sniper marksman ammo. [MDB IGNORE] (#13110)
* Adds a scope component, removes old zooming and adds sniper marksman ammo. (#66218)

Removes the old sniper rifle zoom, replaces it with a scope component. the scope activates on right click and lets your camera follow your mouse.
https://streamable.com/2c63u4 (due to byond rounding some shots were weirdly missed in that video, its fixed now)
Also adds sniper marksman ammo to the nukie uplink. It does slightly less damage, but it is hitscan and has one guaranteed ricochet shot, so you can shoot a wall and it could still hit someone.

* Adds a scope component, removes old zooming and adds sniper marksman ammo.

Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com>
2022-04-25 17:38:49 -07:00