Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 69 additions & 66 deletions code/game/machinery/scan_gate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
#define SCANGATE_SPECIES "Species"
#define SCANGATE_NUTRITION "Nutrition"

#define SCANGATE_HUMAN "human"
#define SCANGATE_LIZARD "lizard"
#define SCANGATE_FELINID "felinid"
#define SCANGATE_FLY "fly"
#define SCANGATE_PLASMAMAN "plasma"
#define SCANGATE_MOTH "moth"
#define SCANGATE_JELLY "jelly"
#define SCANGATE_POD "pod"
#define SCANGATE_GOLEM "golem"
#define SCANGATE_ZOMBIE "zombie"

/obj/machinery/scanner_gate
name = "scanner gate"
desc = "A gate able to perform mid-depth scans on any organisms who pass under it."
Expand All @@ -21,8 +32,8 @@
var/locked = FALSE
var/scangate_mode = SCANGATE_NONE
var/disease_threshold = DISEASE_SEVERITY_MINOR
var/nanite_cloud = 0
var/datum/species/detect_species = /datum/species/human
var/nanite_cloud = 1
var/detect_species = SCANGATE_HUMAN
var/reverse = FALSE //If true, signals if the scan returns false
var/detect_nutrition = NUTRITION_LEVEL_FAT

Expand Down Expand Up @@ -106,9 +117,29 @@
if(SCANGATE_SPECIES)
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(is_species(H, detect_species))
var/datum/species/scan_species = /datum/species/human
switch(detect_species)
if(SCANGATE_LIZARD)
scan_species = /datum/species/lizard
if(SCANGATE_FLY)
scan_species = /datum/species/fly
if(SCANGATE_FELINID)
scan_species = /datum/species/human/felinid
if(SCANGATE_PLASMAMAN)
scan_species = /datum/species/plasmaman
if(SCANGATE_MOTH)
scan_species = /datum/species/moth
if(SCANGATE_JELLY)
scan_species = /datum/species/jelly
if(SCANGATE_POD)
scan_species = /datum/species/pod
if(SCANGATE_GOLEM)
scan_species = /datum/species/golem
if(SCANGATE_ZOMBIE)
scan_species = /datum/species/zombie
if(is_species(H, scan_species))
beep = TRUE
if(detect_species == /datum/species/zombie) //Can detect dormant zombies
if(detect_species == SCANGATE_ZOMBIE) //Can detect dormant zombies
if(H.getorganslot(ORGAN_SLOT_ZOMBIE))
beep = TRUE
if(SCANGATE_GUNS)
Expand Down Expand Up @@ -144,19 +175,21 @@
return FALSE
return ..()

/obj/machinery/scanner_gate/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
SStgui.try_update_ui(user, src, ui_key, ui, force_open)
/obj/machinery/scanner_gate/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "scanner_gate", name, 600, 400, master_ui, state)
ui.open()

/obj/machinery/scanner_gate/ui_data()
var/list/data = list()
data["locked"] = locked
data["scan_mode"] = scangate_mode
data["reverse"] = reverse
data["nanite_cloud"] = nanite_cloud
data["disease_threshold"] = disease_threshold
data["target_species"] = initial(detect_species.name)
data["target_species"] = detect_species
data["target_nutrition"] = detect_nutrition
return data

Expand All @@ -165,77 +198,36 @@
return
switch(action)
if("set_mode")
var/new_mode = input("Choose the scan mode","Scan Mode") as null|anything in list(SCANGATE_NONE,
SCANGATE_MINDSHIELD,
SCANGATE_NANITES,
SCANGATE_DISEASE,
SCANGATE_GUNS,
SCANGATE_WANTED,
SCANGATE_SPECIES,
SCANGATE_NUTRITION)
if(new_mode)
scangate_mode = new_mode
var/new_mode = params["new_mode"]
scangate_mode = new_mode
. = TRUE
if("toggle_reverse")
reverse = !reverse
. = TRUE
if("toggle_lock")
if(allowed(usr))
locked = !locked
. = TRUE
if("set_disease_threshold")
var/new_threshold = input("Set disease threshold","Scan Mode") as null|anything in list(DISEASE_SEVERITY_POSITIVE,
DISEASE_SEVERITY_NONTHREAT,
DISEASE_SEVERITY_MINOR,
DISEASE_SEVERITY_MEDIUM,
DISEASE_SEVERITY_HARMFUL,
DISEASE_SEVERITY_DANGEROUS,
DISEASE_SEVERITY_BIOHAZARD)
if(new_threshold)
disease_threshold = new_threshold
var/new_threshold = params["new_threshold"]
disease_threshold = new_threshold
. = TRUE
if("set_nanite_cloud")
var/new_cloud = input("Set target nanite cloud","Scan Mode", nanite_cloud) as null|num
if(!isnull(new_cloud))
nanite_cloud = CLAMP(round(new_cloud, 1), 1, 100)
var/new_cloud = text2num(params["new_cloud"])
nanite_cloud = CLAMP(round(new_cloud, 1), 1, 100)
. = TRUE
//Some species are not scannable, like abductors (too unknown), androids (too artificial) or skeletons (too magic)
if("set_target_species")
var/new_species = input("Set target species","Scan Mode") as null|anything in list("Human",
"Lizardperson",
"Gorillaperson", // yogs -- gorilla people
"Flyperson",
"Plasmaman",
"Mothmen",
"Jellyperson",
"Podperson",
"Golem",
"Zombie")
if(new_species)
switch(new_species)
if("Human")
detect_species = /datum/species/human
if("Lizardperson")
detect_species = /datum/species/lizard
// yogs start -- gorilla people
if("Gorillaperson")
detect_species = /datum/species/gorilla
// yogs end
if("Flyperson")
detect_species = /datum/species/fly
if("Plasmaman")
detect_species = /datum/species/plasmaman
if("Mothmen")
detect_species = /datum/species/moth
if("Jellyperson")
detect_species = /datum/species/jelly
if("Podperson")
detect_species = /datum/species/pod
if("Golem")
detect_species = /datum/species/golem
if("Zombie")
detect_species = /datum/species/zombie
var/new_species = params["new_species"]
detect_species = new_species
. = TRUE
if("set_target_nutrition")
var/new_nutrition = input("Set target nutrition level","Scan Mode") as null|anything in list("Starving",
"Obese")
if(new_nutrition)
var/new_nutrition = params["new_nutrition"]
var/nutrition_list = list(
"Starving",
"Obese"
)
if(new_nutrition && new_nutrition in nutrition_list)
switch(new_nutrition)
if("Starving")
detect_nutrition = NUTRITION_LEVEL_STARVING
Expand All @@ -251,3 +243,14 @@
#undef SCANGATE_WANTED
#undef SCANGATE_SPECIES
#undef SCANGATE_NUTRITION

#undef SCANGATE_HUMAN
#undef SCANGATE_LIZARD
#undef SCANGATE_FELINID
#undef SCANGATE_FLY
#undef SCANGATE_PLASMAMAN
#undef SCANGATE_MOTH
#undef SCANGATE_JELLY
#undef SCANGATE_POD
#undef SCANGATE_GOLEM
#undef SCANGATE_ZOMBIE
47 changes: 20 additions & 27 deletions code/modules/power/gravitygenerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -220,40 +220,33 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
return
return ..()

/obj/machinery/gravity_generator/main/ui_interact(mob/user)
if(stat & BROKEN)
return
var/dat = "Gravity Generator Breaker: "
if(breaker)
dat += "<span class='linkOn'>ON</span> <A href='?src=[REF(src)];gentoggle=1'>OFF</A>"
else
dat += "<A href='?src=[REF(src)];gentoggle=1'>ON</A> <span class='linkOn'>OFF</span> "

dat += "<br>Generator Status:<br><div class='statusDisplay'>"
if(charging_state != POWER_IDLE)
dat += "<font class='bad'>WARNING</font> Radiation Detected. <br>[charging_state == POWER_UP ? "Charging..." : "Discharging..."]"
else if(on)
dat += "Powered."
else
dat += "Unpowered."

dat += "<br>Gravity Charge: [charge_count]%</div>"
/obj/machinery/gravity_generator/main/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "gravity_generator", name, 400, 200, master_ui, state)
ui.open()

var/datum/browser/popup = new(user, "gravgen", name)
popup.set_content(dat)
popup.open()
/obj/machinery/gravity_generator/main/ui_data(mob/user)
var/list/data = list()

data["breaker"] = breaker
data["charge_count"] = charge_count
data["charging_state"] = charging_state
data["on"] = on
data["operational"] = (stat & BROKEN) ? FALSE : TRUE
return data

/obj/machinery/gravity_generator/main/Topic(href, href_list)
/obj/machinery/gravity_generator/main/ui_act(action, params)

if(..())
return

if(href_list["gentoggle"])
breaker = !breaker
investigate_log("was toggled [breaker ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(usr)].", INVESTIGATE_GRAVITY)
set_power()
src.updateUsrDialog()
switch(action)
if("gentoggle")
breaker = !breaker
investigate_log("was toggled [breaker ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(usr)].", INVESTIGATE_GRAVITY)
set_power()

// Power and Icon States

Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/machinery/chem_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
"Maximum [vol_each_max] units per item.",
"How many units to fill?",
vol_each_max))
vol_each = CLAMP(round(vol_each), 0, vol_each_max)
vol_each = CLAMP(vol_each, 0, vol_each_max)
if(vol_each <= 0)
return FALSE
// Get item name
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/machinery/smoke_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "smoke_machine", name, 450, 350, master_ui, state)
ui = new(user, src, ui_key, "smoke_machine", name, 350, 350, master_ui, state)
ui.open()

/obj/machinery/smoke_machine/ui_data(mob/user)
Expand Down
14 changes: 14 additions & 0 deletions tgui-next/.eslintrc-harder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
rules:
## Enforce a maximum cyclomatic complexity allowed in a program
complexity: [error, { max: 25 }]
## Enforce consistent brace style for blocks
brace-style: [error, stroustrup, { allowSingleLine: false }]
## Enforce the consistent use of either backticks, double, or single quotes
quotes: [error, single, {
avoidEscape: true,
allowTemplateLiterals: true,
}]
react/jsx-closing-bracket-location: [error, {
selfClosing: after-props,
nonEmpty: after-props,
}]
Loading