diff --git a/code/__defines/hud.dm b/code/__defines/hud.dm new file mode 100644 index 000000000000..e44b50a2fe46 --- /dev/null +++ b/code/__defines/hud.dm @@ -0,0 +1,4 @@ +#define CLEAR_HUD_ALERTS(M) if(istype(M?.hud_used) && M.hud_used.alerts) { M.hud_used.alerts = null; } +#define SET_HUD_ALERT(M, A, V) if(istype(M?.hud_used)) { LAZYSET(M.hud_used.alerts, A, V); } +#define SET_HUD_ALERT_MIN(M, A, V) if(istype(M?.hud_used) && V < LAZYACCESS(M.hud_used.alerts, A)) { LAZYSET(M.hud_used.alerts, A, V); } +#define SET_HUD_ALERT_MAX(M, A, V) if(istype(M?.hud_used) && V > LAZYACCESS(M.hud_used.alerts, A)) { LAZYSET(M.hud_used.alerts, A, V); } diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 383bab17729d..ff912714f7c5 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -351,8 +351,8 @@ var/global/list/click_catchers return global.click_catchers /obj/screen/click_catcher - icon = 'icons/mob/screen_gen.dmi' - icon_state = "click_catcher" + icon = 'icons/mob/screen/fill.dmi' + icon_state = "blank" plane = CLICKCATCHER_PLANE mouse_opacity = 2 screen_loc = "CENTER-7,CENTER-7" diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index 705994a14009..e308bd0ccdf9 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -74,7 +74,6 @@ #define ui_up_hint "RIGHT-1:28,TOP-1:29" #define ui_toxin "RIGHT-1:28,TOP-2:27" #define ui_fire "RIGHT-1:28,TOP-3:25" -#define ui_oxygen "RIGHT-1:28,TOP-4:23" #define ui_pressure "RIGHT-1:28,TOP-5:21" #define ui_alien_toxin "RIGHT-1:28,TOP-2:25" diff --git a/code/_onclick/hud/_hud.dm b/code/_onclick/hud/_hud.dm new file mode 100644 index 000000000000..4de22e1df016 --- /dev/null +++ b/code/_onclick/hud/_hud.dm @@ -0,0 +1,539 @@ +/* + The hud datum + Used to show and hide huds for all the different mob types, + including inventories and item quick actions. +*/ +/mob + var/datum/hud/hud_used + +/mob/proc/InitializeHud() + if(ispath(hud_used)) + hud_used = new hud_used(src) + else if(istype(hud_used)) + hud_used.mymob = src // Probably unnecessary. + hud_used.refresh_client_hud() + refresh_lighting_master() + +/datum/hud + var/mob/mymob + + var/hud_shown = 1 //Used for the HUD toggle (F12) + var/inventory_shown = TRUE //the inventory + + /// A assoc lazylist of hud elements by category type + var/list/hud_elements_by_category + /// A assoc lazylist of hud element types to elements that need updating in Life() + var/list/updating_hud_elements + /// A linear list of types to populate the HUD with + var/list/hud_elements = list( + /decl/hud_element/health, + /decl/hud_element/condition/bodytemp, + /decl/hud_element/zone_selector, + /decl/hud_element/move_intent, + /decl/hud_element/action_intent, + /decl/hud_element/condition/pressure, + /decl/hud_element/condition/fire, + /decl/hud_element/condition/toxins, + /decl/hud_element/condition/oxygen, + /decl/hud_element/condition/nutrition, + /decl/hud_element/condition/hydration, + /decl/hud_element/stamina_bar, + /decl/hud_element/drop, + /decl/hud_element/resist, + /decl/hud_element/throwing, + /decl/hud_element/up_hint, + /decl/hud_element/pain, + /decl/hud_element/internals, + /decl/hud_element/gun_mode, + /decl/hud_element/gun_flag_item, + /decl/hud_element/gun_flag_move, + /decl/hud_element/gun_flag_radio + ) + var/health_hud_type = /decl/hud_element/health + var/list/alerts + + /// Whether or not the hotkey UI has been hidden. + var/hotkey_ui_hidden = FALSE + /// Linear list of hotkey UI elements. + var/list/obj/screen/hotkey_hud_elements = list() + var/list/obj/screen/misc_hud_elements = list() + var/list/obj/screen/hidable_hud_elements = list() + + var/list/hand_hud_objects + var/list/swaphand_hud_objects + + var/obj/screen/action_button/hide_toggle/hide_actions_toggle + var/action_buttons_hidden = FALSE + +/datum/hud/New(mob/owner) + mymob = owner + instantiate() + ..() + +/datum/hud/proc/clear_client_hud() + if(!mymob?.client) + return + mymob.client.screen -= hand_hud_objects + mymob.client.screen -= swaphand_hud_objects + mymob.client.screen -= misc_hud_elements + mymob.client.screen -= hidable_hud_elements + mymob.client.screen -= hotkey_hud_elements + +/datum/hud/proc/populate_client_hud() + if(!mymob?.client) + return + if(length(hand_hud_objects)) + mymob.client.screen |= hand_hud_objects + if(length(swaphand_hud_objects)) + mymob.client.screen |= swaphand_hud_objects + if(length(misc_hud_elements)) + mymob.client.screen |= misc_hud_elements + if(length(hidable_hud_elements)) + mymob.client.screen |= hidable_hud_elements + if(length(hotkey_hud_elements)) + mymob.client.screen |= hotkey_hud_elements + +/datum/hud/Destroy() + . = ..() + + clear_client_hud() + + mymob = null + hud_elements = null + hud_elements_by_category = null + updating_hud_elements = null + + QDEL_NULL_LIST(misc_hud_elements) + QDEL_NULL_LIST(hidable_hud_elements) + QDEL_NULL_LIST(hotkey_hud_elements) + QDEL_NULL_LIST(hand_hud_objects) + QDEL_NULL_LIST(swaphand_hud_objects) + +/mob/proc/get_hud_element(var/hud_elem_type) + if(istype(hud_used)) + return hud_used.get_element(hud_elem_type) + +/datum/hud/proc/get_element(var/hud_elem_type) + return LAZYACCESS(hud_elements_by_category, hud_elem_type) + +/datum/hud/proc/update_stamina() + var/obj/screen/stamina/stamina_bar = get_element(/decl/hud_element/stamina_bar) + if(istype(stamina_bar)) + stamina_bar.invisibility = INVISIBILITY_MAXIMUM + var/stamina = mymob.get_stamina() + if(stamina < 100) + stamina_bar.invisibility = 0 + stamina_bar.icon_state = "prog_bar_[FLOOR(stamina/5)*5][(stamina >= 5) && (stamina <= 25) ? "_fail" : null]" + +/datum/hud/proc/hide_inventory() + inventory_shown = FALSE + hidden_inventory_update() + persistant_inventory_update() + +/datum/hud/proc/show_inventory() + inventory_shown = TRUE + hidden_inventory_update() + persistant_inventory_update() + +/datum/hud/proc/hidden_inventory_update() + var/decl/species/species = mymob?.get_species() + if(species?.hud) + refresh_inventory_slots(species.hud.hidden_slots, (inventory_shown && hud_shown)) + +/datum/hud/proc/persistant_inventory_update() + var/decl/species/species = mymob?.get_species() + if(species?.hud) + refresh_inventory_slots(species.hud.persistent_slots, hud_shown) + +/datum/hud/proc/refresh_inventory_slots(var/list/checking_slots, var/show_hud) + + for(var/slot in checking_slots) + + var/datum/inventory_slot/inv_slot = mymob.get_inventory_slot_datum(slot) + if(!istype(inv_slot)) + continue + + // Check if we're even wearing anything in that slot. + var/obj/item/gear = inv_slot.get_equipped_item() + if(!istype(gear)) + continue + + // We're not showing anything, hide it. + if(!show_hud) + inv_slot.hide_slot() + else + inv_slot.show_slot() + +/datum/hud/proc/instantiate() + if(ismob(mymob) && mymob.client) + FinalizeInstantiation() + return TRUE + return FALSE + +/datum/hud/proc/FinalizeInstantiation() + SHOULD_CALL_PARENT(TRUE) + + for(var/elem_type in hud_elements) + var/decl/hud_element/elem_data = GET_DECL(elem_type) + var/obj/screen/elem = elem_data.create_screen_object(src) + if(QDELETED(elem)) + hud_elements -= elem_type + continue + hud_elements[elem_type] = elem + if(elem_data.update_in_life) + LAZYSET(updating_hud_elements, elem_type, elem) + if(elem_data.hud_element_category) + LAZYSET(hud_elements_by_category, elem_data.hud_element_category, elem) + + build_inventory_ui() + build_hands_ui() + refresh_client_hud() + +/datum/hud/proc/update_health_hud() + if(!health_hud_type) + return + var/obj/screen/elem = LAZYACCESS(hud_elements, health_hud_type) + if(!elem) + return + var/decl/hud_element/elem_data = GET_DECL(health_hud_type) + elem_data.refresh_screen_object(src, elem) + +/datum/hud/proc/refresh_client_hud() + if(mymob?.client) + mymob.client.screen.Cut() + + populate_client_hud() + hide_inventory() + refresh_ability_hud() + +/datum/hud/proc/get_ui_style() + return ui_style2icon(mymob?.client?.prefs?.UI_style) || 'icons/mob/screen/white.dmi' + +/datum/hud/proc/get_ui_color() + return mymob?.client?.prefs?.UI_style_color || COLOR_WHITE + +/datum/hud/proc/get_ui_alpha() + return mymob?.client?.prefs?.UI_style_alpha || 255 + +/datum/hud/proc/rebuild_hands() + + var/ui_style = get_ui_style() + var/ui_color = get_ui_color() + var/ui_alpha = get_ui_alpha() + + // Build held item boxes for missing slots. + var/list/held_slots = mymob.get_held_item_slots() + for(var/hand_tag in held_slots) + var/obj/screen/inventory/inv_box + for(var/obj/screen/inventory/existing_box in hand_hud_objects) + if(existing_box.slot_id == hand_tag) + inv_box = existing_box + break + if(!inv_box) + inv_box = new /obj/screen/inventory() + var/datum/inventory_slot/inv_slot = mymob.get_inventory_slot_datum(hand_tag) + inv_box.SetName(hand_tag) + inv_box.icon = ui_style + inv_box.icon_state = "hand_base" + + inv_box.cut_overlays() + inv_box.add_overlay("hand_[hand_tag]") + if(inv_slot.ui_label) + inv_box.add_overlay("hand_[inv_slot.ui_label]") + if(mymob.get_active_held_item_slot() == hand_tag) + inv_box.add_overlay("hand_selected") + inv_box.compile_overlays() + + inv_box.slot_id = hand_tag + inv_box.color = ui_color + inv_box.alpha = ui_alpha + inv_box.appearance_flags |= KEEP_TOGETHER + + LAZYDISTINCTADD(hand_hud_objects, inv_box) + + // Clear held item boxes with no held slot. + for(var/obj/screen/inventory/inv_box in hand_hud_objects) + if(!(inv_box.slot_id in held_slots)) + if(mymob.client) + mymob.client.screen -= inv_box + LAZYREMOVE(hand_hud_objects, inv_box) + qdel(inv_box) + + // Rebuild offsets for the hand elements. + var/hand_y_offset = 5 + var/list/elements = hand_hud_objects?.Copy() + while(length(elements)) + var/copy_index = min(length(elements), 2)+1 + var/list/sublist = elements.Copy(1, copy_index) + elements.Cut(1, copy_index) + var/obj/screen/inventory/inv_box + if(length(sublist) == 1) + inv_box = sublist[1] + inv_box.screen_loc = "CENTER,BOTTOM:[hand_y_offset]" + else + inv_box = sublist[1] + inv_box.screen_loc = "CENTER:-[world.icon_size/2],BOTTOM:[hand_y_offset]" + inv_box = sublist[2] + inv_box.screen_loc = "CENTER:[world.icon_size/2],BOTTOM:[hand_y_offset]" + hand_y_offset += world.icon_size + if(mymob.client) + mymob.client.screen |= inv_box + + // Make sure all held items are on the screen and set to the correct screen loc. + var/datum/inventory_slot/inv_slot + for(var/obj/inv_elem in hand_hud_objects) + inv_slot = mymob.get_inventory_slot_datum(inv_elem.name) + if(inv_slot) + inv_slot.ui_loc = inv_elem.screen_loc + var/obj/item/held = inv_slot.get_equipped_item() + if(held) + held.screen_loc = inv_slot.ui_loc + if(mymob.client) + mymob.client.screen |= held // just to make sure it's visible post-login + + var/hand_x_offset = -(world.icon_size/2) + for(var/i = 1 to length(swaphand_hud_objects)) + var/obj/swap_elem = swaphand_hud_objects[i] + swap_elem.screen_loc = "CENTER:[hand_x_offset],BOTTOM:[hand_y_offset]" + if(i > 1) // first two elems share a slot + hand_x_offset += world.icon_size + if(mymob.client) + mymob.client.screen |= swap_elem + +/datum/hud/proc/build_inventory_ui() + + var/ui_style = get_ui_style() + var/ui_color = get_ui_color() + var/ui_alpha = get_ui_alpha() + + var/has_hidden_gear = FALSE + + // Draw the various inventory equipment slots. + var/obj/screen/inventory/inv_box + var/list/held_slots = mymob.get_held_item_slots() + var/list/inventory_slots = mymob.get_inventory_slots() + for(var/gear_slot in inventory_slots) + + if(gear_slot in held_slots) + continue + + inv_box = new /obj/screen/inventory() + inv_box.icon = ui_style + inv_box.color = ui_color + inv_box.alpha = ui_alpha + + var/datum/inventory_slot/inv_slot = inventory_slots[gear_slot] + inv_box.SetName(inv_slot.slot_name) + inv_box.slot_id = inv_slot.slot_id + inv_box.icon_state = inv_slot.slot_state + inv_box.screen_loc = inv_slot.ui_loc + + if(inv_slot.slot_dir) + inv_box.set_dir(inv_slot.slot_dir) + + if(inv_slot.can_be_hidden) + hidable_hud_elements += inv_box + has_hidden_gear = TRUE + else + misc_hud_elements += inv_box + + if(has_hidden_gear) + var/obj/screen/using = new /obj/screen + using.SetName("toggle") + using.icon = ui_style + using.icon_state = "other" + using.screen_loc = ui_inventory + using.color = ui_color + using.alpha = ui_alpha + misc_hud_elements += using + +/datum/hud/proc/build_hands_ui() + + var/ui_style = get_ui_style() + var/ui_color = get_ui_color() + var/ui_alpha = get_ui_alpha() + + var/obj/screen/using + + // Swap hand and quick equip screen elems. + using = new /obj/screen + using.SetName("equip") + using.icon = ui_style + using.icon_state = "act_equip" + using.color = ui_color + using.alpha = ui_alpha + misc_hud_elements += using + LAZYADD(swaphand_hud_objects, using) + + var/list/held_slots = mymob.get_held_item_slots() + if(length(held_slots) > 1) + + using = new /obj/screen/inventory() + using.SetName("hand") + using.icon = ui_style + using.icon_state = "hand1" + using.color = ui_color + using.alpha = ui_alpha + misc_hud_elements += using + LAZYADD(swaphand_hud_objects, using) + + using = new /obj/screen/inventory() + using.SetName("hand") + using.icon = ui_style + using.icon_state = "hand2" + using.color = ui_color + using.alpha = ui_alpha + misc_hud_elements += using + LAZYADD(swaphand_hud_objects, using) + + // Actual hand elems. + rebuild_hands() + +/mob/verb/minimize_hud_verb() + set name = "Minimize Hud" + set hidden = TRUE + set category = "OOC" + minimize_hud() + +/mob/proc/minimize_hud(var/zoom = FALSE) + + if(!istype(hud_used)) + return + + if(!client || client.view != world.view || !hud_used) + return + + var/obj/screen/action_intent = get_hud_element(/decl/hud_element/action_intent) + if(hud_used.hud_shown) + client.screen -= hud_used.misc_hud_elements + client.screen -= hud_used.hidable_hud_elements + client.screen -= hud_used.hotkey_hud_elements + if(action_intent) + action_intent.screen_loc = ui_acti_alt // move this to the alternative position, where zone_select usually is. + else + if(length(hud_used.misc_hud_elements)) + client.screen |= hud_used.misc_hud_elements + if(hud_used.inventory_shown && length(hud_used.hidable_hud_elements)) + client.screen |= hud_used.hidable_hud_elements + if(!hud_used.hotkey_ui_hidden && length(hud_used.hotkey_hud_elements)) + client.screen |= hud_used.hotkey_hud_elements + if(action_intent) + action_intent.screen_loc = ui_acti //Restore intent selection to the original position + + // We always want to show our hands. + if(LAZYLEN(hud_used.hand_hud_objects)) + client.screen |= hud_used.hand_hud_objects + if(LAZYLEN(hud_used.swaphand_hud_objects)) + client.screen |= hud_used.swaphand_hud_objects + + hud_used.hud_shown = !hud_used.hud_shown + hud_used.hidden_inventory_update() + hud_used.persistant_inventory_update() + update_action_buttons() + +/client/proc/reset_click_catchers() + + var/xmin = -(round(last_view_x_dim*0.5)) + var/xmax = last_view_x_dim - abs(xmin) + var/ymin = -(round(last_view_y_dim*0.5)) + var/ymax = last_view_y_dim - abs(ymin) + + var/list/click_catchers = get_click_catchers() + for(var/obj/screen/click_catcher/catcher in click_catchers) + if(catcher.x_offset <= xmin || catcher.x_offset >= xmax || catcher.y_offset <= ymin || catcher.y_offset >= ymax) + screen -= catcher + else + screen |= catcher + +/mob/proc/reset_click_catchers() + client.reset_click_catchers() + +/mob/new_player/reset_click_catchers() + return + +/datum/hud/proc/update_icons() + if(!length(updating_hud_elements) || QDELETED(mymob)) + return + + var/obj/screen/ability_master/ability_master = get_element(/decl/hud_element/ability_master) + if(ability_master) + ability_master.update_spells(0) + + var/datum/gas_mixture/environment = mymob.loc?.return_air() + for(var/elem_type in updating_hud_elements) + var/decl/hud_element/hud_elem_data = GET_DECL(elem_type) + hud_elem_data.refresh_screen_object(src, hud_elements[elem_type], environment) + +/datum/hud/proc/hide_ability_hud() + var/ui_alpha = get_ui_alpha() + for(var/elem_type in hud_elements) + var/decl/hud_element/hud_elem = GET_DECL(elem_type) + if(hud_elem.hidable) + var/obj/thing = hud_elements[elem_type] + if(istype(thing)) + thing.alpha = hud_elem.apply_hud_alpha ? ui_alpha : initial(thing.alpha) + thing.invisibility = initial(thing.invisibility) + +/datum/hud/proc/show_ability_hud() + for(var/elem_type in hud_elements) + var/decl/hud_element/hud_elem = GET_DECL(elem_type) + if(hud_elem.hidable) + var/obj/thing = hud_elements[elem_type] + if(istype(thing)) + thing.alpha = 0 + thing.invisibility = INVISIBILITY_MAXIMUM + +/datum/hud/proc/should_show_ability_hud() + return TRUE + +/datum/hud/proc/refresh_ability_hud() + + var/obj/screen/ability_master/ability_master = get_element(/decl/hud_element/ability_master) + if(ability_master) + ability_master.update_abilities(TRUE, mymob) + ability_master.toggle_open(1) + ability_master.synch_spells_to_mind(mymob?.mind) + + if(should_show_ability_hud()) + show_ability_hud() + else + hide_ability_hud() + +/datum/hud/proc/reset_hud_callback() + if(mymob.is_on_special_ability_cooldown()) + return + var/ui_color = get_ui_color() + for(var/elem_type in hud_elements) + var/decl/hud_element/hud_elem = GET_DECL(elem_type) + if(hud_elem.apply_color_on_cooldown) + var/obj/thing = hud_elements[elem_type] + if(istype(thing)) + thing.color = hud_elem.apply_hud_color ? ui_color : initial(thing.color) + +/datum/hud/proc/set_hud_cooldown(var/time, var/cooldown_color) + var/colored_a_thing = FALSE + for(var/elem_type in hud_elements) + var/decl/hud_element/hud_elem = GET_DECL(elem_type) + if(hud_elem.apply_color_on_cooldown) + var/obj/thing = hud_elements[elem_type] + if(istype(thing)) + colored_a_thing = TRUE + thing.color = cooldown_color + if(colored_a_thing) + addtimer(CALLBACK(src, /datum/hud/proc/reset_hud_callback), time+1) + +/datum/hud/proc/refresh_stat_panel() + var/obj/screen/ability_master/ability_master = mymob.get_hud_element(/decl/hud_element/ability_master) + if(!ability_master?.spell_objects) + return + for(var/obj/screen/ability/spell/screen in ability_master.spell_objects) + var/spell/S = screen.spell + if((!S.connected_button) || !statpanel(S.panel)) + continue //Not showing the noclothes spell + switch(S.charge_type) + if(Sp_RECHARGE) + statpanel(S.panel,"[S.charge_counter/10.0]/[S.charge_max/10]",S.connected_button) + if(Sp_CHARGES) + statpanel(S.panel,"[S.charge_counter]/[S.charge_max]",S.connected_button) + if(Sp_HOLDVAR) + statpanel(S.panel,"[S.holder_var_type] [S.holder_var_amount]",S.connected_button) diff --git a/code/_onclick/hud/ability_screen_objects.dm b/code/_onclick/hud/ability_screen_objects.dm index 7887e0dd43c1..b742a7731245 100644 --- a/code/_onclick/hud/ability_screen_objects.dm +++ b/code/_onclick/hud/ability_screen_objects.dm @@ -1,6 +1,6 @@ /obj/screen/ability_master name = "Abilities" - icon = 'icons/mob/screen_spells.dmi' + icon = 'icons/mob/screen/spells.dmi' icon_state = "grey_spell_ready" var/list/obj/screen/ability/ability_objects = list() var/list/obj/screen/ability/spell_objects = list() @@ -27,11 +27,6 @@ . = ..() remove_all_abilities() //Get rid of the ability objects. ability_objects.Cut() - if(my_mob) // After that, remove ourselves from the mob seeing us, so we can qdel cleanly. - my_mob.ability_master = null - if(my_mob.client && my_mob.client.screen) - my_mob.client.screen -= src - my_mob = null /obj/screen/ability_master/handle_mouse_drop(var/atom/over, var/mob/user) if(showing) @@ -41,7 +36,6 @@ /obj/screen/ability_master/Click() if(!ability_objects.len) // If we're empty for some reason. return - toggle_open() /obj/screen/ability_master/proc/toggle_open(var/forced_state = 0) @@ -149,15 +143,11 @@ var/spell/S = screen.spell M.learned_spells |= S -/mob/Initialize() - . = ..() - ability_master = new /obj/screen/ability_master(null,src) - ///////////ACTUAL ABILITIES//////////// //This is what you click to do things// /////////////////////////////////////// /obj/screen/ability - icon = 'icons/mob/screen_spells.dmi' + icon = 'icons/mob/screen/spells.dmi' icon_state = "grey_spell_base" maptext_x = 3 var/background_base_state = "grey" @@ -204,11 +194,13 @@ if(isnull(slot) || !isnum(slot)) to_chat(src,".activate_ability requires a number as input, corrisponding to the slot you wish to use.") return // Bad input. - if(!mob.ability_master) + + var/obj/screen/ability_master/ability_master = mob.get_hud_element(/decl/hud_element/ability_master) + if(!ability_master) return // No abilities. - if(slot > mob.ability_master.ability_objects.len || slot <= 0) + if(slot > ability_master.ability_objects.len || slot <= 0) return // Out of bounds. - var/obj/screen/ability/A = mob.ability_master.ability_objects[slot] + var/obj/screen/ability/A = ability_master.ability_objects[slot] A.activate() //////////Verb Abilities////////// diff --git a/code/_onclick/hud/ai.dm b/code/_onclick/hud/ai.dm index 1c99ce6d77d2..eefa3565072f 100644 --- a/code/_onclick/hud/ai.dm +++ b/code/_onclick/hud/ai.dm @@ -1,11 +1,11 @@ /mob/living/silicon/ai - hud_type = /datum/hud/ai + hud_used = /datum/hud/ai /datum/hud/ai/FinalizeInstantiation() var/list/ai_hud_data = decls_repository.get_decls_of_subtype(/decl/ai_hud) for(var/elem_type in ai_hud_data) var/decl/ai_hud/ai_hud = ai_hud_data[elem_type] - adding += new /obj/screen/ai_button(null, + misc_hud_elements += new /obj/screen/ai_button(null, ai_hud.screen_loc, ai_hud.name, ai_hud.icon_state, @@ -13,5 +13,4 @@ ai_hud.input_procs, ai_hud.input_args ) - if(mymob?.client) - mymob.client.screen = list(adding) + return ..() diff --git a/code/_onclick/hud/ai_screen_objects.dm b/code/_onclick/hud/ai_screen_objects.dm index cbbff7d5d962..77945ee7e4ac 100644 --- a/code/_onclick/hud/ai_screen_objects.dm +++ b/code/_onclick/hud/ai_screen_objects.dm @@ -2,7 +2,7 @@ var/mob/living/silicon/ai/ai_verb var/list/input_procs var/list/input_args - icon = 'icons/mob/screen_ai.dmi' + icon = 'icons/mob/screen/ai.dmi' var/list/template_icon = list(null, "template") var/image/template_undelay diff --git a/code/_onclick/hud/animal.dm b/code/_onclick/hud/animal.dm deleted file mode 100644 index 129d39f259a6..000000000000 --- a/code/_onclick/hud/animal.dm +++ /dev/null @@ -1,8 +0,0 @@ - -/mob/living/simple_animal - hud_type = /datum/hud/animal - -/datum/hud/animal/FinalizeInstantiation() - mymob.client.screen = list() - action_intent = new /obj/screen/intent() - mymob.client.screen |= action_intent \ No newline at end of file diff --git a/code/_onclick/hud/constructs.dm b/code/_onclick/hud/constructs.dm new file mode 100644 index 000000000000..30a8ac6f9759 --- /dev/null +++ b/code/_onclick/hud/constructs.dm @@ -0,0 +1,72 @@ +/mob/living/simple_animal/construct + hud_used = /datum/hud/construct/wraith + +/mob/living/simple_animal/construct/armoured + hud_used = /datum/hud/construct/juggernaut + +/mob/living/simple_animal/construct/behemoth + hud_used = /datum/hud/construct/juggernaut + +/mob/living/simple_animal/construct/builder + hud_used = /datum/hud/construct/artificer + +/mob/living/simple_animal/construct/harvester + hud_used = /datum/hud/construct/harvester + +/decl/hud_element/condition/fire/construct + screen_loc = ui_construct_fire + +/decl/hud_element/health/construct + screen_loc = ui_construct_health + abstract_type = /decl/hud_element/health/construct + +/decl/hud_element/health/construct/artificer + screen_icon = 'icons/mob/screen/health_construct_artificer.dmi' + +/decl/hud_element/health/construct/wraith + screen_icon = 'icons/mob/screen/health_construct_wraith.dmi' + +/decl/hud_element/health/construct/juggernaut + screen_icon = 'icons/mob/screen/health_construct_juggernaut.dmi' + +/decl/hud_element/health/construct/harvester + screen_icon = 'icons/mob/screen/health_construct_harvester.dmi' + +/datum/hud/construct/get_ui_style() + return 'icons/mob/screen/construct.dmi' + +/datum/hud/construct/artificer + health_hud_type = /decl/hud_element/health/construct/artificer + hud_elements = list( + /decl/hud_element/health/construct/artificer, + /decl/hud_element/zone_selector, + /decl/hud_element/action_intent, + /decl/hud_element/condition/fire/construct + ) + +/datum/hud/construct/wraith + health_hud_type = /decl/hud_element/health/construct/wraith + hud_elements = list( + /decl/hud_element/health/construct/wraith, + /decl/hud_element/zone_selector, + /decl/hud_element/action_intent, + /decl/hud_element/condition/fire/construct + ) + +/datum/hud/construct/juggernaut + health_hud_type = /decl/hud_element/health/construct/juggernaut + hud_elements = list( + /decl/hud_element/health/construct/juggernaut, + /decl/hud_element/zone_selector, + /decl/hud_element/action_intent, + /decl/hud_element/condition/fire/construct + ) + +/datum/hud/construct/harvester + health_hud_type = /decl/hud_element/health/construct/harvester + hud_elements = list( + /decl/hud_element/health/construct/harvester, + /decl/hud_element/zone_selector, + /decl/hud_element/action_intent, + /decl/hud_element/condition/fire/construct + ) diff --git a/code/_onclick/hud/deity.dm b/code/_onclick/hud/deity.dm index df18fb9ff534..9a7e418da2b4 100644 --- a/code/_onclick/hud/deity.dm +++ b/code/_onclick/hud/deity.dm @@ -1,19 +1,19 @@ /mob/living/deity - hud_type = /datum/hud/deity + hud_used = /datum/hud/deity -/datum/hud/deity/FinalizeInstantiation() - src.adding = list() - src.other = list() +/datum/hud/deity + hud_elements = list( + /decl/hud_element/action_intent/deity + ) - var/obj/screen/intent/deity/D = new() - - src.adding += D - action_intent = D - - mymob.client.screen = list() - mymob.client.screen += src.adding - D.sync_to_mob(mymob) +/decl/hud_element/action_intent/deity + screen_object_type = /obj/screen/intent/deity +/decl/hud_element/action_intent/deity/register_screen_object(obj/screen/elem, datum/hud/hud) + var/obj/screen/intent/deity/deity_elem = elem + if(istype(deity_elem)) + deity_elem.sync_to_mob(hud.mymob) + return ..() /obj/screen/intent/deity var/list/desc_screens = list() @@ -21,7 +21,7 @@ /obj/screen/intent/deity/Initialize() . = ..() - overlays += image('icons/mob/screen_phenomena.dmi', icon_state = "hud", pixel_x = -138, pixel_y = -1) + overlays += image('icons/mob/screen/phenomena.dmi', icon_state = "hud", pixel_x = -138, pixel_y = -1) /obj/screen/intent/deity/proc/sync_to_mob(var/mob) var/mob/living/deity/D = mob diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm index 4da06f9b5757..182efda67f1d 100644 --- a/code/_onclick/hud/fullscreen.dm +++ b/code/_onclick/hud/fullscreen.dm @@ -1,12 +1,12 @@ /mob - var/list/screens = list() + var/list/_screens /mob/proc/set_fullscreen(condition, screen_name, screen_type, arg) condition ? overlay_fullscreen(screen_name, screen_type, arg) : clear_fullscreen(screen_name) /mob/proc/overlay_fullscreen(category, type, severity) - var/obj/screen/fullscreen/screen = screens[category] + var/obj/screen/fullscreen/screen = LAZYACCESS(_screens, category) if(screen) if(screen.type != type) @@ -21,7 +21,7 @@ screen.icon_state = "[initial(screen.icon_state)][severity]" screen.severity = severity - screens[category] = screen + LAZYSET(_screens, category, screen) screen.transform = null if(screen && client && (stat != DEAD || screen.allstate)) client.screen += screen @@ -36,11 +36,11 @@ qdel(screen) /mob/proc/clear_fullscreen(category, animated = 10) - var/obj/screen/fullscreen/screen = screens[category] + var/obj/screen/fullscreen/screen = LAZYACCESS(_screens, category) if(!screen) return - screens -= category + LAZYREMOVE(_screens, category) if(animated) show_screen(screen, animated) @@ -50,19 +50,19 @@ qdel(screen) /mob/proc/clear_fullscreens() - for(var/category in screens) + for(var/category in _screens) clear_fullscreen(category) /mob/proc/hide_fullscreens() if(client) - for(var/category in screens) - client.screen -= screens[category] + for(var/category in _screens) + client.screen -= _screens[category] /mob/proc/reload_fullscreen() if(client) var/largest_bound = max(client.last_view_x_dim, client.last_view_y_dim) - for(var/category in screens) - var/obj/screen/fullscreen/screen = screens[category] + for(var/category in _screens) + var/obj/screen/fullscreen/screen = _screens[category] screen.transform = null if(screen.screen_loc != ui_entire_screen && largest_bound > 7) var/matrix/M = matrix() @@ -71,7 +71,7 @@ client.screen |= screen /obj/screen/fullscreen - icon = 'icons/mob/screen_full.dmi' + icon = 'icons/mob/screen/full.dmi' icon_state = "default" screen_loc = ui_center_fullscreen plane = FULLSCREEN_PLANE @@ -100,7 +100,7 @@ layer = BLIND_LAYER /obj/screen/fullscreen/blackout - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/fill.dmi' icon_state = "black" screen_loc = ui_entire_screen layer = BLIND_LAYER @@ -110,13 +110,13 @@ layer = IMPAIRED_LAYER /obj/screen/fullscreen/blurry - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/fill.dmi' screen_loc = ui_entire_screen icon_state = "blurry" alpha = 100 /obj/screen/fullscreen/flash - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/fill.dmi' screen_loc = ui_entire_screen icon_state = "flash" @@ -124,7 +124,7 @@ icon_state = "noise" /obj/screen/fullscreen/high - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/fill.dmi' screen_loc = ui_entire_screen icon_state = "druggy" alpha = 127 @@ -138,7 +138,7 @@ alpha = 127 /obj/screen/fullscreen/fadeout - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/fill.dmi' icon_state = "black" screen_loc = ui_entire_screen layer = FULLSCREEN_LAYER diff --git a/code/_onclick/hud/gun_mode.dm b/code/_onclick/hud/gun_mode.dm deleted file mode 100644 index ab5cecbff9c2..000000000000 --- a/code/_onclick/hud/gun_mode.dm +++ /dev/null @@ -1,66 +0,0 @@ -/obj/screen/gun - name = "gun" - icon = 'icons/mob/screen1.dmi' - master = null - dir = SOUTH - -/obj/screen/gun/Click(location, control, params) - if(!usr) - return - return 1 - -/obj/screen/gun/move - name = "Allow Movement" - icon_state = "no_walk1" - screen_loc = ui_gun2 - -/obj/screen/gun/move/Click(location, control, params) - if(..()) - var/mob/living/user = usr - if(istype(user)) - if(!user.aiming) user.aiming = new(user) - user.aiming.toggle_permission(TARGET_CAN_MOVE) - return 1 - return 0 - -/obj/screen/gun/item - name = "Allow Item Use" - icon_state = "no_item1" - screen_loc = ui_gun1 - -/obj/screen/gun/item/Click(location, control, params) - if(..()) - var/mob/living/user = usr - if(istype(user)) - if(!user.aiming) user.aiming = new(user) - user.aiming.toggle_permission(TARGET_CAN_CLICK) - return 1 - return 0 - -/obj/screen/gun/mode - name = "Toggle Gun Mode" - icon_state = "gun0" - screen_loc = ui_gun_select - -/obj/screen/gun/mode/Click(location, control, params) - if(..()) - var/mob/living/user = usr - if(istype(user)) - if(!user.aiming) user.aiming = new(user) - user.aiming.toggle_active() - return 1 - return 0 - -/obj/screen/gun/radio - name = "Disallow Radio Use" - icon_state = "no_radio1" - screen_loc = ui_gun4 - -/obj/screen/gun/radio/Click(location, control, params) - if(..()) - var/mob/living/user = usr - if(istype(user)) - if(!user.aiming) user.aiming = new(user) - user.aiming.toggle_permission(TARGET_CAN_RADIO) - return 1 - return 0 diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm deleted file mode 100644 index 25c888d24ade..000000000000 --- a/code/_onclick/hud/hud.dm +++ /dev/null @@ -1,424 +0,0 @@ -/* - The hud datum - Used to show and hide huds for all the different mob types, - including inventories and item quick actions. -*/ - -/mob - var/hud_type = null - var/datum/hud/hud_used = null - -/mob/proc/InitializeHud() - if(hud_used) - qdel(hud_used) - if(hud_type) - hud_used = new hud_type(src) - else - hud_used = new /datum/hud(src) - refresh_lighting_master() - -/datum/hud - var/mob/mymob - - var/hud_shown = 1 //Used for the HUD toggle (F12) - var/inventory_shown = TRUE //the inventory - var/show_intent_icons = FALSE - var/hotkey_ui_hidden = FALSE //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons) - - var/obj/screen/lingchemdisplay - var/list/hand_hud_objects - var/list/swaphand_hud_objects - var/obj/screen/action_intent - var/obj/screen/move_intent - var/obj/screen/stamina/stamina_bar - - var/list/adding - var/list/other - var/list/obj/screen/hotkeybuttons - - var/obj/screen/action_button/hide_toggle/hide_actions_toggle - var/action_buttons_hidden = FALSE - -/datum/hud/New(mob/owner) - mymob = owner - instantiate() - ..() - -/datum/hud/Destroy() - . = ..() - stamina_bar = null - lingchemdisplay = null - action_intent = null - move_intent = null - adding = null - other = null - hotkeybuttons = null - mymob = null - QDEL_NULL_LIST(hand_hud_objects) - QDEL_NULL_LIST(swaphand_hud_objects) - -/datum/hud/proc/update_stamina() - if(mymob && stamina_bar) - stamina_bar.invisibility = INVISIBILITY_MAXIMUM - var/stamina = mymob.get_stamina() - if(stamina < 100) - stamina_bar.invisibility = 0 - stamina_bar.icon_state = "prog_bar_[FLOOR(stamina/5)*5][(stamina >= 5) && (stamina <= 25) ? "_fail" : null]" - -/datum/hud/proc/hide_inventory() - inventory_shown = FALSE - hidden_inventory_update() - persistant_inventory_update() - -/datum/hud/proc/show_inventory() - inventory_shown = TRUE - hidden_inventory_update() - persistant_inventory_update() - -/datum/hud/proc/hidden_inventory_update() - var/decl/species/species = mymob?.get_species() - if(species?.hud) - refresh_inventory_slots(species.hud.hidden_slots, (inventory_shown && hud_shown)) - -/datum/hud/proc/persistant_inventory_update() - var/decl/species/species = mymob?.get_species() - if(species?.hud) - refresh_inventory_slots(species.hud.persistent_slots, hud_shown) - -/datum/hud/proc/refresh_inventory_slots(var/list/checking_slots, var/show_hud) - - for(var/slot in checking_slots) - - var/datum/inventory_slot/inv_slot = mymob.get_inventory_slot_datum(slot) - if(!istype(inv_slot)) - continue - - // Check if we're even wearing anything in that slot. - var/obj/item/gear = inv_slot.get_equipped_item() - if(!istype(gear)) - continue - - // We're not showing anything, hide it. - if(!show_hud) - inv_slot.hide_slot() - else - inv_slot.show_slot() - -/datum/hud/proc/instantiate() - if(ismob(mymob) && mymob.client) - FinalizeInstantiation() - return TRUE - return FALSE - -/datum/hud/proc/FinalizeInstantiation() - return - -/datum/hud/proc/get_ui_style() - return ui_style2icon(mymob?.client?.prefs?.UI_style) || 'icons/mob/screen/white.dmi' - -/datum/hud/proc/get_ui_color() - return mymob?.client?.prefs?.UI_style_color || COLOR_WHITE - -/datum/hud/proc/get_ui_alpha() - return mymob?.client?.prefs?.UI_style_alpha || 255 - -/datum/hud/proc/rebuild_hands() - - var/ui_style = get_ui_style() - var/ui_color = get_ui_color() - var/ui_alpha = get_ui_alpha() - - // Build held item boxes for missing slots. - var/list/held_slots = mymob.get_held_item_slots() - for(var/hand_tag in held_slots) - var/obj/screen/inventory/inv_box - for(var/obj/screen/inventory/existing_box in hand_hud_objects) - if(existing_box.slot_id == hand_tag) - inv_box = existing_box - break - if(!inv_box) - inv_box = new /obj/screen/inventory() - var/datum/inventory_slot/inv_slot = mymob.get_inventory_slot_datum(hand_tag) - inv_box.SetName(hand_tag) - inv_box.icon = ui_style - inv_box.icon_state = "hand_base" - - inv_box.cut_overlays() - inv_box.add_overlay("hand_[hand_tag]") - if(inv_slot.ui_label) - inv_box.add_overlay("hand_[inv_slot.ui_label]") - if(mymob.get_active_held_item_slot() == hand_tag) - inv_box.add_overlay("hand_selected") - inv_box.compile_overlays() - - inv_box.slot_id = hand_tag - inv_box.color = ui_color - inv_box.alpha = ui_alpha - inv_box.appearance_flags |= KEEP_TOGETHER - - LAZYDISTINCTADD(hand_hud_objects, inv_box) - - // Clear held item boxes with no held slot. - for(var/obj/screen/inventory/inv_box in hand_hud_objects) - if(!(inv_box.slot_id in held_slots)) - if(mymob.client) - mymob.client.screen -= inv_box - LAZYREMOVE(hand_hud_objects, inv_box) - qdel(inv_box) - - // Rebuild offsets for the hand elements. - var/hand_y_offset = 5 - var/list/elements = hand_hud_objects?.Copy() - while(length(elements)) - var/copy_index = min(length(elements), 2)+1 - var/list/sublist = elements.Copy(1, copy_index) - elements.Cut(1, copy_index) - var/obj/screen/inventory/inv_box - if(length(sublist) == 1) - inv_box = sublist[1] - inv_box.screen_loc = "CENTER,BOTTOM:[hand_y_offset]" - else - inv_box = sublist[1] - inv_box.screen_loc = "CENTER:-[world.icon_size/2],BOTTOM:[hand_y_offset]" - inv_box = sublist[2] - inv_box.screen_loc = "CENTER:[world.icon_size/2],BOTTOM:[hand_y_offset]" - hand_y_offset += world.icon_size - if(mymob.client) - mymob.client.screen |= inv_box - - // Make sure all held items are on the screen and set to the correct screen loc. - var/datum/inventory_slot/inv_slot - for(var/obj/inv_elem in hand_hud_objects) - inv_slot = mymob.get_inventory_slot_datum(inv_elem.name) - if(inv_slot) - inv_slot.ui_loc = inv_elem.screen_loc - var/obj/item/held = inv_slot.get_equipped_item() - if(held) - held.screen_loc = inv_slot.ui_loc - if(mymob.client) - mymob.client.screen |= held // just to make sure it's visible post-login - - var/hand_x_offset = -(world.icon_size/2) - for(var/i = 1 to length(swaphand_hud_objects)) - var/obj/swap_elem = swaphand_hud_objects[i] - swap_elem.screen_loc = "CENTER:[hand_x_offset],BOTTOM:[hand_y_offset]" - if(i > 1) // first two elems share a slot - hand_x_offset += world.icon_size - if(mymob.client) - mymob.client.screen |= swap_elem - -/datum/hud/proc/BuildInventoryUI() - - var/ui_style = get_ui_style() - var/ui_color = get_ui_color() - var/ui_alpha = get_ui_alpha() - - var/has_hidden_gear = FALSE - - // Draw the various inventory equipment slots. - var/obj/screen/inventory/inv_box - var/list/held_slots = mymob.get_held_item_slots() - var/list/inventory_slots = mymob.get_inventory_slots() - for(var/gear_slot in inventory_slots) - - if(gear_slot in held_slots) - continue - - inv_box = new /obj/screen/inventory() - inv_box.icon = ui_style - inv_box.color = ui_color - inv_box.alpha = ui_alpha - - var/datum/inventory_slot/inv_slot = inventory_slots[gear_slot] - inv_box.SetName(inv_slot.slot_name) - inv_box.slot_id = inv_slot.slot_id - inv_box.icon_state = inv_slot.slot_state - inv_box.screen_loc = inv_slot.ui_loc - - if(inv_slot.slot_dir) - inv_box.set_dir(inv_slot.slot_dir) - - if(inv_slot.can_be_hidden) - other += inv_box - has_hidden_gear = TRUE - else - adding += inv_box - - if(has_hidden_gear) - var/obj/screen/using = new /obj/screen() - using.SetName("toggle") - using.icon = ui_style - using.icon_state = "other" - using.screen_loc = ui_inventory - using.color = ui_color - using.alpha = ui_alpha - adding += using - -/datum/hud/proc/BuildHandsUI() - - var/ui_style = get_ui_style() - var/ui_color = get_ui_color() - var/ui_alpha = get_ui_alpha() - - var/obj/screen/using - - // Swap hand and quick equip screen elems. - using = new /obj/screen() - using.SetName("equip") - using.icon = ui_style - using.icon_state = "act_equip" - using.color = ui_color - using.alpha = ui_alpha - src.adding += using - LAZYADD(swaphand_hud_objects, using) - - var/list/held_slots = mymob.get_held_item_slots() - if(length(held_slots) > 1) - - using = new /obj/screen/inventory() - using.SetName("hand") - using.icon = ui_style - using.icon_state = "hand1" - using.color = ui_color - using.alpha = ui_alpha - src.adding += using - LAZYADD(swaphand_hud_objects, using) - - using = new /obj/screen/inventory() - using.SetName("hand") - using.icon = ui_style - using.icon_state = "hand2" - using.color = ui_color - using.alpha = ui_alpha - src.adding += using - LAZYADD(swaphand_hud_objects, using) - - // Actual hand elems. - rebuild_hands() - -/mob/verb/minimize_hud(full = FALSE as null) - set name = "Minimize Hud" - set hidden = TRUE - - if(!hud_used) - to_chat(usr, "This mob type does not use a HUD.") - return - - if(!ishuman(src)) - to_chat(usr, "Inventory hiding is currently only supported for human mobs, sorry.") - return - - if(!client) return - if(client.view != world.view) - return - if(hud_used.hud_shown) - hud_used.hud_shown = 0 - if(src.hud_used.adding) - src.client.screen -= src.hud_used.adding - if(src.hud_used.other) - src.client.screen -= src.hud_used.other - if(src.hud_used.hotkeybuttons) - src.client.screen -= src.hud_used.hotkeybuttons - - //Due to some poor coding some things need special treatment: - //These ones are a part of 'adding', 'other' or 'hotkeybuttons' but we want them to stay - if(!full) - if(LAZYLEN(hud_used.hand_hud_objects)) - client.screen += hud_used.hand_hud_objects // we want the hands to be visible - if(LAZYLEN(hud_used.swaphand_hud_objects)) - client.screen += hud_used.swaphand_hud_objects // we want the hands swap thingy to be visible - src.client.screen += src.hud_used.action_intent // we want the intent swticher visible - src.hud_used.action_intent.screen_loc = ui_acti_alt // move this to the alternative position, where zone_select usually is. - else - src.client.screen -= src.healths - src.client.screen -= src.internals - src.client.screen -= src.gun_setting_icon - - //These ones are not a part of 'adding', 'other' or 'hotkeybuttons' but we want them gone. - src.client.screen -= src.zone_sel //zone_sel is a mob variable for some reason. - - else - hud_used.hud_shown = 1 - if(src.hud_used.adding) - src.client.screen += src.hud_used.adding - if(src.hud_used.other && src.hud_used.inventory_shown) - src.client.screen += src.hud_used.other - if(src.hud_used.hotkeybuttons && !src.hud_used.hotkey_ui_hidden) - src.client.screen += src.hud_used.hotkeybuttons - if(src.healths) - src.client.screen |= src.healths - if(src.internals) - src.client.screen |= src.internals - if(src.gun_setting_icon) - src.client.screen |= src.gun_setting_icon - - src.hud_used.action_intent.screen_loc = ui_acti //Restore intent selection to the original position - src.client.screen += src.zone_sel //This one is a special snowflake - - hud_used.hidden_inventory_update() - hud_used.persistant_inventory_update() - update_action_buttons() - -//Similar to minimize_hud() but keeps zone_sel, gun_setting_icon, and healths. -/mob/proc/toggle_zoom_hud() - if(!hud_used) - return - if(!ishuman(src)) - return - if(!client) - return - if(client.view != world.view) - return - - if(hud_used.hud_shown) - hud_used.hud_shown = 0 - if(src.hud_used.adding) - src.client.screen -= src.hud_used.adding - if(src.hud_used.other) - src.client.screen -= src.hud_used.other - if(src.hud_used.hotkeybuttons) - src.client.screen -= src.hud_used.hotkeybuttons - src.client.screen -= src.internals - src.client.screen += src.hud_used.action_intent //we want the intent swticher visible - else - hud_used.hud_shown = 1 - if(src.hud_used.adding) - src.client.screen += src.hud_used.adding - if(src.hud_used.other && src.hud_used.inventory_shown) - src.client.screen += src.hud_used.other - if(src.hud_used.hotkeybuttons && !src.hud_used.hotkey_ui_hidden) - src.client.screen += src.hud_used.hotkeybuttons - if(src.internals) - src.client.screen |= src.internals - src.hud_used.action_intent.screen_loc = ui_acti //Restore intent selection to the original position - - hud_used.hidden_inventory_update() - hud_used.persistant_inventory_update() - update_action_buttons() - -/client/proc/reset_click_catchers() - - var/xmin = -(round(last_view_x_dim*0.5)) - var/xmax = last_view_x_dim - abs(xmin) - var/ymin = -(round(last_view_y_dim*0.5)) - var/ymax = last_view_y_dim - abs(ymin) - - var/list/click_catchers = get_click_catchers() - for(var/obj/screen/click_catcher/catcher in click_catchers) - if(catcher.x_offset <= xmin || catcher.x_offset >= xmax || catcher.y_offset <= ymin || catcher.y_offset >= ymax) - screen -= catcher - else - screen |= catcher - -/mob/proc/add_click_catcher() - client.reset_click_catchers() - -/mob/new_player/add_click_catcher() - return - -/obj/screen/stamina - name = "stamina" - icon = 'icons/effects/progressbar.dmi' - icon_state = "prog_bar_100" - invisibility = INVISIBILITY_MAXIMUM - screen_loc = ui_stamina diff --git a/code/_onclick/hud/hud_elements/_hud_element.dm b/code/_onclick/hud/hud_elements/_hud_element.dm new file mode 100644 index 000000000000..4d091c589514 --- /dev/null +++ b/code/_onclick/hud/hud_elements/_hud_element.dm @@ -0,0 +1,49 @@ +/decl/hud_element + abstract_type = /decl/hud_element + var/screen_name + var/screen_icon + var/screen_icon_state + var/screen_loc + var/screen_object_type = /obj/screen + + var/hidable = FALSE + var/apply_hud_color = TRUE + var/apply_hud_alpha = TRUE + var/apply_hud_icon = TRUE + var/apply_color_on_cooldown = FALSE + + var/update_in_life = FALSE + + var/hud_element_category + +/decl/hud_element/proc/refresh_screen_object(var/datum/hud/hud, var/obj/screen/elem, var/datum/gas_mixture/environment) + return + +/decl/hud_element/proc/create_screen_object(var/datum/hud/hud) + var/obj/screen/elem = new screen_object_type + if(screen_name) + elem.SetName(screen_name) + if(apply_hud_color) + elem.color = hud.get_ui_color() + if(apply_hud_alpha) + elem.alpha = hud.get_ui_alpha() + if(apply_hud_icon) + elem.icon = hud.get_ui_style() + else if(screen_icon) + elem.icon = screen_icon + if(screen_icon_state) + elem.icon_state = screen_icon_state + if(screen_loc) + elem.screen_loc = screen_loc + register_screen_object(elem, hud) + return elem + +/decl/hud_element/proc/register_screen_object(var/obj/screen/elem, var/datum/hud/hud) + hud.misc_hud_elements |= elem + +/decl/hud_element/condition + screen_icon = 'icons/mob/screen/condition.dmi' + apply_hud_icon = FALSE + apply_hud_alpha = FALSE + apply_hud_color = FALSE + update_in_life = TRUE diff --git a/code/_onclick/hud/hud_elements/ability_master.dm b/code/_onclick/hud/hud_elements/ability_master.dm new file mode 100644 index 000000000000..3f09c1f9f78a --- /dev/null +++ b/code/_onclick/hud/hud_elements/ability_master.dm @@ -0,0 +1,8 @@ +/decl/hud_element/ability_master + apply_hud_icon = FALSE + apply_hud_alpha = FALSE + apply_hud_color = FALSE + hud_element_category = /decl/hud_element/ability_master + +/decl/hud_element/ability_master/create_screen_object(datum/hud/hud) + return new /obj/screen/ability_master(null, hud?.mymob) diff --git a/code/_onclick/hud/hud_elements/action_intent.dm b/code/_onclick/hud/hud_elements/action_intent.dm new file mode 100644 index 000000000000..595ee131b575 --- /dev/null +++ b/code/_onclick/hud/hud_elements/action_intent.dm @@ -0,0 +1,29 @@ +/decl/hud_element/action_intent + screen_object_type = /obj/screen/intent + screen_icon = 'icons/mob/screen/intent.dmi' + hud_element_category = /decl/hud_element/action_intent + +/obj/screen/intent + name = "intent" + icon = 'icons/mob/screen/white.dmi' + icon_state = "intent_help" + screen_loc = ui_acti + var/intent = I_HELP + +/obj/screen/intent/Click(var/location, var/control, var/params) + var/list/P = params2list(params) + var/icon_x = text2num(P["icon-x"]) + var/icon_y = text2num(P["icon-y"]) + intent = I_DISARM + if(icon_x <= world.icon_size/2) + if(icon_y <= world.icon_size/2) + intent = I_HURT + else + intent = I_HELP + else if(icon_y <= world.icon_size/2) + intent = I_GRAB + update_icon() + usr.a_intent = intent + +/obj/screen/intent/on_update_icon() + icon_state = "intent_[intent]" diff --git a/code/_onclick/hud/hud_elements/bodytemp.dm b/code/_onclick/hud/hud_elements/bodytemp.dm new file mode 100644 index 000000000000..566309a89839 --- /dev/null +++ b/code/_onclick/hud/hud_elements/bodytemp.dm @@ -0,0 +1,37 @@ +/decl/hud_element/condition/bodytemp + screen_name = "body temperature" + screen_object_type = /obj/screen/bodytemp + hud_element_category = /decl/hud_element/condition/bodytemp + screen_icon_state = "temp1" + screen_loc = ui_temp + +/decl/hud_element/condition/bodytemp/refresh_screen_object(var/datum/hud/hud, var/obj/screen/elem, var/datum/gas_mixture/environment) + //TODO: precalculate all of this stuff when the species datum is created + var/bodytemp = hud.mymob.bodytemperature + var/base_temperature = hud.mymob.get_ideal_bodytemp() + if (bodytemp >= base_temperature) + var/heat_level_1 = hud.mymob.getSpeciesOrSynthTemp(HEAT_LEVEL_1) + var/temp_step = (heat_level_1 - base_temperature)/4 + if (bodytemp >= heat_level_1) + elem.icon_state = "temp4" + else if (bodytemp >= base_temperature + temp_step*3) + elem.icon_state = "temp3" + else if (bodytemp >= base_temperature + temp_step*2) + elem.icon_state = "temp2" + else if (bodytemp >= base_temperature + temp_step*1) + elem.icon_state = "temp1" + else + elem.icon_state = "temp0" + else if (bodytemp < base_temperature) + var/cold_level_1 = hud.mymob.getSpeciesOrSynthTemp(COLD_LEVEL_1) + var/temp_step = (base_temperature - cold_level_1)/4 + if (bodytemp <= cold_level_1) + elem.icon_state = "temp-4" + else if (bodytemp <= base_temperature - temp_step*3) + elem.icon_state = "temp-3" + else if (bodytemp <= base_temperature - temp_step*2) + elem.icon_state = "temp-2" + else if (bodytemp <= base_temperature - temp_step*1) + elem.icon_state = "temp-1" + else + elem.icon_state = "temp0" diff --git a/code/_onclick/hud/hud_elements/cells.dm b/code/_onclick/hud/hud_elements/cells.dm new file mode 100644 index 000000000000..34aacb6d77e1 --- /dev/null +++ b/code/_onclick/hud/hud_elements/cells.dm @@ -0,0 +1,21 @@ +/decl/hud_element/cells + screen_name = "cell" + screen_icon_state = "charge-empty" + screen_icon = 'icons/mob/screen/robot_charge.dmi' + screen_loc = ui_nutrition + update_in_life = TRUE + +/decl/hud_element/cells/refresh_screen_object(datum/hud/hud, obj/screen/elem, datum/gas_mixture/environment) + if(!isliving(hud?.mymob)) + return + var/mob/living/user = hud.mymob + if(!user.isSynthetic()) + elem.invisibility = INVISIBILITY_MAXIMUM + else + elem.invisibility = 0 + var/obj/item/cell/cell = user.get_cell() + if(cell) + // 0-100 maps to 0-4, but give it a paranoid clamp just in case. + elem.icon_state = "charge[clamp(CEILING(cell.percent()/25), 0, 4)]" + else + elem.icon_state = "charge-empty" diff --git a/code/_onclick/hud/hud_elements/drop.dm b/code/_onclick/hud/hud_elements/drop.dm new file mode 100644 index 000000000000..d957a227b965 --- /dev/null +++ b/code/_onclick/hud/hud_elements/drop.dm @@ -0,0 +1,7 @@ +/decl/hud_element/drop + screen_name = "drop" + screen_icon_state = "act_drop" + screen_loc = ui_drop_throw + +/decl/hud_element/drop/register_screen_object(obj/screen/elem, datum/hud/hud) + hud.hotkey_hud_elements |= elem diff --git a/code/_onclick/hud/hud_elements/fire.dm b/code/_onclick/hud/hud_elements/fire.dm new file mode 100644 index 000000000000..706ee23b4654 --- /dev/null +++ b/code/_onclick/hud/hud_elements/fire.dm @@ -0,0 +1,8 @@ +/decl/hud_element/condition/fire + screen_name = "fire" + screen_icon_state = "fire0" + screen_loc = ui_fire + hud_element_category = /decl/hud_element/condition/fire + +/decl/hud_element/condition/fire/refresh_screen_object(var/datum/hud/hud, var/obj/screen/elem, var/datum/gas_mixture/environment) + screen_icon_state = "fire[hud?.alerts ? (hud.alerts[hud_element_category] || 0) : 0]" diff --git a/code/_onclick/hud/hud_elements/gun_mode.dm b/code/_onclick/hud/hud_elements/gun_mode.dm new file mode 100644 index 000000000000..76f2d224d692 --- /dev/null +++ b/code/_onclick/hud/hud_elements/gun_mode.dm @@ -0,0 +1,95 @@ +// Omit the base gun_mode because it doesn't care about specific gun use flags +var/global/list/gun_hud_flag_decl_types = list( + /decl/hud_element/gun_flag_move, + /decl/hud_element/gun_flag_item, + /decl/hud_element/gun_flag_radio +) + +/// Root type for flag toggling in gun mode. +/obj/screen/gun_flag + name = "gun" + master = null + dir = SOUTH + + var/option_name + var/option_state + var/option_flag + +/obj/screen/gun_flag/proc/update_from_aiming_overlay(var/obj/aiming_overlay/aiming_overlay) + if(!aiming_overlay || !option_flag || !option_name || !option_state) + return + if(aiming_overlay.target_permissions & option_flag) + icon_state = "[option_state]1" + SetName("Disallow [option_name]]") + else + icon_state = "[option_state]0" + SetName("Allow [option_name]") + +/obj/screen/gun_flag/Click(location, control, params) + if(isliving(usr) && option_flag && option_name && option_state) + var/mob/living/user = usr + if(!user.aiming) + user.aiming = new(user) + user.aiming.toggle_permission(option_flag) + return TRUE + return FALSE + +/// Root gun mode type - toggles aiming mode off or on when ticked. +/obj/screen/gun_mode + name = "Toggle Gun Mode" + icon_state = "gun0" + screen_loc = ui_gun_select + master = null + dir = SOUTH + +/decl/hud_element/gun_mode + screen_object_type = /obj/screen/gun_mode + hud_element_category = /decl/hud_element/gun_mode + +/// Element for dis/allowing gun mode target clicking. +/obj/screen/gun_flag/item + name = "Allow Item Use" + icon_state = "no_item1" + screen_loc = ui_gun1 + option_name = "Item Use" + option_state = "no_item" + option_flag = TARGET_CAN_CLICK + +/decl/hud_element/gun_flag_item + screen_object_type = /obj/screen/gun_flag/item + hud_element_category = /decl/hud_element/gun_flag_item + +/decl/hud_element/gun_flag_item/register_screen_object(obj/screen/elem, datum/hud/hud) + return + +/// Element for dis/allowing gun mode target movement. +/obj/screen/gun_flag/move + name = "Allow Movement" + icon_state = "no_walk1" + screen_loc = ui_gun2 + option_name = "Movement" + option_state = "no_walk" + option_flag = TARGET_CAN_MOVE + +/decl/hud_element/gun_flag_move + screen_object_type = /obj/screen/gun_flag/move + hud_element_category = /decl/hud_element/gun_flag_move + +/decl/hud_element/gun_flag_move/register_screen_object(obj/screen/elem, datum/hud/hud) + return + +/// Element for dis/allowing gun mode target radio use. +/decl/hud_element/gun_flag_radio + screen_object_type = /obj/screen/gun_flag/radio + hud_element_category = /decl/hud_element/gun_flag_radio + +/decl/hud_element/gun_flag_radio/register_screen_object(obj/screen/elem, datum/hud/hud) + return + +/obj/screen/gun_flag/radio + name = "Disallow Radio Use" + icon_state = "no_radio1" + screen_loc = ui_gun4 + option_name = "Radio Use" + option_state = "no_radio" + option_flag = TARGET_CAN_RADIO diff --git a/code/_onclick/hud/hud_elements/health.dm b/code/_onclick/hud/hud_elements/health.dm new file mode 100644 index 000000000000..007f5ffbe11f --- /dev/null +++ b/code/_onclick/hud/hud_elements/health.dm @@ -0,0 +1,81 @@ +/decl/hud_element/health + screen_name = "health" + screen_icon = 'icons/mob/screen/health_human.dmi' + screen_icon_state = "health0" + apply_hud_icon = FALSE + apply_hud_alpha = FALSE + apply_hud_color = FALSE + var/health_states = 6 + var/death_state = 7 + var/numb_state = "_numb" + +/decl/hud_element/health/refresh_screen_object(datum/hud/hud, obj/screen/elem, datum/gas_mixture/environment) + if(!isliving(hud?.mymob)) + return + var/mob/living/user = hud.mymob + reset_health_overlays(user, elem) + if(user.stat == DEAD) + elem.icon_state = "health[death_state]" + else if(user.has_chemical_effect(CE_PAINKILLER, 100)) + elem.icon_state = "health[numb_state]" + else + update_health_overlays(user, elem) + +/decl/hud_element/health/proc/reset_health_overlays(mob/living/user, obj/screen/elem) + return + +/decl/hud_element/health/proc/update_health_overlays(mob/living/user, obj/screen/elem) + elem.icon_state = "health[health_states - round((user.health / user.get_max_health()) * health_states)]" + +/decl/hud_element/health/human + screen_icon_state = "blank" + var/health_icon = 'icons/mob/screen/health_human.dmi' + var/burning_image + var/softcrit_image + var/hardcrit_image + var/fullhealth_image + +/decl/hud_element/health/human/Initialize() + . = ..() + burning_image = image(health_icon, "burning") + softcrit_image = image(health_icon, "softcrit") + hardcrit_image = image(health_icon, "hardcrit") + fullhealth_image = image(health_icon, "fullhealth") + +/decl/hud_element/health/human/reset_health_overlays(mob/living/user, obj/screen/elem) + elem.cut_overlays() + elem.icon_state = "blank" + +/decl/hud_element/health/human/update_health_overlays(mob/living/user, obj/screen/elem) + + // Generate a by-limb health display. + // Pain modifies the effective pain level used to colour the limb. + var/no_damage = 1 + var/trauma_val = 0 // Used in calculating softcrit/hardcrit indicators. + if(user.can_feel_pain() && ishuman(user)) + var/mob/living/carbon/human/human = user + trauma_val = max(human.shock_stage, human.get_shock()) / (user.get_max_health()-100) // TODO: where is this 100 coming from? + + for(var/obj/item/organ/external/E in user.get_external_organs()) + if(no_damage && (E.brute_dam || E.burn_dam)) + no_damage = 0 + var/organ_image = E.get_damage_hud_image() + if(organ_image) + elem.add_overlay(organ_image) + + // Apply a fire overlay if we're burning. + if(user.on_fire) + elem.add_overlay(burning_image) + + // Show a general pain/crit indicator if needed. + if(user.is_asystole()) + elem.add_overlay(hardcrit_image) + else if(trauma_val) + if(user.can_feel_pain()) + if(trauma_val > 0.7) + elem.add_overlay(softcrit_image) + if(trauma_val >= 1) + elem.add_overlay(hardcrit_image) + else if(no_damage) + elem.add_overlay(fullhealth_image) + elem.compile_overlays() diff --git a/code/_onclick/hud/hud_elements/hydration.dm b/code/_onclick/hud/hud_elements/hydration.dm new file mode 100644 index 000000000000..cd6569f94cdc --- /dev/null +++ b/code/_onclick/hud/hud_elements/hydration.dm @@ -0,0 +1,21 @@ +/decl/hud_element/condition/hydration + screen_name = "hydration" + screen_object_type = /obj/screen/drink + screen_icon_state = "hydration1" + screen_loc = ui_nutrition_small + hud_element_category = /decl/hud_element/condition/hydration + var/hud_states = 4 + +/decl/hud_element/condition/hydration/refresh_screen_object(datum/hud/hud, obj/screen/elem, datum/gas_mixture/environment) + if(!isliving(hud?.mymob)) + return + var/mob/living/user = hud.mymob + var/max_hyd = user.get_max_hydration() + var/hyd = user.get_hydration() + var/hyd_offset = max_hyd * 0.2 + if(hyd >= max_hyd - hyd_offset) + elem.icon_state = "hydration[hud_states]" + else if(hyd <= hyd_offset * 2) + elem.icon_state = "hydration" + else + elem.icon_state = "hydration[round(((hyd-(hyd_offset*2))/(max_hyd-hyd_offset))*(hud_states-2))+1]" diff --git a/code/_onclick/hud/hud_elements/internals.dm b/code/_onclick/hud/hud_elements/internals.dm new file mode 100644 index 000000000000..16eb2360536e --- /dev/null +++ b/code/_onclick/hud/hud_elements/internals.dm @@ -0,0 +1,8 @@ +/decl/hud_element/internals + screen_name = "internal" + screen_icon = 'icons/mob/screen/internals.dmi' + screen_icon_state = "internal0" + screen_loc = ui_internal + apply_hud_icon = FALSE + apply_hud_alpha = FALSE + apply_hud_color = FALSE diff --git a/code/_onclick/hud/hud_elements/move_intent.dm b/code/_onclick/hud/hud_elements/move_intent.dm new file mode 100644 index 000000000000..df79aeb7a99f --- /dev/null +++ b/code/_onclick/hud/hud_elements/move_intent.dm @@ -0,0 +1,9 @@ +/decl/hud_element/move_intent + screen_name = "movement method" + screen_object_type = /obj/screen/movement + screen_loc = ui_movi + hud_element_category = /decl/hud_element/move_intent + +/decl/hud_element/move_intent/create_screen_object(var/datum/hud/hud) + var/obj/screen/elem = ..() + elem.icon_state = hud.mymob.move_intent.hud_icon_state diff --git a/code/_onclick/hud/hud_elements/nutrition.dm b/code/_onclick/hud/hud_elements/nutrition.dm new file mode 100644 index 000000000000..46cfc164820e --- /dev/null +++ b/code/_onclick/hud/hud_elements/nutrition.dm @@ -0,0 +1,26 @@ +/decl/hud_element/condition/nutrition + screen_name = "nutrition" + screen_object_type = /obj/screen/food + screen_icon_state = "nutrition1" + screen_loc = ui_nutrition_small + hud_element_category = /decl/hud_element/condition/nutrition + var/hud_states = 4 + +/decl/hud_element/condition/nutrition/create_screen_object(datum/hud/hud) + var/obj/screen/elem = ..() + elem.pixel_w = 8 + return elem + +/decl/hud_element/condition/nutrition/refresh_screen_object(datum/hud/hud, obj/screen/elem, datum/gas_mixture/environment) + if(!isliving(hud?.mymob)) + return + var/mob/living/user = hud.mymob + var/max_nut = user.get_max_nutrition() + var/nut = user.get_nutrition() + var/nut_offset = max_nut * 0.2 + if(nut >= max_nut - nut_offset) + elem.icon_state = "nutrition[hud_states]" + else if(nut <= nut_offset * 2) + elem.icon_state = "nutrition0" + else + elem.icon_state = "nutrition[round(((nut-(nut_offset*2))/(max_nut-nut_offset))*(hud_states-2))+1]" diff --git a/code/_onclick/hud/hud_elements/oxygen.dm b/code/_onclick/hud/hud_elements/oxygen.dm new file mode 100644 index 000000000000..26603a2aabf4 --- /dev/null +++ b/code/_onclick/hud/hud_elements/oxygen.dm @@ -0,0 +1,9 @@ +/decl/hud_element/condition/oxygen + screen_name = "oxygen" + screen_object_type = /obj/screen/oxygen + screen_loc = ui_temp + screen_icon_state = "oxy0" + hud_element_category = /decl/hud_element/condition/oxygen + +/decl/hud_element/condition/oxygen/refresh_screen_object(datum/hud/hud, obj/screen/elem, datum/gas_mixture/environment) + elem.icon_state = "oxy[hud?.alerts ? (LAZYACCESS(hud.alerts, hud_element_category) || 0) : 0]" diff --git a/code/_onclick/hud/hud_elements/pain.dm b/code/_onclick/hud/hud_elements/pain.dm new file mode 100644 index 000000000000..917fe3c8665b --- /dev/null +++ b/code/_onclick/hud/hud_elements/pain.dm @@ -0,0 +1,2 @@ +/decl/hud_element/pain + screen_object_type = /obj/screen/fullscreen/pain diff --git a/code/_onclick/hud/hud_elements/pressure.dm b/code/_onclick/hud/hud_elements/pressure.dm new file mode 100644 index 000000000000..0c6250cd567d --- /dev/null +++ b/code/_onclick/hud/hud_elements/pressure.dm @@ -0,0 +1,9 @@ +/decl/hud_element/condition/pressure + screen_name = "pressure" + screen_object_type = /obj/screen/pressure + screen_icon_state = "pressure0" + screen_loc = ui_temp + hud_element_category = /decl/hud_element/condition/pressure + +/decl/hud_element/condition/pressure/refresh_screen_object(datum/hud/hud, obj/screen/elem, datum/gas_mixture/environment) + elem.icon_state = "pressure[hud?.alerts ? (LAZYACCESS(hud.alerts, hud_element_category) || 0) : 0]" diff --git a/code/_onclick/hud/hud_elements/resist.dm b/code/_onclick/hud/hud_elements/resist.dm new file mode 100644 index 000000000000..35c2e12cc1ac --- /dev/null +++ b/code/_onclick/hud/hud_elements/resist.dm @@ -0,0 +1,7 @@ +/decl/hud_element/resist + screen_name = "resist" + screen_icon_state = "act_resist" + screen_loc = ui_pull_resist + +/decl/hud_element/resist/register_screen_object(obj/screen/elem, datum/hud/hud) + hud.hotkey_hud_elements |= elem diff --git a/code/_onclick/hud/hud_elements/stamina.dm b/code/_onclick/hud/hud_elements/stamina.dm new file mode 100644 index 000000000000..e2fd7b442aca --- /dev/null +++ b/code/_onclick/hud/hud_elements/stamina.dm @@ -0,0 +1,12 @@ +/decl/hud_element/stamina_bar + screen_object_type = /obj/screen/stamina + apply_hud_alpha = FALSE + apply_hud_color = FALSE + apply_hud_icon = FALSE + +/obj/screen/stamina + name = "stamina" + icon = 'icons/effects/progressbar.dmi' + icon_state = "prog_bar_100" + invisibility = INVISIBILITY_MAXIMUM + screen_loc = ui_stamina \ No newline at end of file diff --git a/code/_onclick/hud/hud_elements/throwing.dm b/code/_onclick/hud/hud_elements/throwing.dm new file mode 100644 index 000000000000..158dda5b0fed --- /dev/null +++ b/code/_onclick/hud/hud_elements/throwing.dm @@ -0,0 +1,7 @@ +/decl/hud_element/throwing + screen_name = "throw" + screen_icon_state = "act_throw_off" + screen_loc = ui_drop_throw + +/decl/hud_element/throwing/register_screen_object(obj/screen/elem, datum/hud/hud) + hud.hotkey_hud_elements |= elem diff --git a/code/_onclick/hud/hud_elements/toxins.dm b/code/_onclick/hud/hud_elements/toxins.dm new file mode 100644 index 000000000000..5f42892c4b34 --- /dev/null +++ b/code/_onclick/hud/hud_elements/toxins.dm @@ -0,0 +1,9 @@ +/decl/hud_element/condition/toxins + screen_name = "toxin" + screen_object_type = /obj/screen/toxins + screen_icon_state = "tox0" + screen_loc = ui_temp + hud_element_category = /decl/hud_element/condition/toxins + +/decl/hud_element/condition/toxins/refresh_screen_object(datum/hud/hud, obj/screen/elem, datum/gas_mixture/environment) + elem.icon_state = "tox[hud?.alerts ? (LAZYACCESS(hud.alerts, hud_element_category) || 0) : 0]" diff --git a/code/_onclick/hud/hud_elements/up_hint.dm b/code/_onclick/hud/hud_elements/up_hint.dm new file mode 100644 index 000000000000..e845411cb1ac --- /dev/null +++ b/code/_onclick/hud/hud_elements/up_hint.dm @@ -0,0 +1,5 @@ +/decl/hud_element/up_hint + screen_name = "up hint" + screen_icon_state = "uphint0" + screen_loc = ui_up_hint + diff --git a/code/_onclick/hud/hud_elements/zone_selector.dm b/code/_onclick/hud/hud_elements/zone_selector.dm new file mode 100644 index 000000000000..4776e0b8355e --- /dev/null +++ b/code/_onclick/hud/hud_elements/zone_selector.dm @@ -0,0 +1,3 @@ +/decl/hud_element/zone_selector + screen_object_type = /obj/screen/zone_selector + hud_element_category = /decl/hud_element/zone_selector diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index a40889dc4d61..54f91ae1012d 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -1,219 +1,51 @@ /mob/living/carbon/human - hud_type = /datum/hud/human - -/datum/hud/human/FinalizeInstantiation() - - var/ui_style = get_ui_style() - var/ui_color = get_ui_color() - var/ui_alpha = get_ui_alpha() - - var/mob/living/carbon/human/target = mymob - var/datum/hud_data/hud_data = istype(target) ? target.species.hud : new() - if(hud_data.icon) - ui_style = hud_data.icon - - adding = list() - other = list() - src.hotkeybuttons = list() //These can be disabled for hotkey usersx - - var/list/hud_elements = list() - var/obj/screen/using - - stamina_bar = new - adding += stamina_bar - - BuildInventoryUI() - - // Draw the attack intent dialogue. - if(hud_data.has_a_intent) - using = new /obj/screen/intent() - src.adding += using - action_intent = using - hud_elements |= using - - if(hud_data.has_m_intent) - using = new /obj/screen/movement() - using.SetName("movement method") - using.icon = ui_style - using.icon_state = mymob.move_intent.hud_icon_state - using.screen_loc = ui_movi - using.color = ui_color - using.alpha = ui_alpha - src.adding += using - move_intent = using - - if(hud_data.has_drop) - using = new /obj/screen() - using.SetName("drop") - using.icon = ui_style - using.icon_state = "act_drop" - using.screen_loc = ui_drop_throw - using.color = ui_color - using.alpha = ui_alpha - src.hotkeybuttons += using - - if(hud_data.has_hands) - BuildHandsUI() - - if(hud_data.has_resist) - using = new /obj/screen() - using.SetName("resist") - using.icon = ui_style - using.icon_state = "act_resist" - using.screen_loc = ui_pull_resist - using.color = ui_color - using.alpha = ui_alpha - src.hotkeybuttons += using - - if(hud_data.has_throw) - mymob.throw_icon = new /obj/screen() - mymob.throw_icon.icon = ui_style - mymob.throw_icon.icon_state = "act_throw_off" - mymob.throw_icon.SetName("throw") - mymob.throw_icon.screen_loc = ui_drop_throw - mymob.throw_icon.color = ui_color - mymob.throw_icon.alpha = ui_alpha - src.hotkeybuttons += mymob.throw_icon - hud_elements |= mymob.throw_icon - - if(hud_data.has_internals) - mymob.internals = new /obj/screen() - mymob.internals.icon = ui_style - mymob.internals.icon_state = "internal0" - mymob.internals.SetName("internal") - mymob.internals.screen_loc = ui_internal - hud_elements |= mymob.internals - - if(hud_data.has_warnings) - mymob.healths = new /obj/screen() - mymob.healths.icon = ui_style - mymob.healths.icon_state = "health0" - mymob.healths.SetName("health") - mymob.healths.screen_loc = ui_health - hud_elements |= mymob.healths - - mymob.oxygen = new /obj/screen/oxygen() - mymob.oxygen.icon = 'icons/mob/status_indicators.dmi' - mymob.oxygen.icon_state = "oxy0" - mymob.oxygen.SetName("oxygen") - mymob.oxygen.screen_loc = ui_temp - hud_elements |= mymob.oxygen - - mymob.toxin = new /obj/screen/toxins() - mymob.toxin.icon = 'icons/mob/status_indicators.dmi' - mymob.toxin.icon_state = "tox0" - mymob.toxin.SetName("toxin") - mymob.toxin.screen_loc = ui_temp - hud_elements |= mymob.toxin - - mymob.fire = new /obj/screen() - mymob.fire.icon = ui_style - mymob.fire.icon_state = "fire0" - mymob.fire.SetName("fire") - mymob.fire.screen_loc = ui_fire - hud_elements |= mymob.fire - - if(hud_data.has_pressure) - mymob.pressure = new /obj/screen/pressure() - mymob.pressure.icon = 'icons/mob/status_indicators.dmi' - mymob.pressure.icon_state = "pressure0" - mymob.pressure.SetName("pressure") - mymob.pressure.screen_loc = ui_temp - hud_elements |= mymob.pressure - - if(hud_data.has_bodytemp) - mymob.bodytemp = new /obj/screen/bodytemp() - mymob.bodytemp.icon = 'icons/mob/status_indicators.dmi' - mymob.bodytemp.icon_state = "temp1" - mymob.bodytemp.SetName("body temperature") - mymob.bodytemp.screen_loc = ui_temp - hud_elements |= mymob.bodytemp - - if(target.isSynthetic()) - target.cells = new /obj/screen() - target.cells.icon = 'icons/mob/screen1_robot.dmi' - target.cells.icon_state = "charge-empty" - target.cells.SetName("cell") - target.cells.screen_loc = ui_nutrition - hud_elements |= target.cells - - else if(hud_data.has_nutrition) - mymob.nutrition_icon = new /obj/screen/food() - mymob.nutrition_icon.icon = 'icons/mob/status_hunger.dmi' - mymob.nutrition_icon.pixel_w = 8 - mymob.nutrition_icon.icon_state = "nutrition1" - mymob.nutrition_icon.SetName("nutrition") - mymob.nutrition_icon.screen_loc = ui_nutrition_small - hud_elements |= mymob.nutrition_icon - - mymob.hydration_icon = new /obj/screen/drink() - mymob.hydration_icon.icon = 'icons/mob/status_hunger.dmi' - mymob.hydration_icon.icon_state = "hydration1" - mymob.hydration_icon.SetName("hydration") - mymob.hydration_icon.screen_loc = ui_nutrition_small - hud_elements |= mymob.hydration_icon - - if(hud_data.has_up_hint) - mymob.up_hint = new /obj/screen() - mymob.up_hint.icon = ui_style - mymob.up_hint.icon_state = "uphint0" - mymob.up_hint.SetName("up hint") - mymob.up_hint.screen_loc = ui_up_hint - hud_elements |= mymob.up_hint - - mymob.pain = new /obj/screen/fullscreen/pain( null ) - hud_elements |= mymob.pain - - mymob.zone_sel = new - mymob.zone_sel.icon = ui_style - mymob.zone_sel.color = ui_color - mymob.zone_sel.alpha = ui_alpha - mymob.zone_sel.update_icon() - hud_elements |= mymob.zone_sel - - target.attack_selector = new - target.attack_selector.set_owner(target) - target.attack_selector.icon = ui_style - target.attack_selector.color = ui_color - target.attack_selector.alpha = ui_alpha - target.attack_selector.update_icon() - hud_elements |= target.attack_selector - - //Handle the gun settings buttons - mymob.gun_setting_icon = new /obj/screen/gun/mode(null) - mymob.gun_setting_icon.icon = ui_style - mymob.gun_setting_icon.color = ui_color - mymob.gun_setting_icon.alpha = ui_alpha - hud_elements |= mymob.gun_setting_icon - - mymob.item_use_icon = new /obj/screen/gun/item(null) - mymob.item_use_icon.icon = ui_style - mymob.item_use_icon.color = ui_color - mymob.item_use_icon.alpha = ui_alpha - - mymob.gun_move_icon = new /obj/screen/gun/move(null) - mymob.gun_move_icon.icon = ui_style - mymob.gun_move_icon.color = ui_color - mymob.gun_move_icon.alpha = ui_alpha - - mymob.radio_use_icon = new /obj/screen/gun/radio(null) - mymob.radio_use_icon.icon = ui_style - mymob.radio_use_icon.color = ui_color - mymob.radio_use_icon.alpha = ui_alpha - - mymob.client.screen = list() - if(length(hand_hud_objects)) - mymob.client.screen += hand_hud_objects - if(length(swaphand_hud_objects)) - mymob.client.screen += swaphand_hud_objects - if(length(hud_elements)) - mymob.client.screen += hud_elements - mymob.client.screen += src.adding + src.hotkeybuttons - - hide_inventory() - - hidden_inventory_update() - persistant_inventory_update() + hud_used = /datum/hud/human + +/decl/hud_element/attack_selector + screen_object_type = /obj/screen/default_attack_selector + hud_element_category = /decl/hud_element/attack_selector + +/decl/hud_element/attack_selector/register_screen_object(var/obj/screen/elem, var/datum/hud/hud) + var/obj/screen/default_attack_selector/attack_selector = elem + if(istype(attack_selector) && ishuman(hud.mymob)) + attack_selector.set_owner(hud.mymob) + attack_selector.update_icon() + return ..() + +/datum/hud/human + health_hud_type = /decl/hud_element/health/human + hud_elements = list( + /decl/hud_element/health/human, + /decl/hud_element/condition/bodytemp, + /decl/hud_element/attack_selector, + /decl/hud_element/zone_selector, + /decl/hud_element/move_intent, + /decl/hud_element/action_intent, + /decl/hud_element/condition/pressure, + /decl/hud_element/condition/fire, + /decl/hud_element/condition/toxins, + /decl/hud_element/condition/oxygen, + /decl/hud_element/condition/nutrition, + /decl/hud_element/condition/hydration, + /decl/hud_element/stamina_bar, + /decl/hud_element/drop, + /decl/hud_element/resist, + /decl/hud_element/throwing, + /decl/hud_element/up_hint, + /decl/hud_element/pain, + /decl/hud_element/internals, + /decl/hud_element/gun_mode, + /decl/hud_element/gun_flag_item, + /decl/hud_element/gun_flag_move, + /decl/hud_element/gun_flag_radio + ) + +/datum/hud/human/get_ui_style() + var/decl/species/my_species = mymob?.get_species() + var/datum/hud_data/hud_data = my_species?.hud || new + if(hud_data?.icon) + return hud_data.icon + return ..() /mob/living/carbon/human/verb/toggle_hotkey_verbs() set category = "OOC" @@ -221,17 +53,16 @@ set desc = "This disables or enables the user interface buttons which can be used with hotkeys." if(hud_used.hotkey_ui_hidden) - client.screen += hud_used.hotkeybuttons + client.screen |= hud_used.hotkey_hud_elements hud_used.hotkey_ui_hidden = 0 else - client.screen -= hud_used.hotkeybuttons + client.screen -= hud_used.hotkey_hud_elements hud_used.hotkey_ui_hidden = 1 // Yes, these use icon state. Yes, these are terrible. The alternative is duplicating // a bunch of fairly blobby logic for every click override on these objects. - /obj/screen/food/Click(var/location, var/control, var/params) - if(istype(usr) && usr.nutrition_icon == src) + if(usr.get_hud_element(/decl/hud_element/condition/nutrition) == src) switch(icon_state) if("nutrition0") to_chat(usr, SPAN_WARNING("You are completely stuffed.")) @@ -245,7 +76,7 @@ to_chat(usr, SPAN_DANGER("You are starving!")) /obj/screen/drink/Click(var/location, var/control, var/params) - if(istype(usr) && usr.hydration_icon == src) + if(usr.get_hud_element(/decl/hud_element/condition/hydration) == src) switch(icon_state) if("hydration0") to_chat(usr, SPAN_WARNING("You are overhydrated.")) @@ -259,7 +90,7 @@ to_chat(usr, SPAN_DANGER("You are dying of thirst!")) /obj/screen/bodytemp/Click(var/location, var/control, var/params) - if(istype(usr) && usr.bodytemp == src) + if(usr.get_hud_element(/decl/hud_element/condition/bodytemp) == src) switch(icon_state) if("temp4") to_chat(usr, SPAN_DANGER("You are being cooked alive!")) @@ -281,7 +112,7 @@ to_chat(usr, SPAN_NOTICE("Your body is at a comfortable temperature.")) /obj/screen/pressure/Click(var/location, var/control, var/params) - if(istype(usr) && usr.pressure == src) + if(usr.get_hud_element(/decl/hud_element/condition/pressure) == src) switch(icon_state) if("pressure2") to_chat(usr, SPAN_DANGER("The air pressure here is crushing!")) @@ -295,14 +126,14 @@ to_chat(usr, SPAN_NOTICE("The local air pressure is comfortable.")) /obj/screen/toxins/Click(var/location, var/control, var/params) - if(istype(usr) && usr.toxin == src) + if(usr.get_hud_element(/decl/hud_element/condition/toxins) == src) if(icon_state == "tox0") to_chat(usr, SPAN_NOTICE("The air is clear of toxins.")) else to_chat(usr, SPAN_DANGER("The air is eating away at your skin!")) /obj/screen/oxygen/Click(var/location, var/control, var/params) - if(istype(usr) && usr.oxygen == src) + if(usr.get_hud_element(/decl/hud_element/condition/oxygen) == src) if(icon_state == "oxy0") to_chat(usr, SPAN_NOTICE("You are breathing easy.")) else diff --git a/code/_onclick/hud/other_mobs.dm b/code/_onclick/hud/other_mobs.dm deleted file mode 100644 index 5b6b03616b45..000000000000 --- a/code/_onclick/hud/other_mobs.dm +++ /dev/null @@ -1,34 +0,0 @@ -/mob/living/simple_animal/construct - hud_type = /datum/hud/construct - -/datum/hud/construct/FinalizeInstantiation() - var/constructtype - - if(istype(mymob,/mob/living/simple_animal/construct/armoured) || istype(mymob,/mob/living/simple_animal/construct/behemoth)) - constructtype = "juggernaut" - else if(istype(mymob,/mob/living/simple_animal/construct/builder)) - constructtype = "artificer" - else if(istype(mymob,/mob/living/simple_animal/construct/wraith)) - constructtype = "wraith" - else if(istype(mymob,/mob/living/simple_animal/construct/harvester)) - constructtype = "harvester" - - if(constructtype) - mymob.fire = new /obj/screen() - mymob.fire.icon = 'icons/mob/screen1_construct.dmi' - mymob.fire.icon_state = "fire0" - mymob.fire.SetName("fire") - mymob.fire.screen_loc = ui_construct_fire - - mymob.healths = new /obj/screen() - mymob.healths.icon = 'icons/mob/screen1_construct.dmi' - mymob.healths.icon_state = "[constructtype]_health0" - mymob.healths.SetName("health") - mymob.healths.screen_loc = ui_construct_health - - mymob.zone_sel = new - mymob.zone_sel.icon = 'icons/mob/screen1_construct.dmi' - mymob.zone_sel.update_icon() - - mymob.client.screen = list() - mymob.client.screen += list(mymob.fire, mymob.healths, mymob.zone_sel) diff --git a/code/_onclick/hud/pai.dm b/code/_onclick/hud/pai.dm index 8f305d4153c6..67058ed29c3d 100644 --- a/code/_onclick/hud/pai.dm +++ b/code/_onclick/hud/pai.dm @@ -1,30 +1,21 @@ /datum/hud/pai/FinalizeInstantiation() - adding = list() var/obj/screen/using - using = new /obj/screen/pai/software() using.SetName("Software Interface") - adding += using - + misc_hud_elements += using using = new /obj/screen/pai/subsystems() using.SetName("Subsystems") - adding += using - + misc_hud_elements += using using = new /obj/screen/pai/shell() using.SetName("Toggle Chassis") - adding += using - + misc_hud_elements += using using = new /obj/screen/pai/rest() using.SetName("Rest") - adding += using - + misc_hud_elements += using using = new /obj/screen/pai/light() using.SetName("Toggle Light") - adding += using - - mymob.client.screen = list() - mymob.client.screen += adding - hide_inventory() + misc_hud_elements += using + return ..() /obj/screen/pai icon = 'icons/mob/screen/pai.dmi' diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm index fe5be57d9564..addcf86cca6d 100644 --- a/code/_onclick/hud/robot.dm +++ b/code/_onclick/hud/robot.dm @@ -1,183 +1,153 @@ -var/global/obj/screen/robot_inventory - -/obj/screen/robot_drop_grab - name = "drop grab" - icon = 'icons/mob/screen1_robot.dmi' - icon_state = "drop_grab" +/mob/living/silicon/robot + var/obj/screen/hands + hud_used = /datum/hud/robot + +/decl/hud_element/condition/fire/robot + screen_icon = 'icons/mob/screen/robot_conditions.dmi' + +/decl/hud_element/condition/oxygen/robot + screen_icon = 'icons/mob/screen/robot_conditions.dmi' + +/decl/hud_element/condition/bodytemp/robot + screen_icon = 'icons/mob/screen/robot_conditions.dmi' + +/decl/hud_element/module + screen_name = "module" + screen_icon = 'icons/mob/screen/robot_modules.dmi' + screen_icon_state = "nomod" + screen_loc = ui_borg_module + +/decl/hud_element/radio + screen_name = "radio" + screen_icon_state = "radio" + screen_loc = ui_movi + +/decl/hud_element/radio/create_screen_object(datum/hud/hud) + var/obj/screen/elem = ..() + elem.set_dir(SOUTHWEST) + return elem + +/decl/hud_element/drop_grab + screen_name = "drop grab" + screen_object_type = /obj/screen/robot_drop_grab + screen_icon = 'icons/mob/screen/robot_drop_grab.dmi' + screen_icon_state = "drop_grab" screen_loc = ui_borg_drop_grab - invisibility = INVISIBILITY_MAXIMUM - alpha = 0 + update_in_life = TRUE + +/decl/hud_element/drop_grab/create_screen_object(datum/hud/hud) + var/obj/screen/elem = ..() + if(length(hud?.mymob?.get_active_grabs())) + elem.invisibility = 0 + elem.alpha = 255 + else + elem.invisibility = INVISIBILITY_MAXIMUM + elem.alpha = 0 + return elem + +/decl/hud_element/drop_grab/refresh_screen_object(datum/hud/hud, obj/screen/elem, datum/gas_mixture/environment) + . = ..() + if(length(hud?.mymob?.get_active_grabs())) + elem.invisibility = 0 + elem.alpha = 255 + else + elem.invisibility = INVISIBILITY_MAXIMUM + elem.alpha = 0 /obj/screen/robot_drop_grab/Click(location, control, params) . = ..() - if(isrobot(usr) && !usr.incapacitated()) - var/mob/living/silicon/robot/R = usr - R.drop_item() - invisibility = INVISIBILITY_MAXIMUM - alpha = 0 + if(!isrobot(usr) || usr.incapacitated()) + return -/mob/living/silicon/robot - hud_type = /datum/hud/robot + var/mob/living/silicon/robot/R = usr + R.drop_item() + invisibility = INVISIBILITY_MAXIMUM + alpha = 0 + +/decl/hud_element/health/robot + screen_icon = 'icons/mob/screen/health_robot.dmi' + screen_loc = ui_borg_health + +/decl/hud_element/module_panel + screen_name = "panel" + screen_icon_state = "panel" + screen_loc = ui_borg_panel + +/decl/hud_element/robot_inventory + screen_name = "inventory" + screen_icon_state = "inventory" + screen_loc = ui_borg_inventory + +/datum/hud/robot + health_hud_type = /decl/hud_element/health/robot + hud_elements = list( + /decl/hud_element/health/robot, + /decl/hud_element/drop_grab, + /decl/hud_element/radio, + /decl/hud_element/module, + /decl/hud_element/module_panel, + /decl/hud_element/robot_inventory, + /decl/hud_element/condition/fire/robot, + /decl/hud_element/condition/oxygen/robot, + /decl/hud_element/condition/bodytemp/robot + ) + +/datum/hud/robot/get_ui_color() + return COLOR_WHITE + +/datum/hud/robot/get_ui_alpha() + return 255 + +/datum/hud/robot/get_ui_style() + return 'icons/mob/screen/robot.dmi' /datum/hud/robot/FinalizeInstantiation() if(!isrobot(mymob)) - return + return ..() var/mob/living/silicon/robot/R = mymob - - adding = list() - other = list() - var/obj/screen/using - - //Radio - using = new /obj/screen() - using.SetName("radio") - using.set_dir(SOUTHWEST) - using.icon = 'icons/mob/screen1_robot.dmi' - using.icon_state = "radio" - using.screen_loc = ui_movi - adding += using + var/ui_style = get_ui_style() //Module select - using = new /obj/screen() using.SetName("module1") using.set_dir(SOUTHWEST) - using.icon = 'icons/mob/screen1_robot.dmi' + using.icon = ui_style using.icon_state = "inv1" using.screen_loc = ui_inv1 - adding += using + misc_hud_elements += using R.inv1 = using using = new /obj/screen() using.SetName("module2") using.set_dir(SOUTHWEST) - using.icon = 'icons/mob/screen1_robot.dmi' + using.icon = ui_style using.icon_state = "inv2" using.screen_loc = ui_inv2 - adding += using + misc_hud_elements += using R.inv2 = using using = new /obj/screen() using.SetName("module3") using.set_dir(SOUTHWEST) - using.icon = 'icons/mob/screen1_robot.dmi' + using.icon = ui_style using.icon_state = "inv3" using.screen_loc = ui_inv3 - adding += using + misc_hud_elements += using R.inv3 = using - //End of module select - // Drop UI - R.ui_drop_grab = new - adding += R.ui_drop_grab - - //Intent - using = new /obj/screen() - using.SetName("act_intent") - using.set_dir(SOUTHWEST) - using.icon = 'icons/mob/screen1_robot.dmi' - using.icon_state = R.a_intent - using.screen_loc = ui_acti - adding += using - action_intent = using - - //Cell - R.cells = new /obj/screen() - R.cells.icon = 'icons/mob/screen1_robot.dmi' - R.cells.icon_state = "charge-empty" - R.cells.SetName("cell") - R.cells.screen_loc = ui_toxin - - //Health - R.healths = new /obj/screen() - R.healths.icon = 'icons/mob/screen1_robot.dmi' - R.healths.icon_state = "health0" - R.healths.SetName("health") - R.healths.screen_loc = ui_borg_health - - //Installed Module - R.hands = new /obj/screen() - R.hands.icon = 'icons/mob/screen1_robot.dmi' - R.hands.icon_state = "nomod" - R.hands.SetName("module") - R.hands.screen_loc = ui_borg_module - - //Module Panel - using = new /obj/screen() - using.SetName("panel") - using.icon = 'icons/mob/screen1_robot.dmi' - using.icon_state = "panel" - using.screen_loc = ui_borg_panel - adding += using - - //Store - R.throw_icon = new /obj/screen() - R.throw_icon.icon = 'icons/mob/screen1_robot.dmi' - R.throw_icon.icon_state = "store" - R.throw_icon.SetName("store") - R.throw_icon.screen_loc = ui_borg_store - - //Inventory - robot_inventory = new /obj/screen() - robot_inventory.SetName("inventory") - robot_inventory.icon = 'icons/mob/screen1_robot.dmi' - robot_inventory.icon_state = "inventory" - robot_inventory.screen_loc = ui_borg_inventory - - //Temp - R.bodytemp = new /obj/screen() - R.bodytemp.icon = 'icons/mob/status_indicators.dmi' - R.bodytemp.icon_state = "temp0" - R.bodytemp.SetName("body temperature") - R.bodytemp.screen_loc = ui_temp - - - R.oxygen = new /obj/screen() - R.oxygen.icon = 'icons/mob/screen1_robot.dmi' - R.oxygen.icon_state = "oxy0" - R.oxygen.SetName("oxygen") - R.oxygen.screen_loc = ui_oxygen - - R.fire = new /obj/screen() - R.fire.icon = 'icons/mob/screen1_robot.dmi' - R.fire.icon_state = "fire0" - R.fire.SetName("fire") - R.fire.screen_loc = ui_fire - - R.up_hint = new /obj/screen() - R.up_hint.icon = 'icons/mob/screen1_robot.dmi' - R.up_hint.icon_state = "uphint0" - R.up_hint.SetName("up hint") - R.up_hint.screen_loc = ui_up_hint - - R.zone_sel = new - R.zone_sel.icon = 'icons/mob/screen1_robot.dmi' - R.zone_sel.update_icon() - - //Handle the gun settings buttons - R.gun_setting_icon = new /obj/screen/gun/mode(null) - R.item_use_icon = new /obj/screen/gun/item(null) - R.gun_move_icon = new /obj/screen/gun/move(null) - R.radio_use_icon = new /obj/screen/gun/radio(null) - - R.client.screen = list() - R.client.screen += list(R.throw_icon, R.zone_sel, R.oxygen, R.fire, R.up_hint, R.hands, R.healths, R.cells, robot_inventory, R.gun_setting_icon) - R.client.screen += adding + other + return ..() /datum/hud/proc/toggle_show_robot_modules() if(!isrobot(mymob)) return - var/mob/living/silicon/robot/r = mymob - r.shown_robot_modules = !r.shown_robot_modules update_robot_modules_display() - /datum/hud/proc/update_robot_modules_display() if(!isrobot(mymob) || !mymob.client) return @@ -187,8 +157,6 @@ var/global/obj/screen/robot_inventory if(R.shown_robot_modules) if(R.active_storage) R.active_storage.close(R) //Closes the inventory ui. - //Modules display is shown - //R.client.screen += robot_inventory //"store" icon if(!R.module) to_chat(usr, "No module selected") @@ -235,7 +203,6 @@ var/global/obj/screen/robot_inventory else //Modules display is hidden - //R.client.screen -= robot_inventory //"store" icon for(var/atom/A in R.module.equipment) if( (A != R.module_state_1) && (A != R.module_state_2) && (A != R.module_state_3) ) //Module is not currently active diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 0fd29bfb9848..238c96f55461 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -8,7 +8,7 @@ */ /obj/screen name = "" - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/midnight.dmi' plane = HUD_PLANE layer = HUD_BASE_LAYER appearance_flags = NO_CLIENT_COLOR @@ -74,10 +74,7 @@ return TRUE /obj/screen/default_attack_selector/Destroy() - if(owner) - if(owner.attack_selector == src) - owner.attack_selector = null - owner = null + owner = null . = ..() /obj/screen/default_attack_selector/proc/set_owner(var/mob/living/carbon/human/_owner) @@ -136,6 +133,10 @@ screen_loc = ui_zonesel var/selecting = BP_CHEST +/obj/screen/zone_selector/Initialize(mapload) + . = ..() + update_icon() + /obj/screen/zone_selector/Click(location, control,params) var/list/PL = params2list(params) var/icon_x = text2num(PL["icon-x"]) @@ -211,42 +212,20 @@ /obj/screen/zone_selector/on_update_icon() set_overlays(image('icons/mob/zone_sel.dmi', "[selecting]")) - -/obj/screen/intent - name = "intent" - icon = 'icons/mob/screen/white.dmi' - icon_state = "intent_help" - screen_loc = ui_acti - var/intent = I_HELP - -/obj/screen/intent/Click(var/location, var/control, var/params) - var/list/P = params2list(params) - var/icon_x = text2num(P["icon-x"]) - var/icon_y = text2num(P["icon-y"]) - intent = I_DISARM - if(icon_x <= world.icon_size/2) - if(icon_y <= world.icon_size/2) - intent = I_HURT - else - intent = I_HELP - else if(icon_y <= world.icon_size/2) - intent = I_GRAB - update_icon() - usr.a_intent = intent - -/obj/screen/intent/on_update_icon() - icon_state = "intent_[intent]" + compile_overlays() /obj/screen/Click(location, control, params) - if(!usr) return 1 + if(!usr?.client) + return 1 switch(name) if("toggle") if(usr.hud_used.inventory_shown) - usr.client.screen -= usr.hud_used.other + usr.client.screen -= usr.hud_used.hidable_hud_elements usr.hud_used.hide_inventory() else - usr.client.screen += usr.hud_used.other + if(length(usr.hud_used.hidable_hud_elements)) + usr.client.screen |= usr.hud_used.hidable_hud_elements usr.hud_used.show_inventory() if("equip") @@ -272,9 +251,6 @@ var/mob/living/M = usr M.ui_toggle_internals() - if("act_intent") - usr.a_intent_change("right") - if("throw") if(!usr.stat && isturf(usr.loc) && !usr.restrained()) usr.toggle_throw_mode() diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 4d78a75bd74f..9b0d531011ce 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -725,7 +725,7 @@ H.adjustBruteLoss(damage) H.UpdateDamageIcon() - H.updatehealth() + H.update_health() return /// Get the current color of this atom. diff --git a/code/game/gamemodes/godmode/god_altar.dm b/code/game/gamemodes/godmode/god_altar.dm index 802826eed60c..07a960da5706 100644 --- a/code/game/gamemodes/godmode/god_altar.dm +++ b/code/game/gamemodes/godmode/god_altar.dm @@ -82,10 +82,10 @@ /obj/structure/deity/altar/OnTopic(var/user, var/list/href_list) if(href_list["resist"]) var/mob/living/M = locate(href_list["resist"]) - if(!istype(M) || target != M || M.stat || M.last_special > world.time) + if(!istype(M) || target != M || M.stat || M.is_on_special_ability_cooldown()) return TOPIC_HANDLED - M.last_special = world.time + 10 SECONDS + M.set_special_ability_cooldown(10 SECONDS) M.visible_message("\The [M] writhes on top of \the [src]!", "You struggle against the intruding thoughts, keeping them at bay!") to_chat(linked_god, "\The [M] slows its conversion through willpower!") cycles_before_converted++ diff --git a/code/game/machinery/mech_recharger.dm b/code/game/machinery/mech_recharger.dm index 8a8a988ff97c..3289a9d6754c 100644 --- a/code/game/machinery/mech_recharger.dm +++ b/code/game/machinery/mech_recharger.dm @@ -74,7 +74,7 @@ remaining_energy -= repair * repair_power_usage if(remaining_energy <= 0) break - charging.updatehealth() + charging.update_health() if(fully_repaired()) charging.show_message(SPAN_NOTICE("Exosuit integrity has been fully restored.")) @@ -89,7 +89,7 @@ // An ugly proc, but apparently mechs don't have maxhealth var of any kind. /obj/machinery/mech_recharger/proc/fully_repaired() - return charging && (charging.health == charging.maxHealth) + return charging && (charging.health == charging.get_max_health()) /obj/machinery/mech_recharger/proc/start_charging(var/mob/living/exosuit/M) if(stat & (NOPOWER | BROKEN)) diff --git a/code/game/machinery/oxygen_pump.dm b/code/game/machinery/oxygen_pump.dm index ccd515bcfe8c..45f66bcab2b2 100644 --- a/code/game/machinery/oxygen_pump.dm +++ b/code/game/machinery/oxygen_pump.dm @@ -89,8 +89,9 @@ visible_message(SPAN_NOTICE("\The [user] detaches \the [contained] and it rapidly retracts back into \the [src]!")) else visible_message(SPAN_NOTICE("\The [contained] rapidly retracts back into \the [src]!")) - if(breather.internals) - breather.internals.icon_state = "internal0" + var/obj/screen/internals = breather?.get_hud_element(/decl/hud_element/internals) + if(internals) + internals.icon_state = "internal0" breather = null update_use_power(POWER_USE_IDLE) diff --git a/code/game/objects/effects/bump_teleporter.dm b/code/game/objects/effects/bump_teleporter.dm index 26b1a280f070..b317418bcae9 100644 --- a/code/game/objects/effects/bump_teleporter.dm +++ b/code/game/objects/effects/bump_teleporter.dm @@ -2,7 +2,7 @@ var/global/list/BUMP_TELEPORTERS = list() /obj/effect/bump_teleporter name = "bump-teleporter" - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/crosses.dmi' icon_state = "x2" var/id = null //id of this bump_teleporter. var/id_target = null //id of bump_teleporter which this moves you to. diff --git a/code/game/objects/effects/decals/misc.dm b/code/game/objects/effects/decals/misc.dm index 0d1c6153c772..54d0d2a6b89f 100644 --- a/code/game/objects/effects/decals/misc.dm +++ b/code/game/objects/effects/decals/misc.dm @@ -1,7 +1,7 @@ /obj/effect/decal/point name = "arrow" desc = "It's an arrow hanging in mid-air. There may be a wizard about." - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/arrow.dmi' icon_state = "arrow" layer = POINTER_LAYER anchored = 1 diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 631699a672f6..4eede30a5b7b 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -295,7 +295,7 @@ steam.start() -- spawns the effect R.emote("gasp") spawn (20) R.coughedtime = 0 - R.updatehealth() + R.update_health() return ///////////////////////////////////////////// diff --git a/code/game/objects/effects/landmarks.dm b/code/game/objects/effects/landmarks.dm index 81005d60cfc6..fdbe055ea5f1 100644 --- a/code/game/objects/effects/landmarks.dm +++ b/code/game/objects/effects/landmarks.dm @@ -18,7 +18,7 @@ /obj/abstract/landmark/start name = "start" - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/crosses.dmi' icon_state = "x" anchored = 1.0 invisibility = 101 diff --git a/code/game/objects/effects/manifest.dm b/code/game/objects/effects/manifest.dm index 023b92f552d6..55c0a4ede7a6 100644 --- a/code/game/objects/effects/manifest.dm +++ b/code/game/objects/effects/manifest.dm @@ -1,6 +1,6 @@ /obj/effect/manifest name = "manifest" - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/crosses.dmi' icon_state = "x" unacidable = 1//Just to be sure. diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm index e3e71c4accf1..84f31a338621 100644 --- a/code/game/objects/effects/spawners/bombspawner.dm +++ b/code/game/objects/effects/spawners/bombspawner.dm @@ -20,7 +20,7 @@ /obj/effect/spawner/newbomb name = "TTV bomb" - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/crosses.dmi' icon_state = "x" var/filler_type = /decl/material/gas/carbon_dioxide @@ -102,7 +102,7 @@ /obj/effect/spawner/onetankbomb name = "Single-tank bomb" - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/crosses.dmi' icon_state = "x" /obj/effect/spawner/onetankbomb/Initialize() diff --git a/code/game/objects/item.dm b/code/game/objects/item.dm index a3f0f3ca75b3..70cf8b279f80 100644 --- a/code/game/objects/item.dm +++ b/code/game/objects/item.dm @@ -635,7 +635,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. return if(user.hud_used.hud_shown) - user.toggle_zoom_hud() // If the user has already limited their HUD this avoids them having a HUD when they zoom in + user.minimize_hud(zoom = TRUE) // If the user has already limited their HUD this avoids them having a HUD when they zoom in user.client.view = viewsize zoom = 1 @@ -683,7 +683,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. user.client.view = world.view if(!user.hud_used.hud_shown) - user.toggle_zoom_hud() + user.minimize_hud(zoom = TRUE) user.client.pixel_x = 0 user.client.pixel_y = 0 user.client.OnResize() diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index 3efbdc69b548..0a4133825a8b 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -58,7 +58,7 @@ to_chat(carded_ai, "Your core files are being wiped!") while (carded_ai && carded_ai.stat != DEAD) carded_ai.adjustOxyLoss(2) - carded_ai.updatehealth() + carded_ai.update_health() sleep(10) flush = 0 if (href_list["radio"]) diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index ee950f3b5c7f..14483d7ac6c1 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -17,7 +17,7 @@ icon = 'icons/obj/decals.dmi' icon_state = "securearea" var/sight_mode = null - var/hud_type + var/borg_hud_type /obj/item/borg/sight/xray @@ -51,7 +51,7 @@ name = "medical hud" icon_state = ICON_STATE_WORLD icon = 'icons/clothing/eyes/hud_medical.dmi' - hud_type = HUD_MEDICAL + borg_hud_type = HUD_MEDICAL /obj/item/borg/sight/hud/med/Initialize() . = ..() @@ -61,7 +61,7 @@ name = "security hud" icon_state = ICON_STATE_WORLD icon = 'icons/clothing/eyes/hud_security.dmi' - hud_type = HUD_SECURITY + borg_hud_type = HUD_SECURITY /obj/item/borg/sight/hud/Initialize() . = ..() @@ -72,7 +72,7 @@ name = "janitor hud" icon_state = ICON_STATE_WORLD icon = 'icons/clothing/eyes/hud_janitor.dmi' - hud_type = HUD_JANITOR + borg_hud_type = HUD_JANITOR /obj/item/borg/sight/hud/jani/Initialize() . = ..() diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 3f146c2ad49e..4d2e40c75a6a 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -194,18 +194,18 @@ origin_tech = "{'materials':2,'engineering':3,'programming':3,'magnets':3}" /obj/item/borg/upgrade/jetpack/action(var/mob/living/silicon/robot/R) - if(..()) return 0 + if(..()) + return FALSE if(!R.module || !(type in R.module.supported_upgrades)) to_chat(R, "Upgrade mounting error! No suitable hardpoint detected!") to_chat(usr, "There's no mounting point for the module!") - return 0 - else - R.module.equipment += new/obj/item/tank/jetpack/carbondioxide - for(var/obj/item/tank/jetpack/carbondioxide in R.module.equipment) - R.internals = src - //R.icon_state="Miner+j" - return 1 + return FALSE + + var/jetpack = new /obj/item/tank/jetpack/carbondioxide(R.module) + R.module.equipment += jetpack + R.set_internals(jetpack) + return TRUE /obj/item/borg/upgrade/rcd name = "engineering robot RCD" diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 477c652bf788..38933fe6f4d0 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -66,7 +66,8 @@ ) use(1) - M.updatehealth() + M.update_health() + /obj/item/stack/medical/bruise_pack name = "roll of gauze" singular_name = "gauze length" diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index 5a7f9f4511f7..5a4aa7af3763 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -19,7 +19,7 @@ user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) R.adjustBruteLoss(-15) R.adjustFireLoss(-15) - R.updatehealth() + R.update_health() use(1) user.visible_message("\The [user] applied some [src] on [R]'s damaged areas.",\ "You apply some [src] at [R]'s damaged areas.") @@ -44,7 +44,7 @@ else if(can_use(1)) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) S.heal_damage(15, 15, robo_repair = 1) - H.updatehealth() + H.update_health() use(1) user.visible_message("\The [user] applies some nanite paste on [user != M ? "[M]'s [S.name]" : "[S]"] with [src].",\ "You apply some nanite paste on [user == M ? "your" : "[M]'s"] [S.name].") diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 8ea5e2457fa9..88a6b78b00ec 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -452,7 +452,7 @@ M.emote("gasp") SET_STATUS_MAX(M, STAT_WEAK, rand(10,25)) - M.updatehealth() + M.update_health() apply_brain_damage(M, deadtime) /obj/item/shockpaddles/proc/apply_brain_damage(mob/living/carbon/human/H, var/deadtime) diff --git a/code/game/objects/items/weapons/material/shards.dm b/code/game/objects/items/weapons/material/shards.dm index 53d839f97b05..b880a7047253 100644 --- a/code/game/objects/items/weapons/material/shards.dm +++ b/code/game/objects/items/weapons/material/shards.dm @@ -122,7 +122,7 @@ if(BP_IS_PROSTHETIC(affecting)) return affecting.take_external_damage(5, 0) - H.updatehealth() + H.update_health() if(affecting.can_feel_pain()) SET_STATUS_MAX(H, STAT_WEAK, 3) return diff --git a/code/modules/ZAS/Contaminants.dm b/code/modules/ZAS/Contaminants.dm index cdd312b95ceb..a36f8d36871b 100644 --- a/code/modules/ZAS/Contaminants.dm +++ b/code/modules/ZAS/Contaminants.dm @@ -79,8 +79,9 @@ var/global/image/contamination_overlay = image('icons/effects/contamination.dmi' if(vsc.contaminant_control.SKIN_BURNS) if(!contaminant_head_protected() || !contaminant_suit_protected()) take_overall_damage(0, 0.75) - if(prob(20)) to_chat(src, "Your skin burns!") - updatehealth() + if(prob(20)) + to_chat(src, "Your skin burns!") + update_health() //Burn eyes if exposed. if(vsc.contaminant_control.EYE_BURNS) diff --git a/code/modules/admin/admin_attack_log.dm b/code/modules/admin/admin_attack_log.dm index 6367b996d3c8..a55de2390de3 100644 --- a/code/modules/admin/admin_attack_log.dm +++ b/code/modules/admin/admin_attack_log.dm @@ -51,8 +51,7 @@ var/target_zone = "(ZONE_SEL: N/A)" if(attacker) intent = "(INTENT: [uppertext(attacker.a_intent)])" - if (attacker.get_target_zone()) - target_zone = "(ZONE_SEL: [uppertext(attacker.get_target_zone())])" + target_zone = "(ZONE_SEL: [uppertext(attacker.get_target_zone())])" if(victim) attacker.attack_logs_ += text("\[[time_stamp()]\] [key_name(victim)] - [attacker_message] [intent] [target_zone]") else diff --git a/code/modules/assembly/mousetrap.dm b/code/modules/assembly/mousetrap.dm index 119faac2abc5..90e467e80f26 100644 --- a/code/modules/assembly/mousetrap.dm +++ b/code/modules/assembly/mousetrap.dm @@ -42,7 +42,7 @@ SET_STATUS_MAX(H, STAT_STUN, 3) if(affecting) affecting.take_external_damage(1, 0) - H.updatehealth() + H.update_health() else if(ismouse(target)) var/mob/living/simple_animal/mouse/M = target visible_message("SPLAT!") diff --git a/code/modules/awaymissions/loot.dm b/code/modules/awaymissions/loot.dm index d2ebad954c97..bc91c3c46ac1 100644 --- a/code/modules/awaymissions/loot.dm +++ b/code/modules/awaymissions/loot.dm @@ -1,5 +1,5 @@ /obj/effect/spawner/lootdrop - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/crosses.dmi' icon_state = "x2" var/lootcount = 1 //how many items will be spawned var/lootdoubles = 0 //if the same item can be spawned twice diff --git a/code/modules/blob/blob.dm b/code/modules/blob/blob.dm index 573163278f67..fac185ab747d 100644 --- a/code/modules/blob/blob.dm +++ b/code/modules/blob/blob.dm @@ -12,7 +12,7 @@ layer = BLOB_SHIELD_LAYER - var/maxHealth = 30 + var/blob_max_health = 30 var/health var/regen_rate = 5 var/brute_resist = 4.3 @@ -28,7 +28,7 @@ /obj/effect/blob/Initialize() . = ..() - health = maxHealth + health = blob_max_health update_icon() START_PROCESSING(SSblob, src) @@ -36,6 +36,9 @@ STOP_PROCESSING(SSblob, src) . = ..() +/obj/effect/blob/proc/get_max_health() + return blob_max_health + /obj/effect/blob/CanPass(var/atom/movable/mover, var/turf/target, var/height = 0, var/air_group = 0) if(air_group || height == 0) return 1 @@ -46,7 +49,7 @@ take_damage(rand(140 - (severity * 40), 140 - (severity * 20)) / brute_resist) /obj/effect/blob/on_update_icon() - if(health > maxHealth / 2) + if(health > blob_max_health / 2) icon_state = "blob" else icon_state = "blob_damaged" @@ -66,7 +69,7 @@ update_icon() /obj/effect/blob/proc/regen() - health = min(health + regen_rate, maxHealth) + health = min(health + regen_rate, blob_max_health) update_icon() /obj/effect/blob/proc/expand(var/turf/T) @@ -196,7 +199,7 @@ name = "master nucleus" desc = "A massive, fragile nucleus guarded by a shield of thick tendrils." icon_state = "blob_core" - maxHealth = 450 + blob_max_health = 450 damage_min = 30 damage_max = 40 expandType = /obj/effect/blob/shield @@ -210,7 +213,7 @@ var/times_to_pulse = 0 /obj/effect/blob/core/proc/get_health_percent() - return ((health / maxHealth) * 100) + return ((health / get_max_health()) * 100) /* the master core becomes more vulnereable to damage as it weakens, @@ -282,7 +285,7 @@ regen() will cover update_icon() for this proc name = "auxiliary nucleus" desc = "An interwoven mass of tendrils. A glowing nucleus pulses at its center." icon_state = "blob_node" - maxHealth = 125 + blob_max_health = 125 regen_rate = 1 damage_min = 15 damage_max = 20 @@ -294,13 +297,13 @@ regen() will cover update_icon() for this proc return /obj/effect/blob/core/secondary/on_update_icon() - icon_state = (health / maxHealth >= 0.5) ? "blob_node" : "blob_factory" + icon_state = (health / get_max_health() >= 0.5) ? "blob_node" : "blob_factory" /obj/effect/blob/shield name = "shielding mass" desc = "A pulsating mass of interwoven tendrils. These seem particularly robust, but not quite as active." icon_state = "blob_idle" - maxHealth = 120 + blob_max_health = 120 damage_min = 13 damage_max = 25 attack_freq = 7 @@ -318,9 +321,10 @@ regen() will cover update_icon() for this proc return ..() /obj/effect/blob/shield/on_update_icon() - if(health > maxHealth * 2 / 3) + var/max_health = get_max_health() + if(health > max_health * 2 / 3) icon_state = "blob_idle" - else if(health > maxHealth / 3) + else if(health > max_health / 3) icon_state = "blob" else icon_state = "blob_damaged" @@ -331,7 +335,7 @@ regen() will cover update_icon() for this proc /obj/effect/blob/ravaging name = "ravaging mass" desc = "A mass of interwoven tendrils. They thrash around haphazardly at anything in reach." - maxHealth = 20 + blob_max_health = 20 damage_min = 27 damage_max = 36 attack_freq = 3 diff --git a/code/modules/client/ui_style.dm b/code/modules/client/ui_style.dm index f20646370b6a..6b0c4c5f47e7 100644 --- a/code/modules/client/ui_style.dm +++ b/code/modules/client/ui_style.dm @@ -29,6 +29,9 @@ var/global/all_tooltip_styles = list( set desc = "Configure your user interface" set category = "OOC" + if(!mob.hud_used) + return + if(!ishuman(mob)) to_chat(src, SPAN_WARNING("You must be human to use this verb.")) return @@ -47,18 +50,15 @@ var/global/all_tooltip_styles = list( UI_style_alpha_new = clamp(UI_style_alpha_new, 50, 255) - var/list/icons = mob.hud_used.adding + mob.hud_used.other + mob.hud_used.hotkeybuttons - - icons.Add( - mob.zone_sel, - mob.gun_setting_icon, - mob.item_use_icon, - mob.gun_move_icon, - mob.radio_use_icon - ) + var/list/icons = list() + if(length(mob.hud_used.misc_hud_elements)) + icons |= mob.hud_used.misc_hud_elements + if(length(mob.hud_used.hidable_hud_elements)) + icons |= mob.hud_used.hidable_hud_elements + if(length(mob.hud_used.hotkey_hud_elements)) + icons |= mob.hud_used.hotkey_hud_elements var/icon/UI_style_icon_new = all_ui_styles[UI_style_new] - apply_ui_style(icons, UI_style_icon_new, UI_style_color_new, UI_style_alpha_new) if(alert("Like it? Save changes?",,"Yes", "No") == "Yes") diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index 7efd2a70eaa4..52e8b971d209 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -17,7 +17,7 @@ var/active = TRUE var/electric = FALSE //if the glasses should be disrupted by EMP - var/hud_type + var/glasses_hud_type var/obj/screen/overlay var/obj/item/clothing/glasses/hud/hud // Hud glasses, if any var/activation_sound = 'sound/items/goggles_charge.ogg' diff --git a/code/modules/clothing/glasses/eyepatch.dm b/code/modules/clothing/glasses/eyepatch.dm index e660806e6033..52c63948adaa 100644 --- a/code/modules/clothing/glasses/eyepatch.dm +++ b/code/modules/clothing/glasses/eyepatch.dm @@ -90,7 +90,7 @@ /obj/item/clothing/glasses/eyepatch/hud/science name = "SCIpatch" desc = "A Science-type heads-up display that connects directly to the ocular nerve of the user, replacing the need for that useless eyeball." - hud_type = HUD_SCIENCE + glasses_hud_type = HUD_SCIENCE eye_color = COLOR_PINK /obj/item/clothing/glasses/eyepatch/hud/meson/Initialize() diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 2766c94ee05b..35b023ef2b16 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -24,7 +24,7 @@ name = "science goggles" desc = "Goggles fitted with a portable analyzer capable of determining the fabricator training potential of an item or components of a machine. Sensitive to EMP." icon = 'icons/clothing/eyes/goggles_science.dmi' - hud_type = HUD_SCIENCE + glasses_hud_type = HUD_SCIENCE toggleable = TRUE electric = TRUE anomaly_shielding = 0.1 diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 4a4b6dc75a49..cc5acc5c08ef 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -33,7 +33,7 @@ name = "health scanner HUD" desc = "A heads-up display that scans the humans in view and provides accurate data about their health status." icon = 'icons/clothing/eyes/hud_medical.dmi' - hud_type = HUD_MEDICAL + glasses_hud_type = HUD_MEDICAL body_parts_covered = 0 /obj/item/clothing/glasses/hud/health/process_hud(var/mob/M) @@ -55,7 +55,7 @@ name = "security HUD" desc = "A heads-up display that scans the humans in view and provides accurate data about their ID status and security records." icon = 'icons/clothing/eyes/hud_security.dmi' - hud_type = HUD_SECURITY + glasses_hud_type = HUD_SECURITY body_parts_covered = 0 /obj/item/clothing/glasses/hud/security/prescription @@ -82,7 +82,7 @@ desc = "A heads-up display that scans for messes and alerts the user. Good for finding puddles hiding under catwalks." icon = 'icons/clothing/eyes/hud_janitor.dmi' body_parts_covered = 0 - hud_type = HUD_JANITOR + glasses_hud_type = HUD_JANITOR /obj/item/clothing/glasses/hud/janitor/prescription name = "prescription janiHUD" diff --git a/code/modules/clothing/head/fated_key.dm b/code/modules/clothing/head/fated_key.dm index 5a8f26c040d0..7c605faf30f6 100644 --- a/code/modules/clothing/head/fated_key.dm +++ b/code/modules/clothing/head/fated_key.dm @@ -44,7 +44,7 @@ to_chat(user, SPAN_WARNING("You are in no fit state to perform division.")) return - if(world.time < user.last_special) + if(user.is_on_special_ability_cooldown()) to_chat(user, SPAN_WARNING("You have not yet regained enough focus to perform division.")) return @@ -66,7 +66,7 @@ playsound(user.loc, 'sound/effects/sanctionedaction_cut.ogg', 100, 1) var/obj/item/projectile/sanctionedaction/cut = new(user.loc) cut.launch(get_edge_target_turf(get_turf(user.loc), user.dir), user.get_target_zone()) - user.last_special = world.time + 10 SECONDS + user.set_special_ability_cooldown(10 SECONDS) /obj/item/projectile/sanctionedaction name = "rending slash" diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index 8169713be0e0..c9196a56e8b9 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -197,15 +197,15 @@ return if(H in view(get_turf(src))) // Like medbot's analyzer it can be used in range.. - + var/max_health = H.get_max_health() var/obj/item/organ/internal/brain = GET_INTERNAL_ORGAN(H, BP_BRAIN) set_pin_data(IC_OUTPUT, 1, (brain && H.stat != DEAD)) set_pin_data(IC_OUTPUT, 2, (H.stat == 0)) - set_pin_data(IC_OUTPUT, 3, damage_to_severity(100 * H.getBruteLoss() / H.maxHealth)) - set_pin_data(IC_OUTPUT, 4, damage_to_severity(100 * H.getFireLoss() / H.maxHealth)) - set_pin_data(IC_OUTPUT, 5, damage_to_severity(100 * H.getToxLoss() / H.maxHealth)) - set_pin_data(IC_OUTPUT, 6, damage_to_severity(100 * H.getOxyLoss() / H.maxHealth)) - set_pin_data(IC_OUTPUT, 7, damage_to_severity(100 * H.getCloneLoss() / H.maxHealth)) + set_pin_data(IC_OUTPUT, 3, damage_to_severity(100 * H.getBruteLoss() / max_health)) + set_pin_data(IC_OUTPUT, 4, damage_to_severity(100 * H.getFireLoss() / max_health)) + set_pin_data(IC_OUTPUT, 5, damage_to_severity(100 * H.getToxLoss() / max_health)) + set_pin_data(IC_OUTPUT, 6, damage_to_severity(100 * H.getOxyLoss() / max_health)) + set_pin_data(IC_OUTPUT, 7, damage_to_severity(100 * H.getCloneLoss() / max_health)) set_pin_data(IC_OUTPUT, 8, H.get_pulse_as_number()) set_pin_data(IC_OUTPUT, 9, H.get_blood_oxygenation()) set_pin_data(IC_OUTPUT, 10, damage_to_severity(H.get_shock())) diff --git a/code/modules/materials/definitions/gasses/material_gas_mundane.dm b/code/modules/materials/definitions/gasses/material_gas_mundane.dm index a6f29fca2796..c860fd62d470 100644 --- a/code/modules/materials/definitions/gasses/material_gas_mundane.dm +++ b/code/modules/materials/definitions/gasses/material_gas_mundane.dm @@ -68,20 +68,12 @@ warning_message = pick("extremely dizzy","short of breath","faint","confused") warning_prob = 15 M.adjustOxyLoss(10,20) - if(istype(H)) - H.co2_alert = 1 else if(dosage >= 1.5) warning_message = pick("dizzy","short of breath","faint","momentarily confused") M.adjustOxyLoss(3,5) - if(istype(H)) - H.co2_alert = 1 else if(dosage >= 0.25) warning_message = pick("a little dizzy","short of breath") warning_prob = 10 - if(istype(H)) - H.co2_alert = 0 - else if(istype(H)) - H.co2_alert = 0 if(istype(H) && dosage > 1 && H.losebreath < 15) H.losebreath++ if(warning_message && prob(warning_prob)) diff --git a/code/modules/mechs/interface/_interface.dm b/code/modules/mechs/interface/_interface.dm index 38535387f412..1e293f84df87 100644 --- a/code/modules/mechs/interface/_interface.dm +++ b/code/modules/mechs/interface/_interface.dm @@ -23,7 +23,7 @@ client.screen |= hud_elements /mob/living/exosuit/InitializeHud() - zone_sel = new + if(!LAZYLEN(hud_elements)) var/i = 1 for(var/hardpoint in hardpoints) diff --git a/code/modules/mechs/mech.dm b/code/modules/mechs/mech.dm index 2dccac4ee913..f30fa6dd06b4 100644 --- a/code/modules/mechs/mech.dm +++ b/code/modules/mechs/mech.dm @@ -21,6 +21,7 @@ bone_material = null bone_amount = 0 + var/zone_tracker var/emp_damage = 0 var/obj/item/radio/exosuit/radio @@ -67,6 +68,7 @@ // Interface stuff. var/list/hud_elements = list() var/list/hardpoint_hud_elements = list() + // TODO: /datum/hud/exosuit var/obj/screen/exosuit/health/hud_health var/obj/screen/exosuit/toggle/hatch_open/hud_open var/obj/screen/exosuit/power/hud_power @@ -119,7 +121,7 @@ if(source_frame.material) material = source_frame.material - updatehealth() + update_health() // Generate hardpoint list. var/list/component_descriptions diff --git a/code/modules/mechs/mech_damage.dm b/code/modules/mechs/mech_damage.dm index 84e743894467..a106f2e4e041 100644 --- a/code/modules/mechs/mech_damage.dm +++ b/code/modules/mechs/mech_damage.dm @@ -80,9 +80,11 @@ if(body_armor) . += body_armor -/mob/living/exosuit/updatehealth() - maxHealth = body ? body.mech_health : 0 - health = maxHealth-(getFireLoss()+getBruteLoss()) +/mob/living/exosuit/get_max_health() + return body ? body.mech_health : 0 + +/mob/living/exosuit/sum_health_damages() + return getFireLoss() + getBruteLoss() /mob/living/exosuit/adjustFireLoss(var/amount, var/obj/item/mech_component/MC = pick(list(arms, legs, body, head))) if(MC) @@ -152,7 +154,7 @@ if((damagetype == BRUTE || damagetype == BURN) && prob(25+(damage*2))) sparks.set_up(3,0,src) sparks.start() - updatehealth() + update_health() return 1 @@ -164,7 +166,7 @@ if(!hatch_closed || (body.pilot_coverage < 100)) //Open, environment is the source return . var/list/after_armor = modify_damage_by_armor(null, ., IRRADIATE, DAM_DISPERSED, src, 0, TRUE) - return after_armor[1] + return after_armor[1] /mob/living/exosuit/getFireLoss() var/total = 0 @@ -200,6 +202,6 @@ for(var/thing in pilots) var/mob/pilot = thing pilot.emp_act(severity) - + /mob/living/exosuit/get_bullet_impact_effect_type(def_zone) return BULLET_IMPACT_METAL diff --git a/code/modules/mechs/mech_interaction.dm b/code/modules/mechs/mech_interaction.dm index 654a63986fe4..0c6efc6a38e7 100644 --- a/code/modules/mechs/mech_interaction.dm +++ b/code/modules/mechs/mech_interaction.dm @@ -89,6 +89,15 @@ /mob/living/exosuit/has_dexterity(dex_level) return TRUE +// Override as mechs will usually not have clients and therefore not have HUDs. +/mob/living/exosuit/get_target_zone() + if(!istype(hud_used)) + return + var/obj/screen/zone_selector/zone_selector = get_hud_element(/decl/hud_element/zone_selector) + if(istype(zone_selector)) + return zone_selector.selecting + return zone_tracker + /mob/living/exosuit/ClickOn(var/atom/A, var/params, var/mob/user) if(!user || incapacitated() || user.incapacitated()) @@ -134,10 +143,13 @@ // User is not necessarily the exosuit, or the same person, so update intent. if(user != src) a_intent = user.a_intent - if(user.zone_sel) - zone_sel.set_selected_zone(user.get_target_zone()) + var/obj/screen/zone_selector/zone_selector = get_hud_element(/decl/hud_element/zone_selector) + var/set_zone = user.get_target_zone() || BP_CHEST + if(istype(zone_selector)) + zone_selector.set_selected_zone(set_zone) else - zone_sel.set_selected_zone(BP_CHEST) + zone_tracker = set_zone + // You may attack the target with your exosuit FIST if you're malfunctioning. var/atom/movable/AM = A var/fail_prob = (user != src && istype(AM) && AM.loc != src) ? (user.skill_check(SKILL_MECH, HAS_PERK) ? 0: 15 ) : 0 diff --git a/code/modules/mechs/mech_life.dm b/code/modules/mechs/mech_life.dm index c000678ca654..451b12ae9739 100644 --- a/code/modules/mechs/mech_life.dm +++ b/code/modules/mechs/mech_life.dm @@ -3,6 +3,10 @@ /mob/living/exosuit/Life() + . = ..() + if(. == PROCESS_KILL) + return + for(var/thing in pilots) var/mob/pilot = thing if(pilot.loc != src) // Admin jump or teleport/grab. @@ -14,7 +18,7 @@ if(!body && !QDELETED(src)) qdel(src) - return + return PROCESS_KILL if(radio) radio.on = (head && head.radio && head.radio.is_functional() && get_cell()) @@ -35,13 +39,12 @@ if(istype(M) && M.active && M.passive_power_use) M.deactivate() - updatehealth() + update_health() if(health <= 0 && stat != DEAD) death() if(emp_damage > 0) emp_damage -= min(1, emp_damage) //Reduce emp accumulation over time - ..() //Handles stuff like environment handle_hud_icons() diff --git a/code/modules/mechs/mech_movement.dm b/code/modules/mechs/mech_movement.dm index 408c5931744f..63852806db8d 100644 --- a/code/modules/mechs/mech_movement.dm +++ b/code/modules/mechs/mech_movement.dm @@ -14,13 +14,13 @@ var/turf/B = GetAbove(src) - for(var/thing in pilots) - var/mob/pilot = thing - if(pilot.up_hint) - pilot.up_hint.icon_state = "uphint[!!(B && TURF_IS_MIMICKING(B))]" + for(var/mob/pilot in pilots) + var/obj/screen/up_hint = pilot.get_hud_element(/decl/hud_element/up_hint) + if(up_hint) + up_hint.icon_state = "uphint[!!(B && TURF_IS_MIMICKING(B))]" /mob/living/exosuit/can_ztravel() - if(Process_Spacemove(1)) //Handle here + if(Process_Spacemove(1)) //Handle here return TRUE //Inertia drift making us face direction makes exosuit flight a bit difficult, plus newtonian flight model yo @@ -37,7 +37,7 @@ //For swimming // /mob/living/exosuit/can_float() // return FALSE //Nope - + /datum/movement_handler/mob/delay/exosuit expected_host_type = /mob/living/exosuit diff --git a/code/modules/mob/death.dm b/code/modules/mob/death.dm index 05a2bc9a924f..b63e0b5aa3c3 100644 --- a/code/modules/mob/death.dm +++ b/code/modules/mob/death.dm @@ -77,14 +77,8 @@ SSstatistics.report_death(src) - //TODO: Change death state to health_dead for all these icon files. This is a stop gap. - if(healths) - healths.overlays.Cut() // This is specific to humans but the relevant code is here; shouldn't mess with other mobs. - if("health7" in icon_states(healths.icon)) - healths.icon_state = "health7" - else - healths.icon_state = "health6" - log_debug("[src] ([src.type]) died but does not have a valid health7 icon_state (using health6 instead). report this error to Ccomp5950 or your nearest Developer") + if(hud_used) + hud_used.update_icons() timeofdeath = world.time if(mind) diff --git a/code/modules/mob/examine.dm b/code/modules/mob/examine.dm index a6286602b887..d911f3129586 100644 --- a/code/modules/mob/examine.dm +++ b/code/modules/mob/examine.dm @@ -56,9 +56,10 @@ to_chat(user, "") // Update our target dolly. - if(user.zone_sel) + var/obj/screen/zone_selector = user.get_hud_element(/decl/hud_element/zone_selector) + if(zone_selector) var/decl/species/target_species = get_species() if(target_species && (BP_TAIL in target_species.has_limbs)) - user.zone_sel.icon_state = "zone_sel_tail" + zone_selector.icon_state = "zone_sel_tail" else - user.zone_sel.icon_state = "zone_sel" + zone_selector.icon_state = "zone_sel" diff --git a/code/modules/mob/grab/grab_object.dm b/code/modules/mob/grab/grab_object.dm index 4c444266f333..86ca7f4811a2 100644 --- a/code/modules/mob/grab/grab_object.dm +++ b/code/modules/mob/grab/grab_object.dm @@ -54,8 +54,9 @@ update_icon() events_repository.register(/decl/observ/moved, affecting, src, .proc/on_affecting_move) - if(assailant.zone_sel) - events_repository.register(/decl/observ/zone_selected, assailant.zone_sel, src, .proc/on_target_change) + var/obj/screen/zone_selector = assailant.get_hud_element(/decl/hud_element/zone_selector) + if(zone_selector) + events_repository.register(/decl/observ/zone_selected, zone_selector, src, .proc/on_target_change) var/obj/item/organ/O = get_targeted_organ() var/decl/pronouns/G = assailant.get_pronouns() @@ -129,8 +130,9 @@ affecting.reset_plane_and_layer() affecting = null if(assailant) - if(assailant.zone_sel) - events_repository.unregister(/decl/observ/zone_selected, assailant.zone_sel, src) + var/obj/screen/zone_selector = assailant.get_hud_element(/decl/hud_element/zone_selector) + if(zone_selector) + events_repository.unregister(/decl/observ/zone_selected, zone_selector, src) assailant = null . = ..() if(old_affecting) diff --git a/code/modules/mob/grab/normal/grab_normal.dm b/code/modules/mob/grab/normal/grab_normal.dm index 90adf6f04e0a..ab5b40e8bdd1 100644 --- a/code/modules/mob/grab/normal/grab_normal.dm +++ b/code/modules/mob/grab/normal/grab_normal.dm @@ -1,6 +1,6 @@ /decl/grab/normal name = "grab" - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/grabs.dmi' help_action = "inspect" disarm_action = "pin" grab_action = "jointlock" diff --git a/code/modules/mob/living/bot/bot.dm b/code/modules/mob/living/bot/bot.dm index ee868083ccba..0268a700d9f4 100644 --- a/code/modules/mob/living/bot/bot.dm +++ b/code/modules/mob/living/bot/bot.dm @@ -1,7 +1,7 @@ /mob/living/bot name = "Bot" health = 20 - maxHealth = 20 + mob_default_max_health = 20 icon = 'icons/mob/bot/placeholder.dmi' universal_speak = TRUE density = 0 @@ -56,17 +56,26 @@ access_scanner.req_access = req_access?.Copy() /mob/living/bot/Initialize() + . = ..() + if(. == PROCESS_KILL) + return + if(on) turn_on() // Update lights and other stuff else turn_off() /mob/living/bot/Life() - ..() + + . = ..() + if(. == PROCESS_KILL) + return + if(health <= 0) death() - return + return PROCESS_KILL + set_status(STAT_WEAK, 0) set_status(STAT_STUN, 0) set_status(STAT_PARA, 0) @@ -74,12 +83,8 @@ if(on && !client && !busy) handleAI() -/mob/living/bot/updatehealth() - if(status_flags & GODMODE) - health = maxHealth - set_stat(CONSCIOUS) - else - health = maxHealth - getFireLoss() - getBruteLoss() +/mob/living/bot/sum_health_damages() + return getFireLoss() - getBruteLoss() /mob/living/bot/death() explode() @@ -104,9 +109,10 @@ to_chat(user, "You need to unlock the controls first.") return else if(IS_WELDER(O)) - if(health < maxHealth) + var/max_health = get_max_health() + if(health < max_health) if(open) - health = min(maxHealth, health + 10) + health = min(max_health, health + 10) user.visible_message("\The [user] repairs \the [src].","You repair \the [src].") else to_chat(user, "Unable to repair with the maintenance panel closed.") diff --git a/code/modules/mob/living/bot/ed209bot.dm b/code/modules/mob/living/bot/ed209bot.dm index 3ff51b91c922..2fd94eb80339 100644 --- a/code/modules/mob/living/bot/ed209bot.dm +++ b/code/modules/mob/living/bot/ed209bot.dm @@ -7,7 +7,7 @@ layer = MOB_LAYER density = 1 health = 100 - maxHealth = 100 + mob_default_max_health = 100 preparing_arrest_sounds = new() diff --git a/code/modules/mob/living/bot/farmbot.dm b/code/modules/mob/living/bot/farmbot.dm index 6dea16be17b4..09fbef651e08 100644 --- a/code/modules/mob/living/bot/farmbot.dm +++ b/code/modules/mob/living/bot/farmbot.dm @@ -9,7 +9,7 @@ icon = 'icons/mob/bot/farmbot.dmi' icon_state = "farmbot0" health = 50 - maxHealth = 50 + mob_default_max_health = 50 req_access = list(list(access_hydroponics, access_robotics)) var/action = "" // Used to update icon diff --git a/code/modules/mob/living/bot/mulebot.dm b/code/modules/mob/living/bot/mulebot.dm index 08305c5dec0d..4bc47d159fc0 100644 --- a/code/modules/mob/living/bot/mulebot.dm +++ b/code/modules/mob/living/bot/mulebot.dm @@ -16,7 +16,7 @@ anchored = 1 density = 1 health = 150 - maxHealth = 150 + mob_default_max_health = 150 mob_bump_flag = HEAVY min_target_dist = 0 diff --git a/code/modules/mob/living/bot/remotebot.dm b/code/modules/mob/living/bot/remotebot.dm index 609b3bbf65cf..1dbec98103f6 100644 --- a/code/modules/mob/living/bot/remotebot.dm +++ b/code/modules/mob/living/bot/remotebot.dm @@ -4,7 +4,7 @@ icon = 'icons/mob/bot/fetchbot.dmi' icon_state = "fetchbot1" health = 15 - maxHealth = 15 + mob_default_max_health = 15 var/working = 0 var/speed = 10 //lower = better diff --git a/code/modules/mob/living/bot/secbot.dm b/code/modules/mob/living/bot/secbot.dm index 45fdc1913c46..d6f8197818d4 100644 --- a/code/modules/mob/living/bot/secbot.dm +++ b/code/modules/mob/living/bot/secbot.dm @@ -9,7 +9,7 @@ icon_state = "secbot0" var/attack_state = "secbot-c" layer = MOB_LAYER - maxHealth = 50 + mob_default_max_health = 50 health = 50 req_access = list(list(access_security, access_forensics_lockers)) botcard_access = list(access_security, access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels) diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 2ef856b10ea5..aff9873a1c62 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -3,7 +3,7 @@ desc = "What IS that?" pass_flags = PASS_FLAG_TABLE health = 100 - maxHealth = 100 + mob_default_max_health = 100 mob_size = MOB_SIZE_TINY mob_sort_value = 8 var/dead_icon diff --git a/code/modules/mob/living/carbon/alien/alien_attacks.dm b/code/modules/mob/living/carbon/alien/alien_attacks.dm index dd556813f6e0..3799799892cd 100644 --- a/code/modules/mob/living/carbon/alien/alien_attacks.dm +++ b/code/modules/mob/living/carbon/alien/alien_attacks.dm @@ -20,7 +20,7 @@ SET_STATUS_MAX(src, STAT_WEAK, rand(10,15)) user.visible_message(SPAN_DANGER("\The [user] has weakened \the [src]!"), 1, SPAN_WARNING("You hear someone fall."), 2) adjustBruteLoss(damage) - updatehealth() + update_health() else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) visible_message(SPAN_DANGER("\The [user] has attempted to punch \the [src]!"), 1) diff --git a/code/modules/mob/living/carbon/alien/alien_damage.dm b/code/modules/mob/living/carbon/alien/alien_damage.dm index e75135ae6a6d..6007be2b6f95 100644 --- a/code/modules/mob/living/carbon/alien/alien_damage.dm +++ b/code/modules/mob/living/carbon/alien/alien_damage.dm @@ -19,4 +19,4 @@ SET_STATUS_MAX(src, STAT_DEAF, 60) adjustBruteLoss(b_loss) adjustFireLoss(f_loss) - updatehealth() + update_health() diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 5ebbb32fa712..d4a15e42dc00 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -1,13 +1,12 @@ // Alien larva are quite simple. /mob/living/carbon/alien/Life() - set invisibility = 0 - set background = 1 - - if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src)) return - if(!loc) return + . = ..() + if(. == PROCESS_KILL) + return - ..() + if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src) || !loc) + return blinded = null @@ -35,7 +34,7 @@ blinded = 1 set_status(STAT_SILENCE, 0) else - updatehealth() + update_health() if(health <= 0) death() blinded = 1 @@ -70,59 +69,21 @@ blinded = 1 set_status(STAT_BLURRY, 1) else if(GET_STATUS(src, STAT_BLIND)) - ADJ_STATUS(src, STAT_BLIND, -1) + ADJ_STATUS(src, STAT_BLIND, -1) blinded = 1 update_icon() return 1 -/mob/living/carbon/alien/handle_regular_hud_updates() - update_sight() - if (healths) - if(stat != DEAD) - switch(health) - if(100 to INFINITY) - healths.icon_state = "health0" - if(80 to 100) - healths.icon_state = "health1" - if(60 to 80) - healths.icon_state = "health2" - if(40 to 60) - healths.icon_state = "health3" - if(20 to 40) - healths.icon_state = "health4" - if(0 to 20) - healths.icon_state = "health5" - else - healths.icon_state = "health6" - else - healths.icon_state = "health7" - - if(stat != DEAD) - if(blinded) - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - else - clear_fullscreen("blind") - set_fullscreen(disabilities & NEARSIGHTED, "impaired", /obj/screen/fullscreen/impaired, 1) - set_fullscreen(GET_STATUS(src, STAT_BLURRY), "blurry", /obj/screen/fullscreen/blurry) - set_fullscreen(GET_STATUS(src, STAT_DRUGGY), "high", /obj/screen/fullscreen/high) - if(machine) - if(machine.check_eye(src) < 0) - reset_view(null) - return 1 - /mob/living/carbon/alien/handle_environment(var/datum/gas_mixture/environment) ..() // Both alien subtypes survive in vaccum and suffer in high temperatures, // so I'll just define this once, for both (see radiation comment above) if(environment && environment.temperature > (T0C+66)) adjustFireLoss((environment.temperature - (T0C+66))/5) // Might be too high, check in testing. - if (fire) fire.icon_state = "fire2" if(prob(20)) to_chat(src, "You feel a searing heat!") - else - if (fire) fire.icon_state = "fire0" /mob/living/carbon/alien/handle_fire() if(..()) diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 3df8291409f0..f0ca22f81115 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -14,7 +14,7 @@ radiation-- if(prob(25)) adjustToxLoss(1) - updatehealth() + update_health() if(50 to 74) radiation -= 2 @@ -25,12 +25,12 @@ to_chat(src, "You feel weak.") else to_chat(src, "STATUS: DANGEROUS LEVELS OF RADIATION DETECTED.") - updatehealth() + update_health() if(75 to 100) radiation -= 3 adjustToxLoss(3) - updatehealth() + update_health() /mob/living/carbon/brain/handle_environment(datum/gas_mixture/environment) @@ -69,7 +69,7 @@ return TRUE /mob/living/carbon/brain/handle_regular_status_updates() //TODO: comment out the unused bits >_> - updatehealth() + update_health() if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP blinded = 1 @@ -136,40 +136,5 @@ return 1 -/mob/living/carbon/brain/handle_regular_hud_updates() - update_sight() - if (healths) - if (stat != 2) - switch(health) - if(100 to INFINITY) - healths.icon_state = "health0" - if(80 to 100) - healths.icon_state = "health1" - if(60 to 80) - healths.icon_state = "health2" - if(40 to 60) - healths.icon_state = "health3" - if(20 to 40) - healths.icon_state = "health4" - if(0 to 20) - healths.icon_state = "health5" - else - healths.icon_state = "health6" - else - healths.icon_state = "health7" - - if(stat != DEAD) - if(blinded) - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - else - clear_fullscreen("blind") - set_fullscreen(disabilities & NEARSIGHTED, "impaired", /obj/screen/fullscreen/impaired, 1) - set_fullscreen(GET_STATUS(src, STAT_BLURRY), "blurry", /obj/screen/fullscreen/blurry) - set_fullscreen(GET_STATUS(src, STAT_DRUGGY), "high", /obj/screen/fullscreen/high) - if (machine) - if (!( machine.check_eye(src) )) - reset_view(null) - return 1 - /mob/living/carbon/brain/can_change_intent() return TRUE diff --git a/code/modules/mob/living/carbon/breathe.dm b/code/modules/mob/living/carbon/breathe.dm index c479a2071790..083343fce33f 100644 --- a/code/modules/mob/living/carbon/breathe.dm +++ b/code/modules/mob/living/carbon/breathe.dm @@ -43,13 +43,13 @@ var/obj/item/mask = get_equipped_item(slot_wear_mask_str) if (!mask || !(mask.item_flags & ITEM_FLAG_AIRTIGHT)) set_internals(null) + var/obj/screen/internals = get_hud_element(/decl/hud_element/internals) if(internal) if (internals) internals.icon_state = "internal1" return internal.remove_air_volume(volume_needed) - else - if (internals) - internals.icon_state = "internal0" + else if (internals) + internals.icon_state = "internal0" return null /mob/living/carbon/proc/get_breath_from_environment(var/volume_needed=STD_BREATH_VOLUME, var/atom/location = src.loc) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 6664c230d7b7..3c7dc6261d94 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -50,8 +50,8 @@ /mob/living/carbon/relaymove(var/mob/living/user, direction) if((user in contents) && istype(user)) - if(user.last_special <= world.time) - user.last_special = world.time + 50 + if(!user.is_on_special_ability_cooldown()) + user.set_special_ability_cooldown(5 SECONDS) src.visible_message("You hear something rumbling inside [src]'s stomach...") var/obj/item/I = user.get_active_hand() if(I && I.force) @@ -61,7 +61,7 @@ var/obj/item/organ/external/organ = GET_EXTERNAL_ORGAN(H, BP_CHEST) if (istype(organ)) organ.take_external_damage(d, 0) - H.updatehealth() + H.update_health() else src.take_organ_damage(d) user.visible_message("[user] attacks [src]'s stomach wall with the [I.name]!") diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index 0329801ad702..574cdc426c4f 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -9,5 +9,5 @@ Specifically made to do radiation burns. if(!isSynthetic() && !ignore_rads) damage = 0.25 * damage * (species ? species.get_radiation_mod(src) : 1) adjustFireLoss(damage) - updatehealth() + update_health() return TRUE diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 11743a6bd54e..856243d074da 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -228,14 +228,14 @@ var/obj/item/clothing/glasses/G = get_equipped_item(slot_glasses_str) if(!istype(G)) return - if(G.hud_type & hudtype) + if(G.glasses_hud_type & hudtype) return G - if(G.hud && (G.hud.hud_type & hudtype)) + if(G.hud && (G.hud.glasses_hud_type & hudtype)) return G.hud /mob/living/silicon/robot/getHUDsource(hudtype) for(var/obj/item/borg/sight/sight in list(module_state_1, module_state_2, module_state_3)) - if(istype(sight) && (sight.hud_type & hudtype)) + if(istype(sight) && (sight.borg_hud_type & hudtype)) return sight //Gets the computer network M's source of hudtype is using diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 3475b175fa95..3bd048593e11 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -37,7 +37,6 @@ global.human_mob_list -= src regenerate_body_icon = FALSE // don't bother regenerating if we happen to be queued to update icon worn_underwear = null - QDEL_NULL(attack_selector) QDEL_NULL(vessel) LAZYCLEARLIST(smell_cooldown) . = ..() @@ -605,7 +604,7 @@ holder_type = null if(species.holder_type) holder_type = species.holder_type - maxHealth = species.total_health + mob_size = species.mob_size remove_extension(src, /datum/extension/armor) if(species.natural_armour_values) @@ -650,6 +649,7 @@ else if(has_extension(src, /datum/extension/scannable)) remove_extension(src, /datum/extension/scannable) + update_health() return TRUE //Syncs cultural tokens to the currently set species, and may trigger a language update @@ -1069,7 +1069,7 @@ //Point at which you dun breathe no more. Separate from asystole crit, which is heart-related. /mob/living/carbon/human/nervous_system_failure() - return getBrainLoss() >= maxHealth * 0.75 + return getBrainLoss() >= get_max_health() * 0.75 /mob/living/carbon/human/melee_accuracy_mods() . = ..() diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index efa0642b9cd3..d78691268828 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -355,4 +355,7 @@ var/summary = default_attack.summarize() if(summary) to_chat(src, SPAN_NOTICE(summary)) - attack_selector?.update_icon() \ No newline at end of file + + var/obj/screen/default_attack_selector/attack_selector = get_hud_element(/decl/hud_element/attack_selector) + if(istype(attack_selector)) + attack_selector.update_icon() diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 1e11a7260e66..52a52726ad34 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -1,17 +1,11 @@ -//Updates the mob's health from organs and mob damage variables -/mob/living/carbon/human/updatehealth() +/mob/living/carbon/human/sum_health_damages() + return getBrainLoss() // Humans revolve entirely around brain damage. - if(status_flags & GODMODE) - health = maxHealth - set_stat(CONSCIOUS) - return - - health = maxHealth - getBrainLoss() - //TODO: fix husking - if(((maxHealth - getFireLoss()) < config.health_threshold_dead) && stat == DEAD) +/mob/living/carbon/human/update_health() + ..() + if(health < config.health_threshold_dead && stat == DEAD) make_husked() - return /mob/living/carbon/human/adjustBrainLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode @@ -26,7 +20,7 @@ var/obj/item/organ/internal/sponge = GET_INTERNAL_ORGAN(src, BP_BRAIN) if(sponge) sponge.damage = min(max(amount, 0),sponge.species.total_health) - updatehealth() + update_health() /mob/living/carbon/human/getBrainLoss() if(status_flags & GODMODE) return 0 //godmode @@ -248,7 +242,7 @@ var/obj/item/organ/external/picked = pick(parts) if(picked.heal_damage(brute,burn,robo_repair = affect_robo)) BITSET(hud_updateflag, HEALTH_HUD) - updatehealth() + update_health() //TODO reorganize damage procs so that there is a clean API for damaging living mobs @@ -265,7 +259,7 @@ In most cases it makes more sense to use apply_damage() instead! And make sure t var/obj/item/organ/external/picked = pick(parts) if(picked.take_external_damage(brute, burn, override_droplimb = override_droplimb)) BITSET(hud_updateflag, HEALTH_HUD) - updatehealth() + update_health() //Heal MANY external organs, in random order /mob/living/carbon/human/heal_overall_damage(var/brute, var/burn) @@ -283,7 +277,7 @@ In most cases it makes more sense to use apply_damage() instead! And make sure t burn -= (burn_was-picked.burn_dam) parts -= picked - updatehealth() + update_health() BITSET(hud_updateflag, HEALTH_HUD) // damage MANY external organs, in random order @@ -306,7 +300,7 @@ In most cases it makes more sense to use apply_damage() instead! And make sure t if(burn_avg) apply_damage(damage = burn_avg, damagetype = BURN, damage_flags = dam_flags, used_weapon = used_weapon, silent = TRUE, given_organ = E) - updatehealth() + update_health() BITSET(hud_updateflag, HEALTH_HUD) /* @@ -380,7 +374,7 @@ This function restores all organs. organ.add_genetic_damage(damage) // Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life(). - updatehealth() + update_health() BITSET(hud_updateflag, HEALTH_HUD) return created_wound diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 788db6aeab9c..1f3a6918ceab 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -24,8 +24,6 @@ var/list/cultural_info = list() - var/obj/screen/default_attack_selector/attack_selector - var/icon/stand_icon = null var/voice = "" //Instead of new say code calling GetVoice() over and over and over, we're just going to ask this variable, which gets updated in Life() diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 4738d70db22b..ce3f6c4b8f57 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -18,7 +18,7 @@ tally -= GET_CHEMICAL_EFFECT(src, CE_SPEEDBOOST) tally += GET_CHEMICAL_EFFECT(src, CE_SLOWDOWN) - var/health_deficiency = (maxHealth - health) + var/health_deficiency = (get_max_health() - health) if(health_deficiency >= 40) tally += (health_deficiency / 25) if(can_feel_pain()) @@ -137,9 +137,6 @@ handle_leg_damage() species.handle_post_move(src) - if(client) - var/turf/B = GetAbove(src) - up_hint.icon_state = "uphint[!!(B && TURF_IS_MIMICKING(B))]" /mob/living/carbon/human/proc/handle_leg_damage() if(!can_feel_pain()) diff --git a/code/modules/mob/living/carbon/human/human_species.dm b/code/modules/mob/living/carbon/human/human_species.dm index 56c6441fe000..1fa2d6744838 100644 --- a/code/modules/mob/living/carbon/human/human_species.dm +++ b/code/modules/mob/living/carbon/human/human_species.dm @@ -28,9 +28,9 @@ SetName(newname) if(mind) mind.name = real_name - - adjustOxyLoss(maxHealth)//cease life functions - setBrainLoss(maxHealth) + var/max_health = get_max_health() + adjustOxyLoss(max_health)//cease life functions + setBrainLoss(max_health) var/obj/item/organ/internal/heart/corpse_heart = get_organ(BP_HEART, /obj/item/organ/internal/heart) if(corpse_heart) corpse_heart.pulse = PULSE_NONE//actually stops heart to make worried explorers not care too much diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index dfb980917cef..e5f28055295b 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -31,28 +31,21 @@ #define RADIATION_SPEED_COEFFICIENT 0.025 /mob/living/carbon/human - var/oxygen_alert = 0 - var/toxins_alert = 0 - var/co2_alert = 0 - var/fire_alert = 0 - var/pressure_alert = 0 var/stamina = 100 /mob/living/carbon/human/Life() - set invisibility = 0 - set background = BACKGROUND_ENABLED - if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src)) + . = ..() + if(. == PROCESS_KILL) return - fire_alert = 0 //Reset this here, because both breathe() and handle_environment() have a chance to set it. + if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src)) + return // This is not an ideal place for this but it will do for now. if(wearing_rig && wearing_rig.offline) wearing_rig = null - ..() - if(life_tick%30==15) hud_updateflag = 1022 @@ -252,7 +245,7 @@ if(damage) adjustToxLoss(damage * RADIATION_SPEED_COEFFICIENT) immunity = max(0, immunity - damage * 15 * RADIATION_SPEED_COEFFICIENT) - updatehealth() + update_health() var/list/limbs = get_external_organs() if(!isSynthetic() && LAZYLEN(limbs)) var/obj/item/organ/external/O = pick(limbs) @@ -343,7 +336,7 @@ var/loc_temp = environment.temperature if(adjusted_pressure < species.warning_high_pressure && adjusted_pressure > species.warning_low_pressure && abs(loc_temp - bodytemperature) < 20 && bodytemperature < get_temperature_threshold(HEAT_LEVEL_1) && bodytemperature > get_temperature_threshold(COLD_LEVEL_1) && species.body_temperature) - pressure_alert = 0 + SET_HUD_ALERT(src, /decl/hud_element/condition/pressure, 0) return // Temperatures are within normal ranges, fuck all this processing. ~Ccomp //Body temperature adjusts depending on surrounding atmosphere based on your thermal protection (convection) @@ -363,8 +356,8 @@ // +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt. if(bodytemperature >= get_temperature_threshold(HEAT_LEVEL_1)) //Body temperature is too hot. - fire_alert = max(fire_alert, 1) - if(status_flags & GODMODE) return 1 //godmode + if(status_flags & GODMODE) + return 1 //godmode var/burn_dam = 0 if(bodytemperature < get_temperature_threshold(HEAT_LEVEL_2)) burn_dam = HEAT_DAMAGE_LEVEL_1 @@ -373,14 +366,12 @@ else burn_dam = HEAT_DAMAGE_LEVEL_3 take_overall_damage(burn=burn_dam, used_weapon = "High Body Temperature") - fire_alert = max(fire_alert, 2) + SET_HUD_ALERT_MAX(src, /decl/hud_element/condition/fire, 2) else if(bodytemperature <= get_temperature_threshold(COLD_LEVEL_1)) - fire_alert = max(fire_alert, 1) - if(status_flags & GODMODE) return 1 //godmode - + if(status_flags & GODMODE) + return 1 //godmode var/burn_dam = 0 - if(bodytemperature > get_temperature_threshold(COLD_LEVEL_2)) burn_dam = COLD_DAMAGE_LEVEL_1 else if(bodytemperature > get_temperature_threshold(COLD_LEVEL_3)) @@ -390,7 +381,7 @@ set_stasis(get_cryogenic_factor(bodytemperature), STASIS_COLD) if(!has_chemical_effect(CE_CRYO, 1)) take_overall_damage(burn=burn_dam, used_weapon = "Low Body Temperature") - fire_alert = max(fire_alert, 1) + SET_HUD_ALERT_MAX(src, /decl/hud_element/condition/fire, 1) // Account for massive pressure differences. Done by Polymorph // Made it possible to actually have something that can protect against high pressure... Done by Errorage. Polymorph now has an axe sticking from his head for his previous hardcoded nonsense! @@ -399,13 +390,13 @@ if(adjusted_pressure >= species.hazard_high_pressure) var/pressure_damage = min( ( (adjusted_pressure / species.hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) take_overall_damage(brute=pressure_damage, used_weapon = "High Pressure") - pressure_alert = 2 + SET_HUD_ALERT(src, /decl/hud_element/condition/pressure, 2) else if(adjusted_pressure >= species.warning_high_pressure) - pressure_alert = 1 + SET_HUD_ALERT(src, /decl/hud_element/condition/pressure, 1) else if(adjusted_pressure >= species.warning_low_pressure) - pressure_alert = 0 + SET_HUD_ALERT(src, /decl/hud_element/condition/pressure, 0) else if(adjusted_pressure >= species.hazard_low_pressure) - pressure_alert = -1 + SET_HUD_ALERT(src, /decl/hud_element/condition/pressure, -1) else var/list/obj/item/organ/external/parts = get_damageable_organs() for(var/obj/item/organ/external/O in parts) @@ -415,7 +406,7 @@ O.take_external_damage(brute = LOW_PRESSURE_DAMAGE, used_weapon = "Low Pressure") if(getOxyLossPercent() < 55) // 11 OxyLoss per 4 ticks when wearing internals; unconsciousness in 16 ticks, roughly half a minute adjustOxyLoss(4) // 16 OxyLoss per 4 ticks when no internals present; unconsciousness in 13 ticks, roughly twenty seconds - pressure_alert = -2 + SET_HUD_ALERT(src, /decl/hud_element/condition/pressure, -2) return @@ -539,7 +530,7 @@ blinded = 1 set_status(STAT_SILENCE, 0) else //ALIVE. LIGHTS ARE ON - updatehealth() //TODO + update_health() if(hallucination_power) handle_hallucinations() @@ -622,17 +613,15 @@ /mob/living/carbon/human/handle_regular_hud_updates() if(hud_updateflag) // update our mob's hud overlays, AKA what others see flaoting above our head handle_hud_list() - // now handle what we see on our screen - if(!..()) return - if(stat != DEAD) - if(stat == UNCONSCIOUS && health < maxHealth/2) + var/half_max_health = get_max_health() / 2 + if(stat == UNCONSCIOUS && health < half_max_health) //Critical damage passage overlay var/severity = 0 - switch(health - maxHealth/2) + switch(health - half_max_health) if(-20 to -10) severity = 1 if(-30 to -20) severity = 2 if(-40 to -30) severity = 3 @@ -660,7 +649,6 @@ overlay_fullscreen("oxy", /obj/screen/fullscreen/oxy, severity) else clear_fullscreen("oxy") - //Fire and Brute damage overlay (BSSR) var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not. @@ -676,128 +664,7 @@ overlay_fullscreen("brute", /obj/screen/fullscreen/brute, severity) else clear_fullscreen("brute") - - if(healths) - - var/mutable_appearance/healths_ma = new(healths) - healths_ma.icon_state = "blank" - healths_ma.overlays = null - - if(has_chemical_effect(CE_PAINKILLER, 100)) - healths_ma.icon_state = "health_numb" - else - // Generate a by-limb health display. - var/no_damage = 1 - var/trauma_val = 0 // Used in calculating softcrit/hardcrit indicators. - if(can_feel_pain()) - trauma_val = max(shock_stage,get_shock())/(species.total_health-100) - // Collect and apply the images all at once to avoid appearance churn. - var/list/health_images = list() - for(var/obj/item/organ/external/E in get_external_organs()) - if(no_damage && (E.brute_dam || E.burn_dam)) - no_damage = 0 - health_images += E.get_damage_hud_image() - - // Apply a fire overlay if we're burning. - if(on_fire) - health_images += image('icons/mob/screen1_health.dmi',"burning") - - // Show a general pain/crit indicator if needed. - if(is_asystole()) - health_images += image('icons/mob/screen1_health.dmi',"hardcrit") - else if(trauma_val) - if(can_feel_pain()) - if(trauma_val > 0.7) - health_images += image('icons/mob/screen1_health.dmi',"softcrit") - if(trauma_val >= 1) - health_images += image('icons/mob/screen1_health.dmi',"hardcrit") - else if(no_damage) - health_images += image('icons/mob/screen1_health.dmi',"fullhealth") - healths_ma.overlays += health_images - healths.appearance = healths_ma - - if(nutrition_icon) - switch(nutrition) - if(450 to INFINITY) nutrition_icon.icon_state = "nutrition0" - if(350 to 450) nutrition_icon.icon_state = "nutrition1" - if(250 to 350) nutrition_icon.icon_state = "nutrition2" - if(150 to 250) nutrition_icon.icon_state = "nutrition3" - else nutrition_icon.icon_state = "nutrition4" - - if(hydration_icon) - switch(hydration) - if(450 to INFINITY) hydration_icon.icon_state = "hydration0" - if(350 to 450) hydration_icon.icon_state = "hydration1" - if(250 to 350) hydration_icon.icon_state = "hydration2" - if(150 to 250) hydration_icon.icon_state = "hydration3" - else hydration_icon.icon_state = "hydration4" - - if(isSynthetic()) - var/obj/item/organ/internal/cell/C = get_organ(BP_CELL, /obj/item/organ/internal/cell) - if(C) - var/chargeNum = clamp(CEILING(C.percent()/25), 0, 4) //0-100 maps to 0-4, but give it a paranoid clamp just in case. - cells.icon_state = "charge[chargeNum]" - else - cells.icon_state = "charge-empty" - - if(pressure) - pressure.icon_state = "pressure[pressure_alert]" - if(toxin) - toxin.icon_state = "tox[toxins_alert ? "1" : "0"]" - if(oxygen) - oxygen.icon_state = "oxy[oxygen_alert ? "1" : "0"]" - if(fire) - fire.icon_state = "fire[fire_alert ? fire_alert : 0]" - - if(bodytemp) - if (!species) - switch(bodytemperature) //310.055 optimal body temp - if(370 to INFINITY) bodytemp.icon_state = "temp4" - if(350 to 370) bodytemp.icon_state = "temp3" - if(335 to 350) bodytemp.icon_state = "temp2" - if(320 to 335) bodytemp.icon_state = "temp1" - if(300 to 320) bodytemp.icon_state = "temp0" - if(295 to 300) bodytemp.icon_state = "temp-1" - if(280 to 295) bodytemp.icon_state = "temp-2" - if(260 to 280) bodytemp.icon_state = "temp-3" - else bodytemp.icon_state = "temp-4" - else - var/heat_1 = get_temperature_threshold(HEAT_LEVEL_1) - var/cold_1 = get_temperature_threshold(COLD_LEVEL_1) - //TODO: precalculate all of this stuff when the species datum is created - var/base_temperature = species.body_temperature - if(base_temperature == null) //some species don't have a set metabolic temperature - base_temperature = (heat_1 + cold_1)/2 - - var/temp_step - if (bodytemperature >= base_temperature) - temp_step = (heat_1 - base_temperature)/4 - - if (bodytemperature >= heat_1) - bodytemp.icon_state = "temp4" - else if (bodytemperature >= base_temperature + temp_step*3) - bodytemp.icon_state = "temp3" - else if (bodytemperature >= base_temperature + temp_step*2) - bodytemp.icon_state = "temp2" - else if (bodytemperature >= base_temperature + temp_step*1) - bodytemp.icon_state = "temp1" - else - bodytemp.icon_state = "temp0" - - else if (bodytemperature < base_temperature) - temp_step = (base_temperature - cold_1)/4 - - if (bodytemperature <= cold_1) - bodytemp.icon_state = "temp-4" - else if (bodytemperature <= base_temperature - temp_step*3) - bodytemp.icon_state = "temp-3" - else if (bodytemperature <= base_temperature - temp_step*2) - bodytemp.icon_state = "temp-2" - else if (bodytemperature <= base_temperature - temp_step*1) - bodytemp.icon_state = "temp-1" - else - bodytemp.icon_state = "temp0" - return 1 + return TRUE /mob/living/carbon/human/handle_random_events() // Puke if toxloss is too high diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 0ea5406bcf89..4600a8685dd4 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -899,8 +899,10 @@ var/global/list/damage_icon_parts = list() hud_used.hidden_inventory_update() hud_used.persistant_inventory_update() update_action_buttons() - if(internals && internal) - internals.icon_state = "internal1" + if(internal) + var/obj/screen/internals = get_hud_element(/decl/hud_element/internals) + if(internals) + internals.icon_state = "internal1" queue_hand_rebuild() //Human Overlays Indexes///////// diff --git a/code/modules/mob/living/carbon/internals.dm b/code/modules/mob/living/carbon/internals.dm index c21f82f68b00..53912f7fbfec 100644 --- a/code/modules/mob/living/carbon/internals.dm +++ b/code/modules/mob/living/carbon/internals.dm @@ -4,5 +4,6 @@ /mob/living/carbon/set_internals(obj/item/tank/source, source_string) ..() internal = source + var/obj/screen/internals = get_hud_element(/decl/hud_element/internals) if(internals) internals.icon_state = "internal[!!internal]" diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 89090e9d1e02..8dc6fe671ff2 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -1,5 +1,7 @@ /mob/living/carbon/Life() - if(!..()) + + . = ..() + if(. == PROCESS_KILL) return // Increase germ_level regularly diff --git a/code/modules/mob/living/carbon/resist.dm b/code/modules/mob/living/carbon/resist.dm index 5356f4ed817c..26796ad652f5 100644 --- a/code/modules/mob/living/carbon/resist.dm +++ b/code/modules/mob/living/carbon/resist.dm @@ -33,7 +33,6 @@ return 1 /mob/living/carbon/proc/escape_handcuffs() - //if(!(last_special <= world.time)) return //This line represent a significant buff to grabs... // We don't have to check the click cooldown because /mob/living/verb/resist() has done it for us, we can simply set the delay diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index f3ad31eec725..01b171759ea2 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -42,7 +42,7 @@ if(IRRADIATE) apply_radiation(damage) - updatehealth() + update_health() return TRUE @@ -81,7 +81,7 @@ SET_STATUS_MAX(src, STAT_BLURRY, effect * blocked_mult(blocked)) if(DROWSY) SET_STATUS_MAX(src, STAT_DROWSY, effect * blocked_mult(blocked)) - updatehealth() + update_health() return TRUE /mob/living/proc/apply_effects(var/stun = 0, var/weaken = 0, var/paralyze = 0, var/stutter = 0, var/eyeblur = 0, var/drowsy = 0, var/agony = 0, var/blocked = 0) diff --git a/code/modules/mob/living/deity/deity.dm b/code/modules/mob/living/deity/deity.dm index f3a5f2ff9ddd..314a2fb03289 100644 --- a/code/modules/mob/living/deity/deity.dm +++ b/code/modules/mob/living/deity/deity.dm @@ -6,7 +6,7 @@ pixel_x = -128 pixel_y = -128 health = 100 - maxHealth = 100 //I dunno what to do with health at this point. + mob_default_max_health = 100 //I dunno what to do with health at this point. universal_understand = TRUE mob_sort_value = 5 diff --git a/code/modules/mob/living/deity/deity_phenomena.dm b/code/modules/mob/living/deity/deity_phenomena.dm index 02533e6186c9..aa720e0cd61d 100644 --- a/code/modules/mob/living/deity/deity_phenomena.dm +++ b/code/modules/mob/living/deity/deity_phenomena.dm @@ -18,8 +18,9 @@ /mob/living/deity/proc/silence(var/amount) if(!silenced) to_chat(src, "You've been silenced! Your phenomenas are disabled!") - var/obj/screen/intent/deity/SD = hud_used.action_intent - SD.color = "#ff0000" + var/obj/screen/intent/deity/SD = get_hud_element(/decl/hud_element/action_intent) + if(istype(SD)) + SD.color = "#ff0000" silenced += amount for(var/phenom in phenomenas) //Also make it so that you don't do cooldowns. var/datum/phenomena/P = phenomenas[phenom] @@ -27,16 +28,20 @@ P.refresh_time += amount /mob/living/deity/Life() + . = ..() - if(.) - if(silenced > 0) - silenced-- - if(!silenced) - to_chat(src, "You are no longer silenced.") - var/obj/screen/intent/deity/SD = hud_used.action_intent + if(. == PROCESS_KILL) + return + + if(silenced > 0) + silenced-- + if(!silenced) + to_chat(src, "You are no longer silenced.") + var/obj/screen/intent/deity/SD = get_hud_element(/decl/hud_element/action_intent) + if(istype(SD)) SD.color = null - if(power_per_regen < 0 || power < power_min) - adjust_power(power_per_regen) + if(power_per_regen < 0 || power < power_min) + adjust_power(power_per_regen) /mob/living/deity/Destroy() for(var/phenom in phenomenas) @@ -67,8 +72,9 @@ for(var/mod in intent_list) if(intent_list[mod] == P) intent_list[mod] = null - var/obj/screen/intent/deity/SD = hud_used.action_intent - SD.update_text() + var/obj/screen/intent/deity/SD = get_hud_element(/decl/hud_element/action_intent) + if(istype(SD)) + SD.update_text() update_phenomenas() update_phenomena_bindings() if(selected == to_remove) diff --git a/code/modules/mob/living/deity/menu/deity_nano.dm b/code/modules/mob/living/deity/menu/deity_nano.dm index 63053cac5ed2..c4d617d7e016 100644 --- a/code/modules/mob/living/deity/menu/deity_nano.dm +++ b/code/modules/mob/living/deity/menu/deity_nano.dm @@ -76,5 +76,6 @@ phenomena_bindings[++phenomena_bindings.len] = list("intent" = intent, "intent_data" = intent_data) nano_data["bindings"] = phenomena_bindings //Update the hud as well. - var/obj/screen/intent/deity/SD = hud_used.action_intent - SD.update_text() \ No newline at end of file + var/obj/screen/intent/deity/SD = get_hud_element(/decl/hud_element/action_intent) + if(istype(SD)) + SD.update_text() \ No newline at end of file diff --git a/code/modules/mob/living/deity/phenomena/communication.dm b/code/modules/mob/living/deity/phenomena/communication.dm index 72876f3f9e96..e06bea85bc02 100644 --- a/code/modules/mob/living/deity/phenomena/communication.dm +++ b/code/modules/mob/living/deity/phenomena/communication.dm @@ -26,7 +26,7 @@ /datum/phenomena/point/activate(var/atom/a) ..() if(!arrow) - arrow = image('icons/mob/screen1.dmi', icon_state = "arrow", layer = POINTER_LAYER) + arrow = image('icons/mob/screen/arrow.dmi', icon_state = "arrow", layer = POINTER_LAYER) var/turf/T = get_turf(a) arrow.loc = T var/list/view = view(7,T) diff --git a/code/modules/mob/living/deity/phenomena/conjuration.dm b/code/modules/mob/living/deity/phenomena/conjuration.dm index 86743865057e..90deec6d89fa 100644 --- a/code/modules/mob/living/deity/phenomena/conjuration.dm +++ b/code/modules/mob/living/deity/phenomena/conjuration.dm @@ -59,7 +59,7 @@ L.take_overall_damage(rand(5,30),0,0,0,"blunt intrument") //Actual spell does 5d10 but maaaybe too much. playsound(get_turf(L), 'sound/effects/bamf.ogg', 100, 1) to_chat(L, "Something hard hits you!") - if(L.health < L.maxHealth/2) //If it reduces past 50% + if(L.health < L.get_max_health()/2) //If it reduces past 50% var/obj/effect/rift/R = new(get_turf(L)) L.visible_message("\The [L] is quickly sucked into \a [R]!") L.forceMove(R) diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index c25f075b4198..c2482815f90f 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -48,14 +48,15 @@ var/last_slot = get_active_held_item_slot() if(slot != last_slot && (slot in get_held_item_slots())) _held_item_slot_selected = slot - for(var/obj/screen/inventory/hand in hud_used?.hand_hud_objects) - hand.cut_overlay("hand_selected") - if(hand.slot_id == slot) - hand.add_overlay("hand_selected") - hand.compile_overlays() - var/obj/item/I = get_active_hand() - if(istype(I)) - I.on_active_hand() + if(istype(hud_used)) + for(var/obj/screen/inventory/hand in hud_used.hand_hud_objects) + hand.cut_overlay("hand_selected") + if(hand.slot_id == slot) + hand.add_overlay("hand_selected") + hand.compile_overlays() + var/obj/item/I = get_active_hand() + if(istype(I)) + I.on_active_hand() // Defer proc for the sake of delimbing root limbs with multiple graspers (serpentid) /mob/living/proc/queue_hand_rebuild() diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 87ad5030e772..83d5778ef6ad 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -2,7 +2,9 @@ set invisibility = 0 set background = BACKGROUND_ENABLED - ..() + . = ..() + if(. == PROCESS_KILL) + return if (HasMovementHandler(/datum/movement_handler/mob/transformation/)) return @@ -121,7 +123,7 @@ LAZYREMOVE(chem_doses, T) if(apply_chemical_effects()) - updatehealth() + update_health() return TRUE @@ -191,7 +193,7 @@ //This updates the health and status of the mob (conscious, unconscious, dead) /mob/living/proc/handle_regular_status_updates() - updatehealth() + update_health() if(stat != DEAD) if(HAS_STATUS(src, STAT_PARA)) set_stat(UNCONSCIOUS) @@ -215,13 +217,25 @@ //this handles hud updates. Calls update_vision() and handle_hud_icons() /mob/living/proc/handle_regular_hud_updates() - if(!client) return 0 - + SHOULD_CALL_PARENT(TRUE) + if(machine && machine.check_eye(src) < 0) + reset_view(null) + if(!client) + return FALSE handle_hud_icons() handle_vision() handle_low_light_vision() - - return 1 + if(hud_used) + hud_used.update_icons() + if(stat != DEAD) + if(blinded) + overlay_fullscreen("blind", /obj/screen/fullscreen/blind) + else + clear_fullscreen("blind") + set_fullscreen(disabilities & NEARSIGHTED, "impaired", /obj/screen/fullscreen/impaired, 1) + set_fullscreen(GET_STATUS(src, STAT_BLURRY), "blurry", /obj/screen/fullscreen/blurry) + set_fullscreen(GET_STATUS(src, STAT_DRUGGY), "high", /obj/screen/fullscreen/high) + return TRUE /mob/living/proc/handle_low_light_vision() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 2b1e5698f3db..08ddaca6391e 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -179,22 +179,40 @@ default behaviour is: /mob/living/verb/succumb() set hidden = 1 - if ((src.health < src.maxHealth/2)) // Health below half of maxhealth. - src.adjustBrainLoss(src.health + src.maxHealth * 2) // Deal 2x health in BrainLoss damage, as before but variable. - updatehealth() + var/max_health = get_max_health() + if(health < max_health/2) // Health below half of maximum. + adjustBrainLoss(health + max_health * 2) // Deal 2x health in BrainLoss damage, as before but variable. + update_health() to_chat(src, "You have given up life and succumbed to death.") /mob/living/proc/update_body(var/update_icons=1) if(update_icons) queue_icon_update() -/mob/living/proc/updatehealth() +/mob/living/proc/update_health_hud() + if(!client || !hud_used) + return + hud_used.update_health_hud() + +/mob/living/proc/sum_health_damages() + return getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() - getHalLoss() + +/mob/living/proc/get_max_health() + var/decl/species/my_species = get_species() + return my_species ? my_species.total_health : mob_default_max_health + +/mob/living/proc/get_health_percent() + return health / get_max_health() + +/mob/living/proc/update_health() + var/lasthealth = health + health = get_max_health() if(status_flags & GODMODE) - health = maxHealth set_stat(CONSCIOUS) else - health = maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() - getHalLoss() - + health -= sum_health_damages() + if(health != lasthealth) + update_health_hud() //This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually //affects them once clothing is factored in. ~Errorage @@ -226,12 +244,12 @@ default behaviour is: return btemperature /mob/living/proc/getBruteLoss() - return maxHealth - health + return get_max_health() - health /mob/living/proc/adjustBruteLoss(var/amount) if (status_flags & GODMODE) return - health = clamp(health - amount, 0, maxHealth) + health = clamp(health - amount, 0, get_max_health()) /mob/living/proc/getOxyLoss() return 0 @@ -287,12 +305,6 @@ default behaviour is: /mob/living/proc/adjustCloneLoss(var/amount) return -/mob/living/proc/getMaxHealth() - return maxHealth - -/mob/living/proc/setMaxHealth(var/newMaxHealth) - maxHealth = newMaxHealth - // ++++ROCKDTBEN++++ MOB PROCS //END /mob/proc/get_contents() @@ -341,27 +353,28 @@ default behaviour is: /mob/living/proc/heal_organ_damage(var/brute, var/burn, var/affect_robo = FALSE) adjustBruteLoss(-brute) adjustFireLoss(-burn) - src.updatehealth() + update_health() // damage ONE external organ, organ gets randomly selected from damaged ones. /mob/living/proc/take_organ_damage(var/brute = 0, var/burn = 0, var/bypass_armour = FALSE, var/override_droplimb) if(!(status_flags & GODMODE)) adjustBruteLoss(brute) adjustFireLoss(burn) - updatehealth() + update_health() // heal MANY external organs, in random order /mob/living/proc/heal_overall_damage(var/brute, var/burn) adjustBruteLoss(-brute) adjustFireLoss(-burn) - src.updatehealth() + update_health() // damage MANY external organs, in random order /mob/living/proc/take_overall_damage(var/brute, var/burn, var/used_weapon = null) - if(status_flags & GODMODE) return 0 //godmode + if(status_flags & GODMODE) + return 0 adjustBruteLoss(brute) adjustFireLoss(burn) - src.updatehealth() + update_health() /mob/living/proc/restore_all_organs() return @@ -1150,6 +1163,18 @@ default behaviour is: . = max(20, .) return round(.) +/mob/living + /// Used by the resist verb and some mob abilities. + var/next_special_ability = 0 + +/mob/living/is_on_special_ability_cooldown() + return world.time < next_special_ability + +/mob/living/set_special_ability_cooldown(var/amt) + next_special_ability = max(next_special_ability, world.time+amt) + if(hud_used) + hud_used.set_hud_cooldown((world.time - next_special_ability)-1) // -1 so it visually resets one tick after cooldown. + /mob/living/proc/handle_some_updates() //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle return life_tick <= 5 || !timeofdeath || (timeofdeath >= 5 && (world.time-timeofdeath) <= 10 MINUTES) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index c3fba1660e92..44d90405ad6f 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -218,16 +218,13 @@ // End BS12 momentum-transfer code. /mob/living/attack_generic(var/mob/user, var/damage, var/attack_message) - if(!damage || !istype(user)) return - - adjustBruteLoss(damage) - admin_attack_log(user, src, "Attacked", "Was attacked", "attacked") - src.visible_message("\The [user] has [attack_message] \the [src]!") user.do_attack_animation(src) - spawn(1) updatehealth() + admin_attack_log(user, src, "Attacked", "Was attacked", "attacked") + adjustBruteLoss(damage) + update_health() return 1 /mob/living/proc/IgniteMob() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index a79e61a94762..9a0f663f5650 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -5,7 +5,7 @@ abstract_type = /mob/living //Health and life related vars - var/maxHealth = 100 //Maximum health that should be possible. + var/mob_default_max_health = 100 //Maximum health that should be possible. This can be modified in get_max_health() var/health = 100 //A mob's health var/hud_updateflag = 0 @@ -17,8 +17,6 @@ //var/fireloss = 0 //Burn damage caused by being way too hot, too cold or burnt. //var/halloss = 0 //Hallucination damage. 'Fake' damage obtained through hallucinating or the holodeck. Sleeping should cause it to wear off. - var/last_special = 0 //Used by the resist verb, likely used to prevent players from bypassing next_move by logging in/out. - var/now_pushing = null var/mob_bump_flag = 0 var/mob_swap_flags = 0 diff --git a/code/modules/mob/living/living_grabs.dm b/code/modules/mob/living/living_grabs.dm index a1f81129748c..4f5f099c44db 100644 --- a/code/modules/mob/living/living_grabs.dm +++ b/code/modules/mob/living/living_grabs.dm @@ -41,7 +41,8 @@ face_atom(target) var/obj/item/grab/grab - if(ispath(grab_tag, /decl/grab) && can_grab(target, get_target_zone(), defer_hand = defer_hand) && target.can_be_grabbed(src, get_target_zone(), defer_hand)) + var/target_zone = get_target_zone() + if(ispath(grab_tag, /decl/grab) && can_grab(target, target_zone, defer_hand = defer_hand) && target.can_be_grabbed(src, target_zone, defer_hand)) grab = new /obj/item/grab(src, target, grab_tag, defer_hand) if(QDELETED(grab)) diff --git a/code/modules/mob/living/living_organs.dm b/code/modules/mob/living/living_organs.dm index 13ef91d41def..a6b5d6904db2 100644 --- a/code/modules/mob/living/living_organs.dm +++ b/code/modules/mob/living/living_organs.dm @@ -26,7 +26,7 @@ //Only run install effects if we're not detached and we're not adding in place if(!in_place && !(O.status & ORGAN_CUT_AWAY)) on_gained_organ(O) - updatehealth() + update_health() return TRUE //Can be called when the organ is detached or attached. @@ -41,7 +41,7 @@ if(client) client.screen -= O - updatehealth() + update_health() if(drop_organ) var/drop_loc = get_turf(src) diff --git a/code/modules/mob/living/living_powers.dm b/code/modules/mob/living/living_powers.dm index 980eea00a948..a0fa52bfc540 100644 --- a/code/modules/mob/living/living_powers.dm +++ b/code/modules/mob/living/living_powers.dm @@ -21,15 +21,15 @@ set desc = "Infect others with your very breath." set category = "Abilities" - if (last_special > world.time) - to_chat(src, "You aren't ready to do that! Wait [round(last_special - world.time) / 10] seconds.") + if (is_on_special_ability_cooldown()) + to_chat(src, "You aren't ready to do that! Wait [round(next_special_ability - world.time) / 10] seconds.") return - + if (incapacitated()) to_chat(src, "You can't do that while you're incapacitated!") return - last_special = world.time + 60 SECONDS + set_special_ability_cooldown(60 SECONDS) var/turf/T = get_turf(src) var/obj/effect/effect/water/chempuff/chem = new(T) @@ -43,10 +43,10 @@ set desc = "Regain life by consuming it from others." set category = "Abilities" - if (last_special > world.time) - to_chat(src, "You aren't ready to do that! Wait [round(last_special - world.time) / 10] seconds.") + if (is_on_special_ability_cooldown()) + to_chat(src, "You aren't ready to do that! Wait [round(next_special_ability - world.time) / 10] seconds.") return - + if (incapacitated()) to_chat(src, "You can't do that while you're incapacitated!") return @@ -60,13 +60,13 @@ to_chat(src, "You aren't on top of a victim!") return - last_special = world.time + 5 SECONDS + set_special_ability_cooldown(5 SECONDS) src.visible_message("\The [src] hunkers down over \the [target], tearing into their flesh.") if(do_mob(src, target, 5 SECONDS)) to_chat(target,"\The [src] scrapes your flesh from your bones!") to_chat(src,"You feed hungrily off \the [target]'s flesh.") target.adjustBruteLoss(25) - if(target.getBruteLoss() < -target.maxHealth) + if(target.getBruteLoss() < -target.get_max_health()) target.gib() src.adjustBruteLoss(-25) \ No newline at end of file diff --git a/code/modules/mob/living/maneuvers/_maneuver.dm b/code/modules/mob/living/maneuvers/_maneuver.dm index cc48bae7b83b..e5187d9e091d 100644 --- a/code/modules/mob/living/maneuvers/_maneuver.dm +++ b/code/modules/mob/living/maneuvers/_maneuver.dm @@ -20,9 +20,9 @@ if(!silent) to_chat(user, SPAN_WARNING("You are not in position for maneuvering.")) return FALSE - if(world.time < user.last_special) + if(user.is_on_special_ability_cooldown()) if(!silent) - to_chat(user, SPAN_WARNING("You cannot maneuver again for another [FLOOR((user.last_special - world.time)*0.1)] second\s.")) + to_chat(user, SPAN_WARNING("You cannot maneuver again for another [FLOOR((user.next_special_ability - world.time)*0.1)] second\s.")) return FALSE if(user.get_stamina() < stamina_cost) if(!silent) @@ -40,6 +40,6 @@ user.face_atom(target) . = (!delay || reflexively || (do_after(user, delay) && can_be_used_by(user, target))) if(cooldown) - user.last_special = world.time + cooldown + user.set_special_ability_cooldown(cooldown) if(stamina_cost) user.adjust_stamina(stamina_cost) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index c26d8ae7ac15..d203adeb93c2 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -56,7 +56,7 @@ var/global/list/ai_verbs_default = list( density = 1 status_flags = CANSTUN|CANPARALYSE|CANPUSH shouldnt_see = list(/obj/effect/rune) - maxHealth = 200 + mob_default_max_health = 200 var/obj/machinery/camera/camera = null var/list/connected_robots = list() var/aiRestorePowerRoutine = 0 diff --git a/code/modules/mob/living/silicon/ai/ai_damage.dm b/code/modules/mob/living/silicon/ai/ai_damage.dm index 087e8ecafcbf..88f5648d8d4b 100644 --- a/code/modules/mob/living/silicon/ai/ai_damage.dm +++ b/code/modules/mob/living/silicon/ai/ai_damage.dm @@ -22,7 +22,7 @@ /mob/living/silicon/ai/adjustOxyLoss(var/amount) if(status_flags & GODMODE) return - oxyloss = max(0, oxyloss + min(amount, maxHealth - oxyloss)) + oxyloss = max(0, oxyloss + min(amount, get_max_health() - oxyloss)) /mob/living/silicon/ai/setFireLoss(var/amount) if(status_flags & GODMODE) @@ -36,13 +36,13 @@ return oxyloss = max(0, amount) -/mob/living/silicon/ai/updatehealth() +/mob/living/silicon/ai/update_health() + ..() if(status_flags & GODMODE) - health = maxHealth - set_stat(CONSCIOUS) setOxyLoss(0) - else - health = maxHealth - getFireLoss() - getBruteLoss() // Oxyloss is not part of health as it represents AIs backup power. AI is immune against ToxLoss as it is machine. + +/mob/living/silicon/ai/sum_health_damages() + return getFireLoss()+getBruteLoss() // Oxyloss is not part of health as it represents AIs backup power. AI is immune against ToxLoss as it is machine. /mob/living/silicon/ai/rejuvenate() ..() @@ -50,8 +50,9 @@ // Returns percentage of AI's remaining backup capacitor charge (maxhealth - oxyloss). /mob/living/silicon/ai/proc/backup_capacitor() - return ((getOxyLoss() - maxHealth) / maxHealth) * (-100) + var/max_health = get_max_health() + return ((getOxyLoss() - max_health) / max_health) * (-100) // Returns percentage of AI's remaining hardware integrity (maxhealth - (bruteloss + fireloss)) /mob/living/silicon/ai/proc/hardware_integrity() - return (health / maxHealth) * 100 \ No newline at end of file + return (health / get_max_health()) * 100 \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index ad521094fa59..b8be06d6ff4b 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -5,11 +5,13 @@ if (src.stat == DEAD) return + CLEAR_HUD_ALERTS(src) + if (src.stat!=CONSCIOUS) src.cameraFollow = null src.reset_view(null) - src.updatehealth() + update_health() if ((hardware_integrity() <= 0) || (backup_capacitor() <= 0)) death() diff --git a/code/modules/mob/living/silicon/pai/life.dm b/code/modules/mob/living/silicon/pai/life.dm index f3697bfefe9c..160415343cc4 100644 --- a/code/modules/mob/living/silicon/pai/life.dm +++ b/code/modules/mob/living/silicon/pai/life.dm @@ -5,6 +5,8 @@ if (src.stat == DEAD) return + CLEAR_HUD_ALERTS(src) + if(src.cable) if(get_dist(src, cable) > 1) visible_message( \ @@ -32,9 +34,5 @@ if(health <= 0) death(null,"gives one shrill beep before falling lifeless.") -/mob/living/silicon/pai/updatehealth() - if(status_flags & GODMODE) - health = 100 - set_stat(CONSCIOUS) - else - health = 100 - getBruteLoss() - getFireLoss() \ No newline at end of file +/mob/living/silicon/pai/sum_health_damages() + return getBruteLoss() - getFireLoss() diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 20c4184c1a62..1f70e1fb4138 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -24,10 +24,11 @@ var/global/list/possible_say_verbs = list( icon = 'icons/mob/robots/pai/pai_drone.dmi' icon_state = ICON_STATE_WORLD mob_sort_value = 3 - hud_type = /datum/hud/pai + hud_used = /datum/hud/pai emote_type = 2 // pAIs emotes are heard, not seen, so they can be seen through a container (eg. person) pass_flags = PASS_FLAG_TABLE mob_size = MOB_SIZE_SMALL + mob_default_max_health = 100 can_pull_size = ITEM_SIZE_SMALL can_pull_mobs = MOB_PULL_SMALLER @@ -170,9 +171,9 @@ var/global/list/possible_say_verbs = list( return if(loc != card) return - if(world.time <= last_special) + if(is_on_special_ability_cooldown()) return - last_special = world.time + 100 + set_special_ability_cooldown(10 SECONDS) //I'm not sure how much of this is necessary, but I would rather avoid issues. if(istype(card.loc,/obj/item/rig_module) || istype(card.loc,/obj/item/integrated_circuit/manipulation/ai/)) to_chat(src, "There is no room to unfold inside \the [card.loc]. You're good and stuck.") @@ -211,9 +212,9 @@ var/global/list/possible_say_verbs = list( if(loc == card) return - if(world.time <= last_special) + if(is_on_special_ability_cooldown()) return - last_special = world.time + 100 + set_special_ability_cooldown(10 SECONDS) // Move us into the card and move the card to the ground. resting = 0 @@ -266,7 +267,7 @@ var/global/list/possible_say_verbs = list( if(W.force) visible_message(SPAN_DANGER("[user] attacks [src] with [W]!")) adjustBruteLoss(W.force) - updatehealth() + update_health() else visible_message(SPAN_WARNING("[user] bonks [src] harmlessly with [W].")) diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index 045ae38ab611..79830c211616 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -2,7 +2,7 @@ name = "maintenance drone" real_name = "drone" icon = 'icons/mob/robots/drones/drone.dmi' - maxHealth = 35 + mob_default_max_health = 35 health = 35 cell_emp_mult = 1 universal_speak = FALSE @@ -239,15 +239,6 @@ return 1 //DRONE LIFE/DEATH -//For some goddamn reason robots have this hardcoded. Redefining it for our fragile friends here. -/mob/living/silicon/robot/drone/updatehealth() - if(status_flags & GODMODE) - health = 35 - set_stat(CONSCIOUS) - return - health = 35 - (getBruteLoss() + getFireLoss()) - return - //Easiest to check this here, then check again in the robot proc. //Standard robots use config for crit, which is somewhat excessive for these guys. //Drones killed by damage will gib. diff --git a/code/modules/mob/living/silicon/robot/drone/drone_damage.dm b/code/modules/mob/living/silicon/robot/drone/drone_damage.dm index db105871c135..42a5aa0ab3c5 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_damage.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_damage.dm @@ -6,14 +6,16 @@ /mob/living/silicon/robot/drone/take_overall_damage(var/brute = 0, var/burn = 0, var/sharp = 0, var/used_weapon = null) bruteloss += brute fireloss += burn + update_health() /mob/living/silicon/robot/drone/heal_overall_damage(var/brute, var/burn) - bruteloss -= brute fireloss -= burn - - if(bruteloss<0) bruteloss = 0 - if(fireloss<0) fireloss = 0 + if(bruteloss<0) + bruteloss = 0 + if(fireloss<0) + fireloss = 0 + update_health() /mob/living/silicon/robot/drone/take_organ_damage(var/brute = 0, var/burn = 0, var/bypass_armour = FALSE, var/override_droplimb) take_overall_damage(brute, burn) diff --git a/code/modules/mob/living/silicon/robot/flying/flying.dm b/code/modules/mob/living/silicon/robot/flying/flying.dm index b242c869bb75..789729d7aa14 100644 --- a/code/modules/mob/living/silicon/robot/flying/flying.dm +++ b/code/modules/mob/living/silicon/robot/flying/flying.dm @@ -22,7 +22,11 @@ components["armour"] = new/datum/robot_component/armour/light(src) /mob/living/silicon/robot/flying/Life() + . = ..() + if(. == PROCESS_KILL) + return + if(incapacitated() || !is_component_functioning("actuator")) stop_flying() else diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 1cda2988932c..4374afd29e3f 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -10,6 +10,8 @@ src.blinded = null + CLEAR_HUD_ALERTS(src) + //Status updates, death etc. clamp_values() handle_regular_status_updates() @@ -69,7 +71,7 @@ set_light(0) /mob/living/silicon/robot/handle_regular_status_updates() - updatehealth() + update_health() if(HAS_STATUS(src, STAT_ASLEEP)) SET_STATUS_MAX(src, STAT_PARA, 3) @@ -130,8 +132,8 @@ return 1 /mob/living/silicon/robot/handle_regular_hud_updates() - ..() - + if(!..()) + return var/obj/item/borg/sight/hud/hud = (locate(/obj/item/borg/sight/hud) in src) if(hud && hud.hud) hud.hud.process_hud(src) @@ -142,51 +144,6 @@ if (MED_HUD) process_med_hud(src,0,network = get_computer_network()) - if(length(get_active_grabs())) - ui_drop_grab.invisibility = 0 - ui_drop_grab.alpha = 255 - else - ui_drop_grab.invisibility = INVISIBILITY_MAXIMUM - ui_drop_grab.alpha = 0 - - if (src.healths) - if (src.stat != 2) - if(istype(src,/mob/living/silicon/robot/drone)) - switch(health) - if(35 to INFINITY) - src.healths.icon_state = "health0" - if(25 to 34) - src.healths.icon_state = "health1" - if(15 to 24) - src.healths.icon_state = "health2" - if(5 to 14) - src.healths.icon_state = "health3" - if(0 to 4) - src.healths.icon_state = "health4" - if(-35 to 0) - src.healths.icon_state = "health5" - else - src.healths.icon_state = "health6" - else - switch(health) - if(200 to INFINITY) - src.healths.icon_state = "health0" - if(150 to 200) - src.healths.icon_state = "health1" - if(100 to 150) - src.healths.icon_state = "health2" - if(50 to 100) - src.healths.icon_state = "health3" - if(0 to 50) - src.healths.icon_state = "health4" - else - if(health > config.health_threshold_dead) - src.healths.icon_state = "health5" - else - src.healths.icon_state = "health6" - else - src.healths.icon_state = "health7" - if (src.syndicate && src.client) var/decl/special_role/traitors = GET_DECL(/decl/special_role/traitor) for(var/datum/mind/tra in traitors.current_antagonists) @@ -197,55 +154,7 @@ src.disconnect_from_ai() if(src.mind) traitors.add_antagonist_mind(mind) - - if (src.cells) - if (src.cell) - var/chargeNum = clamp(CEILING(cell.percent()/25), 0, 4) //0-100 maps to 0-4, but give it a paranoid clamp just in case. - src.cells.icon_state = "charge[chargeNum]" - else - src.cells.icon_state = "charge-empty" - - if(bodytemp) - switch(src.bodytemperature) //310.055 optimal body temp - if(335 to INFINITY) - src.bodytemp.icon_state = "temp2" - if(320 to 335) - src.bodytemp.icon_state = "temp1" - if(300 to 320) - src.bodytemp.icon_state = "temp0" - if(260 to 300) - src.bodytemp.icon_state = "temp-1" - else - src.bodytemp.icon_state = "temp-2" - - var/datum/gas_mixture/environment = loc?.return_air() - if(fire && environment) - switch(environment.temperature) - if(-INFINITY to T100C) - src.fire.icon_state = "fire0" - else - src.fire.icon_state = "fire1" - if(oxygen && environment) - var/decl/species/species = all_species[global.using_map.default_species] - if(!species.breath_type || environment.gas[species.breath_type] >= species.breath_pressure) - src.oxygen.icon_state = "oxy0" - for(var/gas in species.poison_types) - if(environment.gas[gas]) - src.oxygen.icon_state = "oxy1" - break - else - src.oxygen.icon_state = "oxy1" - - if(stat != DEAD) - if(blinded) - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - else - clear_fullscreen("blind") - set_fullscreen(disabilities & NEARSIGHTED, "impaired", /obj/screen/fullscreen/impaired, 1) - set_fullscreen(GET_STATUS(src, STAT_BLURRY), "blurry", /obj/screen/fullscreen/blurry) - set_fullscreen(GET_STATUS(src, STAT_DRUGGY), "high", /obj/screen/fullscreen/high) - - return 1 + return TRUE /mob/living/silicon/robot/handle_vision() ..() diff --git a/code/modules/mob/living/silicon/robot/modules/module_illegal.dm b/code/modules/mob/living/silicon/robot/modules/module_illegal.dm index c456f676bf29..8ff7ce3a7b5d 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_illegal.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_illegal.dm @@ -27,9 +27,8 @@ equipment += id /obj/item/robot_module/syndicate/finalize_equipment(var/mob/living/silicon/robot/R) - var/obj/item/tank/jetpack/carbondioxide/jetpack = locate() in equipment - R.internals = jetpack . = ..() + R.set_internals(locate(/obj/item/tank/jetpack/carbondioxide) in equipment) /obj/item/robot_module/syndicate/Destroy() equipment -= id diff --git a/code/modules/mob/living/silicon/robot/modules/module_maintenance_drone.dm b/code/modules/mob/living/silicon/robot/modules/module_maintenance_drone.dm index 012206fe5ee7..7e5407c89f32 100644 --- a/code/modules/mob/living/silicon/robot/modules/module_maintenance_drone.dm +++ b/code/modules/mob/living/silicon/robot/modules/module_maintenance_drone.dm @@ -60,8 +60,7 @@ /obj/item/robot_module/drone/finalize_equipment(var/mob/living/silicon/robot/R) . = ..() - if(istype(R)) - R.internals = locate(/obj/item/tank/jetpack/carbondioxide) in equipment + R.set_internals(locate(/obj/item/tank/jetpack/carbondioxide) in equipment) /obj/item/robot_module/drone/finalize_emag() . = ..() diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 74cf4aae5a62..8bec0e545cd0 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -5,7 +5,7 @@ real_name = "robot" icon = 'icons/mob/robots/robot.dmi' icon_state = ICON_STATE_WORLD - maxHealth = 300 + mob_default_max_health = 300 health = 300 mob_sort_value = 4 @@ -38,7 +38,6 @@ var/obj/screen/inv1 = null var/obj/screen/inv2 = null var/obj/screen/inv3 = null - var/obj/screen/robot_drop_grab/ui_drop_grab var/shown_robot_modules = 0 //Used to determine whether they have the module menu shown or not var/obj/screen/robot_modules_background @@ -200,6 +199,7 @@ //If there's an MMI in the robot, have it ejected when the mob goes away. --NEO //Improved /N /mob/living/silicon/robot/Destroy() + QDEL_NULL(hands) if(mmi)//Safety for when a cyborg gets dust()ed. Or there is no MMI inside. if(mind) mmi.dropInto(loc) @@ -505,7 +505,7 @@ if (WT.weld(0)) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) adjustBruteLoss(-30) - updatehealth() + update_health() add_fingerprint(user) user.visible_message(SPAN_NOTICE("\The [user] has fixed some of the dents on \the [src]!")) else @@ -520,7 +520,7 @@ if (coil.use(1)) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) adjustFireLoss(-30) - updatehealth() + update_health() user.visible_message(SPAN_NOTICE("\The [user] has fixed some of the burnt wires on \the [src]!")) else if(IS_CROWBAR(W) && user.a_intent != I_HURT) // crowbar means open or close the cover - we all know what a crowbar is by now diff --git a/code/modules/mob/living/silicon/robot/robot_damage.dm b/code/modules/mob/living/silicon/robot/robot_damage.dm index cb83947ce63b..e6c3e6674410 100644 --- a/code/modules/mob/living/silicon/robot/robot_damage.dm +++ b/code/modules/mob/living/silicon/robot/robot_damage.dm @@ -1,10 +1,5 @@ -/mob/living/silicon/robot/updatehealth() - if(status_flags & GODMODE) - health = maxHealth - stat = CONSCIOUS - return - health = maxHealth - (getBruteLoss() + getFireLoss()) - return +/mob/living/silicon/robot/sum_health_damages() + return getBruteLoss() + getFireLoss() /mob/living/silicon/robot/getBruteLoss() var/amount = 0 @@ -61,6 +56,7 @@ if(!parts.len) return var/datum/robot_component/picked = pick(parts) picked.heal_damage(brute,burn) + update_health() /mob/living/silicon/robot/take_organ_damage(var/brute = 0, var/burn = 0, var/bypass_armour = FALSE, var/override_droplimb) var/list/components = get_damageable_components() @@ -88,31 +84,29 @@ var/datum/robot_component/armour/A = get_armour() if(A) A.take_damage(brute, burn) + update_health() return var/datum/robot_component/C = pick(components) C.take_damage(brute, burn) + update_health() /mob/living/silicon/robot/heal_overall_damage(var/brute, var/burn) var/list/datum/robot_component/parts = get_damaged_components(brute,burn) - while(parts.len && (brute>0 || burn>0) ) var/datum/robot_component/picked = pick(parts) - var/brute_was = picked.brute_damage var/burn_was = picked.electronics_damage - picked.heal_damage(brute,burn) - brute -= (brute_was-picked.brute_damage) burn -= (burn_was-picked.electronics_damage) - parts -= picked + update_health() /mob/living/silicon/robot/take_overall_damage(var/brute = 0, var/burn = 0, var/sharp = 0, var/used_weapon = null) - if(status_flags & GODMODE) return //godmode + if(status_flags & GODMODE) + return var/list/datum/robot_component/parts = get_damageable_components() - //Combat shielding absorbs a percentage of damage directly into the cell. if(module_active && istype(module_active,/obj/item/borg/combat/shield)) var/obj/item/borg/combat/shield/shield = module_active @@ -137,16 +131,13 @@ while(parts.len && (brute>0 || burn>0) ) var/datum/robot_component/picked = pick(parts) - var/brute_was = picked.brute_damage var/burn_was = picked.electronics_damage - picked.take_damage(brute,burn) - brute -= (picked.brute_damage - brute_was) burn -= (picked.electronics_damage - burn_was) - parts -= picked + update_health() /mob/living/silicon/robot/emp_act(severity) uneq_all() diff --git a/code/modules/mob/living/silicon/robot/robot_movement.dm b/code/modules/mob/living/silicon/robot/robot_movement.dm index 6b5f1c2cd756..d617a98afd25 100644 --- a/code/modules/mob/living/silicon/robot/robot_movement.dm +++ b/code/modules/mob/living/silicon/robot/robot_movement.dm @@ -15,15 +15,7 @@ return 1 . = ..() - -/mob/living/silicon/robot/Move() - . = ..() - if(. && client) - - var/turf/B = GetAbove(src) - up_hint.icon_state = "uphint[!!(B && TURF_IS_MIMICKING(B))]" - - //No longer needed, but I'll leave it here incase we plan to re-use it. +//No longer needed, but I'll leave it here incase we plan to re-use it. /mob/living/silicon/robot/get_movement_delay(var/travel_dir) var/tally = ..() //Incase I need to add stuff other than "speed" later diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 0a1ce0d842fe..ffeb160a629d 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -143,7 +143,7 @@ adjustFireLoss(Proj.damage) Proj.on_hit(src,100) //wow this is a terrible hack - updatehealth() + update_health() return 100 /mob/living/silicon/apply_effect(var/effect = 0,var/effecttype = STUN, var/blocked = 0) @@ -160,7 +160,7 @@ // this function shows the health of the AI in the Status panel /mob/living/silicon/proc/show_system_integrity() if(!src.stat) - stat(null, text("System integrity: [round((health/maxHealth)*100)]%")) + stat(null, text("System integrity: [round((health/get_max_health())*100)]%")) else stat(null, text("Systems nonfunctional")) diff --git a/code/modules/mob/living/simple_animal/aquatic/_aquatic.dm b/code/modules/mob/living/simple_animal/aquatic/_aquatic.dm index 4eb23d4acfda..637ebebc4506 100644 --- a/code/modules/mob/living/simple_animal/aquatic/_aquatic.dm +++ b/code/modules/mob/living/simple_animal/aquatic/_aquatic.dm @@ -25,10 +25,12 @@ reset_offsets(0) /mob/living/simple_animal/aquatic/Life() + . = ..() + if(. == PROCESS_KILL) + return if(!submerged()) walk(src, 0) SET_STATUS_MAX(src, STAT_PARA, 3) - . = ..() update_icon() /mob/living/simple_animal/aquatic/on_update_icon() diff --git a/code/modules/mob/living/simple_animal/aquatic/_aquatic_hostile.dm b/code/modules/mob/living/simple_animal/aquatic/_aquatic_hostile.dm index 6d49fd979340..d840082051ab 100644 --- a/code/modules/mob/living/simple_animal/aquatic/_aquatic_hostile.dm +++ b/code/modules/mob/living/simple_animal/aquatic/_aquatic_hostile.dm @@ -14,10 +14,12 @@ minbodytemp = 0 /mob/living/simple_animal/hostile/aquatic/Life() + . = ..() + if(. == PROCESS_KILL) + return if(!submerged()) walk(src, 0) SET_STATUS_MAX(src, STAT_PARA, 3) - . = ..() update_icon() /mob/living/simple_animal/hostile/aquatic/on_update_icon() diff --git a/code/modules/mob/living/simple_animal/aquatic/_aquatic_retaliate.dm b/code/modules/mob/living/simple_animal/aquatic/_aquatic_retaliate.dm index aec04a20a5a0..9c0c184320bc 100644 --- a/code/modules/mob/living/simple_animal/aquatic/_aquatic_retaliate.dm +++ b/code/modules/mob/living/simple_animal/aquatic/_aquatic_retaliate.dm @@ -14,10 +14,12 @@ minbodytemp = 0 /mob/living/simple_animal/hostile/retaliate/aquatic/Life() + . = ..() + if(. == PROCESS_KILL) + return if(!submerged()) walk(src, 0) SET_STATUS_MAX(src, STAT_PARA, 3) - . = ..() update_icon() /mob/living/simple_animal/hostile/retaliate/aquatic/on_update_icon() diff --git a/code/modules/mob/living/simple_animal/aquatic/aquatic_carp.dm b/code/modules/mob/living/simple_animal/aquatic/aquatic_carp.dm index 31b9149e34d4..9d4eded3eee6 100644 --- a/code/modules/mob/living/simple_animal/aquatic/aquatic_carp.dm +++ b/code/modules/mob/living/simple_animal/aquatic/aquatic_carp.dm @@ -3,7 +3,7 @@ desc = "A ferocious fish. May be too hardcore." icon = 'icons/mob/simple_animal/fish_carp.dmi' faction = "fishes" - maxHealth = 20 + mob_default_max_health = 20 health = 20 meat_type = /obj/item/chems/food/fish/carp diff --git a/code/modules/mob/living/simple_animal/aquatic/aquatic_fish.dm b/code/modules/mob/living/simple_animal/aquatic/aquatic_fish.dm index 6e9debe91740..e12c057575d2 100644 --- a/code/modules/mob/living/simple_animal/aquatic/aquatic_fish.dm +++ b/code/modules/mob/living/simple_animal/aquatic/aquatic_fish.dm @@ -2,7 +2,7 @@ name = "small fish" desc = "Glub glub." faction = "fishes" - maxHealth = 10 + mob_default_max_health = 10 health = 10 mob_size = MOB_SIZE_TINY can_pull_size = 0 diff --git a/code/modules/mob/living/simple_animal/aquatic/aquatic_sharks.dm b/code/modules/mob/living/simple_animal/aquatic/aquatic_sharks.dm index f88940480cfe..93222fa2e423 100644 --- a/code/modules/mob/living/simple_animal/aquatic/aquatic_sharks.dm +++ b/code/modules/mob/living/simple_animal/aquatic/aquatic_sharks.dm @@ -2,7 +2,7 @@ name = "shark" desc = "A ferocious fish with many, many teeth." icon = 'icons/mob/simple_animal/shark.dmi' - maxHealth = 150 + mob_default_max_health = 150 health = 150 natural_weapon = /obj/item/natural_weapon/bite/shark break_stuff_probability = 15 @@ -29,7 +29,7 @@ mob_size = MOB_SIZE_LARGE pixel_x = -16 health = 400 - maxHealth = 400 + mob_default_max_health = 400 harm_intent_damage = 5 natural_weapon = /obj/item/natural_weapon/bite/giantshark break_stuff_probability = 35 diff --git a/code/modules/mob/living/simple_animal/constructs/constructs.dm b/code/modules/mob/living/simple_animal/constructs/constructs.dm index e42bc8a005a3..a236ee9c6ec9 100644 --- a/code/modules/mob/living/simple_animal/constructs/constructs.dm +++ b/code/modules/mob/living/simple_animal/constructs/constructs.dm @@ -65,7 +65,7 @@ /mob/living/simple_animal/construct/attack_animal(var/mob/user) if(istype(user, /mob/living/simple_animal/construct/builder)) - if(health < maxHealth) + if(health < get_max_health()) adjustBruteLoss(-5) user.visible_message("\The [user] mends some of \the [src]'s wounds.") else @@ -75,8 +75,9 @@ /mob/living/simple_animal/construct/show_other_examine_strings(mob/user, distance, infix, suffix, hideflags, decl/pronouns/pronouns) . = ..(user) - if(health < maxHealth) - if(health >= maxHealth/2) + var/max_health = get_max_health() + if(health < max_health) + if(health >= max_health/2) to_chat(user, SPAN_WARNING("It looks slightly dented.")) else to_chat(user, SPAN_DANGER("It looks severely dented!")) @@ -98,7 +99,7 @@ real_name = "Juggernaut" desc = "A possessed suit of armour driven by the will of the restless dead" icon = 'icons/mob/simple_animal/construct_behemoth.dmi' - maxHealth = 250 + mob_default_max_health = 250 health = 250 speak_emote = list("rumbles") response_harm = "harmlessly punches" @@ -120,9 +121,10 @@ force = 30 /mob/living/simple_animal/construct/armoured/Life() - set_status(STAT_WEAK, 0) - if ((. = ..())) + . = ..() + if(. == PROCESS_KILL) return + set_status(STAT_WEAK, 0) /mob/living/simple_animal/construct/armoured/bullet_act(var/obj/item/projectile/P) if(istype(P, /obj/item/projectile/energy) || istype(P, /obj/item/projectile/beam)) @@ -156,7 +158,7 @@ real_name = "Wraith" desc = "A wicked bladed shell contraption piloted by a bound spirit" icon = 'icons/mob/simple_animal/construct_floating.dmi' - maxHealth = 75 + mob_default_max_health = 75 health = 75 natural_weapon = /obj/item/natural_weapon/wraith speed = -1 @@ -181,7 +183,7 @@ real_name = "Artificer" desc = "A bulbous construct dedicated to building and maintaining The Cult of Nar-Sie's armies" icon = 'icons/mob/simple_animal/construct_artificer.dmi' - maxHealth = 50 + mob_default_max_health = 50 health = 50 response_harm = "viciously beaten" harm_intent_damage = 5 @@ -208,7 +210,7 @@ real_name = "Behemoth" desc = "The pinnacle of occult technology, Behemoths are the ultimate weapon in the Cult of Nar-Sie's arsenal." icon = 'icons/mob/simple_animal/construct_behemoth.dmi' - maxHealth = 750 + mob_default_max_health = 750 health = 750 speak_emote = list("rumbles") response_harm = "harmlessly punches" @@ -232,7 +234,7 @@ real_name = "Harvester" desc = "The promised reward of the livings who follow Nar-Sie. Obtained by offering their bodies to the geometer of blood" icon = 'icons/mob/simple_animal/construct_harvester.dmi' - maxHealth = 150 + mob_default_max_health = 150 health = 150 natural_weapon = /obj/item/natural_weapon/harvester speed = -1 @@ -250,81 +252,3 @@ hitsound = 'sound/weapons/pierce.ogg' sharp = TRUE force = 25 - -////////////////HUD////////////////////// - -/mob/living/simple_animal/construct/Life() - . = ..() - if(.) - if(fire) - fire.icon_state = "fire[!!fire_alert]" - silence_spells(purge) - -/mob/living/simple_animal/construct/armoured/Life() - . = ..() - if(healths) - switch(health) - if(250 to INFINITY) healths.icon_state = "juggernaut_health0" - if(208 to 249) healths.icon_state = "juggernaut_health1" - if(167 to 207) healths.icon_state = "juggernaut_health2" - if(125 to 166) healths.icon_state = "juggernaut_health3" - if(84 to 124) healths.icon_state = "juggernaut_health4" - if(42 to 83) healths.icon_state = "juggernaut_health5" - if(1 to 41) healths.icon_state = "juggernaut_health6" - else healths.icon_state = "juggernaut_health7" - - -/mob/living/simple_animal/construct/behemoth/Life() - . = ..() - if(healths) - switch(health) - if(750 to INFINITY) healths.icon_state = "juggernaut_health0" - if(625 to 749) healths.icon_state = "juggernaut_health1" - if(500 to 624) healths.icon_state = "juggernaut_health2" - if(375 to 499) healths.icon_state = "juggernaut_health3" - if(250 to 374) healths.icon_state = "juggernaut_health4" - if(125 to 249) healths.icon_state = "juggernaut_health5" - if(1 to 124) healths.icon_state = "juggernaut_health6" - else healths.icon_state = "juggernaut_health7" - -/mob/living/simple_animal/construct/builder/Life() - . = ..() - if(healths) - switch(health) - if(50 to INFINITY) healths.icon_state = "artificer_health0" - if(42 to 49) healths.icon_state = "artificer_health1" - if(34 to 41) healths.icon_state = "artificer_health2" - if(26 to 33) healths.icon_state = "artificer_health3" - if(18 to 25) healths.icon_state = "artificer_health4" - if(10 to 17) healths.icon_state = "artificer_health5" - if(1 to 9) healths.icon_state = "artificer_health6" - else healths.icon_state = "artificer_health7" - - - -/mob/living/simple_animal/construct/wraith/Life() - . = ..() - if(healths) - switch(health) - if(75 to INFINITY) healths.icon_state = "wraith_health0" - if(62 to 74) healths.icon_state = "wraith_health1" - if(50 to 61) healths.icon_state = "wraith_health2" - if(37 to 49) healths.icon_state = "wraith_health3" - if(25 to 36) healths.icon_state = "wraith_health4" - if(12 to 24) healths.icon_state = "wraith_health5" - if(1 to 11) healths.icon_state = "wraith_health6" - else healths.icon_state = "wraith_health7" - - -/mob/living/simple_animal/construct/harvester/Life() - . = ..() - if(healths) - switch(health) - if(150 to INFINITY) healths.icon_state = "harvester_health0" - if(125 to 149) healths.icon_state = "harvester_health1" - if(100 to 124) healths.icon_state = "harvester_health2" - if(75 to 99) healths.icon_state = "harvester_health3" - if(50 to 74) healths.icon_state = "harvester_health4" - if(25 to 49) healths.icon_state = "harvester_health5" - if(1 to 24) healths.icon_state = "harvester_health6" - else healths.icon_state = "harvester_health7" diff --git a/code/modules/mob/living/simple_animal/familiars/familiars.dm b/code/modules/mob/living/simple_animal/familiars/familiars.dm index 5778aa1450ca..969310a10b7e 100644 --- a/code/modules/mob/living/simple_animal/familiars/familiars.dm +++ b/code/modules/mob/living/simple_animal/familiars/familiars.dm @@ -23,12 +23,9 @@ name = "carcinus" desc = "A small crab said to be made of stone and starlight." icon = 'icons/mob/simple_animal/evilcrab.dmi' - speak_emote = list("chitters","clicks") - - health = 200 - maxHealth = 200 + mob_default_max_health = 200 natural_weapon = /obj/item/natural_weapon/pincers/strong resistance = 9 can_escape = TRUE //snip snip @@ -48,7 +45,7 @@ speak_emote = list("gnashes") health = 100 - maxHealth = 100 + mob_default_max_health = 100 natural_weapon = /obj/item/natural_weapon/bite can_escape = TRUE @@ -69,7 +66,7 @@ response_help_3p = "$USER$ thinks better of touching $TARGET$." health = 150 - maxHealth = 150 + mob_default_max_health = 150 natural_weapon = /obj/item/natural_weapon/horror wizardy_spells = list(/spell/targeted/torment) @@ -95,7 +92,7 @@ speak_emote = list("entones") mob_size = MOB_SIZE_SMALL health = 25 - maxHealth = 25 + mob_default_max_health = 25 wizardy_spells = list( /spell/targeted/heal_target, /spell/targeted/heal_target/area @@ -114,7 +111,7 @@ response_harm = "stamps on" health = 15 - maxHealth = 15 + mob_default_max_health = 15 natural_weapon = /obj/item/natural_weapon/bite/mouse can_escape = TRUE @@ -134,6 +131,6 @@ holder_type = /obj/item/holder mob_size = MOB_SIZE_SMALL health = 25 - maxHealth = 25 + mob_default_max_health = 25 natural_weapon = /obj/item/natural_weapon/claws/weak wizardy_spells = list(/spell/targeted/subjugation) diff --git a/code/modules/mob/living/simple_animal/friendly/crab.dm b/code/modules/mob/living/simple_animal/friendly/crab.dm index 6453a332028b..b444b9362b3b 100644 --- a/code/modules/mob/living/simple_animal/friendly/crab.dm +++ b/code/modules/mob/living/simple_animal/friendly/crab.dm @@ -32,15 +32,14 @@ /mob/living/simple_animal/crab/Life() . = ..() - if(!.) - return FALSE - //CRAB movement - if(!ckey && !stat) - if(isturf(src.loc) && !resting && !buckled) //This is so it only moves if it's not inside a closet, gentics machine, etc. - turns_since_move++ - if(turns_since_move >= turns_per_move) - Move(get_step(src,pick(4,8))) - turns_since_move = 0 + if(. == PROCESS_KILL) + return + //TODO: crab AI + if(!ckey && !stat && isturf(src.loc) && !resting && !buckled) //This is so it only moves if it's not inside a closet, gentics machine, etc. + turns_since_move++ + if(turns_since_move >= turns_per_move) + Move(get_step(src,pick(4,8))) + turns_since_move = 0 update_icon() //COFFEE! SQUEEEEEEEEE! diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index 92dc41cdb898..0807d54ed9ce 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -32,38 +32,40 @@ /mob/living/simple_animal/hostile/retaliate/goat/Life() . = ..() - if(.) - //chance to go crazy and start wacking stuff - if(!enemies.len && prob(1)) - Retaliate() - - if(enemies.len && prob(10)) - enemies = list() - LoseTarget() - src.visible_message("\The [src] calms down.") - - if(stat == CONSCIOUS) - if(udder && prob(5)) - udder.add_reagent(/decl/material/liquid/drink/milk, rand(5, 10)) - - if(locate(/obj/effect/vine) in loc) - var/obj/effect/vine/SV = locate() in loc - if(prob(60)) - src.visible_message("\The [src] eats the plants.") - SV.die_off(1) - if(locate(/obj/machinery/portable_atmospherics/hydroponics/soil/invisible) in loc) - var/obj/machinery/portable_atmospherics/hydroponics/soil/invisible/SP = locate() in loc - qdel(SP) - else if(prob(20)) - src.visible_message("\The [src] chews on the plants.") - return - - if(!LAZYLEN(grabbed_by)) - var/obj/effect/vine/food - food = locate(/obj/effect/vine) in oview(5,loc) - if(food) - var/step = get_step_to(src, food, 0) - Move(step) + if(. == PROCESS_KILL) + return + + //chance to go crazy and start wacking stuff + if(!enemies.len && prob(1)) + Retaliate() + + if(enemies.len && prob(10)) + enemies = list() + LoseTarget() + src.visible_message("\The [src] calms down.") + + if(stat == CONSCIOUS) + if(udder && prob(5)) + udder.add_reagent(/decl/material/liquid/drink/milk, rand(5, 10)) + + if(locate(/obj/effect/vine) in loc) + var/obj/effect/vine/SV = locate() in loc + if(prob(60)) + src.visible_message("\The [src] eats the plants.") + SV.die_off(1) + if(locate(/obj/machinery/portable_atmospherics/hydroponics/soil/invisible) in loc) + var/obj/machinery/portable_atmospherics/hydroponics/soil/invisible/SP = locate() in loc + qdel(SP) + else if(prob(20)) + src.visible_message("\The [src] chews on the plants.") + return + + if(!LAZYLEN(grabbed_by)) + var/obj/effect/vine/food + food = locate(/obj/effect/vine) in oview(5,loc) + if(food) + var/step = get_step_to(src, food, 0) + Move(step) /mob/living/simple_animal/hostile/retaliate/goat/Retaliate() ..() @@ -136,8 +138,8 @@ /mob/living/simple_animal/cow/Life() . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return if(udder && prob(5)) udder.add_reagent(/decl/material/liquid/drink/milk, rand(5, 10)) @@ -182,8 +184,8 @@ /mob/living/simple_animal/chick/Life() . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return amount_grown += rand(1,2) if(amount_grown >= 100) new /mob/living/simple_animal/chicken(src.loc) @@ -249,8 +251,8 @@ var/global/chicken_count = 0 /mob/living/simple_animal/chicken/Life() . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return if(prob(3) && eggsleft > 0) visible_message("[src] [pick("lays an egg.","squats down and croons.","begins making a huge racket.","begins clucking raucously.")]") eggsleft-- diff --git a/code/modules/mob/living/simple_animal/friendly/koala.dm b/code/modules/mob/living/simple_animal/friendly/koala.dm index ecf214260470..dc12ff116b2b 100644 --- a/code/modules/mob/living/simple_animal/friendly/koala.dm +++ b/code/modules/mob/living/simple_animal/friendly/koala.dm @@ -3,7 +3,7 @@ name = "koala" desc = "A little grey bear. How long is he gonna sleep today?" icon = 'icons/mob/simple_animal/koala.dmi' - maxHealth = 45 + mob_default_max_health = 45 health = 45 speed = 4 speak = list("Rrr", "Wraarh...", "Pfrrr...") diff --git a/code/modules/mob/living/simple_animal/friendly/lizard.dm b/code/modules/mob/living/simple_animal/friendly/lizard.dm index 3f8ddca2abcf..9f3e4cf77a7e 100644 --- a/code/modules/mob/living/simple_animal/friendly/lizard.dm +++ b/code/modules/mob/living/simple_animal/friendly/lizard.dm @@ -4,7 +4,7 @@ icon = 'icons/mob/simple_animal/lizard.dmi' speak_emote = list("hisses") health = 5 - maxHealth = 5 + mob_default_max_health = 5 natural_weapon = /obj/item/natural_weapon/bite/weak response_harm = "stamps on" mob_size = MOB_SIZE_MINISCULE diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index c9c0348a2f41..cefa68eb72cd 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -12,7 +12,7 @@ turns_per_move = 5 see_in_dark = 6 health = 5 - maxHealth = 5 + mob_default_max_health = 5 response_harm = "stamps on" density = 0 minbodytemp = 223 //Below -50 Degrees Celsius @@ -39,9 +39,11 @@ return FALSE // Mice are troll bait, give them no power. /mob/living/simple_animal/mouse/Life() + . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return + if(prob(speak_chance)) for(var/mob/M in view()) sound_to(M, 'sound/effects/mousesqueek.ogg') @@ -82,7 +84,7 @@ desc = "It's a small [body_color] rodent, often seen hiding in maintenance areas and making a nuisance of itself." /mob/living/simple_animal/mouse/proc/splat() - adjustBruteLoss(maxHealth) // Enough damage to kill + adjustBruteLoss(get_max_health()) // Enough damage to kill splatted = TRUE death() @@ -132,7 +134,7 @@ body_color = "rat" icon = 'icons/mob/simple_animal/rat.dmi' skin_material = /decl/material/solid/skin/fur/gray - maxHealth = 20 + mob_default_max_health = 20 health = 20 /mob/living/simple_animal/mouse/rat/set_mouse_icon() diff --git a/code/modules/mob/living/simple_animal/friendly/mushroom.dm b/code/modules/mob/living/simple_animal/friendly/mushroom.dm index eff9bf9c3788..3d9595cf68b5 100644 --- a/code/modules/mob/living/simple_animal/friendly/mushroom.dm +++ b/code/modules/mob/living/simple_animal/friendly/mushroom.dm @@ -6,7 +6,7 @@ speak_chance = 0 turns_per_move = 1 health = 5 - maxHealth = 5 + mob_default_max_health = 5 harm_intent_damage = 5 pass_flags = PASS_FLAG_TABLE diff --git a/code/modules/mob/living/simple_animal/friendly/possum.dm b/code/modules/mob/living/simple_animal/friendly/possum.dm index eb0792907ab6..8e27e54ac0d2 100644 --- a/code/modules/mob/living/simple_animal/friendly/possum.dm +++ b/code/modules/mob/living/simple_animal/friendly/possum.dm @@ -11,7 +11,7 @@ speak_chance = 1 turns_per_move = 3 see_in_dark = 6 - maxHealth = 50 + mob_default_max_health = 50 health = 50 response_harm = "stamps on" density = 0 @@ -26,11 +26,15 @@ can_pull_mobs = MOB_PULL_SMALLER holder_type = /obj/item/holder - var/is_angry = FALSE + var/is_angry = FALSE /mob/living/simple_animal/opossum/Life() + . = ..() - if(. && !ckey && stat != DEAD && prob(1)) + if(. == PROCESS_KILL) + return + + if(!ckey && stat != DEAD && prob(1)) resting = (stat == UNCONSCIOUS) if(!resting) wander = initial(wander) diff --git a/code/modules/mob/living/simple_animal/friendly/tomato.dm b/code/modules/mob/living/simple_animal/friendly/tomato.dm index 68378e536d58..c2c61e5534a3 100644 --- a/code/modules/mob/living/simple_animal/friendly/tomato.dm +++ b/code/modules/mob/living/simple_animal/friendly/tomato.dm @@ -4,7 +4,7 @@ icon = 'icons/mob/simple_animal/tomato.dmi' speak_chance = 0 turns_per_move = 5 - maxHealth = 15 + mob_default_max_health = 15 health = 15 response_help_3p = "$USER$ pokes $TARGET$." response_help_1p = "You poke $TARGET$." diff --git a/code/modules/mob/living/simple_animal/hostile/antlion.dm b/code/modules/mob/living/simple_animal/hostile/antlion.dm index e6c0d5cce6df..3813520c0ca5 100644 --- a/code/modules/mob/living/simple_animal/hostile/antlion.dm +++ b/code/modules/mob/living/simple_animal/hostile/antlion.dm @@ -11,7 +11,7 @@ bleed_colour = COLOR_SKY_BLUE health = 65 - maxHealth = 65 + mob_default_max_health = 65 natural_weapon = /obj/item/natural_weapon/bite natural_armor = list( ARMOR_MELEE = ARMOR_MELEE_KNIVES @@ -29,13 +29,13 @@ var/heal_amount = 6 /mob/living/simple_animal/hostile/antlion/Life() + . = ..() + if(. == PROCESS_KILL) + return process_healing() //this needs to occur before if(!.) because of stop_automation - if(!.) - return - if(can_perform_ability()) vanish() @@ -92,7 +92,7 @@ /mob/living/simple_animal/hostile/antlion/proc/process_healing() if(!incapacitated() && healing) var/old_health = health - if(old_health < maxHealth) + if(old_health < get_max_health()) health = old_health + heal_amount /mob/living/simple_animal/hostile/antlion/proc/prep_burrow(var/new_bool) @@ -106,7 +106,7 @@ icon = 'icons/mob/simple_animal/antlion_queen.dmi' mob_size = MOB_SIZE_LARGE health = 275 - maxHealth = 275 + mob_default_max_health = 275 natural_weapon = /obj/item/natural_weapon/bite/megalion natural_armor = list( ARMOR_MELEE = ARMOR_MELEE_RESISTANT diff --git a/code/modules/mob/living/simple_animal/hostile/bad_drone.dm b/code/modules/mob/living/simple_animal/hostile/bad_drone.dm index d0f52f39eb76..fb4ca5adfea5 100644 --- a/code/modules/mob/living/simple_animal/hostile/bad_drone.dm +++ b/code/modules/mob/living/simple_animal/hostile/bad_drone.dm @@ -6,7 +6,7 @@ speak_emote = list("blares","buzzes","beeps") speak_chance = 1 health = 50 - maxHealth = 50 + mob_default_max_health = 50 natural_weapon = /obj/item/natural_weapon/drone_slicer faction = "silicon" min_gas = null diff --git a/code/modules/mob/living/simple_animal/hostile/bat.dm b/code/modules/mob/living/simple_animal/hostile/bat.dm index a8e67b0ccea0..de4a59e39014 100644 --- a/code/modules/mob/living/simple_animal/hostile/bat.dm +++ b/code/modules/mob/living/simple_animal/hostile/bat.dm @@ -5,7 +5,7 @@ speak_chance = 0 turns_per_move = 3 speed = 4 - maxHealth = 20 + mob_default_max_health = 20 health = 20 harm_intent_damage = 8 diff --git a/code/modules/mob/living/simple_animal/hostile/bear.dm b/code/modules/mob/living/simple_animal/hostile/bear.dm index ac281502ca37..dbc1569ce84b 100644 --- a/code/modules/mob/living/simple_animal/hostile/bear.dm +++ b/code/modules/mob/living/simple_animal/hostile/bear.dm @@ -12,7 +12,7 @@ see_in_dark = 6 response_harm = "pokes" stop_automated_movement_when_pulled = 0 - maxHealth = 60 + mob_default_max_health = 60 health = 60 natural_weapon = /obj/item/natural_weapon/claws/strong can_escape = TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/carp.dm b/code/modules/mob/living/simple_animal/hostile/carp.dm index a3d7ab44e651..ec5f9b30b2be 100644 --- a/code/modules/mob/living/simple_animal/hostile/carp.dm +++ b/code/modules/mob/living/simple_animal/hostile/carp.dm @@ -5,7 +5,7 @@ speak_chance = 0 turns_per_move = 3 speed = 2 - maxHealth = 50 + mob_default_max_health = 50 health = 50 harm_intent_damage = 8 @@ -34,8 +34,8 @@ update_icon() /mob/living/simple_animal/hostile/carp/proc/carp_randomify() - maxHealth = rand(initial(maxHealth), (1.5 * initial(maxHealth))) - health = maxHealth + mob_default_max_health = rand(initial(mob_default_max_health), (1.5 * initial(mob_default_max_health))) + health = mob_default_max_health if(prob(1)) carp_color = pick(COLOR_WHITE, COLOR_BLACK) else diff --git a/code/modules/mob/living/simple_animal/hostile/commanded/bear_companion.dm b/code/modules/mob/living/simple_animal/hostile/commanded/bear_companion.dm index ac76b151694b..5d6276533ef4 100644 --- a/code/modules/mob/living/simple_animal/hostile/commanded/bear_companion.dm +++ b/code/modules/mob/living/simple_animal/hostile/commanded/bear_companion.dm @@ -3,7 +3,7 @@ desc = "A large brown bear." icon = 'icons/mob/simple_animal/bear_brown.dmi' health = 75 - maxHealth = 75 + mob_default_max_health = 75 density = 1 natural_weapon = /obj/item/natural_weapon/claws can_escape = TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/commanded/commanded.dm b/code/modules/mob/living/simple_animal/hostile/commanded/commanded.dm index 1690d61a3920..d265a4c853fd 100644 --- a/code/modules/mob/living/simple_animal/hostile/commanded/commanded.dm +++ b/code/modules/mob/living/simple_animal/hostile/commanded/commanded.dm @@ -23,8 +23,8 @@ /mob/living/simple_animal/hostile/commanded/Life() . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return while(command_buffer.len > 0) var/mob/speaker = command_buffer[1] var/text = command_buffer[2] diff --git a/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm b/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm index 680471b3996f..59faf9eaa145 100644 --- a/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm +++ b/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm @@ -7,7 +7,7 @@ icon = 'icons/mob/simple_animal/nanomachines.dmi' natural_weapon = /obj/item/natural_weapon/nanomachine health = 10 - maxHealth = 10 + mob_default_max_health = 10 can_escape = TRUE known_commands = list("stay", "stop", "attack", "follow", "heal", "emergency protocol") gene_damage = -1 @@ -26,19 +26,20 @@ sharp = TRUE /mob/living/simple_animal/hostile/commanded/nanomachine/Life() + . = ..() + if(. == PROCESS_KILL) + return regen_time++ - if(regen_time == 2 && health < maxHealth) //slow regen + if(regen_time == 2 && health < get_max_health()) //slow regen regen_time = 0 health++ - . = ..() - if(.) - switch(stance) - if(COMMANDED_HEAL) - if(!target_mob) - target_mob = FindTarget(COMMANDED_HEAL) - move_to_heal() - if(COMMANDED_HEALING) - heal() + switch(stance) + if(COMMANDED_HEAL) + if(!target_mob) + target_mob = FindTarget(COMMANDED_HEAL) + move_to_heal() + if(COMMANDED_HEALING) + heal() /mob/living/simple_animal/hostile/commanded/nanomachine/death(gibbed, deathmessage, show_dead_message) ..(null, "dissipates into thin air", "You have been destroyed.") @@ -59,7 +60,7 @@ if(!Adjacent(target_mob) || SA_attackable(target_mob)) stance = COMMANDED_HEAL return 0 - if(target_mob.stat || target_mob.health >= target_mob.maxHealth) //he's either dead or healthy, move along. + if(target_mob.stat || target_mob.health >= target_mob.get_max_health()) //he's either dead or healthy, move along. allowed_targets -= target_mob target_mob = null stance = COMMANDED_HEAL diff --git a/code/modules/mob/living/simple_animal/hostile/creature.dm b/code/modules/mob/living/simple_animal/hostile/creature.dm index ae369e9d1cf9..c8b1012d6f0f 100644 --- a/code/modules/mob/living/simple_animal/hostile/creature.dm +++ b/code/modules/mob/living/simple_animal/hostile/creature.dm @@ -4,7 +4,7 @@ icon = 'icons/mob/simple_animal/creature.dmi' speak_emote = list("gibbers") health = 100 - maxHealth = 100 + mob_default_max_health = 100 natural_weapon = /obj/item/natural_weapon/bite/strong faction = "creature" speed = 4 diff --git a/code/modules/mob/living/simple_animal/hostile/drake.dm b/code/modules/mob/living/simple_animal/hostile/drake.dm index a551d5dc468f..4518abb1eeec 100644 --- a/code/modules/mob/living/simple_animal/hostile/drake.dm +++ b/code/modules/mob/living/simple_animal/hostile/drake.dm @@ -13,7 +13,7 @@ bleed_colour = COLOR_VIOLET health = 200 - maxHealth = 200 + mob_default_max_health = 200 natural_weapon = /obj/item/natural_weapon/claws/drake var/obj/item/whip/tail/tailwhip natural_armor = list( diff --git a/code/modules/mob/living/simple_animal/hostile/faithful_hound.dm b/code/modules/mob/living/simple_animal/hostile/faithful_hound.dm index 9c704c1c69cb..bfec95def608 100644 --- a/code/modules/mob/living/simple_animal/hostile/faithful_hound.dm +++ b/code/modules/mob/living/simple_animal/hostile/faithful_hound.dm @@ -4,7 +4,7 @@ icon = 'icons/mob/simple_animal/corgi_ghost.dmi' blend_mode = BLEND_SUBTRACT health = 100 - maxHealth = 100 + mob_default_max_health = 100 natural_weapon = /obj/item/natural_weapon/bite/strong faction = MOB_FACTION_NEUTRAL density = 0 diff --git a/code/modules/mob/living/simple_animal/hostile/faithless.dm b/code/modules/mob/living/simple_animal/hostile/faithless.dm index 5fe45352ed93..44d3aec88f08 100644 --- a/code/modules/mob/living/simple_animal/hostile/faithless.dm +++ b/code/modules/mob/living/simple_animal/hostile/faithless.dm @@ -7,7 +7,7 @@ response_help_1p = "You wave your hand through $TARGET$." response_help_3p = "$USER$ waves $USER_HIS$ hand through $TARGET$." speed = -1 - maxHealth = 80 + mob_default_max_health = 80 health = 80 gene_damage = -1 diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index 2a2e645d1bac..7004e627e09a 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -15,7 +15,7 @@ turns_per_move = 5 see_in_dark = 10 response_harm = "pokes" - maxHealth = 125 + mob_default_max_health = 125 health = 125 natural_weapon = /obj/item/natural_weapon/bite heat_damage_per_tick = 20 @@ -64,7 +64,7 @@ /mob/living/simple_animal/hostile/giant_spider/guard desc = "A monstrously huge brown spider with shimmering eyes." meat_amount = 4 - maxHealth = 200 + mob_default_max_health = 200 health = 200 natural_weapon = /obj/item/natural_weapon/bite/strong poison_per_bite = 5 @@ -81,7 +81,7 @@ /mob/living/simple_animal/hostile/giant_spider/nurse desc = "A monstrously huge beige spider with shimmering eyes." icon = 'icons/mob/simple_animal/spider_beige.dmi' - maxHealth = 80 + mob_default_max_health = 80 health = 80 harm_intent_damage = 6 //soft poison_per_bite = 5 @@ -104,7 +104,7 @@ /mob/living/simple_animal/hostile/giant_spider/hunter desc = "A monstrously huge black spider with shimmering eyes." icon = 'icons/mob/simple_animal/spider_black.dmi' - maxHealth = 150 + mob_default_max_health = 150 health = 150 natural_weapon = /obj/item/natural_weapon/bite/strong poison_per_bite = 10 @@ -125,7 +125,7 @@ /mob/living/simple_animal/hostile/giant_spider/spitter desc = "A monstrously huge iridescent spider with shimmering eyes." icon = 'icons/mob/simple_animal/spider_purple.dmi' - maxHealth = 90 + mob_default_max_health = 90 health = 90 poison_per_bite = 15 ranged = TRUE @@ -147,8 +147,8 @@ . = ..() /mob/living/simple_animal/hostile/giant_spider/proc/spider_randomify() //random math nonsense to get their damage, health and venomness values - maxHealth = rand(initial(maxHealth), (1.4 * initial(maxHealth))) - health = maxHealth + mob_default_max_health = rand(initial(mob_default_max_health), (1.4 * initial(mob_default_max_health))) + health = mob_default_max_health eye_colour = pick(allowed_eye_colours) update_icon() @@ -164,7 +164,7 @@ /mob/living/simple_animal/hostile/giant_spider/AttackingTarget() . = ..() if(isliving(.)) - if(health < maxHealth) + if(health < get_max_health()) var/obj/item/W = get_natural_weapon() if(W) health += (0.2 * W.force) //heal a bit on hit @@ -180,9 +180,11 @@ to_chat(L, "You feel a tiny prick.") /mob/living/simple_animal/hostile/giant_spider/Life() + . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return + if(stance == HOSTILE_STANCE_IDLE) //chance to skitter madly away if(!busy && prob(hunt_chance)) @@ -202,9 +204,11 @@ Guard caste procs ****************/ /mob/living/simple_animal/hostile/giant_spider/guard/Life() + . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return + if(berserking) return FALSE if(!paired_nurse) @@ -300,9 +304,11 @@ Nurse caste procs stop_automated_movement = 0 /mob/living/simple_animal/hostile/giant_spider/nurse/Life() + . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return + if(stance == HOSTILE_STANCE_IDLE) var/list/can_see = view(src, 10) //30% chance to stop wandering and do something @@ -439,9 +445,11 @@ Hunter caste procs Spitter caste procs ******************/ /mob/living/simple_animal/hostile/giant_spider/spitter/Life() + . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return + if(venom_charge <= 0) ranged = FALSE if(prob(25)) diff --git a/code/modules/mob/living/simple_animal/hostile/hivebot.dm b/code/modules/mob/living/simple_animal/hostile/hivebot.dm index c6396b952ff8..6972131ed135 100644 --- a/code/modules/mob/living/simple_animal/hostile/hivebot.dm +++ b/code/modules/mob/living/simple_animal/hostile/hivebot.dm @@ -3,7 +3,7 @@ desc = "A junky looking robot with four spiky legs." icon = 'icons/mob/simple_animal/hivebot.dmi' health = 55 - maxHealth = 55 + mob_default_max_health = 55 natural_weapon = /obj/item/natural_weapon/drone_slicer projectilesound = 'sound/weapons/gunshot/gunshot_pistol.ogg' projectiletype = /obj/item/projectile/beam/smalllaser @@ -38,7 +38,7 @@ /mob/living/simple_animal/hostile/hivebot/strong desc = "A junky looking robot with four spiky legs - this one has thick armour plating." health = 120 - maxHealth = 120 + mob_default_max_health = 120 ranged = 1 can_escape = 1 natural_armor = list( @@ -61,7 +61,7 @@ Teleporter beacon, and its subtypes icon = 'icons/obj/structures/hivebot_props.dmi' icon_state = "def_radar-off" health = 200 - maxHealth = 200 + mob_default_max_health = 200 status_flags = 0 anchored = 1 stop_automated_movement = 1 @@ -97,7 +97,9 @@ Teleporter beacon, and its subtypes /mob/living/simple_animal/hostile/hivebot/tele/Life() . = ..() - if(. && spawn_time && spawn_time <= world.time) + if(. == PROCESS_KILL) + return + if(spawn_time && spawn_time <= world.time) warpbots() /mob/living/simple_animal/hostile/hivebot/tele/strong @@ -141,7 +143,7 @@ The megabot desc = "A huge quadruped robot equipped with a myriad of weaponry." icon = 'icons/mob/simple_animal/megabot.dmi' health = 440 - maxHealth = 440 + mob_default_max_health = 440 natural_weapon = /obj/item/natural_weapon/circular_saw speed = 0 natural_armor = list( @@ -172,9 +174,8 @@ The megabot /mob/living/simple_animal/hostile/hivebot/mega/Life() . = ..() - if(!.) + if(. == PROCESS_KILL) return - if(time_last_used_ability < world.time) switch_mode(ATTACK_MODE_ROCKET) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 4ca878f4bd79..85e3bcc31c03 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -181,8 +181,9 @@ /mob/living/simple_animal/hostile/Life() . = ..() - if(!.) - walk(src, 0) + if(. == PROCESS_KILL) + return + walk(src, 0) /mob/living/simple_animal/hostile/do_delayed_life_action() ..() diff --git a/code/modules/mob/living/simple_animal/hostile/leech.dm b/code/modules/mob/living/simple_animal/hostile/leech.dm index 68662fb1a89e..1f5b9c44c5df 100644 --- a/code/modules/mob/living/simple_animal/hostile/leech.dm +++ b/code/modules/mob/living/simple_animal/hostile/leech.dm @@ -3,7 +3,7 @@ desc = "A green leech the size of a common snake." icon = 'icons/mob/simple_animal/megaleech.dmi' health = 15 - maxHealth = 15 + mob_default_max_health = 15 harm_intent_damage = 5 natural_weapon = /obj/item/natural_weapon/bite/weak pass_flags = PASS_FLAG_TABLE @@ -18,9 +18,8 @@ /mob/living/simple_animal/hostile/leech/Life() . = ..() - if(!.) - return FALSE - + if(. == PROCESS_KILL) + return if(target_mob) belly -= 3 else @@ -34,7 +33,7 @@ if(istype(S) && !length(S.breaches)) return H.remove_blood_simple(suck_potency) - if(health < maxHealth) + if(health < get_max_health()) health += suck_potency / 1.5 belly += clamp(suck_potency, 0, 100) diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index 422194fb113d..a6c4542a153d 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -25,7 +25,7 @@ var/global/list/protected_objects = list(/obj/machinery, meat_type = /obj/item/chems/food/fish speed = 4 - maxHealth = 100 + mob_default_max_health = 100 health = 100 harm_intent_damage = 5 @@ -78,18 +78,18 @@ var/global/list/protected_objects = list(/obj/machinery, var/obj/item/W = get_natural_weapon() if(istype(O, /obj/structure)) - health = (anchored * 50) + 50 + mob_default_max_health = (anchored * 50) + 50 destroy_objects = 1 if(O.density && O.anchored) knockdown_people = 1 W.force = 2 * initial(W.force) else if(istype(O, /obj/item)) var/obj/item/I = O - health = 15 * I.w_class + mob_default_max_health = 15 * I.w_class W.force = 2 + initial(I.force) move_to_delay = 2 * I.w_class - maxHealth = health + health = get_max_health() if(creator) src.creator = weakref(creator) faction = "\ref[creator]" // very unique diff --git a/code/modules/mob/living/simple_animal/hostile/pike.dm b/code/modules/mob/living/simple_animal/hostile/pike.dm index 75e70b201daa..0ee81fc7cc30 100644 --- a/code/modules/mob/living/simple_animal/hostile/pike.dm +++ b/code/modules/mob/living/simple_animal/hostile/pike.dm @@ -11,7 +11,7 @@ pixel_x = -16 health = 150 - maxHealth = 150 + mob_default_max_health = 150 harm_intent_damage = 5 natural_weapon = /obj/item/natural_weapon/bite/pike diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm index aa1fb734be4f..8474a40398b4 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm @@ -9,7 +9,7 @@ speak_chance = 1 a_intent = I_HURT stop_automated_movement_when_pulled = 0 - maxHealth = 75 + mob_default_max_health = 75 health = 75 speed = -1 harm_intent_damage = 8 diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm index 8256fc47cd81..03055df181bc 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm @@ -13,7 +13,7 @@ a_intent = I_HURT stop_automated_movement_when_pulled = 0 health = 300 - maxHealth = 300 + mob_default_max_health = 300 speed = 8 move_to_delay = 6 projectiletype = /obj/item/projectile/beam/drone @@ -85,7 +85,9 @@ //self repair systems have a chance to bring the drone back to life /mob/living/simple_animal/hostile/retaliate/malf_drone/Life() - + . = ..() + if(. == PROCESS_KILL) + return //emps and lots of damage can temporarily shut us down if(disabled > 0) set_stat(UNCONSCIOUS) @@ -110,13 +112,14 @@ //sometimes our targetting sensors malfunction, and we attack anyone nearby Haywire() - if(health / maxHealth > 0.9) + var/health_percent = get_health_percent() + if(health_percent > 0.9) explode_chance = 0 - else if(health / maxHealth > 0.7) + else if(health_percent > 0.7) explode_chance = 0 - else if(health / maxHealth > 0.5) + else if(health_percent > 0.5) explode_chance = 0.5 - else if(health / maxHealth > 0.3) + else if(health_percent > 0.3) explode_chance = 5 else if(health > 0) //if health gets too low, shut down @@ -145,17 +148,17 @@ if(!disabled && exploding) explosion(get_turf(src), 0, 1, 4, 7) death() - ..() update_icon() /mob/living/simple_animal/hostile/retaliate/malf_drone/on_update_icon() . = ..() if(stat != DEAD) - if(health / maxHealth <= 0.3) + var/health_percent = get_health_percent() + if(health_percent <= 0.3) icon_state += "-shield3" - else if(health / maxHealth <= 0.5) + else if(health_percent <= 0.5) icon_state += "-shield1" - else if(health / maxHealth <= 0.7) + else if(health_percent <= 0.7) icon_state += "-shield2" //ion rifle! diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/exoplanet.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/exoplanet.dm index ef8fb10f1126..365da485f623 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/exoplanet.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/exoplanet.dm @@ -19,8 +19,8 @@ /mob/living/simple_animal/hostile/retaliate/beast/Life() . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return hunger++ if(hunger < 100) //stop hunting when satiated prey.Cut() @@ -34,7 +34,7 @@ var/turf/T = get_turf(S) var/obj/item/remains/xeno/X = new(T) X.desc += "These look like they belong to \a [S.name]." - hunger = max(0, hunger - 5*S.maxHealth) + hunger = max(0, hunger - 5*S.get_max_health()) if(prob(5)) S.gib() else @@ -68,7 +68,7 @@ faction = "samak" icon = 'icons/mob/simple_animal/samak.dmi' move_to_delay = 2 - maxHealth = 125 + mob_default_max_health = 125 health = 125 speed = 2 natural_weapon = /obj/item/natural_weapon/claws @@ -91,7 +91,7 @@ faction = "diyaab" icon = 'icons/mob/simple_animal/diyaab.dmi' move_to_delay = 1 - maxHealth = 25 + mob_default_max_health = 25 health = 25 speed = 1 natural_weapon = /obj/item/natural_weapon/claws/weak @@ -108,7 +108,7 @@ faction = "shantak" icon = 'icons/mob/simple_animal/shantak.dmi' move_to_delay = 1 - maxHealth = 75 + mob_default_max_health = 75 health = 75 speed = 1 natural_weapon = /obj/item/natural_weapon/claws @@ -148,7 +148,7 @@ faction = "crab" icon = 'icons/mob/simple_animal/royalcrab.dmi' move_to_delay = 3 - maxHealth = 150 + mob_default_max_health = 150 health = 150 speed = 1 natural_weapon = /obj/item/natural_weapon/pincers @@ -164,7 +164,7 @@ icon = 'icons/mob/simple_animal/char.dmi' mob_size = MOB_SIZE_LARGE health = 45 - maxHealth = 45 + mob_default_max_health = 45 natural_weapon = /obj/item/natural_weapon/charbaby speed = 2 return_damage_min = 2 diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_crab.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_crab.dm index 1b796be4cf71..7b8924299238 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_crab.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_crab.dm @@ -14,7 +14,7 @@ faction = "crabs" pry_time = 2 SECONDS health = 350 - maxHealth = 350 + mob_default_max_health = 350 natural_weapon = /obj/item/natural_weapon/pincers/giant return_damage_min = 2 return_damage_max = 5 @@ -49,10 +49,9 @@ /mob/living/simple_animal/hostile/retaliate/giant_crab/Life() . = ..() - if(!.) + if(. == PROCESS_KILL) return - - if((health > maxHealth / 1.5) && enemies.len && prob(10)) + if((health > get_max_health() / 1.5) && enemies.len && prob(10)) if(victim) release_grab() enemies = list() diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm index e113be0bffcf..5e90a124c9c1 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm @@ -3,7 +3,7 @@ desc = "It could be some all-knowing being that, for reasons we could never hope to understand, is assuming the shape and general mannerisms of a parrot - or just a rather large bird." gender = FEMALE health = 750 //how sweet it is to be a god! - maxHealth = 750 + mob_default_max_health = 750 mob_size = MOB_SIZE_LARGE speak = list("...") speak_emote = list("professes","speaks unto you","elaborates","proclaims") @@ -77,14 +77,14 @@ get_subspecies_name = FALSE natural_weapon = /obj/item/natural_weapon/large health = 300 - maxHealth = 300 + mob_default_max_health = 300 /mob/living/simple_animal/hostile/retaliate/parrot/space/megafauna name = "giant parrot" desc = "A huge parrot-like bird." get_subspecies_name = FALSE health = 350 - maxHealth = 350 + mob_default_max_health = 350 speak_emote = list("squawks") emote_hear = list("preens itself") natural_weapon = /obj/item/natural_weapon/large diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/goose.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/goose.dm index 6ae88d20c550..87feb74110c4 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/goose.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/goose.dm @@ -8,7 +8,7 @@ emote_see = list("flaps its wings", "scratches the ground") natural_weapon = /obj/item/natural_weapon/goosefeet health = 45 - maxHealth = 45 + mob_default_max_health = 45 pass_flags = PASS_FLAG_TABLE faction = "geese" pry_time = 8 SECONDS @@ -55,7 +55,7 @@ if(!loose && prob(25) && (W && W.force >= loose_threshold)) //second wind loose = TRUE health = (initial(health) * 1.5) - maxHealth = (initial(maxHealth) * 1.5) + mob_default_max_health = (initial(mob_default_max_health) * 1.5) enrage_potency = enrage_potency_loose desc += " The [name] is loose! Oh no!" update_icon() @@ -65,7 +65,7 @@ desc = "A large bird. It radiates destructive energy." icon = 'icons/mob/simple_animal/goose_dire.dmi' health = 250 - maxHealth = 250 + mob_default_max_health = 250 enrage_potency = 3 loose_threshold = 20 max_damage = 35 diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/jelly.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/jelly.dm index 02e12536523c..0fca923aca2a 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/jelly.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/jelly.dm @@ -4,7 +4,7 @@ faction = "zeq" icon = 'icons/mob/simple_animal/jelly.dmi' move_to_delay = 1 - maxHealth = 75 + mob_default_max_health = 75 health = 75 speed = 1 natural_weapon = /obj/item/natural_weapon/tentecles @@ -30,7 +30,7 @@ /mob/living/simple_animal/hostile/retaliate/jelly/mega name = "zeq queen" desc = "A gigantic jellyfish-like creature. Its bell wobbles about almost as if it's ready to burst." - maxHealth = 300 + mob_default_max_health = 300 health = 300 gets_random_color = FALSE can_escape = TRUE @@ -69,7 +69,7 @@ /mob/living/simple_animal/hostile/retaliate/jelly/mega/half name = "zeq duchess" desc = "A huge jellyfish-like creature." - maxHealth = 150 + mob_default_max_health = 150 health = 150 can_escape = TRUE jelly_scale = 1.5 @@ -79,7 +79,7 @@ name = "zeqling" desc = "A jellyfish-like creature." health = 75 - maxHealth = 75 + mob_default_max_health = 75 jelly_scale = 0.75 can_escape = FALSE split_type = /mob/living/simple_animal/hostile/retaliate/jelly/mega/fourth @@ -88,7 +88,7 @@ name = "zeqetta" desc = "A tiny jellyfish-like creature." health = 40 - maxHealth = 40 + mob_default_max_health = 40 jelly_scale = 0.375 split_type = /mob/living/simple_animal/hostile/retaliate/jelly/mega/eighth @@ -96,6 +96,6 @@ name = "zeqttina" desc = "An absolutely tiny jellyfish-like creature." health = 20 - maxHealth = 20 + mob_default_max_health = 20 jelly_scale = 0.1875 split_type = null \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm index a0d3ce2685ec..b8ce3e2170f6 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm @@ -14,7 +14,7 @@ meat_amount = 12 response_harm = "assaults" health = 500 - maxHealth = 500 + mob_default_max_health = 500 mob_size = MOB_SIZE_LARGE mob_bump_flag = HEAVY can_escape = TRUE @@ -60,7 +60,7 @@ icon = 'icons/mob/simple_animal/goat_king_phase_2.dmi' meat_amount = 36 health = 750 - maxHealth = 750 + mob_default_max_health = 750 natural_weapon = /obj/item/natural_weapon/goatking/unleashed elemental_weapons = list( BURN = /obj/item/natural_weapon/goatking/fire/unleashed, @@ -95,7 +95,7 @@ desc = "A very handsome and noble beast." icon = 'icons/mob/simple_animal/goat_guard.dmi' health = 125 - maxHealth = 125 + mob_default_max_health = 125 natural_weapon = /obj/item/natural_weapon/goathorns /obj/item/natural_weapon/goathorns @@ -109,7 +109,7 @@ desc = "A very handsome and noble beast - the most trusted of all the king's men." icon = 'icons/mob/simple_animal/goat_master.dmi' health = 200 - maxHealth = 200 + mob_default_max_health = 200 natural_weapon = /obj/item/natural_weapon/goathorns move_to_delay = 3 @@ -194,8 +194,8 @@ /mob/living/simple_animal/hostile/retaliate/goat/king/phase2/Life() . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return if(special_attacks >= 6 && current_damtype != BRUTE) visible_message(SPAN_MFAUNA("The energy surrounding \the [src]'s horns dissipates.")) current_damtype = BRUTE @@ -235,6 +235,6 @@ . = ..() if(current_damtype != BRUTE) special_attacks++ - + /mob/living/simple_animal/hostile/retaliate/goat/king/Process_Spacemove() return 1 \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/hostile/slug.dm b/code/modules/mob/living/simple_animal/hostile/slug.dm index 3aff479b5e14..a423eb8098c9 100644 --- a/code/modules/mob/living/simple_animal/hostile/slug.dm +++ b/code/modules/mob/living/simple_animal/hostile/slug.dm @@ -9,7 +9,7 @@ Small, little HP, poisonous. response_harm = "stomps on" destroy_surroundings = 0 health = 15 - maxHealth = 15 + mob_default_max_health = 15 speed = 0 move_to_delay = 0 density = 1 @@ -56,7 +56,9 @@ Small, little HP, poisonous. /mob/living/simple_animal/hostile/slug/Life() . = ..() - if(. && istype(src.loc, /obj/item/holder) && isliving(src.loc.loc)) //We in somebody + if(. == PROCESS_KILL) + return + if(istype(src.loc, /obj/item/holder) && isliving(src.loc.loc)) //We in somebody var/mob/living/L = src.loc.loc if(src.loc in L.get_visible_implants(0)) if(prob(1)) diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm index ca95c3dd1b00..3aafdf19df79 100644 --- a/code/modules/mob/living/simple_animal/hostile/tree.dm +++ b/code/modules/mob/living/simple_animal/hostile/tree.dm @@ -6,7 +6,7 @@ turns_per_move = 5 meat_type = /obj/item/chems/food/fish speed = -1 - maxHealth = 250 + mob_default_max_health = 250 health = 250 pixel_x = -16 diff --git a/code/modules/mob/living/simple_animal/hostile/vagrant.dm b/code/modules/mob/living/simple_animal/hostile/vagrant.dm index c0f8e6a21963..bfd4934cd496 100644 --- a/code/modules/mob/living/simple_animal/hostile/vagrant.dm +++ b/code/modules/mob/living/simple_animal/hostile/vagrant.dm @@ -3,7 +3,7 @@ name = "creature" desc = "You get the feeling you should run." icon = 'icons/mob/simple_animal/vagrant.dmi' - maxHealth = 60 + mob_default_max_health = 60 health = 20 speed = 5 speak_chance = 0 @@ -45,8 +45,8 @@ /mob/living/simple_animal/hostile/vagrant/Life() . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return if(gripping) if(!(get_turf(src) == get_turf(gripping))) gripping = null @@ -55,7 +55,7 @@ var/blood_volume = round(gripping.vessel.total_volume) if(blood_volume > 5) gripping.vessel.remove_any(blood_per_tick) - health = min(health + health_per_tick, maxHealth) + health = min(health + health_per_tick, get_max_health()) if(prob(15)) to_chat(gripping, "You feel your fluids being drained!") else @@ -67,7 +67,7 @@ if(stance == HOSTILE_STANCE_IDLE && !cloaked) cloaked = 1 update_icon() - if(health == maxHealth) + if(health == get_max_health()) new/mob/living/simple_animal/hostile/vagrant(src.loc) new/mob/living/simple_animal/hostile/vagrant(src.loc) gib() @@ -96,7 +96,7 @@ return //This line ensures there's always a reasonable chance of grabbing, while still //Factoring in health - if(!gripping && (cloaked || prob(health + ((maxHealth - health) * 2)))) + if(!gripping && (cloaked || prob(health + ((get_max_health() - health) * 2)))) gripping = H cloaked = 0 update_icon() diff --git a/code/modules/mob/living/simple_animal/hostile/viscerator.dm b/code/modules/mob/living/simple_animal/hostile/viscerator.dm index cbe04e3dcd93..8a007f95b7f9 100644 --- a/code/modules/mob/living/simple_animal/hostile/viscerator.dm +++ b/code/modules/mob/living/simple_animal/hostile/viscerator.dm @@ -4,7 +4,7 @@ icon = 'icons/mob/simple_animal/viscerator.dmi' pass_flags = PASS_FLAG_TABLE health = 15 - maxHealth = 15 + mob_default_max_health = 15 natural_weapon = /obj/item/natural_weapon/rotating_blade faction = "syndicate" min_gas = null diff --git a/code/modules/mob/living/simple_animal/shade.dm b/code/modules/mob/living/simple_animal/shade.dm index 9f61418f341e..6004a0971805 100644 --- a/code/modules/mob/living/simple_animal/shade.dm +++ b/code/modules/mob/living/simple_animal/shade.dm @@ -3,7 +3,7 @@ real_name = "Shade" desc = "A bound spirit" icon = 'icons/mob/simple_animal/shade.dmi' - maxHealth = 50 + mob_default_max_health = 50 health = 50 universal_speak = TRUE speak_emote = list("hisses") @@ -45,6 +45,8 @@ /mob/living/simple_animal/shade/Life() . = ..() + if(. == PROCESS_KILL) + return OnDeathInLife() /mob/living/simple_animal/shade/proc/OnDeathInLife() diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index acda00cf72f7..8b0262444174 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -1,7 +1,7 @@ /mob/living/simple_animal name = "animal" health = 20 - maxHealth = 20 + mob_default_max_health = 20 universal_speak = FALSE mob_sort_value = 12 @@ -45,7 +45,6 @@ var/maxbodytemp = 350 var/heat_damage_per_tick = 3 //amount of damage applied if animal's body temperature is higher than maxbodytemp var/cold_damage_per_tick = 2 //same as heat_damage_per_tick, only if the bodytemperature it's lower than minbodytemp - var/fire_alert = 0 var/list/hat_offsets @@ -70,7 +69,7 @@ //Null rod stuff var/supernatural = 0 - var/purge = 0 + var/purged_time = 0 // TODO: make this a status condition var/bleed_ticks = 0 var/bleed_colour = COLOR_BLOOD_HUMAN @@ -162,8 +161,8 @@ /mob/living/simple_animal/Life() . = ..() - if(!.) - return FALSE + if(. == PROCESS_KILL) + return if(z && !living_observers_present(SSmapping.get_connected_levels(z))) return //Health @@ -181,9 +180,6 @@ death() return - if(health > maxHealth) - health = maxHealth - handle_supernatural() handle_impaired_vision() @@ -271,14 +267,9 @@ //Atmos effect if(bodytemperature < minbodytemp) - fire_alert = 2 adjustBruteLoss(cold_damage_per_tick) else if(bodytemperature > maxbodytemp) - fire_alert = 1 adjustBruteLoss(heat_damage_per_tick) - else - fire_alert = 0 - if(!atmos_suitable) adjustBruteLoss(unsuitable_atmos_damage) @@ -287,8 +278,9 @@ visible_message(SPAN_DANGER("\The [M] escapes from \the [O]!")) /mob/living/simple_animal/proc/handle_supernatural() - if(purge) - purge -= 1 + if(purged_time) + purged_time -= 1 + silence_spells(purged_time) /mob/living/simple_animal/gib() ..(((mob_icon_state_flags & MOB_ICON_HAS_GIB_STATE) ? "world-gib" : null), TRUE) @@ -361,7 +353,7 @@ var/obj/item/stack/medical/MED = O if(!MED.animal_heal) to_chat(user, SPAN_WARNING("\The [MED] won't help \the [src] at all!")) - else if(health < maxHealth && MED.can_use(1)) + else if(health < get_max_health() && MED.can_use(1)) adjustBruteLoss(-MED.animal_heal) visible_message(SPAN_NOTICE("\The [user] applies \the [MED] to \the [src].")) MED.use(1) @@ -415,7 +407,7 @@ damage = (O.force / 8) if(supernatural && istype(O,/obj/item/nullrod)) damage *= 2 - purge = 3 + purged_time = 3 adjustBruteLoss(damage) if(O.edge || O.sharp) adjustBleedTicks(damage) @@ -424,12 +416,11 @@ /mob/living/simple_animal/get_movement_delay(var/travel_dir) var/tally = ..() //Incase I need to add stuff other than "speed" later - tally += speed - if(purge)//Purged creatures will move more slowly. The more time before their purge stops, the slower they'll move. + if(purged_time)//Purged creatures will move more slowly. The more time before their purge stops, the slower they'll move. if(tally <= 0) tally = 1 - tally *= purge + tally *= purged_time return tally+config.animal_delay @@ -437,11 +428,11 @@ . = ..() if(statpanel("Status") && show_stat_health) - stat(null, "Health: [round((health / maxHealth) * 100)]%") + stat(null, "Health: [round((health / get_max_health()) * 100)]%") /mob/living/simple_animal/death(gibbed, deathmessage = "dies!", show_dead_message) density = 0 - adjustBruteLoss(maxHealth) //Make sure dey dead. + adjustBruteLoss(get_max_health()) //Make sure dey dead. walk_to(src,0) . = ..(gibbed,deathmessage,show_dead_message) @@ -459,19 +450,19 @@ /mob/living/simple_animal/adjustBruteLoss(damage) ..() - updatehealth() + update_health() /mob/living/simple_animal/adjustFireLoss(damage) ..() - updatehealth() + update_health() /mob/living/simple_animal/adjustToxLoss(damage) ..() - updatehealth() + update_health() /mob/living/simple_animal/adjustOxyLoss(damage) ..() - updatehealth() + update_health() /mob/living/simple_animal/proc/SA_attackable(target_mob) if (isliving(target_mob)) @@ -593,8 +584,8 @@ /mob/living/simple_animal/setCloneLoss(amount) if(gene_damage >= 0) - gene_damage = clamp(amount, 0, maxHealth) - if(gene_damage >= maxHealth) + gene_damage = clamp(amount, 0, get_max_health()) + if(gene_damage >= get_max_health()) death() /mob/living/simple_animal/get_admin_job_string() diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 790b2ee8eb7f..fba611a84f2e 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -107,15 +107,10 @@ refresh_client_images() reload_fullscreen() // Reload any fullscreen overlays this mob has. - add_click_catcher() + reset_click_catchers() update_action_buttons() update_mouse_pointer() - if(ability_master) - ability_master.update_abilities(TRUE, src) - ability_master.toggle_open(1) - ability_master.synch_spells_to_mind(mind) - if(get_preference_value(/datum/client_preference/show_status_markers) == PREF_SHOW) if(status_markers?.mob_image_personal) client.images |= status_markers.mob_image_personal diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 610d42d67ead..163c0fbb05f8 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -13,8 +13,6 @@ QDEL_NULL(hud_used) if(active_storage) active_storage.close(src) - if(istype(ability_master)) - QDEL_NULL(ability_master) if(istype(skillset)) QDEL_NULL(skillset) QDEL_NULL_LIST(grabbed_by) @@ -22,7 +20,6 @@ if(istype(ai)) QDEL_NULL(ai) QDEL_NULL(lighting_master) - remove_screen_obj_references() if(client) for(var/atom/movable/AM in client.screen) var/obj/screen/screenobj = AM @@ -35,27 +32,6 @@ ghostize() return ..() -/mob/proc/remove_screen_obj_references() - QDEL_NULL_SCREEN(hands) - QDEL_NULL_SCREEN(internals) - QDEL_NULL_SCREEN(oxygen) - QDEL_NULL_SCREEN(toxin) - QDEL_NULL_SCREEN(fire) - QDEL_NULL_SCREEN(bodytemp) - QDEL_NULL_SCREEN(healths) - QDEL_NULL_SCREEN(throw_icon) - QDEL_NULL_SCREEN(nutrition_icon) - QDEL_NULL_SCREEN(hydration_icon) - QDEL_NULL_SCREEN(pressure) - QDEL_NULL_SCREEN(pain) - QDEL_NULL_SCREEN(up_hint) - QDEL_NULL_SCREEN(item_use_icon) - QDEL_NULL_SCREEN(radio_use_icon) - QDEL_NULL_SCREEN(gun_move_icon) - QDEL_NULL_SCREEN(gun_setting_icon) - QDEL_NULL_SCREEN(ability_master) - QDEL_NULL_SCREEN(zone_sel) - /mob/Initialize() . = ..() if(ispath(skillset)) @@ -235,10 +211,11 @@ /mob/proc/Life() SHOULD_NOT_SLEEP(TRUE) + SHOULD_CALL_PARENT(TRUE) if(QDELETED(src)) return PROCESS_KILL - if(ability_master) - ability_master.update_spells(0) + // Alerts will be set by logic higher in the call chain. + CLEAR_HUD_ALERTS(src) #define UNBUCKLED 0 #define PARTIALLY_BUCKLED 1 @@ -957,13 +934,15 @@ /mob/proc/throw_mode_off() src.in_throw_mode = 0 - if(src.throw_icon) //in case we don't have the HUD and we use the hotkey - src.throw_icon.icon_state = "act_throw_off" + var/obj/screen/throw_icon = get_hud_element(/decl/hud_element/throwing) + if(throw_icon) //in case we don't have the HUD and we use the hotkey + throw_icon.icon_state = "act_throw_off" /mob/proc/throw_mode_on() src.in_throw_mode = 1 - if(src.throw_icon) - src.throw_icon.icon_state = "act_throw_on" + var/obj/screen/throw_icon = get_hud_element(/decl/hud_element/throwing) + if(throw_icon) + throw_icon.icon_state = "act_throw_on" /mob/proc/toggle_antag_pool() set name = "Toggle Add-Antag Candidacy" @@ -985,7 +964,7 @@ return (!alpha || !mouse_opacity || viewer.see_invisible < invisibility) /client/proc/check_has_body_select() - return mob && mob.hud_used && istype(mob.zone_sel, /obj/screen/zone_selector) + return istype(mob?.get_hud_element(/decl/hud_element/zone_selector), /obj/screen/zone_selector) /client/verb/body_toggle_head() set name = "body-toggle-head" @@ -1025,8 +1004,9 @@ /client/proc/toggle_zone_sel(list/zones) if(!check_has_body_select()) return - var/obj/screen/zone_selector/selector = mob.zone_sel - selector.set_selected_zone(next_in_list(mob.get_target_zone(),zones)) + var/obj/screen/zone_selector/selector = mob?.get_hud_element(/decl/hud_element/zone_selector) + if(selector) + selector.set_selected_zone(next_in_list(selector.selecting, zones)) /mob/proc/has_admin_rights() return check_rights(R_ADMIN, 0, src) @@ -1319,8 +1299,55 @@ /mob/proc/toggle_internals(var/mob/living/user) return +/mob/Move() + . = ..() + if(. && client) + var/obj/screen/up_hint = get_hud_element(/decl/hud_element/up_hint) + if(up_hint) + var/turf/above = GetAbove(src) + up_hint.icon_state = "uphint[!!(above && TURF_IS_MIMICKING(above))]" + /mob/proc/get_target_zone() - return zone_sel?.selecting + var/obj/screen/zone_selector/zone_selector = get_hud_element(/decl/hud_element/zone_selector) + if(istype(zone_selector)) + return zone_selector.selecting + +//Get species or synthetic temp if the mob is a FBP. Used when a synthetic type human mob is exposed to a temp check. +//Essentially, used when a synthetic human mob should act diffferently than a normal type mob. +/mob/proc/getSpeciesOrSynthTemp(var/temptype) + var/decl/species/my_species = get_species() + switch(temptype) + if(COLD_LEVEL_1) + return isSynthetic() ? SYNTH_COLD_LEVEL_1 : (my_species ? my_species.cold_level_1 : 243) + if(COLD_LEVEL_2) + return isSynthetic() ? SYNTH_COLD_LEVEL_2 : (my_species ? my_species.cold_level_2 : 200) + if(COLD_LEVEL_3) + return isSynthetic() ? SYNTH_COLD_LEVEL_3 : (my_species ? my_species.cold_level_3 : 120) + if(HEAT_LEVEL_1) + return isSynthetic() ? SYNTH_HEAT_LEVEL_1 : (my_species ? my_species.heat_level_1 : 360) + if(HEAT_LEVEL_2) + return isSynthetic() ? SYNTH_HEAT_LEVEL_2 : (my_species ? my_species.heat_level_2 : 400) + if(HEAT_LEVEL_3) + return isSynthetic() ? SYNTH_HEAT_LEVEL_3 : (my_species ? my_species.heat_level_3 : 1000) + +/mob/proc/get_ideal_bodytemp() + var/decl/species/my_species = get_species() + if(my_species) + if(isnull(my_species.body_temperature)) + return (getSpeciesOrSynthTemp(HEAT_LEVEL_1) + getSpeciesOrSynthTemp(COLD_LEVEL_1))/2 + return my_species.body_temperature + return 310.15 + +/mob/proc/set_special_ability_cooldown(var/amt) + return + +/mob/proc/is_on_special_ability_cooldown() + return FALSE + +/mob/get_cell() + var/obj/item/organ/internal/cell/cell_organ = get_organ(BP_CELL, /obj/item/organ/internal/cell) + return cell_organ?.cell + /mob/proc/get_temperature_threshold(var/threshold) switch(threshold) @@ -1338,3 +1365,4 @@ return 1000 else CRASH("base get_temperature_threshold() called with invalid threshold value.") + diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 245f6991ecd6..65265f1a6921 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -39,36 +39,6 @@ var/stat = CONSCIOUS //Whether a mob is alive or dead. TODO: Move this to living - Nodrak - var/obj/screen/cells = null - - var/obj/screen/hands = null - var/obj/screen/internals = null - var/obj/screen/oxygen = null - var/obj/screen/toxin = null - var/obj/screen/fire = null - var/obj/screen/bodytemp = null - var/obj/screen/healths = null - var/obj/screen/throw_icon = null - var/obj/screen/nutrition_icon = null - var/obj/screen/hydration_icon = null - var/obj/screen/pressure = null - var/obj/screen/pain = null - var/obj/screen/up_hint = null - var/obj/screen/gun/item/item_use_icon = null - var/obj/screen/gun/radio/radio_use_icon = null - var/obj/screen/gun/move/gun_move_icon = null - var/obj/screen/gun/mode/gun_setting_icon = null - - var/obj/screen/ability_master/ability_master = null - - /*A bunch of this stuff really needs to go under their own defines instead of being globally attached to mob. - A variable should only be globally attached to turfs/objects/whatever, when it is in fact needed as such. - The current method unnecessarily clusters up the variable list, especially for humans (although rearranging won't really clean it up a lot but the difference will be noticable for other mobs). - I'll make some notes on where certain variable defines should probably go. - Changing this around would probably require a good look-over the pre-existing code. - */ - var/obj/screen/zone_selector/zone_sel = null - /// Cursor icon used when holding shift over things. var/examine_cursor_icon = 'icons/effects/mouse_pointers/examine_pointer.dmi' diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index c282674ab71a..45072aef619b 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -13,7 +13,7 @@ return FALSE //M is too small to wield this return TRUE -/mob/living/proc/isSynthetic() +/mob/proc/isSynthetic() return 0 /mob/living/carbon/human/isSynthetic() @@ -375,6 +375,8 @@ var/global/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HURT) set name = "a-intent" set hidden = 1 + var/obj/screen/action_intent = get_hud_element(/decl/hud_element/action_intent) + if(can_change_intent()) switch(input) if(I_HELP,I_DISARM,I_GRAB,I_HURT) @@ -383,8 +385,8 @@ var/global/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HURT) a_intent = intent_numeric((intent_numeric(a_intent)+1) % 4) if("left") a_intent = intent_numeric((intent_numeric(a_intent)+3) % 4) - if(hud_used && hud_used.action_intent) - hud_used.action_intent.icon_state = "intent_[a_intent]" + if(action_intent) + action_intent.icon_state = "intent_[a_intent]" else if(isrobot(src)) switch(input) @@ -394,11 +396,11 @@ var/global/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HURT) a_intent = I_HURT if("right","left") a_intent = intent_numeric(intent_numeric(a_intent) - 3) - if(hud_used && hud_used.action_intent) + if(action_intent) if(a_intent == I_HURT) - hud_used.action_intent.icon_state = I_HURT + action_intent.icon_state = I_HURT else - hud_used.action_intent.icon_state = I_HELP + action_intent.icon_state = I_HELP /proc/is_blind(A) if(istype(A, /mob/living/carbon)) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 6868751a02fc..fa05fd8700ec 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -273,8 +273,9 @@ /mob/proc/set_move_intent(var/decl/move_intent/next_intent) if(next_intent && move_intent != next_intent && next_intent.can_be_used_by(src)) move_intent = next_intent - if(hud_used) - hud_used.move_intent.icon_state = move_intent.hud_icon_state + var/obj/screen/hud_move_intent = get_hud_element(/decl/hud_element/move_intent) + if(hud_move_intent) + hud_move_intent.icon_state = move_intent.hud_icon_state return TRUE return FALSE diff --git a/code/modules/mob/observer/eye/freelook/life.dm b/code/modules/mob/observer/eye/freelook/life.dm index 98b9c477e1fc..3758115e604d 100644 --- a/code/modules/mob/observer/eye/freelook/life.dm +++ b/code/modules/mob/observer/eye/freelook/life.dm @@ -1,5 +1,7 @@ /mob/observer/eye/freelook/Life() - ..() + . = ..() + if(. == PROCESS_KILL) + return // If we lost our client, reset the list of visible chunks so they update properly on return if(owner == src && !client) visibleChunks.Cut() diff --git a/code/modules/mob/observer/ghost/ghost.dm b/code/modules/mob/observer/ghost/ghost.dm index dff96ea14cc1..47d01ed52cf5 100644 --- a/code/modules/mob/observer/ghost/ghost.dm +++ b/code/modules/mob/observer/ghost/ghost.dm @@ -110,9 +110,13 @@ Works together with spawning an observer, noted above. */ /mob/observer/ghost/Life() - ..() - if(!loc) return - if(!client) return 0 + + . = ..() + if(. == PROCESS_KILL) + return + + if(!loc || !client) + return handle_hud_glasses() diff --git a/code/modules/modular_computers/file_system/programs/research/ai_restorer.dm b/code/modules/modular_computers/file_system/programs/research/ai_restorer.dm index a304cca03189..bda3f19343f5 100644 --- a/code/modules/modular_computers/file_system/programs/research/ai_restorer.dm +++ b/code/modules/modular_computers/file_system/programs/research/ai_restorer.dm @@ -69,7 +69,7 @@ A.adjustFireLoss(-4) A.adjustBruteLoss(-4) A.adjustOxyLoss(-4) - A.updatehealth() + A.update_health() // If the AI is dead, revive it. if (A.health >= -100 && A.stat == DEAD) A.set_stat(CONSCIOUS) diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm index 3cdf5c285296..7a3000d6d0ac 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -266,7 +266,7 @@ var/obj/item/organ/external/victim = pick(victims) victim.dislocate() to_chat(src, "You feel a sickening pop as your [victim.joint] is wrenched out of the socket.") - updatehealth() + update_health() /mob/living/carbon/human/proc/climb_up(atom/A) if(!isturf(loc) || !bound_overlay || bound_overlay.destruction_timer || is_physically_disabled()) // This destruction_timer check ideally wouldn't be required, but I'm not awake enough to refactor this to not need it. diff --git a/code/modules/organs/external/_external.dm b/code/modules/organs/external/_external.dm index fa44143ada3f..de90076b1920 100644 --- a/code/modules/organs/external/_external.dm +++ b/code/modules/organs/external/_external.dm @@ -406,7 +406,6 @@ /obj/item/organ/external/update_health() damage = min(max_damage, (brute_dam + burn_dam)) - return //If "in_place" is TRUE will make organs skip their install/uninstall effects and the sub-limbs and internal organs /obj/item/organ/external/do_install(mob/living/carbon/human/target, obj/item/organ/external/affected, in_place, update_icon, detached) @@ -584,7 +583,7 @@ This function completely restores a damaged organ to perfect condition. . = ..() // Clear damage, reapply aspects. if(owner) - owner.updatehealth() + owner.update_health() //#TODO: Rejuvination hacks should probably be removed /obj/item/organ/external/remove_rejuv() @@ -625,7 +624,7 @@ This function completely restores a damaged organ to perfect condition. switch(type) if(BURN) fluid_loss_severity = FLUIDLOSS_WIDE_BURN if(LASER) fluid_loss_severity = FLUIDLOSS_CONC_BURN - var/fluid_loss = (damage/(owner.maxHealth - config.health_threshold_dead)) * SPECIES_BLOOD_DEFAULT * fluid_loss_severity + var/fluid_loss = (damage/(owner.get_max_health() - config.health_threshold_dead)) * SPECIES_BLOOD_DEFAULT * fluid_loss_severity owner.remove_blood(fluid_loss) // first check whether we can widen an existing wound diff --git a/code/modules/organs/external/_external_damage.dm b/code/modules/organs/external/_external_damage.dm index 096acd2f761d..3440aa38f22b 100644 --- a/code/modules/organs/external/_external_damage.dm +++ b/code/modules/organs/external/_external_damage.dm @@ -10,7 +10,7 @@ take_external_damage(amount) /obj/item/organ/external/proc/take_external_damage(brute, burn, damage_flags, used_weapon, override_droplimb) - + if(!owner) return @@ -48,7 +48,7 @@ burn = max(burn - spillover, 0) //If limb took enough damage, try to cut or tear it off if(owner && loc == owner) - owner.updatehealth() //droplimb will call updatehealth() again if it does end up being called + owner.update_health() //droplimb will call update_health() again if it does end up being called if((limb_flags & ORGAN_FLAG_CAN_AMPUTATE) && config.limbs_can_break) var/total_damage = brute_dam + burn_dam + brute + burn + spillover var/threshold = max_damage * config.organ_health_multiplier @@ -113,7 +113,7 @@ // sync the organ's damage with its wounds update_damages() - owner.updatehealth() + owner.update_health() if(status & ORGAN_BLEEDING) owner.update_bandages() @@ -193,7 +193,7 @@ //Sync the organ's damage with its wounds src.update_damages() - owner.updatehealth() + owner.update_health() return update_damstate() @@ -289,7 +289,7 @@ if(agony_amount && owner && can_feel_pain()) agony_amount -= (GET_CHEMICAL_EFFECT(owner, CE_PAINKILLER)/2)//painkillers does wonders! agony_amount += get_pain() - if(agony_amount < 5) + if(agony_amount < 5) return if(check_pain_disarm()) diff --git a/code/modules/organs/internal/heart.dm b/code/modules/organs/internal/heart.dm index 8c378497f586..d82a2347869c 100644 --- a/code/modules/organs/internal/heart.dm +++ b/code/modules/organs/internal/heart.dm @@ -70,7 +70,7 @@ return else //and if it's beating, let's see if it should var/should_stop = prob(80) && owner.get_blood_circulation() < BLOOD_VOLUME_SURVIVE //cardiovascular shock, not enough liquid to pump - should_stop = should_stop || prob(max(0, owner.getBrainLoss() - owner.maxHealth * 0.75)) //brain failing to work heart properly + should_stop = should_stop || prob(max(0, owner.getBrainLoss() - owner.get_max_health() * 0.75)) //brain failing to work heart properly should_stop = should_stop || (prob(5) && pulse == PULSE_THREADY) //erratic heart patterns, usually caused by oxyloss if(should_stop) // The heart has stopped due to going into traumatic or cardiovascular shock. to_chat(owner, "Your heart has stopped!") diff --git a/code/modules/organs/internal/lungs.dm b/code/modules/organs/internal/lungs.dm index fee2235d1dc3..757e04c23afc 100644 --- a/code/modules/organs/internal/lungs.dm +++ b/code/modules/organs/internal/lungs.dm @@ -199,12 +199,12 @@ to_chat(owner, SPAN_NOTICE("It gets easier to breathe.")) breath_fail_ratio = clamp(0,breath_fail_ratio-0.05,1) - owner.oxygen_alert = failed_inhale * 2 - + var/alert_val = (failed_inhale * 2) + SET_HUD_ALERT(owner, /decl/hud_element/condition/oxygen, alert_val) var/inhaled_gas_used = inhaling / 4 breath.adjust_gas(breath_type, -inhaled_gas_used, update = 0) //update afterwards - owner.toxins_alert = 0 // Reset our toxins alert for now. + SET_HUD_ALERT(owner, /decl/hud_element/condition/toxins, 0) if(!failed_inhale) // Enough gas to tell we're being poisoned via chemical burns or whatever. var/poison_total = 0 if(poison_types) @@ -212,7 +212,7 @@ if(poison_types[gname]) poison_total += breath.gas[gname] if(((poison_total/breath.total_moles)*breath_pressure) > safe_toxins_max) - owner.toxins_alert = 1 + SET_HUD_ALERT(owner, /decl/hud_element/condition/toxins, 1) // Pass reagents from the gas into our body. // Presumably if you breathe it you have a specialized metabolism for it, so we drop/ignore breath_type. Also avoids @@ -252,7 +252,7 @@ if(failed_breath) handle_failed_breath() else - owner.oxygen_alert = 0 + SET_HUD_ALERT(owner, /decl/hud_element/condition/oxygen, 0) return failed_breath /obj/item/organ/internal/lungs/proc/handle_failed_breath() @@ -266,7 +266,7 @@ if(damage || GET_CHEMICAL_EFFECT(owner, CE_BREATHLOSS) || world.time > last_successful_breath + 2 MINUTES) owner.adjustOxyLoss(HUMAN_MAX_OXYLOSS*breath_fail_ratio) - owner.oxygen_alert = max(owner.oxygen_alert, 2) + SET_HUD_ALERT_MAX(owner, /decl/hud_element/condition/oxygen, 2) last_int_pressure = 0 /obj/item/organ/internal/lungs/proc/handle_temperature_effects(datum/gas_mixture/breath) @@ -289,7 +289,9 @@ owner.apply_damage(damage, BURN, BP_HEAD, used_weapon = "Excessive Cold") else src.damage += damage - owner.fire_alert = 1 + if(owner.hud_used) + SET_HUD_ALERT_MAX(owner, /decl/hud_element/condition/fire, 1) + else if(breath.temperature >= heat_1) if(prob(20)) to_chat(owner, "You feel your face burning and a searing heat in your lungs!") @@ -305,7 +307,7 @@ owner.apply_damage(damage, BURN, BP_HEAD, used_weapon = "Excessive Heat") else src.damage += damage - owner.fire_alert = 2 + SET_HUD_ALERT(owner, /decl/hud_element/condition/fire, 2) //breathing in hot/cold air also heats/cools you a bit var/temp_adj = breath.temperature - owner.bodytemperature diff --git a/code/modules/organs/pain.dm b/code/modules/organs/pain.dm index 535be3492ab8..4fb270c8acb5 100644 --- a/code/modules/organs/pain.dm +++ b/code/modules/organs/pain.dm @@ -1,12 +1,13 @@ /mob/proc/flash_pain(var/target) - if(pain) + var/obj/screen/pain_overlay = get_hud_element(/decl/hud_element/pain) + if(pain_overlay) var/matrix/M if(client && max(client.last_view_x_dim, client.last_view_y_dim) > 7) M = matrix() M.Scale(CEILING(client.last_view_x_dim/7), CEILING(client.last_view_y_dim/7)) - pain.transform = M - animate(pain, alpha = target, time = 15, easing = ELASTIC_EASING) - animate(pain, alpha = 0, time = 20) + pain_overlay.transform = M + animate(pain_overlay, alpha = target, time = 15, easing = ELASTIC_EASING) + animate(pain_overlay, alpha = 0, time = 20) // message is the custom message to be displayed // power decides how much painkillers will stop the message diff --git a/code/modules/organs/prosthetics/_prosthetics.dm b/code/modules/organs/prosthetics/_prosthetics.dm index 3397e7c28f77..9719758084fe 100644 --- a/code/modules/organs/prosthetics/_prosthetics.dm +++ b/code/modules/organs/prosthetics/_prosthetics.dm @@ -83,7 +83,7 @@ // Proc helper for attachment verb. /mob/living/carbon/human/proc/check_can_attach_modular_limb(var/obj/item/organ/external/E) - if(world.time < last_special + (2 SECONDS) || get_active_hand() != E) + if(is_on_special_ability_cooldown() || get_active_hand() != E) return FALSE if(incapacitated() || restrained()) to_chat(src, SPAN_WARNING("You can't do that in your current state!")) @@ -114,7 +114,7 @@ // Proc helper for detachment verb. /mob/living/carbon/human/proc/check_can_detach_modular_limb(var/obj/item/organ/external/E) - if(world.time < last_special + (2 SECONDS)) + if(is_on_special_ability_cooldown()) return FALSE if(incapacitated() || restrained()) to_chat(src, SPAN_WARNING("You can't do that in your current state!")) @@ -143,12 +143,12 @@ var/obj/item/organ/external/E = get_active_hand() if(!check_can_attach_modular_limb(E)) return FALSE + set_special_ability_cooldown(2 SECONDS) if(!do_after(src, 2 SECONDS, src)) return FALSE if(!check_can_attach_modular_limb(E)) return FALSE - last_special = world.time drop_from_inventory(E) src.add_organ(E) @@ -177,12 +177,12 @@ var/obj/item/organ/external/E = input(usr, "Which limb do you wish to detach?", "Limb Removal") as null|anything in detachable_limbs if(!check_can_detach_modular_limb(E)) return FALSE + set_special_ability_cooldown(2 SECONDS) if(!do_after(src, 2 SECONDS, src)) return FALSE if(!check_can_detach_modular_limb(E)) return FALSE - last_special = world.time remove_organ(E) E.dropInto(loc) put_in_hands(E) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index 4b273e23071a..2e119fd4ec20 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -305,9 +305,9 @@ if(length(holding)) holding = "They are holding [english_list(holding)]" if(!mob_detail) - mob_detail = "You can see [A] on the photo[(A.health / A.maxHealth) < 0.75 ? " - [A] looks hurt":""].[holding ? " [holding]":"."]. " + mob_detail = "You can see [A] on the photo[(A.health / A.get_max_health()) < 0.75 ? " - [A] looks hurt":""].[holding ? " [holding]":"."]. " else - mob_detail += "You can also see [A] on the photo[(A.health / A.maxHealth)< 0.75 ? " - [A] looks hurt":""].[holding ? " [holding]":"."]." + mob_detail += "You can also see [A] on the photo[(A.health / A.get_max_health())< 0.75 ? " - [A] looks hurt":""].[holding ? " [holding]":"."]." return mob_detail /obj/item/camera/afterattack(atom/target, mob/user, flag) diff --git a/code/modules/power/singularity/particle_accelerator/particle.dm b/code/modules/power/singularity/particle_accelerator/particle.dm index 0b46a43221b6..dac31545c780 100644 --- a/code/modules/power/singularity/particle_accelerator/particle.dm +++ b/code/modules/power/singularity/particle_accelerator/particle.dm @@ -63,7 +63,7 @@ /obj/effect/accelerated_particle/proc/toxmob(var/mob/living/M) var/radiation = (energy*2) M.apply_damage((radiation*3),IRRADIATE, damage_flags = DAM_DISPERSED) - M.updatehealth() + M.update_health() /obj/effect/accelerated_particle/proc/move(var/lag) set waitfor = FALSE diff --git a/code/modules/projectiles/targeting/targeting_client.dm b/code/modules/projectiles/targeting/targeting_client.dm index eeaf61909deb..0facc51e6012 100644 --- a/code/modules/projectiles/targeting/targeting_client.dm +++ b/code/modules/projectiles/targeting/targeting_client.dm @@ -1,12 +1,16 @@ //These are called by the on-screen buttons, adjusting what the victim can and cannot do. /client/proc/add_gun_icons() - if(!usr || !usr.item_use_icon) return 1 // This can runtime if someone manages to throw a gun out of their hand before the proc is called. - screen |= usr.item_use_icon - screen |= usr.gun_move_icon - screen |= usr.radio_use_icon + if(!usr?.hud_used) + return + for(var/elem_type in global.gun_hud_flag_decl_types) + var/obj/screen/elem = usr.get_hud_element(elem_type) + if(elem) + screen |= elem /client/proc/remove_gun_icons() - if(!usr) return 1 // Runtime prevention on N00k agents spawning with SMG - screen -= usr.item_use_icon - screen -= usr.gun_move_icon - screen -= usr.radio_use_icon + if(!usr?.hud_used) + return + for(var/elem_type in global.gun_hud_flag_decl_types) + var/obj/screen/elem = usr.get_hud_element(elem_type) + if(elem) + screen -= elem diff --git a/code/modules/projectiles/targeting/targeting_overlay.dm b/code/modules/projectiles/targeting/targeting_overlay.dm index 383924a606a7..44c1eef9ed0f 100644 --- a/code/modules/projectiles/targeting/targeting_overlay.dm +++ b/code/modules/projectiles/targeting/targeting_overlay.dm @@ -32,29 +32,13 @@ target_permissions |= perm // Update HUD icons. - if(owner.gun_move_icon) - if(!(target_permissions & TARGET_CAN_MOVE)) - owner.gun_move_icon.icon_state = "no_walk0" - owner.gun_move_icon.SetName("Allow Movement") - else - owner.gun_move_icon.icon_state = "no_walk1" - owner.gun_move_icon.SetName("Disallow Movement") + if(!owner?.hud_used) + return - if(owner.item_use_icon) - if(!(target_permissions & TARGET_CAN_CLICK)) - owner.item_use_icon.icon_state = "no_item0" - owner.item_use_icon.SetName("Allow Item Use") - else - owner.item_use_icon.icon_state = "no_item1" - owner.item_use_icon.SetName("Disallow Item Use") - - if(owner.radio_use_icon) - if(!(target_permissions & TARGET_CAN_RADIO)) - owner.radio_use_icon.icon_state = "no_radio0" - owner.radio_use_icon.SetName("Allow Radio Use") - else - owner.radio_use_icon.icon_state = "no_radio1" - owner.radio_use_icon.SetName("Disallow Radio Use") + for(var/gun_flag_elem in global.gun_hud_flag_decl_types) + var/obj/screen/gun_flag/gun_elem = owner.get_hud_element(gun_flag_elem) + if(istype(gun_elem)) + gun_elem.update_from_aiming_overlay(src) var/message = "no longer permitted to " var/use_span = "warning" @@ -173,7 +157,7 @@ LAZYDISTINCTADD(aiming_at.aimed_at_by, src) toggle_active(1) locked = 0 - + update_icon() lock_time = world.time + 35 events_repository.register(/decl/observ/moved, owner, src, /obj/aiming_overlay/proc/update_aiming) @@ -206,7 +190,11 @@ if(!no_message) to_chat(owner, "You will no longer aim rather than fire.") owner.client.remove_gun_icons() - owner.gun_setting_icon.icon_state = "gun[active]" + + if(istype(owner.hud_used)) + var/obj/screen/gun_mode/gun_mode = owner.get_hud_element(/decl/hud_element/gun_mode) + if(gun_mode) + gun_mode.icon_state = "gun[!!active]" /obj/aiming_overlay/proc/cancel_aiming(var/no_message = 0) if(!aiming_with || !aiming_at) diff --git a/code/modules/recycling/disposalholder.dm b/code/modules/recycling/disposalholder.dm index 1441fcbcb3b6..ada6ca443ff2 100644 --- a/code/modules/recycling/disposalholder.dm +++ b/code/modules/recycling/disposalholder.dm @@ -126,10 +126,10 @@ var/mob/living/U = user - if (U.stat || U.last_special <= world.time) + if (U.stat || U.is_on_special_ability_cooldown()) return - U.last_special = world.time+100 + U.set_special_ability_cooldown(10 SECONDS) var/turf/our_turf = get_turf(src) if (our_turf) diff --git a/code/modules/species/species.dm b/code/modules/species/species.dm index ee0d8f708547..0924e4c9fa6a 100644 --- a/code/modules/species/species.dm +++ b/code/modules/species/species.dm @@ -162,7 +162,7 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 // HUD data vars. var/datum/hud_data/hud - var/hud_type + var/species_hud_type var/grab_type = /decl/grab/normal/passive // The species' default grab type. @@ -415,8 +415,8 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200 if(!default_cultural_info[token]) default_cultural_info[token] = global.using_map.default_cultural_info[token] - if(hud_type) - hud = new hud_type() + if(species_hud_type) + hud = new species_hud_type() else hud = new() diff --git a/code/modules/species/species_hud.dm b/code/modules/species/species_hud.dm index d18384bffa02..25f6d608d9d4 100644 --- a/code/modules/species/species_hud.dm +++ b/code/modules/species/species_hud.dm @@ -1,17 +1,5 @@ /datum/hud_data var/icon // If set, overrides ui_style. - var/has_a_intent = 1 // Set to draw intent box. - var/has_m_intent = 1 // Set to draw move intent box. - var/has_warnings = 1 // Set to draw environment warnings. - var/has_pressure = 1 // Draw the pressure indicator. - var/has_nutrition = 1 // Draw the nutrition indicator. - var/has_bodytemp = 1 // Draw the bodytemp indicator. - var/has_hands = 1 // Set to draw hands. - var/has_drop = 1 // Set to draw drop button. - var/has_throw = 1 // Set to draw throw button. - var/has_resist = 1 // Set to draw resist button. - var/has_internals = 1 // Set to draw the internals toggle button. - var/has_up_hint = 1 // Set to draw the "look-up" hint icon var/list/equip_slots = list() // Checked by mob_can_equip(). var/list/persistent_slots = list() // Built in New(), used for unhidable inv updates var/list/hidden_slots = list() // Built in New(), used for hidable inv updates @@ -50,8 +38,7 @@ else if(slot_id in global.hidden_inventory_slots) hidden_slots |= slot_id - if(has_hands) - equip_slots |= slot_handcuffed_str + equip_slots |= slot_handcuffed_str if(slot_back_str in equip_slots) equip_slots |= slot_in_backpack_str diff --git a/code/modules/species/species_shapeshifter.dm b/code/modules/species/species_shapeshifter.dm index 9d0f308aa23a..af816b7fe97d 100644 --- a/code/modules/species/species_shapeshifter.dm +++ b/code/modules/species/species_shapeshifter.dm @@ -53,10 +53,10 @@ var/global/list/wrapped_species_by_ref = list() set name = "Select Hair" set category = "Abilities" - if(stat || world.time < last_special) + if(stat || is_on_special_ability_cooldown()) return - last_special = world.time + 10 + set_special_ability_cooldown(1 SECOND) visible_message("\The [src]'s form contorts subtly.") var/list/hairstyles = species.get_hair_styles(bodytype.associated_gender) @@ -74,10 +74,10 @@ var/global/list/wrapped_species_by_ref = list() set name = "Select Gender" set category = "Abilities" - if(stat || world.time < last_special) + if(stat || is_on_special_ability_cooldown()) return - last_special = world.time + 50 + set_special_ability_cooldown(5 SECONDS) var/new_gender = input("Please select a gender.", "Shapeshifter Gender") as null|anything in list(FEMALE, MALE, NEUTER, PLURAL) if(!new_gender) @@ -91,10 +91,10 @@ var/global/list/wrapped_species_by_ref = list() set name = "Select Body Shape" set category = "Abilities" - if(stat || world.time < last_special) + if(stat || is_on_special_ability_cooldown()) return - last_special = world.time + 50 + set_special_ability_cooldown(5 SECONDS) var/new_species = input("Please select a species to emulate.", "Shapeshifter Body") as null|anything in species.get_valid_shapeshifter_forms(src) if(!new_species || !get_species_by_key(new_species) || wrapped_species_by_ref["\ref[src]"] == new_species) @@ -109,10 +109,10 @@ var/global/list/wrapped_species_by_ref = list() set name = "Select Body Colour" set category = "Abilities" - if(stat || world.time < last_special) + if(stat || is_on_special_ability_cooldown()) return - last_special = world.time + 50 + set_special_ability_cooldown(5 SECONDS) var/new_skin = input("Please select a new body color.", "Shapeshifter Colour") as color if(!new_skin) diff --git a/code/modules/species/station/monkey.dm b/code/modules/species/station/monkey.dm index a0ba7309067e..3f01853851cb 100644 --- a/code/modules/species/station/monkey.dm +++ b/code/modules/species/station/monkey.dm @@ -18,7 +18,7 @@ unarmed_attacks = list(/decl/natural_attack/bite, /decl/natural_attack/claws, /decl/natural_attack/punch) inherent_verbs = list(/mob/living/proc/ventcrawl) - hud_type = /datum/hud_data/monkey + species_hud_type = /datum/hud_data/monkey meat_type = /obj/item/chems/food/meat/monkey rarity_value = 0.1 diff --git a/code/modules/spells/aoe_turf/conjure/druidic_spells.dm b/code/modules/spells/aoe_turf/conjure/druidic_spells.dm index 70a37798f3fa..59c1d00b1713 100644 --- a/code/modules/spells/aoe_turf/conjure/druidic_spells.dm +++ b/code/modules/spells/aoe_turf/conjure/druidic_spells.dm @@ -39,7 +39,12 @@ if(!..()) return 0 - newVars = list("maxHealth" = 20 + spell_levels[Sp_POWER]*5, "health" = 20 + spell_levels[Sp_POWER]*5, "melee_damage_lower" = 10 + spell_levels[Sp_POWER], "melee_damage_upper" = 10 + spell_levels[Sp_POWER]*2) + newVars = list( + "mob_default_max_health" = 20 + spell_levels[Sp_POWER]*5, + "health" = 20 + spell_levels[Sp_POWER]*5, + "melee_damage_lower" = 10 + spell_levels[Sp_POWER], + "melee_damage_upper" = 10 + spell_levels[Sp_POWER]*2 + ) return "Your bats are now stronger." @@ -59,11 +64,12 @@ summon_amt = 1 summon_type = list(/mob/living/simple_animal/hostile/commanded/bear) - newVars = list("maxHealth" = 15, - "health" = 15, - "melee_damage_lower" = 10, - "melee_damage_upper" = 10, - ) + newVars = list( + "mob_default_max_health" = 15, + "health" = 15, + "melee_damage_lower" = 10, + "melee_damage_upper" = 10, + ) hud_state = "wiz_bear" @@ -76,34 +82,38 @@ return 0 switch(spell_levels[Sp_POWER]) if(1) - newVars = list("maxHealth" = 30, - "health" = 30, - "melee_damage_lower" = 15, - "melee_damage_upper" = 15 - ) + newVars = list( + "mob_default_max_health" = 30, + "health" = 30, + "melee_damage_lower" = 15, + "melee_damage_upper" = 15 + ) return "Your bear has been upgraded from a cub to a whelp." if(2) - newVars = list("maxHealth" = 45, - "health" = 45, - "melee_damage_lower" = 20, - "melee_damage_upper" = 20, - "color" = "#d9d9d9" //basically we want them to look different enough that people can recognize it. - ) + newVars = list( + "mob_default_max_health" = 45, + "health" = 45, + "melee_damage_lower" = 20, + "melee_damage_upper" = 20, + "color" = "#d9d9d9" //basically we want them to look different enough that people can recognize it. + ) return "Your bear has been upgraded from a whelp to an adult." if(3) - newVars = list("maxHealth" = 60, - "health" = 60, - "melee_damage_lower" = 25, - "melee_damage_upper" = 25, - "color" = "#8c8c8c" - ) + newVars = list( + "mob_default_max_health" = 60, + "health" = 60, + "melee_damage_lower" = 25, + "melee_damage_upper" = 25, + "color" = "#8c8c8c" + ) return "Your bear has been upgraded from an adult to an alpha." if(4) - newVars = list("maxHealth" = 75, - "health" = 75, - "melee_damage_lower" = 35, - "melee_damage_upper" = 35, - "resistance" = 3, - "color" = "#0099ff" - ) + newVars = list( + "mob_default_max_health" = 75, + "health" = 75, + "melee_damage_lower" = 35, + "melee_damage_upper" = 35, + "resistance" = 3, + "color" = "#0099ff" + ) return "Your bear is now worshiped as a god amongst bears." \ No newline at end of file diff --git a/code/modules/spells/contracts.dm b/code/modules/spells/contracts.dm index 1037d04b65d9..c05b875685ab 100644 --- a/code/modules/spells/contracts.dm +++ b/code/modules/spells/contracts.dm @@ -1,7 +1,7 @@ /obj/item/contract name = "contract" desc = "written in the blood of some unfortunate fellow." - icon = 'icons/mob/screen_spells.dmi' + icon = 'icons/mob/screen/spells.dmi' icon_state = "master_open" material = /decl/material/solid/cardboard //#TODO: replace with paper var/contract_master = null diff --git a/code/modules/spells/hand/hand_item.dm b/code/modules/spells/hand/hand_item.dm index 855cfdcfa921..dd5f6ee6d906 100644 --- a/code/modules/spells/hand/hand_item.dm +++ b/code/modules/spells/hand/hand_item.dm @@ -4,12 +4,12 @@ Basically: I can use it to target things where I click. I can then pass these ta /obj/item/magic_hand name = "Magic Hand" - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/spells.dmi' + icon_state = "spell" atom_flags = 0 item_flags = 0 obj_flags = 0 simulated = 0 - icon_state = "spell" max_health = ITEM_HEALTH_NO_DAMAGE is_spawnable_type = FALSE var/next_spell_time = 0 diff --git a/code/modules/spells/spell_code.dm b/code/modules/spells/spell_code.dm index c4acd43cca28..a9d3c2d83385 100644 --- a/code/modules/spells/spell_code.dm +++ b/code/modules/spells/spell_code.dm @@ -240,7 +240,7 @@ var/global/list/spells = typesof(/spell) //needed for the badmin verb for now if(holder == user) if(istype(user, /mob/living/simple_animal)) var/mob/living/simple_animal/SA = user - if(SA.purge) + if(SA.purged_time) to_chat(SA, "The null sceptre's power interferes with your own!") return 0 diff --git a/code/modules/spells/spells.dm b/code/modules/spells/spells.dm index 19ad57ce0e96..61b39e603bef 100644 --- a/code/modules/spells/spells.dm +++ b/code/modules/spells/spells.dm @@ -3,18 +3,8 @@ /mob/Stat() . = ..() - if(. && ability_master && ability_master.spell_objects) - for(var/obj/screen/ability/spell/screen in ability_master.spell_objects) - var/spell/S = screen.spell - if((!S.connected_button) || !statpanel(S.panel)) - continue //Not showing the noclothes spell - switch(S.charge_type) - if(Sp_RECHARGE) - statpanel(S.panel,"[S.charge_counter/10.0]/[S.charge_max/10]",S.connected_button) - if(Sp_CHARGES) - statpanel(S.panel,"[S.charge_counter]/[S.charge_max]",S.connected_button) - if(Sp_HOLDVAR) - statpanel(S.panel,"[S.holder_var_type] [S.holder_var_amount]",S.connected_button) + if(. && istype(hud_used)) + hud_used.refresh_stat_panel() /proc/restore_spells(var/mob/H) if(H.mind && H.mind.learned_spells) @@ -27,11 +17,14 @@ for(var/spell/spell_to_add in spells) H.add_spell(spell_to_add) - H.ability_master.update_abilities(0,H) + var/obj/screen/ability_master/ability_master = H.get_hud_element(/decl/hud_element/ability_master) + if(ability_master) + ability_master.update_abilities(0,H) /mob/proc/add_spell(var/spell/spell_to_add, var/spell_base = "wiz_spell_ready") + var/obj/screen/ability_master/ability_master = get_hud_element(/decl/hud_element/ability_master) if(!ability_master) - ability_master = new() + return spell_to_add.holder = src if(mind) if(!mind.learned_spells) @@ -46,6 +39,7 @@ if(mind) mind.learned_spells -= spell_to_remove + var/obj/screen/ability_master/ability_master = get_hud_element(/decl/hud_element/ability_master) if (ability_master) ability_master.remove_ability(ability_master.get_ability_by_spell(spell_to_remove)) return 1 @@ -53,8 +47,6 @@ /mob/proc/silence_spells(var/amount = 0) if(amount < 0) return - - if(!ability_master) - return - - ability_master.silence_spells(amount) \ No newline at end of file + var/obj/screen/ability_master/ability_master = get_hud_element(/decl/hud_element/ability_master) + if(ability_master) + ability_master.silence_spells(amount) diff --git a/code/modules/spells/targeted/equip/burning_touch.dm b/code/modules/spells/targeted/equip/burning_touch.dm index b9b8ee356297..aa1cb0c9705b 100644 --- a/code/modules/spells/targeted/equip/burning_touch.dm +++ b/code/modules/spells/targeted/equip/burning_touch.dm @@ -16,7 +16,7 @@ /obj/item/flame/hands name = "Burning Hand" - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/grabs.dmi' icon_state = "grabbed+1" force = 10 damtype = BURN diff --git a/code/modules/spells/targeted/shapeshift.dm b/code/modules/spells/targeted/shapeshift.dm index 4140e9bd27da..19c510e4d235 100644 --- a/code/modules/spells/targeted/shapeshift.dm +++ b/code/modules/spells/targeted/shapeshift.dm @@ -73,8 +73,9 @@ return FALSE transformer.status_flags &= ~GODMODE if(share_damage) - var/ratio = target.health/target.maxHealth - var/damage = transformer.maxHealth - round(transformer.maxHealth*(ratio)) + var/ratio = target.health/target.get_max_health() + var/trans_max_health = transformer.get_max_health() + var/damage = trans_max_health - round(trans_max_health*(ratio)) for(var/i in 1 to CEILING(damage/10)) transformer.adjustBruteLoss(10) if(target.mind) @@ -116,7 +117,10 @@ level_max = list(Sp_TOTAL = 2, Sp_SPEED = 2, Sp_POWER = 2) - newVars = list("health" = 50, "maxHealth" = 50) + newVars = list( + "health" = 50, + "mob_default_max_health" = 50 + ) hud_state = "wiz_poly" @@ -179,11 +183,13 @@ duration *= 2 return "You will now stay corrupted for [duration/10] seconds." if(2) - newVars = list("name" = "\proper corruption incarnate", - "melee_damage_upper" = 25, - "resistance" = 6, - "health" = 125, - "maxHealth" = 125) + newVars = list( + "name" = "\proper corruption incarnate", + "melee_damage_upper" = 25, + "resistance" = 6, + "health" = 125, + "mob_default_max_health" = 125 + ) duration = 0 return "You revel in the corruption. There is no turning back." diff --git a/code/modules/supermatter/setup_supermatter.dm b/code/modules/supermatter/setup_supermatter.dm index 357dec3464f2..0e0cd301f1a6 100644 --- a/code/modules/supermatter/setup_supermatter.dm +++ b/code/modules/supermatter/setup_supermatter.dm @@ -105,7 +105,7 @@ var/global/list/engine_setup_markers = list() invisibility = 101 anchored = 1 density = 0 - icon = 'icons/mob/screen1.dmi' + icon = 'icons/mob/screen/crosses.dmi' icon_state = "x3" /obj/effect/engine_setup/Initialize() diff --git a/code/unit_tests/mob_tests.dm b/code/unit_tests/mob_tests.dm index 49e1edf18f09..c13e86ee480e 100644 --- a/code/unit_tests/mob_tests.dm +++ b/code/unit_tests/mob_tests.dm @@ -251,7 +251,7 @@ var/global/default_mobloc = null /datum/unit_test/robot_module_icons name = "MOB: Robot Modules Shall Have UI Icons" - var/icon_file = 'icons/mob/screen1_robot.dmi' + var/icon_file = 'icons/mob/screen/robot_modules.dmi' /datum/unit_test/robot_module_icons/start_test() var/failed = 0 diff --git a/icons/mob/screen_ai.dmi b/icons/mob/screen/ai.dmi similarity index 100% rename from icons/mob/screen_ai.dmi rename to icons/mob/screen/ai.dmi diff --git a/icons/mob/screen/arrow.dmi b/icons/mob/screen/arrow.dmi new file mode 100644 index 000000000000..af9ab119939a Binary files /dev/null and b/icons/mob/screen/arrow.dmi differ diff --git a/icons/mob/screen/condition.dmi b/icons/mob/screen/condition.dmi new file mode 100644 index 000000000000..b602ea27580c Binary files /dev/null and b/icons/mob/screen/condition.dmi differ diff --git a/icons/mob/screen/construct.dmi b/icons/mob/screen/construct.dmi new file mode 100644 index 000000000000..5c7193ccd1b5 Binary files /dev/null and b/icons/mob/screen/construct.dmi differ diff --git a/icons/mob/screen/crosses.dmi b/icons/mob/screen/crosses.dmi new file mode 100644 index 000000000000..cc711a7a0c01 Binary files /dev/null and b/icons/mob/screen/crosses.dmi differ diff --git a/icons/mob/screen/fill.dmi b/icons/mob/screen/fill.dmi new file mode 100644 index 000000000000..712f127bac97 Binary files /dev/null and b/icons/mob/screen/fill.dmi differ diff --git a/icons/mob/screen_full.dmi b/icons/mob/screen/full.dmi similarity index 100% rename from icons/mob/screen_full.dmi rename to icons/mob/screen/full.dmi diff --git a/icons/mob/screen/grabs.dmi b/icons/mob/screen/grabs.dmi new file mode 100644 index 000000000000..4058c78bef38 Binary files /dev/null and b/icons/mob/screen/grabs.dmi differ diff --git a/icons/mob/screen/health_construct_artificer.dmi b/icons/mob/screen/health_construct_artificer.dmi new file mode 100644 index 000000000000..ea86c13574d0 Binary files /dev/null and b/icons/mob/screen/health_construct_artificer.dmi differ diff --git a/icons/mob/screen/health_construct_harvester.dmi b/icons/mob/screen/health_construct_harvester.dmi new file mode 100644 index 000000000000..0e6796a431c8 Binary files /dev/null and b/icons/mob/screen/health_construct_harvester.dmi differ diff --git a/icons/mob/screen/health_construct_juggernaut.dmi b/icons/mob/screen/health_construct_juggernaut.dmi new file mode 100644 index 000000000000..212ebbc3e4ee Binary files /dev/null and b/icons/mob/screen/health_construct_juggernaut.dmi differ diff --git a/icons/mob/screen/health_construct_wraith.dmi b/icons/mob/screen/health_construct_wraith.dmi new file mode 100644 index 000000000000..73f5a9102e78 Binary files /dev/null and b/icons/mob/screen/health_construct_wraith.dmi differ diff --git a/icons/mob/screen/health_human.dmi b/icons/mob/screen/health_human.dmi new file mode 100644 index 000000000000..695d606562b5 Binary files /dev/null and b/icons/mob/screen/health_human.dmi differ diff --git a/icons/mob/screen/health_robot.dmi b/icons/mob/screen/health_robot.dmi new file mode 100644 index 000000000000..95e64ec6b2de Binary files /dev/null and b/icons/mob/screen/health_robot.dmi differ diff --git a/icons/mob/screen/intent.dmi b/icons/mob/screen/intent.dmi new file mode 100644 index 000000000000..7f38d756a141 Binary files /dev/null and b/icons/mob/screen/intent.dmi differ diff --git a/icons/mob/screen/internals.dmi b/icons/mob/screen/internals.dmi new file mode 100644 index 000000000000..0ddffa7023c3 Binary files /dev/null and b/icons/mob/screen/internals.dmi differ diff --git a/icons/mob/screen/midnight.dmi b/icons/mob/screen/midnight.dmi index a654344696b6..11e8d71682d7 100644 Binary files a/icons/mob/screen/midnight.dmi and b/icons/mob/screen/midnight.dmi differ diff --git a/icons/mob/screen/minimalist.dmi b/icons/mob/screen/minimalist.dmi index 12591f10b299..b9c7ee418bb4 100644 Binary files a/icons/mob/screen/minimalist.dmi and b/icons/mob/screen/minimalist.dmi differ diff --git a/icons/mob/screen/old-noborder.dmi b/icons/mob/screen/old-noborder.dmi index 1ac07fc99d8c..9543076821af 100644 Binary files a/icons/mob/screen/old-noborder.dmi and b/icons/mob/screen/old-noborder.dmi differ diff --git a/icons/mob/screen/old.dmi b/icons/mob/screen/old.dmi index 152eaee1b309..8f83f56f4347 100644 Binary files a/icons/mob/screen/old.dmi and b/icons/mob/screen/old.dmi differ diff --git a/icons/mob/screen/orange.dmi b/icons/mob/screen/orange.dmi index 690189eaecd7..c81430635130 100644 Binary files a/icons/mob/screen/orange.dmi and b/icons/mob/screen/orange.dmi differ diff --git a/icons/mob/screen_phenomena.dmi b/icons/mob/screen/phenomena.dmi similarity index 100% rename from icons/mob/screen_phenomena.dmi rename to icons/mob/screen/phenomena.dmi diff --git a/icons/mob/screen/robot.dmi b/icons/mob/screen/robot.dmi new file mode 100644 index 000000000000..ed581ba9975f Binary files /dev/null and b/icons/mob/screen/robot.dmi differ diff --git a/icons/mob/screen/robot_charge.dmi b/icons/mob/screen/robot_charge.dmi new file mode 100644 index 000000000000..265c213516d8 Binary files /dev/null and b/icons/mob/screen/robot_charge.dmi differ diff --git a/icons/mob/screen/robot_conditions.dmi b/icons/mob/screen/robot_conditions.dmi new file mode 100644 index 000000000000..717853f481a3 Binary files /dev/null and b/icons/mob/screen/robot_conditions.dmi differ diff --git a/icons/mob/screen/robot_drop_grab.dmi b/icons/mob/screen/robot_drop_grab.dmi new file mode 100644 index 000000000000..7a1ecce37dfc Binary files /dev/null and b/icons/mob/screen/robot_drop_grab.dmi differ diff --git a/icons/mob/screen/robot_intent.dmi b/icons/mob/screen/robot_intent.dmi new file mode 100644 index 000000000000..165427cc6339 Binary files /dev/null and b/icons/mob/screen/robot_intent.dmi differ diff --git a/icons/mob/screen/robot_modules.dmi b/icons/mob/screen/robot_modules.dmi new file mode 100644 index 000000000000..b9061e1b6c67 Binary files /dev/null and b/icons/mob/screen/robot_modules.dmi differ diff --git a/icons/mob/screen/spells.dmi b/icons/mob/screen/spells.dmi new file mode 100644 index 000000000000..4916ce33ab5c Binary files /dev/null and b/icons/mob/screen/spells.dmi differ diff --git a/icons/mob/screen/white.dmi b/icons/mob/screen/white.dmi index dc4e7a40c215..7fcaa2650f02 100644 Binary files a/icons/mob/screen/white.dmi and b/icons/mob/screen/white.dmi differ diff --git a/icons/mob/screen1.dmi b/icons/mob/screen1.dmi deleted file mode 100644 index 7f8db4256da5..000000000000 Binary files a/icons/mob/screen1.dmi and /dev/null differ diff --git a/icons/mob/screen1_construct.dmi b/icons/mob/screen1_construct.dmi deleted file mode 100644 index 67a37ccd7388..000000000000 Binary files a/icons/mob/screen1_construct.dmi and /dev/null differ diff --git a/icons/mob/screen1_health.dmi b/icons/mob/screen1_health.dmi deleted file mode 100644 index 9cd7a4134202..000000000000 Binary files a/icons/mob/screen1_health.dmi and /dev/null differ diff --git a/icons/mob/screen1_robot.dmi b/icons/mob/screen1_robot.dmi deleted file mode 100644 index c6aa98f2b1fa..000000000000 Binary files a/icons/mob/screen1_robot.dmi and /dev/null differ diff --git a/icons/mob/screen_gen.dmi b/icons/mob/screen_gen.dmi deleted file mode 100644 index 436fb1169a2d..000000000000 Binary files a/icons/mob/screen_gen.dmi and /dev/null differ diff --git a/icons/mob/screen_spells.dmi b/icons/mob/screen_spells.dmi deleted file mode 100644 index 50be07d787b8..000000000000 Binary files a/icons/mob/screen_spells.dmi and /dev/null differ diff --git a/icons/mob/status_hunger.dmi b/icons/mob/status_hunger.dmi deleted file mode 100644 index db92eb35581e..000000000000 Binary files a/icons/mob/status_hunger.dmi and /dev/null differ diff --git a/icons/mob/status_indicators.dmi b/icons/mob/status_indicators.dmi deleted file mode 100644 index 80baa88177f7..000000000000 Binary files a/icons/mob/status_indicators.dmi and /dev/null differ diff --git a/maps/away/bearcat/bearcat.dm b/maps/away/bearcat/bearcat.dm index f72158abc35b..6027a630265c 100644 --- a/maps/away/bearcat/bearcat.dm +++ b/maps/away/bearcat/bearcat.dm @@ -117,8 +117,8 @@ corpse.name = "Captain" var/decl/hierarchy/outfit/outfit = outfit_by_type(/decl/hierarchy/outfit/deadcap) outfit.equip(corpse) - corpse.adjustOxyLoss(corpse.maxHealth) - corpse.setBrainLoss(corpse.maxHealth) + corpse.adjustOxyLoss(corpse.get_max_health()) + corpse.setBrainLoss(corpse.get_max_health()) var/obj/structure/bed/chair/C = locate() in T if(C) C.buckle_mob(corpse) diff --git a/maps/away/errant_pisces/errant_pisces.dm b/maps/away/errant_pisces/errant_pisces.dm index 3e181891c8e7..8dc3d7cf39bc 100644 --- a/maps/away/errant_pisces/errant_pisces.dm +++ b/maps/away/errant_pisces/errant_pisces.dm @@ -24,7 +24,7 @@ turns_per_move = 5 meat_type = /obj/item/chems/food/sharkmeat speed = 2 - maxHealth = 100 + mob_default_max_health = 100 health = 100 natural_weapon = /obj/item/natural_weapon/bite/strong break_stuff_probability = 35 diff --git a/maps/away/slavers/slavers_base.dm b/maps/away/slavers/slavers_base.dm index b7b2cf501574..830eef0f3563 100644 --- a/maps/away/slavers/slavers_base.dm +++ b/maps/away/slavers/slavers_base.dm @@ -134,7 +134,7 @@ turns_per_move = 5 speed = 4 stop_automated_movement_when_pulled = 0 - maxHealth = 100 + mob_default_max_health = 100 health = 100 natural_weapon = /obj/item/natural_weapon/punch can_escape = TRUE diff --git a/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dm b/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dm index a5b3ed11b3c1..8676c98c65d4 100644 --- a/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dm +++ b/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dm @@ -85,7 +85,7 @@ name = "goat" desc = "An impressive goat, in size and coat. His horns look pretty serious!" health = 100 - maxHealth = 100 + mob_default_max_health = 100 natural_weapon = /obj/item/natural_weapon/hooves/strong faction = "farmbots" @@ -100,7 +100,7 @@ emote_see = list("beeps repeatedly", "whirrs violently", "flashes its indicator lights", "emits a ping sound") faction = "farmbots" health = 225 - maxHealth = 225 + mob_default_max_health = 225 malfunctioning = 0 /mob/living/simple_animal/hostile/retaliate/malf_drone/hydro/Initialize() diff --git a/mods/content/corporate/away_sites/lar_maria/lar_maria.dm b/mods/content/corporate/away_sites/lar_maria/lar_maria.dm index 753bfa582447..699d11e215dd 100644 --- a/mods/content/corporate/away_sites/lar_maria/lar_maria.dm +++ b/mods/content/corporate/away_sites/lar_maria/lar_maria.dm @@ -54,7 +54,7 @@ /mob/living/simple_animal/hostile/lar_maria/test_subject name = "test subject" desc = "Sick, filthy, angry and probably crazy human in an orange robe." - maxHealth = 40 + mob_default_max_health = 40 health = 40 corpse = /obj/abstract/landmark/corpse/lar_maria/test_subject icon = 'mods/content/corporate/away_sites/lar_maria/lar_maria_test_subject.dmi' @@ -88,7 +88,7 @@ /mob/living/simple_animal/hostile/lar_maria/guard//angry guards armed with batons and shotguns. Still bite name = "security" desc = "Guard dressed at Zeng-Hu Pharmaceuticals uniform." - maxHealth = 60 + mob_default_max_health = 60 health = 60 natural_weapon = /obj/item/baton weapon = /obj/item/baton @@ -124,7 +124,7 @@ name = "virologist" desc = "Virologist dressed at Zeng-Hu Pharmaceuticals uniform." icon = 'mods/content/corporate/away_sites/lar_maria/lar_maria_virologist_m.dmi' - maxHealth = 50 + mob_default_max_health = 50 health = 50 corpse = /obj/abstract/landmark/corpse/lar_maria/virologist diff --git a/mods/content/xenobiology/circuit.dm b/mods/content/xenobiology/circuit.dm index 81e12500a025..37615e62df2f 100644 --- a/mods/content/xenobiology/circuit.dm +++ b/mods/content/xenobiology/circuit.dm @@ -30,7 +30,7 @@ set_pin_data(IC_OUTPUT, 2, T.is_adult) set_pin_data(IC_OUTPUT, 3, T.nutrition/T.get_max_nutrition()) set_pin_data(IC_OUTPUT, 4, T.powerlevel) - set_pin_data(IC_OUTPUT, 5, round(T.health/T.maxHealth,0.01)*100) + set_pin_data(IC_OUTPUT, 5, round(T.health/T.get_max_health(),0.01)*100) set_pin_data(IC_OUTPUT, 6, slime_data.descendants?.Copy()) set_pin_data(IC_OUTPUT, 7, T.mutation_chance) set_pin_data(IC_OUTPUT, 8, T.cores) diff --git a/mods/content/xenobiology/mobs/critter_slime.dm b/mods/content/xenobiology/mobs/critter_slime.dm index 4210eed8fc8c..72959dab2c51 100644 --- a/mods/content/xenobiology/mobs/critter_slime.dm +++ b/mods/content/xenobiology/mobs/critter_slime.dm @@ -4,7 +4,7 @@ icon = 'mods/content/xenobiology/icons/slimes/slime_baby.dmi' speak_emote = list("chirps") health = 100 - maxHealth = 100 + mob_default_max_health = 100 response_harm = "stamps on" emote_see = list("jiggles", "bounces in place") gene_damage = -1 @@ -25,7 +25,7 @@ SHOULD_CALL_PARENT(FALSE) icon = get_slime_icon() icon_state = (stat == DEAD ? "slime_dead" : "slime") - + /mob/living/simple_animal/slime/proc/get_slime_icon() var/decl/slime_colour/slime_data = GET_DECL(slime_type) return slime_data.baby_icon diff --git a/mods/content/xenobiology/mobs/slime_feeding_helpers.dm b/mods/content/xenobiology/mobs/slime_feeding_helpers.dm index d8bfbee4803b..7f7fbcc0146e 100644 --- a/mods/content/xenobiology/mobs/slime_feeding_helpers.dm +++ b/mods/content/xenobiology/mobs/slime_feeding_helpers.dm @@ -77,5 +77,5 @@ var/global/list/slime_pain_messages = list( if(prob(15) && client) handle_additional_slime_effects() . = 15 * protection - if(stat == DEAD || getCloneLoss() >= maxHealth) + if(stat == DEAD || getCloneLoss() >= get_max_health()) eaten_by_slime() diff --git a/mods/content/xenobiology/slime/_slime.dm b/mods/content/xenobiology/slime/_slime.dm index 196cbce35289..6e479c94e99d 100644 --- a/mods/content/xenobiology/slime/_slime.dm +++ b/mods/content/xenobiology/slime/_slime.dm @@ -8,7 +8,7 @@ icon_state = ICON_STATE_WORLD pass_flags = PASS_FLAG_TABLE speak_emote = list("chirps") - maxHealth = 150 + mob_default_max_health = 150 health = 150 gender = NEUTER update_icon = 0 @@ -21,7 +21,7 @@ bone_material = null bone_amount = 0 ai = /datum/ai/slime - hud_type = /datum/hud/slime + hud_used = /datum/hud/slime var/is_adult = FALSE var/mutation_chance = 30 // Chance of mutating, should be between 25 and 35 @@ -51,7 +51,7 @@ return /decl/material/liquid/slimejelly /mob/living/slime/adjustToxLoss(var/amount) - toxloss = clamp(toxloss + amount, 0, maxHealth) + toxloss = clamp(toxloss + amount, 0, get_max_health()) /mob/living/slime/setToxLoss(var/amount) adjustToxLoss(amount-getToxLoss()) @@ -87,7 +87,7 @@ var/tally = ..() - var/health_deficiency = (maxHealth - health) + var/health_deficiency = (get_max_health() - health) if(health_deficiency >= 30) tally += (health_deficiency / 25) if (bodytemperature < 183.222) @@ -146,7 +146,7 @@ . = ..() statpanel("Status") - stat(null, "Health: [round((health / maxHealth) * 100)]%") + stat(null, "Health: [round((health / get_max_health()) * 100)]%") stat(null, "Intent: [a_intent]") if (client.statpanel == "Status") @@ -343,7 +343,7 @@ else if (nutrition < get_hunger_nutrition()) . += "Warning:\tthe slime is hungry." . += "Electric charge strength:\t[powerlevel]" - . += "Health:\t[round((health * 100) / maxHealth)]%" + . += "Health:\t[round((health * 100) / get_max_health())]%" var/list/mutations = slime_data.descendants?.Copy() if(!mutations.len) diff --git a/mods/content/xenobiology/slime/feeding.dm b/mods/content/xenobiology/slime/feeding.dm index af7ea2288372..327219ea7bb7 100644 --- a/mods/content/xenobiology/slime/feeding.dm +++ b/mods/content/xenobiology/slime/feeding.dm @@ -31,7 +31,7 @@ if(!silent) to_chat(src, SPAN_WARNING("\The [src] is dead.")) return FEED_RESULT_DEAD - if(M.getCloneLoss() >= M.maxHealth * 1.5) + if(M.getCloneLoss() >= M.get_max_health() * 1.5) if(!silent) to_chat(src, SPAN_WARNING("\The [M] is too degraded to feed upon.")) return FEED_RESULT_DEAD diff --git a/mods/content/xenobiology/slime/life.dm b/mods/content/xenobiology/slime/life.dm index 78a1de1c7527..0e86c58dc1c3 100644 --- a/mods/content/xenobiology/slime/life.dm +++ b/mods/content/xenobiology/slime/life.dm @@ -1,13 +1,15 @@ /mob/living/slime/Life() . = ..() - if(. && stat != DEAD) + if(. == PROCESS_KILL) + return + if(stat != DEAD) handle_turf_contents() handle_local_conditions() if(feeding_on) slime_feed() ingested.metabolize() -/mob/living/slime/updatehealth() +/mob/living/slime/update_health() . = ..() if(stat != DEAD && health <= 0) death() @@ -29,7 +31,6 @@ death() else if(bodytemperature <= hurt_temperature) adjustToxLoss(30) - updatehealth() /mob/living/slime/proc/adjust_body_temperature(current, loc_temp, boost) var/delta = abs(current-loc_temp) diff --git a/mods/content/xenobiology/slime/powers.dm b/mods/content/xenobiology/slime/powers.dm index cac27ead4e2b..a90c4b879f9c 100644 --- a/mods/content/xenobiology/slime/powers.dm +++ b/mods/content/xenobiology/slime/powers.dm @@ -16,7 +16,7 @@ return is_adult = TRUE - maxHealth = 200 + mob_default_max_health = 200 amount_grown = 0 update_name() update_icon() diff --git a/mods/content/xenobiology/slime/slime_hud.dm b/mods/content/xenobiology/slime/slime_hud.dm index f81edf4e3fd7..7e8edc17290f 100644 --- a/mods/content/xenobiology/slime/slime_hud.dm +++ b/mods/content/xenobiology/slime/slime_hud.dm @@ -1,11 +1 @@ -/datum/hud/slime/FinalizeInstantiation() - src.adding = list() - - var/obj/screen/using - - using = new /obj/screen/intent() - src.adding += using - action_intent = using - - mymob.client.screen = list() - mymob.client.screen += src.adding +/datum/hud/slime diff --git a/mods/mobs/borers/mob/borer/borer.dm b/mods/mobs/borers/mob/borer/borer.dm index b967a1880b6a..356a189baac6 100644 --- a/mods/mobs/borers/mob/borer/borer.dm +++ b/mods/mobs/borers/mob/borer/borer.dm @@ -25,6 +25,8 @@ bleed_colour = "#816e12" + hud_used = /datum/hud/borer + var/static/list/chemical_types = list( "anti-trauma" = /decl/material/liquid/brute_meds, "amphetamines" = /decl/material/liquid/amphetamines, @@ -60,12 +62,14 @@ /mob/living/simple_animal/borer/Login() . = ..() + if(hud_used) + hud_used.refresh_ability_hud() if(mind && !neutered) var/decl/special_role/borer/borers = GET_DECL(/decl/special_role/borer) borers.add_antagonist(mind) /mob/living/simple_animal/borer/Initialize(var/mapload, var/gen=1) - + hud_used = neutered ? /datum/hud/borer : /datum/hud/borer/sterile . = ..() add_language(/decl/language/corticalborer) @@ -82,6 +86,9 @@ truename = "[borer_names[min(generation, borer_names.len)]] [random_id("borer[generation]", 1000, 9999)]" /mob/living/simple_animal/borer/Life() + . = ..() + if(. == PROCESS_KILL) + return sdisabilities = 0 if(host) @@ -97,10 +104,6 @@ set_status(STAT_BLIND, 0) set_status(STAT_BLURRY, 0) - . = ..() - if(!.) - return FALSE - if(host) if(!stat && !host.stat) @@ -204,23 +207,10 @@ qdel(host_brain) -#define COLOR_BORER_RED "#ff5555" -/mob/living/simple_animal/borer/proc/set_ability_cooldown(var/amt) - last_special = world.time + amt - var/datum/hud/borer/borer_hud = hud_used - if(istype(borer_hud)) - for(var/obj/thing in borer_hud.borer_hud_elements) - thing.color = COLOR_BORER_RED - addtimer(CALLBACK(src, /mob/living/simple_animal/borer/proc/reset_ui_callback), amt) -#undef COLOR_BORER_RED - /mob/living/simple_animal/borer/proc/leave_host() - var/datum/hud/borer/borer_hud = hud_used - if(istype(borer_hud)) - for(var/obj/thing in borer_hud.borer_hud_elements) - thing.alpha = 0 - thing.invisibility = INVISIBILITY_MAXIMUM + if(hud_used) + hud_used.hide_ability_hud() if(!host) return diff --git a/mods/mobs/borers/mob/borer/borer_attacks.dm b/mods/mobs/borers/mob/borer/borer_attacks.dm index b51723a88f55..97741af3fb16 100644 --- a/mods/mobs/borers/mob/borer/borer_attacks.dm +++ b/mods/mobs/borers/mob/borer/borer_attacks.dm @@ -31,7 +31,7 @@ to_chat(M, SPAN_WARNING("Something slimy begins probing at the opening of your ear canal...")) to_chat(src, SPAN_NOTICE("You slither up [M] and begin probing at their ear canal...")) - set_ability_cooldown(5 SECONDS) + set_special_ability_cooldown(5 SECONDS) if(!do_after(src, 3 SECONDS, M)) return @@ -44,11 +44,8 @@ host.status_flags |= PASSEMOTES forceMove(host) - var/datum/hud/borer/borer_hud = hud_used - if(istype(borer_hud)) - for(var/obj/thing in borer_hud.borer_hud_elements) - thing.alpha = 255 - thing.invisibility = 0 + if(hud_used) + hud_used.show_ability_hud() //Update their traitor status. if(host.mind && !neutered) diff --git a/mods/mobs/borers/mob/borer/borer_hud.dm b/mods/mobs/borers/mob/borer/borer_hud.dm index 17422752aaad..982033272411 100644 --- a/mods/mobs/borers/mob/borer/borer_hud.dm +++ b/mods/mobs/borers/mob/borer/borer_hud.dm @@ -1,56 +1,39 @@ +#define COLOR_BORER_RED "#ff5555" + /datum/hud/borer - var/list/borer_hud_elements = list() - var/obj/screen/intent/hud_intent_selector - var/obj/screen/borer/toggle_host_control/hud_toggle_control - var/obj/screen/borer/inject_chemicals/hud_inject_chemicals - var/obj/screen/borer/leave_host/hud_leave_host - -/datum/hud/borer/Destroy() - QDEL_NULL_LIST(borer_hud_elements) - hud_toggle_control = null - hud_inject_chemicals = null - hud_leave_host = null - QDEL_NULL(hud_intent_selector) - . = ..() + hud_elements = list( + /decl/hud_element/borer/inject_chems, + /decl/hud_element/borer/leave_host, + /decl/hud_element/borer/toggle_control + ) -/datum/hud/borer/FinalizeInstantiation() - hud_intent_selector = new - adding = list(hud_intent_selector) - hud_inject_chemicals = new - hud_leave_host = new - borer_hud_elements = list( - hud_inject_chemicals, - hud_leave_host +/datum/hud/borer/sterile + hud_elements = list( + /decl/hud_element/borer/inject_chems, + /decl/hud_element/borer/leave_host ) - if(istype(mymob, /mob/living/simple_animal/borer)) - var/mob/living/simple_animal/borer/borer = mymob - if(!borer.neutered) - hud_toggle_control = new - borer_hud_elements += hud_toggle_control - adding += borer_hud_elements - if(mymob) - var/mob/living/simple_animal/borer/borer = mymob - if(istype(borer) && borer.host) - for(var/obj/thing in borer_hud_elements) - thing.alpha = 255 - thing.invisibility = 0 - if(mymob.client) - mymob.client.screen |= adding - -/mob/living/simple_animal/borer - hud_type = /datum/hud/borer - -/mob/living/simple_animal/borer/proc/reset_ui_callback() - if(world.time >= last_special) - var/datum/hud/borer/borer_hud = hud_used - if(istype(borer_hud)) - for(var/obj/thing in borer_hud.borer_hud_elements) - thing.color = null + +/datum/hud/borer/should_show_ability_hud() + var/mob/living/simple_animal/borer/borer = mymob + return istype(borer) && borer.host + +/decl/hud_element/borer + abstract_type = /decl/hud_element/borer + apply_color_on_cooldown = TRUE + hidable = TRUE + +/decl/hud_element/borer/inject_chems + screen_object_type = /obj/screen/borer/inject_chemicals + +/decl/hud_element/borer/leave_host + screen_object_type = /obj/screen/borer/leave_host + +/decl/hud_element/borer/toggle_control + screen_object_type = /obj/screen/borer/toggle_host_control /obj/screen/borer icon = 'mods/mobs/borers/icons/borer_ui.dmi' alpha = 0 - invisibility = INVISIBILITY_MAXIMUM /obj/screen/borer/Click(location, control, params) if(!istype(usr, /mob/living/simple_animal/borer)) diff --git a/mods/mobs/borers/mob/borer/borer_powers.dm b/mods/mobs/borers/mob/borer/borer_powers.dm index 3402fa01eab4..45e8dbf2c1ad 100644 --- a/mods/mobs/borers/mob/borer/borer_powers.dm +++ b/mods/mobs/borers/mob/borer/borer_powers.dm @@ -25,7 +25,7 @@ if(!silent) to_chat(src, SPAN_NOTICE("You are feeling far too docile to perform this action.")) return FALSE - if(check_last_special && world.time < last_special) + if(check_last_special && is_on_special_ability_cooldown()) if(!silent) to_chat(src, SPAN_NOTICE("You cannot perform this action so soon after the last.")) return FALSE diff --git a/mods/mobs/dionaea/mob/_nymph.dm b/mods/mobs/dionaea/mob/_nymph.dm index bb24669059d0..aa5c649127d4 100644 --- a/mods/mobs/dionaea/mob/_nymph.dm +++ b/mods/mobs/dionaea/mob/_nymph.dm @@ -1,7 +1,6 @@ #define DIONA_SCREEN_LOC_HELD "RIGHT-8:16,BOTTOM:5" #define DIONA_SCREEN_LOC_HAT "RIGHT-7:16,BOTTOM:5" #define DIONA_SCREEN_LOC_INTENT "RIGHT-2,BOTTOM:5" -#define DIONA_SCREEN_LOC_HEALTH ui_alien_health /datum/extension/hattable/diona_nymph/wear_hat(mob/wearer, obj/item/clothing/head/new_hat) var/mob/living/carbon/alien/diona/doona = wearer @@ -17,7 +16,7 @@ icon_state = ICON_STATE_WORLD death_msg = "expires with a pitiful chirrup..." health = 60 - maxHealth = 60 + mob_default_max_health = 60 available_maneuvers = list(/decl/maneuver/leap) status_flags = NO_ANTAG @@ -35,7 +34,7 @@ holder_type = /obj/item/holder/diona possession_candidate = 1 atom_flags = ATOM_FLAG_NO_TEMP_CHANGE | ATOM_FLAG_NO_REACT - hud_type = /datum/hud/diona_nymph + hud_used = /datum/hud/diona_nymph ai = /datum/ai/nymph diff --git a/mods/mobs/dionaea/mob/nymph_ui.dm b/mods/mobs/dionaea/mob/nymph_ui.dm index 248a637f2195..df1d76cbffe1 100644 --- a/mods/mobs/dionaea/mob/nymph_ui.dm +++ b/mods/mobs/dionaea/mob/nymph_ui.dm @@ -1,3 +1,6 @@ +/decl/hud_element/action_intent/diona_nymph + screen_object_type = /obj/screen/intent/diona_nymph + /obj/screen/intent/diona_nymph icon_state = "intent_devour" screen_loc = DIONA_SCREEN_LOC_INTENT @@ -42,39 +45,17 @@ return 255 /datum/hud/diona_nymph/FinalizeInstantiation() - var/ui_style = get_ui_style() var/ui_color = get_ui_color() var/ui_alpha = get_ui_alpha() - - src.adding = list() - src.other = list() - hat = new hat.icon = ui_style hat.color = ui_color hat.alpha = ui_alpha - adding += hat - + misc_hud_elements += hat held = new held.icon = ui_style held.color = ui_color held.alpha = ui_alpha - adding += held - - action_intent = new /obj/screen/intent/diona_nymph() - action_intent.icon = ui_style - action_intent.color = ui_color - action_intent.alpha = ui_alpha - adding += action_intent - - mymob.healths = new /obj/screen() - mymob.healths.icon = ui_style - mymob.healths.color = ui_color - mymob.healths.alpha = ui_alpha - mymob.healths.icon_state = "health0" - mymob.healths.SetName("health") - mymob.healths.screen_loc = DIONA_SCREEN_LOC_HEALTH - - mymob.client.screen = list(mymob.healths) - mymob.client.screen += src.adding + src.other + misc_hud_elements += held + return ..() diff --git a/mods/mobs/dionaea/mob/~diona.dm b/mods/mobs/dionaea/mob/~diona.dm index 0df03ea0e903..f30cb151165e 100644 --- a/mods/mobs/dionaea/mob/~diona.dm +++ b/mods/mobs/dionaea/mob/~diona.dm @@ -1,4 +1,3 @@ #undef DIONA_SCREEN_LOC_HELD #undef DIONA_SCREEN_LOC_HAT #undef DIONA_SCREEN_LOC_INTENT -#undef DIONA_SCREEN_LOC_HEALTH \ No newline at end of file diff --git a/mods/species/ascent/mobs/nymph/_nymph.dm b/mods/species/ascent/mobs/nymph/_nymph.dm index 4ea753c23337..0ce9ffd34321 100644 --- a/mods/species/ascent/mobs/nymph/_nymph.dm +++ b/mods/species/ascent/mobs/nymph/_nymph.dm @@ -2,7 +2,6 @@ #define ANYMPH_SCREEN_LOC_HAT "RIGHT-7:16,BOTTOM:5" #define ANYMPH_SCREEN_LOC_MOLT "RIGHT-6:16,BOTTOM:5" #define ANYMPH_SCREEN_LOC_INTENT "RIGHT-2,BOTTOM:5" -#define ANYMPH_SCREEN_LOC_HEALTH ui_alien_health #define ANYMPH_MAX_CRYSTALS 20000 #define ANYMPH_CRYSTAL_MOLT 2000 // How much it takes to molt. @@ -16,7 +15,7 @@ icon_state = ICON_STATE_WORLD death_msg = "expires with a pitiful hiss..." health = 60 - maxHealth = 60 + mob_default_max_health = 60 available_maneuvers = list(/decl/maneuver/leap) only_species_language = 1 @@ -31,7 +30,7 @@ holder_type = /obj/item/holder/ascent_nymph possession_candidate = 1 atom_flags = ATOM_FLAG_NO_TEMP_CHANGE | ATOM_FLAG_NO_REACT - hud_type = /datum/hud/ascent_nymph + hud_used = /datum/hud/ascent_nymph var/obj/item/holding_item var/crystal_reserve = 1000 diff --git a/mods/species/ascent/mobs/nymph/nymph_life.dm b/mods/species/ascent/mobs/nymph/nymph_life.dm index 298f9e627f6c..daaadd969171 100644 --- a/mods/species/ascent/mobs/nymph/nymph_life.dm +++ b/mods/species/ascent/mobs/nymph/nymph_life.dm @@ -1,9 +1,9 @@ /mob/living/carbon/alien/ascent_nymph/Life() . = ..() - if(stat == DEAD) + if(. == PROCESS_KILL || stat == DEAD) return - + // Generate some crystals over time. if(nutrition >= 300 && crystal_reserve < ANYMPH_MAX_CRYSTALS) crystal_reserve = min(ANYMPH_MAX_CRYSTALS, crystal_reserve + 15) @@ -20,28 +20,6 @@ if(hydration > 0) adjust_hydration(DEFAULT_THIRST_FACTOR * -1) - update_nymph_hud() - -/mob/living/carbon/alien/ascent_nymph/proc/update_nymph_hud() - // Update the HUD. - var/datum/hud/ascent_nymph/nymph_hud = hud_used - if(istype(nymph_hud)) - if(nymph_hud.food) - switch(nutrition) - if(450 to INFINITY) nymph_hud.food.icon_state = "nutrition0" - if(350 to 450) nymph_hud.food.icon_state = "nutrition1" - if(250 to 350) nymph_hud.food.icon_state = "nutrition2" - if(150 to 250) nymph_hud.food.icon_state = "nutrition3" - else nymph_hud.food.icon_state = "nutrition4" - - if(nymph_hud.drink) - switch(hydration) - if(450 to INFINITY) nymph_hud.drink.icon_state = "hydration0" - if(350 to 450) nymph_hud.drink.icon_state = "hydration1" - if(250 to 350) nymph_hud.drink.icon_state = "hydration2" - if(150 to 250) nymph_hud.drink.icon_state = "hydration3" - else nymph_hud.drink.icon_state = "hydration4" - /mob/living/carbon/alien/ascent_nymph/proc/can_molt() if(crystal_reserve < ANYMPH_CRYSTAL_MOLT) to_chat(src, SPAN_WARNING("You don't have enough crystalline matter stored up to molt right now.")) @@ -61,7 +39,7 @@ molt = min(molt + 1, 5) var/mob/living/carbon/alien/ascent_nymph/nymph = usr nymph.visible_message("\icon[nymph] [nymph] begins to shimmy and shake out of its old skin.") - if(molt == 5) + if(molt == 5) if(do_after(nymph, 10 SECONDS, nymph, FALSE)) var/mob/living/carbon/human/H = new(get_turf(usr), SPECIES_MANTID_ALATE) H.dna.lineage = nymph.dna.lineage @@ -74,7 +52,7 @@ else nymph.visible_message("\icon[nymph] [nymph] abruptly stops molting.") return - + if(do_after(nymph, 5 SECONDS, nymph, FALSE)) var/matrix/M = matrix() M.Scale(1 + (molt / 10)) diff --git a/mods/species/ascent/mobs/nymph/nymph_ui.dm b/mods/species/ascent/mobs/nymph/nymph_ui.dm index 968405cc6bdd..17ff9a9476e1 100644 --- a/mods/species/ascent/mobs/nymph/nymph_ui.dm +++ b/mods/species/ascent/mobs/nymph/nymph_ui.dm @@ -1,3 +1,6 @@ +/decl/hud_element/action_intent/ascent_nymph + screen_object_type = /obj/screen/intent/ascent_nymph + /obj/screen/intent/ascent_nymph icon_state = "intent_devour" screen_loc = ANYMPH_SCREEN_LOC_INTENT @@ -30,10 +33,15 @@ if(istype(nymph)) nymph.molt() /datum/hud/ascent_nymph + health_hud_type = /decl/hud_element/health/ascent_nymph + hud_elements = list( + /decl/hud_element/health/ascent_nymph + ) var/obj/screen/ascent_nymph_held/held var/obj/screen/ascent_nymph_molt/molt - var/obj/screen/food/food - var/obj/screen/drink/drink + +/decl/hud_element/health/ascent_nymph + screen_loc = ui_alien_health /datum/hud/ascent_nymph/get_ui_style() return 'mods/species/ascent/icons/ui.dmi' @@ -45,53 +53,17 @@ return 255 /datum/hud/ascent_nymph/FinalizeInstantiation() - var/ui_style = get_ui_style() var/ui_color = get_ui_color() var/ui_alpha = get_ui_alpha() - - src.adding = list() - src.other = list() - held = new held.icon = ui_style held.color = ui_color held.alpha = ui_alpha - adding += held - + misc_hud_elements += held molt = new molt.icon = ui_style molt.color = ui_color molt.alpha = ui_alpha - adding += molt - - food = new - food.icon = 'icons/mob/status_hunger.dmi' - food.SetName("nutrition") - food.icon_state = "nutrition1" - food.pixel_w = 8 - food.screen_loc = ui_nutrition_small - adding += food - - drink = new - drink.icon = 'icons/mob/status_hunger.dmi' - drink.icon_state = "hydration1" - drink.SetName("hydration") - drink.screen_loc = ui_nutrition_small - adding += drink - - action_intent = new /obj/screen/intent/ascent_nymph() - action_intent.icon = ui_style - action_intent.color = ui_color - action_intent.alpha = ui_alpha - adding += action_intent - - mymob.healths = new /obj/screen() - mymob.healths.icon = ui_style - mymob.healths.color = ui_color - mymob.healths.alpha = ui_alpha - mymob.healths.SetName("health") - mymob.healths.screen_loc = ANYMPH_SCREEN_LOC_HEALTH - - mymob.client.screen = list(mymob.healths) - mymob.client.screen += src.adding + src.other \ No newline at end of file + misc_hud_elements += molt + return ..() diff --git a/mods/species/bayliens/adherent/datum/species.dm b/mods/species/bayliens/adherent/datum/species.dm index 9f4782b8fff0..852e005a5a5d 100644 --- a/mods/species/bayliens/adherent/datum/species.dm +++ b/mods/species/bayliens/adherent/datum/species.dm @@ -71,7 +71,7 @@ appearance_flags = HAS_EYE_COLOR flesh_color = "#90edeb" slowdown = -1 - hud_type = /datum/hud_data/adherent + species_hud_type = /datum/hud_data/adherent available_cultural_info = list( TAG_CULTURE = list( @@ -156,7 +156,6 @@ if(can_overcome_gravity(H)) return "\nThey are floating on a cloud of shimmering distortion." /datum/hud_data/adherent - has_internals = FALSE inventory_slots = list( /datum/inventory_slot/handcuffs, /datum/inventory_slot/ear/adherent, diff --git a/mods/species/serpentid/datum/species.dm b/mods/species/serpentid/datum/species.dm index 70e3c666e7db..49ace91eb69e 100644 --- a/mods/species/serpentid/datum/species.dm +++ b/mods/species/serpentid/datum/species.dm @@ -74,7 +74,7 @@ darksight_range = 8 slowdown = -0.5 rarity_value = 4 - hud_type = /datum/hud_data/serpentid + species_hud_type = /datum/hud_data/serpentid total_health = 200 brute_mod = 0.9 burn_mod = 1.35 diff --git a/mods/species/serpentid/mobs/bodyparts_serpentid.dm b/mods/species/serpentid/mobs/bodyparts_serpentid.dm index 75beb9f0b6fd..cc2630533e35 100644 --- a/mods/species/serpentid/mobs/bodyparts_serpentid.dm +++ b/mods/species/serpentid/mobs/bodyparts_serpentid.dm @@ -82,13 +82,13 @@ H.adjustOxyLoss(-(HUMAN_MAX_OXYLOSS * oxygenated)) if(breath_fail_ratio < 0.25 && oxygenated) - H.oxygen_alert = 0 + SET_HUD_ALERT(H, /decl/hud_element/condition/oxygen, 0) if(breath_fail_ratio >= 0.25 && (damage || world.time > last_successful_breath + 2 MINUTES)) H.adjustOxyLoss(HUMAN_MAX_OXYLOSS * breath_fail_ratio) if(oxygenated) - H.oxygen_alert = 1 + SET_HUD_ALERT(H, /decl/hud_element/condition/oxygen, 1) else - H.oxygen_alert = 2 + SET_HUD_ALERT(H, /decl/hud_element/condition/oxygen, 2) /obj/item/organ/internal/brain/insectoid/serpentid var/lowblood_tally = 0 diff --git a/nebula.dme b/nebula.dme index ec0d31e6d835..cf4a2e4e398f 100644 --- a/nebula.dme +++ b/nebula.dme @@ -46,6 +46,7 @@ #include "code\__defines\gamemode.dm" #include "code\__defines\guns.dm" #include "code\__defines\holomap.dm" +#include "code\__defines\hud.dm" #include "code\__defines\hydroponics.dm" #include "code\__defines\integrated_circuits.dm" #include "code\__defines\interactions.dm" @@ -160,25 +161,45 @@ #include "code\_onclick\other_mobs.dm" #include "code\_onclick\rig.dm" #include "code\_onclick\hud\_defines.dm" +#include "code\_onclick\hud\_hud.dm" #include "code\_onclick\hud\ability_screen_objects.dm" #include "code\_onclick\hud\action.dm" #include "code\_onclick\hud\ai.dm" #include "code\_onclick\hud\ai_hud.dm" #include "code\_onclick\hud\ai_screen_objects.dm" -#include "code\_onclick\hud\animal.dm" +#include "code\_onclick\hud\constructs.dm" #include "code\_onclick\hud\deity.dm" #include "code\_onclick\hud\fullscreen.dm" #include "code\_onclick\hud\global_hud.dm" -#include "code\_onclick\hud\gun_mode.dm" -#include "code\_onclick\hud\hud.dm" #include "code\_onclick\hud\human.dm" -#include "code\_onclick\hud\other_mobs.dm" #include "code\_onclick\hud\pai.dm" #include "code\_onclick\hud\radial.dm" #include "code\_onclick\hud\radial_persistent.dm" #include "code\_onclick\hud\robot.dm" #include "code\_onclick\hud\screen_objects.dm" #include "code\_onclick\hud\skybox.dm" +#include "code\_onclick\hud\hud_elements\_hud_element.dm" +#include "code\_onclick\hud\hud_elements\ability_master.dm" +#include "code\_onclick\hud\hud_elements\action_intent.dm" +#include "code\_onclick\hud\hud_elements\bodytemp.dm" +#include "code\_onclick\hud\hud_elements\cells.dm" +#include "code\_onclick\hud\hud_elements\drop.dm" +#include "code\_onclick\hud\hud_elements\fire.dm" +#include "code\_onclick\hud\hud_elements\gun_mode.dm" +#include "code\_onclick\hud\hud_elements\health.dm" +#include "code\_onclick\hud\hud_elements\hydration.dm" +#include "code\_onclick\hud\hud_elements\internals.dm" +#include "code\_onclick\hud\hud_elements\move_intent.dm" +#include "code\_onclick\hud\hud_elements\nutrition.dm" +#include "code\_onclick\hud\hud_elements\oxygen.dm" +#include "code\_onclick\hud\hud_elements\pain.dm" +#include "code\_onclick\hud\hud_elements\pressure.dm" +#include "code\_onclick\hud\hud_elements\resist.dm" +#include "code\_onclick\hud\hud_elements\stamina.dm" +#include "code\_onclick\hud\hud_elements\throwing.dm" +#include "code\_onclick\hud\hud_elements\toxins.dm" +#include "code\_onclick\hud\hud_elements\up_hint.dm" +#include "code\_onclick\hud\hud_elements\zone_selector.dm" #include "code\controllers\admin.dm" #include "code\controllers\autotransfer.dm" #include "code\controllers\communications.dm"