mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
Merge pull request #2936 from MrPerson/jitterbug_dizzydummies
Redo of jitteriness and dizziness.
This commit is contained in:
@@ -33,5 +33,5 @@ Bonus
|
||||
M << "<span class='notice'>[pick("You feel dizzy.", "Your head starts spinning.")]</span>"
|
||||
else
|
||||
M << "<span class='notice'>You are unable to look straight!</span>"
|
||||
M.make_dizzy(5)
|
||||
M.Dizzy(5)
|
||||
return
|
||||
@@ -343,7 +343,7 @@
|
||||
if(!M.mind || !M.mind.changeling)
|
||||
M.ear_deaf += 30
|
||||
M.confused += 20
|
||||
M.make_jittery(50)
|
||||
M.Jitter(50)
|
||||
else
|
||||
M << sound('sound/effects/screech.ogg')
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/obj/item/weapon/melee/cultblade/pickup(mob/living/user as mob)
|
||||
if(!iscultist(user))
|
||||
user << "\red An overwhelming feeling of dread comes over you as you pick up the cultist's sword. It would be wise to be rid of this blade quickly."
|
||||
user.make_dizzy(120)
|
||||
user.Dizzy(120)
|
||||
|
||||
|
||||
/obj/item/clothing/head/culthood
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
if(!istype(target, /obj) && !istype(target, /mob)) return
|
||||
if(istype(target, /mob))
|
||||
var/mob/M = target
|
||||
M.make_dizzy(3)
|
||||
M.Dizzy(3)
|
||||
M.adjustBruteLoss(1)
|
||||
M.updatehealth()
|
||||
for (var/mob/V in viewers(src))
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
M.Stun(10)
|
||||
M.Paralyse(4)
|
||||
else
|
||||
M.make_jittery(500)
|
||||
M.Jitter(500)
|
||||
/* //else the mousetraps are useless
|
||||
if(istype(M, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = M
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
/* 21st Sept 2010
|
||||
Updated by Skie -- Still not perfect but better!
|
||||
Stuff you can't do:
|
||||
Call proc /mob/proc/make_dizzy() for some player
|
||||
Call proc /mob/proc/Dizzy() for some player
|
||||
Because if you select a player mob as owner it tries to do the proc for
|
||||
/mob/living/carbon/human/ instead. And that gives a run-time error.
|
||||
But you can call procs that are of type /mob/living/carbon/human/proc/ for that player.
|
||||
|
||||
@@ -182,12 +182,12 @@
|
||||
msg += "[t_He] [t_is] wearing \icon[wear_id] \a [wear_id].\n"
|
||||
|
||||
//Jitters
|
||||
if(is_jittery)
|
||||
if(jitteriness >= 300)
|
||||
switch(jitteriness)
|
||||
if(300 to INFINITY)
|
||||
msg += "<span class='warning'><B>[t_He] [t_is] convulsing violently!</B></span>\n"
|
||||
else if(jitteriness >= 200)
|
||||
if(200 to 300)
|
||||
msg += "<span class='warning'>[t_He] [t_is] extremely jittery.</span>\n"
|
||||
else if(jitteriness >= 100)
|
||||
if(100 to 200)
|
||||
msg += "<span class='warning'>[t_He] [t_is] twitching ever so slightly.</span>\n"
|
||||
|
||||
if(suiciding)
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
else
|
||||
return ONE_ATMOSPHERE - pressure_difference
|
||||
|
||||
|
||||
/mob/living/carbon/human
|
||||
|
||||
proc/handle_disabilities()
|
||||
@@ -130,30 +131,23 @@
|
||||
continue
|
||||
O.show_message(text("\red <B>[src] starts having a seizure!"), 1)
|
||||
Paralyse(10)
|
||||
make_jittery(1000)
|
||||
Jitter(1000)
|
||||
if (disabilities & COUGHING)
|
||||
if ((prob(5) && paralysis <= 1))
|
||||
drop_item()
|
||||
spawn( 0 )
|
||||
emote("cough")
|
||||
return
|
||||
emote("cough")
|
||||
if (disabilities & TOURETTES)
|
||||
if ((prob(10) && paralysis <= 1))
|
||||
Stun(10)
|
||||
spawn( 0 )
|
||||
switch(rand(1, 3))
|
||||
if(1)
|
||||
emote("twitch")
|
||||
if(2 to 3)
|
||||
say("[prob(50) ? ";" : ""][pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS")]")
|
||||
var/old_x = pixel_x
|
||||
var/old_y = pixel_y
|
||||
pixel_x += rand(-2,2)
|
||||
pixel_y += rand(-1,1)
|
||||
sleep(2)
|
||||
pixel_x = old_x
|
||||
pixel_y = old_y
|
||||
return
|
||||
switch(rand(1, 3))
|
||||
if(1)
|
||||
emote("twitch")
|
||||
if(2 to 3)
|
||||
say("[prob(50) ? ";" : ""][pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS")]")
|
||||
var/x_offset = pixel_x + rand(-2,2) //Should probably be moved into the twitch emote at some point.
|
||||
var/y_offset = pixel_y + rand(-1,1)
|
||||
animate(src, pixel_x = pixel_x + x_offset, pixel_y = pixel_y + y_offset, time = 1)
|
||||
animate(pixel_x = pixel_x - x_offset, pixel_y = pixel_y - y_offset, time = 1)
|
||||
if (disabilities & NERVOUS)
|
||||
if (prob(10))
|
||||
stuttering = max(10, stuttering)
|
||||
@@ -912,6 +906,50 @@
|
||||
else if(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs
|
||||
ear_damage = max(ear_damage-0.05, 0)
|
||||
|
||||
//Dizziness
|
||||
if(dizziness)
|
||||
var/client/C = client
|
||||
var/pixel_x_diff = 0
|
||||
var/pixel_y_diff = 0
|
||||
var/temp
|
||||
var/saved_dizz = dizziness
|
||||
dizziness = max(dizziness-1, 0)
|
||||
if(C)
|
||||
var/oldsrc = src
|
||||
var/amplitude = dizziness*(sin(dizziness * 0.044 * world.time) + 1) / 70 // This shit is annoying at high strength
|
||||
src = null
|
||||
spawn(0)
|
||||
if(C)
|
||||
temp = amplitude * sin(0.008 * saved_dizz * world.time)
|
||||
pixel_x_diff += temp
|
||||
C.pixel_x += temp
|
||||
temp = amplitude * cos(0.008 * saved_dizz * world.time)
|
||||
pixel_y_diff += temp
|
||||
C.pixel_y += temp
|
||||
sleep(3)
|
||||
if(C)
|
||||
temp = amplitude * sin(0.008 * saved_dizz * world.time)
|
||||
pixel_x_diff += temp
|
||||
C.pixel_x += temp
|
||||
temp = amplitude * cos(0.008 * saved_dizz * world.time)
|
||||
pixel_y_diff += temp
|
||||
C.pixel_y += temp
|
||||
sleep(3)
|
||||
if(C)
|
||||
C.pixel_x -= pixel_x_diff
|
||||
C.pixel_y -= pixel_y_diff
|
||||
src = oldsrc
|
||||
|
||||
//Jitteryness
|
||||
if(jitteriness)
|
||||
var/amplitude = min(4, (jitteriness/100) + 1)
|
||||
var/pixel_x_diff = rand(-amplitude, amplitude)
|
||||
var/pixel_y_diff = rand(-amplitude/3, amplitude/3)
|
||||
|
||||
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = -1)
|
||||
animate(pixel_x = pixel_x - pixel_x_diff, pixel_y = pixel_y - pixel_y_diff, time = 2)
|
||||
jitteriness = max(jitteriness-1, 0)
|
||||
|
||||
//Other
|
||||
if(stunned)
|
||||
AdjustStunned(-1)
|
||||
|
||||
+5
-73
@@ -569,79 +569,6 @@ var/list/slot_equipment_priority = list( \
|
||||
for(var/mob/M in viewers())
|
||||
M.see(message)
|
||||
|
||||
/*
|
||||
adds a dizziness amount to a mob
|
||||
use this rather than directly changing var/dizziness
|
||||
since this ensures that the dizzy_process proc is started
|
||||
currently only humans get dizzy
|
||||
|
||||
value of dizziness ranges from 0 to 1000
|
||||
below 100 is not dizzy
|
||||
*/
|
||||
/mob/proc/make_dizzy(var/amount)
|
||||
if(!istype(src, /mob/living/carbon/human)) // for the moment, only humans get dizzy
|
||||
return
|
||||
|
||||
dizziness = min(1000, dizziness + amount) // store what will be new value
|
||||
// clamped to max 1000
|
||||
if(dizziness > 100 && !is_dizzy)
|
||||
spawn(0)
|
||||
dizzy_process()
|
||||
|
||||
|
||||
/*
|
||||
dizzy process - wiggles the client's pixel offset over time
|
||||
spawned from make_dizzy(), will terminate automatically when dizziness gets <100
|
||||
note dizziness decrements automatically in the mob's Life() proc.
|
||||
*/
|
||||
/mob/proc/dizzy_process()
|
||||
is_dizzy = 1
|
||||
while(dizziness > 100)
|
||||
if(client)
|
||||
var/amplitude = dizziness*(sin(dizziness * 0.044 * world.time) + 1) / 70
|
||||
client.pixel_x = amplitude * sin(0.008 * dizziness * world.time)
|
||||
client.pixel_y = amplitude * cos(0.008 * dizziness * world.time)
|
||||
|
||||
sleep(1)
|
||||
//endwhile - reset the pixel offsets to zero
|
||||
is_dizzy = 0
|
||||
if(client)
|
||||
client.pixel_x = 0
|
||||
client.pixel_y = 0
|
||||
|
||||
// jitteriness - copy+paste of dizziness
|
||||
|
||||
/mob/proc/make_jittery(var/amount)
|
||||
if(!istype(src, /mob/living/carbon/human)) // for the moment, only humans get dizzy
|
||||
return
|
||||
|
||||
jitteriness = min(1000, jitteriness + amount) // store what will be new value
|
||||
// clamped to max 1000
|
||||
if(jitteriness > 100 && !is_jittery)
|
||||
spawn(0)
|
||||
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
|
||||
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 = rand(-amplitude, amplitude)
|
||||
pixel_y = rand(-amplitude/3, amplitude/3)
|
||||
|
||||
sleep(1)
|
||||
//endwhile - reset the pixel offsets to zero
|
||||
is_jittery = 0
|
||||
pixel_x = old_x
|
||||
pixel_y = old_y
|
||||
|
||||
/mob/Stat()
|
||||
..()
|
||||
|
||||
@@ -768,6 +695,11 @@ note dizziness decrements automatically in the mob's Life() proc.
|
||||
/mob/proc/IsAdvancedToolUser()//This might need a rename but it should replace the can this mob use things check
|
||||
return 0
|
||||
|
||||
/mob/proc/Jitter(amount)
|
||||
jitteriness = max(jitteriness,amount,0)
|
||||
|
||||
/mob/proc/Dizzy(amount)
|
||||
dizziness = max(dizziness,amount,0)
|
||||
|
||||
/mob/proc/Stun(amount)
|
||||
if(status_flags & CANSTUN)
|
||||
|
||||
@@ -74,8 +74,6 @@
|
||||
var/bodytemperature = 310.055 //98.7 F
|
||||
var/drowsyness = 0//Carbon
|
||||
var/dizziness = 0//Carbon
|
||||
var/is_dizzy = 0
|
||||
var/is_jittery = 0
|
||||
var/jitteriness = 0//Carbon
|
||||
var/nutrition = 400//Carbon
|
||||
|
||||
@@ -167,4 +165,4 @@
|
||||
var/robot_talk_understand = 0
|
||||
var/alien_talk_understand = 0
|
||||
|
||||
var/turf/listed_turf = null //the current turf being examined in the stat panel
|
||||
var/turf/listed_turf = null //the current turf being examined in the stat panel
|
||||
|
||||
@@ -266,7 +266,7 @@ datum
|
||||
if(data >= 30)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.stuttering += 4
|
||||
M.make_dizzy(5)
|
||||
M.Dizzy(5)
|
||||
if(data >= 30*2.5 && prob(33))
|
||||
if (!M.confused) M.confused = 1
|
||||
M.confused += 3
|
||||
@@ -825,7 +825,7 @@ datum
|
||||
|
||||
on_mob_life(var/mob/living/M as mob)
|
||||
if(!M) M = holder.my_atom
|
||||
M.make_dizzy(1)
|
||||
M.Dizzy(1)
|
||||
if(!M.confused) M.confused = 1
|
||||
M.confused = max(M.confused, 20)
|
||||
holder.remove_reagent(src.id, 0.5 * REAGENTS_METABOLISM)
|
||||
@@ -1151,8 +1151,8 @@ datum
|
||||
M.status_flags &= ~DISFIGURED
|
||||
if(35 to INFINITY)
|
||||
M.adjustToxLoss(1)
|
||||
M.make_dizzy(5)
|
||||
M.make_jittery(5)
|
||||
M.Dizzy(5)
|
||||
M.Jitter(5)
|
||||
|
||||
..()
|
||||
return
|
||||
@@ -1995,18 +1995,18 @@ datum
|
||||
switch(data)
|
||||
if(1 to 5)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.make_dizzy(5)
|
||||
M.Dizzy(5)
|
||||
if(prob(10)) M.emote(pick("twitch","giggle"))
|
||||
if(5 to 10)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.make_jittery(10)
|
||||
M.make_dizzy(10)
|
||||
M.Jitter(10)
|
||||
M.Dizzy(10)
|
||||
M.druggy = max(M.druggy, 35)
|
||||
if(prob(20)) M.emote(pick("twitch","giggle"))
|
||||
if (10 to INFINITY)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.make_jittery(20)
|
||||
M.make_dizzy(20)
|
||||
M.Jitter(20)
|
||||
M.Dizzy(20)
|
||||
M.druggy = max(M.druggy, 40)
|
||||
if(prob(30)) M.emote(pick("twitch","giggle"))
|
||||
holder.remove_reagent(src.id, 0.2)
|
||||
@@ -2394,7 +2394,7 @@ datum
|
||||
M.sleeping = max(0,M.sleeping - 2)
|
||||
if (M.bodytemperature < 310)//310 is the normal bodytemp. 310.055
|
||||
M.bodytemperature = min(310, M.bodytemperature + (25 * TEMPERATURE_DAMAGE_COEFFICIENT))
|
||||
M.make_jittery(5)
|
||||
M.Jitter(5)
|
||||
if(holder.has_reagent("frostoil"))
|
||||
holder.remove_reagent("frostoil", 5)
|
||||
..()
|
||||
@@ -2434,7 +2434,7 @@ datum
|
||||
M.sleeping = max(0,M.sleeping-2)
|
||||
if (M.bodytemperature > 310)//310 is the normal bodytemp. 310.055
|
||||
M.bodytemperature = max(310, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT))
|
||||
M.make_jittery(5)
|
||||
M.Jitter(5)
|
||||
..()
|
||||
return
|
||||
|
||||
@@ -2479,7 +2479,7 @@ datum
|
||||
color = "#100800" // rgb: 16, 8, 0
|
||||
|
||||
on_mob_life(var/mob/living/M as mob)
|
||||
M.make_jittery(20)
|
||||
M.Jitter(20)
|
||||
M.druggy = max(M.druggy, 30)
|
||||
M.dizziness +=5
|
||||
M.drowsyness = 0
|
||||
@@ -2502,7 +2502,7 @@ datum
|
||||
M.sleeping = max(0,M.sleeping-1)
|
||||
if (M.bodytemperature > 310)
|
||||
M.bodytemperature = max(310, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT))
|
||||
M.make_jittery(5)
|
||||
M.Jitter(5)
|
||||
M.nutrition += 1
|
||||
..()
|
||||
return
|
||||
@@ -2608,7 +2608,7 @@ datum
|
||||
M.sleeping = 0
|
||||
if (M.bodytemperature < 310)//310 is the normal bodytemp. 310.055
|
||||
M.bodytemperature = min(310, M.bodytemperature + (5 * TEMPERATURE_DAMAGE_COEFFICIENT))
|
||||
M.make_jittery(5)
|
||||
M.Jitter(5)
|
||||
if(M.getBruteLoss() && prob(20)) M.heal_organ_damage(1,0)
|
||||
M.nutrition++
|
||||
..()
|
||||
@@ -2628,7 +2628,7 @@ datum
|
||||
M.sleeping = 0
|
||||
if (M.bodytemperature < 310)//310 is the normal bodytemp. 310.055
|
||||
M.bodytemperature = min(310, M.bodytemperature + (5 * TEMPERATURE_DAMAGE_COEFFICIENT))
|
||||
M.make_jittery(5)
|
||||
M.Jitter(5)
|
||||
if(M.getBruteLoss() && prob(20)) M.heal_organ_damage(1,0)
|
||||
M.nutrition++
|
||||
..()
|
||||
@@ -2664,7 +2664,7 @@ datum
|
||||
on_mob_life(var/mob/living/M as mob)
|
||||
M.druggy = max(M.druggy, 50)
|
||||
M.confused = max(M.confused+2,0)
|
||||
M.make_dizzy(10)
|
||||
M.Dizzy(10)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.stuttering += 3
|
||||
if(!data) data = 1
|
||||
@@ -2741,24 +2741,24 @@ datum
|
||||
switch(data)
|
||||
if(1 to 5)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.make_dizzy(10)
|
||||
M.Dizzy(10)
|
||||
if(prob(10)) M.emote(pick("twitch","giggle"))
|
||||
if(5 to 10)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.make_jittery(20)
|
||||
M.make_dizzy(20)
|
||||
M.Jitter(20)
|
||||
M.Dizzy(20)
|
||||
M.druggy = max(M.druggy, 45)
|
||||
if(prob(20)) M.emote(pick("twitch","giggle"))
|
||||
if (10 to 200)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.make_jittery(40)
|
||||
M.make_dizzy(40)
|
||||
M.Jitter(40)
|
||||
M.Dizzy(40)
|
||||
M.druggy = max(M.druggy, 60)
|
||||
if(prob(30)) M.emote(pick("twitch","giggle"))
|
||||
if(200 to INFINITY)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.make_jittery(60)
|
||||
M.make_dizzy(60)
|
||||
M.Jitter(60)
|
||||
M.Dizzy(60)
|
||||
M.druggy = max(M.druggy, 75)
|
||||
if(prob(40)) M.emote(pick("twitch","giggle"))
|
||||
if(prob(30)) M.adjustToxLoss(2)
|
||||
@@ -2789,7 +2789,7 @@ datum
|
||||
if(data >= boozepwr)
|
||||
if (!M.stuttering) M.stuttering = 1
|
||||
M.stuttering += 4
|
||||
M.make_dizzy(5)
|
||||
M.Dizzy(5)
|
||||
if(data >= boozepwr*2.5 && prob(33))
|
||||
if (!M.confused) M.confused = 1
|
||||
M.confused += 3
|
||||
@@ -2841,7 +2841,7 @@ datum
|
||||
M.dizziness = max(0,M.dizziness-5)
|
||||
M.drowsyness = max(0,M.drowsyness-3)
|
||||
M.sleeping = max(0,M.sleeping-2)
|
||||
M.make_jittery(5)
|
||||
M.Jitter(5)
|
||||
..()
|
||||
return
|
||||
|
||||
@@ -2864,7 +2864,7 @@ datum
|
||||
M.sleeping = max(0,M.sleeping-2)
|
||||
if (M.bodytemperature > 310)
|
||||
M.bodytemperature = max(310, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT))
|
||||
M.make_jittery(5)
|
||||
M.Jitter(5)
|
||||
M.nutrition += 1
|
||||
..()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user