Commit Graph

41 Commits

Author SHA1 Message Date
SyncIt21
9c9a5d28ff Some alt & ctrl click improvements (#84203)
## About The Pull Request
Improved code quality of both so they resemble each other. Some of the
new specs are as follows

1. Moved` COMSIG_CLICK_ALT` & `COMSIG_CLICK_ALT_SECONDARY` up i.e.
before `can_perform_action()` making them pure hooks not bound by any
action checks giving components full control over them
2. Removed range check(`CAN_I_SEE`) & view check(`is_blind()`) out of
the base alt click proc. They now only apply to living mobs and don't
apply to ghosts(ghosts don't get blind & see everything) & revenants
(the range check still applies for revenants though).

This was actually a bug because these 2 checks were only meant to see if
the loot panel could be opened (as stated in
https://github.com/tgstation/tgstation/pull/83736#discussion_r1628097941)
but because they are at the top of the proc they also apply to all alt
click actions which is not intended. Also, by moving these checks down
to mob subtype levels some of the snowflake checks like this
7579e0e173/code/_onclick/click_alt.dm (L23)
can be removed. We should not check for subtypes within the parent type
proc but instead have subtypes override their parent procs to implement
custom behaviour
3. Removed redundant signals like` COMSIG_XENO_SLIME_CLICK_ALT` in
favour of just `COMSIG_MOB_ALTCLICKON`
4. While looking for alt click signal overrides I found alt click for
style meter was run timing, that's fixed now

## Changelog
🆑
fix: alt click runtime no more when using style meter
code: improved alt & ctrl click code
/🆑
2024-06-25 16:06:59 -07:00
Jeremiah
8e3f635b98 Alt click refactor (#82656)
## About The Pull Request
Rewrites how alt click works. 
Based heavily on #82625. What a cool concept, it flows nicely with
#82533.

Fixes #81242 
(tm bugs fixed)
Fixes #82668

<details><summary>More info for devs</summary>

Handy regex used for alt click s&r:
`AltClick\((.*).*\)(\n\t.*\.\.\(\))?`
`click_alt($1)` (yes I am aware this only copies the first arg. there
are no other args!)

### Obj reskins
No reason for obj reskin to check on every single alt click for every
object. It applies to only a few items.
- Moved to obj/item
- Made into signal
- Added screentips

### Ventcrawling
Every single atmospherics machine checked for ventcrawling capability on
alt click despite only 3 objects needing that functionality. This has
been moved down to those individual items.
</details>

## Why It's Good For The Game
For players: 
- Alt clicking should work more logically, not causing double actions
like eject disk and open item window
- Added context menus for reskinnable items
- Removed adjacency restriction on loot panel

For devs:
- Makes alt click interactions easier to work with, no more click chain
nonsense and redundant guard clauses.
- OOP hell reduced
- Pascal Case reduced
- Glorious snake case

## Changelog
🆑
add: The lootpanel now works at range.
add: Screentips for reskinnable items.
fix: Alt click interactions have been refactored, which may lead to
unintentional changes to gameplay. Report any issues, please.
/🆑
2024-04-16 17:48:03 -06:00
Jeremiah
d554ab7766 RPG Loot: Revisited & READY (#82533)
## About The Pull Request
Revival of #72881

A new alt click window with a tarkov-y loading spinner. Replaces the
object item window in stat panel.

## Videos
<details>
<summary>vids</summary>

toggleable grouping:

![syAA5zf6RK](https://github.com/tgstation/tgstation/assets/42397676/c89b372d-29f6-4ebe-895d-f73bbdc41c19)

now lists the floor as first obj:

![abc](https://github.com/tgstation/tgstation/assets/42397676/cd8dc962-2ac7-41bf-a5d3-b9e926116b06)

in action:

![dreamseeker_IkrPKt2QZt](https://github.com/tgstation/tgstation/assets/42397676/1f990aa0-60f0-47e7-9d93-b63e35d05273)

</details>

## features:
- search by name
- 515 image generator is much faster than alt click menu
- opening a gargantuan amount of items shouldnt freeze your screen
- groups similar items together in stacks by default, toggleable
- shows tile as first item
- <kbd>Shift</kbd> and <kbd>Ctrl</kbd> compatible with LMB
🖱️
- RMB points points at items (sry i could not get MMB working)
- key <kbd>Esc</kbd> to exit the window.


For devs:
- A new image generation tech.
- An error refetch mechanic to the Image component
- It does not "smart track" the items being added to the pile, just
reopen or refresh. This was a design decision.

## Why It's Good For The Game
Honestly I just dislike the stat panel

Fixes #53824

Fixes 

![image](https://github.com/tgstation/tgstation/assets/42397676/0e50faab-7d4d-4bf7-8c5b-4ac28547bfbd)

## Changelog
🆑
add: Added a loot window for alt-clicking tiles.
del: Removed the item browser from the stat panel.
/🆑

---------

Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
Co-authored-by: AnturK <AnturK@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2024-04-14 17:35:03 -04:00
John Willard
1389351ef9 You can now move and talk through statues and mannequins (#81188)
## About The Pull Request

I recently played a game where I rotated my skeleton model while
rotating my own character at the same time and it being in sync gave me
the realization on how cool it would be if the Coroner was able to
simply control the skeleton body.

I find skeleton displays very funny and I want to see more funny things
happen with them, so I thought this would be a good place to start, with
the benefits that it also works on mannequins and statues too so they
aren't left out.

Basically, while it is unanchored, if you have a statue/mannequin
grabbed, it will change its direction as you do, and speak the same
words you do. Your own messages can only be heard if the person is
directly next to you, revealing that it was you talking through it all
along.

I was originally gonna add this to the simple rotation component but
moved off when I decided to add talking through it, I left in the code
improvements I made to the component though since it is one of the
oldest components and hasn't been touched in a while.

Video demonstration (before I added the person also talking, just ignore
that missing)

https://github.com/tgstation/tgstation/assets/53777086/27242fc3-9649-418d-95cb-b31619319e97

While fixing the Toilet bong's rotation stuff I noticed a lot of it
wasn't up to proper code standards so I went over it and fixed issues I
had with it. It now doesn't give text saying you found something nasty
to species that still likes mice (like flypeople), and fixed its update
appearance to match the codebase standard set by the introduction of
``update_appearance`` many years ago.

## Why It's Good For The Game

It's a funny small idea I had and got inspired to add, it's a niche
mechanic that I think fits the aesthetic I am going for with Coroner and
also give a funny interaction with the human-like inanimate objects.

## Changelog

🆑
fix: Species that can eat mice don't get disgusted from seeing one in
the toilet bong.
add: Grabbing an unwrenched statue/mannequin/skeleton model will now
move its direction as you move yours, and you can talk through it.
/🆑
2024-02-08 14:19:31 +01:00
Bloop
4c870f71ca Fixes a bunch of callbacks that were being qdeleted, and code cleanup (#77904)
## About The Pull Request


![image](https://github.com/tgstation/tgstation/assets/13398309/559eb50a-461c-4220-b628-55412baaffc3)

Continuing the work of
https://github.com/tgstation/tgstation/pull/77850.

it started with finding one that was being missed and causing a
runtime...then I noticed a whole lot more. While I was doing this I
found callbacks that weren't being nulled in `Destroy()`, so I added
that wherever I found these spots as well as some general code cleanup.

There were a lot more of these than I initially hoped to encounter so
I'm labeling it as a refactor.

## Why It's Good For The Game

Fixes lots of runtimes, improves code resiliency.

## Changelog

🆑
refactor: fixed a bunch of instances of callbacks being qdeleted and
cleaned up related code
/🆑
2023-08-25 16:03:27 -06:00
LemonInTheDark
ed0999e4ea Adds error on qdeling callback, fixes errors this causes (#77850)
## About The Pull Request

You shouldn't ever qdel a callback. If you don't want to own it free
your ref (remove it from a list/set it to null). When all refs are
cleared it'll get cleaned up by byond itself
2023-08-22 21:32:30 -05:00
LemonInTheDark
ae5a4f955d Pulls apart the vestiges of components still hanging onto signals (#75914)
## About The Pull Request

Signals were initially only usable with component listeners, which while
no longer the case has lead to outdated documentation, names, and a
similar location in code.

This pr pulls the two apart. Partially because mso thinks we should, but
also because they really aren't directly linked anymore, and having them
in this midstate just confuses people.

[Renames comp_lookup to listen_lookup, since that's what it
does](102b79694f)

[Moves signal procs over to their own
file](33d07d01fd)

[Renames the PREQDELETING and QDELETING comsigs to drop the parent bit
since they can hook to more then just comps
now](335ea4ad08)

[Does something similar to the attackby comsigs (PARENT ->
ATOM)](210e57051d)

[And finally passes over the examine
signals](65917658fb)

## Why It's Good For The Game

Code makes more sense, things are better teased apart, s just good imo

## Changelog
🆑
refactor: Pulled apart the last vestiges of names/docs directly linking
signals to components
/🆑
2023-06-09 06:14:31 +00:00
Bloop
ac5236a251 Refactors sheet crafting to better support directional construction (#74572)
## About The Pull Request


0426f7ddba/code/game/objects/items/stacks/stack.dm (L449)

Ok, but can we not?

This PR refactors sheet crafting to generalize all the cases that were
previously locked behind grille/window type checks and such. In their
stead there are bitflags that can be set to achieve certain behaviors.

All the behavior from before should be preserved, but now it can be
extended to other items. E.g. if you want a railing that can be crafted
underneath directional windows, or an item that behaves like a grille
does--it's just a matter of setting the right obj_flags for it now.

This makes it very simple and painless to add new recipes that use
directional crafting! It's all modular now.

<details><summary>Details</summary>

---

### What I've done:

-Eliminated all the type checks, instead it will now be handled by
object flags and recipe vars, making for a much more configurable
system.

-Added two new obj_flags: `BLOCKS_CONSTRUCTION_DIR` and
`IGNORE_DENSITY`.
-Additionally, I renamed the existing flag `NO_BUILD` to
`BLOCKS_CONSTRUCTION`.

-Changes the proc `valid_window_location` to `valid_build_direction`,
and makes it work for things other than windows.

-Removed a deprecated `window_checks` var from the stack_recipe datum.
-Added three more vars to the stack_recipe datum: `check_direction` and
`check_density`, `is_fulltile`

-Decoupled `on_solid_ground` from the object density check. Now you can
set those separately, allowing you to make recipes that forbid/allow
building things over other things while in space.

---

### What the new flags do:

`BLOCKS_CONSTRUCTION` works as before---prevents objects from being
built on the object. I felt that the previous name was not descriptive
enough, you should know exactly what it does just from looking at the
name.
_example: dna scanner_

`BLOCKS_CONSTRUCTION_DIR` -- setting this on an object will prevent
objects from being built on it when their directions are the same.
_example: directional windows, windoors, railings_

`IGNORE_DENSITY` -- setting this on an object will cause its density to
be ignored when performing the construction density check. This could
have other potential uses as well in the future.
_example: grilles, directional windows, tables_

These three flags cover all the bases for the types of items that are
currently craftable, so there is no more need for any type checking or
weird snowflake window checks. Simply set the appropriate flag and it'll
work as you would expect.

---


### What the recipe vars do:
`check_direction` tells the recipe to check if there's something in that
direction with the `BLOCKS_CONSTRUCTION_DIR` flag set.

`check_density` tells the recipe to run the density check when set. This
is true by default. There are very few items in the game that currently
have this set to false--namely grilles. Setting this to false will make
it so that the object can be constructed regardless of what is in that
tile (unless `one_per_turf` is also set, which will make it so that you
can't craft the same thing twice in the same turf).

`is_fulltile` is used for fulltile windows, but it doesn't necessarily
have to be--you can give this to any recipe and it will adopt the same
properties as that of the fulltile window. Basically they have a special
case where they shouldn't be able to be built over directional
constructions, where normally things would be able to be. Setting this
makes check_direction true as well.

---

### In summary: 

Sheet crafting still works just as it did before. But the backend of it
has gotten a glow up and will be able to more easily support new
behaviors.

</details>

## Why It's Good For The Game

This makes the crafting system much more flexible to add recipes to, and
will prevent bad code practices of stacking more conditionals down the
line whenever someone wants to add an item that behaves like grilles or
directional windows in how they are constructed.

It had to be done. Those window checks were a mess.

## Changelog

🆑
qol: added fifty stack versions of remaining glass sheet stacks for ease
of debugging
refactor: refactored sheet crafting to better support directional
constructions that aren't windows
/🆑

---------

Co-authored-by: san7890 <the@san7890.com>
2023-04-15 21:48:34 -06:00
san7890
ccef887efe Lints Against Unmanaged Local Defines (#74333)
# MAINTAINER - USE THE BUTTON THAT SAYS "MERGE MASTER" THEN SET THE PR
TO AUTO-MERGE! IT'S MUCH EASIER FOR ME TO FIX THINGS BEFORE THEY SKEW
RATHER THAN AFTER THE FACT.

## About The Pull Request

Hey there,

This took a while to do, but here's the gist:

Python file now regexes every file in `/code` except for those that have
some valid reason to be tacking on more global defines. Some of those
reasons are simply just that I don't have the time right now (doing what
you see in this PR took a few hours) to refactor and parse what should
belong and what should be thrown out. For the time being though, this PR
will at least _halt_ people making the mistake of not `#undef`ing any
files they `#define` "locally", or within the scope of a file.

Most people forget to do this and this leads to a lot of mess later on
due to how many variables can be unmanaged on the global level. I've
made this mistake, you've made this mistake, it's a common thing. Let's
automatically check for it so it can be fixed no-stress.

Scenarios this PR corrects:

* Forgetting to undef a define but undeffing others.
* Not undeffing any defines in your file.
* Earmarking a define as a "file local" define, but not defining it.
* Having a define be a "file local" define, but having it be used
elsewhere.
* Having a "local" define not even be in the file that it only shows up
in.
* Having a completely unused define*

(* I kept some of these because they seemed important... Others were
junked.)
## Why It's Good For The Game

If you wanna use it across multiple files, no reason to not make it a
global define (maybe there's a few reasons but let's assume that this is
the 95% case).

Let me know if you don't like how I re-arranged some of the defines and
how you'd rather see it be implemented, and I'd be happy to do that.
This was mostly just "eh does it need it or not" sorta stuff.

I used a pretty cool way to detect if we should use the standardized
GitHub "error" output, you can see the results of that here
https://github.com/san7890/bruhstation/actions/runs/4549766579/jobs/8022186846#step:7:792
## Changelog
Nothing that really concerns players.

(I fixed up all this stuff using vscode, no regexes beyond what you see
in the python script. sorry downstreams)
2023-03-29 10:17:03 -07:00
Tim
a1ada2c9ef Refactor, improve, and rename canUseTopic to be can_perform_action (#73434)
This builds on what #69790 did and improved the code even further.
Notable things:
- `Topic()` is a deprecated proc in our codebase (replaced with
Javascript tgui) so it makes sense to rename `canUseTopic` to
`can_perform_action` which is more straightforward in what it does.
- Positional and named arguments have been converted into a easier to
use `action_bitflag`
- The bitflags adds some new checks you can use like: `NEED_GRAVITY |
NEED_LITERACY | NEED_LIGHT` when you want to perform an action.
- Redundant, duplicate, or dead code has been removed.
- Fixes several runtimes where `canUseTopic` was being called without a
proper target (IV drips, gibber, food processor)
- Better documentation for the proc and bitflags with examples
2023-02-16 20:22:14 -05:00
ShizCalev
65be90bf0d Fixes seeing rotation failed message ballons at distance (#72463) 2023-01-05 14:11:50 -06:00
Ghom
e514f5edfb Removing verbs from the simple_rotation component (#71740)
## About The Pull Request
Likely the most trival issue from the [Dev Cycles
Initiative](https://github.com/orgs/tgstation/projects/11) project:

Closes https://github.com/tgstation/dev-cycles-initiative/issues/20

## Why It's Good For The Game
On the face of how useful they may seem, these verbs are basically
surclassed by the more accessible click shortcuts, while also being an
additional cost, which I cannot readily quantify on my subpar hardware,
but likely to be but a smidge compared to loading the nukie outpost and
wizard shuttle everytime rather than on demand, for example.

## Changelog

🆑
del: Removed object rotation related verbs, overwhelmingly overshadowed
by the click shortcuts anyway.
/🆑
2022-12-12 12:08:01 -08:00
AnturK
4d6a8bc537 515 Compatibility (#71161)
Makes the code compatible with 515.1594+

Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword

And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.

@tgstation/commit-access Since the .proc/stuff is pretty big change.

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-11-15 03:50:11 +00:00
John Willard
91f02f2a6b canUseTopic now uses TRUE/FALSE instead of defines that just say TRUE (#69790)
* canUseTopic now uses TRUE/FALSE instead of defines that just say TRUE

The most idiotic thing I've seen is canUseTopic's defines, they literally just define TRUE, you can use it however you want, it doesn't matter, it just means TRUE. You can mix and match the args and it will set that arg to true, despite the name.

It's so idiotic I decided to remove it, so now I can reclaim a little bit of my sanity.
2022-10-01 09:47:52 -07:00
John Willard
48bf156206 Removes canuserrotate from simple rotation's screentip (#70002)
Removes canuserrotate from rotation context

Removes the check on whether the user can rotate a chair or not, in the screentip context message.
We shouldn't check to see if a person can or can't rotate a chair or not, they will instead get the feedback when they try to rotate it if they fail, but it's better if the screentip let them know it's a mechanic that exists.
2022-09-19 23:10:09 -07:00
Tim
c8b45b3e99 Add Alt RMB and Ctrl RMB screentips (used for Simple Rotation) (#69726)
* Add Alt RMB and Ctrl RMB to screentips

* Add Ctrl and Alt RMB screentips to defines
2022-09-15 00:45:24 -04:00
Mothblocks
29c9ebfdfa Adjust balloon alerts for the rotate component (#64801)
Adjusts the failure balloon alerts to have a !, which is standard.
Remove the balloon alert for rotating/flipping things, as the visual feedback is already there: it's the thing getting rotated/flipped. Plus it's too long.
2022-02-11 14:37:03 +00:00
Tim
612808cbd2 Rotation component refactor and improvements (#64441)
This adds some new defines and flags for the rotation component that lets us remove lots of c/p code chunks. I also added documentation to all the rotation defines that currently exist and in other spots that had weird behavior.

New rotation flags:

ROTATION_GHOSTS_ALLOWED - checks if ghosts are able to manipulate objects in config and lets them rotate the object
ROTATION_IGNORE_ANCHORED - this skips checking if an object is anchored (which normally prevents us from rotating) Used mainly for chairs.
ROTATION_NO_FLIPPING - this removes the flip verb from possible right click rotation options. Used for pipes that have custom flipping verbs instead
ROTATION_NEEDS_ROOM - this checks if an object needs to have an empty spot available in target direction. Used for windows and railings.

Objects can now be rotated in the direction based on which LMB or RMB you click with when you ALT click it. LMB is counter clockwise. RMB is clockwise. Before some objects could only be rotated clockwise. Now any object that inherits the rotation component can be rotated in either direction.

There was also a bug with wheelchairs that existed from when they were ported over from another codebase. The rotation logic was broken and never allowed anyone to rotate them. This has been fixed.

Rotation for IV_drips was enabled however Alt Click was being used for another proc and rotation was ignored because of this. I removed the rotation component due to this since I didn't want to change the hotkeys for IV drips since those have an actual effect on gameplay interactions while rotation does not.

Fingerprints are no longer added when something gets rotated. Only a few objects had this enabled but I believe this interaction was very spammy and unnecessary. I can readd this as a flag if needed but for now it's removed.

Alert balloons have replaced a lot of rotation to_chat() messages for the same reason as fingerprints. Rotating objects has almost no effect on gameplay and will only clutter a player's message log.

The hotkeys for pipe interactions had to be redone since Alt clicking was already being used in some situations. For regular pipes: Right clicking now changes the pipe layer. Alt clicking rotates the pipe. For Trinary pipes: Right clicking now flips the pipe device. Alt clicking rotates the device.

ComponentInitialize() is a deprecated function and the AddComponent proc was moved to Initialize for several objects.
2022-02-06 09:10:39 -03:00
LemonInTheDark
64afba725d Renames RemoveComponent, fixes a dumb runtime in Destroy (#60653)
* Renames RemoveComponent, as its purpose was unclear. Fixes up some dumb uses, and properly docs its status as a helper proc for transfering components
2021-08-02 22:23:00 -07:00
Watermelon914
375a20e49b Refactors most spans into span procs (#59645)
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs.
Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines.

Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing.
Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc.

(Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
2021-06-14 13:03:53 -07:00
Mothblocks
0f435d5dff Remove hideous inline tab indentation, and bans it in contributing guidelines (#56912)
Done using this command sed -Ei 's/(\s*\S+)\s*\t+/\1 /g' code/**/*.dm

We have countless examples in the codebase with this style gone wrong, and defines and such being on hideously different levels of indentation. Fixing this to keep the alignment involves tainting the blames of code your PR doesn't need to be touching at all. And ultimately, it's hideous.

There are some files that this sed makes uglier. I can fix these when they are pointed out, but I believe this is ultimately for the greater good of readability. I'm more concerned with if any strings relied on this.

Hi codeowners!

Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
2021-02-14 16:53:29 -08:00
Ghom
4c31b0e116 CanUseTopic() refactor. (#54747)
* CanUseTopic() refactor.

* Forgot about default_can_use_topic. Tested and working.

* Update bin.dm

* no-nonsense.
2020-11-25 13:12:12 +01:00
Qustinnus
87c4df3880 Food refactor part 1: Bread destruction and processable element (#53047) 2020-08-20 21:07:05 -03:00
Jared-Fogle
45c14f6330 Adds SIGNAL_HANDLER and SIGNAL_HANDLER_DOES_SLEEP to prevent signal callbacks from blocking (#52761)
Adds SIGNAL_HANDLER, a macro that sets SHOULD_NOT_SLEEP(TRUE). This should ideally be required on all new signal callbacks.

Adds BLOCKING_SIGNAL_HANDLER, a macro that does nothing except symbolize "this is an older signal that didn't necessitate a code rewrite". It should not be allowed for new work.

This comes from discussion around #52735, which yields by calling input, and (though it sets the return type beforehand) will not properly return the flag to prevent attack from slapping.

To fix 60% of the yielding cases, WrapAdminProcCall no longer waits for another admin's proc call to finish. I'm not an admin, so I don't know how many behinds this has saved, but if this is problematic for admins I can just make it so that it lets you do it anyway. I'm not sure what the point of this babysitting was anyway.

Requested by @optimumtact.
Changelog

cl
admin: Calling a proc while another admin is calling one will no longer wait for the first to finish. You will simply just have to call it again.
/cl
2020-08-20 09:11:28 +12:00
JJRcop
a1392847bd Remove ismovableatom macro (#9) 2020-02-17 15:03:16 +01:00
spessbandit
e3d1e5c53e ghosts can't use monitors; dextrous animals can climb crates; fixes atrocious spelling (#47262) 2019-10-22 04:37:35 -07:00
nemvar
5d804ad82f Signals for tool acts. (#45263)
About The Pull Request

This PR adds signals for all basic tool acts.
Replaced signals places where it's appropriate.
Why It's Good For The Game

It's kinda dirty how we used to do attackby and then check for tool behaviour. Since we now have stuff like plumbing and possibly that one laser PR, we need signals that directly relate to tool behaviour.
Changelog

cl
code: Added signals for all basic tool acts.
/cl
2019-07-26 09:47:22 +12:00
vuonojenmustaturska
8ddc9677c7 examine-code refactor (#44636)
* 1/4 done? maybe?

* more

* stuff

* incremental stuff

* stuff

* stuff & things

* mostly done but not yet

* stuffing

* stuffing 2: electric boogaloo

* Git Commit and the Kingdom of the Crystal Skull

* make it actually compile

* found more stuff

* fixes

* fix AI laws appearing out of order

* fix windows

* should be the remaining stuff

* this time for real

* i guess it should compile too

* fix sechuds
2019-06-19 22:07:57 +02:00
Emmett Gaines
c3f95024b2 Gets rid of the GetComponent macros (#44220)
* Removes the GetComponent macros

* Regex replacement for GET_COMPONENT

Search: `GET_COMPONENT\( *(.+?) *, *(.+?) *\)`
Replace: `var$2/$1 = GetComponent($2)`

* Regex replacement for GET_COMPONENT_FROM

Search: `GET_COMPONENT_FROM\( *(.+?) *, *(.+?) *, *(.+?) *\)`
Replace: `var$2/$1 = $3.GetComponent($2)`
2019-06-04 17:39:58 +02:00
Tad Hardesty
38977aa740 Fix Alt-Click to rotate soda and booze dispensers (#43522) 2019-04-08 10:37:39 +02:00
oranges
0267bce949 Turns out a bunch of components do not properly transfer because of (#42691)
one of three things.

    1. They don't use RegisterWithParent or UnregisterFromParent to unregister
       and register signals

    2. They use callbacks which refer to a source object, which is usually deleted
       on transfer, or lost in some manner, or simply makes no sense at all to be
       transferred

    3. the component was never designed to be transferred at all

TransferComponents gave no shits about any of this and just blindly transferred
all components, if they were actually capable of it or not.

I only noticed this because it was causing chairs to break as they would not register signals
and verbs correctly for rotation after being picked up and then placed down, and a player
reported that issue via ahelp.

Luckily we caught it before the rot got anywhere, only chairs and the shuttle subystem
tend to use this proc (Shuttle uses it on turfs), can you imagine if everything was using
this LMAO

Which is good because it's more dangerous than a loaded gun

I have added a can_transfer var, that is true when a component is valid to
actually transfer, which means the dev has actually thought about what happens when
you take the parent object away and swap it for another and all the crazy that is entailed
by this

I have done my best to audit what components are actually
transferable, but things are basically a hot mess (Thanks @Cyberboss )

The following components required edits:
Forensics:
did not register/deregister the clean_act signal properly, did not checkblood on new parent

Rotation:
did not use RegisterWithParent or UnregisterFromParent, turned out
to not be transferable anyway due to having callbacks that can be
passed in to the parent with unknown sources that we can't feasibly
reuse (i.e if you're transferred from a chair to a bed, your old rotation
call backs are no longer valid). Turns out the use case it was for (just chairs)
didn't need it anyway, so I just made it non valid for transfer.

Wet Floor:
Honestly this one is just a hot mess, it should be a subtype of the slippery
component with the extra wet turf handling.

As it is it basically manages a slippery component on top of it's own extra
functionality, so that's a major code smell.

I added registration/unregistration of the signals, and made it's pretransfer
remove the slippery component and the posttransfer add it back (via update_flags)

Components that seem transferable without issues
mirage_border
orbiter
decal
spill
storage (I hope to earth)
2019-03-05 20:27:29 +01:00
AnturK
1d403cecfb Fixes rotation verbs. (#40643) 2018-10-03 13:14:02 +03:00
ShizCalev
2fa1ac1349 Replaces istypes with the proper tool_behaviour checks. (#40414) 2018-10-01 03:10:31 +03:00
Emmett Gaines
0943e56e08 Adds the signal origin as the first arg to all signals (#39861)
* Adds the signal origin as the first arg to all signals

* Fixes some storage and nanite procs
2018-08-28 18:28:29 +03:00
Emmett Gaines
34a3d2da4d Refactors component signals registration (#38798)
Datums know what signals are being listened for and components can now be registered to listen for signals on more than one object.
2018-07-05 00:56:39 +03:00
AnturK
74ce12deff Fixes simple rotation component deletion (#38825)
* Fixes simple rotation component deletion

* Also remove verbs on destroy.
2018-07-01 13:58:43 -07:00
pigeons
6135ec864f Refactors bitflag macro values into bitshifts (#37234)
* Refactors bitflag values into bitshifts

* minor formatting edits

* Unbitshifts a macro set that skipped 3 for whatever reason
2018-04-19 18:36:35 -04:00
ShizCalev
3cb6ab32d2 Cleans up some duplicate canusetopic warnings 2018-02-11 09:56:43 -05:00
ShizCalev
bfde5ac057 [s] Fixes altclick exploits (#35456)
* Fixes altclick exploits

* Removed free spam, fixes monkey altclicks

* replaced named args with proper defines

* More cleanup and fixes

* Better yet

* Another exploit fix

* pet carrier fix
2018-02-11 16:06:12 +13:00
Ian Turk
1b35873f36 Fixed not being able to rotate anything except in the default rotation direction 2018-01-24 17:35:17 -06:00
AnturK
53909747c8 Simple rotation component. (#34476)
I'm going to port other rotations to it when i don't feel lazy.
Closes #34064
2018-01-23 21:09:15 +13:00