Skip to content

Commit

Permalink
Dae review
Browse files Browse the repository at this point in the history
  • Loading branch information
Samirakis committed Nov 2, 2024
1 parent e992a00 commit 535e7cf
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 35 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,9 @@
#define COMSIG_MINE_TRIGGERED "minegoboom"
///from [/obj/item/organ/internal/remove]:
#define COMSIG_ORGAN_REMOVED "organ_removed"
///from [/obj/item/organ/internal/cyberimp/mouth/translator/check_lang]
#define COMSIG_CHECK_LANG_IN_TRANSLATOR "check_language"
#define COMSIG_LANG_STORED (1<<0)

/// Defib-specific signals

Expand Down
12 changes: 11 additions & 1 deletion code/datums/diseases/viruses/babylon_fever.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,20 @@

stored_languages = LAZYCOPY(affected_mob.languages)

for(var/datum/language/lan as anything in affected_mob.languages)
var/obj/item/organ/internal/cyberimp/mouth/translator/translator = affected_mob.get_organ_slot(INTERNAL_ORGAN_SPEECH_TRANSLATOR)
if(translator?.given_languages)
stored_languages ^= translator.given_languages // you can't forget it, because it's on the chip in translator

for(var/datum/language/lan as anything in stored_languages)
affected_mob.remove_language(lan.name)


/datum/disease/virus/babylonian_fever/proc/store_language(datum/signal_source, language_name)
SIGNAL_HANDLER

if(SEND_SIGNAL(signal_source, COMSIG_CHECK_LANG_IN_TRANSLATOR, language_name) & COMSIG_LANG_STORED)
return DISEASE_MOB_LANGUAGE_PROCESSED

var/datum/language/new_language = GLOB.all_languages[language_name]
LAZYOR(stored_languages, new_language)
return DISEASE_MOB_LANGUAGE_PROCESSED
Expand All @@ -97,6 +104,9 @@
/datum/disease/virus/babylonian_fever/proc/remove_language(datum/signal_source, language_name)
SIGNAL_HANDLER

if(SEND_SIGNAL(signal_source, COMSIG_CHECK_LANG_IN_TRANSLATOR, language_name) & COMSIG_LANG_STORED)
return DISEASE_MOB_LANGUAGE_PROCESSED

var/datum/language/rem_language = GLOB.all_languages[language_name]
LAZYREMOVE(stored_languages, rem_language)
return DISEASE_MOB_LANGUAGE_PROCESSED
3 changes: 2 additions & 1 deletion code/modules/mob/living/carbon/human/species/grey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@
retranslator.insert(H)

var/translator_pref = H.client.prefs.speciesprefs
var/command_roles = FALSE

if(!HAS_TRAIT(H, TRAIT_WINGDINGS))
return handle_loadout_chip(H, retranslator)

var/command_roles = FALSE

if(ismindshielded(H) || J.is_command || J.supervisors == "the captain")
command_roles = TRUE

Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/reagents/toxins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@
if(!istype(H))
return FALSE // skip check

if(TRAIT_ACID_PROTECTED in H.dna?.species.inherent_traits)
if(HAS_TRAIT(H, TRAIT_ACID_PROTECTED))
return TRUE // acid proof species

return FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/organs/augments_eyes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

to_chat(owner, span_warning("Static obfuscates your vision!"))

if(TRAIT_ADVANCED_CYBERIMPLANTS in owner.dna?.species.inherent_traits)
if(HAS_TRAIT(owner, TRAIT_ADVANCED_CYBERIMPLANTS))
owner.EyeBlurry(1.5 SECONDS)
else
owner.flash_eyes(3, visual = TRUE)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/surgery/organs/augments_internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,13 @@


/obj/item/organ/internal/cyberimp/chest/nutriment/plus/insert(mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT)
if(TRAIT_ADVANCED_CYBERIMPLANTS in target.dna?.species.inherent_traits)
if(HAS_TRAIT(target, TRAIT_ADVANCED_CYBERIMPLANTS))
hunger_modificator = 0.2
. = ..()


/obj/item/organ/internal/cyberimp/chest/nutriment/plus/remove(mob/living/carbon/human/target, special = ORGAN_MANIPULATION_DEFAULT)
if(TRAIT_ADVANCED_CYBERIMPLANTS in target.dna?.species.inherent_traits)
if(HAS_TRAIT(target, TRAIT_ADVANCED_CYBERIMPLANTS))
hunger_modificator = initial(hunger_modificator)
. = ..()

Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/organs/ears.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
var/mob/living/carbon/C = owner
var/losstime = 120 SECONDS

if(TRAIT_ADVANCED_CYBERIMPLANTS in C.dna?.species.inherent_traits)
if(HAS_TRAIT(C, TRAIT_ADVANCED_CYBERIMPLANTS))
losstime /= 3

C.AdjustDeaf(losstime)
6 changes: 3 additions & 3 deletions code/modules/surgery/organs/heart.dm
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@
/obj/item/organ/internal/heart/cybernetic/upgraded/insert(mob/living/carbon/target, special)
. = ..()

if(TRAIT_ADVANCED_CYBERIMPLANTS in target.dna?.species.inherent_traits)
if(HAS_TRAIT(target, TRAIT_ADVANCED_CYBERIMPLANTS))
target.stam_regen_start_modifier *= 0.5


/obj/item/organ/internal/heart/cybernetic/upgraded/remove(mob/living/carbon/human/target, special)
if(TRAIT_ADVANCED_CYBERIMPLANTS in target.dna?.species.inherent_traits)
if(HAS_TRAIT(target, TRAIT_ADVANCED_CYBERIMPLANTS))
target.stam_regen_start_modifier /= 0.5

. = ..()
Expand Down Expand Up @@ -274,7 +274,7 @@
if(emp_proof)
return

if(TRAIT_ADVANCED_CYBERIMPLANTS in owner.dna?.species.inherent_traits)
if(HAS_TRAIT(owner, TRAIT_ADVANCED_CYBERIMPLANTS))
Stop()
else
necrotize()
Expand Down
6 changes: 3 additions & 3 deletions code/modules/surgery/organs/lungs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

if(owner)
var/losstime = 40 SECONDS
if(TRAIT_ADVANCED_CYBERIMPLANTS in owner.dna?.species.inherent_traits)
if(HAS_TRAIT(owner, TRAIT_ADVANCED_CYBERIMPLANTS))
losstime /= 2

owner.LoseBreath(losstime)
Expand Down Expand Up @@ -396,11 +396,11 @@
/obj/item/organ/internal/lungs/cybernetic/upgraded/insert(mob/living/carbon/human/target, special)
. = ..()

if(TRAIT_ADVANCED_CYBERIMPLANTS in target.dna?.species.inherent_traits)
if(HAS_TRAIT(target, TRAIT_ADVANCED_CYBERIMPLANTS))
target.physiology.oxy_mod -= 0.5

/obj/item/organ/internal/lungs/cybernetic/upgraded/remove(mob/living/carbon/human/target, special)
if(TRAIT_ADVANCED_CYBERIMPLANTS in target.dna?.species.inherent_traits)
if(HAS_TRAIT(target, TRAIT_ADVANCED_CYBERIMPLANTS))
target.physiology.oxy_mod += 0.5

. = ..()
11 changes: 6 additions & 5 deletions code/modules/surgery/organs/organ_internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
/// Whether it shows up as an option to remove during surgery.
var/unremovable = FALSE
var/can_see_food = FALSE
var/list/whitelisted_species // empty list == all species alowed
/// Empty list == all species allowed
var/list/species_restrictions
light_system = MOVABLE_LIGHT
light_on = FALSE

Expand All @@ -26,13 +27,13 @@
// target = the carbon we're testing for suitability
// fail_message = message that user will recieve if the checks failed. FALSE make it quiet even with "user"
/obj/item/organ/internal/proc/can_insert(mob/living/user, mob/living/carbon/target, fail_message = "Данное существо не способно принять этот орган!")
if(!LAZYLEN(whitelisted_species))
if(!LAZYLEN(species_restrictions))
return TRUE

if(!istype(target)) // only carbons have species
return TRUE
if(!istype(target) && !target.dna?.species) // only carbons have species
return FALSE

if(target.dna.species.name in whitelisted_species)
if(target.dna.species.name in species_restrictions)
return TRUE

if(user && fail_message)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/organs/subtypes/wryn.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
icon_state = "antennae"
parent_organ_zone = BODY_ZONE_HEAD
slot = INTERNAL_ORGAN_HIVENODE
whitelisted_species = list(SPECIES_WRYN)
species_restrictions = list(SPECIES_WRYN)

/obj/item/organ/internal/wryn/hivenode/insert(mob/living/carbon/human/M, special = ORGAN_MANIPULATION_DEFAULT)
..()
Expand Down
71 changes: 55 additions & 16 deletions code/modules/surgery/organs/voice_translator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
slot = INTERNAL_ORGAN_SPEECH_TRANSLATOR
w_class = WEIGHT_CLASS_TINY
/// List of languages, stored in this translator
var/list/given_languages
var/list/datum/language/given_languages
/// Russian list of languages, stored in this translator
var/list/given_languages_rus
/// What types of translator storage upgrades can be attached to this translator. Empty = nothing
Expand Down Expand Up @@ -46,11 +46,10 @@
desc = "Необычный инопланетный имплант с маленьким экранчиком. Судя по всему, создан специально для греев."
icon = 'icons/obj/voice_translator.dmi'
icon_state = "pvr_implant"
given_languages = list(LANGUAGE_GALACTIC_COMMON)
given_languages_rus = list("Общегалактический")
given_languages = list()
upgrade_with = list(/obj/item/translator_upgrade/grey_retraslator)
origin_tech = "materials=2;biotech=3;engineering=3;programming=3;abductor=2"
whitelisted_species = list(SPECIES_GREY, SPECIES_ABDUCTOR)
species_restrictions = list(SPECIES_GREY, SPECIES_ABDUCTOR)
ru_names = list(
NOMINATIVE = "ретранслятор псионического голоса",
GENITIVE = "ретранслятора псионического голоса",
Expand All @@ -61,6 +60,26 @@
)


/obj/item/organ/internal/cyberimp/mouth/translator/New()
if(!..())
return

if(!LAZYLEN(given_languages))
return

for(var/lang_name in given_languages)
LAZYADD(given_languages, GLOB.all_languages[lang_name])

return TRUE


/obj/item/organ/internal/cyberimp/mouth/translator/grey_retraslator/New()
LAZYADD(given_languages, GLOB.all_languages[LANGUAGE_GALACTIC_COMMON]) // basic galcom for greys
LAZYADD(given_languages_rus, "Общегалактический")

. = ..()


/obj/item/organ/internal/cyberimp/mouth/translator/examine(mob/user)
. = ..()
if(!Adjacent(user)) // Too far!
Expand Down Expand Up @@ -88,20 +107,32 @@
/obj/item/organ/internal/cyberimp/mouth/translator/insert(mob/living/carbon/target, special)
. = ..()

for(var/lang in given_languages)
target.add_language(lang)
RegisterSignal(target, COMSIG_CHECK_LANG_IN_TRANSLATOR, PROC_REF(check_language))

for(var/datum/language/lang as anything in given_languages)
target.add_language(lang.name)


/obj/item/organ/internal/cyberimp/mouth/translator/remove(mob/living/carbon/target, special)
if(!istype(target))
return

for(var/lang in given_languages)
target.remove_language(lang)
UnregisterSignal(target, COMSIG_CHECK_LANG_IN_TRANSLATOR)

for(var/datum/language/lang as anything in given_languages)
target.remove_language(lang.name)

. = ..()


/obj/item/organ/internal/cyberimp/mouth/translator/proc/check_language(mob/living/carbon/C, language_name)
SIGNAL_HANDLER

for(var/datum/language/lang as anything in given_languages)
if(language_name == lang.name)
return COMSIG_LANG_STORED


/obj/item/organ/internal/cyberimp/mouth/translator/update_desc(updates)
. = ..()

Expand Down Expand Up @@ -176,7 +207,7 @@
return FALSE

if(owner && chip.stored_language) //if translator inside someone
owner.remove_language(chip.stored_language)
owner.remove_language(chip.stored_language.name)

user.put_in_hands(chip)
LAZYREMOVE(stored_chips, chip)
Expand Down Expand Up @@ -223,7 +254,7 @@
handle_wingdings_chip(chip)

if(owner && chip.stored_language)
owner.add_language(chip.stored_language)
owner.add_language(chip.stored_language.name)


/obj/item/organ/internal/cyberimp/mouth/translator/proc/handle_wingdings_chip(obj/item/translator_chip/chip)
Expand Down Expand Up @@ -310,8 +341,8 @@
return

to_chat(owner, span_notice("<font color=green>[capitalize(declent_ru(NOMINATIVE))] снова работает!</font>"))
for(var/lang in given_languages)
owner.add_language(lang)
for(var/datum/language/lang as anything in given_languages)
owner.add_language(lang.name)

decoder.update_button_state()

Expand All @@ -321,8 +352,8 @@
can_wingdings = FALSE
to_chat(owner, span_warning("[capitalize(declent_ru(NOMINATIVE))] временно вышел из строя от воздействия ЭМИ!"))
do_sparks(3, FALSE, owner)
for(var/lang in given_languages)
owner.remove_language(lang)
for(var/datum/language/lang as anything in given_languages)
owner.remove_language(lang.name)

decoder.update_button_state()

Expand Down Expand Up @@ -433,7 +464,7 @@
icon_state = "chip_empty"
w_class = WEIGHT_CLASS_TINY
origin_tech = "materials=1;programming=2"
var/stored_language
var/datum/language/stored_language
var/stored_language_rus
var/wingdings_decoder = FALSE
ru_names = list(
Expand All @@ -446,6 +477,12 @@
)


/obj/item/translator_chip/New()
. = ..()
if(stored_language)
stored_language = GLOB.all_languages[stored_language]


/obj/item/translator_chip/attack_self(mob/living/user)
if(stored_language_rus)
return
Expand All @@ -462,7 +499,9 @@


/obj/item/translator_chip/proc/update_chip(obj/item/translator_chip/chip)
stored_language = chip.stored_language
if(chip.stored_language)
stored_language = GLOB.all_languages[chip.stored_language]

stored_language_rus = chip.stored_language_rus
wingdings_decoder = chip.wingdings_decoder
update_icon(UPDATE_ICON_STATE)
Expand Down

0 comments on commit 535e7cf

Please sign in to comment.