Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
51 changes: 43 additions & 8 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,6 @@ GLOBAL_LIST_INIT(all_precise_body_zones, list(BODY_ZONE_PRECISE_EYES, BODY_ZONE_
/// Calculates the new armour value after armour penetration. Can return negative values, and those must be caught.
#define PENETRATE_ARMOUR(armour, penetration) (penetration == 100 ? 0 : 100 * (armour - penetration) / (100 - penetration))

/// Return values used in item/melee/baton/baton_attack.
/// Does a normal item attack.
#define BATON_DO_NORMAL_ATTACK 1
/// The attack has been stopped. Either because the user was clumsy or the attack was blocked.
#define BATON_ATTACK_DONE 2
/// The baton attack is still going. baton_effect() is called.
#define BATON_ATTACKING 3

// Defines for combo attack component
/// LMB Attack
#define LEFT_ATTACK "Left Attack"
Expand Down Expand Up @@ -360,3 +352,46 @@ GLOBAL_LIST_INIT(all_precise_body_zones, list(BODY_ZONE_PRECISE_EYES, BODY_ZONE_
#define JOULES_PER_DAMAGE (25 KILO JOULES)
/// Calculates the amount of burn force when applying this much energy to a mob via electrocution from an energy source.
#define ELECTROCUTE_DAMAGE(energy) (energy >= 1 KILO JOULES ? clamp(20 + round(energy / JOULES_PER_DAMAGE), 20, 195) + rand(-5,5) : 0)

// Attack chain attack_modifier modifiers
/// Sets the weapon's base force to this. Use carefully (as multiple overrides may collide). Set via [SET_ATTACK_FORCE]
#define FORCE_OVERRIDE "force_override"
/// Flat addition or subtration to the weapon's force. Set via [MODIFY_ATTACK_FORCE]
#define FORCE_MODIFIER "force_modifier"
/// Multiplication of the weapon's force. Applied AFTER [FORCE_MODIFIER]. Set via [MODIFY_ATTACK_FORCE_MULTIPLIER]
#define FORCE_MULTIPLIER "force_multiplier"
/// If set in modifiers, default messages ("You hit the thing with the thing") are silenced
#define SILENCE_DEFAULT_MESSAGES "silence_default_messages"
/// If set in modifiers, default hitsound is silenced
#define SILENCE_HITSOUND "silence_hitsound"

/// Used in attack chain to set the force of the attack without changing the base force of the item.
#define SET_ATTACK_FORCE(atk_mods, value) \
if(!islist(atk_mods)) { atk_mods = list() }; \
atk_mods[FORCE_OVERRIDE] = value;

/// Used in attack chain to add or remove force from the attack without changing the base force of the item.
#define MODIFY_ATTACK_FORCE(atk_mods, amount) \
if(!islist(atk_mods)) { atk_mods = list() }; \
atk_mods[FORCE_MODIFIER] += amount;

/// Used in attack chain to multiply the force of the attack without changing the base force of the item.
#define MODIFY_ATTACK_FORCE_MULTIPLIER(atk_mods, amount) \
if(!islist(atk_mods)) { atk_mods = list() }; \
if(!(FORCE_MULTIPLIER in atk_mods)) { atk_mods[FORCE_MULTIPLIER] = 1 }; \
atk_mods[FORCE_MULTIPLIER] *= amount;

/// Used in attack chain to prevent hitsounds on attack (to allow for custom sounds)
#define MUTE_ATTACK_HITSOUND(atk_mods) \
if(!islist(atk_mods)) { atk_mods = list() }; \
atk_mods[SILENCE_HITSOUND] = TRUE;

/// Used in attack chain to prevent default visible messages from being sent (to allow for custom messages)
#define HIDE_ATTACK_MESSAGES(atk_mods) \
if(!islist(atk_mods)) { atk_mods = list() }; \
atk_mods[SILENCE_DEFAULT_MESSAGES] = TRUE;

/// Calculates the final force of some item based on atk_mods
/// Needs to have support for force overrides and multipliers of 0 (hence why we ternaries are used over 'or's)
#define CALCULATE_FORCE(some_item, atk_mods) \
((((FORCE_OVERRIDE in atk_mods) ? atk_mods[FORCE_OVERRIDE] : some_item.force) + (atk_mods?[FORCE_MODIFIER] || 0)) * ((FORCE_MULTIPLIER in atk_mods) ? atk_mods[FORCE_MULTIPLIER] : 1))
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// When the signal is called: (signal arguments)
// All signals send the source datum of the signal as the first argument

///from base of atom/attackby(): (/obj/item, /mob/living, params)
///from base of atom/attackby(): (/obj/item, /mob/living, list/modifiers)
#define COMSIG_ATOM_ATTACKBY "atom_attackby"
/// From base of [atom/proc/attacby_secondary()]: (/obj/item/weapon, /mob/user, params)
/// From base of [atom/proc/attacby_secondary()]: (/obj/item/weapon, /mob/user, list/modifiers)
#define COMSIG_ATOM_ATTACKBY_SECONDARY "atom_attackby_secondary"
/// From [/item/attack()], sent by an atom which was just attacked by an item: (/obj/item/weapon, /mob/user, proximity_flag, click_parameters)
/// From [/item/attack()], sent by an atom which was just attacked by an item: (/obj/item/weapon, /mob/user, list/modifiers)
#define COMSIG_ATOM_AFTER_ATTACKEDBY "atom_after_attackby"
/// From base of [/atom/proc/attack_hand_secondary]: (mob/user, list/modifiers) - Called when the atom receives a secondary unarmed attack.
#define COMSIG_ATOM_ATTACK_HAND_SECONDARY "atom_attack_hand_secondary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@

/// Sent to the mob when their mind is slaved
#define COMSIG_MOB_ENSLAVED_TO "mob_enslaved_to"
/// From /obj/item/proc/attack_atom: (mob/living/attacker, atom/attacked)
/// From /obj/item/proc/attack_atom: (mob/living/attacker, atom/attacked, list/modifiers)
#define COMSIG_LIVING_ATTACK_ATOM "living_attack_atom"
/// From /mob/living/proc/stop_leaning()
#define COMSIG_LIVING_STOPPED_LEANING "living_stopped_leaning"
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
#define COMSIG_TABLE_SLAMMED "table_slammed"
///from base of atom/attack_hand(): (mob/user, modifiers)
#define COMSIG_MOB_ATTACK_HAND "mob_attack_hand"
///from base of /obj/item/attack(): (mob/M, mob/user)
///from base of /obj/item/attack(): (mob/M, mob/user, list/modifiers, list/attack_modifiers)
#define COMSIG_MOB_ITEM_ATTACK "mob_item_attack"
///from base of mob/RangedAttack(): (atom/A, modifiers)
#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged"
Expand Down
16 changes: 8 additions & 8 deletions code/__DEFINES/dcs/signals/signals_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
#define COMSIG_ITEM_ON_GRIND "on_grind"
///from base of obj/item/on_juice(): ()
#define COMSIG_ITEM_ON_JUICE "on_juice"
///from /obj/machinery/hydroponics/attackby(obj/item/O, mob/user, params) when an object is used as compost: (mob/user)
///from /obj/machinery/hydroponics/attackby(obj/item/O, mob/user, list/modifiers, list/attack_modifiers) when an object is used as compost: (mob/user)
#define COMSIG_ITEM_ON_COMPOSTED "on_composted"
///Called when an item is dried by a drying rack
#define COMSIG_ITEM_DRIED "item_dried"
Expand Down Expand Up @@ -190,7 +190,7 @@
#define COMSIG_ITEM_OFFER_TAKEN "item_offer_taken"
///Interrupts the offer acceptance
#define COMPONENT_OFFER_TAKE_INTERRUPT (1<<0)
/// sent from obj/effect/attackby(): (/obj/effect/hit_effect, /mob/living/attacker, params)
/// sent from obj/effect/attackby(): (/obj/effect/hit_effect, /mob/living/attacker, list/modifiers)
#define COMSIG_ITEM_ATTACK_EFFECT "item_effect_attacked"
/// Called by /obj/item/proc/worn_overlays(list/overlays, mutable_appearance/standing, isinhands, icon_file)
#define COMSIG_ITEM_GET_WORN_OVERLAYS "item_get_worn_overlays"
Expand Down Expand Up @@ -452,24 +452,24 @@
/// Prevents click from happening.
#define COMPONENT_CANCEL_EQUIPMENT_CLICK (1<<0)

///from base of /obj/item/attack(): (mob/living, mob/living, params)
///from base of /obj/item/attack(): (mob/living, mob/living, list/modifiers, list/attack_modifiers)
#define COMSIG_ITEM_ATTACK "item_attack"
///from base of obj/item/attack_self(): (/mob)
#define COMSIG_ITEM_ATTACK_SELF "item_attack_self"
//from base of obj/item/attack_self_secondary(): (/mob)
#define COMSIG_ITEM_ATTACK_SELF_SECONDARY "item_attack_self_secondary"
///from base of obj/item/attack_atom(): (/atom, /mob)
///from base of obj/item/attack_atom(): (/atom, /mob, list/modifiers)
#define COMSIG_ITEM_ATTACK_ATOM "item_attack_atom"
///from base of obj/item/pre_attack(): (atom/target, mob/user, params)
///from base of obj/item/pre_attack(): (atom/target, mob/user, list/modifiers)
#define COMSIG_ITEM_PRE_ATTACK "item_pre_attack"
/// From base of [/obj/item/proc/pre_attack_secondary()]: (atom/target, mob/user, params)
/// From base of [/obj/item/proc/pre_attack_secondary()]: (atom/target, mob/user, list/modifiers, list/attack_modifiers)
#define COMSIG_ITEM_PRE_ATTACK_SECONDARY "item_pre_attack_secondary"
#define COMPONENT_SECONDARY_CANCEL_ATTACK_CHAIN (1<<0)
#define COMPONENT_SECONDARY_CONTINUE_ATTACK_CHAIN (1<<1)
#define COMPONENT_SECONDARY_CALL_NORMAL_ATTACK_CHAIN (1<<2)
/// From base of [/obj/item/proc/attack_secondary()]: (atom/target, mob/user, params)
/// From base of [/obj/item/proc/attack_secondary()]: (atom/target, mob/user, list/modifiers, list/attack_modifiers)
#define COMSIG_ITEM_ATTACK_SECONDARY "item_attack_secondary"
///from base of [obj/item/attack()]: (atom/target, mob/user, proximity_flag, click_parameters)
///from base of [obj/item/attack()]: (atom/target, mob/user, proximity_flag, list/modifiers)
#define COMSIG_ITEM_AFTERATTACK "item_afterattack"
///from base of obj/item/embedded(): (atom/target, obj/item/bodypart/part)
#define COMSIG_ITEM_EMBEDDED "item_embedded"
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
//User itself, current loc, and user inventory
if(A in DirectAccess())
if(W)
W.melee_attack_chain(src, A, params)
W.melee_attack_chain(src, A, modifiers)
else
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
Expand All @@ -162,7 +162,7 @@
//Standard reach turf to turf or reaching inside storage
if(CanReach(A,W))
if(W)
W.melee_attack_chain(src, A, params)
W.melee_attack_chain(src, A, modifiers)
else
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/cyborg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@

// cyborgs are prohibited from using storage items so we can I think safely remove (A.loc in contents)
if(A == loc || (A in loc) || (A in contents))
W.melee_attack_chain(src, A, params)
W.melee_attack_chain(src, A, modifiers)
return

if(!isturf(loc))
return

// cyborg rightclick code, allowing borgos to use weapons at range
if(CanReach(A,W))
W.melee_attack_chain(src, A, params)
W.melee_attack_chain(src, A, modifiers)
return
else if(isturf(A) || isturf(A.loc))
A.base_ranged_item_interaction(src, W, modifiers)
Expand Down
Loading
Loading