From 7131a3f2e216bfe686db5e26a56ecdbdda0283a8 Mon Sep 17 00:00:00 2001
From: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
Date: Wed, 23 Feb 2022 01:36:02 -0600
Subject: [PATCH] Fixes Dreamchecker warnings in the codebase (#17422)
---
code/__HELPERS/type2type.dm | 4 +-
code/game/gamemodes/nuclear/nuclear.dm | 2 +-
code/game/machinery/syndicatebeacon.dm | 11 ++-
.../machinery/pipes/simple/pipe_simple.dm | 4 +-
code/modules/events/ion_storm.dm | 2 +-
code/modules/flufftext/TextFilters.dm | 80 -------------------
code/modules/hallucinations/hallucinations.dm | 2 +-
code/modules/mob/mob_helpers.dm | 8 +-
code/modules/power/singularity/singularity.dm | 4 +-
.../reagents/chemistry/reagents/alcohol.dm | 2 +
.../reagents/chemistry/reagents/toxins.dm | 2 +
paradise.dme | 1 -
12 files changed, 23 insertions(+), 99 deletions(-)
delete mode 100644 code/modules/flufftext/TextFilters.dm
diff --git a/code/__HELPERS/type2type.dm b/code/__HELPERS/type2type.dm
index dcf304314bb..713c2305ed3 100644
--- a/code/__HELPERS/type2type.dm
+++ b/code/__HELPERS/type2type.dm
@@ -385,9 +385,9 @@
switch(child)
if(/datum)
return null
- if(/obj || /mob)
+ if(/obj, /mob)
return /atom/movable
- if(/area || /turf)
+ if(/area, /turf)
return /atom
else
return /datum
diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm
index 6aef09163d3..0835c97cf17 100644
--- a/code/game/gamemodes/nuclear/nuclear.dm
+++ b/code/game/gamemodes/nuclear/nuclear.dm
@@ -282,7 +282,7 @@
var/race = synd_mob.dna.species.name
switch(race)
- if("Vox" || "Vox Armalis")
+ if("Vox", "Vox Armalis")
synd_mob.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/syndicate(synd_mob), slot_wear_mask)
synd_mob.equip_to_slot_or_del(new /obj/item/tank/internals/emergency_oxygen/double/vox(synd_mob), slot_l_hand)
synd_mob.internal = synd_mob.l_hand
diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm
index 6318eebdb2d..cef0a62c6bd 100644
--- a/code/game/machinery/syndicatebeacon.dm
+++ b/code/game/machinery/syndicatebeacon.dm
@@ -49,12 +49,11 @@
src.updateUsrDialog()
return
charges -= 1
- switch(rand(1,2))
- if(1)
- temptext = "Double-crosser. You planned to betray us from the start. Allow us to repay the favor in kind."
- src.updateUsrDialog()
- spawn(rand(50,200)) selfdestruct()
- return
+ if(prob(50))
+ temptext = "Double-crosser. You planned to betray us from the start. Allow us to repay the favor in kind."
+ updateUsrDialog()
+ addtimer(CALLBACK(src, .proc/selfdestruct), rand(50, 200))
+ return
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/N = M
var/objective = "Free Objective"
diff --git a/code/modules/atmospherics/machinery/pipes/simple/pipe_simple.dm b/code/modules/atmospherics/machinery/pipes/simple/pipe_simple.dm
index 7e14946e61e..deec621d34c 100644
--- a/code/modules/atmospherics/machinery/pipes/simple/pipe_simple.dm
+++ b/code/modules/atmospherics/machinery/pipes/simple/pipe_simple.dm
@@ -30,9 +30,9 @@
alpha = 255
switch(dir)
- if(SOUTH || NORTH)
+ if(SOUTH, NORTH)
initialize_directions = SOUTH|NORTH
- if(EAST || WEST)
+ if(EAST, WEST)
initialize_directions = EAST|WEST
if(NORTHEAST)
initialize_directions = NORTH|EAST
diff --git a/code/modules/events/ion_storm.dm b/code/modules/events/ion_storm.dm
index e9df07a8d3c..78548bdc194 100644
--- a/code/modules/events/ion_storm.dm
+++ b/code/modules/events/ion_storm.dm
@@ -488,7 +488,7 @@
if(3) //X is Ying an abstract
message = "THE [ionabstract] IS [ionverb] THE [ionadjectiveshalf][ionobjects]"
- if(40 to INFINITY) //Static laws
+ else //Static laws
message = uppertext(generate_static_ion_law())
return message
diff --git a/code/modules/flufftext/TextFilters.dm b/code/modules/flufftext/TextFilters.dm
deleted file mode 100644
index 9224ec51d00..00000000000
--- a/code/modules/flufftext/TextFilters.dm
+++ /dev/null
@@ -1,80 +0,0 @@
-/proc/Intoxicated(phrase)
- phrase = html_decode(phrase)
- var/leng=length(phrase)
- var/counter=length(phrase)
- var/newphrase=""
- var/newletter=""
- while(counter>=1)
- newletter=copytext(phrase,(leng-counter)+1,(leng-counter)+2)
- if(rand(1,3)==3)
- if(lowertext(newletter)=="o") newletter="u"
- if(lowertext(newletter)=="s") newletter="ch"
- if(lowertext(newletter)=="a") newletter="ah"
- if(lowertext(newletter)=="c") newletter="k"
- switch(rand(1,7))
- if(1,3,5,8) newletter="[lowertext(newletter)]"
- if(2,4,6,15) newletter="[uppertext(newletter)]"
- if(7) newletter+="'"
- //if(9,10) newletter="[newletter]"
- //if(11,12) newletter="[newletter]"
- //if(13) newletter="[newletter]"
- newphrase+="[newletter]";counter-=1
- return newphrase
-
-/proc/NewStutter(phrase,stunned)
- phrase = html_decode(phrase)
-
- var/list/split_phrase = splittext(phrase," ") //Split it up into words.
-
- var/list/unstuttered_words = split_phrase.Copy()
- var/i = rand(1,3)
- if(stunned) i = split_phrase.len
- for(,i > 0,i--) //Pick a few words to stutter on.
-
- if(!unstuttered_words.len)
- break
- var/word = pick(unstuttered_words)
- unstuttered_words -= word //Remove from unstuttered words so we don't stutter it again.
- var/index = split_phrase.Find(word) //Find the word in the split phrase so we can replace it.
-
- //Search for dipthongs (two letters that make one sound.)
- var/first_sound = copytext(word,1,3)
- var/first_letter = copytext(word,1,2)
- if(lowertext(first_sound) in list("ch","th","sh"))
- first_letter = first_sound
-
- //Repeat the first letter to create a stutter.
- var/rnum = rand(1,3)
- switch(rnum)
- if(1)
- word = "[first_letter]-[word]"
- if(2)
- word = "[first_letter]-[first_letter]-[word]"
- if(3)
- word = "[first_letter]-[word]"
-
- split_phrase[index] = word
-
- return sanitize(jointext(split_phrase," "))
-
-/proc/Stagger(mob/M,d) //Technically not a filter, but it relates to drunkenness.
- step(M, pick(d,turn(d,90),turn(d,-90)))
-
-/proc/Ellipsis(original_msg, chance = 50)
- if(chance <= 0) return "..."
- if(chance >= 100) return original_msg
-
- var/list/words = splittext(original_msg," ")
- var/list/new_words = list()
-
- var/new_msg = ""
-
- for(var/w in words)
- if(prob(chance))
- new_words += "..."
- else
- new_words += w
-
- new_msg = jointext(new_words," ")
-
- return new_msg
diff --git a/code/modules/hallucinations/hallucinations.dm b/code/modules/hallucinations/hallucinations.dm
index 6545d8bdc1f..f45894723d8 100644
--- a/code/modules/hallucinations/hallucinations.dm
+++ b/code/modules/hallucinations/hallucinations.dm
@@ -56,7 +56,7 @@ GLOBAL_LIST_INIT(hallucinations, list(
switch(rand(100))
if(0 to HALLUCINATE_MINOR_WEIGHT)
severity = HALLUCINATE_MINOR
- if((HALLUCINATE_MINOR_WEIGHT + 1) to HALLUCINATE_MODERATE_WEIGHT)
+ if((HALLUCINATE_MINOR_WEIGHT + 1) to (HALLUCINATE_MINOR_WEIGHT + HALLUCINATE_MODERATE_WEIGHT))
severity = HALLUCINATE_MODERATE
if((HALLUCINATE_MINOR_WEIGHT + HALLUCINATE_MODERATE_WEIGHT + 1) to 100)
severity = HALLUCINATE_MAJOR
diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm
index 03ddf39a4e4..20f5f8ee717 100644
--- a/code/modules/mob/mob_helpers.dm
+++ b/code/modules/mob/mob_helpers.dm
@@ -221,9 +221,8 @@
if(1,3,5,8) newletter="[lowertext(newletter)]"
if(2,4,6,15) newletter="[uppertext(newletter)]"
if(7) newletter+=pick(slurletters)
- //if(9,10) newletter="[newletter]"
- //if(11,12) newletter="[newletter]"
- //if(13) newletter="[newletter]"
+ else
+ pass()
newphrase+="[newletter]"
counter-=1
return newphrase
@@ -658,6 +657,9 @@ GLOBAL_LIST_INIT(intents, list(INTENT_HELP,INTENT_DISARM,INTENT_GRAB,INTENT_HARM
newletter="nglu"
if(5)
newletter="glor"
+ else
+ pass()
+
newphrase+="[newletter]";counter-=1
return newphrase
diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm
index 2a2e833fd8e..946cf01069d 100644
--- a/code/modules/power/singularity/singularity.dm
+++ b/code/modules/power/singularity/singularity.dm
@@ -335,10 +335,10 @@
var/dir2 = 0
var/dir3 = 0
switch(direction)
- if(NORTH||SOUTH)
+ if(NORTH, SOUTH)
dir2 = 4
dir3 = 8
- if(EAST||WEST)
+ if(EAST, WEST)
dir2 = 1
dir3 = 2
var/turf/T2 = T
diff --git a/code/modules/reagents/chemistry/reagents/alcohol.dm b/code/modules/reagents/chemistry/reagents/alcohol.dm
index 5165665cc0a..3ff4caee472 100644
--- a/code/modules/reagents/chemistry/reagents/alcohol.dm
+++ b/code/modules/reagents/chemistry/reagents/alcohol.dm
@@ -1444,6 +1444,8 @@
if(2)
update_flags |= M.adjustToxLoss(1, FALSE)
to_chat(M, "Your stomach grumbles painfully!")
+ else
+ pass()
else
if(prob(60))
M.adjust_nutrition(-remove_nutrition)
diff --git a/code/modules/reagents/chemistry/reagents/toxins.dm b/code/modules/reagents/chemistry/reagents/toxins.dm
index b32ca3503f9..b7c4e9549b2 100644
--- a/code/modules/reagents/chemistry/reagents/toxins.dm
+++ b/code/modules/reagents/chemistry/reagents/toxins.dm
@@ -893,6 +893,8 @@
if(2)
update_flags |= M.adjustToxLoss(1, FALSE)
to_chat(M, "Your stomach grumbles painfully!")
+ else
+ pass()
else
if(prob(60))
var/fat_to_burn = max(round(M.nutrition / 100, 1), 5)
diff --git a/paradise.dme b/paradise.dme
index 27b3d09221b..f785533761a 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -1595,7 +1595,6 @@
#include "code\modules\fish\fish_types.dm"
#include "code\modules\fish\fishtank.dm"
#include "code\modules\flufftext\Dreaming.dm"
-#include "code\modules\flufftext\TextFilters.dm"
#include "code\modules\food_and_drinks\food.dm"
#include "code\modules\food_and_drinks\drinks\drinks.dm"
#include "code\modules\food_and_drinks\drinks\bottler\bottler.dm"