Skip to content

Commit

Permalink
Отработка по ревью
Browse files Browse the repository at this point in the history
  • Loading branch information
msw7007 committed Oct 21, 2024
1 parent 8d23718 commit 00cdc58
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 72 deletions.
1 change: 1 addition & 0 deletions modular_ss220/species/_code/chat_offset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define CHAT_MESSAGE_WIDTH 96
#define CHAT_MESSAGE_GRACE_PERIOD (0.2 SECONDS)

//Отрпавить на оффы - так можно кастомно выводить рунчат сообщения (выше/ниже верхней границы спрайта)
/mob
var/chat_message_y_offset = 0

Expand Down
11 changes: 6 additions & 5 deletions modular_ss220/species/_code/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
qdel(preview_icon_side)
qdel(preview_icon)

var/g = "m"
//Переменные взяты с оффов, обновил
var/gender = "m"
if(body_type == FEMALE)
g = "f"
gender = "f"

var/icon/icobase = selected_specie.icobase
preview_icon = new /icon(icobase, "torso_[g]")
preview_icon.Blend(new /icon(icobase, "groin_[g]"), ICON_OVERLAY)
preview_icon.Blend(new /icon(icobase, "head_[g]"), ICON_OVERLAY)
preview_icon = new /icon(icobase, "torso_[gender]")
preview_icon.Blend(new /icon(icobase, "groin_[gender]"), ICON_OVERLAY)
preview_icon.Blend(new /icon(icobase, "head_[gender]"), ICON_OVERLAY)
for(var/name in list("chest", "groin", "head", "r_arm", "r_hand", "r_leg", "r_foot", "l_leg", "l_foot", "l_arm", "l_hand"))
if(organ_data[name] == "amputated") continue
if(organ_data[name] == "cyborg")
Expand Down
83 changes: 49 additions & 34 deletions modular_ss220/species/_components/appearance/mob_overlay_shift.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
Компонент должен цепляться на моба.
При инициализации предаются сдвиги.
*/
#define MOB_OVERLAY_SHIFT_HAND "inhand"
#define MOB_OVERLAY_SHIFT_BELT "belt"
#define MOB_OVERLAY_SHIFT_BACK "back"
#define MOB_OVERLAY_SHIFT_HEAD "head"
#define MOB_OVERLAY_SHIFT_SIDE "side"
#define MOB_OVERLAY_SHIFT_FRONT "front"
#define MOB_OVERLAY_SHIFT_CENTER "center"

#define COMSIG_MOB_OVERLAY_SHIFT_ON_EQUIP "on_equip"
#define COMSIG_MOB_OVERLAY_SHIFT_ON_CLICK "on_click"


/datum/component/mob_overlay_shift
var/dir = NORTH
var/list/shift_data = list()

/datum/component/mob_overlay_shift/Initialize(list/shift_list)
// Define body parts and positions
var/list/body_parts = list("inhand", "belt", "back", "head")
var/list/positions = list("center", "side", "front")
var/list/body_parts = list(MOB_OVERLAY_SHIFT_HAND, MOB_OVERLAY_SHIFT_BELT, MOB_OVERLAY_SHIFT_BACK, MOB_OVERLAY_SHIFT_HEAD)
var/list/positions = list(MOB_OVERLAY_SHIFT_CENTER, MOB_OVERLAY_SHIFT_SIDE, MOB_OVERLAY_SHIFT_FRONT)
// Initialize shifts using the provided shift_data list or default to zero
for(var/body_part in body_parts)
// Create a nested list for each body part if it doesn't exist
Expand All @@ -21,35 +33,36 @@
shift_data[body_part][position] = shift_list[body_part][position] ? shift_list[body_part][position] : list()

// Set default values for x and y shifts if not provided
shift_data[body_part][position]["x"] = shift_list[body_part][position]["x"] ? shift_list[body_part][position]["x"] : 0
shift_data[body_part][position]["y"] = shift_list[body_part][position]["y"] ? shift_list[body_part][position]["y"] : 0
shift_data[body_part][position]["x"] = shift_list[body_part][position]["x"] || 0
shift_data[body_part][position]["y"] = shift_list[body_part][position]["y"] || 0

shift_call(parent)

/datum/component/mob_overlay_shift/RegisterWithParent()
RegisterSignal(parent, COMSIG_ATOM_DIR_CHANGE, PROC_REF(shift_call))
RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(shift_call))
RegisterSignal(parent, COMSIG_MOB_OVERLAY_SHIFT_ON_EQUIP, PROC_REF(shift_call))
RegisterSignal(parent, COMSIG_MOB_OVERLAY_SHIFT_ON_CLICK, PROC_REF(shift_call))

/datum/component/mob_overlay_shift/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_ATOM_DIR_CHANGE, COMSIG_COMPONENT_CLEAN_ACT))

//datum/component/mob_overlay_shift/process()
//shift_call(parent)
/datum/component/mob_overlay_shift/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_ATOM_DIR_CHANGE, COMSIG_COMPONENT_CLEAN_ACT, COMSIG_MOB_OVERLAY_SHIFT_ON_EQUIP, COMSIG_MOB_OVERLAY_SHIFT_ON_CLICK))

/datum/component/mob_overlay_shift/proc/shift_call(mob/living/carbon/human/mob)
if(mob.dir)
dir = mob.dir

var/list/body_parts = list("inhand", "belt", "back", "head")
var/list/body_parts = list(MOB_OVERLAY_SHIFT_HAND, MOB_OVERLAY_SHIFT_BELT, MOB_OVERLAY_SHIFT_BACK, MOB_OVERLAY_SHIFT_HEAD)
var/position
switch(dir)
if(EAST)
position = "side"
position = MOB_OVERLAY_SHIFT_SIDE
if(SOUTH)
position = "front"
position = MOB_OVERLAY_SHIFT_FRONT
if(WEST)
position = "side"
position = MOB_OVERLAY_SHIFT_SIDE
if(NORTH)
position = "front"
position = MOB_OVERLAY_SHIFT_FRONT

var/flip = (dir == WEST || dir == SOUTH) ? -1 : 1

Expand All @@ -60,8 +73,8 @@

var/x_shift_value = shift_data[body_part][position]["x"]
var/y_shift_value = shift_data[body_part][position]["y"]
var/x_central_value = shift_data[body_part]["center"]["x"]
var/y_central_value = shift_data[body_part]["center"]["y"]
var/x_central_value = shift_data[body_part][MOB_OVERLAY_SHIFT_CENTER]["x"]
var/y_central_value = shift_data[body_part][MOB_OVERLAY_SHIFT_CENTER]["y"]

shift_data[body_part][x_shift_key] = flip * x_shift_value + x_central_value
shift_data[body_part][y_shift_key] = flip * y_shift_value + y_central_value
Expand Down Expand Up @@ -118,8 +131,8 @@
standing = mutable_appearance(mob.belt.sprite_sheets[mob.dna.species.sprite_sheet_name], "[t_state]", layer = -overlay_layer)
else
standing = mutable_appearance('icons/mob/clothing/belt.dmi', "[t_state]", layer = -overlay_layer)
standing.pixel_x = shift_data["belt"]["shift_y"]
standing.pixel_y = shift_data["belt"]["shift_y"]
standing.pixel_x = shift_data[MOB_OVERLAY_SHIFT_BELT]["shift_y"]
standing.pixel_y = shift_data[MOB_OVERLAY_SHIFT_BELT]["shift_y"]
mob.overlays_standing[overlay_layer] = standing
mob.apply_overlay(BELT_LAYER)
mob.apply_overlay(SPECIAL_BELT_LAYER)
Expand All @@ -143,8 +156,8 @@
//create the image
standing.alpha = mob.back.alpha
standing.color = mob.back.color
standing.pixel_x = shift_data["back"]["shift_x"]
standing.pixel_y = shift_data["back"]["shift_y"]
standing.pixel_x = shift_data[MOB_OVERLAY_SHIFT_BACK]["shift_x"]
standing.pixel_y = shift_data[MOB_OVERLAY_SHIFT_BACK]["shift_y"]
mob.overlays_standing[BACK_LAYER] = standing
mob.apply_overlay(BACK_LAYER)

Expand All @@ -163,8 +176,8 @@
else
standing = mutable_appearance(mob.r_hand.righthand_file, "[t_state]", layer = -R_HAND_LAYER, color = mob.r_hand.color)
standing = center_image(standing, (mob.r_hand.inhand_x_dimension), (mob.r_hand.inhand_y_dimension))
standing.pixel_x = shift_data["inhand"]["shift_x"]
standing.pixel_y = shift_data["inhand"]["shift_y"]
standing.pixel_x = shift_data[MOB_OVERLAY_SHIFT_HAND]["shift_x"]
standing.pixel_y = shift_data[MOB_OVERLAY_SHIFT_HAND]["shift_y"]
mob.overlays_standing[R_HAND_LAYER] = standing
mob.apply_overlay(R_HAND_LAYER)

Expand All @@ -184,8 +197,8 @@
else
standing = mutable_appearance(mob.l_hand.lefthand_file, "[t_state]", layer = -L_HAND_LAYER, color = mob.l_hand.color)
standing = center_image(standing, mob.l_hand.inhand_x_dimension, mob.l_hand.inhand_y_dimension)
standing.pixel_x = shift_data["inhand"]["shift_x"]
standing.pixel_y = shift_data["inhand"]["shift_y"]
standing.pixel_x = shift_data[MOB_OVERLAY_SHIFT_HAND]["shift_x"]
standing.pixel_y = shift_data[MOB_OVERLAY_SHIFT_HAND]["shift_y"]
mob.overlays_standing[L_HAND_LAYER] = standing
mob.apply_overlay(L_HAND_LAYER)

Expand Down Expand Up @@ -216,8 +229,8 @@
standing.overlays += bloodsies
standing.alpha = mob.head.alpha
standing.color = mob.head.color
standing.pixel_x = shift_data["head"]["shift_x"]
standing.pixel_y = shift_data["head"]["shift_y"]
standing.pixel_x = shift_data[MOB_OVERLAY_SHIFT_HEAD]["shift_x"]
standing.pixel_y = shift_data[MOB_OVERLAY_SHIFT_HEAD]["shift_y"]
mob.overlays_standing[HEAD_LAYER] = standing
mob.apply_overlay(HEAD_LAYER)

Expand All @@ -233,7 +246,7 @@

if(mob.glasses)
var/mutable_appearance/new_glasses
var/obj/item/organ/external/head/head_organ = mob.get_organ("head")
var/obj/item/organ/external/head/head_organ = mob.get_organ(MOB_OVERLAY_SHIFT_HEAD)
mob.update_hud_glasses(mob.glasses)

if(mob.glasses.icon_override)
Expand All @@ -243,8 +256,8 @@
else
new_glasses = mutable_appearance('icons/mob/clothing/eyes.dmi', "[mob.glasses.icon_state]", layer = -GLASSES_LAYER)

new_glasses.pixel_x = shift_data["head"]["shift_x"]
new_glasses.pixel_y = shift_data["head"]["shift_y"]
new_glasses.pixel_x = shift_data[MOB_OVERLAY_SHIFT_HEAD]["shift_x"]
new_glasses.pixel_y = shift_data[MOB_OVERLAY_SHIFT_HEAD]["shift_y"]

var/datum/sprite_accessory/hair/hair_style = GLOB.hair_styles_full_list[head_organ.h_style]
var/obj/item/clothing/glasses/G = mob.glasses
Expand Down Expand Up @@ -286,8 +299,8 @@
left_ear_icon = mob.l_ear.icon_override

var/mutable_appearance/standing = mutable_appearance(left_ear_icon, left_ear_item_state, layer = -LEFT_EAR_LAYER)
standing.pixel_x = shift_data["head"]["shift_x"]
standing.pixel_y = shift_data["head"]["shift_y"]
standing.pixel_x = shift_data[MOB_OVERLAY_SHIFT_HEAD]["shift_x"]
standing.pixel_y = shift_data[MOB_OVERLAY_SHIFT_HEAD]["shift_y"]
mob.overlays_standing[LEFT_EAR_LAYER] = standing

if(mob.r_ear)
Expand All @@ -302,21 +315,23 @@
right_ear_icon = mob.r_ear.icon_override

var/mutable_appearance/standing = mutable_appearance(right_ear_icon, right_ear_item_state, layer = -RIGHT_EAR_LAYER)
standing.pixel_x = shift_data["head"]["shift_x"]
standing.pixel_y = shift_data["head"]["shift_y"]
standing.pixel_x = shift_data[MOB_OVERLAY_SHIFT_HEAD]["shift_x"]
standing.pixel_y = shift_data[MOB_OVERLAY_SHIFT_HEAD]["shift_y"]
mob.overlays_standing[RIGHT_EAR_LAYER] = standing

mob.apply_overlay(LEFT_EAR_LAYER)
mob.apply_overlay(RIGHT_EAR_LAYER)

/mob/equip_to_slot(obj/item/W, slot, initial = FALSE)
. = .. ()
SEND_SIGNAL(src, COMSIG_ATOM_DIR_CHANGE)
SEND_SIGNAL(src, COMSIG_MOB_OVERLAY_SHIFT_ON_EQUIP)

//Вызов сигнала при повоторе через ctrl+wasd
/mob/facedir(ndir)
. = .. ()
SEND_SIGNAL(src, COMSIG_ATOM_DIR_CHANGE)

//Вызов сигнала при повороте через ЛКМы
/mob/ClickOn(atom/A, params)
. = .. ()
SEND_SIGNAL(src, COMSIG_ATOM_DIR_CHANGE)
SEND_SIGNAL(src, COMSIG_MOB_OVERLAY_SHIFT_ON_CLICK)
7 changes: 6 additions & 1 deletion modular_ss220/species/_components/attacking/double_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

/datum/component/double_attack
var/state_attack = FALSE
var/attack_CD = 0

/datum/component/double_attack/Initialize(attack_CD_OVR = 0)
attack_CD = attack_CD_OVR

/datum/component/double_attack/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOB_ITEM_ATTACK, PROC_REF(hand_pre_attack))
Expand All @@ -19,7 +23,8 @@
var/hand_item = user.get_active_hand()
if(hand_item && !state_attack)
state_attack = TRUE
addtimer(CALLBACK(src, PROC_REF(hand_attack), target, user, def_zone, hand_item), (user.next_move_modifier / 5) SECONDS)
var/attack_haste = attack_CD ? attack_CD : user.next_move_modifier / 5
addtimer(CALLBACK(src, PROC_REF(hand_attack), target, user, def_zone, hand_item), attack_haste SECONDS)

/datum/component/double_attack/proc/hand_attack(mob/living/target, mob/living/user, def_zone, obj/item/hand_item)
if(QDELETED(src) || QDELETED(target) || user != hand_item.loc || !user.Adjacent(target))
Expand Down
12 changes: 10 additions & 2 deletions modular_ss220/species/_components/attacking/pair_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Срабатывает только, если оружие одинаковое.
*/

#define PAIRATTACK_RECOIL_MULT 2.5

#define COMSIG_ITEM_ATTACK_PROCESS "offhand_pre_attack"
#define COMSIG_PAIRATTACK_SYNC "sync_states"
#define COMSIG_PAIRATTACK_CHECK "check_state"
Expand All @@ -13,6 +15,10 @@
/datum/component/pair_attack
var/obj/item/offhand_item = null
var/state_attack = FALSE
var/attack_CD = 0

/datum/component/pair_attack/Initialize(attack_CD_OVR = 0)
attack_CD = attack_CD_OVR

/datum/component/pair_attack/RegisterWithParent()
RegisterSignal(parent, COMSIG_ITEM_ATTACK_PROCESS, PROC_REF(offhand_pre_attack))
Expand Down Expand Up @@ -44,8 +50,10 @@
state_attack = TRUE
SEND_SIGNAL(offhand_item, COMSIG_PAIRATTACK_SYNC, state_attack)
if(offhand_item)
addtimer(CALLBACK(src, PROC_REF(offhand_attack), target, user, def_zone), (user.next_move_modifier / 5) SECONDS)
addtimer(CALLBACK(src, PROC_REF(offhand_post_attack)), (user.next_move_modifier / 2) SECONDS)
var/attack_haste = attack_CD ? attack_CD : user.next_move_modifier / 5
var/attack_recoil = attack_haste * PAIRATTACK_RECOIL_MULT
addtimer(CALLBACK(src, PROC_REF(offhand_attack), target, user, def_zone), attack_haste SECONDS)
addtimer(CALLBACK(src, PROC_REF(offhand_post_attack)), attack_recoil SECONDS)

/datum/component/pair_attack/proc/offhand_attack(mob/living/target, mob/living/user, def_zone)
if(QDELETED(src) || QDELETED(target) || user != offhand_item.loc || !user.Adjacent(target))
Expand Down
15 changes: 7 additions & 8 deletions modular_ss220/species/_components/carapace/carapace.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
#define COMSIG_LIMB_HEAL_DAMAGE "heal_damage"

/datum/component/carapace
var/self_medning = FALSE
var/self_mending = FALSE
var/broken_treshold = CARAPACE_BROKEN_STATE

/datum/component/carapace/Initialize(allow_self_medning, break_threshold, control_node = FALSE)
self_medning = allow_self_medning
/datum/component/carapace/Initialize(allow_self_mending, break_threshold, control_node = FALSE)
src.self_mending = allow_self_mending
broken_treshold = break_threshold
var/obj/item/organ/external/affected_limb = parent
affected_limb.encased = CARAPACE_ENCASE_WORD
Expand All @@ -49,25 +49,23 @@
/datum/component/carapace/proc/receive_damage(obj/item/organ/external/affected_limb, brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list(), ignore_resists = FALSE, updating_health = TRUE)
if(affected_limb.get_damage() > broken_treshold)
affected_limb.fracture()
if(length(affected_limb.internal_organs) > 0)
if(length(affected_limb.internal_organs))
var/obj/item/organ/internal/O = pick(affected_limb.internal_organs)
O.receive_damage(burn * affected_limb.burn_dam)

/datum/component/carapace/proc/heal_damage(obj/item/organ/external/affected_limb, brute, burn, internal = 0, robo_repair = 0, updating_health = TRUE)
if((affected_limb.status & ORGAN_BROKEN) && affected_limb.get_damage() == 0)
if(self_medning || prob(CARAPACE_HEAL_BROKEN_PROB))
if(self_mending || prob(CARAPACE_HEAL_BROKEN_PROB))
affected_limb.mend_fracture()

//Расширение проков урона и лечения для обращения к компоненту
/obj/item/organ/external/receive_damage(brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list(), ignore_resists = FALSE, updating_health = TRUE)
. = ..()
SEND_SIGNAL(src, COMSIG_LIMB_RECIEVE_DAMAGE, brute, burn, sharp, used_weapon, forbidden_limbs, ignore_resists, updating_health)
return

/obj/item/organ/external/heal_damage(brute, burn, internal = 0, robo_repair = 0, updating_health = TRUE)
. = ..()
SEND_SIGNAL(src, COMSIG_LIMB_HEAL_DAMAGE, brute, burn, internal, robo_repair, updating_health)
return

//////////////////////////////////////////////////////////////////
// Хирургия для панциря //
Expand Down Expand Up @@ -106,6 +104,7 @@
requires_organic_bodypart = TRUE

//Оверрайды для операций, которые могут применяться для панциря.
//Возможный рефактор - отослать сигнал в компоненнт с параметрами "операция, зона операции" и вернуть значение оттуда?
/datum/surgery/can_start(mob/user, mob/living/carbon/target)
var/obj/item/organ/external/affected = target.get_organ(user.zone_selected)
if(affected?.encased == CARAPACE_ENCASE_WORD)
Expand Down Expand Up @@ -145,7 +144,7 @@
/datum/surgery_step/generic/cut_open/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if((affected?.encased == CARAPACE_ENCASE_WORD) && !(affected.status & ORGAN_BROKEN))
user.visible_message("<span class='notice'>Эта конечность [target] покрыта крепким хитином. Сломайте его, прежде чем начать операцию .</span>")
to_chat(user, span_notice("Эта конечность [target] покрыта крепким хитином. Сломайте его, прежде чем начать операцию."))
return SURGERY_BEGINSTEP_ABORT
. = .. ()

Expand Down
Loading

0 comments on commit 00cdc58

Please sign in to comment.