U_I Phase 1.0: First consolidation pass

This commit is contained in:
Arokha Sieyes
2018-03-06 18:05:23 -05:00
parent 59def29202
commit aa9ec19118
17 changed files with 325 additions and 536 deletions

View File

@@ -84,6 +84,9 @@
var/reach = 1 // Length of tiles it can reach, 1 is adjacent.
var/addblends // Icon overlay for ADD highlights when applicable.
var/icon/default_worn_icon //Default on-mob icon
var/worn_layer //Default on-mob layer
/obj/item/New()
..()
if(embed_chance < 0)
@@ -678,4 +681,114 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
// My best guess as to why this is here would be that it does so little. Still, keep it under all the procs, for sanity's sake.
/obj/item/device
icon = 'icons/obj/device.dmi'
icon = 'icons/obj/device.dmi'
//Worn icon generation for on-mob sprites
/obj/item/proc/make_worn_icon(var/body_type,var/slot_name,var/inhands,var/default_icon,var/default_layer = 0)
//Get the required information about the base icon
var/icon/icon2use = get_worn_icon_file(body_type = body_type, slot_name = slot_name, default_icon = default_icon)
var/state2use = get_worn_icon_state(slot_name = slot_name)
var/layer2use = get_worn_layer(default_layer = default_layer)
//Snowflakey inhand icons in a specific slot
if(inhands && icon2use == icon_override)
switch(slot_name)
if(slot_r_hand_str)
state2use += "_r"
if(slot_l_hand_str)
state2use += "_l"
testing("[src] (\ref[src]) - Worn Icon:[icon2use], Worn State:[state2use], Worn Layer:[layer2use]")
//Generate the base onmob icon
var/icon/standing_icon = icon(icon = icon2use, icon_state = state2use)
apply_custom(standing_icon) //Pre-image overridable proc to customize the thing
apply_addblends(icon2use,standing_icon) //Some items have ICON_ADD blend shaders
var/image/standing = image(standing_icon)
standing.alpha = alpha
standing.color = color
standing.layer = layer2use
//Apply any special features
apply_blood(standing) //Some items show blood when bloodied
apply_accessories(standing) //Some items sport accessories like webbing
//Return our icon
return standing
//Returns the icon object that should be used for the worn icon
/obj/item/proc/get_worn_icon_file(var/body_type,var/slot_name,var/default_icon)
//1: icon_override var
if(icon_override)
return icon_override
//2: species-specific sprite sheets
var/sheet = sprite_sheets[body_type]
if(sheet)
return sheet
//3: slot-specific sprite sheets
sheet = item_icons[slot_name]
if(sheet)
return sheet
//4: item's default icon
if(default_worn_icon)
return default_worn_icon
//5: provided default_icon
if(default_icon)
return default_icon
//6: give up
return
//Returns the state that should be used for the worn icon
/obj/item/proc/get_worn_icon_state(var/slot_name)
//1: slot-specific sprite sheets
var/state = item_state_slots[slot_name]
if(state)
return state
//2: item_state variable
if(item_state)
return item_state
//3: icon_state variable
if(icon_state)
return icon_state
//Returns the layer that should be used for the worn icon (as a FLOAT_LAYER layer, so negative)
/obj/item/proc/get_worn_layer(var/default_layer)
//1: worn_layer variable
if(!isnull(worn_layer)) //Can be zero, so...
return -100+worn_layer
//2: your default
return -100+default_layer
//Apply the addblend blends onto the icon
/obj/item/proc/apply_addblends(var/source_icon, var/icon/standing_icon)
//If we have addblends, blend them onto the provided icon
if(addblends && standing_icon && source_icon)
var/addblend_icon = icon("icon" = source_icon, "icon_state" = addblends)
standing_icon.Blend(addblend_icon, ICON_ADD)
//STUB
/obj/item/proc/apply_custom(var/icon/standing_icon)
return standing_icon
//STUB
/obj/item/proc/apply_blood(var/image/standing)
return standing
//STUB
/obj/item/proc/apply_accessories(var/image/standing)
return standing

View File

@@ -3,6 +3,7 @@
desc = "An updated, modular intercom that fits over the head. Takes encryption keys"
var/radio_desc = ""
icon_state = "headset"
item_state = null //To remove the radio's state
matter = list(DEFAULT_WALL_MATERIAL = 75)
subspace_transmission = 1
canhear_range = 0 // can't hear headsets from very far away
@@ -63,6 +64,17 @@
return ..(freq, level)
return -1
/obj/item/device/radio/headset/get_worn_icon_state(var/slot_name)
var/append = ""
if(icon_override)
switch(slot_name)
if(slot_l_ear_str)
append = "_l"
if(slot_r_ear_str)
append = "_r"
return "[..()][append]"
/obj/item/device/radio/headset/syndicate
origin_tech = list(TECH_ILLEGAL = 3)
syndie = 1

View File

@@ -89,6 +89,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
var/weldermes = "USER lights NAME with FLAME"
var/ignitermes = "USER lights NAME with FLAME"
var/brand
blood_sprite_state = null //Can't bloody these
/obj/item/clothing/mask/smokable/New()
..()

View File

@@ -20,6 +20,12 @@
var/use_time = 30
sprite_sheets = list("Teshari" = 'icons/mob/species/seromi/handcuffs.dmi')
/obj/item/weapon/handcuffs/get_worn_icon_state(var/slot_name)
if(slot_name == slot_handcuffed_str)
return "handcuff1" //Simple
return ..()
/obj/item/weapon/handcuffs/attack(var/mob/living/carbon/C, var/mob/living/user)
if(!user.IsAdvancedToolUser())
@@ -210,6 +216,12 @@ var/last_chew = 0
breakouttime = 30
cuff_sound = 'sound/weapons/towelwipe.ogg' //Is there anything this sound can't do?
/obj/item/weapon/handcuffs/legcuffs/get_worn_icon_state(var/slot_name)
if(slot_name == slot_legcuffed_str)
return "legcuff1"
return ..()
/obj/item/weapon/handcuffs/legcuffs/bola/can_place(var/mob/target, var/mob/user)
if(user) //A ranged legcuff, until proper implementation as items it remains a projectile-only thing.
return 1

View File

@@ -112,6 +112,12 @@
usr << "The fingerprint hash on the card is [fingerprint_hash]."
return
/obj/item/weapon/card/id/get_worn_icon_state(var/slot_name)
if(slot_name == slot_wear_id_str)
return "id" //Legacy, just how it is. There's only one sprite.
return ..()
/obj/item/weapon/card/id/initialize()
. = ..()
var/datum/job/J = job_master.GetJob(rank)

View File

@@ -22,6 +22,16 @@
show_above_suit = !show_above_suit
update_icon()
//Some belts have sprites to show icons
/obj/item/weapon/storage/make_worn_icon(var/body_type,var/slot_name,var/inhands,var/default_icon,var/default_layer = 0)
var/image/standing = ..()
if(contents.len)
for(var/obj/item/i in contents)
var/i_state = i.item_state
if(!i_state) i_state = i.icon_state
standing.add_overlay(image(icon = INV_BELT_DEF_ICON, icon_state = i_state))
return standing
/obj/item/weapon/storage/update_icon()
if (ismob(src.loc))
var/mob/M = src.loc