Gets rid of the sleep() altogether and also that client rotation thing that breaks everything

This commit is contained in:
Screemonster
2018-02-20 10:15:17 +00:00
parent 6769c04a44
commit 421aa33c40
2 changed files with 176 additions and 177 deletions

View File

@@ -159,187 +159,188 @@
handling_hal = 1 handling_hal = 1
if(client && feral >= 10) // largely a copy of handle_hallucinations() without the fake attackers. Unlike hallucinations, only fires once - if they're still feral they'll get hit again anyway. if(client && feral >= 10) // largely a copy of handle_hallucinations() without the fake attackers. Unlike hallucinations, only fires once - if they're still feral they'll get hit again anyway.
sleep(rand(200,500)/(feral/10)) spawn(rand(200,500)/(feral/10))
var/halpick = rand(1,100) var/halpick = rand(1,100)
switch(halpick) switch(halpick)
if(0 to 15) //15% chance if(0 to 15) //15% chance
//Screwy HUD //Screwy HUD
//src << "Screwy HUD" //src << "Screwy HUD"
hal_screwyhud = pick(1,2,3,3,4,4) hal_screwyhud = pick(1,2,3,3,4,4)
spawn(rand(100,250)) spawn(rand(100,250))
hal_screwyhud = 0 hal_screwyhud = 0
if(16 to 25) //10% chance if(16 to 25) //10% chance
//Strange items //Strange items
//src << "Traitor Items" //src << "Traitor Items"
if(!halitem) if(!halitem)
halitem = new halitem = new
var/list/slots_free = list(ui_lhand,ui_rhand) var/list/slots_free = list(ui_lhand,ui_rhand)
if(l_hand) slots_free -= ui_lhand if(l_hand) slots_free -= ui_lhand
if(r_hand) slots_free -= ui_rhand if(r_hand) slots_free -= ui_rhand
if(istype(src,/mob/living/carbon/human)) if(istype(src,/mob/living/carbon/human))
var/mob/living/carbon/human/H = src var/mob/living/carbon/human/H = src
if(!H.belt) slots_free += ui_belt if(!H.belt) slots_free += ui_belt
if(!H.l_store) slots_free += ui_storage1 if(!H.l_store) slots_free += ui_storage1
if(!H.r_store) slots_free += ui_storage2 if(!H.r_store) slots_free += ui_storage2
if(slots_free.len) if(slots_free.len)
halitem.screen_loc = pick(slots_free) halitem.screen_loc = pick(slots_free)
halitem.layer = 50 halitem.layer = 50
switch(rand(1,6)) switch(rand(1,6))
if(1) //revolver if(1) //revolver
halitem.icon = 'icons/obj/gun.dmi' halitem.icon = 'icons/obj/gun.dmi'
halitem.icon_state = "revolver" halitem.icon_state = "revolver"
halitem.name = "Revolver" halitem.name = "Revolver"
if(2) //c4 if(2) //c4
halitem.icon = 'icons/obj/assemblies.dmi' halitem.icon = 'icons/obj/assemblies.dmi'
halitem.icon_state = "plastic-explosive0" halitem.icon_state = "plastic-explosive0"
halitem.name = "Mysterious Package" halitem.name = "Mysterious Package"
if(prob(25)) if(prob(25))
halitem.icon_state = "c4small_1" halitem.icon_state = "c4small_1"
if(3) //sword if(3) //sword
halitem.icon = 'icons/obj/weapons.dmi' halitem.icon = 'icons/obj/weapons.dmi'
halitem.icon_state = "sword1" halitem.icon_state = "sword1"
halitem.name = "Sword" halitem.name = "Sword"
if(4) //stun baton if(4) //stun baton
halitem.icon = 'icons/obj/weapons.dmi' halitem.icon = 'icons/obj/weapons.dmi'
halitem.icon_state = "stunbaton" halitem.icon_state = "stunbaton"
halitem.name = "Stun Baton" halitem.name = "Stun Baton"
if(5) //emag if(5) //emag
halitem.icon = 'icons/obj/card.dmi' halitem.icon = 'icons/obj/card.dmi'
halitem.icon_state = "emag" halitem.icon_state = "emag"
halitem.name = "Cryptographic Sequencer" halitem.name = "Cryptographic Sequencer"
if(6) //flashbang if(6) //flashbang
halitem.icon = 'icons/obj/grenade.dmi' halitem.icon = 'icons/obj/grenade.dmi'
halitem.icon_state = "flashbang1" halitem.icon_state = "flashbang1"
halitem.name = "Flashbang" halitem.name = "Flashbang"
if(client) client.screen += halitem if(client) client.screen += halitem
spawn(rand(100,250)) spawn(rand(100,250))
if(client) if(client)
client.screen -= halitem client.screen -= halitem
halitem = null halitem = null
if(26 to 35) //10% chance if(26 to 35) //10% chance
//Flashes of danger //Flashes of danger
//src << "Danger Flash" //src << "Danger Flash"
if(!halimage) if(!halimage)
var/list/possible_points = list() var/list/possible_points = list()
for(var/turf/simulated/floor/F in view(src,world.view)) for(var/turf/simulated/floor/F in view(src,world.view))
possible_points += F possible_points += F
if(possible_points.len) if(possible_points.len)
var/turf/simulated/floor/target = pick(possible_points) var/turf/simulated/floor/target = pick(possible_points)
switch(rand(1,3)) switch(rand(1,3))
if(1) if(1)
//src << "Space" //src << "Space"
halimage = image('icons/turf/space.dmi',target,"[rand(1,25)]",TURF_LAYER) halimage = image('icons/turf/space.dmi',target,"[rand(1,25)]",TURF_LAYER)
if(2) if(2)
//src << "Fire" //src << "Fire"
halimage = image('icons/effects/fire.dmi',target,"1",TURF_LAYER) halimage = image('icons/effects/fire.dmi',target,"1",TURF_LAYER)
if(3) if(3)
//src << "C4" //src << "C4"
halimage = image('icons/obj/assemblies.dmi',target,"plastic-explosive2",OBJ_LAYER+0.01) halimage = image('icons/obj/assemblies.dmi',target,"plastic-explosive2",OBJ_LAYER+0.01)
if(client) client.images += halimage if(client) client.images += halimage
spawn(rand(10,50)) //Only seen for a brief moment. spawn(rand(10,50)) //Only seen for a brief moment.
if(client) client.images -= halimage if(client) client.images -= halimage
halimage = null halimage = null
if(36 to 55) //20% chance if(36 to 55) //20% chance
//Strange audio //Strange audio
//src << "Strange Audio" //src << "Strange Audio"
switch(rand(1,12)) switch(rand(1,12))
if(1) src << 'sound/machines/airlock.ogg' if(1) src << 'sound/machines/airlock.ogg'
if(2) if(2)
if(prob(50))src << 'sound/effects/Explosion1.ogg' if(prob(50))src << 'sound/effects/Explosion1.ogg'
else src << 'sound/effects/Explosion2.ogg' else src << 'sound/effects/Explosion2.ogg'
if(3) src << 'sound/effects/explosionfar.ogg' if(3) src << 'sound/effects/explosionfar.ogg'
if(4) src << 'sound/effects/Glassbr1.ogg' if(4) src << 'sound/effects/Glassbr1.ogg'
if(5) src << 'sound/effects/Glassbr2.ogg' if(5) src << 'sound/effects/Glassbr2.ogg'
if(6) src << 'sound/effects/Glassbr3.ogg' if(6) src << 'sound/effects/Glassbr3.ogg'
if(7) src << 'sound/machines/twobeep.ogg' if(7) src << 'sound/machines/twobeep.ogg'
if(8) src << 'sound/machines/windowdoor.ogg' if(8) src << 'sound/machines/windowdoor.ogg'
if(9) if(9)
//To make it more realistic, I added two gunshots (enough to kill) //To make it more realistic, I added two gunshots (enough to kill)
src << 'sound/weapons/Gunshot.ogg'
spawn(rand(10,30))
src << 'sound/weapons/Gunshot.ogg' src << 'sound/weapons/Gunshot.ogg'
if(10) src << 'sound/weapons/smash.ogg' spawn(rand(10,30))
if(11) src << 'sound/weapons/Gunshot.ogg'
//Same as above, but with tasers. if(10) src << 'sound/weapons/smash.ogg'
src << 'sound/weapons/Taser.ogg' if(11)
spawn(rand(10,30)) //Same as above, but with tasers.
src << 'sound/weapons/Taser.ogg' src << 'sound/weapons/Taser.ogg'
//Rare audio spawn(rand(10,30))
if(12) src << 'sound/weapons/Taser.ogg'
//These sounds are (mostly) taken from Hidden: Source //Rare audio
var/list/creepyasssounds = list('sound/effects/ghost.ogg', 'sound/effects/ghost2.ogg', 'sound/effects/Heart Beat.ogg', 'sound/effects/screech.ogg',\ if(12)
'sound/hallucinations/behind_you1.ogg', 'sound/hallucinations/behind_you2.ogg', 'sound/hallucinations/far_noise.ogg', 'sound/hallucinations/growl1.ogg', 'sound/hallucinations/growl2.ogg',\ //These sounds are (mostly) taken from Hidden: Source
'sound/hallucinations/growl3.ogg', 'sound/hallucinations/im_here1.ogg', 'sound/hallucinations/im_here2.ogg', 'sound/hallucinations/i_see_you1.ogg', 'sound/hallucinations/i_see_you2.ogg',\ var/list/creepyasssounds = list('sound/effects/ghost.ogg', 'sound/effects/ghost2.ogg', 'sound/effects/Heart Beat.ogg', 'sound/effects/screech.ogg',\
'sound/hallucinations/look_up1.ogg', 'sound/hallucinations/look_up2.ogg', 'sound/hallucinations/over_here1.ogg', 'sound/hallucinations/over_here2.ogg', 'sound/hallucinations/over_here3.ogg',\ 'sound/hallucinations/behind_you1.ogg', 'sound/hallucinations/behind_you2.ogg', 'sound/hallucinations/far_noise.ogg', 'sound/hallucinations/growl1.ogg', 'sound/hallucinations/growl2.ogg',\
'sound/hallucinations/turn_around1.ogg', 'sound/hallucinations/turn_around2.ogg', 'sound/hallucinations/veryfar_noise.ogg', 'sound/hallucinations/wail.ogg') 'sound/hallucinations/growl3.ogg', 'sound/hallucinations/im_here1.ogg', 'sound/hallucinations/im_here2.ogg', 'sound/hallucinations/i_see_you1.ogg', 'sound/hallucinations/i_see_you2.ogg',\
src << pick(creepyasssounds) 'sound/hallucinations/look_up1.ogg', 'sound/hallucinations/look_up2.ogg', 'sound/hallucinations/over_here1.ogg', 'sound/hallucinations/over_here2.ogg', 'sound/hallucinations/over_here3.ogg',\
if(56 to 60) //5% chance 'sound/hallucinations/turn_around1.ogg', 'sound/hallucinations/turn_around2.ogg', 'sound/hallucinations/veryfar_noise.ogg', 'sound/hallucinations/wail.ogg')
//Flashes of danger src << pick(creepyasssounds)
//src << "Danger Flash" if(56 to 60) //5% chance
if(!halbody) //Flashes of danger
var/list/possible_points = list() //src << "Danger Flash"
for(var/turf/simulated/floor/F in view(src,world.view)) if(!halbody)
possible_points += F var/list/possible_points = list()
if(possible_points.len) for(var/turf/simulated/floor/F in view(src,world.view))
var/turf/simulated/floor/target = pick(possible_points) possible_points += F
switch(rand(1,4)) if(possible_points.len)
if(1) var/turf/simulated/floor/target = pick(possible_points)
halbody = image('icons/mob/human.dmi',target,"husk_l",TURF_LAYER) switch(rand(1,4))
if(2,3) if(1)
halbody = image('icons/mob/human.dmi',target,"husk_s",TURF_LAYER) halbody = image('icons/mob/human.dmi',target,"husk_l",TURF_LAYER)
if(4) if(2,3)
halbody = image('icons/mob/alien.dmi',target,"alienother",TURF_LAYER) halbody = image('icons/mob/human.dmi',target,"husk_s",TURF_LAYER)
// if(5) if(4)
// halbody = image('xcomalien.dmi',target,"chryssalid",TURF_LAYER) halbody = image('icons/mob/alien.dmi',target,"alienother",TURF_LAYER)
// if(5)
// halbody = image('xcomalien.dmi',target,"chryssalid",TURF_LAYER)
if(client) client.images += halbody if(client) client.images += halbody
spawn(rand(50,80)) //Only seen for a brief moment. spawn(rand(50,80)) //Only seen for a brief moment.
if(client) client.images -= halbody if(client) client.images -= halbody
halbody = null halbody = null
if(61 to 85) //25% chance if(61 to 85) //25% chance
//food //food
if(!halbody) if(!halbody)
var/list/possible_points = list() var/list/possible_points = list()
for(var/turf/simulated/floor/F in view(src,world.view)) for(var/turf/simulated/floor/F in view(src,world.view))
possible_points += F possible_points += F
if(possible_points.len) if(possible_points.len)
var/turf/simulated/floor/target = pick(possible_points) var/turf/simulated/floor/target = pick(possible_points)
switch(rand(1,10)) switch(rand(1,10))
if(1) if(1)
halbody = image('icons/mob/animal.dmi',target,"cow",TURF_LAYER) halbody = image('icons/mob/animal.dmi',target,"cow",TURF_LAYER)
if(2) if(2)
halbody = image('icons/mob/animal.dmi',target,"chicken",TURF_LAYER) halbody = image('icons/mob/animal.dmi',target,"chicken",TURF_LAYER)
if(3) if(3)
halbody = image('icons/obj/food.dmi',target,"bigbiteburger",TURF_LAYER) halbody = image('icons/obj/food.dmi',target,"bigbiteburger",TURF_LAYER)
if(4) if(4)
halbody = image('icons/obj/food.dmi',target,"meatbreadslice",TURF_LAYER) halbody = image('icons/obj/food.dmi',target,"meatbreadslice",TURF_LAYER)
if(5) if(5)
halbody = image('icons/obj/food.dmi',target,"sausage",TURF_LAYER) halbody = image('icons/obj/food.dmi',target,"sausage",TURF_LAYER)
if(6) if(6)
halbody = image('icons/obj/food.dmi',target,"bearmeat",TURF_LAYER) halbody = image('icons/obj/food.dmi',target,"bearmeat",TURF_LAYER)
if(7) if(7)
halbody = image('icons/obj/food.dmi',target,"fishfillet",TURF_LAYER) halbody = image('icons/obj/food.dmi',target,"fishfillet",TURF_LAYER)
if(8) if(8)
halbody = image('icons/obj/food.dmi',target,"meat",TURF_LAYER) halbody = image('icons/obj/food.dmi',target,"meat",TURF_LAYER)
if(9) if(9)
halbody = image('icons/obj/food.dmi',target,"meatstake",TURF_LAYER) halbody = image('icons/obj/food.dmi',target,"meatstake",TURF_LAYER)
if(10) if(10)
halbody = image('icons/obj/food.dmi',target,"monkeysdelight",TURF_LAYER) halbody = image('icons/obj/food.dmi',target,"monkeysdelight",TURF_LAYER)
if(client) client.images += halbody
spawn(rand(50,80)) //Only seen for a brief moment.
if(client) client.images -= halbody
halbody = null
if(86 to 100) //15% chance
//hear voices. Could make the voice pick from nearby creatures, but nearby creatures make feral hallucinations rare so don't bother.
var/list/hiddenspeakers = list("Someone distant", "A voice nearby","A familiar voice", "An echoing voice", "A cautious voice", "A scared voice", "Someone around the corner", "Someone", "Something", "Something scary", "An urgent voice", "An angry voice")
var/list/speakerverbs = list("calls out", "yells", "screams", "exclaims", "shrieks", "shouts", "hisses", "snarls")
var/list/spookyphrases = list("It's over here!","Stop it!", "Hunt it down!", "Get it!", "Quick, over here!", "Anyone there?", "Who's there?", "Catch that thing!", "Stop it! Kill it!", "Anyone there?", "Where is it?", "Find it!", "There it is!")
to_chat(src, "<span class='game say'><span class='name'>[pick(hiddenspeakers)]</span> [pick(speakerverbs)], \"[pick(spookyphrases)]\"</span>")
if(client) client.images += halbody
spawn(rand(50,80)) //Only seen for a brief moment.
if(client) client.images -= halbody
halbody = null
if(86 to 100) //15% chance
//disorientation
if(client)
client.dir = pick(2,4,8)
spawn(rand(20,50))
client.dir = 1
handling_hal = 0 handling_hal = 0
return return

View File

@@ -144,11 +144,9 @@
H << "<span class='danger'> Every movement, every flick, every sight and sound has your full attention, your hunting instincts on high alert... In fact, [M] looks extremely appetizing...</span>" H << "<span class='danger'> Every movement, every flick, every sight and sound has your full attention, your hunting instincts on high alert... In fact, [M] looks extremely appetizing...</span>"
if(H.stat == CONSCIOUS) if(H.stat == CONSCIOUS)
H.emote("twitch") H.emote("twitch")
spawn(0)
H.handle_feral()
else // nobody around
spawn(0)
H.handle_feral() H.handle_feral()
else // nobody around
H.handle_feral()
if(prob(2)) //periodic nagmessages if(prob(2)) //periodic nagmessages
if(H.nutrition <= 100) //If hungry, nag them to go and find someone or something to eat. if(H.nutrition <= 100) //If hungry, nag them to go and find someone or something to eat.
H << "<span class='danger'> Confusing sights and sounds and smells surround you - scary and disorienting it may be, but the drive to hunt, to feed, to survive, compels you.</span>" H << "<span class='danger'> Confusing sights and sounds and smells surround you - scary and disorienting it may be, but the drive to hunt, to feed, to survive, compels you.</span>"