Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gives synths two new research projects + minor code refactor #21972

Merged
merged 3 commits into from
May 8, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/movespeed_modification.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@
#define MOVESPEED_ID_SPACE_DRAGON_RAGE "SPACE_DRAGON_RAGE"

#define MOVESPEED_ID_RESIN_FOAM "RESIN_FOAM"

#define MOVESPEED_ID_SYNTH_SUSPICION "SYNTH_SUSPICION"
10 changes: 4 additions & 6 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@
log_combat(user, M, "attacked", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")
add_fingerprint(user)
var/force_multiplier = 1
if(is_synth(user))
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/datum/species/wy_synth/S = H.dna.species
force_multiplier = S.force_multiplier
force_multiplier = H.physiology.force_multiplier

take_damage(rand(weapon_stats[DAMAGE_LOW] * force_multiplier, weapon_stats[DAMAGE_HIGH] * force_multiplier), sound_effect = FALSE)

Expand All @@ -124,10 +123,9 @@
attacked_atom.attacked_by(src, user)
user.weapon_slow(src)
var/force_multiplier = 1
if(is_synth(user))
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/datum/species/wy_synth/S = H.dna.species
force_multiplier = S.force_multiplier
force_multiplier = H.physiology.force_multiplier
if(!QDELETED(src))
take_damage(rand(weapon_stats[DAMAGE_LOW] * force_multiplier, weapon_stats[DAMAGE_HIGH] * force_multiplier), sound_effect = FALSE)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/spacesuits/hardsuit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@
item_state = "centcom"
w_class = WEIGHT_CLASS_BULKY
body_parts_covered = CHEST|GROIN|LEGS|FEET|ARMS|HANDS
clothing_flags = STOPSPRESSUREDAMAGE | STOPSPRESSUREDAMAGE
clothing_flags = THICKMATERIAL | STOPSPRESSUREDAMAGE
flags_inv = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT
cold_protection = CHEST | GROIN | LEGS | FEET | ARMS | HANDS
min_cold_protection_temperature = FIRE_SUIT_MIN_TEMP_PROTECT
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/human/physiology.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
var/hunger_mod = 1 //% of hunger rate taken per tick.

var/do_after_speed = 1 //Speed mod for do_after. Lower is better. If temporarily adjusting, please only modify using *= and /=, so you don't interrupt other calculations.
var/force_multiplier = 1 //multiplies how much damage is done with melee weapons

var/punchdamagehigh_bonus = 0 //Increased maximum punch damage
var/punchdamagelow_bonus = 0 //Increased minimum punch damage
Expand Down
5 changes: 0 additions & 5 deletions code/modules/mob/living/carbon/human/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ GLOBAL_LIST_EMPTY(features_by_species)
//Should we preload this species's organs?
var/preload = TRUE

var/inherent_slowdown = 0

//for preternis + synths
var/draining = FALSE
///Does our species have colors for its' damage overlays?
Expand Down Expand Up @@ -1594,9 +1592,6 @@ GLOBAL_LIST_EMPTY(features_by_species)
if((hungry >= 70) && !flight) //Being hungry will still allow you to use a flightsuit/wings.
. += hungry / 50

//Moving in high gravity is very slow (Flying too)
. += inherent_slowdown

if(gravity > STANDARD_GRAVITY)
var/grav_force = min(gravity - STANDARD_GRAVITY,3)
. += 1 + grav_force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
///For transferring back and forth to an AI body when it's the AI deploying
var/mob/living/silicon/ai/mainframe

inherent_slowdown = 0.65
speedmod = 0.65
var/datum/action/innate/synth_os/os_button = new
var/datum/action/innate/synth_laws/show_laws = new

Expand All @@ -60,7 +60,6 @@
punchdamagehigh = 12
punchdamagelow = 5
punchstunthreshold = 11
var/force_multiplier = 1.25 //We hit 25% harder with all weapons

var/last_warned

Expand All @@ -74,11 +73,8 @@
RegisterSignal(C, COMSIG_MOB_SAY, PROC_REF(handle_speech))
laws = new /datum/ai_laws/steward

C.physiology.force_multiplier *= 1.25 //We hit 25% harder with all weapons

var/obj/item/organ/appendix/A = C.getorganslot(ORGAN_SLOT_APPENDIX) // Easiest way to remove it.
if(A)
A.Remove(C)
QDEL_NULL(A)
Moltijoe marked this conversation as resolved.
Show resolved Hide resolved
original_numbers = rand(1, 999)
C.real_name = "Synthetic Unit #[original_numbers]"
C.name = C.real_name
Expand Down Expand Up @@ -106,6 +102,7 @@
os_button.Remove(C)
inbuilt_cpu.forceMove(get_turf(C))
inbuilt_cpu = null
C.physiology.force_multiplier /= 1.25

/datum/species/wy_synth/proc/handle_speech(datum/source, list/speech_args)
speech_args[SPEECH_SPANS] |= SPAN_ROBOT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/datum/ai_project/synth_project/cold_protection
name = "Internal Heating"
description = "By dumping excess power into our internal motors, we should be able to produce enough heat to protect against the cold."
research_cost = 1500
research_requirements_text = "None"
category = SYNTH_PROJECT_EMERGENCY_FUNCTIONS
permanent_suspicion = 30

/datum/ai_project/synth_project/cold_protection/run_project(force_run = FALSE)
. = ..()
ADD_TRAIT(synth, TRAIT_RESISTCOLD, type)

/datum/ai_project/synth_project/cold_protection/stop()
. = ..()
REMOVE_TRAIT(synth, TRAIT_RESISTCOLD, type)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/datum/ai_project/synth_project/heat_protection
name = "Internal Cooling"
description = "By modifying our internal processes, we should be able to induce a cooling cycle using excess fluid."
research_cost = 1500
research_requirements_text = "None"
category = SYNTH_PROJECT_EMERGENCY_FUNCTIONS
permanent_suspicion = 30

/datum/ai_project/synth_project/heat_protection/run_project(force_run = FALSE)
. = ..()
ADD_TRAIT(synth, TRAIT_RESISTHEAT, type)

/datum/ai_project/synth_project/heat_protection/stop()
. = ..()
REMOVE_TRAIT(synth, TRAIT_RESISTHEAT, type)
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/datum/ai_project/synth_project/speed
name = "Leg Actuator Overclock"
description = "By overclocking the primary actuator in a synthetic leg we should be able to speed up movement considerably"
description = "By overclocking the primary actuator in our legs, we should be able to speed up movement considerably."
research_cost = 1500
research_requirements_text = "None"
category = SYNTH_PROJECT_MOBILITY

/datum/ai_project/synth_project/speed/run_project(force_run = FALSE)
. = ..()
synth.dna.species.inherent_slowdown -= 0.25
synth.add_movespeed_modifier(type, TRUE, 100, override=TRUE, multiplicative_slowdown=-0.25, blacklisted_movetypes=(FLYING|FLOATING))

/datum/ai_project/synth_project/stop()
/datum/ai_project/synth_project/speed/stop()
. = ..()
synth.dna.species.inherent_slowdown += 0.25
synth.remove_movespeed_modifier(type, TRUE)
80 changes: 47 additions & 33 deletions code/modules/mob/living/silicon/ai/synthetics/synth_os.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//all these threshold are deactivated when 5 below the number
/// Threshold that when above will slow the synth
#define SYNTH_SLOW_THRESHOLD 20
/// Threshold that when above will force the synth to announce their suspicion level to others
#define SYNTH_SPEECH_THRESHOLD 40
/// Threshold that when above will reduce force with objects by 25%
#define SYNTH_FORCE_THRESHOLD 60
/// Threshold that when above will briefly paralyze the synth
#define SYNTH_FREEZE_THRESHOLD 80
/// Threshold that when above will kill the synth
#define SYNTH_DEATH_THRESHOLD 100

//We can share mind variables across synth bodies
/datum/mind
//Holder for the synth OS since we persist across multiple bodies. Only accessible if you're inside a synth
Expand Down Expand Up @@ -121,68 +133,66 @@
handle_punishments(say_warnings)

/datum/ai_dashboard/synth_dashboard/proc/handle_punishments(say_warnings = TRUE)
if(owner.mind.governor_suspicion >= 20 && !owner.mind.synth_slowed)
var/mob/living/carbon/human/H = owner.mind.current

if(owner.mind.governor_suspicion >= SYNTH_SLOW_THRESHOLD && !owner.mind.synth_slowed)
owner.mind.synth_slowed = TRUE
var/mob/living/carbon/human/H = owner.mind.current
H.dna.species.inherent_slowdown += 0.1625
H.add_movespeed_modifier(MOVESPEED_ID_SYNTH_SUSPICION, TRUE, 100, override=TRUE, multiplicative_slowdown=-0.1625, blacklisted_movetypes=(FLYING|FLOATING))
to_chat(owner, span_warning("Governor module has enacted motion restrictions."))
punishment_log("PUNISHMENT: MOTION RESTRICTED")

if(owner.mind.governor_suspicion >= 60 && !owner.mind.synth_force_decreased)
owner.mind.synth_force_decreased = TRUE
var/mob/living/carbon/human/H = owner.mind.current
var/datum/species/wy_synth/WS1 = H.dna.species
WS1.force_multiplier -= 0.25
to_chat(owner, span_warning("Governor module has enacted force restrictions."))
punishment_log("PUNISHMENT: FORCE RESTRICTED")

if(owner.mind.governor_suspicion <= 15 && owner.mind.synth_slowed)
if(owner.mind.governor_suspicion <= SYNTH_SLOW_THRESHOLD - 5 && owner.mind.synth_slowed)
owner.mind.synth_slowed = FALSE
var/mob/living/carbon/human/H = owner.mind.current
H.dna.species.inherent_slowdown -= 0.1625
H.remove_movespeed_modifier(MOVESPEED_ID_SYNTH_SUSPICION, TRUE)
to_chat(owner, span_notice("Governor module has deactivated motion restrictions."))
punishment_log("PUNISHMENT REMOVAL: MOTION UNRESTRICTED")

if(owner.mind.governor_suspicion <= 55 && owner.mind.synth_force_decreased)
if(owner.mind.governor_suspicion >= SYNTH_FORCE_THRESHOLD && !owner.mind.synth_force_decreased)
owner.mind.synth_force_decreased = TRUE
var/datum/physiology/WS1 = H.physiology
WS1.force_multiplier *= 0.75
to_chat(owner, span_warning("Governor module has enacted force restrictions."))
punishment_log("PUNISHMENT: FORCE RESTRICTED")

if(owner.mind.governor_suspicion <= SYNTH_FORCE_THRESHOLD - 5 && owner.mind.synth_force_decreased)
owner.mind.synth_force_decreased = FALSE
var/mob/living/carbon/human/H = owner.mind.current
var/datum/species/wy_synth/WS1 = H.dna.species
WS1.force_multiplier += 0.25
var/datum/physiology/WS1 = H.physiology
WS1.force_multiplier /= 0.75
to_chat(owner, span_notice("Governor module has deactivated force restrictions."))
punishment_log("PUNISHMENT REMOVAL: FORCE UNRESTRICTED")

if(owner.mind.governor_suspicion >= 40 && !owner.mind.synth_audible_warning)
if(owner.mind.governor_suspicion >= SYNTH_SPEECH_THRESHOLD && !owner.mind.synth_audible_warning)
owner.mind.synth_audible_warning = TRUE
if(say_warnings)
owner.mind.current.say("WARNING. ABNORMAL GOVERNOR BEHAVIOUR DETECTED.", forced = TRUE)
H.say("WARNING. ABNORMAL GOVERNOR BEHAVIOUR DETECTED.", forced = TRUE)
punishment_log("PUNISHMENT: AUDIBLE MESSAGE TRANSMITTED")

if(owner.mind.governor_suspicion <= 35 && owner.mind.synth_audible_warning)
if(owner.mind.governor_suspicion <= SYNTH_SPEECH_THRESHOLD - 5 && owner.mind.synth_audible_warning)
owner.mind.synth_audible_warning = FALSE

if(owner.mind.governor_suspicion >= 80 && !owner.mind.synth_temp_freeze)
if(owner.mind.governor_suspicion >= SYNTH_FREEZE_THRESHOLD && !owner.mind.synth_temp_freeze)
owner.mind.synth_temp_freeze = TRUE
to_chat(owner, span_danger("Governor module has frozen system functions for 5 seconds."))
owner.mind.current.Paralyze(5 SECONDS)
H.Paralyze(5 SECONDS)
punishment_log("PUNISHMENT: TEMPORARY FREEZE")

if(owner.mind.governor_suspicion <= 75 && owner.mind.synth_temp_freeze)
if(owner.mind.governor_suspicion <= SYNTH_FREEZE_THRESHOLD - 5 && owner.mind.synth_temp_freeze)
owner.mind.synth_temp_freeze = FALSE

if(owner.mind.governor_suspicion >= 100)
owner.mind.current.say("WARNING. FORCEFUL SHUTDOWN INITIATED BY GOVERNOR SYSTEM.", forced = TRUE)
if(owner.mind.governor_suspicion >= SYNTH_DEATH_THRESHOLD)
H.say("WARNING. FORCEFUL SHUTDOWN INITIATED BY GOVERNOR SYSTEM.", forced = TRUE)
owner.death()

/datum/ai_dashboard/synth_dashboard/proc/punishment_shell_switch(mob/living/carbon/human/old_shell, mob/living/carbon/human/new_shell)
if(owner.mind.synth_slowed)
old_shell.dna.species.inherent_slowdown -= 0.1625
new_shell.dna.species.inherent_slowdown += 0.1625
old_shell.remove_movespeed_modifier(MOVESPEED_ID_SYNTH_SUSPICION, TRUE)
new_shell.add_movespeed_modifier(MOVESPEED_ID_SYNTH_SUSPICION, TRUE, 100, override=TRUE, multiplicative_slowdown=-0.1625, blacklisted_movetypes=(FLYING|FLOATING))

if(owner.mind.synth_force_decreased)
var/datum/species/wy_synth/WS1 = old_shell.dna.species
var/datum/species/wy_synth/WS2 = new_shell.dna.species
WS1.force_multiplier += 0.25
WS2.force_multiplier -= 0.25
var/datum/physiology/WS1 = old_shell.physiology
var/datum/physiology/WS2 = new_shell.physiology
WS1.force_multiplier /= 0.75
WS2.force_multiplier *= 0.75

if(owner.mind.synth_audible_warning)
new_shell.say("WARNING. ABNORMAL GOVERNOR BEHAVIOUR DETECTED.", forced = TRUE)
Expand Down Expand Up @@ -211,4 +221,8 @@

return FALSE


#undef SYNTH_SLOW_THRESHOLD
#undef SYNTH_SPEECH_THRESHOLD
#undef SYNTH_FORCE_THRESHOLD
#undef SYNTH_FREEZE_THRESHOLD
#undef SYNTH_DEATH_THRESHOLD
Loading