Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
FakeTruth, even with the best optimizations there are situations that you won't handle well. Even the vanilla client has troubles with some things. I remember when I was toying with the terrain generator, that I accidentally generated terrain that had too many block faces exposed to air - think "20% stone to 80% air dithering". The client would halt and finally, after half an hour, crash.
Your optimization could be broken in the same way - an alternating pattern of cobble, mossy cobble and air.
I'm not saying that it's normal, I'm just saying that there are cases that you won't be able to handle well. The question is, is anyone gonna get into such a situation? And if so, is there a better solution?
Posts: 1,162
Threads: 68
Joined: Mar 2013
Thanks: 245
Given 125 thank(s) in 100 post(s)
One question about OnBlockToPickups hook.
When a player breaks sugarcane/cacti, all blocks above are digged and a pickup it's spawned, would this be a natural reason (no Digger) or would there be a digger?
Posts: 4,629
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
I think it would be a natural reason.
Posts: 1,162
Threads: 68
Joined: Mar 2013
Thanks: 245
Given 125 thank(s) in 100 post(s)
Could you add an OnFished hook? I'd like to add fisherman job to Jobs.
Something like
function OnFished(Player, Result)
Result would be the item player got fishing.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
Nice idea. Make it a set of two - OnFishing(Player, ResultItem) that is fired just as the player decided to reel in and could override the result, and OnFished(Player, ResultItem) that is fired as a notification only after the catch has been decided.
Posts: 4,629
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
The OnPlayerFished and OnPlayerFishing is implented.
Posts: 1,162
Threads: 68
Joined: Mar 2013
Thanks: 245
Given 125 thank(s) in 100 post(s)
What about an OnPlayerTick hook? Like OnPlayerMoving, but called every tick.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
You have OnWorldTick() and cWorld::ForEachPlayer()