mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
All camelCase (Brute|Burn|Fire|Tox|Oxy|Organ|Stamina)(Loss) procs now use snake_case. UNDERSCORES RULE! (#94111)
## About The Pull Request It's just a partial cleanup of anti-[STYLE](https://github.com/tgstation/tgstation/blob/master/.github/guides/STYLE.md) code from /tg/'s ancient history. I compiled & tested with my helpful assistant and damage is still working. <img width="1920" height="1040" alt="image" src="https://github.com/user-attachments/assets/26dabc17-088f-4008-b299-3ff4c27142c3" /> I'll upload the .cs script I used to do it shortly. ## Why It's Good For The Game Just minor code cleanup. Script used is located at https://metek.tech/camelTo-Snake.7z EDIT 11/23/25: Updated the script to use multithreading and sequential scan so it works a hell of a lot faster ``` /* // Copyright 2025 Joshua 'Joan Metekillot' Kidder This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. // */ using System.Text.RegularExpressions; class Program { static async Task Main(string[] args) { var readFile = new FileStreamOptions { Access = FileAccess.Read, Share = FileShare.ReadWrite, Options = FileOptions.Asynchronous | FileOptions.SequentialScan }; FileStreamOptions writeFile = new FileStreamOptions { Share = FileShare.ReadWrite, Access = FileAccess.ReadWrite, Mode = FileMode.Truncate, Options = FileOptions.Asynchronous }; RegexOptions regexOptions = RegexOptions.Multiline | RegexOptions.Compiled; Dictionary<string, int> changedProcs = new(); string regexPattern = @"(?<=\P{L})([a-z]+)([A-Z]{1,2}[a-z]+)*(Brute|Burn|Fire|Tox|Oxy|Organ|Stamina)(Loss)([A-Z]{1,2}[a-z]+)*"; Regex camelCaseProcRegex = new(regexPattern, regexOptions); string snakeify(Match matchingRegex) { var vals = matchingRegex.Groups.Cast<Group>().SelectMany(_ => _.Captures).Select(_ => _.Value).ToArray(); var newVal = string.Join("_", vals.Skip(1).ToArray()).ToLower(); string logString = $"{vals[0]} => {newVal}"; if (changedProcs.TryGetValue(logString, out int value)) { changedProcs[logString] = value + 1; } else { changedProcs.Add(logString, 1); } return newVal; } var dmFiles = Directory.EnumerateFiles(".", "*.dm", SearchOption.AllDirectories).ToAsyncEnumerable<string>(); // uses default ParallelOptions // https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.paralleloptions?view=net-10.0#main await Parallel.ForEachAsync(dmFiles, async (filePath, UnusedCancellationToken) => { var reader = new StreamReader(filePath, readFile); string oldContent = await reader.ReadToEndAsync(); string newContent = camelCaseProcRegex.Replace(oldContent, new MatchEvaluator((Func<Match, string>)snakeify)); if (oldContent != newContent) { var writer = new StreamWriter(filePath, writeFile); await writer.WriteAsync(newContent); await writer.DisposeAsync(); } reader.Dispose(); }); var logToList = changedProcs.Cast<KeyValuePair<string, int>>().ToList(); foreach (var pair in logToList) { Console.WriteLine($"{pair.Key}: {pair.Value} locations"); } } } ``` ## Changelog 🆑 Bisar code: All (Brute|Burn|Fire|Tox|Oxy|Organ|Stamina)(Loss) procs now use snake_case, in-line with the STYLE guide. Underscores rule! /🆑
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
if(HAS_TRAIT(user, TRAIT_STRENGTH)) //The strong get reductions to stamina damage taken while exercising
|
||||
stamina_exhaustion *= 0.5
|
||||
|
||||
user.adjustStaminaLoss(stamina_exhaustion)
|
||||
user.adjust_stamina_loss(stamina_exhaustion)
|
||||
user.mind?.adjust_experience(/datum/skill/athletics, is_heavy_gravity ? 0.6 : 0.3)
|
||||
user.apply_status_effect(/datum/status_effect/exercised)
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
if(HAS_TRAIT(user, TRAIT_STRENGTH)) //The strong get reductions to stamina damage taken while exercising
|
||||
stamina_exhaustion *= 0.5
|
||||
|
||||
user.adjustStaminaLoss(stamina_exhaustion * seconds_per_tick)
|
||||
user.adjust_stamina_loss(stamina_exhaustion * seconds_per_tick)
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
playsound(src.loc, 'sound/effects/splat.ogg', 25, TRUE)
|
||||
target.emote("scream")
|
||||
target.add_splatter_floor()
|
||||
target.adjustBruteLoss(30)
|
||||
target.adjust_brute_loss(30)
|
||||
target.setDir(2)
|
||||
var/matrix/m180 = matrix(target.transform)
|
||||
m180.Turn(180)
|
||||
@@ -142,7 +142,7 @@
|
||||
buckled_mob.visible_message(span_warning("[buckled_mob] struggles to break free from [src]!"),\
|
||||
span_notice("You struggle to break free from [src], exacerbating your wounds! (Stay still for two minutes.)"),\
|
||||
span_hear("You hear a wet squishing noise.."))
|
||||
buckled_mob.adjustBruteLoss(30)
|
||||
buckled_mob.adjust_brute_loss(30)
|
||||
if(!do_after(buckled_mob, 2 MINUTES, target = src, hidden = TRUE))
|
||||
if(buckled_mob?.buckled)
|
||||
to_chat(buckled_mob, span_warning("You fail to free yourself!"))
|
||||
@@ -150,7 +150,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/structure/kitchenspike/post_unbuckle_mob(mob/living/buckled_mob)
|
||||
buckled_mob.adjustBruteLoss(30)
|
||||
buckled_mob.adjust_brute_loss(30)
|
||||
INVOKE_ASYNC(buckled_mob, TYPE_PROC_REF(/mob, emote), "scream")
|
||||
buckled_mob.AdjustParalyzed(20)
|
||||
var/matrix/m180 = matrix(buckled_mob.transform)
|
||||
|
||||
@@ -374,7 +374,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/shower, (-16))
|
||||
to_chat(living, span_warning("[src] is freezing!"))
|
||||
else if(current_temperature == SHOWER_BOILING)
|
||||
living.adjust_bodytemperature(35, 0, 500)
|
||||
living.adjustFireLoss(5)
|
||||
living.adjust_fire_loss(5)
|
||||
to_chat(living, span_danger("[src] is searing!"))
|
||||
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
/obj/structure/spawner/nether/process(seconds_per_tick)
|
||||
for(var/mob/living/living_mob in contents)
|
||||
playsound(src, 'sound/effects/magic/demon_consume.ogg', 50, TRUE)
|
||||
living_mob.adjustBruteLoss(60 * seconds_per_tick)
|
||||
living_mob.adjust_brute_loss(60 * seconds_per_tick)
|
||||
new /obj/effect/gibspawner/generic(get_turf(living_mob), living_mob)
|
||||
if(living_mob.stat == DEAD)
|
||||
var/mob/living/basic/blankbody/newmob = new(loc)
|
||||
@@ -280,7 +280,7 @@
|
||||
. = ..()
|
||||
if(!IS_CULTIST(user) && isliving(user))
|
||||
var/mob/living/living_user = user
|
||||
living_user.adjustOrganLoss(ORGAN_SLOT_BRAIN, 15)
|
||||
living_user.adjust_organ_loss(ORGAN_SLOT_BRAIN, 15)
|
||||
. += span_danger("The voices of the damned echo relentlessly in your mind, continously rebounding on the walls of your self the more you focus on [src]. Your head pounds, better keep away...")
|
||||
else
|
||||
. += span_cult("The gateway will create one weak proteon construct every [spawn_time * 0.1] seconds, up to a total of [max_mobs], that may be controlled by the spirits of the dead.")
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
/obj/structure/trap/damage/trap_effect(mob/living/victim)
|
||||
to_chat(victim, span_bolddanger("The ground quakes beneath your feet!"))
|
||||
victim.Paralyze(10 SECONDS)
|
||||
victim.adjustBruteLoss(35)
|
||||
victim.adjust_brute_loss(35)
|
||||
var/obj/structure/flora/rock/style_random/giant_rock = new(get_turf(src))
|
||||
QDEL_IN(giant_rock, 20 SECONDS)
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
playsound(src.loc, SFX_SWING_HIT, 25, TRUE)
|
||||
swirlie.visible_message(span_danger("[user] slams the toilet seat onto [swirlie]'s head!"), span_userdanger("[user] slams the toilet seat onto your head!"), span_hear("You hear reverberating porcelain."))
|
||||
log_combat(user, swirlie, "swirlied (brute)")
|
||||
swirlie.adjustBruteLoss(5)
|
||||
swirlie.adjust_brute_loss(5)
|
||||
return
|
||||
|
||||
if(user.pulling && isliving(user.pulling))
|
||||
@@ -151,10 +151,10 @@
|
||||
var/mob/living/carbon/carbon_grabbed = grabbed_mob
|
||||
if(!carbon_grabbed.internal)
|
||||
log_combat(user, carbon_grabbed, "swirlied (oxy)")
|
||||
carbon_grabbed.adjustOxyLoss(5)
|
||||
carbon_grabbed.adjust_oxy_loss(5)
|
||||
else
|
||||
log_combat(user, grabbed_mob, "swirlied (oxy)")
|
||||
grabbed_mob.adjustOxyLoss(5)
|
||||
grabbed_mob.adjust_oxy_loss(5)
|
||||
if(was_alive && swirlie.stat == DEAD && swirlie.client)
|
||||
swirlie.client.give_award(/datum/award/achievement/misc/swirlie, swirlie) // just like space high school all over again!
|
||||
swirlie = null
|
||||
@@ -162,7 +162,7 @@
|
||||
playsound(src.loc, 'sound/effects/bang.ogg', 25, TRUE)
|
||||
grabbed_mob.visible_message(span_danger("[user] slams [grabbed_mob.name] into [src]!"), span_userdanger("[user] slams you into [src]!"))
|
||||
log_combat(user, grabbed_mob, "toilet slammed")
|
||||
grabbed_mob.adjustBruteLoss(5)
|
||||
grabbed_mob.adjust_brute_loss(5)
|
||||
return
|
||||
|
||||
if(cistern_open && !cover_open && IsReachableBy(user))
|
||||
|
||||
@@ -37,7 +37,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/urinal, 32)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.visible_message(span_danger("[user] slams [grabbed_mob] into [src]!"), span_danger("You slam [grabbed_mob] into [src]!"))
|
||||
grabbed_mob.emote("scream")
|
||||
grabbed_mob.adjustBruteLoss(8)
|
||||
grabbed_mob.adjust_brute_loss(8)
|
||||
else
|
||||
to_chat(user, span_warning("You need a tighter grip!"))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user