mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 18:02:57 +00:00
Combat mode component. (#12338)
* Combat mode component. * Whoops. * test. * Oh * refs begone, and documentation.
This commit is contained in:
@@ -101,8 +101,5 @@
|
||||
|
||||
#define TOGGLES_CITADEL 0
|
||||
|
||||
//component stuff
|
||||
#define COMSIG_VORE_TOGGLED "voremode_toggled" // totally not copypasta
|
||||
|
||||
//belly sound pref things
|
||||
#define NORMIE_HEARCHECK 4
|
||||
|
||||
@@ -29,38 +29,27 @@
|
||||
#define EFFECT_DROWSY "drowsy"
|
||||
#define EFFECT_JITTER "jitter"
|
||||
|
||||
// /mob/living/combat_flags
|
||||
#define CAN_TOGGLE_COMBAT_MODE(mob) FORCE_BOOLEAN((mob.stat == CONSCIOUS) && !(mob.combat_flags & COMBAT_FLAG_HARD_STAMCRIT))
|
||||
|
||||
/// Default combat flags for those affected by ((stamina combat))
|
||||
/// Default combat flags for those affected by sprinting (combat mode has been made into its own component)
|
||||
#define COMBAT_FLAGS_DEFAULT NONE
|
||||
/// Default combat flags for everyone else (so literally everyone but humans)
|
||||
#define COMBAT_FLAGS_STAMSYSTEM_EXEMPT (COMBAT_FLAG_SPRINT_ACTIVE | COMBAT_FLAG_COMBAT_ACTIVE | COMBAT_FLAG_SPRINT_TOGGLED | COMBAT_FLAG_COMBAT_TOGGLED | COMBAT_FLAG_SPRINT_FORCED | COMBAT_FLAG_COMBAT_FORCED)
|
||||
/// Default combat flags for those only affected by sprint (so just silicons)
|
||||
#define COMBAT_FLAGS_STAMEXEMPT_YESSPRINT (COMBAT_FLAG_COMBAT_ACTIVE | COMBAT_FLAG_COMBAT_TOGGLED | COMBAT_FLAG_COMBAT_FORCED)
|
||||
/// Default combat flags for everyone else (so literally everyone but humans).
|
||||
#define COMBAT_FLAGS_SPRINT_EXEMPT (COMBAT_FLAG_SPRINT_ACTIVE | COMBAT_FLAG_SPRINT_TOGGLED | COMBAT_FLAG_SPRINT_FORCED)
|
||||
|
||||
/// The user wants combat mode on
|
||||
#define COMBAT_FLAG_COMBAT_TOGGLED (1<<0)
|
||||
/// The user wants sprint mode on
|
||||
#define COMBAT_FLAG_SPRINT_TOGGLED (1<<1)
|
||||
/// Combat mode is currently active
|
||||
#define COMBAT_FLAG_COMBAT_ACTIVE (1<<2)
|
||||
#define COMBAT_FLAG_SPRINT_TOGGLED (1<<0)
|
||||
/// Sprint is currently active
|
||||
#define COMBAT_FLAG_SPRINT_ACTIVE (1<<3)
|
||||
#define COMBAT_FLAG_SPRINT_ACTIVE (1<<1)
|
||||
/// Currently attempting to crawl under someone
|
||||
#define COMBAT_FLAG_ATTEMPTING_CRAWL (1<<4)
|
||||
#define COMBAT_FLAG_ATTEMPTING_CRAWL (1<<2)
|
||||
/// Currently stamcritted
|
||||
#define COMBAT_FLAG_HARD_STAMCRIT (1<<5)
|
||||
#define COMBAT_FLAG_HARD_STAMCRIT (1<<3)
|
||||
/// Currently attempting to resist up from the ground
|
||||
#define COMBAT_FLAG_RESISTING_REST (1<<6)
|
||||
#define COMBAT_FLAG_RESISTING_REST (1<<4)
|
||||
/// Intentionally resting
|
||||
#define COMBAT_FLAG_INTENTIONALLY_RESTING (1<<7)
|
||||
#define COMBAT_FLAG_INTENTIONALLY_RESTING (1<<5)
|
||||
/// Currently stamcritted but not as violently
|
||||
#define COMBAT_FLAG_SOFT_STAMCRIT (1<<8)
|
||||
/// Force combat mode on at all times, overrides everything including combat disable traits.
|
||||
#define COMBAT_FLAG_COMBAT_FORCED (1<<9)
|
||||
#define COMBAT_FLAG_SOFT_STAMCRIT (1<<6)
|
||||
/// Force sprint mode on at all times, overrides everything including sprint disable traits.
|
||||
#define COMBAT_FLAG_SPRINT_FORCED (1<<10)
|
||||
#define COMBAT_FLAG_SPRINT_FORCED (1<<7)
|
||||
|
||||
// Helpers for getting someone's stamcrit state. Cast to living.
|
||||
#define NOT_STAMCRIT 0
|
||||
|
||||
@@ -75,3 +75,11 @@
|
||||
#define ID_COMPONENT_KNOWLEDGE_NONE 0
|
||||
/// Has full knowledge
|
||||
#define ID_COMPONENT_KNOWLEDGE_FULL 1
|
||||
|
||||
// Combat mode flags.
|
||||
/// The user wants combat mode on
|
||||
#define COMBAT_MODE_TOGGLED (1<<0)
|
||||
/// combat mode is active.
|
||||
#define COMBAT_MODE_ACTIVE (1<<1)
|
||||
/// combat mode is not active
|
||||
#define COMBAT_MODE_INACTIVE (1<<2)
|
||||
@@ -192,7 +192,12 @@
|
||||
|
||||
#define COMSIG_MOB_SPELL_CAN_CAST "mob_spell_can_cast" //from base of /obj/effect/proc_holder/spell/can_cast(): (spell)
|
||||
|
||||
#define COMSIG_ROBOT_UPDATE_ICONS "robot_update_icons" //from base of robot/update_icons(): ()
|
||||
// /client signals
|
||||
#define COMSIG_MOB_CLIENT_LOGIN "mob_client_login" //sent when a mob/login() finishes: (client)
|
||||
#define COMSIG_MOB_CLIENT_LOGOUT "mob_client_logout" //sent when a mob/logout() starts: (client)
|
||||
#define COMSIG_MOB_CLIENT_MOVE "mob_client_move" //sent when client/Move() finishes with no early returns: (client, direction, n, oldloc)
|
||||
#define COMSIG_MOB_CLIENT_CHANGE_VIEW "mob_client_change_view" //from base of /client/change_view(): (client, old_view, view)
|
||||
#define COMSIG_MOB_CLIENT_MOUSEMOVE "mob_client_mousemove" //from base of /client/MouseMove(): (object, location, control, params)
|
||||
|
||||
// /mob/living signals
|
||||
#define COMSIG_LIVING_REGENERATE_LIMBS "living_regenerate_limbs" //from base of /mob/living/regenerate_limbs(): (noheal, excluded_limbs)
|
||||
@@ -204,17 +209,10 @@
|
||||
#define COMSIG_LIVING_MINOR_SHOCK "living_minor_shock" //sent by stuff like stunbatons and tasers: ()
|
||||
#define COMSIG_LIVING_REVIVE "living_revive" //from base of mob/living/revive() (full_heal, admin_revive)
|
||||
|
||||
#define COMSIG_MOB_CLIENT_LOGIN "mob_client_login" //sent when a mob/login() finishes: (client)
|
||||
#define COMSIG_MOB_CLIENT_LOGOUT "mob_client_logout" //sent when a mob/logout() starts: (client)
|
||||
#define COMSIG_MOB_CLIENT_MOVE "mob_client_move" //sent when client/Move() finishes with no early returns: (client, direction, n, oldloc)
|
||||
#define COMSIG_MOB_CLIENT_CHANGE_VIEW "mob_client_change_view" //from base of /client/change_view(): (client, old_view, view)
|
||||
|
||||
#define COMSIG_MOB_RESET_PERSPECTIVE "mob_reset_perspective" //from base of /mob/reset_perspective(): (atom/target)
|
||||
#define COMSIG_LIVING_GUN_PROCESS_FIRE "living_gun_process_fire" //from base of /obj/item/gun/proc/process_fire(): (atom/target, params, zone_override)
|
||||
// This returns flags as defined for block in __DEFINES/combat.dm!
|
||||
#define COMSIG_LIVING_RUN_BLOCK "living_do_run_block" //from base of mob/living/do_run_block(): (real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone)
|
||||
#define COMSIG_LIVING_COMBAT_ENABLED "combatmode_enabled" //from base of mob/living/enable_combat_mode() (was_forced)
|
||||
#define COMSIG_LIVING_COMBAT_DISABLED "combatmode_disabled" //from base of mob/living/disable_combat_mode() (was_forced)
|
||||
#define COMSIG_LIVING_GET_BLOCKING_ITEMS "get_blocking_items" //from base of mob/living/get_blocking_items(): (list/items)
|
||||
|
||||
//ALL OF THESE DO NOT TAKE INTO ACCOUNT WHETHER AMOUNT IS 0 OR LOWER AND ARE SENT REGARDLESS!
|
||||
@@ -232,6 +230,10 @@
|
||||
#define COMSIG_CARBON_SOUNDBANG "carbon_soundbang" //from base of mob/living/carbon/soundbang_act(): (list(intensity))
|
||||
#define COMSIG_CARBON_IDENTITY_TRANSFERRED_TO "carbon_id_transferred_to" //from datum/dna/transfer_identity(): (datum/dna, transfer_SE)
|
||||
#define COMSIG_CARBON_TACKLED "carbon_tackled" //sends from tackle.dm on tackle completion
|
||||
|
||||
// /mob/living/silicon signals
|
||||
#define COMSIG_ROBOT_UPDATE_ICONS "robot_update_icons" //from base of robot/update_icons(): ()
|
||||
|
||||
// /mob/living/simple_animal/hostile signals
|
||||
#define COMSIG_HOSTILE_ATTACKINGTARGET "hostile_attackingtarget"
|
||||
#define COMPONENT_HOSTILE_NO_ATTACK 1
|
||||
@@ -342,6 +344,14 @@
|
||||
//NTnet
|
||||
#define COMSIG_COMPONENT_NTNET_RECEIVE "ntnet_receive" //called on an object by its NTNET connection component on receive. (sending_id(number), sending_netname(text), data(datum/netdata))
|
||||
|
||||
//Combat mode
|
||||
#define COMSIG_TOGGLE_COMBAT_MODE "toggle_combat_mode" //safely toggles combat mode.
|
||||
#define COMSIG_DISABLE_COMBAT_MODE "disable_combat_mode" //safely disables combat mode.
|
||||
#define COMSIG_ENABLE_COMBAT_MODE "enable_combat_mode" //safely enables combat mode.
|
||||
#define COMSIG_LIVING_COMBAT_ENABLED "combatmode_enabled" //from base of datum/component/combat_mode/enable_combat_mode() (was_forced)
|
||||
#define COMSIG_LIVING_COMBAT_DISABLED "combatmode_disabled" //from base of datum/component/combat_mode/disable_combat_mode() (was_forced)
|
||||
#define COMSIG_COMBAT_MODE_CHECK "combatmode_check" //called when checking the combat mode flags (enabled/disabled/forced)
|
||||
|
||||
//Nanites
|
||||
#define COMSIG_HAS_NANITES "has_nanites" //() returns TRUE if nanites are found
|
||||
#define COMSIG_NANITE_IS_STEALTHY "nanite_is_stealthy" //() returns TRUE if nanites have stealth
|
||||
|
||||
@@ -74,8 +74,10 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
|
||||
#define FLYING (1<<1)
|
||||
#define VENTCRAWLING (1<<2)
|
||||
#define FLOATING (1<<3)
|
||||
#define UNSTOPPABLE (1<<4) //When moving, will Bump()/Cross()/Uncross() everything, but won't be stopped.
|
||||
#define CRAWLING (1<<5) //Applied if you're crawling around on the ground/resting.
|
||||
///When moving, will Bump()/Cross()/Uncross() everything, but won't be stopped.
|
||||
#define UNSTOPPABLE (1<<4)
|
||||
///Applied if you're crawling around on the ground/resting.
|
||||
#define CRAWLING (1<<5)
|
||||
|
||||
//Fire and Acid stuff, for resistance_flags
|
||||
#define LAVA_PROOF (1<<0)
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
var/textb = copytext(HTMLstring, 6, 8)
|
||||
return rgb(255 - hex2num(textr), 255 - hex2num(textg), 255 - hex2num(textb))
|
||||
|
||||
//Better performant than an artisanal proc and more reliable than Turn(). From TGMC.
|
||||
#define REVERSE_DIR(dir) ( ((dir & 85) << 1) | ((dir & 170) >> 1) )
|
||||
//Returns location. Returns null if no location was found.
|
||||
/proc/get_teleport_loc(turf/location,mob/target,distance = 1, density = FALSE, errorx = 0, errory = 0, eoffsetx = 0, eoffsety = 0)
|
||||
/*
|
||||
|
||||
@@ -242,15 +242,14 @@ GLOBAL_LIST_INIT(bitfields, list(
|
||||
"MOBILITY_RESIST" = MOBILITY_RESIST
|
||||
),
|
||||
"combat_flags" = list(
|
||||
"COMBAT_FLAG_COMBAT_TOGGLED" = COMBAT_FLAG_COMBAT_TOGGLED,
|
||||
"COMBAT_FLAG_SPRINT_TOGGLED" = COMBAT_FLAG_SPRINT_TOGGLED,
|
||||
"COMBAT_FLAG_COMBAT_ACTIVE" = COMBAT_FLAG_COMBAT_ACTIVE,
|
||||
"COMBAT_FLAG_SPRINT_ACTIVE" = COMBAT_FLAG_SPRINT_ACTIVE,
|
||||
"COMBAT_FLAG_ATTEMPTING_CRAWL" = COMBAT_FLAG_ATTEMPTING_CRAWL,
|
||||
"COMBAT_FLAG_HARD_STAMCRIT" = COMBAT_FLAG_HARD_STAMCRIT,
|
||||
"COMBAT_FLAG_SOFT_STAMCRIT" = COMBAT_FLAG_SOFT_STAMCRIT,
|
||||
"COMBAT_FLAG_INTENTIONALLY_RESTING" = COMBAT_FLAG_INTENTIONALLY_RESTING,
|
||||
"COMBAT_FLAG_RESISTING_REST" = COMBAT_FLAG_RESISTING_REST
|
||||
"COMBAT_FLAG_RESISTING_REST" = COMBAT_FLAG_RESISTING_REST,
|
||||
"COMBAT_FLAG_SPRINT_FORCED" = COMBAT_FLAG_SPRINT_FORCED
|
||||
),
|
||||
"shield_flags" = list(
|
||||
"SHIELD_TRANSPARENT" = SHIELD_TRANSPARENT,
|
||||
|
||||
@@ -92,16 +92,10 @@
|
||||
mouseLocation = location
|
||||
mouseObject = object
|
||||
mouseControlObject = control
|
||||
if(mob && LAZYLEN(mob.mousemove_intercept_objects))
|
||||
for(var/datum/D in mob.mousemove_intercept_objects)
|
||||
D.onMouseMove(object, location, control, params)
|
||||
if(!show_popup_menus && mob) //CIT CHANGE - passes onmousemove() to mobs
|
||||
mob.onMouseMove(object, location, control, params) //CIT CHANGE - ditto
|
||||
if(mob)
|
||||
SEND_SIGNAL(mob, COMSIG_MOB_CLIENT_MOUSEMOVE, object, location, control, params)
|
||||
..()
|
||||
|
||||
/datum/proc/onMouseMove(object, location, control, params)
|
||||
return
|
||||
|
||||
/client/MouseDrag(src_object,atom/over_object,src_location,over_location,src_control,over_control,params)
|
||||
var/list/L = params2list(params)
|
||||
if (L["middle"])
|
||||
|
||||
@@ -246,13 +246,6 @@
|
||||
using.screen_loc = ui_pull_resist
|
||||
using.hud = src
|
||||
static_inventory += using
|
||||
|
||||
//CIT CHANGES - combat mode buttons
|
||||
using = new /obj/screen/combattoggle()
|
||||
using.icon = tg_ui_icon_to_cit_ui(ui_style)
|
||||
using.screen_loc = ui_combat_toggle
|
||||
using.hud = src
|
||||
static_inventory += using
|
||||
//END OF CIT CHANGES
|
||||
|
||||
using = new /obj/screen/human/toggle()
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
/obj/attacked_by(obj/item/I, mob/living/user)
|
||||
var/totitemdamage = I.force
|
||||
var/bad_trait
|
||||
if(!(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) && iscarbon(user))
|
||||
if(!SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
totitemdamage *= 0.5
|
||||
bad_trait = SKILL_COMBAT_MODE //blacklist combat skills.
|
||||
if(I.used_skills && user.mind)
|
||||
@@ -155,9 +155,11 @@
|
||||
/mob/living/proc/pre_attacked_by(obj/item/I, mob/living/user)
|
||||
. = I.force
|
||||
var/bad_trait
|
||||
if(!(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) && iscarbon(user))
|
||||
if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
. *= 0.5
|
||||
bad_trait = SKILL_COMBAT_MODE //blacklist combat skills.
|
||||
if(SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
. *= 1.5
|
||||
if(!CHECK_MOBILITY(user, MOBILITY_STAND))
|
||||
. *= 0.5
|
||||
if(!user.mind || !I.used_skills)
|
||||
@@ -169,10 +171,6 @@
|
||||
continue
|
||||
user.mind.auto_gain_experience(skill, I.skill_gain)
|
||||
|
||||
/mob/living/carbon/pre_attacked_by(obj/item/I, mob/living/user)
|
||||
. = ..()
|
||||
if(!(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
. *= 1.5
|
||||
|
||||
// Proximity_flag is 1 if this afterattack was called on something adjacent, in your square, or on your person.
|
||||
// Click parameters is the params string from byond Click() code, see that documentation.
|
||||
@@ -212,7 +210,7 @@
|
||||
if(!user)
|
||||
return
|
||||
var/bad_trait
|
||||
if(iscarbon(user) && !(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
. *= STAM_COST_NO_COMBAT_MULT
|
||||
bad_trait = SKILL_COMBAT_MODE
|
||||
if(used_skills && user.mind)
|
||||
|
||||
217
code/datums/components/combat_mode.dm
Normal file
217
code/datums/components/combat_mode.dm
Normal file
@@ -0,0 +1,217 @@
|
||||
/**
|
||||
* Combat mode component. It makes the user face whichever atom the mouse pointer is hovering,
|
||||
* amongst other things designed outside of this file, namely PvP and PvE stuff, hence the name.
|
||||
* Can be toggled on and off by clicking the screen hud object or by pressing the assigned hotkey (default 'C')
|
||||
*/
|
||||
/datum/component/combat_mode
|
||||
var/mode_flags = COMBAT_MODE_INACTIVE
|
||||
var/combatmessagecooldown
|
||||
var/lastmousedir
|
||||
var/obj/screen/combattoggle/hud_icon
|
||||
var/hud_loc
|
||||
|
||||
/datum/component/combat_mode/Initialize(hud_loc = ui_combat_toggle)
|
||||
if(!isliving(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
var/mob/living/L = parent
|
||||
|
||||
src.hud_loc = hud_loc
|
||||
|
||||
RegisterSignal(L, SIGNAL_TRAIT(TRAIT_COMBAT_MODE_LOCKED), .proc/update_combat_lock)
|
||||
RegisterSignal(L, COMSIG_TOGGLE_COMBAT_MODE, .proc/user_toggle_intentional_combat_mode)
|
||||
RegisterSignal(L, COMSIG_DISABLE_COMBAT_MODE, .proc/safe_disable_combat_mode)
|
||||
RegisterSignal(L, COMSIG_ENABLE_COMBAT_MODE, .proc/safe_enable_combat_mode)
|
||||
RegisterSignal(L, COMSIG_MOB_DEATH, .proc/on_death)
|
||||
RegisterSignal(L, COMSIG_MOB_CLIENT_LOGOUT, .proc/on_logout)
|
||||
RegisterSignal(L, COMSIG_MOB_HUD_CREATED, .proc/on_mob_hud_created)
|
||||
RegisterSignal(L, COMSIG_COMBAT_MODE_CHECK, .proc/check_flags)
|
||||
|
||||
update_combat_lock()
|
||||
|
||||
if(L.client)
|
||||
on_mob_hud_created(L)
|
||||
|
||||
/datum/component/combat_mode/Destroy()
|
||||
if(parent)
|
||||
safe_disable_combat_mode(parent)
|
||||
if(hud_icon)
|
||||
QDEL_NULL(hud_icon)
|
||||
return ..()
|
||||
|
||||
/// Creates the hud screen object.
|
||||
/datum/component/combat_mode/proc/on_mob_hud_created(mob/source)
|
||||
hud_icon = new
|
||||
hud_icon.hud = source.hud_used
|
||||
hud_icon.icon = tg_ui_icon_to_cit_ui(source.hud_used.ui_style)
|
||||
hud_icon.screen_loc = hud_loc
|
||||
source.hud_used.static_inventory += hud_icon
|
||||
hud_icon.update_icon()
|
||||
|
||||
/// Combat mode can be locked out, forcibly disabled by a status trait.
|
||||
/datum/component/combat_mode/proc/update_combat_lock()
|
||||
var/locked = HAS_TRAIT(parent, TRAIT_COMBAT_MODE_LOCKED)
|
||||
var/desired = (mode_flags & COMBAT_MODE_TOGGLED)
|
||||
var/actual = (mode_flags & COMBAT_MODE_ACTIVE)
|
||||
if(actual)
|
||||
if(locked)
|
||||
disable_combat_mode(parent, FALSE, TRUE)
|
||||
else if(!desired)
|
||||
disable_combat_mode(parent, TRUE, TRUE)
|
||||
else
|
||||
if(desired && !locked)
|
||||
enable_combat_mode(parent, FALSE, TRUE)
|
||||
|
||||
/// Enables combat mode. Please use 'safe_enable_combat_mode' instead, if you wish to also enable the toggle flag.
|
||||
/datum/component/combat_mode/proc/enable_combat_mode(mob/living/source, silent = TRUE, forced = TRUE, visible = FALSE, locked = FALSE, playsound = FALSE)
|
||||
if(locked)
|
||||
if(hud_icon)
|
||||
hud_icon.combat_on = TRUE
|
||||
hud_icon.update_icon()
|
||||
return
|
||||
if(mode_flags & COMBAT_MODE_ACTIVE)
|
||||
return
|
||||
mode_flags |= COMBAT_MODE_ACTIVE
|
||||
mode_flags &= ~COMBAT_MODE_INACTIVE
|
||||
SEND_SIGNAL(source, COMSIG_LIVING_COMBAT_ENABLED, forced)
|
||||
if(!silent)
|
||||
var/self_message = forced? "<span class='warning'>Your muscles reflexively tighten!</span>" : "<span class='warning'>You drop into a combative stance!</span>"
|
||||
if(visible && (forced || world.time >= combatmessagecooldown))
|
||||
combatmessagecooldown = world.time + 10 SECONDS
|
||||
if(!forced)
|
||||
if(source.a_intent != INTENT_HELP)
|
||||
source.visible_message("<span class='warning'>[source] [source.resting ? "tenses up" : "drops into a combative stance"].</span>", self_message)
|
||||
else
|
||||
source.visible_message("<span class='notice'>[source] [pick("looks","seems","goes")] [pick("alert","attentive","vigilant")].</span>")
|
||||
else
|
||||
source.visible_message("<span class='warning'>[source] drops into a combative stance!</span>", self_message)
|
||||
else
|
||||
to_chat(source, self_message)
|
||||
if(playsound)
|
||||
source.playsound_local(source, 'sound/misc/ui_toggle.ogg', 50, FALSE, pressure_affected = FALSE) //Sound from interbay!
|
||||
RegisterSignal(source, COMSIG_MOB_CLIENT_MOUSEMOVE, .proc/onMouseMove)
|
||||
RegisterSignal(source, COMSIG_MOVABLE_MOVED, .proc/on_move)
|
||||
RegisterSignal(source, COMSIG_MOB_CLIENT_MOVE, .proc/on_client_move)
|
||||
if(hud_icon)
|
||||
hud_icon.combat_on = TRUE
|
||||
hud_icon.update_icon()
|
||||
|
||||
/// Disables combat mode. Please use 'safe_disable_combat_mode' instead, if you wish to also disable the toggle flag.
|
||||
/datum/component/combat_mode/proc/disable_combat_mode(mob/living/source, silent = TRUE, forced = TRUE, visible = FALSE, locked = FALSE, playsound = FALSE)
|
||||
if(locked)
|
||||
if(hud_icon)
|
||||
hud_icon.combat_on = FALSE
|
||||
hud_icon.update_icon()
|
||||
return
|
||||
if(!(mode_flags & COMBAT_MODE_ACTIVE))
|
||||
return
|
||||
mode_flags &= ~COMBAT_MODE_ACTIVE
|
||||
mode_flags |= COMBAT_MODE_INACTIVE
|
||||
SEND_SIGNAL(source, COMSIG_LIVING_COMBAT_DISABLED, forced)
|
||||
if(!silent)
|
||||
var/self_message = forced? "<span class='warning'>Your muscles are forcibly relaxed!</span>" : "<span class='warning'>You relax your stance.</span>"
|
||||
if(visible)
|
||||
source.visible_message("<span class='warning'>[source] relaxes [source.p_their()] stance.</span>", self_message)
|
||||
else
|
||||
to_chat(source, self_message)
|
||||
if(playsound)
|
||||
source.playsound_local(source, 'sound/misc/ui_toggleoff.ogg', 50, FALSE, pressure_affected = FALSE) //Slightly modified version of the toggleon sound!
|
||||
UnregisterSignal(source, list(COMSIG_MOB_CLIENT_MOUSEMOVE, COMSIG_MOVABLE_MOVED, COMSIG_MOB_CLIENT_MOVE))
|
||||
if(hud_icon)
|
||||
hud_icon.combat_on = FALSE
|
||||
hud_icon.update_icon()
|
||||
|
||||
///Changes the user direction to (try) keep match the pointer.
|
||||
/datum/component/combat_mode/proc/on_move(atom/movable/source, dir, atom/oldloc, forced)
|
||||
var/mob/living/L = source
|
||||
if(mode_flags & COMBAT_MODE_ACTIVE && L.client && lastmousedir && lastmousedir != dir)
|
||||
L.setDir(lastmousedir, ismousemovement = TRUE)
|
||||
|
||||
/// Added movement delay if moving backward.
|
||||
/datum/component/combat_mode/proc/on_client_move(mob/source, client/client, direction, n, oldloc, added_delay)
|
||||
if(oldloc != n && direction == REVERSE_DIR(source.dir))
|
||||
client.move_delay += added_delay*0.5
|
||||
|
||||
///Changes the user direction to (try) match the pointer.
|
||||
/datum/component/combat_mode/proc/onMouseMove(mob/source, object, location, control, params)
|
||||
if(source.client.show_popup_menus)
|
||||
return
|
||||
source.face_atom(object, TRUE)
|
||||
lastmousedir = source.dir
|
||||
|
||||
/// Toggles whether the user is intentionally in combat mode. THIS should be the proc you generally use! Has built in visual/to other player feedback, as well as an audible cue to ourselves.
|
||||
/datum/component/combat_mode/proc/user_toggle_intentional_combat_mode(mob/living/source)
|
||||
if(mode_flags & COMBAT_MODE_TOGGLED)
|
||||
safe_disable_combat_mode(source)
|
||||
else if(source.stat == CONSCIOUS && !(source.combat_flags & COMBAT_FLAG_HARD_STAMCRIT))
|
||||
safe_enable_combat_mode(source)
|
||||
|
||||
/// Enables intentionally being in combat mode. Please try to use the COMSIG_COMBAT_MODE_CHECK signal for feedback when possible.
|
||||
/datum/component/combat_mode/proc/safe_enable_combat_mode(mob/living/source, silent = FALSE, visible = TRUE)
|
||||
if((mode_flags & COMBAT_MODE_TOGGLED) && (mode_flags & COMBAT_MODE_ACTIVE))
|
||||
return TRUE
|
||||
mode_flags |= COMBAT_MODE_TOGGLED
|
||||
enable_combat_mode(source, silent, FALSE, visible, HAS_TRAIT(source, TRAIT_COMBAT_MODE_LOCKED), TRUE)
|
||||
if(source.client)
|
||||
source.client.show_popup_menus = FALSE
|
||||
if(iscarbon(source)) //I dislike this typecheck. It probably should be removed once that spoiled apple is componentized too.
|
||||
var/mob/living/carbon/C = source
|
||||
if(C.voremode)
|
||||
C.disable_vore_mode()
|
||||
return TRUE
|
||||
|
||||
/// Disables intentionally being in combat mode. Please try to use the COMSIG_COMBAT_MODE_CHECK signal for feedback when possible.
|
||||
/datum/component/combat_mode/proc/safe_disable_combat_mode(mob/living/source, silent = FALSE, visible = FALSE)
|
||||
if(!(mode_flags & COMBAT_MODE_TOGGLED) && !(mode_flags & COMBAT_MODE_ACTIVE))
|
||||
return TRUE
|
||||
mode_flags &= ~COMBAT_MODE_TOGGLED
|
||||
disable_combat_mode(source, silent, FALSE, visible, !(mode_flags & COMBAT_MODE_ACTIVE), TRUE)
|
||||
if(source.client)
|
||||
source.client.show_popup_menus = TRUE
|
||||
return TRUE
|
||||
|
||||
/// Returns a field of flags that are contained in both the second arg and our bitfield variable.
|
||||
/datum/component/combat_mode/proc/check_flags(mob/living/source, flags)
|
||||
return mode_flags & (flags)
|
||||
|
||||
/// Disables combat mode upon death.
|
||||
/datum/component/combat_mode/proc/on_death(mob/living/source)
|
||||
safe_disable_combat_mode(source)
|
||||
|
||||
/// Disables combat mode upon logout
|
||||
/datum/component/combat_mode/proc/on_logout(mob/living/source)
|
||||
safe_disable_combat_mode(source)
|
||||
|
||||
/// The screen button.
|
||||
/obj/screen/combattoggle
|
||||
name = "toggle combat mode"
|
||||
icon = 'modular_citadel/icons/ui/screen_midnight.dmi'
|
||||
icon_state = "combat_off"
|
||||
var/mutable_appearance/flashy
|
||||
var/combat_on = FALSE ///Wheter combat mode is enabled or not, so we don't have to store a reference.
|
||||
|
||||
/obj/screen/combattoggle/Click()
|
||||
if(hud && usr == hud.mymob)
|
||||
SEND_SIGNAL(hud.mymob, COMSIG_TOGGLE_COMBAT_MODE)
|
||||
|
||||
/obj/screen/combattoggle/update_icon_state()
|
||||
var/mob/living/user = hud?.mymob
|
||||
if(!user)
|
||||
return
|
||||
if(combat_on)
|
||||
icon_state = "combat"
|
||||
else if(HAS_TRAIT(user, TRAIT_COMBAT_MODE_LOCKED))
|
||||
icon_state = "combat_locked"
|
||||
else
|
||||
icon_state = "combat_off"
|
||||
|
||||
/obj/screen/combattoggle/update_overlays()
|
||||
. = ..()
|
||||
var/mob/living/carbon/user = hud?.mymob
|
||||
if(!(user?.client))
|
||||
return
|
||||
|
||||
if(combat_on)
|
||||
if(!flashy)
|
||||
flashy = mutable_appearance('icons/mob/screen_gen.dmi', "togglefull_flash")
|
||||
flashy.color = user.client.prefs.hud_toggle_color
|
||||
. += flashy //TODO - beg lummox jr for the ability to force mutable appearances or images to be created rendering from their first frame of animation rather than being based entirely around the client's frame count
|
||||
@@ -47,14 +47,11 @@
|
||||
if(icon_state)
|
||||
lock_icon_state = icon_state
|
||||
generate_lock_visuals()
|
||||
var/mob/M = parent
|
||||
LAZYOR(M.mousemove_intercept_objects, src)
|
||||
RegisterSignal(parent, COMSIG_MOB_CLIENT_MOUSEMOVE, .proc/onMouseMove)
|
||||
START_PROCESSING(SSfastprocess, src)
|
||||
|
||||
/datum/component/lockon_aiming/Destroy()
|
||||
var/mob/M = parent
|
||||
clear_visuals()
|
||||
LAZYREMOVE(M.mousemove_intercept_objects, src)
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
return ..()
|
||||
|
||||
@@ -120,7 +117,7 @@
|
||||
return
|
||||
LAZYREMOVE(immune_weakrefs, A.weak_reference)
|
||||
|
||||
/datum/component/lockon_aiming/onMouseMove(object,location,control,params)
|
||||
/datum/component/lockon_aiming/proc/onMouseMove(object,location,control,params)
|
||||
var/mob/M = parent
|
||||
if(!istype(M) || !M.client)
|
||||
return
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
valid_slots = _valid_slots
|
||||
|
||||
/datum/component/wearertargeting/phantomthief/proc/handlefilterstuff(mob/living/user, was_forced = FALSE)
|
||||
if(!(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
if(!SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE))
|
||||
user.remove_filter("phantomthief")
|
||||
else
|
||||
user.add_filter("phantomthief", 4, list(type = "drop_shadow", x = filter_x, y = filter_y, size = filter_size, color = filter_color))
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
/datum/martial_art/proc/damage_roll(mob/living/carbon/human/A, mob/living/carbon/human/D)
|
||||
//Here we roll for our damage to be added into the damage var in the various attack procs. This is changed depending on whether we are in combat mode, lying down, or if our target is in combat mode.
|
||||
var/damage = rand(A.dna.species.punchdamagelow, A.dna.species.punchdamagehigh)
|
||||
if(!(D.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
if(SEND_SIGNAL(D, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
damage *= 1.5
|
||||
if(!CHECK_MOBILITY(A, MOBILITY_STAND))
|
||||
damage *= 0.5
|
||||
if(!(A.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
if(SEND_SIGNAL(A, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
damage *= 0.25
|
||||
return damage
|
||||
|
||||
|
||||
@@ -97,9 +97,6 @@
|
||||
if(current) // remove ourself from our old body's mind variable
|
||||
current.mind = null
|
||||
SStgui.on_transfer(current, new_character)
|
||||
if(iscarbon(current))
|
||||
var/mob/living/carbon/C = current
|
||||
C.disable_intentional_combat_mode(TRUE)
|
||||
|
||||
if(key)
|
||||
if(new_character.key != key) //if we're transferring into a body with a key associated which is not ours
|
||||
|
||||
@@ -423,13 +423,11 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
return usr.client.Click(src, src_location, src_control, params)
|
||||
var/list/directaccess = usr.DirectAccess() //This, specifically, is what requires the copypaste. If this were after the adjacency check, then it'd be impossible to use items in your inventory, among other things.
|
||||
//If this were before the above checks, then trying to click on items would act a little funky and signal overrides wouldn't work.
|
||||
if(iscarbon(usr))
|
||||
var/mob/living/carbon/C = usr
|
||||
if((C.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) && ((C.CanReach(src) || (src in directaccess)) && (C.CanReach(over) || (over in directaccess))))
|
||||
if(!C.get_active_held_item())
|
||||
C.UnarmedAttack(src, TRUE)
|
||||
if(C.get_active_held_item() == src)
|
||||
melee_attack_chain(C, over)
|
||||
if(SEND_SIGNAL(usr, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE) && ((usr.CanReach(src) || (src in directaccess)) && (usr.CanReach(over) || (over in directaccess))))
|
||||
if(!usr.get_active_held_item())
|
||||
usr.UnarmedAttack(src, TRUE)
|
||||
if(usr.get_active_held_item() == src)
|
||||
melee_attack_chain(usr, over)
|
||||
return TRUE //returning TRUE as a "is this overridden?" flag
|
||||
if(!Adjacent(usr) || !over.Adjacent(usr))
|
||||
return // should stop you from dragging through windows
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
return TRUE
|
||||
|
||||
/obj/item/shield/proc/user_shieldbash(mob/living/user, atom/target, harmful)
|
||||
if(!(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)) //Combat mode has to be enabled for shield bashing
|
||||
if(!SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE)) //Combat mode has to be enabled for shield bashing
|
||||
return FALSE
|
||||
if(!(shield_flags & SHIELD_CAN_BASH))
|
||||
to_chat(user, "<span class='warning'>[src] can't be used to shield bash!</span>")
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
. += "<span class='notice'>[DisplayTimeText(nextadrenalinepop - world.time)] left before the adrenaline injector can be used again."
|
||||
|
||||
/obj/item/clothing/glasses/phantomthief/syndicate/proc/injectadrenaline(mob/living/user, was_forced = FALSE)
|
||||
if(user.combat_flags & COMBAT_FLAG_COMBAT_TOGGLED && world.time >= nextadrenalinepop)
|
||||
if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_TOGGLED) && world.time >= nextadrenalinepop)
|
||||
nextadrenalinepop = world.time + 5 MINUTES
|
||||
user.reagents.add_reagent(/datum/reagent/syndicateadrenals, 5)
|
||||
user.playsound_local(user, 'sound/misc/adrenalinject.ogg', 100, 0, pressure_affected = FALSE)
|
||||
|
||||
@@ -22,12 +22,8 @@
|
||||
full_name = "Toggle combat mode"
|
||||
description = "Toggles whether or not you're in combat mode."
|
||||
|
||||
/datum/keybinding/living/toggle_combat_mode/can_use(client/user)
|
||||
return iscarbon(user.mob) // for now, only carbons should be using combat mode, although all livings have combat mode implemented.
|
||||
|
||||
/datum/keybinding/living/toggle_combat_mode/down(client/user)
|
||||
var/mob/living/carbon/C = user.mob
|
||||
C.user_toggle_intentional_combat_mode()
|
||||
SEND_SIGNAL(user.mob, COMSIG_TOGGLE_COMBAT_MODE)
|
||||
return TRUE
|
||||
|
||||
/datum/keybinding/living/toggle_resting
|
||||
|
||||
@@ -443,14 +443,14 @@
|
||||
|
||||
//dropItemToGround(I) CIT CHANGE - makes it so the item doesn't drop if the modifier rolls above 100
|
||||
|
||||
var/modifier = 0
|
||||
var/modifier = 50
|
||||
|
||||
if(HAS_TRAIT(src, TRAIT_CLUMSY))
|
||||
modifier -= 40 //Clumsy people are more likely to hit themselves -Honk!
|
||||
|
||||
//CIT CHANGES START HERE
|
||||
else if(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)
|
||||
modifier += 50
|
||||
else if(SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
modifier -= 50
|
||||
|
||||
if(modifier < 100)
|
||||
dropItemToGround(I)
|
||||
@@ -828,13 +828,13 @@
|
||||
return
|
||||
if(IsUnconscious() || IsSleeping() || getOxyLoss() > 50 || (HAS_TRAIT(src, TRAIT_DEATHCOMA)) || (health <= HEALTH_THRESHOLD_FULLCRIT && !HAS_TRAIT(src, TRAIT_NOHARDCRIT)))
|
||||
stat = UNCONSCIOUS
|
||||
disable_intentional_combat_mode(FALSE, FALSE)
|
||||
SEND_SIGNAL(src, COMSIG_DISABLE_COMBAT_MODE)
|
||||
if(!eye_blind)
|
||||
blind_eyes(1)
|
||||
else
|
||||
if(health <= crit_threshold && !HAS_TRAIT(src, TRAIT_NOSOFTCRIT))
|
||||
stat = SOFT_CRIT
|
||||
disable_intentional_combat_mode(FALSE, FALSE)
|
||||
SEND_SIGNAL(src, COMSIG_DISABLE_COMBAT_MODE)
|
||||
else
|
||||
stat = CONSCIOUS
|
||||
if(eye_blind <= 1)
|
||||
@@ -1124,10 +1124,6 @@
|
||||
if(mood.sanity < SANITY_UNSTABLE)
|
||||
return TRUE
|
||||
|
||||
/mob/living/carbon/transfer_ckey(mob/new_mob, send_signal = TRUE)
|
||||
disable_intentional_combat_mode(TRUE, FALSE)
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/can_see_reagents()
|
||||
. = ..()
|
||||
if(.) //No need to run through all of this if it's already true.
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
/mob/living/carbon/enable_intentional_combat_mode()
|
||||
. = ..()
|
||||
if(.)
|
||||
if(voremode)
|
||||
toggle_vore_mode()
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
if(!gibbed)
|
||||
emote("deathgasp")
|
||||
|
||||
disable_intentional_combat_mode(TRUE, FALSE)
|
||||
|
||||
. = ..()
|
||||
|
||||
for(var/T in get_traumas())
|
||||
@@ -62,7 +60,3 @@
|
||||
var/obj/item/bodypart/BP = X
|
||||
BP.drop_limb()
|
||||
BP.throw_at(get_edge_target_turf(src,pick(GLOB.alldirs)),rand(1,3),5)
|
||||
|
||||
/mob/living/carbon/ghostize(can_reenter_corpse = TRUE, special = FALSE, penalize = FALSE, voluntary = FALSE)
|
||||
disable_intentional_combat_mode(TRUE, FALSE)
|
||||
return ..()
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
if(digitalcamo)
|
||||
. += "[t_He] [t_is] moving [t_his] body in an unnatural and blatantly unsimian manner."
|
||||
|
||||
if(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)
|
||||
if(SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE))
|
||||
. += "[t_He] [t_is] visibly tense[CHECK_MOBILITY(src, MOBILITY_STAND) ? "." : ", and [t_is] standing in combative stance."]"
|
||||
|
||||
var/trait_exam = common_trait_examine()
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
. = ..()
|
||||
if(!CONFIG_GET(flag/disable_human_mood))
|
||||
AddComponent(/datum/component/mood)
|
||||
AddComponent(/datum/component/combat_mode)
|
||||
AddElement(/datum/element/flavor_text/carbon, _name = "Flavor Text", _save_key = "flavor_text")
|
||||
AddElement(/datum/element/flavor_text, "", "Temporary Flavor Text", "This should be used only for things pertaining to the current round!")
|
||||
AddElement(/datum/element/flavor_text, _name = "OOC Notes", _addendum = "Put information on ERP/vore/lewd-related preferences here. THIS SHOULD NOT CONTAIN REGULAR FLAVORTEXT!!", _always_show = TRUE, _save_key = "ooc_notes", _examine_no_preview = TRUE)
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
if(!SSI)
|
||||
SSI = CONFIG_GET_ENTRY(number/movedelay/sprint_speed_increase)
|
||||
. -= SSI.config_entry_value
|
||||
if(wrongdirmovedelay)
|
||||
. += 1
|
||||
if (m_intent == MOVE_INTENT_WALK && HAS_TRAIT(src, TRAIT_SPEEDY_STEP))
|
||||
. -= 1.5
|
||||
|
||||
|
||||
@@ -1473,11 +1473,11 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
|
||||
var/punchedbrute = target.getBruteLoss()
|
||||
|
||||
//CITADEL CHANGES - makes resting and disabled combat mode reduce punch damage, makes being out of combat mode result in you taking more damage
|
||||
if(!(target.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
if(!SEND_SIGNAL(target, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
damage *= 1.5
|
||||
if(!CHECK_MOBILITY(user, MOBILITY_STAND))
|
||||
damage *= 0.5
|
||||
if(!(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
damage *= 0.25
|
||||
//END OF CITADEL CHANGES
|
||||
|
||||
@@ -1625,11 +1625,11 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
|
||||
log_combat(user, target, "disarmed out of grab from")
|
||||
return
|
||||
var/randn = rand(1, 100)
|
||||
if(!(target.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)) // CITADEL CHANGE
|
||||
if(SEND_SIGNAL(target, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE)) // CITADEL CHANGE
|
||||
randn += -10 //CITADEL CHANGE - being out of combat mode makes it easier for you to get disarmed
|
||||
if(!CHECK_MOBILITY(user, MOBILITY_STAND)) //CITADEL CHANGE
|
||||
randn += 100 //CITADEL CHANGE - No kosher disarming if you're resting
|
||||
if(!(target.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)) //CITADEL CHANGE
|
||||
if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE)) //CITADEL CHANGE
|
||||
randn += 25 //CITADEL CHANGE - Makes it harder to disarm outside of combat mode
|
||||
if(user.pulling == target)
|
||||
randn -= 20 //If you have the time to get someone in a grab, you should have a greater chance at snatching the thing in their hand. Will be made completely obsolete by the grab rework but i've got a poor track record for releasing big projects on time so w/e i guess
|
||||
@@ -1827,7 +1827,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
|
||||
if(IS_STAMCRIT(user))
|
||||
to_chat(user, "<span class='warning'>You're too exhausted for that.</span>")
|
||||
return
|
||||
if(!(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
to_chat(user, "<span class='warning'>You need combat mode to be active to that!</span>")
|
||||
return
|
||||
if(user.IsKnockdown() || user.IsParalyzed() || user.IsStun())
|
||||
|
||||
@@ -523,7 +523,7 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put
|
||||
//this updates all special effects: stun, sleeping, knockdown, druggy, stuttering, etc..
|
||||
/mob/living/carbon/handle_status_effects()
|
||||
..()
|
||||
if(getStaminaLoss() && !(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)) //CIT CHANGE - prevents stamina regen while combat mode is active
|
||||
if(getStaminaLoss() && !SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE)) //CIT CHANGE - prevents stamina regen while combat mode is active
|
||||
adjustStaminaLoss(!CHECK_MOBILITY(src, MOBILITY_STAND) ? ((combat_flags & COMBAT_FLAG_HARD_STAMCRIT) ? -7.5 : -6) : -3)//CIT CHANGE - decreases adjuststaminaloss to stop stamina damage from being such a joke
|
||||
|
||||
if(!(combat_flags & COMBAT_FLAG_HARD_STAMCRIT) && incomingstammult != 1)
|
||||
|
||||
@@ -322,7 +322,7 @@
|
||||
set_pull_offsets(M, state)
|
||||
|
||||
/mob/living/proc/set_pull_offsets(mob/living/M, grab_state = GRAB_PASSIVE)
|
||||
if(M.buckled || M.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)
|
||||
if(M.buckled || SEND_SIGNAL(M, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE))
|
||||
return //don't make them change direction or offset them if they're buckled into something or in combat mode.
|
||||
var/offset = 0
|
||||
switch(grab_state)
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/mob/living/ComponentInitialize()
|
||||
. = ..()
|
||||
RegisterSignal(src, SIGNAL_TRAIT(TRAIT_COMBAT_MODE_LOCKED), .proc/update_combat_lock)
|
||||
|
||||
/mob/living/proc/update_combat_lock()
|
||||
var/locked = HAS_TRAIT(src, TRAIT_COMBAT_MODE_LOCKED)
|
||||
var/desired = (combat_flags & COMBAT_FLAG_COMBAT_TOGGLED)
|
||||
var/actual = (combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)
|
||||
if(actual)
|
||||
if(locked)
|
||||
disable_combat_mode(FALSE, TRUE, FALSE, FALSE)
|
||||
else if(!desired)
|
||||
disable_combat_mode(TRUE, TRUE, FALSE, FALSE)
|
||||
else
|
||||
if(desired && !locked)
|
||||
enable_combat_mode(FALSE, TRUE, FALSE, FALSE)
|
||||
update_combat_mode_icon()
|
||||
|
||||
/mob/living/proc/disable_combat_mode(silent = TRUE, was_forced = FALSE, visible = FALSE, update_icon = TRUE)
|
||||
if(!(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) || (combat_flags & COMBAT_FLAG_COMBAT_FORCED))
|
||||
return
|
||||
DISABLE_BITFIELD(combat_flags, COMBAT_FLAG_COMBAT_ACTIVE)
|
||||
SEND_SIGNAL(src, COMSIG_LIVING_COMBAT_DISABLED, was_forced)
|
||||
if(visible)
|
||||
visible_message("<span class='warning'>[src] goes limp.</span>", "<span class='warning'>Your muscles are forcibly relaxed!</span>")
|
||||
else if(!silent)
|
||||
to_chat(src, was_forced? "<span class='warning'>Your muscles are forcibly relaxed!</span>" : "<span class='warning'>You relax your muscles.</span>")
|
||||
if(update_icon)
|
||||
update_combat_mode_icon()
|
||||
|
||||
/mob/living/proc/enable_combat_mode(silent = TRUE, was_forced = FALSE, visible = FALSE, update_icon = TRUE)
|
||||
if(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)
|
||||
return
|
||||
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_COMBAT_ACTIVE)
|
||||
SEND_SIGNAL(src, COMSIG_LIVING_COMBAT_ENABLED, was_forced)
|
||||
if(visible)
|
||||
visible_message("<span class='warning'>[src] drops into a combative stance!</span>", "<span class='warning'>You drop into a combative stance!</span>")
|
||||
else if(!silent)
|
||||
to_chat(src, was_forced? "<span class='warning'>Your muscles reflexively tighten!</span>" : "<span class='warning'>You tighten your muscles.</span>")
|
||||
if(update_icon)
|
||||
update_combat_mode_icon()
|
||||
|
||||
/// Updates the combat mode HUD icon.
|
||||
/mob/living/proc/update_combat_mode_icon()
|
||||
var/obj/screen/combattoggle/T = locate() in hud_used?.static_inventory
|
||||
T?.update_icon()
|
||||
|
||||
/// Enables intentionally being in combat mode. Please try not to use this proc for feedback whenever possible.
|
||||
/mob/living/proc/enable_intentional_combat_mode(silent = TRUE, visible = FALSE)
|
||||
if((combat_flags & COMBAT_FLAG_COMBAT_TOGGLED) && (combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
return
|
||||
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_COMBAT_TOGGLED)
|
||||
if(!HAS_TRAIT(src, TRAIT_COMBAT_MODE_LOCKED) && !(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
enable_combat_mode(silent, FALSE, visible, FALSE)
|
||||
update_combat_mode_icon()
|
||||
client?.show_popup_menus = FALSE
|
||||
return TRUE
|
||||
|
||||
/// Disables intentionally being in combat mode. Please try not to use this proc for feedback whenever possible.
|
||||
/mob/living/proc/disable_intentional_combat_mode(silent = TRUE, visible = FALSE)
|
||||
if(!(combat_flags & COMBAT_FLAG_COMBAT_TOGGLED) && !(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
return
|
||||
if(combat_flags & COMBAT_FLAG_COMBAT_FORCED)
|
||||
return
|
||||
DISABLE_BITFIELD(combat_flags, COMBAT_FLAG_COMBAT_TOGGLED)
|
||||
if(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE)
|
||||
disable_combat_mode(silent, FALSE, visible, FALSE)
|
||||
update_combat_mode_icon()
|
||||
client?.show_popup_menus = TRUE
|
||||
return TRUE
|
||||
|
||||
/// Toggles whether the user is intentionally in combat mode. THIS should be the proc you generally use! Has built in visual/to other player feedback, as well as an audible cue to ourselves.
|
||||
/mob/living/proc/user_toggle_intentional_combat_mode(visible = TRUE)
|
||||
var/old = (combat_flags & COMBAT_FLAG_COMBAT_TOGGLED)
|
||||
if(old)
|
||||
if(combat_flags & COMBAT_FLAG_COMBAT_FORCED)
|
||||
to_chat(src, "<span class='warning'>You are unable to relax your muscles.</span>")
|
||||
return
|
||||
disable_intentional_combat_mode()
|
||||
playsound_local(src, 'sound/misc/ui_toggleoff.ogg', 50, FALSE, pressure_affected = FALSE) //Slightly modified version of the above!
|
||||
else if(CAN_TOGGLE_COMBAT_MODE(src))
|
||||
enable_intentional_combat_mode()
|
||||
var/current = (combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) //because we could be locked
|
||||
if(current != old) //only sound effect if you succeeded. Could have the feedback system be better but shrug, someone else can do it.
|
||||
if(current)
|
||||
playsound_local(src, 'sound/misc/ui_toggle.ogg', 50, FALSE, pressure_affected = FALSE) //Sound from interbay!
|
||||
if(visible)
|
||||
if(world.time >= combatmessagecooldown)
|
||||
combatmessagecooldown = world.time + 10 SECONDS
|
||||
if(a_intent != INTENT_HELP)
|
||||
visible_message("<span class='warning'>[src] [resting ? "tenses up" : (prob(95)? "drops into a combative stance" : (prob(95)? "poses aggressively" : "asserts dominance with their pose"))].</span>")
|
||||
else
|
||||
visible_message("<span class='notice'>[src] [pick("looks","seems","goes")] [pick("alert","attentive","vigilant")].</span>")
|
||||
@@ -122,7 +122,7 @@
|
||||
|
||||
//// CITADEL STATION COMBAT ////
|
||||
/// See __DEFINES/combat.dm
|
||||
var/combat_flags = COMBAT_FLAGS_STAMSYSTEM_EXEMPT
|
||||
var/combat_flags = COMBAT_FLAGS_SPRINT_EXEMPT
|
||||
/// Next world.time when we will show a visible message on entering combat mode voluntarily again.
|
||||
var/combatmessagecooldown = 0
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
speech_span = SPAN_ROBOT
|
||||
flags_1 = PREVENT_CONTENTS_EXPLOSION_1 | HEAR_1
|
||||
vore_flags = NO_VORE
|
||||
/// Enable sprint system but not stamina
|
||||
combat_flags = COMBAT_FLAGS_STAMEXEMPT_YESSPRINT
|
||||
|
||||
var/datum/ai_laws/laws = null//Now... THEY ALL CAN ALL HAVE LAWS
|
||||
var/last_lawchange_announce = 0
|
||||
|
||||
@@ -101,10 +101,10 @@
|
||||
mob.throwing.finalize(FALSE)
|
||||
|
||||
var/atom/movable/AM = L.pulling
|
||||
if(AM && AM.density && !(L.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) && !ismob(AM))
|
||||
if(AM && AM.density && !SEND_SIGNAL(L, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE) && !ismob(AM))
|
||||
L.setDir(turn(L.dir, 180))
|
||||
|
||||
SEND_SIGNAL(mob, COMSIG_MOB_CLIENT_MOVE, src, direction, n, oldloc)
|
||||
SEND_SIGNAL(mob, COMSIG_MOB_CLIENT_MOVE, src, direction, n, oldloc, add_delay)
|
||||
|
||||
/// Process_Grab(): checks for grab, attempts to break if so. Return TRUE to prevent movement.
|
||||
/client/proc/Process_Grab()
|
||||
|
||||
@@ -215,6 +215,7 @@
|
||||
var/bonus_spread = 0
|
||||
var/loop_counter = 0
|
||||
|
||||
if(user)
|
||||
bonus_spread += getinaccuracy(user) //CIT CHANGE - adds bonus spread while not aiming
|
||||
if(ishuman(user) && user.a_intent == INTENT_HARM && weapon_weight <= WEAPON_LIGHT)
|
||||
var/mob/living/carbon/human/H = user
|
||||
@@ -565,12 +566,7 @@
|
||||
chambered = null
|
||||
update_icon()
|
||||
|
||||
/obj/item/gun/proc/getinaccuracy(mob/living/user)
|
||||
if(!isliving(user))
|
||||
return FALSE
|
||||
else
|
||||
var/mob/living/holdingdude = user
|
||||
if(istype(holdingdude) && (holdingdude.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
return 0
|
||||
else
|
||||
/obj/item/gun/proc/getinaccuracy(mob/user)
|
||||
if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE))
|
||||
return ((weapon_weight * 25) * inaccuracy_modifier)
|
||||
return 0
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
var/static/image/drained_overlay = image(icon = 'icons/obj/guns/energy.dmi', icon_state = "esniper_empty")
|
||||
|
||||
var/datum/action/item_action/zoom_lock_action/zoom_lock_action
|
||||
var/mob/listeningTo
|
||||
|
||||
/obj/item/gun/energy/beam_rifle/debug
|
||||
delay = 0
|
||||
@@ -178,7 +177,6 @@
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
set_user(null)
|
||||
QDEL_LIST(current_tracers)
|
||||
listeningTo = null
|
||||
return ..()
|
||||
|
||||
/obj/item/gun/energy/beam_rifle/proc/aiming_beam(force_update = FALSE)
|
||||
@@ -260,17 +258,12 @@
|
||||
if(user == current_user)
|
||||
return
|
||||
stop_aiming(current_user)
|
||||
if(listeningTo)
|
||||
UnregisterSignal(listeningTo, COMSIG_MOVABLE_MOVED)
|
||||
listeningTo = null
|
||||
if(istype(current_user))
|
||||
LAZYREMOVE(current_user.mousemove_intercept_objects, src)
|
||||
if(current_user)
|
||||
UnregisterSignal(current_user, COMSIG_MOVABLE_MOVED)
|
||||
current_user = null
|
||||
if(istype(user))
|
||||
current_user = user
|
||||
LAZYOR(current_user.mousemove_intercept_objects, src)
|
||||
RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/on_mob_move)
|
||||
listeningTo = user
|
||||
|
||||
/obj/item/gun/energy/beam_rifle/onMouseDrag(src_object, over_object, src_location, over_location, params, mob)
|
||||
if(aiming)
|
||||
|
||||
@@ -1,53 +1,22 @@
|
||||
/obj/screen/combattoggle
|
||||
name = "toggle combat mode"
|
||||
icon = 'modular_citadel/icons/ui/screen_midnight.dmi'
|
||||
icon_state = "combat_off"
|
||||
var/mutable_appearance/flashy
|
||||
|
||||
/obj/screen/combattoggle/Click()
|
||||
if(iscarbon(usr))
|
||||
var/mob/living/carbon/C = usr
|
||||
C.user_toggle_intentional_combat_mode()
|
||||
|
||||
/obj/screen/combattoggle/update_icon_state()
|
||||
var/mob/living/carbon/user = hud?.mymob
|
||||
if(!istype(user))
|
||||
return
|
||||
if((user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
icon_state = "combat"
|
||||
else if(HAS_TRAIT(user, TRAIT_COMBAT_MODE_LOCKED))
|
||||
icon_state = "combat_locked"
|
||||
else
|
||||
icon_state = "combat_off"
|
||||
|
||||
/obj/screen/combattoggle/update_overlays()
|
||||
. = ..()
|
||||
var/mob/living/carbon/user = hud?.mymob
|
||||
if(!istype(user) || !user.client)
|
||||
return
|
||||
|
||||
if((user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) && user.client.prefs.hud_toggle_flash)
|
||||
if(!flashy)
|
||||
flashy = mutable_appearance('icons/mob/screen_gen.dmi', "togglefull_flash")
|
||||
if(flashy.color != user.client.prefs.hud_toggle_color)
|
||||
flashy.color = user.client.prefs.hud_toggle_color
|
||||
. += flashy //TODO - beg lummox jr for the ability to force mutable appearances or images to be created rendering from their first frame of animation rather than being based entirely around the client's frame count
|
||||
|
||||
/obj/screen/voretoggle
|
||||
name = "toggle vore mode"
|
||||
icon = 'modular_citadel/icons/ui/screen_midnight.dmi'
|
||||
icon_state = "nom_off"
|
||||
|
||||
/obj/screen/voretoggle/Click()
|
||||
if(iscarbon(usr))
|
||||
if(usr != hud.mymob)
|
||||
return
|
||||
var/mob/living/carbon/C = usr
|
||||
if(SEND_SIGNAL(usr, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE))
|
||||
to_chat(usr, "<span class='warning'>Disable combat mode first.</span>")
|
||||
return
|
||||
C.toggle_vore_mode()
|
||||
|
||||
/obj/screen/voretoggle/update_icon_state()
|
||||
var/mob/living/carbon/user = hud?.mymob
|
||||
if(!istype(user))
|
||||
return
|
||||
if(user.voremode && !(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
if(user.voremode)
|
||||
icon_state = "nom"
|
||||
else
|
||||
icon_state = "nom_off"
|
||||
|
||||
@@ -1,29 +1,16 @@
|
||||
/mob/living/carbon
|
||||
var/lastmousedir
|
||||
var/wrongdirmovedelay
|
||||
|
||||
//oh no vore time
|
||||
var/voremode = FALSE
|
||||
|
||||
/mob/living/carbon/proc/toggle_vore_mode()
|
||||
if(SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_TOGGLED))
|
||||
return FALSE //let's not override the main draw of the game these days
|
||||
voremode = !voremode
|
||||
var/obj/screen/voretoggle/T = locate() in hud_used?.static_inventory
|
||||
T?.update_icon_state()
|
||||
if(combat_flags & COMBAT_FLAG_COMBAT_TOGGLED)
|
||||
return FALSE //let's not override the main draw of the game these days
|
||||
SEND_SIGNAL(src, COMSIG_VORE_TOGGLED, src, voremode)
|
||||
return TRUE
|
||||
|
||||
/mob/living/carbon/Move(atom/newloc, direct = 0)
|
||||
. = ..()
|
||||
wrongdirmovedelay = FALSE
|
||||
if((combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) && client && lastmousedir)
|
||||
if(lastmousedir != dir)
|
||||
wrongdirmovedelay = TRUE
|
||||
setDir(lastmousedir, ismousemovement = TRUE)
|
||||
|
||||
/mob/living/carbon/onMouseMove(object, location, control, params)
|
||||
if(!(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
|
||||
return
|
||||
face_atom(object, TRUE)
|
||||
lastmousedir = dir
|
||||
/mob/living/carbon/proc/disable_vore_mode()
|
||||
voremode = FALSE
|
||||
var/obj/screen/voretoggle/T = locate() in hud_used?.static_inventory
|
||||
T?.update_icon_state()
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
if(!(combat_flags & COMBAT_FLAG_HARD_STAMCRIT) && total_health >= STAMINA_CRIT && !stat)
|
||||
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
|
||||
set_resting(TRUE, FALSE, FALSE)
|
||||
disable_intentional_combat_mode(TRUE, FALSE)
|
||||
SEND_SIGNAL(src, COMSIG_DISABLE_COMBAT_MODE)
|
||||
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_HARD_STAMCRIT)
|
||||
filters += CIT_FILTER_STAMINACRIT
|
||||
update_mobility()
|
||||
|
||||
@@ -395,6 +395,7 @@
|
||||
#include "code\datums\components\butchering.dm"
|
||||
#include "code\datums\components\caltrop.dm"
|
||||
#include "code\datums\components\chasm.dm"
|
||||
#include "code\datums\components\combat_mode.dm"
|
||||
#include "code\datums\components\construction.dm"
|
||||
#include "code\datums\components\decal.dm"
|
||||
#include "code\datums\components\dejavu.dm"
|
||||
@@ -2309,7 +2310,6 @@
|
||||
#include "code\modules\mob\living\life.dm"
|
||||
#include "code\modules\mob\living\living.dm"
|
||||
#include "code\modules\mob\living\living_block.dm"
|
||||
#include "code\modules\mob\living\living_combat.dm"
|
||||
#include "code\modules\mob\living\living_defense.dm"
|
||||
#include "code\modules\mob\living\living_defines.dm"
|
||||
#include "code\modules\mob\living\living_mobility.dm"
|
||||
@@ -2332,7 +2332,6 @@
|
||||
#include "code\modules\mob\living\brain\say.dm"
|
||||
#include "code\modules\mob\living\brain\status_procs.dm"
|
||||
#include "code\modules\mob\living\carbon\carbon.dm"
|
||||
#include "code\modules\mob\living\carbon\carbon_combat.dm"
|
||||
#include "code\modules\mob\living\carbon\carbon_defense.dm"
|
||||
#include "code\modules\mob\living\carbon\carbon_defines.dm"
|
||||
#include "code\modules\mob\living\carbon\carbon_movement.dm"
|
||||
|
||||
Reference in New Issue
Block a user