mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
Fixes and speedups to spraycans/crayons (#44561)
* spraycan stuff * tgui.js again * Update text.dm
This commit is contained in:
committed by
AnturK
parent
b432ae7c74
commit
58935e41c9
@@ -816,3 +816,6 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
|
||||
corrupted_text += pick(corruption_options)
|
||||
|
||||
return corrupted_text
|
||||
|
||||
#define is_alpha(X) ((text2ascii(X) <= 122) && (text2ascii(X) >= 97))
|
||||
#define is_digit(X) ((length(X) == 1) && (length(text2num(X)) == 1))
|
||||
|
||||
@@ -36,9 +36,6 @@
|
||||
var/text_buffer = ""
|
||||
|
||||
var/static/list/graffiti = list("amyjon","face","matt","revolution","engie","guy","end","dwarf","uboa","body","cyka","star","poseur tag","prolizard","antilizard")
|
||||
var/static/list/letters = list("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
|
||||
var/static/list/punctuation = list("!","?",".",",","/","+","-","=","%","#","&")
|
||||
var/static/list/numerals = list("0","1","2","3","4","5","6","7","8","9")
|
||||
var/static/list/symbols = list("danger","firedanger","electricdanger","biohazard","radiation","safe","evac","space","med","trade","shop","food","peace","like","skull","nay","heart","credit")
|
||||
var/static/list/drawings = list("smallbrush","brush","largebrush","splatter","snake","stickman","carp","ghost","clown","taser","disk","fireaxe","toolbox","corgi","cat","toilet","blueprint","beepsky","scroll","bottle","shotgun")
|
||||
var/static/list/oriented = list("arrow","line","thinline","shortline","body","chevron","footprint","clawprint","pawprint") // These turn to face the same way as the drawer
|
||||
@@ -47,7 +44,7 @@
|
||||
RANDOM_NUMBER, RANDOM_GRAFFITI, RANDOM_LETTER, RANDOM_SYMBOL, RANDOM_PUNCTUATION, RANDOM_DRAWING)
|
||||
var/static/list/graffiti_large_h = list("yiffhell", "secborg", "paint")
|
||||
|
||||
var/static/list/all_drawables = graffiti + letters + punctuation + numerals + symbols + drawings + oriented + runes + graffiti_large_h
|
||||
var/static/list/all_drawables = graffiti + symbols + drawings + oriented + runes + graffiti_large_h
|
||||
|
||||
var/paint_mode = PAINT_NORMAL
|
||||
|
||||
@@ -170,21 +167,6 @@
|
||||
for(var/glh in graffiti_large_h)
|
||||
glh_items += list(list("item" = glh))
|
||||
|
||||
var/list/L_items = list()
|
||||
. += list(list("name" = "Letters", "items" = L_items))
|
||||
for(var/L in letters)
|
||||
L_items += list(list("item" = L))
|
||||
|
||||
var/list/P_items = list()
|
||||
. += list(list("name" = "Punctuation", "items" = P_items))
|
||||
for(var/P in punctuation)
|
||||
P_items += list(list("item" = P))
|
||||
|
||||
var/list/N_items = list()
|
||||
. += list(list(name = "Numerals", "items" = N_items))
|
||||
for(var/N in numerals)
|
||||
N_items += list(list("item" = N))
|
||||
|
||||
var/list/S_items = list()
|
||||
. += list(list("name" = "Symbols", "items" = S_items))
|
||||
for(var/S in symbols)
|
||||
@@ -241,6 +223,7 @@
|
||||
if(stencil in all_drawables + randoms)
|
||||
drawtype = stencil
|
||||
. = TRUE
|
||||
text_buffer = ""
|
||||
if(stencil in graffiti_large_h)
|
||||
paint_mode = PAINT_LARGE_HORIZONTAL
|
||||
text_buffer = ""
|
||||
@@ -260,18 +243,16 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/crayon/proc/crayon_text_strip(text)
|
||||
var/list/base = string2charlist(lowertext(text))
|
||||
var/list/out = list()
|
||||
for(var/a in base)
|
||||
if(a in (letters|numerals|punctuation))
|
||||
out += a
|
||||
return jointext(out,"")
|
||||
var/static/regex/crayon_r = new /regex(@"[^\w!?,.=%#&+\/\-]")
|
||||
return replacetext(lowertext(text), crayon_r, "")
|
||||
|
||||
/obj/item/toy/crayon/afterattack(atom/target, mob/user, proximity, params)
|
||||
. = ..()
|
||||
if(!proximity || !check_allowed_items(target))
|
||||
return
|
||||
|
||||
var/static/list/punctuation = list("!","?",".",",","/","+","-","=","%","#","&")
|
||||
|
||||
var/cost = 1
|
||||
if(paint_mode == PAINT_LARGE_HORIZONTAL)
|
||||
cost = 5
|
||||
@@ -295,7 +276,7 @@
|
||||
var/drawing = drawtype
|
||||
switch(drawtype)
|
||||
if(RANDOM_LETTER)
|
||||
drawing = pick(letters)
|
||||
drawing = ascii2text(rand(97, 122)) // a-z
|
||||
if(RANDOM_PUNCTUATION)
|
||||
drawing = pick(punctuation)
|
||||
if(RANDOM_SYMBOL)
|
||||
@@ -309,13 +290,16 @@
|
||||
if(RANDOM_ORIENTED)
|
||||
drawing = pick(oriented)
|
||||
if(RANDOM_NUMBER)
|
||||
drawing = pick(numerals)
|
||||
drawing = ascii2text(rand(48, 57)) // 0-9
|
||||
if(RANDOM_ANY)
|
||||
drawing = pick(all_drawables)
|
||||
|
||||
|
||||
var/temp = "rune"
|
||||
if(drawing in letters)
|
||||
if(is_alpha(drawing))
|
||||
temp = "letter"
|
||||
else if(is_digit(drawing))
|
||||
temp = "number"
|
||||
else if(drawing in punctuation)
|
||||
temp = "punctuation mark"
|
||||
else if(drawing in symbols)
|
||||
@@ -324,8 +308,6 @@
|
||||
temp = "drawing"
|
||||
else if(drawing in graffiti|oriented)
|
||||
temp = "graffiti"
|
||||
else if(drawing in numerals)
|
||||
temp = "number"
|
||||
|
||||
|
||||
var/graf_rot
|
||||
@@ -364,7 +346,7 @@
|
||||
return
|
||||
|
||||
if(length(text_buffer))
|
||||
drawing = copytext(text_buffer,1,2)
|
||||
drawing = text_buffer[1]
|
||||
|
||||
|
||||
var/list/turf/affected_turfs = list()
|
||||
@@ -395,8 +377,9 @@
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You spray a [temp] on \the [target.name]</span>")
|
||||
|
||||
if(length(text_buffer))
|
||||
if(length(text_buffer) > 1)
|
||||
text_buffer = copytext(text_buffer,2)
|
||||
SStgui.update_uis(src)
|
||||
|
||||
if(post_noise)
|
||||
audible_message("<span class='notice'>You hear spraying.</span>")
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -29,7 +29,7 @@
|
||||
{{/each}}
|
||||
</ui-display>
|
||||
<ui-display title="Text Mode">
|
||||
<ui-section label='Current Buffer'>{{text_buffer}}
|
||||
<ui-section label='Current Buffer'>{{data.text_buffer}}
|
||||
</ui-section>
|
||||
<ui-section><ui-button action='enter_text'>New Text</ui-button></ui-section>
|
||||
</ui-display>
|
||||
|
||||
Reference in New Issue
Block a user