[LUA][Rulesets] Tile reval signal

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Posts: 220
Joined: Sat May 04, 2013 2:19 pm

[LUA][Rulesets] Tile reval signal

Postby Lachu » Wed Nov 08, 2017 6:39 pm

I know, that making good Civilization scenario is hard and adding signals invoked once player reveal some tile/city/hero on map doesn't change this, but maybe this little change could be useful?
"Sir, We've discovered barbarian camp! Raze it!" ;-)

User avatar
Posts: 264
Joined: Mon Dec 23, 2013 3:13 am
Location: Hamburg

Re: [LUA][Rulesets] Tile reval signal

Postby dunnoob » Mon Nov 13, 2017 11:07 am

There is a unit_moved signal, and I never tested or used it so far. Allegedly a handler gets arguments (Unit unit, Tile src_tile, Tile dst_tile), and if that happens after the move all adjacent tiles for the destination including huts, enemies, etc. should be visible.

Out of curiosity I just tried to find it in the code, it's in server/unittools.c near line 3935 deep in function unit_move(). Near the end, vision already updated, after is applicable. IOW, what you want should be possible in Lua, it's just a special case of "unit_moved".

Edit: comment added on the Wiki.