Author Topic: [Lua]: Degrade Buildings (Last updated on: 2017-09-28)  (Read 1424 times)

Offline Zhilkin

  • NPC
  • **
  • Posts: 205
    • View Profile
[Lua]: Degrade Buildings (Last updated on: 2017-09-28)
« on: August 03, 2017, 02:13:30 AM »
Description:

Walls have a chance to collapse, windows and doors can be damaged when building is generated. Also adds some graffiti to the walls.

This mod is WIP and probably rather unbalanced. All, but several buildings from \data\json\mapgen were updated. I will update more in future versions.

Warning: Please be aware that additional lua mapgen is rather slow, especially when logging is enabled.

Download links:


Technical info:
  • Mod utilizes LUA functionality in overmap mapgen (see https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/MAPGEN.md#25-lua).
  • You can find mod logs in \data\mods\ZSLua_DegradeBuildings\lua\ (ZSLua_DegradeBuildings.log and mapgen_degrade_building.report).
  • One can use \data\mods\ZSLua_DegradeBuildings\lua_tools\InjectMapgenJson.lua to process json-files with mapgens from other mods.

Additional info:

Please also check dda-lua (http://smf.cataclysmdda.com/index.php?topic=14861.0). This mod will be eventually merged there.
« Last Edit: September 28, 2017, 08:29:43 AM by Zhilkin »

Offline RipRoarinBoogerPenis

  • NPC
  • **
  • Posts: 235
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #1 on: August 04, 2017, 03:09:28 PM »
Fucking sick nasty, can't wait to try it tonight

Offline DeWolf

  • Survivor
  • ***
  • Posts: 964
  • STAY AWAY FROM MY PRETZELS
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #2 on: August 04, 2017, 03:31:54 PM »
So lua is still in the game. I wonder why stats through skills 2 isn't working then.

Offline Zhilkin

  • NPC
  • **
  • Posts: 205
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #3 on: August 05, 2017, 04:31:45 PM »
So lua is still in the game. I wonder why stats through skills 2 isn't working then.
StatsThroughSkills mod shipped with the game is working good. Is you version of the game compiled with lua support?

Offline RipRoarinBoogerPenis

  • NPC
  • **
  • Posts: 235
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #4 on: August 06, 2017, 05:58:56 PM »
Getting this error. Tried it in an existing world and a new one


http://imagebucket.net/j649wmeqhxh1/fug.png

Offline Zhilkin

  • NPC
  • **
  • Posts: 205
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #5 on: August 06, 2017, 07:27:36 PM »
Getting this error. Tried it in an existing world and a new one


http://imagebucket.net/j649wmeqhxh1/fug.png
You have probably some old version of CDDA which does not include Necropolis yet. Do you know version number?

Offline RipRoarinBoogerPenis

  • NPC
  • **
  • Posts: 235
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #6 on: August 06, 2017, 07:37:43 PM »
From a couple days ago, necropolis is in but I haven't run into any in this current world gen. Maybe it didn't generate one and thats why I get the error? If thats the case I don't know why it would spit me out to the main menu.

Offline Zhilkin

  • NPC
  • **
  • Posts: 205
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #7 on: August 06, 2017, 09:18:26 PM »
From a couple days ago, necropolis is in but I haven't run into any in this current world gen. Maybe it didn't generate one and thats why I get the error? If thats the case I don't know why it would spit me out to the main menu.
The issue is you game cannot find item group `energy_weapon_armory`. It should be defined in `\data\json\itemgroups\locations.json`.

Code: [Select]
,
  {
    "id": "energy_weapon_armory",
    "type": "item_group",
    "subtype": "collection",
    "items":[
      { "group": "guns_energy", "prob": 50 },
      [ "plut_cell", 30 ],
      [ "adv_UPS_off", 20 ],
      [ "electrolaser_conversion", 5 ],
      [ "high_density_capacitor", 5 ],
      [ "beam_scatterer", 5 ]
    ]
  },

It is likely that you have some mod enabled which blacklists this item group.

Offline RipRoarinBoogerPenis

  • NPC
  • **
  • Posts: 235
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #8 on: August 06, 2017, 09:36:12 PM »
Got it working, something is fucky with my energy weapon stuff for somereason but whatever.

Love the destroyed damaged buildings. Could use more variety in the graffitti. Is there any way to disable those lua callbacks? Made a character and had to wait till daytime to check things out and just get spammed with lua callbacks.

Really excited about this, how can I add more to the graffitti?

Offline DeWolf

  • Survivor
  • ***
  • Posts: 964
  • STAY AWAY FROM MY PRETZELS
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #9 on: August 06, 2017, 10:32:21 PM »
So lua is still in the game. I wonder why stats through skills 2 isn't working then.
StatsThroughSkills mod shipped with the game is working good. Is you version of the game compiled with lua support?
That is the basic stats through skills which I don't think uses lua. Basically the reason I don't use that mod is as soon as stats update and if you start out with 0 skills then al your starting stats are dropped whereas stats through skills 2 I know doesn't do that.

Offline Zhilkin

  • NPC
  • **
  • Posts: 205
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #10 on: August 07, 2017, 12:09:23 AM »
Got it working, something is fucky with my energy weapon stuff for somereason but whatever.

Love the destroyed damaged buildings. Could use more variety in the graffitti. Is there any way to disable those lua callbacks? Made a character and had to wait till daytime to check things out and just get spammed with lua callbacks.

Really excited about this, how can I add more to the graffitti?
Graffiti strings are defined in the "\data\mods\ZSLua_DegradeBuildings\lua\MapGen.lua". Search for this code and add more strings as necessary:

Code: [Select]
function MapGen.RandomGraffitiString ()

  local strings = {
    "LUA rules!",
    "LOOTED",
    "X",
    "muh fukaz!",
    "Beware of Zeds",
    "Hello, Kitty!",
    "* unreadable symbols *",
    "<color_ltred>PRAY!</color>",
    "<color_red>PRAY AND SPRAY!</color>"
  }

Lua callbacks are defined in "\data\mods\ZSLua_DegradeBuildings\main.lua". They should be disabled in the NoLog version,s or either try use that version, remove callback functions or comment Log statements like this:

Code: [Select]
function MOD.on_new_player_created()
    --Log.Message("ZSLua_DegradeBuildings: main.lua: callback: on_new_player_created", true)
end

function MOD.on_skill_increased()
    --Log.Message("ZSLua_DegradeBuildings: main.lua: callback: on_skill_increased", true)
end

function MOD.on_minute_passed()
    --Log.Message("ZSLua_DegradeBuildings: main.lua: callback: on_minute_passed", true)
end

function MOD.on_day_passed()
    --Log.Message("ZSLua_DegradeBuildings: main.lua: callback: on_day_passed", true)
end

You can also omit second parameter of the function or set it to nil/false.
« Last Edit: August 07, 2017, 12:12:17 AM by Zhilkin »

Offline Zhilkin

  • NPC
  • **
  • Posts: 205
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #11 on: August 07, 2017, 12:11:22 AM »
So lua is still in the game. I wonder why stats through skills 2 isn't working then.
StatsThroughSkills mod shipped with the game is working good. Is you version of the game compiled with lua support?
That is the basic stats through skills which I don't think uses lua. Basically the reason I don't use that mod is as soon as stats update and if you start out with 0 skills then al your starting stats are dropped whereas stats through skills 2 I know doesn't do that.
StatsThroughSkills shipped with the game uses lua. Somewhere in the future it will be recoded in c++, but that's not yet true for today.

Offline Decipher4096

  • Zombie Food
  • *
  • Posts: 1
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #12 on: August 11, 2017, 06:16:42 PM »
Hey, I have a problem with this mod. I have experimental 6675 and when the game generates the world, I have this error:

I installed the non-log version.

I don't want to start the game without this mod, so I'll wait patiently for help :)

Offline Zhilkin

  • NPC
  • **
  • Posts: 205
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #13 on: August 11, 2017, 08:17:44 PM »
Hey, I have a problem with this mod. I have experimental 6675 and when the game generates the world, I have this error:
I installed the non-log version.

I don't want to start the game without this mod, so I'll wait patiently for help :)
Please download once again (same link). There was missing comment hyphen in Mapgen.lua.

Offline fallout2077

  • Zombie Food
  • *
  • Posts: 2
    • View Profile
Re: [Lua]: Degrade Buildings (Last updated on: 2017-08-03)
« Reply #14 on: August 26, 2017, 10:16:46 PM »
Hey there, I've been having an issue starting a new game when the game tries to generate the map with this game loaded. For some reason, the forums won't allow me to post links or attachments, so the next best thing is to provide a description of the error.
On the DEBUG line of the error, there is a message regarding an invalid overmap terrain flag "ALLOW_OVERRIDE".
The function line states: bool main_menu::new_character_tab()
File is src/main_menu.cpp
Line 614