56 NPCs.bb
@@ -597,7 +597,7 @@ Function CreateNPC.NPCs(NPCtype%, x#, y#, z#)

MeshCullBox (n\obj, -MeshWidth(n\obj), -MeshHeight(n\obj), -MeshDepth(n\obj), MeshWidth(n\obj)*2, MeshHeight(n\obj)*2, MeshDepth(n\obj)*2)

SetNPCFrame n,9
SetNPCFrame n,11

n\Sound = LoadSound_Strict("SFX\SCP\049\0492Breath.ogg")
;[End Block]
@@ -1140,11 +1140,13 @@ Function UpdateNPCs()
n\Frame = 110
;SetAnimTime n\obj, 110.0

If (Not PlayerRoom\RoomTemplate\DisableDecals) Then
If (SelectedDifficulty\aggressiveNPCs) Then
n\State=n\State-FPSfactor*2
Else
n\State=n\State-FPSfactor
If (Not PlayerRoom\RoomTemplate\DisableDecals) Then
If PlayerRoom\RoomTemplate\Name <> "gatea"
If (SelectedDifficulty\aggressiveNPCs) Then
n\State=n\State-FPSfactor*2
Else
n\State=n\State-FPSfactor
EndIf
EndIf
EndIf
End If
@@ -4475,9 +4477,9 @@ Function UpdateNPCs()

Select n\State
Case 0 ;Lying next to the wall
SetNPCFrame(n,9)
SetNPCFrame(n,11)
Case 1 ;Standing up
AnimateNPC(n,9,30,0.1,False)
AnimateNPC(n,11,32,0.1,False)
If n\Frame => 29
n\State = 2
EndIf
@@ -4492,12 +4494,14 @@ Function UpdateNPCs()
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 20.0), 0

AnimateNPC(n, 61, 112, n\CurrSpeed*30)
AnimateNPC(n, 64, 93, n\CurrSpeed*30)
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor

If EntityDistance(n\Collider,Collider)<1.0
n\State = 3
If (Abs(DeltaYaw(n\Collider,Collider))<=60.0)
n\State = 3
EndIf
EndIf

n\PathTimer = 0
@@ -4516,7 +4520,7 @@ Function UpdateNPCs()
PointEntity n\obj, n\Path[n\PathLocation]\obj
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 20.0), 0

AnimateNPC(n, 61, 112, n\CurrSpeed*30)
AnimateNPC(n, 64, 93, n\CurrSpeed*30)
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor

@@ -4546,7 +4550,7 @@ Function UpdateNPCs()
;EndIf
EndIf
Else
AnimateNPC(n, 152, 173, 0.2, True)
AnimateNPC(n, 323, 344, 0.2, True)
n\CurrSpeed = 0
If n\PathTimer < 70*5
n\PathTimer = n\PathTimer + Rnd(1,2+(2*SelectedDifficulty\aggressiveNPCs))*FPSfactor
@@ -4568,15 +4572,15 @@ Function UpdateNPCs()
EndIf

If n\CurrSpeed > 0.005 Then
If (prevFrame < 72 And n\Frame=>72) Or (prevFrame < 85 And n\Frame=>85) Or (prevFrame < 98 And n\Frame > 98) Or (prevFrame > 110 And n\Frame<62)
If (prevFrame < 80 And n\Frame=>80) Or (prevFrame > 92 And n\Frame<65)
PlaySound2(StepSFX(0,0,Rand(0,7)),Camera, n\Collider, 8.0, Rnd(0.3,0.5))
EndIf
EndIf

n\SoundChn = LoopSound2(n\Sound,n\SoundChn,Camera,n\Collider)
Case 3 ;Attacking
AnimateNPC(n, 113, 151, 0.2, False)
If (n\Frame => 127 And prevFrame < 127) Or (n\Frame => 135 And prevFrame < 135)
AnimateNPC(n, 126, 165, 0.4, False)
If (n\Frame => 146 And prevFrame < 146)
If EntityDistance(n\Collider,Collider)<1.1
If (Abs(DeltaYaw(n\Collider,Collider))<=60.0)
PlaySound_Strict DamageSFX(Rand(5,8))
@@ -4585,8 +4589,16 @@ Function UpdateNPCs()
DeathMSG = "Subject D-9341. Cause of death: multiple lacerations and severe blunt force trauma caused by [DATA EXPUNGED], who was infected with SCP-008. Said subject was located by Nine-Tailed Fox and terminated."
EndIf
EndIf
ElseIf n\Frame => 150
n\State = 2
ElseIf n\Frame => 164
If EntityDistance(n\Collider,Collider)<1.1
If (Abs(DeltaYaw(n\Collider,Collider))<=60.0)
SetNPCFrame(n,126)
Else
n\State = 2
EndIf
Else
n\State = 2
EndIf
EndIf
Case 4 ;Idling
HideEntity n\obj
@@ -7020,7 +7032,11 @@ End Function




;~IDEal Editor Parameters:
;~F#0
;~B#197#129F#1339#13D2#1586#1691#1852#18AE
;~C#Blitz3D
;~F#0#A#4F#6B#85#95#C5#D5#DE#EC#FB#10F#12F#159#16D#18A#1CB#1E2#203#226
;~F#230#248#25C#27C#2AC#3A0#49B#5FE#803#89E#9FB#A00#A37#AD9#B15#BA8#C14#D28#DF7#EAE
;~F#F61#107F#1088#1248#126F#127A#12A2#12B5#12B6#1313#1472#15BE#1640#169F#171F#174F#1775#178E#180E#18BC
;~F#1946#1957#1971#1982#198C#19AD#1A18#1A99#1AB2#1ACB#1AD9#1AF5#1B07#1B2B#1B4E#1B5C
;~B#197#12A9#1343#13DC#1590#169B#185C#18B8
;~C#Blitz3D
@@ -1496,7 +1496,7 @@ Function UpdateEvents()
EndIf
EndIf
EndIf

If WearingNightVision > 0 Then
Local hasBatteryFor895% = 0
For i% = 0 To MaxItemAmount - 1
@@ -1509,42 +1509,39 @@ Function UpdateEvents()
EndIf
EndIf
Next
;If EntityVisible(Camera,e\room\Objects[2]) Then
;If EntityInView(e\room\Objects[2], Camera) Then
;If EntityVisible(Camera,e\room\Objects[1])
If (CoffinDistance < 4.0) And (hasBatteryFor895) Then

Sanity = Sanity-(FPSfactor*1.1/WearingNightVision)
BlurTimer = Sin(MilliSecs2()/10)*Abs(Sanity)

tempF# = point_direction(EntityX(Collider,True),EntityZ(Collider,True),EntityX(e\room\Objects[1],True),EntityZ(e\room\Objects[1],True))
tempF2# = EntityYaw(Collider)
tempF3# = angleDist(tempF+90+Sin(WrapAngle(e\EventState3/10)),tempF2)

TurnEntity Collider, 0,tempF3/4,0,True

tempF# = Abs(point_distance(EntityX(Collider,True),EntityZ(Collider,True),EntityX(e\room\Objects[1],True),EntityZ(e\room\Objects[1],True)))
tempF2# = -60.0 * Min(Max((2.0-tempF)/2.0,0.0),1.0)

user_camera_pitch=(user_camera_pitch * 0.8)+(tempF2 * 0.2)

If (Rand(Int(Max(tempF*100.0,1.0)))=1) And (e\EventState3<0.0) Then
EntityTexture(NVOverlay, GorePics(Rand(0, 5)))
PlaySound_Strict(HorrorSFX(1))
e\EventState3 = 10.0
EntityColor(NVOverlay, 255,255,255)
EndIf
If Sanity < (-1000) Then
If WearingNightVision > 1
DeathMSG = Chr(34)+"Class D viewed SCP-895 through a pair of digital night vision goggles, presumably enhanced by SCP-914. It might be possible that the subject"
DeathMSG = DeathMSG + "was able to resist the memetic effects partially through these goggles. The goggles have been stored for further study."+Chr(34)
Else
DeathMSG = Chr(34)+"Class D viewed SCP-895 through a pair of digital night vision goggles, killing him."+Chr(34)
EndIf
Kill()
If (CoffinDistance < 4.0) And (hasBatteryFor895) And (Not Wearing714) Then

Sanity = Sanity-(FPSfactor*1.1/WearingNightVision)
RestoreSanity = False
BlurTimer = Sin(MilliSecs2()/10)*Abs(Sanity)

tempF# = point_direction(EntityX(Collider,True),EntityZ(Collider,True),EntityX(e\room\Objects[1],True),EntityZ(e\room\Objects[1],True))
tempF2# = EntityYaw(Collider)
tempF3# = angleDist(tempF+90+Sin(WrapAngle(e\EventState3/10)),tempF2)

TurnEntity Collider, 0,tempF3/4,0,True

tempF# = Abs(point_distance(EntityX(Collider,True),EntityZ(Collider,True),EntityX(e\room\Objects[1],True),EntityZ(e\room\Objects[1],True)))
tempF2# = -60.0 * Min(Max((2.0-tempF)/2.0,0.0),1.0)

user_camera_pitch=(user_camera_pitch * 0.8)+(tempF2 * 0.2)

If (Rand(Int(Max(tempF*100.0,1.0)))=1) And (e\EventState3<0.0) Then
EntityTexture(NVOverlay, GorePics(Rand(0, 5)))
PlaySound_Strict(HorrorSFX(1))
e\EventState3 = 10.0
EntityColor(NVOverlay, 255,255,255)
EndIf
If Sanity < (-1000) Then
If WearingNightVision > 1
DeathMSG = Chr(34)+"Class D viewed SCP-895 through a pair of digital night vision goggles, presumably enhanced by SCP-914. It might be possible that the subject"
DeathMSG = DeathMSG + "was able to resist the memetic effects partially through these goggles. The goggles have been stored for further study."+Chr(34)
Else
DeathMSG = Chr(34)+"Class D viewed SCP-895 through a pair of digital night vision goggles, killing him."+Chr(34)
EndIf
Kill()
EndIf
;EndIf
EndIf
EndIf

If e\EventState3>0.0 Then e\EventState3=Max(e\EventState3-FPSfactor,0.0)
@@ -7906,13 +7903,48 @@ Function UpdateEvents()
Else
CatchErrors("Deleted event")
EndIf

Next

;This here is necessary because the 294 drinks with explosion effect didn't worked anymore - ENDSHN
If ExplosionTimer > 0 Then
ExplosionTimer = ExplosionTimer+FPSfactor

If ExplosionTimer < 140.0 Then
If ExplosionTimer-FPSfactor < 5.0 Then
ExplosionSFX = LoadSound_Strict("SFX\Ending\GateB\Nuke1.ogg")
PlaySound_Strict ExplosionSFX
CameraShake = 10.0
ExplosionTimer = 5.0
EndIf

CameraShake = CurveValue(ExplosionTimer/60.0,CameraShake, 50.0)
Else
CameraShake = Min((ExplosionTimer/20.0),20.0)
If ExplosionTimer-FPSfactor < 140.0 Then
BlinkTimer = 1.0
ExplosionSFX = LoadSound_Strict("SFX\Ending\GateB\Nuke2.ogg")
PlaySound_Strict ExplosionSFX
For i = 0 To (10+(10*(ParticleAmount+1)))
p.Particles = CreateParticle(EntityX(Collider)+Rnd(-0.5,0.5),EntityY(Collider)-Rnd(0.2,1.5),EntityZ(Collider)+Rnd(-0.5,0.5),0, Rnd(0.2,0.6), 0.0, 350)
RotateEntity p\pvt,-90,0,0,True
p\speed = Rnd(0.05,0.07)
Next
EndIf
LightFlash = Min((ExplosionTimer-140.0)/10.0,5.0)

If ExplosionTimer > 160 Then KillTimer = Min(KillTimer,-0.1)
If ExplosionTimer > 500 Then ExplosionTimer = 0

;a dirty workaround to prevent the collider from falling down into the facility once the nuke goes off,
;causing the UpdateEvent function to be called again and crashing the game
PositionEntity Collider, EntityX(Collider), 200, EntityZ(Collider)
EndIf
EndIf

End Function

Function UpdateDimension1499()
Local e.Events,n.NPCs,r.Rooms
Local e.Events,n.NPCs,r.Rooms,it.Items

For e.Events = Each Events
If e\EventName = "dimension1499"
@@ -7972,6 +8004,15 @@ Function UpdateDimension1499()
PositionEntity Collider,EntityX(Collider),800.5,EntityZ(Collider),True
ResetEntity Collider
EndIf
;A hacky fix to make items not fall that are in dimension1499
For it.Items = Each Items
If EntityY(it\collider)>750.0
If EntityY(it\collider)<800.0
PositionEntity it\collider,EntityX(it\collider),800.5,EntityZ(it\collider)
ResetEntity it\collider
EndIf
EndIf
Next
Else
DropSpeed = 0
EndIf
@@ -8455,10 +8496,11 @@ Function UpdateEndings()
Next

For n.NPCs = Each NPCs
If n <> Curr106
If n <> Curr106 And n <> Curr173
RemoveNPC(n)
EndIf
Next
Curr173\Idle = True

CameraFogMode(Camera, 0)
SecondaryLightOn = True