Author Topic: Lua may be getting axed, how many people care?  (Read 4685 times)

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3839
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #15 on: April 06, 2017, 02:23:11 AM »
What can Lua actually do?

If someone actually made a good enough use of it to warrant supporting it, it could use 95% of hardcoded functions and emulate the rest in lua.
No one did and actual lua mods were rather simple, so most of the giant interface was unused.

Offline Taberone

  • NPC
  • **
  • Posts: 162
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #16 on: April 06, 2017, 02:39:56 PM »
What can Lua actually do?

Lua can also clear all items under a player's feet.

Code: (Enter into the Lua Console) [Select]
map:i_clear(player:pos())
Something like 15:00-18:00 is good time to kill the children
This is art right here

Offline Slax

  • Survivor
  • ***
  • Posts: 1255
  • Crash Test Dummy
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #17 on: April 06, 2017, 03:11:23 PM »
Lua piggybacks off of existing features and can modify them... from what I gather. Creative coders can do crazy stuff with it.
Very useful... unless no one uses it. :P

Offline Chezzo

  • Survivor
  • ***
  • Posts: 321
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #18 on: May 04, 2017, 04:47:57 PM »
I just found a whole bunch of awesome new mods that are big in Japan!

https://translate.google.com/translate?hl=en&sl=ja&u=https://www57.atwiki.jp/cataclyj/&prev=search

And a bunch use Lua.

Offline Taberone

  • NPC
  • **
  • Posts: 162
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #19 on: May 07, 2017, 06:28:31 PM »
Would the Japanese mods that use Lua be a good enough reason to avoid Lua getting axed?
Something like 15:00-18:00 is good time to kill the children
This is art right here

Offline Zhilkin

  • NPC
  • **
  • Posts: 218
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #20 on: May 07, 2017, 09:43:10 PM »
I've seen several mods that are changing item groups (which is possible without lua) and one mod that adds two iuse actions. I doubt it is good reason to keep lua.

Offline Chezzo

  • Survivor
  • ***
  • Posts: 321
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #21 on: May 08, 2017, 08:59:32 PM »
Well, there is this one, that makes the zombies tougher and tougher as time goes on, and when it does, you have a nightmare.

http://chezzo.com/cdda/Nightmare.zip


Offline pisskop

  • Survivor
  • ***
  • Posts: 3616
  • Excitebike
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #22 on: May 09, 2017, 02:56:03 AM »
that ninja mod adds iuse functions.


its actually quite the mod.  wide in scope and with small touches

Offline Alec White

  • NPC
  • **
  • Posts: 215
  • I'm shy
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #23 on: May 11, 2017, 02:08:01 PM »
Is there any place where all the Lua functions are documented? Or do you just have to check catabindings.cpp for how to use them?

Offline Zhilkin

  • NPC
  • **
  • Posts: 218
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #24 on: May 13, 2017, 08:38:44 AM »
Is there any place where all the Lua functions are documented? Or do you just have to check catabindings.cpp for how to use them?

Check example mods in https://github.com/CleverRaven/Cataclysm-DDA/tree/master/doc/sample_mods

Also all LUA bindings are automatically extracted to https://github.com/CleverRaven/Cataclysm-DDA/blob/master/lua/class_definitions.lua

Offline Alec White

  • NPC
  • **
  • Posts: 215
  • I'm shy
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #25 on: May 13, 2017, 10:09:54 AM »

Offline Taberone

  • NPC
  • **
  • Posts: 162
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #26 on: May 14, 2017, 03:03:06 AM »
Any reasons why (presumably) only the Japanese modding community cares enough about Lua to actually use it, and will that be enough to prevent Lua getting axed? Some of those mods are quite impressive sounding (although I've never installed them).
« Last Edit: May 14, 2017, 03:12:33 AM by Taberone »
Something like 15:00-18:00 is good time to kill the children
This is art right here

Offline Kevin Granade

  • Administrator
  • Survivor
  • *****
  • Posts: 5588
  • I code dead people.
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #27 on: May 14, 2017, 08:26:59 AM »
My top guess is that English-speaking developers find it easier to add their functionality to the main repository using c++.
I haven't had a chance to look over the japanese mods, but there'd have to be some really elaborate use of LUA to make me change my mind at this point.
I'm planning on replacing LUA-based code with behavior you can configure with JSON wherever possible, so hopefully little to no features will be lost.
Its like a fun family cookout, except your family is burning in flames while trying to eat you. -secretfire
I'm more excited than a survivor on meth and toast'ems. -Nighthawk
The the giant wasp is slammed through the zombie brute!

Offline Zhilkin

  • NPC
  • **
  • Posts: 218
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #28 on: May 14, 2017, 10:00:12 AM »
My top guess is that English-speaking developers find it easier to add their functionality to the main repository using c++.
I haven't had a chance to look over the japanese mods, but there'd have to be some really elaborate use of LUA to make me change my mind at this point.
I'm planning on replacing LUA-based code with behavior you can configure with JSON wherever possible, so hopefully little to no features will be lost.

-- MOD NINJA.
game.add_item_to_group("museum_misc", "ninja_tengu_mask", 5)


function iuse_ninja_afterimage(item, active)

   local SCREEN_RADIUS = 2
   local CHARGES_PER_USE = 25

   if item.charges < CHARGES_PER_USE then
      game.add_msg("Power is insufficient...")
      return
   end

   local num_of_image = 0
   for x = (-1 * SCREEN_RADIUS), SCREEN_RADIUS do
      for y = (-1 * SCREEN_RADIUS), SCREEN_RADIUS do
         local point = player:pos()
         point.x = point.x + x
         point.y = point.y + y

         if g:is_empty(point) and game.one_in(3) then
            game.create_monster(mtype_id("mon_ninja_afterimage"), point)
            num_of_image = num_of_image + 1
         end

         if num_of_image >= 7 then
            break;
         end
      end
   end

   if num_of_image > 0 then
      game.add_msg("I copied the afterimage on the screen of the fog.")
   else
      game.add_msg("I could not image the afterimage.")
   end

   item.charges = math.max(item.charges - CHARGES_PER_USE, 0)

end

function iuse_ninja_typhoon(item, active)

   local CHARGES_PER_USE = 100
   local TYPHOON_RADIUS = 10
   local VORTEX_SPAWNRATE = 0.05      -- per a tile.
   local THRESHOLD_DESTRUCTION = 600   -- t_wall.bash_str = 210, t_wall_metal.bash_str = 600

   local RUBBLES = {}
   RUBBLES[0] = "A mountain of rubble"
   RUBBLES[1] = "A mountain of rubble (rock)"
   RUBBLES[2] = "Wreck (metal)"
   RUBBLES[3] = "A mountain of ashes"

   if item.charges < CHARGES_PER_USE then
      game.add_msg("Power is insufficient...")
      return
   end

   for x = (-1 * TYPHOON_RADIUS), TYPHOON_RADIUS do
      for y = (-1 * TYPHOON_RADIUS), TYPHOON_RADIUS do
         local point = player:pos()
         point.x = point.x + x
         point.y = point.y + y

         -- *Cleaning* ter & furn.
         local bash_str = map:bash_strength(point,true)

         if  bash_str < THRESHOLD_DESTRUCTION
         and game.one_in( math.floor( bash_str / THRESHOLD_DESTRUCTION * 10 ) )
         then
            map:destroy(point)
         end

         -- try remove rubbles.
         local fname = map:furnname(point)
            -- "furn_at" was removed.
            -- "furn" function returns "furn_id" but cant instanciate,
            -- therefore i have no idea to compare id & id. i want furn& :(

         if (
            fname == RUBBLES[0]
         or fname == RUBBLES[1]
         or fname == RUBBLES[2]
         or fname == RUBBLES[3]
         ) then
            map:furn_set(point, furn_str_id("f_null"))
         end

         -- spwan vortex.
         if g:is_empty(point) and game.one_in( math.floor((TYPHOON_RADIUS * 2)^2 / VORTEX_SPAWNRATE / 100) ) then
            game.create_monster(mtype_id("mon_vortex"), point)
         end
      end
   end

   item.charges = math.max(item.charges - CHARGES_PER_USE, 0)

end

game.register_iuse("IUSE_LUA_NINJA_AFTERIMAGE", iuse_ninja_afterimage)
game.register_iuse("IUSE_LUA_NINJA_TYPHOON"   , iuse_ninja_typhoon)

Offline Alec White

  • NPC
  • **
  • Posts: 215
  • I'm shy
    • View Profile
Re: Lua may be getting axed, how many people care?
« Reply #29 on: May 14, 2017, 11:19:17 AM »
I'm planning on replacing LUA-based code with behavior you can configure with JSON wherever possible, so hopefully little to no features will be lost.

I'm curious, how would that work code-wise?

snip

And this other too https://pastebin.com/xXXR2TKa

I also heard there was another mod that made a water-world.
« Last Edit: May 14, 2017, 11:23:59 AM by Alec White »