Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarmunora committed Nov 24, 2024
2 parents 75af3f7 + 45ee02e commit 05388d4
Show file tree
Hide file tree
Showing 29 changed files with 518 additions and 294 deletions.
2 changes: 1 addition & 1 deletion browserassets/tgui/tgui.bundle.js

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions code/datums/preferences/preferences.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
var/list/bad_name_characters = list("_", "'", "\"", "<", ">", ";", "\[", "\]", "{", "}", "|", "\\", "/")
var/regex/emoji_regex = regex(@{"([^\u0020-\u8000]+)"})

proc/remove_bad_name_characters(string)
for (var/char in bad_name_characters)
string = replacetext(string, char, "")
return emoji_regex.Replace_char(string, "")

var/list/removed_jobs = list(
// jobs that have been removed or replaced (replaced -> new name, removed -> null)
"Barman" = "Bartender",
Expand Down Expand Up @@ -420,8 +427,7 @@ var/list/removed_jobs = list(
if (isnull(new_name))
return
new_name = trimtext(new_name)
for (var/c in bad_name_characters)
new_name = replacetext(new_name, c, "")
new_name = remove_bad_name_characters(new_name)
if (length(new_name) < NAME_CHAR_MIN)
tgui_alert(usr, "Your first name is too short. It must be at least [NAME_CHAR_MIN] characters long.", "Name too short")
return
Expand All @@ -447,8 +453,7 @@ var/list/removed_jobs = list(
if (isnull(new_name))
new_name = ""
new_name = trimtext(new_name)
for (var/c in bad_name_characters)
new_name = replacetext(new_name, c, "")
new_name = remove_bad_name_characters(new_name)
if (length(new_name) > NAME_CHAR_MAX)
tgui_alert(usr, "Your middle name is too long. It must be no more than [NAME_CHAR_MAX] characters long.", "Name too long")
return
Expand All @@ -464,8 +469,7 @@ var/list/removed_jobs = list(
if (isnull(new_name))
return
new_name = trimtext(new_name)
for (var/c in bad_name_characters)
new_name = replacetext(new_name, c, "")
new_name = remove_bad_name_characters(new_name)
if (length(new_name) < NAME_CHAR_MIN)
tgui_alert(usr, "Your last name is too short. It must be at least [NAME_CHAR_MIN] characters long.", "Name too short")
return
Expand Down Expand Up @@ -1107,10 +1111,9 @@ var/list/removed_jobs = list(
src.update_preview_icon()

proc/sanitize_name()
for (var/c in bad_name_characters)
src.name_first = replacetext(src.name_first, c, "")
src.name_middle = replacetext(src.name_middle, c, "")
src.name_last = replacetext(src.name_last, c, "")
src.name_first = remove_bad_name_characters(src.name_first)
src.name_middle = remove_bad_name_characters(src.name_middle)
src.name_last = remove_bad_name_characters(src.name_last)

if (length(src.name_first) < NAME_CHAR_MIN || length(src.name_first) > NAME_CHAR_MAX || is_blank_string(src.name_first) || !character_name_validation.Find(src.name_first))
src.randomize_name(1, 0, 0)
Expand Down
13 changes: 13 additions & 0 deletions code/datums/savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,19 @@
// Welp, you get a random name then.
src.randomize_name()

//macros save me from infinite var hell
#define FIX_NAME(name_var) var/fixed_##name_var = remove_bad_name_characters(src.##name_var);\
if (fixed_##name_var != src.##name_var){\
src.##name_var = fixed_##name_var;\
src.profile_modified = TRUE;\
}

FIX_NAME(name_first)
FIX_NAME(name_last)
FIX_NAME(name_middle)
FIX_NAME(real_name)

#undef FIX_NAME
// Clean up invalid / default preferences
if (isnull(AH.fartsound))
AH.fartsound = "default"
Expand Down
7 changes: 6 additions & 1 deletion code/interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,9 @@
if (map_settings)
. = map_settings.goonhub_map
. = goonhub_href(.)
. += "?sx=[our_user.mob.x]&sy=[our_user.mob.y]&zoom=0"
var/turf/T = get_turf(our_user.mob)
if (!T || T.z != Z_LEVEL_STATION && T.z != Z_LEVEL_DEBRIS) //no maps for weird z levels or nullspace
return .
. += "?sx=[T.x]&sy=[T.y]&zoom=0"
if (T.z == Z_LEVEL_DEBRIS)
. += "&layer=debris"
1 change: 1 addition & 0 deletions code/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2851,6 +2851,7 @@
return
else
newname = strip_html(newname, MOB_NAME_MAX_LENGTH, 1)
newname = remove_bad_name_characters(newname)
if (!length(newname) || copytext(newname,1,2) == " ")
src.show_text("That name was too short after removing bad characters from it. Please choose a different name.", "red")
continue
Expand Down
1 change: 1 addition & 0 deletions code/mob/living/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ var/global/list/module_editors = list()
newname = default_name
else
newname = tgui_input_text(src, "You are a Robot. Would you like to change your name to something else?", "Name Change", default_name)
newname = remove_bad_name_characters(newname)
if(newname && newname != default_name)
phrase_log.log_phrase("name-cyborg", newname, no_duplicates=TRUE)
if (!newname)
Expand Down
1 change: 1 addition & 0 deletions code/mob/living/silicon/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2578,6 +2578,7 @@ proc/get_mobs_trackable_by_AI()
newname = default_name
else
newname = tgui_input_text(renaming_mob || src, "You are an AI. Would you like to change your name to something else?", "Name Change", client?.preferences?.robot_name || default_name)
newname = remove_bad_name_characters(newname)
if(newname && newname != default_name)
phrase_log.log_phrase("name-ai", newname, no_duplicates=TRUE)
if (src.brain.owner != brain_owner)
Expand Down
14 changes: 14 additions & 0 deletions code/modules/chemistry/Chemistry-Recipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,20 @@
mix_sound = 'sound/misc/drinkfizz.ogg'
drinkrecipe = TRUE

kombucha
name = "Kombucha"
id = "kombucha"
result = "kombucha"
required_reagents = list("sweet_tea" = 3, "beer" = 1, "antihol" = 1)
result_amount = 3
mix_phrase = "The tea fizzes lightly, giving off a soft vinegar scent."
mix_sound = 'sound/misc/drinkfizz.ogg'
drinkrecipe = TRUE
min_temperature = T0C + 16
max_temperature = T0C + 29
instant = FALSE
reaction_speed = 0.333 // about 100u after 5 minutes

catamount
name = "catamount"
id = "catamount"
Expand Down
11 changes: 11 additions & 0 deletions code/modules/chemistry/Reagents-FoodDrink.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4191,6 +4191,17 @@ datum
reagent_state = LIQUID
thirst_value = 0.8

fooddrink/kombucha
name = "kombucha"
id = "kombucha"
fluid_r = 255
fluid_g = 239
fluid_b = 148
transparency = 200
taste = list("fizzy", "rich", "vinegary")
reagent_state = LIQUID
thirst_value = 0.8

fooddrink/cafe_gele
name = "cafe gele"
id = "cafe_gele"
Expand Down
18 changes: 18 additions & 0 deletions code/modules/robotics/robot/robot_docking_station.dm
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,23 @@ TYPEINFO(/obj/machinery/recharge_station)
if (ishuman(AM))
src.move_human_inside(user, AM)

/obj/machinery/recharge_station/receive_silicon_hotkey(mob/user)
. = ..()

if (!isAI(user))
return

var/mob/living/silicon/ai/mainframe = null
if (isAIeye(user))
var/mob/living/intangible/aieye/eye = user
mainframe = eye.mainframe
else
mainframe = user

if(user.client.check_key(KEY_OPEN))
if (src.occupant)
mainframe.deploy_to_shell(src.occupant)

/obj/machinery/recharge_station/proc/build_icon()
if (src.occupant)
src.UpdateOverlays(image('icons/obj/robot_parts.dmi', "station-occu"), "occupant")
Expand Down Expand Up @@ -629,6 +646,7 @@ TYPEINFO(/obj/machinery/recharge_station)
if (R.shell || R.dependent) //no renaming AI shells
return
var/newname = copytext(strip_html(sanitize(tgui_input_text(user, "What do you want to rename [R]?", "Cyborg Maintenance", R.name))), 1, 64)
newname = remove_bad_name_characters(newname)
if ((!issilicon(user) && (BOUNDS_DIST(user, src) > 0)) || user.stat || !newname)
return
if (url_regex?.Find(newname))
Expand Down
35 changes: 35 additions & 0 deletions code/obj/item/cigarette.dm
Original file line number Diff line number Diff line change
Expand Up @@ -538,18 +538,53 @@
var/max_cigs = 6
var/cigtype = /obj/item/clothing/mask/cigarette
var/package_style = "cigpacket"
var/list/allowed = list(/obj/item/clothing/mask/cigarette)
c_flags = ONBELT
stamina_damage = 3
stamina_cost = 3
rand_pos = 1

New()
..()
AddComponent(/datum/component/transfer_input/quickloading, allowed, "onLoading", "filterLoading")
if (!cigtype)
return
for(var/i in 1 to src.max_cigs)
new src.cigtype(src)

mouse_drop(atom/over_object, src_location, over_location, src_control, over_control, params)
if ((istype(over_object, /obj/table) || \
(isturf(over_object) && total_density(over_location) < 1)) && \
in_interact_range(over_object,src) && \
src.contents.len > 0)
usr.visible_message(SPAN_NOTICE("[usr] dumps out [src]'s contents onto [over_object]!"))
for (var/obj/item/thing in src.contents)
thing.set_loc(over_location)
src.UpdateIcon()
if (!islist(params)) params = params2list(params)
if (params) params["dumped"] = 1
else ..()

should_place_on(obj/target, params)
if (istype(target, /obj/table) && params && params["dumped"])
return FALSE
return ..()

get_help_message(dist, mob/user)
. = ..()
. += "Hold this and drag a nearby cigarette onto it to auto-fill.\n \
Drag this onto a nearby table or floor while holding it to dump its contents."

/obj/item/cigpacket/proc/onLoading(atom/movable/incoming)
src.UpdateIcon()
// No idea is usr works via components like this, but there seems to be no recourse without altering the component itself.
incoming.add_fingerprint(usr)
return TRUE

/obj/item/cigpacket/proc/filterLoading(obj/item/clothing/mask/cigarette/cig)
if (length(src.contents) >= max_cigs) return FALSE
if (cig.on) return FALSE
return TRUE

/obj/item/cigpacket/nicofree
name = "nicotine-free cigarette packet"
Expand Down
22 changes: 17 additions & 5 deletions code/obj/machinery/singularity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ proc/singularity_containment_check(turf/center)
TYPEINFO(/obj/machinery/the_singularitygen)
mats = 250

ADMIN_INTERACT_PROCS(/obj/machinery/the_singularitygen, proc/activate)

/obj/machinery/the_singularitygen
name = "Gravitational Singularity Generator"
desc = "An Odd Device which produces a Black Hole when set up."
Expand All @@ -60,11 +62,14 @@ TYPEINFO(/obj/machinery/the_singularitygen)
anchored = UNANCHORED // so it can be moved around out of crates
density = 1
var/bhole = 0 // it is time. we can trust people to use the singularity For Good - cirr
var/activating = FALSE

HELP_MESSAGE_OVERRIDE({"Automatically creates a singularity when all surrounding containment fields are active.\
Can be anchored/unanchored with a <b>wrench</b>"})

/obj/machinery/the_singularitygen/process()
if (src.activating)
return
var/max_radius = singularity_containment_check(get_turf(src))
if(isnull(max_radius))
return
Expand All @@ -77,12 +82,19 @@ TYPEINFO(/obj/machinery/the_singularitygen)
src.visible_message(SPAN_NOTICE("[src] refuses to activate in this place. Odd."))
qdel(src)

src.activate(max_radius)

/obj/machinery/the_singularitygen/proc/activate(max_radius = null)
src.activating = TRUE
var/turf/T = get_turf(src)
playsound(T, 'sound/machines/singulo_start.ogg', 90, FALSE, 3, flags=SOUND_IGNORE_SPACE)
if (src.bhole)
new /obj/bhole(T, 3000)
else
new /obj/machinery/the_singularity(T, 100,,max_radius)
qdel(src)
src.icon_state = "TheSingGenOhNo"
SPAWN(7 SECONDS)
if (src.bhole)
new /obj/bhole(T, 3000)
else
new /obj/machinery/the_singularity(T, 100,,max_radius)
qdel(src)

/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user)
src.add_fingerprint(user)
Expand Down
Binary file modified icons/mob/clothing/feet.dmi
Binary file not shown.
Binary file modified icons/obj/singularity.dmi
Binary file not shown.
18 changes: 18 additions & 0 deletions strings/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@

(t)sun nov 24 24
(u)Egregorious
(p)21374
(e)💅📦|C-QoL, A-Game-Objects
(+)Enabled quick-filling and dumping of cigarette packets. Inspect them for more detailed information.
(u)FlameArrow57
(p)21432
(e)🆕🍝|C-Feature, A-Catering
(+)Added kombucha drink recipe. 3u sweet tea + 1u beer + 1u antihol -> 3u kombucha over 9 seconds
(u)LeahTheTech
(p)21430
(e)|
(+)Nanotrasen IT contractors have updated the records department to a brand new version of ThinkDOS that doesn't support the ancient "emoji" standard anymore. Consequently, you can no longer use emojis in your character names.
(t)sat nov 23 24
(u)JORJ949
(p)21385
(e)💅🤖|C-QoL, A-Silicons
(+)AI shell Ctrl-Click to deploy function expanded to cyborg docks for shells that are recharging.
(u)LeahTheTech
(+)Tweaked the HoS beret sprite slightly.
(+)Singularity startup is now a little bit cooler.
(t)fri nov 22 24
(u)ZeWaka
(e)🆕|C-Feature
Expand Down
28 changes: 11 additions & 17 deletions tgui/packages/tgui/interfaces/ClothingBooth/BoothGrouping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { classes } from 'common/react';
import { memo, useCallback } from 'react';
import { Stack } from 'tgui-core/components';
import { shallowDiffers } from 'tgui-core/react';

import { Image } from '../../components';
import { GroupingTags } from './GroupingTags';
Expand Down Expand Up @@ -90,28 +91,21 @@ const BoothGroupingView = (props: BoothGroupingProps) => {
};

export const BoothGrouping = memo(BoothGroupingView, (prevProps, nextProps) => {
// shallow comparison for most props
if (
prevProps.cost_max !== nextProps.cost_max ||
prevProps.cost_min !== nextProps.cost_min ||
prevProps.everythingIsFree !== nextProps.everythingIsFree ||
prevProps.itemsCount !== nextProps.itemsCount ||
prevProps.list_icon !== nextProps.list_icon ||
prevProps.name !== nextProps.name ||
prevProps.onSelectGrouping !== nextProps.onSelectGrouping ||
prevProps.selected !== nextProps.selected ||
prevProps.slot !== nextProps.slot
) {
const { grouping_tags: prevGroupingTags, ...prevRest } = prevProps;
const { grouping_tags: nextGroupingTags, ...nextRest } = nextProps;
if (shallowDiffers(prevRest, nextRest)) {
return false;
}
// contents equality comparison for grouping_tags
if (prevProps.grouping_tags.length !== nextProps.grouping_tags.length) {
if (prevGroupingTags.length !== nextGroupingTags.length) {
return false;
}
for (let i = 0; i < prevProps.grouping_tags.length; i++) {
if (prevProps.grouping_tags[i] !== nextProps.grouping_tags[i]) {
return false;
}
if (
prevGroupingTags.some(
(prevGroupingTag, i) => prevGroupingTag !== nextGroupingTags[i],
)
) {
return false;
}
return true;
});
Loading

0 comments on commit 05388d4

Please sign in to comment.