Skip to content

Commit

Permalink
simpler (#10637)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilDragonfiend authored May 8, 2024
1 parent 12a5db5 commit 9706946
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/modules/language/language.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
var/icon = 'icons/misc/language.dmi'
var/icon_state = "popcorn"

// get_icon() proc will return a complete string rather than calling a proc every time.
var/fast_icon_span

/// Returns TRUE/FALSE based on seeing a language icon is validated to a given hearer in the parameter.
/datum/language/proc/display_icon(atom/movable/hearer)
// ghosts want to know how it is going.
Expand Down Expand Up @@ -56,8 +59,10 @@
return TRUE

/datum/language/proc/get_icon()
var/datum/asset/spritesheet_batched/sheet = get_asset_datum(/datum/asset/spritesheet_batched/chat)
return sheet.icon_tag("language-[icon_state]")
if(!fast_icon_span)
var/datum/asset/spritesheet_batched/sheet = get_asset_datum(/datum/asset/spritesheet_batched/chat)
fast_icon_span = sheet.icon_tag("language-[icon_state]")
return fast_icon_span

/datum/language/proc/get_random_name(gender, name_count=2, syllable_count=4, syllable_divisor=2)
if(!syllables || !syllables.len)
Expand Down

0 comments on commit 9706946

Please sign in to comment.