Javascript API documentation

For AI and campaign script related discussions and questions
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Post by NoQ »

Yeah, and also scavengers use different textures on urban/rockies.
Great, no more WRF hell for modders!
___________________
Just noticed that enableTemplate() doesn't do anything, neither on 3.1 nor on 3.2.
In both cases everything is controlled via templates.{txt,ini}.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Javascript API documentation

Post by Per »

Hmm. As far as I can tell, only urban used different baba textures, which is weird. Won't those rockies babas freeze? O_o I can fix this, but should I give rockies babas kevlar vests, while I'm at it?

I didn't realize that about enableTemplate(). Not sure what to do about it. templates.txt|ini sort of does everything you need, I think?
User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base
Contact:

Re: Javascript API documentation

Post by Goth Zagog-Thou »

I have encountered the same problem as NoQ, Per.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Post by NoQ »

In fact per-tileset textures (and maybe even per-tileset pies) are a very useful feature. Especially when custom tilesets are around (i had to recolor barbarian huts to fit the volcanic tileset gamma).

As for templates, i'd rather say deprecate templates.ini :3 (keep it only for wzscript) cause right now this is the only use case we have for it, and even this is duplicated. Probably make the js function actually work and add a component-based variant (?)
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Javascript API documentation

Post by Per »

Maybe we should move some of the per-tileset-relevant textures into the terrain directories...

I'm not sure why you need enableTemplate() when you can control it all with greater granularity with enableComponent() already?
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Post by NoQ »

I'm not sure why you need enableTemplate() when you can control it all with greater granularity with enableComponent() already?
Well it all started when we tried to discriminate between necessity to research components and necessity to design a template out of existing components and found that the latter is not always trivially available.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Javascript API documentation

Post by NoQ »

Looking for a way of working with structure blueprints. Two specific problems:
  • Estimating allocated money. Unlike unit production or research, money is not spent instantly after the construction order is given. So i want to be able to know the net cost of all blueprints at any moment, or at least make it accounted for in queuedPower() (unless it already is).
  • Knowing what oil derricks are already being taken by me and allies. For example, I'd like to be able to cancel oil derrick construction order if my ally has just ordered it as well. It'd also simplify the code that makes sure i don't order the same derrick twice.
Not sure how to implement it. Probably enumBlueprints(player = me) and eventBlueprintAppeared(object).
Post Reply