Merge pull request #14245 from silicons/sprint_staging
adds config entry for sprint removal that works prettier than just setting sprint speed to 0
@@ -118,27 +118,7 @@
|
||||
action_intent.hud = src
|
||||
static_inventory += action_intent
|
||||
|
||||
using = new /obj/screen/mov_intent
|
||||
using.icon = tg_ui_icon_to_cit_ui(ui_style) // CIT CHANGE - overrides mov intent icon
|
||||
using.icon_state = (mymob.m_intent == MOVE_INTENT_RUN ? "running" : "walking")
|
||||
using.screen_loc = ui_movi
|
||||
using.hud = src
|
||||
static_inventory += using
|
||||
|
||||
//CITADEL CHANGES - sprint button
|
||||
using = new /obj/screen/sprintbutton
|
||||
using.icon = tg_ui_icon_to_cit_ui(ui_style)
|
||||
using.icon_state = ((owner.combat_flags & COMBAT_FLAG_SPRINT_ACTIVE) ? "act_sprint_on" : "act_sprint")
|
||||
using.screen_loc = ui_movi
|
||||
using.hud = src
|
||||
static_inventory += using
|
||||
//END OF CITADEL CHANGES
|
||||
|
||||
//same as above but buffer.
|
||||
sprint_buffer = new /obj/screen/sprint_buffer
|
||||
sprint_buffer.screen_loc = ui_sprintbufferloc
|
||||
sprint_buffer.hud = src
|
||||
static_inventory += sprint_buffer
|
||||
assert_move_intent_ui(owner, TRUE)
|
||||
|
||||
// clickdelay
|
||||
clickdelay = new
|
||||
@@ -393,6 +373,51 @@
|
||||
|
||||
update_locked_slots()
|
||||
|
||||
/datum/hud/human/proc/assert_move_intent_ui(mob/living/carbon/human/owner = mymob, on_new = FALSE)
|
||||
var/obj/screen/using
|
||||
// delete old ones
|
||||
var/list/obj/screen/victims = list()
|
||||
victims += locate(/obj/screen/mov_intent) in static_inventory
|
||||
victims += locate(/obj/screen/sprintbutton) in static_inventory
|
||||
victims += locate(/obj/screen/sprint_buffer) in static_inventory
|
||||
if(victims)
|
||||
static_inventory -= victims
|
||||
if(mymob?.client)
|
||||
mymob.client.screen -= victims
|
||||
QDEL_LIST(victims)
|
||||
|
||||
// make new ones
|
||||
// walk/run
|
||||
using = new /obj/screen/mov_intent
|
||||
using.icon = tg_ui_icon_to_cit_ui(ui_style) // CIT CHANGE - overrides mov intent icon
|
||||
using.screen_loc = ui_movi
|
||||
using.hud = src
|
||||
using.update_icon()
|
||||
static_inventory += using
|
||||
if(!on_new)
|
||||
owner?.client?.screen += using
|
||||
|
||||
if(!CONFIG_GET(flag/sprint_enabled))
|
||||
return
|
||||
|
||||
// sprint button
|
||||
using = new /obj/screen/sprintbutton
|
||||
using.icon = tg_ui_icon_to_cit_ui(ui_style)
|
||||
using.icon_state = ((owner.combat_flags & COMBAT_FLAG_SPRINT_ACTIVE) ? "act_sprint_on" : "act_sprint")
|
||||
using.screen_loc = ui_movi
|
||||
using.hud = src
|
||||
static_inventory += using
|
||||
if(!on_new)
|
||||
owner?.client?.screen += using
|
||||
|
||||
// same as above but buffer.
|
||||
sprint_buffer = new /obj/screen/sprint_buffer
|
||||
sprint_buffer.screen_loc = ui_sprintbufferloc
|
||||
sprint_buffer.hud = src
|
||||
static_inventory += sprint_buffer
|
||||
if(!on_new)
|
||||
owner?.client?.screen += using
|
||||
|
||||
/datum/hud/human/update_locked_slots()
|
||||
if(!mymob)
|
||||
return
|
||||
|
||||
@@ -351,6 +351,10 @@
|
||||
icon = 'icons/mob/screen_midnight.dmi'
|
||||
icon_state = "running"
|
||||
|
||||
/obj/screen/mov_intent/Initialize(mapload)
|
||||
. = ..()
|
||||
update_icon()
|
||||
|
||||
/obj/screen/mov_intent/Click()
|
||||
toggle(usr)
|
||||
|
||||
@@ -359,7 +363,7 @@
|
||||
if(MOVE_INTENT_WALK)
|
||||
icon_state = "walking"
|
||||
if(MOVE_INTENT_RUN)
|
||||
icon_state = "running"
|
||||
icon_state = CONFIG_GET(flag/sprint_enabled)? "running" : "running_nosprint"
|
||||
|
||||
/obj/screen/mov_intent/proc/toggle(mob/user)
|
||||
if(isobserver(user))
|
||||
|
||||
@@ -290,6 +290,17 @@
|
||||
var/datum/movespeed_modifier/config_walk_run/M = get_cached_movespeed_modifier(/datum/movespeed_modifier/config_walk_run/walk)
|
||||
M.sync()
|
||||
|
||||
/datum/config_entry/flag/sprint_enabled
|
||||
config_entry_value = TRUE
|
||||
|
||||
/datum/config_entry/flag/sprint_enabled/ValidateAndSet(str_val)
|
||||
. = ..()
|
||||
for(var/datum/hud/human/H)
|
||||
H.assert_move_intent_ui()
|
||||
if(!config_entry_value) // disabled
|
||||
for(var/mob/living/L in world)
|
||||
L.disable_intentional_sprint_mode()
|
||||
|
||||
/datum/config_entry/number/movedelay/sprint_speed_increase
|
||||
config_entry_value = 1
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
update_sprint_icon()
|
||||
|
||||
/mob/living/proc/enable_sprint_mode(update_icon = TRUE)
|
||||
if(!CONFIG_GET(flag/sprint_enabled))
|
||||
return
|
||||
if(combat_flags & COMBAT_FLAG_SPRINT_ACTIVE)
|
||||
return
|
||||
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_SPRINT_ACTIVE)
|
||||
@@ -61,6 +63,8 @@
|
||||
update_sprint_icon()
|
||||
|
||||
/mob/living/proc/user_toggle_intentional_sprint_mode()
|
||||
if(!CONFIG_GET(flag/sprint_enabled))
|
||||
return
|
||||
var/old = (combat_flags & COMBAT_FLAG_SPRINT_TOGGLED)
|
||||
if(old)
|
||||
if(combat_flags & COMBAT_FLAG_SPRINT_FORCED)
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/mob/living/silicon/robot/default_toggle_sprint(shutdown = FALSE)
|
||||
if(!CONFIG_GET(flag/sprint_enabled))
|
||||
disable_intentional_sprint_mode()
|
||||
return
|
||||
var/current = (combat_flags & COMBAT_FLAG_SPRINT_ACTIVE)
|
||||
if(current || shutdown || !cell || (cell.charge < 25) || !cansprint)
|
||||
disable_intentional_sprint_mode()
|
||||
|
||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 6.0 KiB |