Feature #1464
openLua API: minimal specialist control
0%
Description
Split from #1399 but applied also to S3_3. Main application there is scripted removal of specialists that the city can't employ any more due to their reqs but that are not automatically removed.
Common- bool (City):can_employ(Specialist s)
- bool (Player):can_employ(Specialist s)
- int (City):num_specalists(Specialist s?)
- bool (City):reduce_specialist(Specialist s, amount n?)
Probably we also want a way to know Specialist_Output effect but the logical addition in effects
module is probably too global for this patch; just a City method can be added though.
Files
Updated by Marko Lindqvist 10 days ago
- Related to Feature #1399: Lua API: specialists control added
Updated by Marko Lindqvist 10 days ago
- Blocked by Feature #1451: Lua API: specialist class added
Updated by Marko Lindqvist 10 days ago
- Target version changed from 3.3.0 to 3.3.0-d3f
Updated by Alexandr Ignatiev 7 days ago
In fact, effects.specialist_bonus() is rather easy and natural to place here ("Specialist_Output" is an unique effect that is calculated towards city but not its tile). But seeing that superspecialists patch is already in review, the editing stuff should probably be delivered to S3_3 and S3_4 separately since its methods must be aware if the specialist is calculated within citizens.
Updated by Alexandr Ignatiev 7 days ago
Well, let's eat elephant by pieces. Here is a patch to apply at S3_3 and probably stop with specalists API there. For S3_4 it is applied but the editing part does a wrong thing if superspecialists are introduced, so we shall fix it in a separate patch that will also add some more API for superspecialists (namely, City:add_specialist() and Specialist.is_super).
Updated by Marko Lindqvist 4 days ago
- Status changed from New to In Progress
- Assignee set to Alexandr Ignatiev
Can you fix the global observers FIXME comment.
Likely helpful:
conn_list_iterate(game.glob_observers ...
Updated by Alexandr Ignatiev 3 days ago
Marko Lindqvist wrote in #note-6:
Can you fix the global observers FIXME comment.
Likely helpful:
conn_list_iterate(game.glob_observers ...
I copied this part from handle_city_change_specialist()
in server/cityhand.c, I did not check thoroughly, just expressed a concern. Probably we need first define a function to broadcast city internals, and then apply it in both places.
Updated by Alexandr Ignatiev 3 days ago
citytools.c L#2471-2472:
if (dest == powner->connections {
/* HACK: send also a copy to global observers. */
really well hidden thing but it works, I delete that line.
Updated by Alexandr Ignatiev 2 days ago
Also, I probably should write a wrapper method in tolua_server.pkg to get more comprehensive Lua backtraces on arg errors.
Updated by Alexandr Ignatiev 1 day ago
- File lua-specialists.patch lua-specialists.patch added
Alexandr Ignatiev wrote in #note-9:
Also, I probably should write a wrapper method in tolua_server.pkg to get more comprehensive Lua backtraces on arg errors.
The traceback is not much better, but the wrappers probably serve one purpose: you can replace a method in edit table, and the objects' API changes alongside. Rather a dubious merit but not to be changed here. HEre is the patch.
Updated by Alexandr Ignatiev 1 day ago
- File lua-specialists1.patch lua-specialists1.patch added
Some cleanup.
Updated by Marko Lindqvist 1 day ago
- Related to deleted (Feature #1399: Lua API: specialists control)
Updated by Marko Lindqvist 1 day ago
- Blocks Feature #1399: Lua API: specialists control added
Updated by Marko Lindqvist 1 day ago
- Status changed from In Progress to In Review
- Assignee changed from Alexandr Ignatiev to Marko Lindqvist