Skip to content

Commit

Permalink
prevents jitter while dead, and collects some /mob variables from var…
Browse files Browse the repository at this point in the history
…ious files (#6827)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
Fixes #6728
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

:cl:
fix: fixed feign impairment being activated while not conscious
fix: fixed corpses jittering around
refactor: refactored some variables on /mob level to be in the
mob_defines.dm file, where most of the type is defined
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
TheLordME authored Nov 5, 2024
1 parent 6a7d9d0 commit 391293b
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 153 deletions.
3 changes: 0 additions & 3 deletions code/game/click/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
~Sayu
*/

// 1 decisecond click delay (above and beyond mob/next_move)
/mob/var/next_click = 0

/*
Before anything else, defer these calls to a per-mobtype handler. This allows us to
remove istype() spaghetti code, but requires the addition of other handler procs to simplify it.
Expand Down
5 changes: 0 additions & 5 deletions code/game/gamemodes/cult/cultify/mob.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/mob
//thou shall always be able to see the Geometer of Blood
var/image/narsimage = null
var/image/narglow = null

/mob/proc/cultify()
return

Expand Down
3 changes: 0 additions & 3 deletions code/game/rendering/legacy/alert.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//A system to manage and display alerts on screen without needing you to do it yourself

/mob/var/list/alerts = list() // contains /atom/movable/screen/alert only // On /mob so clientless mobs will throw alerts properly

/atom/movable/screen/alert/Click(location, control, params)
if(!usr || !usr.client)
return
Expand Down
2 changes: 0 additions & 2 deletions code/game/verbs/suicide.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/mob/var/suiciding = 0

/mob/living/carbon/human/verb/suicide()
set hidden = 1

Expand Down
5 changes: 0 additions & 5 deletions code/modules/admin/admin_attack_log.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/mob/var/lastattacker = null
/mob/var/lastattacked = null
/mob/var/attack_log = list( )
/mob/var/dialogue_log = list( )

/proc/log_and_message_admins(message as text, mob/user = usr)
log_admin(user ? "[key_name(user)] [message]" : "[message]")
message_admins(user ? "[key_name_admin(user)] [message]" : "[message]")
Expand Down
3 changes: 0 additions & 3 deletions code/modules/atmospherics/environmental/zas/airflow.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
Contains helper procs for airflow, handled in /connection_group.
*/

/mob
var/tmp/last_airflow_stun = 0

/mob/proc/airflow_stun()
if(stat == 2)
return 0
Expand Down
2 changes: 0 additions & 2 deletions code/modules/catalogue/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// Also you should use get_catalogue_data() to access this instead of doing so directly, so special behavior can be enabled.
var/list/catalogue_data = null

/mob
catalogue_delay = 10 SECONDS

// Tests if something can be catalogued.
// If something goes wrong and a mob was supplied, the mob will be told why they can't catalogue it.
Expand Down
8 changes: 0 additions & 8 deletions code/modules/detectivework/tools/rag.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/mob
var/bloody_hands = 0
var/mob/living/carbon/human/bloody_hands_mob
var/track_blood = 0
var/list/feet_blood_DNA
var/track_blood_type
var/feet_blood_color

/obj/item/clothing/gloves
var/transfer_blood = 0
var/mob/living/carbon/human/bloody_hands_mob
Expand Down
6 changes: 0 additions & 6 deletions code/modules/keybindings/focus.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/mob
/// What receives our keyboard inputs, defaulting to src.
var/datum/key_focus
/// a singular thing that can intercept keyboard inputs
var/datum/key_intercept

/**
* set our keyboard input focus
*/
Expand Down
108 changes: 3 additions & 105 deletions code/modules/mob/animations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ value of dizziness ranges from 0 to 1000
below 100 is not dizzy
*/

/mob/var/dizziness = 0//Carbon
/mob/var/is_dizzy = 0

/mob/proc/make_dizzy(var/amount)
// for the moment, only humans get dizzy
if(!istype(src, /mob/living/carbon/human))
Expand Down Expand Up @@ -43,9 +40,6 @@ note dizziness decrements automatically in the mob's Life() proc.
client.pixel_x = 0
client.pixel_y = 0

// jitteriness - copy+paste of dizziness
/mob/var/is_jittery = 0
/mob/var/jitteriness = 0//Carbon
/mob/proc/make_jittery(var/amount)
if(!istype(src, /mob/living/carbon/human)) // for the moment, only humans get dizzy
return
Expand All @@ -57,29 +51,20 @@ note dizziness decrements automatically in the mob's Life() proc.
jittery_process()


// Typo from the oriignal coder here, below lies the jitteriness process. So make of his code what you will, the previous comment here was just a copypaste of the above.
/mob/proc/jittery_process()
//var/old_x = pixel_x
//var/old_y = pixel_y
if(IS_DEAD(src))//Dead people dont twitch around
return

is_jittery = 1
while(jitteriness > 100)
// var/amplitude = jitteriness*(sin(jitteriness * 0.044 * world.time) + 1) / 70
// pixel_x = amplitude * sin(0.008 * jitteriness * world.time)
// pixel_y = amplitude * cos(0.008 * jitteriness * world.time)

var/amplitude = min(4, jitteriness / 100)
pixel_x = get_managed_pixel_x() + rand(-amplitude, amplitude)
pixel_y = get_managed_pixel_y() + rand(-amplitude/3, amplitude/3)

sleep(1)
//endwhile - reset the pixel offsets to zero
is_jittery = 0
reset_pixel_offsets()

//handles up-down floaty effect in space and zero-gravity
/mob/var/is_floating = 0
/mob/var/floatiness = 0

/mob/proc/update_floating(dense_object=0)

if(anchored||buckled)
Expand Down Expand Up @@ -207,30 +192,6 @@ note dizziness decrements automatically in the mob's Life() proc.

/atom/movable/proc/do_attack_animation(atom/A)
animate_swing_at_target(A)
// var/pixel_x_diff = 0
// var/pixel_y_diff = 0
// var/direction = get_dir(src, A)
// if(direction & NORTH)
// pixel_y_diff = 8
// else if(direction & SOUTH)
// pixel_y_diff = -8

// if(direction & EAST)
// pixel_x_diff = 8
// else if(direction & WEST)
// pixel_x_diff = -8

// var/base_pixel_x = initial(pixel_x)
// var/base_pixel_y = initial(pixel_y)
// var/mob/mob = src
// if(istype(mob))
// base_pixel_x = mob.base_pixel_x
// base_pixel_y = mob.base_pixel_y

// SEND_SIGNAL(src, COMSIG_ATOM_TEMPORARY_ANIMATION_START, 4)

// animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, time = 2)
// animate(pixel_x = base_pixel_x, pixel_y = base_pixel_y, time = 2)

/mob/living/do_attack_animation(atom/A, no_attack_icons = FALSE)
..()
Expand All @@ -241,69 +202,6 @@ note dizziness decrements automatically in the mob's Life() proc.
A.animate_hit_by_weapon(src, held)
else
A.animate_hit_by_attack(src)
// if(no_attack_icons)
// return FALSE

// //Check for clients with pref enabled
// var/list/viewing = list()
// for(var/m in viewers(A))
// var/mob/M = m
// var/client/C = M.client
// if(C && C.get_preference_toggle(/datum/client_preference/attack_icons))
// viewing += M.client

// //Animals attacking each other in the distance, probably. Forgeddaboutit.
// if(!viewing.len)
// return FALSE

// // What icon do we use for the attack?
// var/obj/used_item
// if(hand && l_hand) // Attacked with item in left hand.
// used_item = l_hand
// else if (!hand && r_hand) // Attacked with item in right hand.
// used_item = r_hand

// //Couldn't find an item, do they have a sprite specified (like animal claw stuff?)
// if(!used_item && !(attack_icon && attack_icon_state))
// return FALSE //Didn't find an item, not doing animation.

// // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
// is_floating = 0

// var/image/I

// if(used_item) //Found an in-hand item to animate
// I = image(used_item.icon, A, used_item.icon_state, A.layer + 1)
// //Color the icon
// I.color = used_item.color
// // Scale the icon.
// I.transform *= 0.75
// else //They had a hardcoded one specified
// I = image(attack_icon, A, attack_icon_state, A.layer + 1)
// I.dir = dir

// // Show the overlay to the clients
// flick_overlay(I, viewing, 5) // 5 ticks/half a second

// // Set the direction of the icon animation.
// var/direction = get_dir(src, A)
// if(direction & NORTH)
// I.pixel_y = -16
// else if(direction & SOUTH)
// I.pixel_y = 16

// if(direction & EAST)
// I.pixel_x = -16
// else if(direction & WEST)
// I.pixel_x = 16

// if(!direction) // Attacked self?!
// I.pixel_z = 16

// // And animate the attack!
// animate(I, alpha = 175, pixel_x = 0, pixel_y = 0, pixel_z = 0, time = 3)
// update_icon()
// return TRUE //Found an item, doing item attack animation.

/mob/proc/spin(spintime, speed)
if(speed < world.tick_lag)
Expand Down
3 changes: 0 additions & 3 deletions code/modules/mob/freelook/eye.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@
// we see everything by default
P.SetSight(SEE_TURFS | SEE_MOBS | SEE_OBJS)

/mob
var/mob/observer/eye/eyeobj

/mob/proc/EyeMove(n, direct)
if(!eyeobj)
return
Expand Down
5 changes: 0 additions & 5 deletions code/modules/mob/living/carbon/human/pain.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
/mob/proc/flash_pain()
flick("pain",pain)

/mob/var/list/pain_stored = list()
/mob/var/last_pain_message = ""
/mob/var/next_pain_time = 0


/mob/living/proc/custom_pain(message, power, force)

// message is the custom message to be displayed
Expand Down
60 changes: 60 additions & 0 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,63 @@
//? Movement
/// Is self-moving.
var/in_selfmove

var/is_jittery = 0
var/jitteriness = 0

//handles up-down floaty effect in space and zero-gravity
var/is_floating = 0
var/floatiness = 0

var/dizziness = 0
var/is_dizzy = 0

// used when venting rooms
var/tmp/last_airflow_stun = 0

catalogue_delay = 10 SECONDS

var/mob/observer/eye/eyeobj

//thou shall always be able to see the Geometer of Blood
var/image/narsimage = null
var/image/narglow = null

//Moved from code\modules\detectivework\tools\rag.dm
var/bloody_hands = 0
var/mob/living/carbon/human/bloody_hands_mob
var/track_blood = 0
var/list/feet_blood_DNA
var/track_blood_type
var/feet_blood_color

//Moved from code\modules\keybindings\focus.dm
/// What receives our keyboard inputs, defaulting to src.
var/datum/key_focus
/// a singular thing that can intercept keyboard inputs
var/datum/key_intercept

//Moved from code\game\click\click.dm
// 1 decisecond click delay (above and beyond mob/next_move)
var/next_click = 0

//Moved from code\game\rendering\legacy\alert.dm
var/list/alerts = list() // contains /atom/movable/screen/alert only // On /mob so clientless mobs will throw alerts properly

//Moved from code\game\verbs\suicide.dm
var/suiciding = 0

//Moved from code\modules\admin\admin_attack_log.dm
var/lastattacker = null
var/lastattacked = null
var/attack_log = list( )
var/dialogue_log = list( )

//Moved from code\modules\mob\living\carbon\human\pain.dm
var/list/pain_stored = list()
var/last_pain_message = ""
var/next_pain_time = 0

//Moved from code\modules\nano\nanoexternal.dm
// Used by the Nano UI Manager (/datum/nanomanager) to track UIs opened by this mob
var/list/open_uis = list()
3 changes: 0 additions & 3 deletions code/modules/nano/nanoexternal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,3 @@
*/
/datum/proc/nano_ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/nanoui/master_ui = null, var/datum/topic_state/state = default_state)
return

// Used by the Nano UI Manager (/datum/nanomanager) to track UIs opened by this mob
/mob/var/list/open_uis = list()
4 changes: 4 additions & 0 deletions code/modules/preferences/preferences_toggle_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
set desc = "Allows user to manually enable drunkenness, stutter, jitter, etc."
set src = usr

if(!IS_CONSCIOUS(src))
to_chat(src, "You need to be conscious to do that")
return

var/list/choices = list("Drunkenness", "Stuttering", "Jittering")
if(src.slurring >= 10 || src.stuttering >= 10 || src.jitteriness >= 100)
var/disable = alert(src, "Stop performing impairment? (Do NOT abuse this)", "Impairments", "Yes", "No")
Expand Down

0 comments on commit 391293b

Please sign in to comment.