How is checking whether the message box is showing or not related to checking whether you're getting in a vehicle?
lol, they are completely unrelated - naturally, however, in this situation they are both restrictions the engine dev's felt where necessary. Personally I wouldn't mind being able to move while im supposed to be reading an important cutscene message 😛
oh for sure..
According to my own benchmarking tests though, more methods = slower code (in most cases). So for example, if you separated each of those checks into its own method, like this...
class Game_Player def movable? any_moving? end def any_moving? moving? || movable_check2? || movable_check3? || movable_check4? || movable_check5? end def movable_check2? @move_route_forcing || @followers.gathering? end def movable_check3? @vehicle_getting_on || @vehicle_getting_off end def movable_check4? $game_message.busy? || $game_message.visible end def movable_check5? vehicle && !vehicle.movable? endend Could potentially result in code that runs slower 🙂
Also - checking a variable value within a method is always faster than calling a method that returns the same value. Its one of the many 'perks' \s of the ruby code interpreter 😛
Edit:
That being said, perhaps 'speed' isnt the priority, perhaps its flexibility. In which case, having the separated methods would be much more advantageous. 🙂
I would trade a few milliseconds* of processing for infinitely more flexible code to work with.
*untested, just a random figure
Because you can do something like this later:
player.moveables = []player.moveables << (whatever)# Ex objects as hashes:# {name: 'ship', active: false, moveable?: (single method to determine moveability)} player.moveables.select(&:active).none?(&:moveable?)Tell me honestly, is speed that large of a concern to you? You're wrong, but is it really?
foo = -> { puts 'foo' }bar = -> { puts 'bar' }baz = -> { puts 'baz' } Benchmark.measure { 100000.times { [foo,bar,baz].none? { |proc| proc.call() } } }.real# => 1.002677 Benchmark.measure { 100000.times { foo.call() || bar.call() || baz.call() ? false : true } }.real# => 0.917967Please, if you're going to try and make a point on speed, post the benchmarks instead of spreading blatantly false information.