Weather.
#1
I added the New / Invalid State and Thunderbolt packets. Just for testing of the packets(one packet) I made it so rain starts when you open a workbench and stop when you open a chest.

It seems thunder is overly complex. It looks like the server needs to create a thunder entity, send the thunderbolt packet, and remove the entity. I haven't tested anything with it, I just created the packet.

Weather is going to need a lot more work. Each world need to have a raining or not raining state. If raining than all players that log on need to have the rain status sent to them. If it's a thunderstorm, than random thunder bolts need to be created.

I'm not sure how the client knows the difference between a thunderstorm and rainstorm, I don't see anything but rain on the packet list. Maybe once a thunderbolt packet is sent the client turns it into a thunderstorm.
Yup, sending just the thunderbolt packet to the client does absolutely nothing. >.>

Guess I'll get to work on creating the entity.
Reply
Thanks given by:
#2
Got lightning kinf of working. Right now it's always striking 0,0,0.

Looks like the entity is all client side and all I have to do is tell the client where the lightning hits.

Still not sure how the server tells the client it's a lightning storm and not a rain storm. Is there a way for the server to control sky lighting directly?
Oooooh, I need to multiple the X, Y and Z by 32. Very odd. :/


Whelp, lightning works.

Now to come up with a weather system.

Each world needs an is or is not raining variable. It should probably be a char instead of a bool similar to m_GameMode I think. If the worlds m_Weather is set to rain then everyone gets the packet telling them it's raining when they log in. When the world is first set to rain everyone should get the packet at once. I'm not sure how to send every client a packet, but I'll look and see how the chat packet works.
Reply
Thanks given by:
#3
Figured it out.Big Grin

cRoot::Get()->GetServer()->Broadcast()
instead of
send()
Reply
Thanks given by:
#4
Changed broadcast to be per world.
Random chance for weather to change now. (A bit too frequent at the moment, just need to add some zeros to the chances)

added SetWeather, GetWeather and CastThunderbolt to bindings using ToLUA batch file.

Chests and Workbenches are back to normal.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)