Skip to content
Snippets Groups Projects
  1. May 06, 2016
  2. May 01, 2016
    • Auke Kok's avatar
      TNT: Combine adjacent TNT into the explosion · 12c763a6
      Auke Kok authored
      This uses a vmanip to count adjacent tnt nodes and explodes them
      all at once, using an inverse square law to recalculate the radius.
      The maximum explosion becomes 125 nodes of tnt yielding a radius of
      15 nodes, which does not break my machine and makes it return
      in under a second.
      
      This makes both bigger explosions and less stability issues.
      
      The drop code has been simplified and now drops at all times a
      reasonable amount of drops, never blanketing the area with drops,
      even at the larges explosion level.
      
      Particles are scaled up according to explosion size as well - a
      bigger explosion will show bigger particles.
      
      To scale the tnt:boom particle, we move it to the _effects() function.
      12c763a6
  3. Apr 30, 2016
    • Auke Kok's avatar
      TNT: Allow mods to override entity physics. · 098ea0d1
      Auke Kok authored
      Introduces an `on_blast(luaobj, damage)` callback that mods can attach
      to an entity def. The function will get called with the damage that
      TNT would make.
      
      The function should return three values:
      
        bool do_damage, bool do_knockback, table drops
      
      do_damage allows the mod to tell the TNT code to perform damage on
      the entity for the mod. The mod code should not do anything with
      the entity HP. The entity should not be immortal. If false, then
      the entity will not be damaged by the TNT mod.
      
      do_knockback allows the mod to tell the TNT mod to perform an
      entity knockback effect. If false, no knockback effect is applied
      to the entity.
      
      the drops table is a list of items to drop. It may be nil. E.g. {
      "wool:red" }.
      
      I've documented both on_blast() API methods in game_api.txt. It is
      a better place than lua_api.txt.
      098ea0d1
    • Auke Kok's avatar
      TNT: Fix multiple explosions erasing drops · f14b4111
      Auke Kok authored
      Any second explosion near a first TNT explosion will punch all
      entities found nearby, including item drops. This causes the
      item pickup code to think the item was picked up, but by
      a `nil` player, thus removing the item.
      
      We query for the immortal entity group, and if the item is in
      the immortal group, do not punch the item.
      f14b4111
  4. Apr 26, 2016
    • Auke Kok's avatar
      TNT: make tnt:boom visual a particle, and larger · 5cd4b5a2
      Auke Kok authored
      We reuse the tnt:boom texture for a particle that is added by the
      on_construct() of tnt:boom, and has a short expiry time (0.2sec).
      It is 3 nodes larged, centered on the explosion.
      
      We then make tnt:boom airlike so it doesn't have a texture, and it's
      the thing that emits lots of light (we could even make it exist a
      bit longer).
      
      The nice thing about particles is that the client is less susceptible
      to lag and will always remove them as fast as possible, so this makes
      the visual more constant and responsive.
      5cd4b5a2
    • Auke Kok's avatar
      TNT: lower smoke particle count and speed. · f62afa02
      Auke Kok authored
      The effect is similar, and the reduction in particles is a small
      boost in responsiveness.
      
      To compensate, I've lowered the spawner time and expiration length
      as well.
      f62afa02
    • Auke Kok's avatar
      TNT: self-start boom removal timer. · 7a892c70
      Auke Kok authored
      7a892c70
    • Auke Kok's avatar
      TNT: make tnt:burning a falling node. · 682d79b8
      Auke Kok authored
      This allows TNT to be used for e.g. traps (drop it from the
      ceiling) or weird tnt effects with other explosions.
      682d79b8
    • Auke Kok's avatar
      TNT: randomly vary ejecting velocity · 8b384fb2
      Auke Kok authored
      We add a +/- 0.5 random value to the velocity vector of
      ejecting nodes.
      
      I've spotted a lot of nodes going exactly straight up if blowing
      up sand above TNT. The extra variation looks less artificial.
      8b384fb2
    • Auke Kok's avatar
      TNT: Damage mobs, knock back players · d6c33da3
      Auke Kok authored
      We apply punch damage to mobs caught in the blast radius, as
      this code previously only hurt players.
      
      We "move" players back 1 node if they're caught in the blast, and
      slightly up. We can't "eject" players due to missing API code to
      support that, unfortunately.
      d6c33da3
    • Auke Kok's avatar
      TNT: Whitespace cleanup · 386dcdef
      Auke Kok authored
      386dcdef
    • Auke Kok's avatar
      TNT: Add on_blast to all nodes with an inventory · 54b87e95
      Auke Kok authored
      Adds a minor helper function that allows efficient retrieval of
      several inventories from a node inventory. We use this helper to
      quickly retrieve the items in chests, vessel shelves, book shelves
      and furnaces, and return these with the nodes itself to the TNT caller.
      
      The TNT caller then performs the entity physics, and we don't need
      to do anything else.
      
      We disable TNT doing anything with bones.
      
      We expose a bug in the code that drops the items - metadata was lost
      entirely. This patch corrects that by properly copying the metadata
      and creating the drops list inclusive metadata.
      54b87e95
  5. Apr 16, 2016
    • Auke Kok's avatar
      Call nodeupdate on the entire blast zone · a2d4e577
      Auke Kok authored
      This will make sand and gravel blocks on top of TNT actually fly
      in the air.
      
        https://youtu.be/4omndVZijLc
      a2d4e577
    • Auke Kok's avatar
      Limit entity speed to 250m/s. · 8114c3db
      Auke Kok authored
      Let's just call it "terminal" velocity.
      8114c3db
    • Auke Kok's avatar
      TNT: Move timer start to on_create() for burning nodes. · e6cef576
      Auke Kok authored
      We add on_create() handlers for both burning TNT and burning
      gunpowder. Because gunpowder will explode TNT in 1 second,
      and not 4, we need to modify the 4 second timer after we
      make the TNT burning. Other mods can now place burning TNT
      that will by default explode after 4 seconds.
      e6cef576
    • Auke Kok's avatar
      TNT: Fix up nil derefs · 0736d30e
      Auke Kok authored
      I spotted two places where under stress (many explosions) luajit would
      end up passing nil to these functions. I'm not entirely sure how,
      but it seems good form to guard against it, which does make it
      more robust. After this patch, I'm not able to crash the server. With
      many explosions, it may still lag significantly, but always returns
      in the end.
      0736d30e
    • red-001's avatar
      Restructure code to only check `def` once. · a84e2669
      red-001 authored
      a84e2669
    • Auke Kok's avatar
      Calculate blast intensity at all locations. · ccee025c
      Auke Kok authored
      We define the blast intensity as the square of the tnt_radius, divided
      by the square of the distance to the explosion center, where distance
      is limited to 1 at the lower end.
      
      When destroying nodes, we calculate the intensity for each node, and
      only destroy the nodes when the intensity is 1.0 or larger. To avoid
      perfectly spherical explosions, we make sure to retain a randomness
      factor of 20%. This will make explosion edges jagged and not smooth,
      but not too much.
      
      We pass the calculated intensity to on_blast() functions as well,
      except we take the jitter here out and make sure it's always 1.0
      or larger.
      ccee025c
    • Auke Kok's avatar
      TNT: Limit amount of stacks ejected. · 8c801529
      Auke Kok authored
      We apply a log scale to the size of the stacks ejected, so that
      in larger explosions we are getting larger stacks. For normal r=3
      explosions, this gives stack sizes ~6-7 or so, but for r=10 explosions
      it could end up giving stacks of 25+.V
      8c801529
    • Auke Kok's avatar
      TNT: Chain reaction · 3ddff2fb
      Auke Kok authored
      With the new high res timer, we can make TNT much better create chain
      reactions. This does exactly that.
      3ddff2fb
    • Auke Kok's avatar
      TNT particles: use drops list smartly · eafd1ebc
      Auke Kok authored
      The drops list already has quantities, so let's just select the one
      with the highest quantity from it, and use that as tile. Fallback
      tile will therefore only be used if explosion happens in air. Oh well.
      eafd1ebc
    • Auke Kok's avatar
      TNT: Spacing / codestyle fixes · 3623398b
      Auke Kok authored
      - Fix spacing errors around = and ..
      - Indentation fixes
      - Break up long lines
      3623398b
    • red-001's avatar
    • red-001's avatar
      Fix TNT mod calculate blast intensity. · 9f4dc141
      red-001 authored
      Currently the TNT mod uses a dummy vaule of 1 for this.
      9f4dc141
    • red-001's avatar
      Add TNT API. · cfef21f4
      red-001 authored
      cfef21f4
    • Auke Kok's avatar
      TNT: add some depth to the explosion effect · 8556dd30
      Auke Kok authored
      We add a dirt-like particle (drawn from scratch, uses some
      colors from default_dirt's palette) to spawn many particles
      that have collision enabled around the center of the blast.
      
      This has the effect of obscuring the center of the blast, as
      that is a painfully visible empty area when the explosion happens,
      as there's only a little spark.
      
      The dirt particles bounce around the walls and floor a bit,
      and disappear rapidly, well before the smoke particles disappear.
      
      This is a nice visual distraction that obscures the sudden
      appearance of the gaping hole, and makes it a whole lot more
      believable.
      8556dd30
    • Auke Kok's avatar
      Make TNT a bit more fun. · 8cd049c2
      Auke Kok authored
      But not too much.
      
      TNT is a bit underwhelming at the moment. We can make it a bit
      more interesting by ejecting not just one or two itemstacks,
      but a bunch of them. This code splits up the drops into
      separate itemstacks that are 2-5 items together, which
      results in generally roughly 10 itemstacks being ejected.
      
      Since now we have multiple ejecta, it makes sense to tune
      the ejecta velocities a bit better to get the appearance of
      an actual explosion better. The items will not all start
      with the same vertical velocity, since that would look
      like fireworks. Instead we give them all a different vertical
      speed.
      8cd049c2
    • Auke Kok's avatar
      Allow the on_blast API to pass an itemstack. · 12d5ca2f
      Auke Kok authored
      If the node is special and has an on_blast() handler, we need
      to call it instead of getting node drops manually. However, we
      do want to know if drops should be added for the special nodes,
      so we modify the on_blast() handler code to allow the nodedef
      handlers to pass back itemstacks. This could be used by e.g.
      the doors mod to drop door items after a blast.
      
      Since this API is documented in lua_api.txt, a separate PR will
      be incoming to update the on_blast() documentation.
      12d5ca2f
  6. Feb 18, 2016
    • tenplus1's avatar
      added timer to tnt:tnt_burning for explosions · 36d18cb1
      tenplus1 authored
      By adding the timer to the tnt:tnt_burning node it will help mods add the block and cause an explosion after 4 seconds instead of doing nothing like in it's current state.
      36d18cb1
    • Craig Davison's avatar
      Remove log_mods from TNT · b47a5564
      Craig Davison authored
      This option is not documented nor is it used with any other mod in Minetest Game so why should it be used in TNT?
      b47a5564
  7. Feb 14, 2016
    • paramat's avatar
      Consolidate ABMs · 7d2dfe41
      paramat authored
      Spread ABM intervals evenly across 1 to 16 seconds
      16s ensures no nodes are missed when player walks past
      Adjust chance values to compensate, for identical action rates
      Combine lavacooling ABMs into one, return to chance = 1
      Grass growth: add 'neighbors = "air"' to avoid
      processing the thousands of underground dirt nodes
      Grass death: Reduce action rate to that of grass growth
      Fire: Use chance = 1 for flame extinguishing
      and flame removal when mod is disabled
      7d2dfe41
  8. Jan 06, 2016
  9. Jun 18, 2015
  10. Jun 07, 2015
  11. May 12, 2015
  12. Jan 10, 2015
  13. Jul 26, 2014
  14. Jul 22, 2014
Loading