Incidencia #44696

Lua: allow edit.create_building() to move a great wonder

Abrir Fecha: 2022-05-28 19:30 Última actualización: 2022-06-11 12:34

Informador:
Propietario:
Estado:
Cerrado
Componente:
Hito:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
2

Details

This effect is already achievable with edit.remove_building() called first, it's not natural to hide the opportunity. Also, editing from client can do it.

Ticket History (3/10 Histories)

2022-05-28 19:30 Updated by: ihnatus
  • New Ticket "Lua: allow edit.create_building() to move a great wonder" created
2022-06-02 01:34 Updated by: cazfi
Comentario

I guess I should comment something, though I don't have time to investigate in depth at the moment.

Some random considerations:
- That it's already possible by removing the wonder first means also that it's a workaround that people could use even if we didn't reopen semi-frozen S3_1 d3f
- What's the status of other methods related to this? Would it still be easy to grant the Wonder only if it's not already built?
- As create_building() is new in 3.1, and having the change in the features initial release, would save us from handling it as a change between two stable releases of the API
- Patch submitted in time for me to handle before my summer break (-> to be in testing over the summer) would increase the chances that this gets accepted to S3_1

2022-06-02 03:27 Updated by: ihnatus
Comentario

Reply To cazfi

Some random considerations:
- That it's already possible by removing the wonder first means also that it's a workaround that people could use even if we didn't reopen semi-frozen S3_1 d3f

Well, behaviour with wonders was never documented behind "creates a building to a city".

- What's the status of other methods related to this? Would it still be easy to grant the Wonder only if it's not already built?

function wonder_owner(wonder)
for p in players_iterate() do
if p:has_wonder(wonder) then
return p
end
end
return nil
end

- Patch submitted in time for me to handle before my summer break (-> to be in testing over the summer) would increase the chances that this gets accepted to S3_1

Ok, I'll try to make the patch soon.

(Edited, 2022-06-02 03:30 Updated by: ihnatus)
2022-06-02 05:32 Updated by: ihnatus
Comentario

Centralized the code with editor. A bug or two got fixed in process. I'll see tomorrow how much more I have caused.

(Edited, 2022-06-02 06:03 Updated by: ihnatus)
2022-06-03 08:42 Updated by: ihnatus
Comentario

I have caused a lot... Well, reworking this. What really should be fixed in process:

  • Lua does not refresh the cities before sending or rearrange the workers if the building changes the radius.
  • Lua may put a coinage into the city that works buggy.
  • Editor (client and server part) considers any Special genus building unplaceable. While the reciprocal is more or less guaranteed by ruleset loading, the straight seems to be not true. Making Special genus building obligatory either a mint or a space part is a format change (let alone the fact that wether something is a space part is calculated dependent to the current state of the city it's being built in). I will replace the check to reflect the current logic of city_build_building() but maybe we should change something, at least in 3.2, and this change should go also to 3.0.

What is not to be handled in this patch:

  • Building obsoletion
  • Trade route effects for third party cities (actually, I didn't check, maybe client calculates them?)
  • Both editor and Lua don't call Lua "building_built/lost" callbacks, shouldn't they?
2022-06-04 06:02 Updated by: ihnatus
Comentario

Made a better patch. Question of special buildings is to be handled later in #44748. Updating cities due to moving around a governmental center requires a special patch (#44749), I doubt I'm going to submit it any soon.

2022-06-09 08:35 Updated by: cazfi
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
Comentario

I'm inclined to accept this to S3_1.

There's textual conflict with https://www.hostedredmine.com/issues/856947 but I think it's better to rebase that patch on top of this than the other way around.

2022-06-11 12:34 Updated by: cazfi
  • Estado Update from Open to Cerrado
  • Resolución Update from Accepted to Fixed

Attachment File List

Editar

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Entrar