Editing the Effects of Nuclears

Can you help improve your favourite game? Hardcore C mages, talented artists, and players with any level of experience are welcome!
Posts: 10
Joined: Mon Nov 16, 2015 4:15 pm

Editing the Effects of Nuclears

Postby Bob » Mon Nov 16, 2015 4:22 pm

I'm currently making a ghetto mod of the game in which there are multiple types of nuclear weapons (Nuclear bomber, ICBM, and tactical nuke [for shits and giggles]), looked all through the .ruleset scripts and couldn't find where to change the properties of the nuclear explosions, as in to change the radius of the explosion and its effects on cities.
Being temporarily hindered-in-the-brain I probably overlooked where those settings were, thanks in advance.

Posts: 1787
Joined: Tue Jan 29, 2013 6:54 pm

Re: Editing the Effects of Nuclears

Postby cazfi » Mon Nov 16, 2015 7:20 pm

Unfortunately Nuclear blast moddability exist in my loooong TODO list only.

User avatar
Posts: 578
Joined: Mon Apr 29, 2013 4:41 pm

Re: Editing the Effects of Nuclears

Postby GriffonSpade » Tue Nov 24, 2015 12:15 pm

Hmm, a thought, is the SDI defense's thing linked to the nuclear flag? Because really, it should only work on ICBMs, not short range tactical nukes.

User avatar
Posts: 473
Joined: Wed Jan 30, 2013 12:15 am

Re: Editing the Effects of Nuclears

Postby JTN » Tue Nov 24, 2015 11:12 pm

Afraid it is; and it's not possible to make the Nuke_Proof effect (which is what SDI buildings use) depend on properties of the attacking unit, although that wouldn't be so hard to add. It can only depend on properties of the city that is attacked.

See common/combat.c:sdi_try_defend() and callers.

Posts: 20
Joined: Sat Feb 23, 2013 5:18 pm

Re: Editing the Effects of Nuclears

Postby Unknown » Wed Nov 25, 2015 5:41 am

While looking at sdi_try_defend I noticed something

Code: Select all

struct city *sdi_try_defend(const struct player *owner,
                const struct tile *ptile)
  square_iterate(ptile, 2, ptile1) {
    struct city *pcity = tile_city(ptile1);

    if (pcity
        && !pplayers_allied(city_owner(pcity), owner)
        && fc_rand(100) < get_city_bonus(pcity, EFT_NUKE_PROOF)) {
      return pcity;
  } square_iterate_end;

  return NULL;

This code only applies to fixed city radius of 2. Variable city radius is not handled here.