Author Topic: The Minor JSON Questions Thread  (Read 4257 times)

Offline africalinguist

  • Zombie Food
  • *
  • Posts: 3
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #105 on: May 19, 2017, 02:59:27 AM »
thanks alec white yes you were right. the item id was s-23 not c-23 :P

Offline pisskop

  • Survivor
  • ***
  • Posts: 3388
  • So Noble he farts Helium
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #106 on: May 25, 2017, 10:56:23 PM »
Anyone know why my custom lighter can start overworld fires but wont spark a cigar?



  {
    "id": "ref_lighter_string",
    "type": "TOOL_ARMOR",
    "name": "wearable lighter",
    "copy-from": "lighter",
    "description": "A lighter with a bit of string and taping to allow it to be worn about the neck like a lanyard.  A bit fumbly to get a hold of, but perfectly servicable.",
    "weight": 25,
    "volume": 0,
    "price": 3000,
    "material": "aluminum",
    "symbol": ",",
    "color": "light_gray",
    "coverage": 1,
    "encumbrance": 0,
    "storage": 0,
    "warmth": 0,
    "material_thickness": 1,
    "ammo": "gasoline",
    "max_charges": 50,
    "rand_charges": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 7, 11, 13, 17, 21, 27 ],
    "charges_per_use": 1,
    "use_action": [
      {
        "type": "firestarter",
        "moves": 60,
        "moves_slow": 600
      }
    ]
  },

Offline Zhilkin

  • NPC
  • **
  • Posts: 110
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #107 on: May 26, 2017, 03:42:56 PM »
Anyone know why my custom lighter can start overworld fires but wont spark a cigar?



  {
    "id": "ref_lighter_string",
    "type": "TOOL_ARMOR",
    "name": "wearable lighter",
    "copy-from": "lighter",
    "description": "A lighter with a bit of string and taping to allow it to be worn about the neck like a lanyard.  A bit fumbly to get a hold of, but perfectly servicable.",
    "weight": 25,
    "volume": 0,
    "price": 3000,
    "material": "aluminum",
    "symbol": ",",
    "color": "light_gray",
    "coverage": 1,
    "encumbrance": 0,
    "storage": 0,
    "warmth": 0,
    "material_thickness": 1,
    "ammo": "gasoline",
    "max_charges": 50,
    "rand_charges": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 7, 11, 13, 17, 21, 27 ],
    "charges_per_use": 1,
    "use_action": [
      {
        "type": "firestarter",
        "moves": 60,
        "moves_slow": 600
      }
    ]
  },

https://github.com/CleverRaven/Cataclysm-DDA/blob/4bcc67a9d0b5dc3d2b8844fb3705e4b524fdcb23/src/iuse.cpp#L397-L409

Code: [Select]
int iuse::smoking(player *p, item *it, bool, const tripoint&)
{
    bool hasFire = (p->has_charges("fire", 1));

    // make sure we're not already smoking something
    if( !check_litcig( *p ) ) {
        return 0;
    }

    if (!hasFire) {
        p->add_msg_if_player(m_info, _("You don't have anything to light it with!"));
        return 0;
}

***

ref_lighter_on = refillable lighter (lit) also does not provide fire for cigarettes.

You can check this in LUA console by this command:

game.add_msg(tostring(player:has_charges("fire",1)))


***

Probably same issue as described in https://github.com/CleverRaven/Cataclysm-DDA/issues/21005
« Last Edit: May 26, 2017, 04:07:04 PM by Zhilkin »

Offline pisskop

  • Survivor
  • ***
  • Posts: 3388
  • So Noble he farts Helium
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #108 on: May 26, 2017, 05:09:23 PM »
oh hey, thanks for the update edit.

I was doing my own doodadaling with the jsons and came to the conclusion that it must be a hardcode somewhere?