mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
[MIRROR] Martial arts combo meter (#3022)
* Martial arts combo meter (#56520) * Martial arts combo meter Co-authored-by: Jack LeCroy <3073035+jacklecroy@users.noreply.github.com>
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#define ui_back "CENTER-2:14,SOUTH:5"
|
||||
#define ui_storage1 "CENTER+1:18,SOUTH:5"
|
||||
#define ui_storage2 "CENTER+2:20,SOUTH:5"
|
||||
#define ui_combo "CENTER+4:24,SOUTH+1:7" //combo meter for martial arts
|
||||
|
||||
//Lower right, persistent menu
|
||||
#define ui_drop_throw "EAST-1:28,SOUTH+1:7"
|
||||
|
||||
@@ -34,6 +34,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
|
||||
var/atom/movable/screen/alien_plasma_display
|
||||
var/atom/movable/screen/alien_queen_finder
|
||||
|
||||
var/atom/movable/screen/combo/combo_display
|
||||
|
||||
var/atom/movable/screen/action_intent
|
||||
var/atom/movable/screen/zone_select
|
||||
@@ -111,6 +112,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
|
||||
blobpwrdisplay = null
|
||||
alien_plasma_display = null
|
||||
alien_queen_finder = null
|
||||
combo_display = null
|
||||
|
||||
QDEL_LIST_ASSOC_VAL(plane_masters)
|
||||
QDEL_LIST(screenoverlays)
|
||||
|
||||
@@ -310,6 +310,9 @@
|
||||
zone_select.update_icon()
|
||||
static_inventory += zone_select
|
||||
|
||||
combo_display = new /atom/movable/screen/combo()
|
||||
infodisplay += combo_display
|
||||
|
||||
for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
|
||||
if(inv.slot_id)
|
||||
inv.hud = src
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
pull_icon.hud = src
|
||||
static_inventory += pull_icon
|
||||
|
||||
combo_display = new /atom/movable/screen/combo()
|
||||
infodisplay += combo_display
|
||||
|
||||
//mob health doll! assumes whatever sprite the mob is
|
||||
healthdoll = new /atom/movable/screen/healthdoll/living()
|
||||
healthdoll.hud = src
|
||||
|
||||
@@ -730,3 +730,28 @@
|
||||
/atom/movable/screen/component_button/Click(params)
|
||||
if(parent)
|
||||
parent.component_click(src, params)
|
||||
|
||||
/atom/movable/screen/combo
|
||||
icon_state = ""
|
||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
screen_loc = ui_combo
|
||||
layer = ABOVE_HUD_LAYER
|
||||
var/timerid
|
||||
|
||||
/atom/movable/screen/combo/proc/clear_streak()
|
||||
cut_overlays()
|
||||
icon_state = ""
|
||||
|
||||
/atom/movable/screen/combo/update_icon_state(streak = "")
|
||||
clear_streak()
|
||||
if (timerid)
|
||||
deltimer(timerid)
|
||||
if (!streak)
|
||||
return
|
||||
timerid = addtimer(CALLBACK(src, .proc/clear_streak), 20, TIMER_UNIQUE | TIMER_STOPPABLE)
|
||||
icon_state = "combo"
|
||||
for (var/i = 1; i <= length(streak); ++i)
|
||||
var/intent_text = copytext(streak, i, i + 1)
|
||||
var/image/intent_icon = image(icon,src,"combo_[intent_text]")
|
||||
intent_icon.pixel_x = 16 * (i - 1) - 8 * length(streak)
|
||||
add_overlay(intent_icon)
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
var/help_verb
|
||||
var/allow_temp_override = TRUE //if this martial art can be overridden by temporary martial arts
|
||||
var/smashes_tables = FALSE //If the martial art smashes tables when performing table slams and head smashes
|
||||
var/datum/weakref/holder //owner of the martial art
|
||||
var/display_combos = FALSE //shows combo meter if true
|
||||
|
||||
/datum/martial_art/proc/help_act(mob/living/A, mob/living/D)
|
||||
return FALSE
|
||||
@@ -31,48 +33,55 @@
|
||||
streak = streak+element
|
||||
if(length(streak) > max_streak_length)
|
||||
streak = copytext(streak, 1 + length(streak[1]))
|
||||
if (display_combos)
|
||||
var/mob/living/holder_living = holder.resolve()
|
||||
holder_living?.hud_used?.combo_display.update_icon_state(streak)
|
||||
|
||||
/datum/martial_art/proc/reset_streak(mob/living/new_target)
|
||||
current_target = new_target
|
||||
streak = ""
|
||||
var/mob/living/holder_living = holder.resolve()
|
||||
holder_living?.hud_used?.combo_display.update_icon_state(streak)
|
||||
|
||||
/datum/martial_art/proc/teach(mob/living/owner, make_temporary=FALSE)
|
||||
if(!istype(owner) || !owner.mind)
|
||||
/datum/martial_art/proc/teach(mob/living/holder_living, make_temporary=FALSE)
|
||||
if(!istype(holder_living) || !holder_living.mind)
|
||||
return FALSE
|
||||
if(owner.mind.martial_art)
|
||||
if(holder_living.mind.martial_art)
|
||||
if(make_temporary)
|
||||
if(!owner.mind.martial_art.allow_temp_override)
|
||||
if(!holder_living.mind.martial_art.allow_temp_override)
|
||||
return FALSE
|
||||
store(owner.mind.martial_art, owner)
|
||||
store(holder_living.mind.martial_art, holder_living)
|
||||
else
|
||||
owner.mind.martial_art.on_remove(owner)
|
||||
holder_living.mind.martial_art.on_remove(holder_living)
|
||||
else if(make_temporary)
|
||||
base = owner.mind.default_martial_art
|
||||
base = holder_living.mind.default_martial_art
|
||||
if(help_verb)
|
||||
add_verb(owner, help_verb)
|
||||
owner.mind.martial_art = src
|
||||
add_verb(holder_living, help_verb)
|
||||
holder_living.mind.martial_art = src
|
||||
holder = WEAKREF(holder_living)
|
||||
return TRUE
|
||||
|
||||
/datum/martial_art/proc/store(datum/martial_art/old, mob/living/owner)
|
||||
old.on_remove(owner)
|
||||
/datum/martial_art/proc/store(datum/martial_art/old, mob/living/holder_living)
|
||||
old.on_remove(holder_living)
|
||||
if (old.base) //Checks if old is temporary, if so it will not be stored.
|
||||
base = old.base
|
||||
else //Otherwise, old is stored.
|
||||
base = old
|
||||
|
||||
/datum/martial_art/proc/remove(mob/living/owner)
|
||||
if(!istype(owner) || !owner.mind || owner.mind.martial_art != src)
|
||||
/datum/martial_art/proc/remove(mob/living/holder_living)
|
||||
if(!istype(holder_living) || !holder_living.mind || holder_living.mind.martial_art != src)
|
||||
return
|
||||
on_remove(owner)
|
||||
on_remove(holder_living)
|
||||
if(base)
|
||||
base.teach(owner)
|
||||
base.teach(holder_living)
|
||||
else
|
||||
var/datum/martial_art/default = owner.mind.default_martial_art
|
||||
default.teach(owner)
|
||||
var/datum/martial_art/default = holder_living.mind.default_martial_art
|
||||
default.teach(holder_living)
|
||||
holder = null
|
||||
|
||||
/datum/martial_art/proc/on_remove(mob/living/owner)
|
||||
/datum/martial_art/proc/on_remove(mob/living/holder_living)
|
||||
if(help_verb)
|
||||
remove_verb(owner, help_verb)
|
||||
remove_verb(holder_living, help_verb)
|
||||
return
|
||||
|
||||
///Gets called when a projectile hits the owner. Returning anything other than BULLET_ACT_HIT will stop the projectile from hitting the mob.
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
smashes_tables = TRUE
|
||||
var/old_grab_state = null
|
||||
var/restraining = FALSE
|
||||
display_combos = TRUE
|
||||
|
||||
/datum/martial_art/cqc/reset_streak(mob/living/new_target)
|
||||
. = ..()
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
var/plasma_power = 1 //starts at a 1, 2, 4 explosion.
|
||||
var/plasma_increment = 1 //how much explosion power gets added per kill (1 = 1, 2, 4. 2 = 2, 4, 8 and so on)
|
||||
var/plasma_cap = 12 //max size explosion level
|
||||
display_combos = TRUE
|
||||
|
||||
/datum/martial_art/plasma_fist/proc/check_streak(mob/living/A, mob/living/D)
|
||||
if(findtext(streak,TORNADO_COMBO))
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
id = MARTIALART_SLEEPINGCARP
|
||||
allow_temp_override = FALSE
|
||||
help_verb = /mob/living/proc/sleeping_carp_help
|
||||
display_combos = TRUE
|
||||
|
||||
/datum/martial_art/the_sleeping_carp/proc/check_streak(mob/living/A, mob/living/D)
|
||||
if(findtext(streak,STRONG_PUNCH_COMBO))
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 107 KiB |
Reference in New Issue
Block a user