Skip to content

Commit

Permalink
Merge branch 'BurgerLUA:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
IjNebula authored Sep 4, 2024
2 parents 4496d82 + 92805c1 commit 4ee951e
Show file tree
Hide file tree
Showing 27 changed files with 161 additions and 103 deletions.
8 changes: 5 additions & 3 deletions code/__defines/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
#define GAMEMODE_BREAK 6

#define WORLD_END_SHUTDOWN 0
#define WORLD_END_NANOTRASEN_VICTORY 1
#define WORLD_END_SYNDICATE_VICTORY 2
#define WORLD_END_SYNDICATE_VICTORY 1
#define WORLD_END_BORING_VICTORY 2
#define WORLD_END_MINOR_NANOTRASEN_VICTORY 3
#define WORLD_END_NANOTRASEN_VICTORY 4

#define FAILED "FAILED"
#define COMPLETED "COMPLETED"
#define ACTIVE "ACTIVE"
#define IMPOSSIBLE "IMPOSSIBLE"
#define IMPOSSIBLE "IMPOSSIBLE"
15 changes: 8 additions & 7 deletions code/_core/client/life.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/client/proc/on_life()

if(length(queued_chat_messages) && queued_chat_messages[1])
var/list/queued_message = queued_chat_messages[1]
var/text = queued_message["text"]
var/list/targets = queued_message["output_target_list"]
for(var/target in targets)
src << output(text,target)
queued_chat_messages.Cut(1,2)
for(var/i in 1 to length(queued_chat_messages) > 20 ? 3 : 1) // If they have an excessive amount of messages, lets speed up.
var/list/queued_message = queued_chat_messages[1]
var/text = queued_message["text"]
var/list/targets = queued_message["output_target_list"]
for(var/target in targets)
src << output(text,target)
queued_chat_messages.Cut(1,2)

if(mob)
mob.on_life_client()
Expand Down Expand Up @@ -82,4 +83,4 @@
else
animate(src,pixel_x = 0, pixel_y = 0, time = SECONDS_TO_DECISECONDS(0.5), flags = ANIMATION_LINEAR_TRANSFORM )
*/
return TRUE
return TRUE
2 changes: 2 additions & 0 deletions code/_core/client/verbs/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
if(in_sleeper)
var/choice = input("Are you sure you want to save your character and cryo? Your items and character will be saved..","Cryogenics","No") in list("Yes","No") | null
if(choice == "Yes")
if(P.dead)
return FALSE
var/savedata/client/mob/mobdata = MOBDATA(ckey)
if(mobdata)
mobdata.save_character(P)
Expand Down
6 changes: 0 additions & 6 deletions code/_core/datum/ai/ai_combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@

/ai/proc/handle_attacking()

if(!can_attack)
return FALSE

if(!objective_attack)
return FALSE

if(get_dist(owner,objective_attack) > distance_target_max)
return FALSE

Expand Down
12 changes: 6 additions & 6 deletions code/_core/datum/ai/ai_life.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/ai/proc/should_life()

if(!active)
return FALSE

if(!owner)
qdel(src)
return FALSE

if(!active)
return FALSE

if(!owner.finalized)
return FALSE

Expand Down Expand Up @@ -37,7 +37,7 @@
owner.resist()
return TRUE

if(aggression > 0)
if(aggression > 0 && can_attack)
if(!master_ai) //Find objectives only if you don't belong to a master.
objective_ticks += tick_rate
var/actual_objective_delay = get_objective_delay()
Expand All @@ -50,7 +50,7 @@
queue_find_new_objectives = TRUE
frustration_attack = 0

if(owner.attack_next <= world.time)
if(objective_attack && (owner.attack_next <= world.time))
handle_attacking()

if(queue_find_new_objectives)
Expand Down Expand Up @@ -229,4 +229,4 @@
set_path_node(null)
set_path_astar(null)
set_active(FALSE)
return TRUE
return TRUE
4 changes: 2 additions & 2 deletions code/_core/datum/ai/ai_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
if(!objective_attack)
return FALSE

if(cowardice >= 0) //RUN AWAY.
if(cowardice >= 0 || world_state >= STATE_ROUND_END) //RUN AWAY.
var/health_percent = owner.health ? owner.health.health_current/owner.health.health_max : 1
if((owner.horizontal || health_percent <= cowardice) && !length(node_path_current) && !length(astar_path_current) && get_dist(owner,objective_attack) <= VIEW_RANGE)
if((owner.horizontal || health_percent <= cowardice || world_state >= STATE_ROUND_END) && !length(node_path_current) && !length(astar_path_current) && get_dist(owner,objective_attack) <= VIEW_RANGE)
owner.move_dir = get_dir(objective_attack,owner)
owner.movement_flags = MOVEMENT_RUNNING
return TRUE
Expand Down
47 changes: 26 additions & 21 deletions code/_core/datum/damagetype/_damagetype.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@
if(!allow_hostile_action(A.loyalty_tag,V))
return null

if(is_living(victim))
var/mob/living/L = victim
if(L.has_status_effect(IMMORTAL))
return null

var/list/new_attack_damage = attack_damage_base.Copy()

if(is_living(attacker))
Expand Down Expand Up @@ -502,7 +507,7 @@
block_multiplier = block_data[2]

var/list/damage_to_deal = get_attack_damage(use_blamed_stats ? blamed : attacker,victim,weapon,hit_object,damage_multiplier)
var/list/damage_to_deal_main = list(
var/list/damage_to_deal_core = list(
BRUTE = 0,
BURN = 0,
TOX = 0,
Expand Down Expand Up @@ -604,12 +609,13 @@
if(debug) log_debug("Adding [damage_type] damage into [pain_damage_to_add] pain damage.")
pain_damage += pain_damage_to_add

if(length(damage_to_deal) && !length(defense_rating_victim) || !defense_rating_victim[FATIGUE] || !IS_INFINITY(defense_rating_victim[FATIGUE]))
damage_to_deal[FATIGUE] += CEILING(fatigue_damage,1)

if(!length(defense_rating_victim) || !(defense_rating_victim[FATIGUE] && IS_INFINITY(defense_rating_victim[FATIGUE])))
damage_to_deal_core[FATIGUE] += CEILING(fatigue_damage,1)
if(debug) log_debug("Dealing [fatigue_damage] extra fatigue damage due to blocked damage.")

if(!length(defense_rating_victim) || !defense_rating_victim[FATIGUE] || !IS_INFINITY(defense_rating_victim[PAIN]))
damage_to_deal[PAIN] += CEILING(pain_damage,1)
if(!length(defense_rating_victim) || !(defense_rating_victim[PAIN] && IS_INFINITY(defense_rating_victim[PAIN])))
damage_to_deal_core[PAIN] += CEILING(pain_damage,1)
if(debug) log_debug("Dealing [pain_damage] extra pain damage due to converted damage.")

var/total_damage_dealt = 0
Expand All @@ -623,10 +629,10 @@
var/list_length = length(real_damage_type)
for(var/single_damage_type in real_damage_type)
var/real_damage_amount = CEILING(damage_amount/list_length,1)
damage_to_deal_main[single_damage_type] += real_damage_amount
damage_to_deal_core[single_damage_type] += real_damage_amount
if(debug) log_debug("Converting [damage_amount] [damage_type] damage into [real_damage_amount] [single_damage_type] damage.")
else
damage_to_deal_main[real_damage_type] += CEILING(damage_amount,1)
damage_to_deal_core[real_damage_type] += CEILING(damage_amount,1)
if(debug) log_debug("Converting [damage_amount] [damage_type] damage into [damage_amount] [real_damage_type] damage.")

if(defense_rating_victim && defense_rating_victim["items"])
Expand All @@ -643,23 +649,23 @@
victim_was_dead = TRUE


var/physical_damage_dealt = damage_to_deal_main[BRUTE] + damage_to_deal_main[BURN]
var/chemical_damage_dealt = damage_to_deal_main[TOX] + damage_to_deal_main[OXY] + damage_to_deal_main[RAD]
var/physical_damage_dealt = damage_to_deal_core[BRUTE] + damage_to_deal_core[BURN]
var/chemical_damage_dealt = damage_to_deal_core[TOX] + damage_to_deal_core[OXY] + damage_to_deal_core[RAD]
var/real_damage_dealt = physical_damage_dealt + chemical_damage_dealt
//var/mental_damage_dealt = damage_to_deal_main[SANITY] + damage_to_deal_main[MENTAL]
//var/misc_damage_dealt = damage_to_deal_main[FATIGUE] + damage_to_deal_main[PAIN]
//var/mental_damage_dealt = damage_to_deal_core[SANITY] + damage_to_deal_core[MENTAL]
//var/misc_damage_dealt = damage_to_deal_core[FATIGUE] + damage_to_deal_core[PAIN]

if(total_damage_dealt > 0 && hit_object.health && victim.health)
hit_object.health.adjust_loss_smart(
brute = damage_to_deal_main[BRUTE],
burn = damage_to_deal_main[BURN],
tox = damage_to_deal_main[TOX],
oxy = damage_to_deal_main[OXY],
fatigue = damage_to_deal_main[FATIGUE],
pain = damage_to_deal_main[PAIN],
rad = damage_to_deal_main[RAD],
sanity = damage_to_deal_main[SANITY],
mental = damage_to_deal_main[MENTAL],
brute = damage_to_deal_core[BRUTE],
burn = damage_to_deal_core[BURN],
tox = damage_to_deal_core[TOX],
oxy = damage_to_deal_core[OXY],
fatigue = damage_to_deal_core[FATIGUE],
pain = damage_to_deal_core[PAIN],
rad = damage_to_deal_core[RAD],
sanity = damage_to_deal_core[SANITY],
mental = damage_to_deal_core[MENTAL],
update = FALSE
)

Expand Down Expand Up @@ -788,7 +794,6 @@
victim.add_skill_xp(SKILL_BLOCK,damage_blocked_with_shield*0.1)
. = TRUE


if(!victim.is_player_controlled() && attacker.is_player_controlled())
var/list/experience_gained = list()
var/experience_multiplier = victim.get_xp_multiplier() * experience_mod
Expand Down
2 changes: 1 addition & 1 deletion code/_core/datum/dialogue/tutorial/_tutorial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@

dialogue_options["get to work"] = list(
"In order to be a smart #1, you must be a well-equipped #2. You should first explore a little, and then head to the #3. \
From there, you can gear up and then head #4 to help secure the planet from #6 presence.",
From there, you can gear up and then head #4 to help secure the planet from #5 presence.",
"Corporate Mercenary",
"Corporate Mercenary",
"armory",
Expand Down
4 changes: 3 additions & 1 deletion code/_core/datum/experience/_experience.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@
/experience/proc/set_level(var/level)
if(!ENABLE_XP)
return FALSE
var/old_level = get_current_level()
experience = level_to_xp(clamp(level,1,get_max_level()))
last_level = get_current_level()
on_level_up(old_level, last_level)
return experience

/experience/proc/get_current_level()
Expand Down Expand Up @@ -121,4 +123,4 @@
var/mob/living/advanced/player/P = owner
if(!P.prestige_count[id])
return 0
return P.prestige_count[id]
return P.prestige_count[id]
4 changes: 2 additions & 2 deletions code/_core/datum/gamemode/horde.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
if(can_continue())
SSvote.create_vote(/vote/continue_round)
else
world.end(WORLD_END_NANOTRASEN_VICTORY)
world.end()

/gamemode/horde/proc/create_horde_mob(var/desired_loc)
var/mob/living/L = pickweight(enemy_types_to_spawn)
Expand Down Expand Up @@ -386,4 +386,4 @@
continue
return N_start

return null
return null
4 changes: 2 additions & 2 deletions code/_core/datum/gamemode/mission.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
status_display_text = "VOTE"
round_time_next = -1
if(allow_continue)
world.end(WORLD_END_NANOTRASEN_VICTORY)
world.end()
else
SSvote.create_vote(/vote/continue_round)

Expand All @@ -228,4 +228,4 @@
add_objective(objectives_left[1])
objectives_left.Cut(1,2)
else
stage = 5 //No objectives left!
stage = 5 //No objectives left!
5 changes: 3 additions & 2 deletions code/_core/datum/reagent/reagent_nutrition.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@
else if(amount_to_heal < 0)
owner.tox_regen_buffer += amount_to_heal

if(owner.health && (nutrition_normal_amount + nutrition_quality_amount + hydration_amount) != 0 && (owner.move_mod < 3 || owner.next_move <= 0)) //Not sprinting
owner.stamina_regen_buffer += (nutrition_normal_amount + nutrition_quality_amount + hydration_amount) * . *multiplier
var/stamina_to_give = (nutrition_normal_amount + nutrition_quality_amount + hydration_amount) * . *multiplier
if(owner.health && stamina_to_give > 0)
owner.stamina_regen_buffer += stamina_to_give

/reagent/nutrition/on_metabolize_blood(var/mob/living/owner,var/reagent_container/container,var/amount_to_metabolize=0,var/starting_volume=0,var/multiplier=1)
. = ..()
Expand Down
4 changes: 2 additions & 2 deletions code/_core/datum/vote/continue.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/vote/continue_round/on_result(var/winner,var/list/results)

if(winner == "No")
world.end(WORLD_END_NANOTRASEN_VICTORY)
world.end()
else
SSgamemode.active_gamemode.on_continue()

return TRUE
return TRUE
3 changes: 3 additions & 0 deletions code/_core/mob/living/_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,9 @@

if(boss)
for(var/mob/living/advanced/player/P in viewers(VIEW_RANGE,src))
if(loyalty_tag == P.loyalty_tag)
continue

for(var/obj/hud/button/boss_health/B in P.buttons)
B.target_bosses |= src
B.update_stats()
Expand Down
2 changes: 1 addition & 1 deletion code/_core/mob/living/advanced/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
if(set_default || !mobdata || !length(mobdata.loaded_data["organs"]))
return ..()

set_mob_data(mobdata["loaded_data"])
set_mob_data(mobdata.loaded_data)
return TRUE


Expand Down
4 changes: 2 additions & 2 deletions code/_core/mob/living/health.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

. = ..()

var/total_bleed_damage = SAFENUM(damage_table[BLADE])*2.5 + SAFENUM(damage_table[BLUNT])*0.75 + SAFENUM(damage_table[PIERCE])*1.5
var/total_bleed_damage = length(damage_table) ? SAFENUM(damage_table[BLADE])*2.5 + SAFENUM(damage_table[BLUNT])*0.75 + SAFENUM(damage_table[PIERCE])*1.5 : 0

var/savage_hit = health && !has_status_effect(IMMORTAL) ? damage_amount >= health.health_max*DT.savage_hit_threshold : FALSE

Expand Down Expand Up @@ -55,7 +55,7 @@

if(dead && time_of_death + 30 <= world.time && (override_butcher || length(butcher_contents)) && is_living(attacker) && get_dist(attacker,src) <= 1)
var/mob/living/L = attacker
var/blade_damage = SAFENUM(damage_table[BLADE]) + SAFENUM(damage_table[LASER])
var/blade_damage = length(damage_table) ? SAFENUM(damage_table[BLADE]) + SAFENUM(damage_table[LASER]) : 0

var/atom/atom_to_butcher = src
if(is_organ(atom_damaged))
Expand Down
17 changes: 9 additions & 8 deletions code/_core/mob/living/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@
update_eyes()
return TRUE

/mob/living/proc/rejuvenate()
/mob/living/proc/rejuvenate(var/reset_nutrition = TRUE)
blood_volume = blood_volume_max
if(reagents) reagents.remove_all_reagents()
nutrition_normal = initial(nutrition_normal)
nutrition_fast = initial(nutrition_fast)
nutrition_quality = initial(nutrition_quality)
hydration = max(hydration,initial(hydration))
if(reset_nutrition)
nutrition_normal = initial(nutrition_normal)
nutrition_fast = initial(nutrition_fast)
nutrition_quality = initial(nutrition_quality)
hydration = max(hydration,initial(hydration))
intoxication = initial(intoxication)
on_fire = initial(on_fire)
fire_stacks = initial(fire_stacks)
Expand All @@ -159,8 +160,8 @@
stamina_regen_buffer = 0
return TRUE

/mob/living/proc/resurrect()
return rejuvenate() && revive()
/mob/living/proc/resurrect(var/reset_nutrition = TRUE)
return rejuvenate(reset_nutrition) && revive()

/mob/living/proc/pre_death()
brute_regen_buffer = max(brute_regen_buffer,0)
Expand Down Expand Up @@ -633,4 +634,4 @@ mob/living/proc/on_life_slow()

CALLBACK_REMOVE("\ref[src]_make_unrevivable")

return TRUE
return TRUE
Loading

0 comments on commit 4ee951e

Please sign in to comment.