Skip to content

Commit

Permalink
refactor: Attack Chain Rework Part1 (#5672) [testmerge]
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottfrei authored and Dimach committed Aug 7, 2024
1 parent fbcc934 commit ebb5dea
Show file tree
Hide file tree
Showing 221 changed files with 3,132 additions and 2,561 deletions.
10 changes: 4 additions & 6 deletions _maps/map_files/generic/CentComm.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -8654,10 +8654,9 @@
/area/centcom/supply)
"dZu" = (
/obj/effect/turf_decal/caution/stand_clear/white,
/obj/machinery/door/poddoor/impassable{
/obj/machinery/door/poddoor/impassable/unhittable{
id_tag = "CC_Players_In";
name = "Blast Door";
can_be_hit = 0
name = "Blast Door"
},
/turf/simulated/floor/plasteel{
icon_state = "dark"
Expand Down Expand Up @@ -40390,10 +40389,9 @@
/area/centcom/zone2)
"sFQ" = (
/obj/effect/turf_decal/caution/stand_clear/white,
/obj/machinery/door/poddoor/impassable{
/obj/machinery/door/poddoor/impassable/unhittable{
id_tag = "CC_Players_In";
name = "Blast Door";
can_be_hit = 0
name = "Blast Door"
},
/turf/simulated/floor/plasteel{
icon_state = "dark"
Expand Down
6 changes: 2 additions & 4 deletions _maps/map_files/shuttles/ferry_meteorshelp.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@
/obj/machinery/door/window/survival_pod{
dir = 2
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor/mech_bay_recharge_floor,
Expand All @@ -165,10 +164,9 @@
dir = 1;
tag = "icon-tube1 (NORTH)"
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor/plasteel{
Expand Down
3 changes: 1 addition & 2 deletions _maps/map_files/shuttles/ferry_slave.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@
layer = 3;
req_access = list(104,106,63,19)
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor{
Expand Down
30 changes: 10 additions & 20 deletions _maps/map_files/shuttles/ferry_zoo.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
/mob/living/simple_animal/pet/dog/corgi/narsie{
faction = list("neutral")
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor{
Expand All @@ -32,10 +31,9 @@
req_access = list(104,106,63,19)
},
/mob/living/simple_animal/hulk/zilla,
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor{
Expand Down Expand Up @@ -86,10 +84,9 @@
/mob/living/simple_animal/hostile/creature{
faction = list("neutral")
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor{
Expand All @@ -106,10 +103,9 @@
/mob/living/simple_animal/hostile/netherworld/migo{
faction = list("neutral")
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor{
Expand Down Expand Up @@ -177,10 +173,9 @@
/mob/living/simple_animal/hostile/hellhound{
faction = list("neutral")
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor{
Expand Down Expand Up @@ -208,10 +203,9 @@
dir = 1;
tag = "icon-tube1 (NORTH)"
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor/noslip{
Expand Down Expand Up @@ -251,10 +245,9 @@
/obj/item/reagent_containers/food/snacks/grown/banana,
/obj/item/reagent_containers/food/snacks/grown/banana,
/obj/machinery/light/spot,
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor/noslip{
Expand All @@ -268,10 +261,9 @@
layer = 3;
req_access = list(104,106,63,19)
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor{
Expand All @@ -284,10 +276,9 @@
layer = 3;
req_access = list(104,106,63,19)
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor{
Expand All @@ -304,10 +295,9 @@
/mob/living/simple_animal/pet/penguin/emperor{
faction = list("neutral")
},
/obj/structure/window/reinforced/survival_pod{
/obj/structure/window/reinforced/survival_pod/unhittable{
dir = 8;
pixel_x = -4;
can_be_hit = 0;
damage_deflection = 100
},
/turf/simulated/floor{
Expand Down
14 changes: 14 additions & 0 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,17 @@

#define COMBO_STEPS "steps"
#define COMBO_PROC "proc"


#define ATTACK_CHAIN_PROCEED NONE // temporary value, until attackby is fully converted
#define ATTACK_CHAIN_SUCCESS (1<<1)
#define ATTACK_CHAIN_BLOCKED (1<<2)
#define ATTACK_CHAIN_NO_AFTERATTACK (1<<3)
#define ATTACK_CHAIN_CANCEL (ATTACK_CHAIN_SUCCESS|ATTACK_CHAIN_BLOCKED)
#define ATTACK_CHAIN_CANCEL_ALL (ATTACK_CHAIN_CANCEL|ATTACK_CHAIN_NO_AFTERATTACK)
#define ATTACK_CHAIN_VALID_BITFLAGS (ATTACK_CHAIN_PROCEED|ATTACK_CHAIN_CANCEL_ALL)

#define ATTACK_CHAIN_CANCEL_CHECK(bitflags) (ATTACK_CHAIN_CANCEL & bitflags)
#define ATTACK_CHAIN_NO_AFTERATTACK_CHECK(bitflags) (ATTACK_CHAIN_NO_AFTERATTACK & bitflags)
#define ATTACK_CHAIN_CANCEL_ALL_CHECK(bitflags) (ATTACK_CHAIN_CANCEL_CHECK(bitflags) || ATTACK_CHAIN_NO_AFTERATTACK_CHECK(bitflags))

12 changes: 4 additions & 8 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#define COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE "atom_init_success"
//from SSatoms InitAtom - Only if the atom was not deleted or failed initialization and has a loc
#define COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON "atom_init_success_on"
///from base of atom/attackby(): (/obj/item, /atom/source, params) sends singal on user who attacked source
///from base of /obj/item//attack(): (/obj/item, /atom/source, params) sends singal on user who attacked source
#define COMSIG_ATOM_ATTACK "atom_attack"
///called when the atom sucessfully has it's density var changed, from base atom/set_density(): (value)
#define COMSIG_ATOM_SET_DENSITY "atom_set_density"
Expand All @@ -77,8 +77,6 @@

///from base of atom/attackby(): (/obj/item, /mob/living, params)
#define COMSIG_PARENT_ATTACKBY "atom_attackby"
///Return this in response if you don't want afterattack to be called
#define COMPONENT_NO_AFTERATTACK (1<<0)
///from base of atom/attack_hulk(): (/mob/living/carbon/human)
#define COMSIG_ATOM_HULK_ATTACK "hulk_attack"
///from base of atom/animal_attack(): (/mob/user)
Expand Down Expand Up @@ -220,6 +218,8 @@
// You can use these signal responses to cancel the attack chain at a certain point from most attack signal types.
/// This response cancels the attack chain entirely. If sent early, it might cause some later effects to be skipped.
#define COMPONENT_CANCEL_ATTACK_CHAIN (1<<0)
///Return this in response if you don't want afterattack to be called
#define COMPONENT_NO_AFTERATTACK (1<<1)

/////////////////
///from base of atom/attack_ghost(): (mob/dead/observer/ghost)
Expand Down Expand Up @@ -707,17 +707,15 @@

// /obj/item signals

///from base of obj/item/attack(): (/mob/living/target, /mob/living/user)
///from base of obj/item/attack(): (/mob/living/target, /mob/living/user, params, def_zone)
#define COMSIG_ITEM_ATTACK "item_attack"
///from base of obj/item/attack_self(): (/mob)
#define COMSIG_ITEM_ATTACK_SELF "item_attack_self"
#define COMPONENT_NO_INTERACT (1<<0)
///from base of obj/item/attack_obj(): (/obj, /mob)
#define COMSIG_ITEM_ATTACK_OBJ "item_attack_obj"
#define COMPONENT_NO_ATTACK_OBJ (1<<0)
///from base of obj/item/pre_attackby(): (atom/target, mob/user, params)
#define COMSIG_ITEM_PRE_ATTACKBY "item_pre_attackby"
#define COMPONENT_NO_ATTACK (1<<0)
///from base of obj/item/afterattack(): (atom/target, mob/user, params)
#define COMSIG_ITEM_AFTERATTACK "item_afterattack"
///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, params)
Expand All @@ -734,8 +732,6 @@
#define COMSIG_ITEM_DROPPED "item_drop"
///from base of obj/item/pickup(): (/mob/taker)
#define COMSIG_ITEM_PICKUP "item_pickup"
///from base of mob/living/carbon/attacked_by(): (mob/living/carbon/target, mob/living/user, hit_zone)
#define COMSIG_ITEM_ATTACK_ZONE "item_attack_zone"
///return a truthy value to prevent ensouling, checked in /obj/effect/proc_holder/spell/lichdom/cast(): (mob/user)
#define COMSIG_ITEM_IMBUE_SOUL "item_imbue_soul"
///called before marking an object for retrieval, checked in /obj/effect/proc_holder/spell/summonitem/cast() : (mob/user)
Expand Down
6 changes: 5 additions & 1 deletion code/__DEFINES/obj_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#define BLOCK_Z_IN_UP (1<<4)
/// Objects will not leave any components after being destroyed
#define NODECONSTRUCT (1<<5)
/// Objects will ignore item attacks
#define IGNORE_HITS (1<<6)


// Flags for the item_flags var on /obj/item
Expand All @@ -34,7 +36,7 @@
#define NOSHARPENING (1<<6)
/// If an item has this flag, it will slow you, but only if in hands.
#define SLOWS_WHILE_IN_HAND (1<<7)
/// When an item has this it produces no "X has been hit by Y with Z" message in the default attackby()
/// When an item has this it will skip all the procedures in default /obj/item/proc/attack() and /obj/item/proc/attack_obj()
#define NOBLUDGEON (1<<8)
/// When dropped, it wont have a randomized pixel_x/pixel_y
#define NO_PIXEL_RANDOM_DROP (1<<9)
Expand All @@ -50,6 +52,8 @@
#define HEALS_EARS (1<<14)
/// An item will allow its usage even when UI is blocked but user is conscious, not incapacitated and has no hands blocked trait.
#define DENY_UI_BLOCKED (1<<15)
/// When an item has this it produces no "X has been hit by Y with Z" message in the default /mob/living/proc/send_item_attack_message()
#define SKIP_ATTACK_MESSAGE (1<<16)


// Flags for the clothing_flags var on /obj/item/clothing
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ GLOBAL_LIST_INIT(can_embed_types, typecacheof(list(
if(is_type_in_typecache(W, GLOB.can_embed_types))
return 1

/proc/is_hot(obj/item/W as obj)
/proc/is_hot(obj/item/W)
if(W.tool_behaviour == TOOL_WELDER)
if(W.tool_enabled)
return 2500
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
else // non-adjacent click
beforeRangedClick(A, params)
if(W)
W.afterattack(A,src,0,params) // 0: not Adjacent
W.afterattack(A, src, FALSE, params)
else
RangedAttack(A, params)

Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/cogscarab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
return
else
if(W)
W.afterattack(A, src, 0, params)
W.afterattack(A, src, FALSE, params)
else
RangedAttack(A, params)
return
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/cyborg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
W.melee_attack_chain(src, A, params)
return
else
W.afterattack(A, src, 0, params)
W.afterattack(A, src, FALSE, params)
return
return

Expand Down
Loading

0 comments on commit ebb5dea

Please sign in to comment.