Skip to content

Commit

Permalink
Merge pull request #93 from MistakeNot4892/fork/pyrelight
Browse files Browse the repository at this point in the history
Updating from Neb dev.
  • Loading branch information
MistakeNot4892 authored Sep 26, 2024
2 parents bf830be + 9941210 commit e9f7359
Show file tree
Hide file tree
Showing 140 changed files with 1,161 additions and 1,166 deletions.
6 changes: 0 additions & 6 deletions code/_onclick/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@
silicon_camera.captureimage(A, usr)
return

/*
AI restrained() currently does nothing
if(restrained())
RestrainedClickOn(A)
else
*/
A.add_hiddenprint(src)
A.attack_ai(src)

Expand Down
7 changes: 0 additions & 7 deletions code/_onclick/cyborg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@
to_chat(src, "<span class='danger'>Your camera isn't functional.</span>")
return

/*
cyborg restrained() currently does nothing
if(restrained())
RestrainedClickOn(A)
return
*/

var/obj/item/holding = get_active_held_item()

// Cyborgs have no range-checking unless there is item use
Expand Down
25 changes: 20 additions & 5 deletions code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
return TRUE
return FALSE


/mob/living/human/RestrainedClickOn(var/atom/A)
return

/mob/living/human/RangedAttack(var/atom/A, var/params)
//Climbing up open spaces
if(isturf(loc) && bound_overlay && !is_physically_disabled() && istype(A) && A.can_climb_from_below(src))
Expand All @@ -59,7 +55,26 @@
return FALSE

/mob/living/RestrainedClickOn(var/atom/A)
return
if (A != src)
return ..()
if(world.time < next_restraint_chew || !get_equipped_item(slot_handcuffed_str) || a_intent != I_HURT || get_target_zone() != BP_MOUTH)
return FALSE
// Cannot chew with a mask or a full body restraint.
if (get_equipped_item(slot_wear_mask_str) || istype(get_equipped_item(slot_wear_suit_str), /obj/item/clothing/suit/straight_jacket))
return FALSE
// Type to hand so drakes don't chew off their own head.
var/obj/item/organ/external/hand/O = GET_EXTERNAL_ORGAN(src, get_active_held_item_slot())
if(!istype(O))
return FALSE
var/decl/pronouns/G = get_pronouns()
visible_message(
SPAN_DANGER("\The [src] chews on [G.his] [O.name]"),
SPAN_DANGER("You chew on your [O.name]!")
)
admin_attacker_log(src, "chewed on their [O.name]!")
O.take_external_damage(3,0, DAM_SHARP|DAM_EDGE ,"teeth marks")
next_restraint_chew = world.time + (2.5 SECONDS)
return TRUE

/*
New Players:
Expand Down
12 changes: 6 additions & 6 deletions code/datums/ai/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@
if(dam > maxdam && (maxdam == 0 || prob(50)) )
damaged_organ = E
maxdam = dam
var/decl/pronouns/G = H.get_pronouns()
var/decl/pronouns/pronouns = H.get_pronouns()
if(damaged_organ)
if(damaged_organ.status & ORGAN_BLEEDING)
H.custom_emote("clutches [G.his] [damaged_organ.name], trying to stop the blood.")
H.custom_emote("clutches [pronouns.his] [damaged_organ.name], trying to stop the blood.")
else if(damaged_organ.status & ORGAN_BROKEN)
H.custom_emote("holds [G.his] [damaged_organ.name] carefully.")
H.custom_emote("holds [pronouns.his] [damaged_organ.name] carefully.")
else if(damaged_organ.burn_dam > damaged_organ.brute_dam && damaged_organ.organ_tag != BP_HEAD)
H.custom_emote("blows on [G.his] [damaged_organ.name] carefully.")
H.custom_emote("blows on [pronouns.his] [damaged_organ.name] carefully.")
else
H.custom_emote("rubs [G.his] [damaged_organ.name] carefully.")
H.custom_emote("rubs [pronouns.his] [damaged_organ.name] carefully.")

for(var/obj/item/organ/I in H.get_internal_organs())
if((I.status & ORGAN_DEAD) || BP_IS_PROSTHETIC(I))
continue
if(I.damage > 2 && prob(1))
var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(H, I.parent_organ)
H.custom_emote("clutches [G.his] [parent.name]!")
H.custom_emote("clutches [pronouns.his] [parent.name]!")
13 changes: 7 additions & 6 deletions code/datums/config/config_types/config_game_option.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,31 @@

/decl/config/num/movement_human
uid = "human_delay"
desc = "These modify the run/walk speed of all mobs before the mob-specific modifiers are applied."
desc = "A modifier applied to the run/walk delay of human-type mobs. A higher value will result in slower movement."
default_value = -1

/decl/config/num/movement_robot
uid = "robot_delay"
desc = "These modify the run/walk speed of all mobs before the mob-specific modifiers are applied."
desc = "A modifier applied to the run/walk delay of robots (cyborgs and drones). A higher value will result in slower movement."

/decl/config/num/movement_animal
uid = "animal_delay"
desc = "These modify the run/walk speed of all mobs before the mob-specific modifiers are applied."
desc = "A modifier applied to the run/walk delay of simple_animal type mobs (including combat drones and other simple hostile mobs). A higher value will result in slower movement."

/decl/config/num/movement_run
uid = "run_delay"
default_value = 2
desc = "These modify the run/walk speed of all mobs before the mob-specific modifiers are applied."
desc = "A modifier applied to the run delay of all mobs, prior to the mob-specific modifiers being applied. A higher value will result in slower movement."

/decl/config/num/movement_walk
uid = "walk_delay"
default_value = 4
desc = "These modify the run/walk speed of all mobs before the mob-specific modifiers are applied."
desc = "A modifier applied to the walk delay of all mobs, prior to the mob-specific modifiers being applied. A higher value will result in slower movement."

/decl/config/num/movement_creep
uid = "creep_delay"
default_value = 6
desc = "These modify the run/walk speed of all mobs before the mob-specific modifiers are applied."
desc = "A modifier applied to the creep delay of all mobs, prior to the mob-specific modifiers being applied. A higher value will result in slower movement."

/decl/config/num/movement_glide_size
uid = "glide_size_delay"
Expand Down
11 changes: 10 additions & 1 deletion code/datums/extensions/extensions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@
return get_extension(source, base_type)

/proc/get_extension(var/datum/source, var/base_type)
if(!istype(source) || !source.extensions || isnull(base_type))
// Invalid holder datum.
if(!istype(source))
PRINT_STACK_TRACE("Invalid source provided to get_extension(): [source || "null"]")
return
// Invalid extension type.
if(!ispath(base_type, /datum/extension))
PRINT_STACK_TRACE("Invalid base_type provided to get_extension(): [base_type || "null"]")
return
// Return early if we have no extensions whatsoever.
if(!source.extensions)
return
. = source.extensions[base_type]
if(!.)
Expand Down
85 changes: 85 additions & 0 deletions code/datums/extensions/resistable/resistable.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// TODO: extend this to cover buckled structures
/datum/extension/resistable
base_type = /datum/extension/resistable
expected_type = /obj/item

/datum/extension/resistable/proc/get_restraint_escape_time(mob/living/user)
return 2 MINUTES

/datum/extension/resistable/proc/user_try_escape(mob/living/user, slot)

set waitfor = FALSE

var/obj/item/restraint = holder
if(!istype(user) || QDELETED(user) || QDELETED(restraint) || restraint.loc != user || user.buckled)
return FALSE

// Don't want to do a lot of logic gating here.
if(user.can_break_restraints())
return user.break_restraints(restraint)

var/breakouttime = get_restraint_escape_time(user)
breakouttime = max(5, breakouttime * user.get_restraint_breakout_mod())
user.setClickCooldown(breakouttime)

user.visible_message(
SPAN_DANGER("\The [user] attempts to remove \the [restraint]!"),
SPAN_DANGER("You attempt to remove \the [restraint] (This will take around [ceil(breakouttime / (1 SECOND))] second\s and you need to stand still)."),
range = 2
)

var/static/resist_stages = 4
for(var/i = 1 to resist_stages)
if(!do_after(user, breakouttime*0.25, incapacitation_flags = (INCAPACITATION_DEFAULT & ~INCAPACITATION_RESTRAINED)))
user.visible_message(
SPAN_WARNING("\The [user] stops fiddling with \the [restraint]."),
SPAN_WARNING("You stop trying to slip free of \the [restraint]."),
range = 2
)
return FALSE

var/new_restraint = user.get_equipped_item(slot)
if((restraint != new_restraint) || user.buckled)
return FALSE
user.visible_message(
SPAN_WARNING("\The [user] fiddles with \the [restraint]."),
SPAN_WARNING("You try to slip free of \the [restraint] ([i*100/resist_stages]% done)."),
range = 2
)

if (restraint.can_take_damage() && restraint.current_health > 0) // Improvised restraint can break because their health is > 0
restraint.take_damage(restraint.get_max_health() / 2)
if (QDELETED(restraint) || restraint.current_health < 1)
var/decl/pronouns/pronouns = restraint.get_pronouns()
user.visible_message(
SPAN_DANGER("\The [user] manages to remove \the [restraint], breaking [pronouns.him]!"),
SPAN_NOTICE("You successfully remove \the [restraint], breaking [pronouns.him]!"),
range = 2
)
QDEL_NULL(restraint)
if(user.buckled && user.buckled.buckle_require_restraints)
user.buckled.unbuckle_mob()
user.update_equipment_overlay(slot)
return
user.visible_message(
SPAN_WARNING("\The [user] manages to remove \the [restraint]!"),
SPAN_NOTICE("You successfully remove \the [restraint]!"),
range = 2
)
user.drop_from_inventory(restraint)

// Specific item subtypes/logic below.
/datum/extension/resistable/handcuffs
expected_type = /obj/item/handcuffs

/datum/extension/resistable/handcuffs/get_restraint_escape_time(mob/living/user)
var/obj/item/handcuffs/cuffs = holder
. = cuffs.breakouttime
if(istype(user?.get_equipped_item(slot_gloves_str), /obj/item/clothing/gloves/rig))
. = round(.*0.5)

/datum/extension/resistable/straightjacket
expected_type = /obj/item/clothing/suit/straight_jacket

/datum/extension/resistable/straightjacket/get_restraint_escape_time(mob/living/user)
return 5 MINUTES
4 changes: 2 additions & 2 deletions code/datums/movement/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@
to_chat(mob, SPAN_WARNING("You're pinned down by \a [mob.pinned[1]]!"))
return MOVEMENT_STOP

for(var/obj/item/grab/G as anything in mob.grabbed_by)
if(G.assailant != mob && G.assailant != mover && (mob.restrained() || G.stop_move()))
for(var/obj/item/grab/grab as anything in mob.grabbed_by)
if(grab.assailant != mob && grab.assailant != mover && (mob.restrained() || grab.stop_move()))
if(mover == mob)
to_chat(mob, SPAN_WARNING("You're restrained and cannot move!"))
mob.ProcessGrabs()
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@
- `G`: The grab hitting this atom
- Return: `TRUE` to skip attackby() and afterattack() or `FALSE`
*/
/atom/proc/grab_attack(var/obj/item/grab/G)
/atom/proc/grab_attack(obj/item/grab/grab, mob/user)
return FALSE

/atom/proc/climb_on()
Expand Down
12 changes: 6 additions & 6 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,9 @@

/atom/movable/proc/show_buckle_message(var/mob/buckled, var/mob/buckling)
if(buckled == buckling)
var/decl/pronouns/G = buckled.get_pronouns()
var/decl/pronouns/pronouns = buckled.get_pronouns()
visible_message(
SPAN_NOTICE("\The [buckled] buckles [G.self] to \the [src]."),
SPAN_NOTICE("\The [buckled] buckles [pronouns.self] to \the [src]."),
SPAN_NOTICE("You buckle yourself to \the [src]."),
SPAN_NOTICE("You hear metal clanking.")
)
Expand All @@ -449,16 +449,16 @@
var/mob/living/M = unbuckle_mob()
if(M)
show_unbuckle_message(M, user)
for(var/obj/item/grab/G as anything in (M.grabbed_by|grabbed_by))
qdel(G)
for(var/obj/item/grab/grab as anything in (M.grabbed_by|grabbed_by))
qdel(grab)
add_fingerprint(user)
return M

/atom/movable/proc/show_unbuckle_message(var/mob/buckled, var/mob/buckling)
if(buckled == buckling)
var/decl/pronouns/G = buckled.get_pronouns()
var/decl/pronouns/pronouns = buckled.get_pronouns()
visible_message(
SPAN_NOTICE("\The [buckled] unbuckled [G.self] from \the [src]!"),
SPAN_NOTICE("\The [buckled] unbuckled [pronouns.self] from \the [src]!"),
SPAN_NOTICE("You unbuckle yourself from \the [src]."),
SPAN_NOTICE("You hear metal clanking.")
)
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/objectives/objective_demote.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/datum/objective/anti_revolution/demote/find_target()
..()
if(target && target.current)
var/decl/pronouns/G = target.current.get_pronouns(ignore_coverings = TRUE)
explanation_text = "[target.current.real_name], the [target.assigned_role] has been classified as harmful to [global.using_map.company_name]'s goals. Demote [G.him] to assistant."
var/decl/pronouns/pronouns = target.current.get_pronouns(ignore_coverings = TRUE)
explanation_text = "[target.current.real_name], the [target.assigned_role] has been classified as harmful to [global.using_map.company_name]'s goals. Demote [pronouns.him] to assistant."
else
explanation_text = "Free Objective"
return target
4 changes: 2 additions & 2 deletions code/game/gamemodes/objectives/objective_execute.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/datum/objective/anti_revolution/execute/find_target()
..()
if(target && target.current)
var/decl/pronouns/G = target.current.get_pronouns(ignore_coverings = TRUE)
explanation_text = "[target.current.real_name], the [target.assigned_role] has extracted confidential information above their clearance. Execute [G.him]."
var/decl/pronouns/pronouns = target.current.get_pronouns(ignore_coverings = TRUE)
explanation_text = "[target.current.real_name], the [target.assigned_role] has extracted confidential information above their clearance. Execute [pronouns.him]."
else
explanation_text = "Free Objective"
return target
12 changes: 5 additions & 7 deletions code/game/machinery/OpTable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@
. = ..()
to_chat(user, SPAN_NOTICE("The neural suppressors are switched [suppressing ? "on" : "off"]."))

/obj/machinery/optable/attackby(var/obj/item/O, var/mob/user)
if (istype(O, /obj/item/grab))
var/obj/item/grab/G = O
if(isliving(G.affecting) && check_table(G.affecting))
take_victim(G.affecting,usr)
qdel(O)
return
/obj/machinery/optable/grab_attack(obj/item/grab/grab, mob/user)
if(isliving(grab.affecting) && check_table(grab.affecting))
take_victim(grab.affecting, user)
qdel(grab)
return TRUE
return ..()

/obj/machinery/optable/state_transition(var/decl/machine_construction/default/new_state)
Expand Down
10 changes: 4 additions & 6 deletions code/game/machinery/bodyscanner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@
if(istype(new_state))
updateUsrDialog()

/obj/machinery/bodyscanner/attackby(obj/item/grab/G, user)
if(istype(G))
var/mob/M = G.get_affecting_mob()
if(!M || !user_can_move_target_inside(M, user))
return
qdel(G)
/obj/machinery/bodyscanner/grab_attack(obj/item/grab/grab, mob/user)
var/mob/living/victim = grab.get_affecting_mob()
if(istype(victim) && user_can_move_target_inside(victim, user))
qdel(grab)
return TRUE
return ..()

Expand Down
21 changes: 8 additions & 13 deletions code/game/machinery/cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -392,21 +392,16 @@
attempt_enter(dropping, user)
return TRUE

/obj/machinery/cryopod/attackby(var/obj/item/G, var/mob/user)

if(istype(G, /obj/item/grab))
var/obj/item/grab/grab = G
/obj/machinery/cryopod/grab_attack(obj/item/grab/grab, mob/user)
var/mob/living/victim = grab.get_affecting_mob()
if(istype(victim) && istype(user))
if(occupant)
to_chat(user, SPAN_NOTICE("\The [src] is in use."))
return

if(!ismob(grab.affecting))
return

if(!check_occupant_allowed(grab.affecting))
return

attempt_enter(grab.affecting, user)
return TRUE
if(!check_occupant_allowed(victim))
return TRUE
attempt_enter(victim, user)
return TRUE
return ..()

/obj/machinery/cryopod/verb/eject()
Expand Down
Loading

0 comments on commit e9f7359

Please sign in to comment.