mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
Port DmIcon & Image components from TG (#26623)
* Port DmIcon & Image components from TG * Documentation * Uh oh * I hate it * I will bang you
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/// Maps icon names to ref values
|
||||
/datum/asset/json/icon_ref_map
|
||||
name = "icon_ref_map"
|
||||
early = TRUE
|
||||
|
||||
/datum/asset/json/icon_ref_map/generate()
|
||||
var/list/data = list() //"icons/obj/drinks.dmi" => "[0xc000020]"
|
||||
|
||||
//var/start = "0xc000000"
|
||||
var/value = 0
|
||||
|
||||
while(TRUE)
|
||||
value += 1
|
||||
var/ref = "\[0xc[num2text(value,6,16)]\]"
|
||||
var/mystery_meat = locate(ref)
|
||||
|
||||
if(isicon(mystery_meat))
|
||||
if(!isfile(mystery_meat)) // Ignore the runtime icons for now
|
||||
continue
|
||||
var/path = get_icon_dmi_path(mystery_meat) //Try to get the icon path
|
||||
if(path)
|
||||
data[path] = ref
|
||||
else if(mystery_meat)
|
||||
continue; //Some other non-icon resource, ogg/json/whatever
|
||||
else //Out of resources end this, could also try to end this earlier as soon as runtime generated icons appear but eh
|
||||
break;
|
||||
|
||||
return data
|
||||
@@ -1,13 +0,0 @@
|
||||
/datum/asset/spritesheet/prize_counter
|
||||
name = "prize_counter"
|
||||
|
||||
/datum/asset/spritesheet/prize_counter/create_spritesheets()
|
||||
for(var/datum/prize_item/prize in GLOB.global_prizes.prizes)
|
||||
var/obj/item/prize_item = prize.typepath
|
||||
var/prize_icon = icon(icon = initial(prize_item.icon), icon_state = initial(prize_item.icon_state))
|
||||
var/imgid = replacetext(replacetext("[prize_item]", "/obj/item/", ""), "/", "-")
|
||||
Insert(imgid, prize_icon)
|
||||
|
||||
/datum/asset/spritesheet/prize_counter/ModifyInserted(icon/pre_asset)
|
||||
pre_asset.Scale(64, 64)
|
||||
return pre_asset
|
||||
Reference in New Issue
Block a user