cleans up dest tagger (#19280)

* cleans up dest tagger

* fix that
This commit is contained in:
Kashargul
2026-03-14 22:27:09 +01:00
committed by GitHub
parent 7ef8145431
commit 794d55ca73
13 changed files with 316 additions and 113 deletions
@@ -114,19 +114,19 @@
if("desc")
t = sanitize(params["desc"], MAX_MESSAGE_LEN * 4)
if(!isnull(t) && CanUseTopic(user))
pref.update_preference_by_type(/datum/preference/text/pai_description, sanitize(t))
pref.update_preference_by_type(/datum/preference/text/pai_description, t)
if("ad")
t = sanitize(params["ad"])
if(!isnull(t) && CanUseTopic(user))
pref.update_preference_by_type(/datum/preference/text/pai_ad, sanitize(t))
pref.update_preference_by_type(/datum/preference/text/pai_ad, t)
if("role")
t = sanitize(params["role"])
if(!isnull(t) && CanUseTopic(user))
pref.update_preference_by_type(/datum/preference/text/pai_role, sanitize(t))
pref.update_preference_by_type(/datum/preference/text/pai_role, t)
if("ooc")
t = sanitize(params["ooc"])
if(!isnull(t) && CanUseTopic(user))
pref.update_preference_by_type(/datum/preference/text/pai_comments, sanitize(t))
pref.update_preference_by_type(/datum/preference/text/pai_comments, t)
if("color")
var/new_color = sanitize_hexcolor(params["color"])
if(new_color && CanUseTopic(user))
@@ -11,9 +11,7 @@
fear = min((fear + 6), 102)
if(phobias & HEMOPHOBIA)
for(var/obj/effect/decal/cleanable/blood/B in view(7, src))
var/obj/effect/decal/cleanable/blood/oil/O = B
var/obj/effect/decal/cleanable/blood/tracks/T = B
if(istype(O) || istype(T))
if(istype(B, /obj/effect/decal/cleanable/blood/oil) || istype(B, /obj/effect/decal/cleanable/blood/tracks) || istype(B, /obj/effect/decal/cleanable/blood/gibs/robot))
continue
fear = min((fear + 2), 102)
for(var/turf/simulated/floor/water/blood/T in view(7, src))
@@ -86,7 +86,7 @@
to_chat(src, span_danger("You begin to resist \the [prey_name]'s control!!!"))
to_chat(pred_body, span_danger("You feel the captive mind of [src] begin to resist your control."))
if(do_after(src, 10 SECONDS, target = prey_name))
if(do_after(src, 10 SECONDS, target = pred_body))
restore_control()
else
to_chat(src, span_notice("Your attempt to regain control has been interrupted..."))
+16 -10
View File
@@ -21,16 +21,13 @@
ui.open()
/obj/item/destTagger/tgui_static_data(mob/user)
var/list/data = ..()
var/list/taggers = list()
var/list/tagger_levels = list()
for(var/tag in GLOB.tagger_locations)
var/z_level = GLOB.tagger_locations[tag]
taggers += list(list("tag" = tag, "level" = z_level))
tagger_levels += list(list("z" = z_level, "location" = using_map.get_zlevel_name(z_level)))
data["taggerLevels"] = tagger_levels
data["taggerLocs"] = taggers
. = ..()
.["level_names"] = using_map.zlevels
/obj/item/destTagger/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
var/list/data = list(
"taggerLocs" = GLOB.tagger_locations
)
return data
/obj/item/destTagger/tgui_data(mob/user, datum/tgui/ui)
@@ -56,4 +53,13 @@
if(!(new_tag in GLOB.tagger_locations))
return FALSE
currTag = new_tag
. = TRUE
return TRUE
if("new_tag")
var/dest_tag = sanitizeName(params["tag"], allow_numbers = TRUE)
if(!istext(dest_tag) || length(dest_tag) < 3)
return FALSE
if(dest_tag in GLOB.tagger_locations)
return FALSE
GLOB.tagger_locations[dest_tag] = null
currTag = dest_tag
return TRUE
+26 -19
View File
@@ -25,25 +25,25 @@
var/flipdir = turn(fromdir, 180)
if(flipdir != dir) // came from secondary dir
return dir // so exit through primary
else // came from primary
// came from primary
// so need to choose either secondary exit
var/mask = ..(fromdir)
var/mask = ..(fromdir)
// find a bit which is set
var/setbit = 0
if(mask & NORTH)
setbit = NORTH
else if(mask & SOUTH)
setbit = SOUTH
else if(mask & EAST)
setbit = EAST
else
setbit = WEST
// find a bit which is set
var/setbit = 0
if(mask & NORTH)
setbit = NORTH
else if(mask & SOUTH)
setbit = SOUTH
else if(mask & EAST)
setbit = EAST
else
setbit = WEST
if(prob(50)) // 50% chance to choose the found bit or the other one
return setbit
else
return mask & (~setbit)
if(prob(50)) // 50% chance to choose the found bit or the other one
return setbit
return mask & (~setbit)
//a three-way junction that sorts objects
/obj/structure/disposalpipe/sortjunction
@@ -66,11 +66,13 @@
/obj/structure/disposalpipe/sortjunction/proc/updatename()
if(sortType)
name = "[initial(name)] ([sortType])"
else
name = initial(name)
return
name = initial(name)
/obj/structure/disposalpipe/sortjunction/Destroy()
QDEL_NULL(wires)
if(sortType)
LAZYREMOVE(GLOB.tagger_locations["[sortType]"], get_z(src))
. = ..()
/obj/structure/disposalpipe/sortjunction/proc/updatedir()
@@ -85,7 +87,8 @@
/obj/structure/disposalpipe/sortjunction/Initialize(mapload)
. = ..()
if(sortType) GLOB.tagger_locations |= list("[sortType]" = get_z(src))
if(sortType)
LAZYADD(GLOB.tagger_locations["[sortType]"], get_z(src))
wires = new /datum/wires/disposals(src)
@@ -113,7 +116,11 @@
var/obj/item/destTagger/O = I
if(O.currTag)// Tag set
var/current_z = get_z(src)
if(sortType)
LAZYREMOVE(GLOB.tagger_locations["[sortType]"], current_z)
sortType = O.currTag
LAZYADD(GLOB.tagger_locations["[sortType]"], current_z)
playsound(src, 'sound/machines/twobeep.ogg', 100, 1)
to_chat(user, span_blue("Changed filter to '[sortType]'."))
updatename()
+14 -4
View File
@@ -12,16 +12,22 @@
/obj/structure/disposalpipe/tagger/proc/updatename()
if(sort_tag)
name = "[initial(name)] ([sort_tag])"
else
name = initial(name)
return
name = initial(name)
/obj/structure/disposalpipe/tagger/Initialize(mapload)
. = ..()
dpdir = dir | turn(dir, 180)
if(sort_tag) GLOB.tagger_locations |= list("[sort_tag]" = get_z(src))
if(sort_tag)
LAZYADD(GLOB.tagger_locations["[sort_tag]"], get_z(src))
updatename()
updatedesc()
update()
/obj/structure/disposalpipe/tagger/Destroy()
. = ..()
if(sort_tag)
LAZYREMOVE(GLOB.tagger_locations["[sort_tag]"], get_z(src))
/obj/structure/disposalpipe/tagger/attackby(obj/item/I, mob/user)
if(..())
@@ -31,9 +37,13 @@
var/obj/item/destTagger/O = I
if(O.currTag)// Tag set
var/current_z = get_z(src)
if(sort_tag)
LAZYREMOVE(GLOB.tagger_locations["[sort_tag]"], current_z)
sort_tag = O.currTag
LAZYADD(GLOB.tagger_locations["[sort_tag]"], current_z)
playsound(src, 'sound/machines/twobeep.ogg', 100, 1)
to_chat(user, span_blue("Changed tag to '[sort_tag]'."))
to_chat(user, span_notice("Changed tag to '[sort_tag]'."))
updatename()
updatedesc()