Commit Graph

104 Commits

Author SHA1 Message Date
grungussuss
613581897e /obj/item/clothing/head/mob_holder -> /obj/item/mob_holder (#91893)
## About The Pull Request
title
## Why It's Good For The Game
it inherits a lot of behavior from clothing which leads to lots of bugs
when it isn't actually clothes, for example: shredded overlays. this
should be better.
probably fixes a bunch of bugs
## Changelog
🆑
code: mob holders are no longer subtypes of clothes, report any issues
/🆑

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
2025-07-01 14:20:48 +01:00
jimmyl
a7eb32b7cc cleans up holodeck map templates + prevents the holodeck from overloading due to lag (#88792)
## About The Pull Request
removes unused holodeck template vars
prevents the holodeck from overloading if process is fired during
loading

## Why It's Good For The Game
unused var bad
holodeck shouldnt detonate if the server lags

## Changelog
🆑
fix: holodeck no longer explodes if the server lags while its loading a
new sim
/🆑
2024-12-30 22:48:49 -08:00
Tim
fcadec240a Fix holodeck computer using wrong power settings (#88568)
## About The Pull Request
The holodeck computer has a complex power formula since it calculates
the power requirements based on the choosen simulation and items inside.
One apparent problem that I discovered through testing is that when the
holodeck computer is idle or using the offline program it is drawing
power as if it was active...

This is not supposed to happen. Let's see what the code documentation
says for reference:

```
//Power use
/// dont use power
#define NO_POWER_USE 0
/// use idle_power_usage i.e. the power needed just to keep the machine on
#define IDLE_POWER_USE 1
/// use active_power_usage i.e. the power the machine consumes to perform a specific task
#define ACTIVE_POWER_USE 2

///Base global power consumption for idling machines
#define BASE_MACHINE_IDLE_CONSUMPTION (100 WATTS)
///Base global power consumption for active machines. The unit is ambiguous (joules or watts) depending on the use case for dynamic users.
#define BASE_MACHINE_ACTIVE_CONSUMPTION (BASE_MACHINE_IDLE_CONSUMPTION * 10)

///see code/__DEFINES/machines.dm
var/use_power = IDLE_POWER_USE
///the amount of static power load this machine adds to its area's power_usage list when use_power = IDLE_POWER_USE
var/idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION
///the amount of static power load this machine adds to its area's power_usage list when use_power = ACTIVE_POWER_USE
var/active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION
///the current amount of static power usage this machine is taking from its area
var/static_power_usage = 0
```

If the machine isn't in use it should be using `IDLE_POWER_USE` when it
is not active. So in our case, we have it offline but it is still using
`ACTIVE_POWER_USE` draining more power than it should.

There was also some misc edge case where if you are near the computer
and you change the simulation, it wouldn't update the power correctly
since having the UI of a computer active did not allow the power to
properly reset to the simulation or offline mode.

Anyway here is how it looks fixed. If you are ever checking power vars,
the ones you need to pay attention to are here:


![dreamseeker_b7B7ErVRVH](https://github.com/user-attachments/assets/01e6e78d-b6af-4245-b73a-4b5212c74953)

CC @SmArtKar Hopefully this is a sufficient enough explanation. If you
really need me to I can record a video of the before and after effects.

## Why It's Good For The Game
Holodeck computer does not drain power when it is offline mode. Instead
it uses the correct idle amount which is significantly reduced. This is
how all machines behave. Due to holodeck having unique power
calculations it was bugged.

## Changelog
🆑
fix: Fix holodeck computer using wrong power settings and not updating
properly
/🆑
2024-12-25 04:11:50 +00:00
Tim
dd0893569c Holodeck grammar tweak (#88566)
## About The Pull Request
Apparently adding a tiny coffee machine worth of power to make this
accurate:

`to_chat(user, span_warning("You vastly increase projector power and
override the safety and security protocols."))`

was too much. So let's just do a grammar tweak to fix it.

Is 

## Why It's Good For The Game
Accurate descriptions.

## Changelog
🆑
spellcheck: Fix holodeck emag message claiming to increase power
/🆑
2024-12-21 22:21:02 +01:00
Tim
980d8e421b Add human organ crate to emergency medical holodeck simulation (#88195)
## About The Pull Request
This adds a crate to medical holodeck sim with a full set of human
organs inside a freezer containing:
- heart
- lungs
- eyes
- ears
- tongue
- liver
- stomach
- appendix

##### (And yes, a holodeck organ can fade away while it's still inside
someone causing them to suffer organ loss)

## Why It's Good For The Game

Immersion.

## Changelog
🆑
add: Add medical human organ crate emergency medical holodeck simulation
/🆑
2024-12-07 00:08:22 +01:00
John Willard
1880003270 Reworks silicon/ai access checking & fixes some ui_act's (#84964)
## About The Pull Request

Currently to check for Silicon access, we do:
``if is silicon or is admin ghost or has unlimited silicon privileges or
has machine remote in hand``
What has unlimited silicon privileges? Bots, Drones, and admin ghosts.
To check for AI access, it just checks for AI instead of silicon, and
doesnt check for unlimited silicon privileges.

This was kinda silly, so I thought I should make this a little easier to
understand.
Now all silicon/ai traits come from ``AI_ACCESS_TRAIT`` or
``SILICON_ACCESS_TRAIT``. I made a single exception to keep Admin ghost,
since now instead of being a var on the client, we moved it to using the
same trait but giving it to the client instead, but since we have to
keep parity with previous functionality (admins can spawn in and not
have this on, it only works while as a ghost), I kept previous checks as
well.

No more type checks, removes a silly var on the mob level and another on
the client.

Now while I was doing this, I found a lot of tgui's ``ui_act`` still
uses ``usr`` and the wrong args, so I fixed those wherever I saw them,
and used a mass replace for the args.

Other changes:

- machinery's ``ui_act`` from
https://github.com/tgstation/tgstation/pull/81250 had ``isAI`` replaced
with ``HAS_AI_ACCESS``, this has been reverted. Machine wands and admin
ghosts no longer get kicked off things not on cameras. This was my
fault, I overlooked this when adding Human AI.
- Human AI's wand gives AI control as long as it's in your hand, you can
swap to your offhand. I hope this doesn't end up going horribly,
otherwise I'll revert this part. It should let human AIs not have their
UI closed on them when swapping to eat food or use their door wand or
whatnot.
- Bots previously had special checks to scan reagents and be
unobservant, I replaced this with giving them the trait. I also fixed an
instance of unobservant not being used, so now statues don't affect the
basic creature, whatever that is.

## Why It's Good For The Game

This is an easier to understand way of handling silicon access and makes
these mobs more consistent between eachother.
Other than what I've mentioned above, this should have no impact on
gameplay itself.

## Changelog

🆑
fix: Statues don't count as eyes to creatures.
fix: Human AIs and Admin ghosts no longer get kicked off of machines
that aren't on cameranets.
/🆑
2024-08-19 10:43:45 +00:00
SyncIt21
6d80956db1 Holodeck closet & crate items are marked as holograms (#84326)
## About The Pull Request
- Fixes #83834
- Fixes #74765

When a holographic closet/crate is opened for the 1st time all their
items are marked as holograms & get deleted when the simulation is
changed

## Changelog
🆑
fix: Holodeck closet & crate items are marked as holograms as well
fix: Holodeck closet & crate items delete themselves when the program is
changed
/🆑
2024-06-28 16:15:23 -06:00
FlufflesTheDog
f484c9ac87 Fix holodecks using infinitely increasing power (#83529)
## About The Pull Request
`update_mode_power_usage` updates the power usage variables for a
machine, so using that variable as the baseline in calculating new power
consumption, means that those calculations stack infinitely.
When this comes up elsewhere, the calculations are based off the
*initial* value, so this updates holodecks and holopads to use that
logic.
## Why It's Good For The Game
why are the chess players using 1.3 megawatts turn off the tv please
## Changelog
🆑 Fluffles
fix: holodecks no longer use increasing amounts of power the longer
they're on
/🆑
2024-05-29 21:42:35 +02:00
SyncIt21
227cdd2c7c [NO GBP] Patches & renaming for NO_DECONSTRUCTION flag (#82547)
## About The Pull Request

1. Renames `NO_DECONSTRUCTION` -> `NO_DEBRIS_AFTER_DECONSTRUCTION`. As
the name suggests when the object is deconstructed it won't drop any
items/debris. After my last refactor for this flag it now serves a new
purpose so its name has been changed to match that

2. Fixes objects that are now using `NO_DECONSTRUCTION` incorrectly.
Some of these changes include
- Removing the flag in objects where there are no means to deconstruct
them (e.g. jukebox, hydroponics soil, flora etc)
- Replacing the flags old purpose by overriding its tool procs so that
it regains its old behaviour(e.g. You once again cannot deconstruct ctf
reinforced tables, survival pods, indestructible windows etc)

## Changelog
🆑
code: renamed `NO_DECONSTRUCTION` to `NO_DEBRIS_AFTER_DECONSTRUCTION` so
its name matches its intended purpose
fix: fixes some items that incorrectly used `NO_DECONSTRUCTION` prior to
its refactor, meaning makes some objects non deconstructable again
/🆑
2024-04-10 18:58:11 -07:00
John Willard
fa31403353 LateInitialize is not allowed to call parent anymore (#82540)
## About The Pull Request

I've seen a few cases in the past where LateInitialize is done cause of
the init return value being set to do so for no real reason, I thought I
should try to avoid that by ensuring LateInitialize isn't ever called
without overriding.

This fixes a ton of machine's LateInitialize not calling parent
(mechpad, door buttons, message monitor, a lot of tram machines,
abductor console, holodeck computer & disposal bin), avoiding having to
set itself up to be connected to power. If they were intended to not
connect to power, they should be using ``NO_POWER_USE`` instead.

Also removes a ton of returns to LateInit when it's already getting it
from parent regardless (many cases of that in machine code).

## Why It's Good For The Game

I think this is better for coding standard reasons as well as just
making sure we're not calling this proc on things that does absolutely
nothing with them. A machine not using power can be seen evidently not
using power with ``NO_POWER_USE``, not so much if it's LateInitialize
not calling parent.

## Changelog

🆑
fix: Mech pads, door buttons, message monitors, tram machines, abductor
consoles & holodeck computers now use power.
/🆑
2024-04-08 22:15:07 -06:00
Jeremiah
9723b4b317 Replaces even more deciseconds with SECONDS (#82438)
## About The Pull Request
Using these search regexes:

Ending in 0:
`addtimer\((.*),\s?(\d{1,3})0\b\)`
replacement:
`addtimer($1, $2 SECONDS)`

Two digit ending in odd:
`addtimer\((.*), (\d)([1-9])\)$`
replacement:
`addtimer($1, $2.$3 SECONDS)`

Single digit ending odd:
`addtimer\((.*), ([1-9])\)$`
replacement:
`addtimer($1, 0.$2 SECONDS)`

## Why It's Good For The Game
Code readability

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2024-04-06 15:18:49 -06:00
Pickle-Coding
c1f11f26ce Converts arbitrary energy units to the joule. Fixes conservation of energy issues relating to charging cells. (#81579)
## About The Pull Request
Removes all arbitrary energy and power units in the codebase. Everything
is replaced with the joule and watt, with 1 = 1 joule, or 1 watt if you
are going to multiply by time. This is a visible change, where all
arbitrary energy units you see in the game will get proper prefixed
units of energy.

With power cells being converted to the joule, charging one joule of a
power cell will require one joule of energy.

The grid will now store energy, instead of power. When an energy usage
is described as using the watt, a power to energy conversion based on
the relevant subsystem's timing (usually multiplying by seconds_per_tick
or applying power_to_energy()) is needed before adding or removing from
the grid. Power usages that are described as the watt is really anything
you would scale by time before applying the load. If it's described as a
joule, no time conversion is needed. Players will still read the grid as
power, having no visible change.

Machines that dynamically use power with the use_power() proc will
directly drain from the grid (and apc cell if there isn't enough)
instead of just tallying it up on the dynamic power usages for the area.
This should be more robust at conserving energy as the surplus is
updated on the go, preventing charging cells from nothing.

APCs no longer consume power for the dynamic power usage channels. APCs
will consume power for static power usages. Because static power usages
are added up without checking surplus, static power consumption will be
applied before any machine processes. This will give a more truthful
surplus for dynamic power consumers.

APCs will display how much power it is using for charging the cell. APC
cell charging applies power in its own channel, which gets added up to
the total. This will prevent invisible power usage you see when looking
at the power monitoring console.

After testing in MetaStation, I found roundstart power consumption to be
around 406kW after all APCs get fully charged. During the roundstart APC
charge rush, the power consumption can get as high as over 2MW (up to
25kW per roundstart APC charging) as long as there's that much
available.

Because of the absurd potential power consumption of charging APCs near
roundstart, I have changed how APCs decide to charge. APCs will now
charge only after all other machines have processed in the machines
processing subsystem. This will make sure APC charging won't disrupt
machines taking from the grid, and should stop APCs getting their power
drained due to others demanding too much power while charging. I have
removed the delays for APC charging too, so they start charging
immediately whenever there's excess power. It also stops them turning
red when a small amount of cell gets drained (airlocks opening and shit
during APC charge rush), as they immediately become fully charged
(unless too much energy got drained somehow) before changing icon.

Engineering SMES now start at 100% charge instead of 75%. I noticed
cells were draining earlier than usual after these changes, so I am
making them start maxed to try and combat that.

These changes will fix all conservation of energy issues relating to
charging powercells.
## Why It's Good For The Game
Closes #73438
Closes #75789
Closes #80634
Closes #82031

Makes it much easier to interface with the power system in the codebase.
It's more intuitive. Removes a bunch of conservation of energy issues,
making energy and power much more meaningful. It will help the
simulation remain immersive as players won't encounter energy
duplication so easily. Arbitrary energy units getting replaced with the
joule will also tell people more meaningful information when reading it.
APC charging will feel more snappy.
## Changelog
🆑
fix: Fixes conservation of energy issues relating to charging
powercells.
qol: APCs will display how much power they are using to charge their
cell. This is accounted for in the power monitoring console.
qol: All arbitrary power cell energy units you see are replaced with
prefixed joules.
balance: As a consequence of the conservation of energy issues getting
fixed, the power consumption for charging cells is now very significant.
balance: APCs only use surplus power from the grid after every machine
processes when charging, preventing APCs from causing others to
discharge while charging.
balance: Engineering SMES start at max charge to combat the increased
energy loss due to conservation of energy fixes.
/🆑

---------

Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2024-03-23 16:58:56 +01:00
Time-Green
1016f62661 Fixes holodeck monkeys gibbing (#80660)
Holodeck takes apart all hologram atoms, blindly. This breaks a lot, but
most notably people.
I've also went and given monkeys organs again, which were removed in
#79068. This broke incredibly hard, because monkeys can't live without
DNA or organs (who would've thought)

Fixes #80369, #79184

🆑
fix: Holodeck monkeys are properly cleaned up now
fix: Holodeck monkeys have organs now
/🆑

Look they're so happy and wont gib on deload

![image](https://github.com/tgstation/tgstation/assets/7501474/7e1f5a12-143c-4906-9d1e-79559dcb49dc)

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2023-12-30 21:59:38 +01:00
san7890
5ce9d5806d Scopes NODECONSTRUCT_1 from flags_1 to obj_flags (#80104)
This flag only worked on the `/obj/structure` and `/obj/machinery`
level, so let's rescope it from `flags_1` and put it where it belongs -
`obj_flags`.
Bitflag operators should be scoped to their subtype specific bitfield,
not really useful to have this take up a spot on the `/atom` level if
absolutely nothing other than `/obj`s use it.
2023-12-08 08:49:14 +00:00
Ghom
d9c8bd9bae [READY] Fishing and aquarium expansion. (#76531)
Listing the changes, off the top of my head:
- Resprited fishing rods, hooks, and the worm bait!
- Added a new, telescopic fishing rod, that can be bought as a goodie.
The master rod is also telescopic now.
- Added a couple hooks. One that lets you move the bait up and down,
otherwise keeping it in place, and another that stops the fish from
escaping, but slowly kills it. The former from the bepis fishing tech
node, the latter frm the black market.
- Added a fishing skill and relative legendary reward: A fishing hat,
like the one that recites "women fear me, fish fear me"
- You can now stop fishing by activating the fishing rod in your hand,
and stops it from stealing all clicks on other things if it isn't in
your active hand.
- Reworked fishing traits into fish traits, which can apply to fish
after it has been caught.
- Expanded the fish breeding system. Traits may be passed down to
offsprings, and offsprings may evolve (mutate?) into different kind of
fishes if conditions when conditions are met.
- Added half a dozen new fishes, each with its own traits: lubefish,
sludgefish (and its purple variant), slimefish, unmarine bonemass and
unmarine mastodon. Also, holodeck fish, as a joke.
- New traits: lubed skin, parthenogenesis, toxic (new reagent), toxin
immunity, predator, necrophage, no mating, crossbreeder, aggressive and
revival. Converted Emulsijack's ability and Donkfish's yuckiness into
traits as well.
- Added a fish analyzer that you can scan aquariums and fishes with.
- Fish can now be blended if you really want to. The number of reagents
from blending, w_class, and the number of fillets you get from cutting
fish now scale with size and weight.
- fish feed is no longer infinite (but it should still be plenty).
- Implemented temperature requirements for aquarium fish.
- You can now buy (dead) fish from the black market for dirt cheap.
- Last but now least, toilets are now valid fishing spots.
2023-07-27 22:50:36 +02:00
nikothedude
ccf547c142 Adds an extra malf AI ability: Remote emagging. Also tidies up emag code and coverts a lot of things to balloon alerts (#76669)
## About The Pull Request

New malf AI upgrade

Remote safety overrides: Mid-cost, Mid-supply. Allows the AI to remotely
emag things it can see and can access.
1. Very useful for psychological warfare (Emagging APCs to throw the
crew off their trail)
2. Logically makes sense - why, of all things, can the AI not emag
anything when it's fundumentally integrated with the station's
electronics?
3. Generally speaking can only access things that make sense for it to
access - it cannot emag ethereals, sadly

In order for this to work, emag_act now returns a boolean, designating
if the emag had any effect.
While I was in there, I also added args to every single emag_act I could
find and added far more feedback/converted a lot of things to balloon
alerts to allow the AI to see if its emag had any effect.
## Why It's Good For The Game

It just makes sense that the AI, the most electronically-sensitive
entity in the game, would be able to emag things. Plus, more options
given to malf that aren't strictly MURDER KILL MURDER are always a plus,
especially if they allow for fancier plays.
## Changelog
🆑
add: New malf ability: Remote safety overrides. Allows the AI to
remotely emag things it has access to.
code: emag_act() now returns a boolean designating it's success in
emagging
code: All instances of emag_act() now have the proper arguments
qol: Most usecases of emagging now have some kind of feedback, and
existing feedback has been sanity checked and converted to balloon
alerts.
/🆑
2023-07-15 15:35:14 +01:00
MrMelbert
bfe3f19d53 Allows uniforms to have multiple accessories attached, removes armor from accessories (#76629)
## About The Pull Request


![image](https://github.com/tgstation/tgstation/assets/51863163/b7808325-bd8d-4949-9611-985be5475064)

- Multiple accessories can now be pinned to one jumpsuit. 
- All accessories are shown on examine, but only the first is shown
on-mob.

- Under-clothing code cleanup.

- Removed armor from all accessories. 

- Halved the mood given from Hope to accommodate the fact that it can
now stack with others.

- Generalizes dogtags. Now dogtags will show their string on
examine_more if examining the mob wearing it, so you can see the
contents of someone's Allergy Dogtag without removing their clothes.

## Why It's Good For The Game

Accessories are a surprisingly contentious slot for something supposed
to be entirely cosmetic, so I've decided to address that.

This turns accessories into almost entirely cosmetic, with some minor
effects like mood boosts or pen storage.

People will no longer have to choose between showing off a pride pen or
getting a medal from the HoP, or between wearing sick lavaland drip
items, while also letting us stretch our legs a bit without worrying
about clothing balance.

## Changelog

🆑 Melbert
add: You can now wear multiple accessories on your uniform at once (up
to five by default)
balance: Removed armor from accessories, and nerfs the effects of some
accessories.
/🆑
2023-07-12 19:34:47 +01: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
oranges
4c48966ff8 Renames delta time to be a more obvious name (#74654)
This tracks the seconds per tick of a subsystem, however note that it is
not completely accurate, as subsystems can be delayed, however it's
useful to have this number as a multiplier or ratio, so that if in
future someone changes the subsystem wait time code correctly adjusts
how fast it applies effects

regexes used

git grep --files-with-matches --name-only 'DT_PROB' | xargs -l sed -i
's/DT_PROB/SPT_PROB/g'
git grep --files-with-matches --name-only 'delta_time' | xargs -l sed -i
's/delta_time/seconds_per_tick/g'
2023-04-11 21:31:07 -07:00
Mothblocks
45dcc6e72b Abstract away stuff that acts on baseturfs directly into their own procs, and kills some dead code related to baseturfs + tests (#72117)
Adds some new procs relating to baseturfs that replaces some code that
reads and sets them directly. Moves them to their own file. **To
reviewers: Any proc in baseturfs.dm that is snake_case is mine, anything
else is just moved**.

Adds tests for the existing procs of baseturfs.

I'm going to be doing some optimizations to baseturfs that change the
actual representation of baseturfs, and so I'm prepping these to be
implementation agnostic.

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2022-12-27 06:29:49 +00:00
Kylerace
b4644e8024 fixes holodecks directly changing baseturfs (#72067)
## About The Pull Request
i did this with #59355 to fix a bug but it breaks guarantees with
baseturfs. now they arent broken.
## Why It's Good For The Game
this probably causes bugs under some conditions
2022-12-19 16:48:46 -08:00
AnturK
84f69359a0 More horrible 515 proc compatibility. (#71333)
So i left over some basic `/whatever/proc/format` uses in the original
PR this fixes it.

Notable exceptions to the rule:
- Paths in add_verb/remove_verb, we need full path instead of a name
there to access verb metadata so we can't use proc ref macros there.
- regex.Replace, found out that it does not accept call by name. Instead
i added new REGEX_REPLACE_HANDLER so we can at least try to mark these.

There's still leftover global procs that do not use GLOBAL_PROC_REF but
they functionally equivalent so that's for later.

I don't see any reasonable way to grep for this. But if you got any
ideas please share.
2022-11-22 07:55:43 +00:00
ShizCalev
9dab26371c Throws a bunch of parenthesis around to ensure dear Aunt Sally is always properly excused. (#71281)
Similar vein to #37116

This is supposed to be standard, yet here we are.

SHOULDN'T change anything, but there's likely something out there that's
bound to behave different because of it.


These were done manually, regex to find things that MIGHT need to be
corrected;
`^#define.+\+((?!\)).)*$`
`^#define.+-((?!\)).)*$`
`^#define.+\*((?!\)).)*$`
`^#define.+\/((?!\)).)*$` (yeah that's a lot of stuff.)
`^#define.+%((?!\)).)*$`
`^#define.+SECONDS((?!\)).)*$`
`^#define.+MINUTES((?!\)).)*$`
2022-11-21 20:53:06 -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
LemonInTheDark
d34fa4c642 Macro optimizes SSmapping saving 50% (#69632)
* 'optimizes' space transitions by like 0.06 seconds, makes them easier to read tho, so that's an upside

* ''''optimizes'''' parsed map loading

I'm honestly not sure how big a difference this makes, looked like small
percentage points if anything
It's a bit more internally concistent at least, which is nice. Also I
understand the system now.

I'd like to think it helped but I think this is kinda a "do you think
it's easier to read" sort of situation. if it did help it was by the
skin of its teeth

* Saves 0.6 seconds off loading meta and lavaland's map files

This is just a lot of micro stuff.
1: Bound checks don't need to be inside for loops, we can instead bound the iteration counts
2: TGM and DMM are parsed differently. in dmm a grid_set is one z level,
   in tgm it's one collumn. Realizing this allows you to skip copytexts and
   other such silly in the tgm implemenentation, saving a good bit of time
3: Min/max bounds do not need to be checked inside for loops, and can
   instead be handled outside of them, because we know the order of x
   and y iteration. This saves 0.2 seconds

I may or may not have made the code harder to read, if so let me know
and I'll check it over.

* Micro ops key caching significantly. Fixes macros bug

inserting \ into a dmm with no valid target would just less then loop
the string. Dumb

Anyway, optimizations. I save a LOT of time by not needing to call
find_next_delimiter_position for every entry and var set. (like maybe 0.5
seconds, not totally sure)
I save this by using splittext, which is significantly faster. this
would cause parsing issues if you could embed \n into dmms, but you
can't, so I'm safe.

Lemme see uh, lots of little things, stuff that's suboptimal or could be
done cheaper. Some "hey you and I both know a \" is 2 chars long sort of
stuff

I removed trim_text because the quote trimming was never actually used,
and the space trimming was slower then using the code in trim. I also
micro'd trim to save a bit of time. this saves another maybe 0.5.

Few other things, I think that's the main of it. Gives me the fuzzy
feelings

* Saves 50% of build_coordinate's time

Micro optimizing go brrrrr
I made turf_blacklist an assoc list rather then just a normal one, so
lookups are O(log n) instead of O(n). Also it's faster for the base case
of loading mostly space.

Instead of toggling the map loader right before and right after New()
calls, we toggle at the start of mapload, and disable then reenable if
we check tick. This saves like 0.3 seconds

Rather then tracking an area cache ourselves, and needing to pass it
around, we use a locally static list to reference the global list of
area -> type. This is much faster, if slightly fragile.

Rather then checking for a null turf at every line, we do it at the
start of the proc and not after. Faster this way, tho it can in theory
drop area vvs.

Avoids calling world.preloader_setup unless we actually have a unique
set of attributes. We use another static list to make this comparison
cheap. This saves another 0.3

Rather then checking for area paths in the turf logic, or vis versa, we
assume we are creating the type implied by the index we're reading off.
So only the last type entry will be loaded like a turf, etc.
This is slightly unsafe but saves a good bit of time, and will properly
error on fucked maps.

Also, rather then using a datum to hold preloader vars, we use 2 global
variables. This is faster.

This marks the end of my optimizations for direct maploading. I've
reduced the cost of loading a map by more then 50% now. Get owned.

* Adds a define for maploading tick check

* makes shuttles load again, removes some of the hard limits I had on the reader for profiling

* Macro ops cave generation

Cave generation was insanely more expensive then it had any right to be.
Maybe 0.5 seconds was saved off not doing a range(12) for EVERY SPAWNED
MOB.
0.14 was saved off using expanded weighted lists (A new idea of mine)
This is useful because I can take a weighted list, and condense it into
weight * path count. This is more memory heavy, and costs more to
create, but is so much faster then the proc.

I also added a naive implementation of gcd to make this a bit less bad.
It's not great, but it'll do for this usecase.

Oh and I changed some ChangeTurfs into New()s. I'm still not entirely
sure what the core difference between the two is, but it seems to work
fine.
I believe it's safe because the turf below us hasn't init'd yet, there's
nothing to take from them. It's like 3 seconds faster too so I'll be sad
when it turns out I'm being dumb

* Micros river spawning

This uses the same sort of concepts as the last change, mostly New being
preferable to ChangeTurf at this level of code.
This bit isn't nearly as detailed as the last few, I honestly got a bit
tired. It's still like 0.4 seconds saved tho

* Micros ruin loading

Turns out it saves time if you don't check area type for every tile on a
ruin. Not a whole ton faster, like 0.03, but faster.

Saves even more time (0.1) to not iterate all your ruin's turfs 3 times
to clear away lavaland mobs, when you're IN SPACE who wrote this.

Oh it also saves time to only pull your turf list once, rather then 3
times
2022-09-22 15:34:10 -07:00
Mooshimi
b09f3868f8 individual LOG_GAME (#68683)
About The Pull Request

    replaces a ton of log_game with user.log_message so the log is added to individual and global logs.
    adds a few logs for individual LOG_VICTIM, LOG_ATTACK etc logging.
    adds logging for bluespace launchpad's tele coords being changed.
    took the word "has" out of log_combat, as it's extra and just lengthens the log.

Why It's Good For The Admins

It's extremely laggy to open game.txt so an alternative is individual game logs
Changelog

cl
admin: A lot of game logs will now also be in individual game logs, for convenience in log diving.
admin: Added logging for bluespace launchpad x and y offset changes, which go to individual game logs.
admin: Attack logs will now be slightly shorter, one useless word was removed.
/cl
2022-08-05 09:32:02 +12:00
Jolly
cfc2330528 [MDB IGNORE] More /area/ typepath organization and cleanup (#67107)
This further continues what I did in b4fb8f3ed1 (but instead of just stations, its now every (most) applicable area in the game
2022-05-23 13:01:19 -06:00
Tastyfish
129bc94df2 Blacklists holodeck computer from unit_test/create_and_destroy (#66765)
The holodeck runtimes if it's not linked to a holodeck area.
When running integration tests on the default CI map, metastation, this is fine because the one created by create_and_destroy just links to the holodeck on-station. This technically would cause problems in a real game since it's a 2-way link, (create_and_destroy breaks the link to the real on-station computer when it does its test) but no unit tests check that.
Unfortunately, runtime and multiz debug don't have holodecks (for good reason, it's completely unnecessary for testing literally anything but specifically the holodeck) and fail CI as a result.

Since the unit test isn't trying to test for the existence of a well-designed recreation area, I've set unit_test/create_and_destroy to ignore the holodeck computer.

Edit: I've added better mapping error handling for this case in the holodeck. I still don't want a pointless mapping error in my CI either so I'm keeping the ignore.
2022-05-08 10:11:58 -07:00
LemonInTheDark
0504c0a2b4 Improper forced qdel cleanup, some expanded del all verbs (#66595)
* Removes all supurfolus uses of QDEL_HINT_LETMELIVE

This define exists to allow abstract, sturucturally important things to
opt out of being qdeleted.
It does not exist to be a "Immune to everything" get out of jail free
card.
We have systems for this, and it's not appropriate here.

This change is inherently breaking, because things might be improperly
qdeling these things. Those issues will need to be resolved in future,
as they pop up

* Changes all needless uses of COMSIG_PARENT_PREQDELETED

It exists for things that want to block the qdel. If that's not you,
don't use it

* Adds force and hard del verbs, for chip and break glass cases
respectively

The harddel verb comes with two options before it's run, to let you
tailor it to your level of fucked

* Damn you nova

Adds proper parent returns instead of . = ..()

Co-authored-by: Seth Scherer <supernovaa41@gmx.com>

* Ensures immortality talismans cannot delete their human if something goes fuckey. Thanks ath/oro for pointing this out

Co-authored-by: Seth Scherer <supernovaa41@gmx.com>
2022-05-06 17:52:45 -07:00
Ghilker
ffd1ae5fc0 Rebalanced Power consumption, increase for machines (#66059)
Machinery power consumption rebalance.
2022-04-20 09:50:54 +02:00
Tim
bdd0192168 Fix jumpsuits to drop accessories when destroyed (#65768)
Fixes #65103 and probably some other edge cases.

Medals of captaincy are an indestructible antag objective. If you attached the medal to the jumpsuit and somehow destroyed it, it would delete all the accessories on it. Now when jumpsuits are destroyed, they drop their accessories to the floor.
2022-03-30 15:07:06 +01:00
Gandalf
684eab3d31 Converts SFX keys into DEFINES (#65146)
About The Pull Request

Simply converts all instances of soundkeys that use get_sfx from strings into defines.

E.g. "sparks" is now SFX_SPARKS
Why It's Good For The Game

It makes life a lot easier when you're looking for a sound effect. You just type SFX_ and you get suggestions in VSC. Plus, it looks better.

image
Changelog

Not player facing.
2022-03-11 10:09:18 +13:00
Seth Scherer
b35e63c46a fix (#63943) 2022-01-09 19:51:08 -08:00
Seth Scherer
5c02cd35eb Fixes silicons being unable to disable holodeck safeties (#63834) 2022-01-05 11:09:12 -08:00
CocaColaTastesGood
135b6d83b0 Fixes exploit that allowed players to disable the safety of holodeck consoles without the proper conditions being followed (#62563)
About The Pull Request

As the title says. Players were able to disable the safety of the holodeck without the console being emagged, and without being a robot.
Why It's Good For The Game

I think it would be interesting to add some sort of replacement to this, like players with high gamer skill could disable the safety.
Changelog

cl
fix: Fixes an exploit that allowed players to disable holodeck safety without following the proper conditions
/cl
2021-11-04 18:08:41 +13:00
CocaColaTastesGood
e93d89f1da [s] Fixes exploits (#62549)
Removes an unsanitized to chat to world.
2021-11-04 09:07:20 +13:00
esainane
d521116acf Refactor /turf/var/intact (#62331)
Turfs have a variable, intact, which conflates three meanings:

    Determining whether there's something that can be pried out, such as directly with a crowbar or indirectly with a tile stack and a crowbar off-hand.
    Determining whether underfloor pieces are visible.
    Determining whether underfloor pieces can be interacted with - by players with tools, through interaction with effects like chemical acid, or foam.

When plating is hit with a stack of tiles, /turf/open/floor/attackby checks whether the turf is intact, and if so, ends the attack chain regardless of whether or not the attempt to hotswap a turf (with a crowbar) is successful or not. However, turfs which want the underfloor to be visible - such as catwalks and glass - set the intact variable to FALSE, and so can be repeatedly placed over one another, as if they were the first tile to be placed over the plating.

This refactors /turf/var/intact into two distinct variables:

    /turf/var/overfloor_placed, for whether or not there is something over plating.
    /turf/var/underfloor_visible, for whether or not the various underfloor pieces should be invisible, visible, or both visible and interactable.

All references to /turf/var/intact have been replaced with an equivalent overfloor_placed or underfloor_visible reference, depending on which check is appropriate. underfloor_accessibility can take one of UNDERFLOOR_HIDDEN, UNDERFLOOR_VISIBLE, or UNDERFLOOR_INTERACTABLE. This prevents cases such as acid foam or tools phasing through glass floors to affect the underfloor pieces underneath, and covers all kinds of unusual, not-wiring-visiblity usage such as Holodeck completeness, Revenant interaction, or station integrity checking.
2021-10-28 19:14:40 -03:00
LemonInTheDark
e663308b0d Adds SHOULD_NOT_SLEEP to Destroy. Why didn't we do this before. (#61943) 2021-10-09 04:29:33 -07:00
Kylerace
740a471dbb large refactor of machine/power code to cut down on processing time and wasted lists (#60317)
original pr here: #59789 (Closed because he didn't think it was good enough)
came back to this because i realized that

    all machines were area sensitive, meaning they had a list with at least a reference to themselves (assuming they arent in the contents of another movable which most arent) for the purposes of handling power differences when their area changes
    pipes are machines
    there are ~14k machines and ~6k pipes
    i made this problem worse with a recent pr by making it a nested list

so i needed to track what machines needed power, and this pr had work already done that could be used for that purpose. now machines that have use_power == NO_POWER_USE do not have this extra memory overhead for no reason

currently every machine that uses power draws that amount from its area from a dynamic channel via auto_use_power() which is called every SSmachines fire(), then in apc/process() the area's dynamic power draw is reset and the power is used. with static power its not calculated then reset every loop, its just taken from the grid. so now machines handle updating their static power usage from their current area (this doesnt touch power machines that require a wire connection). in order to allow this, use_power, idle_power_usage, and active_power_usage have setters to track state correctly and update the static power usage on the machines current area and handle area sensitivity.

also goes through a lot of heavy abusers of SSmachine processing time and tries to make it faster. makes airalarm/process() into a signal handler for COMSIG_TURF_EXPOSE since air alarms only need to process for changes.
Why It's Good For The Game

SSmachines isnt the heaviest hitter in terms of total cpu and certainly not in terms of overtime, but its not a lightweight. it frequently takes > 50ms to complete a run and seems to be in the top 5 or so of subsystem costs looking at some round profilers

also gets rid of a few thousand lists since every pipe no longer has two useless lists each (and any other machines that dont use power)

Love ya kyler

Co-authored-by: Rohesie <rohesie@gmail.com>
2021-09-01 18:10:47 -07:00
Kylerace
faeb380a2e fixes hard del with objects created from holodeck spawners (#60140)
turns out mobs spawned from holodeck spawners dont get registered for qdeletion, now they do. hard dels btfo

hard dels are poo poo and holodeck issues are definitely 100x worse
2021-07-11 23:18:51 -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
Kylerace
5a8c9f8274 fixes bug with holodecks referencing self deleting atoms in spawned (#59355)
decals were hard deleting whenever you loaded a holodeck program with them because it wasnt taking them out of the spawned list, now it does that. also goes around holodeck code and changes for loops to as anything and puts in better var names.

also since its been a while since i looked at holodeck code, the thing could really use a better rewrite one of these days.
2021-05-28 17:58:45 -07:00
Kylerace
e13fe75590 use SIGNAL_HANDLER REEEEEE (#59242)
makes as many procs as i can find use the SIGNAL_HANDLER define which i assumed they all already did
2021-05-24 15:28:02 -04:00
TheVekter
f80105ed21 Adds proper logging to Holodeck safeties and programs (#58149)
* Adds proper logging to Holodeck safeties and programs

* a more elegant solution
2021-04-05 23:29:28 +02:00
Kylerace
c7a399ec4a Fixes bug with atoms (including new players!!!!) not spawned from the holodeck being deleted by it if they happened to be initialized at the same time (#57510)
About The Pull Request

Fixes #57446
yeah not my best moment, holodeck currently sets SSatoms to add every call to InitAtom() to a list and then give it back to the holodeck console (it actually goes through map_template/holodeck to do it but whatever). However it turns out atom/New() calls InitAtom too, so if an atom is created while SSatoms is still creating the list to give to the holodeck then that atom is added to the list regardless of whether or not its actually from the holodeck template.

Now theres an extra argument to InitAtom that tells it whether its spawned directly from a map template (ie, its part of the input list of uninitialized atoms that InitializeAtoms was given) or otherwise the output list that the holodeck uses is populated by calling GetAllContents on all atom/movables spawned directly from the template.

also renamed some vars in initTemplateBounds because it was hard to reason what it was doing and made it use as anything

also note that loading a map template with returns_created_atoms = TRUE will no longer track atoms that arent in the map file but are spawned directly onto a turf, currently nothing does this with the holodeck (which is the only map template that has this feature)

by the way this bug is my fault
Why It's Good For The Game

incredibly incredibly unlucky new players dont deserve to be deleted just because they didnt spawn in the holodeck
Changelog

🆑
fix: the holodeck is no longer so powerful that it can destroy anything and everything that dares to start existing while it's busy loading programs
/🆑
2021-03-20 11:56:35 +13:00
Kylerace
00cf04b5a1 All Holobugs Must Die the Same Day Theyre Born or You Are Money Back Part Two (#56878)
runtime in holodeck/finish_spawn() that dealt with doing shit with the atoms in the spawned list, which in some cases cease to exist. now finish_spawn has a check to see if the entry in the spawned list actually exists.

also fixes another small issue with the holodeck process() continually trying to load the offline program and getting rejected which causes the holodeck to give the "ERROR. Recalibrating projection apparatus." message, which it no longer does if the program is forced.
2021-02-13 21:41:24 -08:00
Kylerace
ca7b419dea Turbo fix for holodecks not clearing previous programs under live server lag (#56566)
Fixes #56561
the holodeck control console now returns if the previous program still has not finished loading in, so it should now be impossible to have two concurrent load_program() processes running at the same time and thus programs should not overlap under lag. tested locally with around 80% time dilation and 0 holodeck cooldown while spamming the fuck out of loading simulations
2021-02-01 09:50:16 -03:00
Kylerace
052130ac0a see title (#56536) 2021-01-31 21:39:53 +01:00
Kylerace
98f58208c8 Refactors Holodeck to Use Map Templates, Again! Black Magic OOM Crashing No Longer Included (#55645)
Refactors the holodeck to use map templates instead of copy_contents_to, which every maintainer seems to have complaints about.

Fixes #41485 because the matches become part of the spawned list created by ssatoms
Fixes #54789 because the holodeck area no longer has the NO_TELEPORT flag
Fixes #55676 because the map templates cant be changed midround unlike the program copies in the centcom z level
Fixes #49318 because the holodeck no longer creates new areas like the original did

This pr also changes initTemplateBounds to be a /datum/map_template proc instead of a parsed_map proc. This was mainly so I wouldn't have to duplicate vars between map_template and parsed_map. It's also nice because there's no longer a parsed_map proc inside the map_template file, especially when it didn't need to be a parsed_map proc.

The holodeck sims wont take up space in the centcom z level any more (which allows for more possible programs in the future), and map templates are more heavily tested. This is also a chance to future proof the holodeck against bugs. Holodeck also seems more responsive. This should allow for a second custom holodeck in some future ruin as well, although that of course will not be in play for the near future because of the offstation content ban. Also I documented the fuck out of the holodeck
2021-01-30 11:56:29 -03:00
tralezab
1fd0485206 [READY] Hark! The Medieval Reality Simulation Dome Emergency Shuttle! (+speech mutation, NOTELEPORT fixes and teambuilder improvements) (#55424)
* HARK! THERE ARE SOME MAIDENS THAT NEED SAVING!

* claymores, chairs

* mapmerge, price increase, no losing the flag, no teleporting in, other small stuff

* oldworld language, medieval mutation, reviews

* see desc for full changelog

huge improvements to how medieval speech feels, CTF now fully lit, json beautified, bugs squashed and more NOTELEPORT exploits also quashed. (I NEED TO UNDO THIS FOR ATOMIZATION)

* removes my fixes? also bugfixes and CTF separation

* dumb json mistake, starting work on reality simulators

* BOWS ARE BROOOOOOOOOOOOOOOOOKEN

* br

* getting closer to working

* well, mostly everything now.

* finally ready

* removes languages stuff as it is buggy and does not work, fixes more bugs, fixes more bugs, fixes more bugs

* conflict fix

* linting

* more lint

* bow buff, speech fix, TON of ctf fixes

* oh fuck year

* NO MORE INSTA DELETING CREW

* whoops

* review handled

* pooosh

* conflict fix
2021-01-05 00:49:53 -08:00