Weather and fog scripts to JS

For AI and campaign script related discussions and questions
Post Reply
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Weather and fog scripts to JS

Post by Berserk Cyborg »

Branch.

I have the weather scripts done which was simple as ever. Oddly, the music was set from these scripts so I moved that to both rules.js files. Each of the three files use a setCampaignNumber(num) though I have not checked if it is useful anymore.

Because skirmish does not include the fog/weather scripts, the music has likely been incorrectly using the frontend music for some time now. Also implies weather particles do not show up for urban and rocky maps.

Now what to do with fog code (daynight files in here)? Maybe salvage NoQ's fog patch? In any case this marks the end of WZScript dependence.

Mod idea for weather:
Spoiler:
Edit: Buildbot is broken again.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Weather and fog scripts to JS

Post by NoQ »

My fog patch had the problem of me cannot into opengl. So i made it work with trial and error, but i've no idea if it's like anyhow correct (: The scripting part was fine though, i guess.
Berserk Cyborg wrote: Mod idea for weather:
Spoiler:
Sounds awesome :3 I guess this way it would also actually disable units hit by lightning.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Weather and fog scripts to JS

Post by Berserk Cyborg »

Here is a patch for the weather (campaign only right now). Like what I did with the tech levels, I could include it along with rule.js if that is preferred. There is one problem where savegames are not loading because it says scriptstate.es is corrupted... not sure what is up with that.

Added setCampaignNumber(num) as it does have a couple of uses and I also saw no difference with the absence of the fog stuff with this patch.
0001-Move-weather-scripts-to-JS.patch
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Weather and fog scripts to JS

Post by Per »

Berserk Cyborg wrote:Here is a patch for the weather (campaign only right now). Like what I did with the tech levels, I could include it along with rule.js if that is preferred. There is one problem where savegames are not loading because it says scriptstate.es is corrupted... not sure what is up with that.

Added setCampaignNumber(num) as it does have a couple of uses and I also saw no difference with the absence of the fog stuff with this patch.
0001-Move-weather-scripts-to-JS.patch
IIRC, if you remove globals from wzscript, old savegames will no longer load.

Patch looks good to me.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Weather and fog scripts to JS

Post by Berserk Cyborg »

I should say that the patch creates broken saves. Claims no script contexts were found with scriptState.es and then goes back to the main menu. Or maybe that file is now obsoleted without any wzscripts around?
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Weather and fog scripts to JS

Post by Per »

Berserk Cyborg wrote:I should say that the patch creates broken saves. Claims no script contexts were found with scriptState.es and then goes back to the main menu. Or maybe that file is now obsoleted without any wzscripts around?
Ah, it does not expect that there is no wzscript context to be created from the savegame anymore. Fixed in f0930756a32ef8310818abcb022609c8f582621c. Your patch seems to work now.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Weather and fog scripts to JS

Post by Berserk Cyborg »

Pushed b016f609d704ce4df022e3a89f4f70f6eaabbee7. I enabled weather for multiplay; Hopefully that does not cause problems. As for old saves, we can just delete the scriptState.es file and they will load.

I also fixed an ancient bug #983.

I guess the data/base/script/data and data/base/script/text directories are useless now and can be deleted.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Weather and fog scripts to JS

Post by Per »

I pushed deletes for all remaining base wzscripts except basic.slo, where I just removed the stuff I am certain is no longer used.
Post Reply