Why do bookrotate set a timer to reset the book position

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
Post Reply
i30817
Posts: 58
Joined: 07 Nov 2018, 05:56

Why do bookrotate set a timer to reset the book position

Post by i30817 » 24 Nov 2018, 18:41

Code: Select all

short LastPos ;LastPos = 0 is normal, LastPos = 1 is vertical, LastPos = 2 is horizontal.
....
if ( OnPCDrop != 1 )

	if ( TMax < 	5 )
		Set TMax to Random 50
		Set TMax to ( TMax / 10 ) + 5
	endif

	if ( CellChanged == 1 )
		Set Timer to TMax + 1
	endif

	if ( bZpos != ( GetPos, Z ) )
		Set Timer to TMax + 1
	endif

	if ( LastPos > 0 )
		set Timer to Timer + GetSecondsPassed
		if ( Timer > 5 )
			if ( LastPos >= 1 )
				SetPos X, xDest
				SetPos Y, yDest
				SetPos Z, zDest
				SetAngle Z, zAngle
				SetAngle X, xAngle
				SetAngle Y, yAngle
			endif
			set bZpos to ( GetPos, Z )
			set Timer to 0
		endif
	endif

	;BEGIN original Book Script:


	;END original Book script.

	return

endif
ie: while the book is in the world and disregarding the small window where it's being dropped, always run a random timer to 'reset' the book position to the saved coordinates if the book isn't on its 'native' form.

What's the point, does the book fall down if it's not reset often? Clearly not because setting a book on top of a object and then removing that object doesn't cause a fall, so why the performance loss of keeping this running whenever the book is not being player dropped?

Also btw, this part of the code should really run only on 'not in inventory'.

Post Reply