Skip to content

Commit

Permalink
bugfixes#5 (#3645)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePooba authored Oct 3, 2024
1 parent e5519fc commit 74d74aa
Show file tree
Hide file tree
Showing 17 changed files with 196 additions and 122 deletions.
157 changes: 93 additions & 64 deletions _maps/map_files/generic/CentCom.dmm

Large diffs are not rendered by default.

72 changes: 50 additions & 22 deletions code/datums/components/omen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,44 @@
* Omens are removed once the victim is either maimed by one of the possible injuries, or if they receive a blessing (read: bashing with a bible) from the chaplain.
*/
/datum/component/omen
dupe_mode = COMPONENT_DUPE_UNIQUE
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
/// Whatever's causing the omen, if there is one. Destroying the vessel won't stop the omen, but we destroy the vessel (if one exists) upon the omen ending
var/obj/vessel
/// If the omen is permanent, it will never go away
var/permanent = FALSE
/// How many incidents are left. If 0 exactly, it will get deleted.
var/incidents_left = INFINITY
/// Base probability of negative events. Cursed are half as unlucky.
var/luck_mod = 1
/// Base damage from negative events. Cursed take 25% less damage.
var/damage_mod = 1

/datum/component/omen/Initialize(obj/vessel, permanent, luck_mod, damage_mod)
/datum/component/omen/Initialize(obj/vessel, incidents_left, luck_mod, damage_mod)
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE

if(istype(vessel))
src.vessel = vessel
RegisterSignal(vessel, COMSIG_QDELETING, PROC_REF(vessel_qdeleting))
src.permanent = permanent
if(!isnull(incidents_left))
src.incidents_left = incidents_left
if(!isnull(luck_mod))
src.luck_mod = luck_mod
if(!isnull(damage_mod))
src.damage_mod = damage_mod

/datum/component/omen/InheritComponent(obj/vessel, incidents_left, luck_mod, damage_mod)
// If we have more incidents left the new one gets deleted.
if(src.incidents_left > incidents_left)
return // make slimes get nurtiton from plasmer
// Otherwise we set our incidents remaining to the higher, newer value.
src.incidents_left = incidents_left
// The new omen is weaker than our current omen? Let's split the difference.
if(src.luck_mod > luck_mod)
src.luck_mod += luck_mod * 0.5
if(src.damage_mod > damage_mod)
src.luck_mod += luck_mod * 0.5
// This means that if you had a strong temporary omen and it was replaced by a weaker but permanent omen, the latter is made worse.
// Feature!

/datum/component/omen/Destroy(force)
var/mob/living/person = parent
to_chat(person, span_nicegreen("You feel a horrible omen lifted off your shoulders!"))
Expand All @@ -42,6 +57,11 @@

return ..()

/datum/component/omen/proc/consume_omen()
incidents_left--
if(incidents_left < 1)
qdel(src)

/datum/component/omen/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(check_accident))
RegisterSignal(parent, COMSIG_ON_CARBON_SLIP, PROC_REF(check_slip))
Expand All @@ -64,9 +84,21 @@
return

var/mob/living/living_guy = our_guy
if(!prob(15 * luck_mod))
return
var/effective_luck = luck_mod

// If there's nobody to witness the misfortune, make it less likely.
// This way, we allow for people to be able to get into hilarious situations without making the game nigh unplayable most of the time.

var/has_watchers = FALSE
for(var/mob/viewer in viewers(our_guy, world.view))
if(viewer.client)
has_watchers = TRUE
break
if(!has_watchers)
effective_luck *= 0.5

if(!prob(15 * effective_luck))
return
var/our_guy_pos = get_turf(living_guy)
for(var/obj/machinery/door/airlock/darth_airlock in our_guy_pos)
if(darth_airlock.locked || !darth_airlock.hasPower())
Expand All @@ -80,8 +112,7 @@
if(istype(our_guy_pos, /turf/open/floor/noslip/tram_plate/energized))
var/turf/open/floor/noslip/tram_plate/energized/future_tram_victim = our_guy_pos
if(future_tram_victim.toast(living_guy))
if(!permanent)
qdel(src)
consume_omen()
return

for(var/turf/the_turf as anything in get_adjacent_open_turfs(living_guy))
Expand All @@ -90,23 +121,21 @@
if(living_guy.can_z_move(DOWN, the_turf, z_move_flags = ZMOVE_FALL_FLAGS))
to_chat(living_guy, span_warning("A malevolent force guides you towards the edge..."))
living_guy.throw_at(the_turf, 1, 10, force = MOVE_FORCE_EXTREMELY_STRONG)
if(!permanent)
qdel(src)
consume_omen()
return

for(var/obj/machinery/vending/darth_vendor in the_turf)
if(!darth_vendor.tiltable || darth_vendor.tilted)
continue
to_chat(living_guy, span_warning("A malevolent force tugs at the [darth_vendor]..."))
INVOKE_ASYNC(darth_vendor, TYPE_PROC_REF(/obj/machinery/vending, tilt), living_guy)
if(!permanent)
qdel(src)
consume_omen()
return

/datum/component/omen/proc/slam_airlock(obj/machinery/door/airlock/darth_airlock)
. = darth_airlock.close(force_crush = TRUE)
if(. && !permanent && !prob(66.6))
qdel(src)
if(.)
consume_omen()

/// If we get knocked down, see if we have a really bad slip and bash our head hard
/datum/component/omen/proc/check_slip(mob/living/our_guy, amount)
Expand All @@ -124,16 +153,15 @@
our_guy.visible_message(span_danger("[our_guy] hits [our_guy.p_their()] head really badly falling down!"), span_userdanger("You hit your head really badly falling down!"))
the_head.receive_damage(75 * damage_mod)
our_guy.adjustOrganLoss(ORGAN_SLOT_BRAIN, 100 * damage_mod)
if(!permanent)
qdel(src)
consume_omen()

return

/// Hijack the mood system to see if we get the blessing mood event to cancel the omen
/datum/component/omen/proc/check_bless(mob/living/our_guy, category)
SIGNAL_HANDLER

if(permanent)
if(incidents_left == INFINITY)
return

if(!("blessing" in our_guy.mob_mood.mood_events))
Expand All @@ -145,7 +173,7 @@
/datum/component/omen/proc/check_death(mob/living/our_guy)
SIGNAL_HANDLER

if(permanent)
if(incidents_left == INFINITY)
return

qdel(src)
Expand All @@ -170,7 +198,7 @@
/datum/component/omen/smite

/datum/component/omen/smite/check_death(mob/living/our_guy)
if(!permanent)
if(incidents_left == INFINITY)
return ..()

death_explode(our_guy)
Expand All @@ -181,8 +209,8 @@
* Has only a 50% chance of bad things happening, and takes only 25% of normal damage.
*/
/datum/component/omen/quirk
permanent = TRUE
luck_mod = 0.5 // 50% chance of bad things happening
incidents_left = INFINITY
luck_mod = 0.4 // 30% chance of bad things happening
damage_mod = 0.25 // 25% of normal damage

/datum/component/omen/quirk/RegisterWithParent()
Expand Down
3 changes: 3 additions & 0 deletions code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@
/obj/machinery/proc/close_machine(atom/movable/target, density_to_set = TRUE)
state_open = FALSE
set_density(density_to_set)
if (!density)
update_appearance()
return
if(!target)
for(var/atom in loc)
if (!(can_be_occupant(atom)))
Expand Down
36 changes: 20 additions & 16 deletions code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -483,25 +483,29 @@
open()

/obj/machinery/door/proc/crush()
for(var/mob/living/L in get_turf(src))
L.visible_message(span_warning("[src] closes on [L], crushing [L.p_them()]!"), span_userdanger("[src] closes on you and crushes you!"))
SEND_SIGNAL(L, COMSIG_LIVING_DOORCRUSHED, src)
if(isalien(L)) //For xenos
L.adjustBruteLoss(DOOR_CRUSH_DAMAGE * 1.5) //Xenos go into crit after aproximately the same amount of crushes as humans.
L.emote("roar")
else if(ishuman(L)) //For humans
L.adjustBruteLoss(DOOR_CRUSH_DAMAGE)
L.emote("scream")
L.Paralyze(100)
for(var/mob/living/future_pancake in get_turf(src))
future_pancake.visible_message(span_warning("[src] closes on [future_pancake], crushing [future_pancake.p_them()]!"), span_userdanger("[src] closes on you and crushes you!"))
SEND_SIGNAL(future_pancake, COMSIG_LIVING_DOORCRUSHED, src)
if(isalien(future_pancake)) //For xenos
future_pancake.adjustBruteLoss(DOOR_CRUSH_DAMAGE * 1.5) //Xenos go into crit after aproximately the same amount of crushes as humans.
future_pancake.emote("roar")
else if(ismonkey(future_pancake))
future_pancake.emote("screech")
future_pancake.adjustBruteLoss(DOOR_CRUSH_DAMAGE)
future_pancake.Paralyze(100)
else if(ishuman(future_pancake)) //For humans
future_pancake.adjustBruteLoss(DOOR_CRUSH_DAMAGE)
future_pancake.emote("scream")
future_pancake.Paralyze(100)
else //for simple_animals & borgs
L.adjustBruteLoss(DOOR_CRUSH_DAMAGE)
future_pancake.adjustBruteLoss(DOOR_CRUSH_DAMAGE)
var/turf/location = get_turf(src)
//add_blood doesn't work for borgs/xenos, but add_blood_floor does.
L.add_splatter_floor(location)
log_combat(src, L, "crushed")
for(var/obj/vehicle/sealed/mecha/M in get_turf(src))
M.take_damage(DOOR_CRUSH_DAMAGE)
log_combat(src, M, "crushed")
future_pancake.add_splatter_floor(location)
log_combat(src, future_pancake, "crushed")
for(var/obj/vehicle/sealed/mecha/mech in get_turf(src))
mech.take_damage(DOOR_CRUSH_DAMAGE)
log_combat(src, mech, "crushed")

/obj/machinery/door/proc/autoclose()
if(!QDELETED(src) && !density && !operating && !locked && !welded && autoclose)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/fireaxe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
name = "metallic hydrogen axe"
desc = "A lightweight crowbar with an extreme sharp fire axe head attached. It trades it's hefty as a weapon by making it easier to carry around when holstered to suits without having to sacrifice your backpack."
force_unwielded = 5
force_wielded = 15
force_wielded = 20
demolition_mod = 2
tool_behaviour = TOOL_CROWBAR
toolspeed = 1
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/structures/mirror.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
. = ..()
if(broken) // breaking a mirror truly gets you bad luck!
to_chat(user, span_warning("A chill runs down your spine as [src] shatters..."))
user.AddComponent(/datum/component/omen)
user.AddComponent(/datum/component/, incidents_left = 7)

/obj/structure/mirror/bullet_act(obj/projectile/P)
if(broken || !isliving(P.firer) || !P.damage)
Expand All @@ -90,7 +90,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
if(broken) // breaking a mirror truly gets you bad luck!
var/mob/living/unlucky_dude = P.firer
to_chat(unlucky_dude, span_warning("A chill runs down your spine as [src] shatters..."))
unlucky_dude.AddComponent(/datum/component/omen)
unlucky_dude.AddComponent(/datum/component/omen, incidents_left = 7)

/obj/structure/mirror/atom_break(damage_flag, mapload)
. = ..()
Expand Down
12 changes: 7 additions & 5 deletions code/modules/admin/smites/bad_luck.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@
var/silent

/// Is this permanent?
var/permanent
var/incidents

/datum/smite/bad_luck/configure(client/user)
silent = tgui_alert(user, "Do you want to apply the omen with a player notification?", "Notify Player?", list("Notify", "Silent")) == "Silent"
permanent = tgui_alert(user, "Would you like this to be permanent or removed automatically after the first accident?", "Permanent?", list("Permanent", "Temporary")) == "Permanent"
incidents = tgui_input_number(user, "For how many incidents will the omen last? 0 means permanent.", "Duration?", default = 0, round_value = 1)
if(incidents == 0)
incidents = INFINITY

/datum/smite/bad_luck/effect(client/user, mob/living/target)
. = ..()
//if permanent, replace any existing omen
if(permanent)
if(incidents == INFINITY)
var/existing_component = target.GetComponent(/datum/component/omen)
qdel(existing_component)
target.AddComponent(/datum/component/omen/smite, permanent = permanent)
target.AddComponent(/datum/component/omen/smite, incidents_left = incidents)
if(silent)
return
to_chat(target, span_warning("You get a bad feeling..."))
if(permanent)
if(incidents == INFINITY)
to_chat(target, span_warning("A <b>very</b> bad feeling... As if malevolent forces are watching you..."))
3 changes: 2 additions & 1 deletion code/modules/antagonists/changeling/powers/lesserform.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
desc = "We debase ourselves and become lesser. We become a monkey. Costs 5 chemicals."
helptext = "The transformation greatly reduces our size, allowing us to slip out of cuffs and climb through vents."
button_icon_state = "lesser_form"
chemical_cost = 5
chemical_cost = 20 // monkestation edit
dna_cost = 1
/// Whether to allow the transformation animation to play
var/transform_instantly = FALSE
Expand All @@ -25,6 +25,7 @@
..()
return ismonkey(user) ? unmonkey(user) : become_monkey(user)


/// Stop being a monkey
/datum/action/changeling/lesserform/proc/unmonkey(mob/living/carbon/human/user)
if(user.movement_type & VENTCRAWLING)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/cargo/coupon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
to_chat(cursed, span_warning("The coupon reads '<b>fuck you</b>' in large, bold text... is- is that a prize, or?"))

if(!cursed.GetComponent(/datum/component/omen))
cursed.AddComponent(/datum/component/omen)
cursed.AddComponent(/datum/component/omen, incidents_left = 2)
return TRUE
if(HAS_TRAIT(cursed, TRAIT_CURSED))
to_chat(cursed, span_warning("What a horrible night... To have a curse!"))
Expand Down
6 changes: 3 additions & 3 deletions code/modules/clothing/head/helmet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,12 @@
flags_cover = HEADCOVERSEYES | HEADCOVERSMOUTH

/datum/armor/helmet_elder_atmosian
melee = 25
bullet = 20
melee = 30
bullet = 30
laser = 30
energy = 30
bomb = 85
bio = 10
fire = 65
fire = 100
acid = 40
wound = 15
6 changes: 3 additions & 3 deletions code/modules/clothing/suits/armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,13 @@
)

/datum/armor/armor_elder_atmosian
melee = 25
bullet = 20
melee = 30
bullet = 30
laser = 30
energy = 30
bomb = 85
bio = 10
fire = 65
fire = 100
acid = 40
wound = 15

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
mutanttongue = /obj/item/organ/internal/tongue/zombie
changesource_flags = MIRROR_BADMIN | WABBAJACK | ERT_SPAWN
/// The rate the zombies regenerate at
var/heal_rate = 0.5
var/heal_rate = 0.6
/// The cooldown before the zombie can start regenerating
COOLDOWN_DECLARE(regen_cooldown)

Expand All @@ -112,6 +112,7 @@
TRAIT_RESISTHIGHPRESSURE,
TRAIT_RESISTLOWPRESSURE,
TRAIT_TOXIMMUNE,
TRAIT_NO_PAIN_EFFECTS,
// INFECTIOUS UNIQUE
TRAIT_STABLEHEART, // Replacement for noblood. Infectious zombies can bleed but don't need their heart.
TRAIT_STABLELIVER, // Not necessary but for consistency with above
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/transform_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
icon = initial(icon)
invisibility = 0
set_species(/datum/species/monkey)
name = "monkey"
set_name()
SEND_SIGNAL(src, COMSIG_HUMAN_MONKEYIZE)
uncuff()
regenerate_icons()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/religion/sparring/sparring_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
switch(pick(possible_punishments))
if(PUNISHMENT_OMEN)
to_chat(interfering, span_warning("You get a bad feeling... for interfering with [chaplain]'s sparring match..."))
interfering.AddComponent(/datum/component/omen)
interfering.AddComponent(/datum/component/omen, incidents_left = 10)
if(PUNISHMENT_LIGHTNING)
to_chat(interfering, span_warning("[GLOB.deity] has punished you for interfering with [chaplain]'s sparring match!"))
lightningbolt(interfering)
Expand Down
Loading

0 comments on commit 74d74aa

Please sign in to comment.