[LUAmmer]

If you liked this item, please rate it up on Steam Workshop page.

Author: filz0

Last revision: 10 Mar, 2024 at 11:02 UTC (1)

File size: 13.08 KB

On Steam Workshop

Description:
Description:

A simple API that allows you to "inject" lua code into hammer maps. Fast and simple. Entries can be added using entity names, classes, or positions. Everything is fully networked. Great for adding extra functionality or applying fixes for engine entities.

———————————————————————-
Some Of The Features:
  • LUAmmer.AddEntry(map, nameORclassORpos, func)

    Used to add LUAmmer entries. Entries get only added when the specified map gets loaded.

    map
    Entries will be loaded only if the specified map is loaded
    nameORclassORpos
    Name, class, or position of an entity that you wish to inject lua to
    func
    Pretty much an Initialize function, here you can apply your code. Mind that it i shared between the server and the clients

    Examples:
    1. Of using the entity’s class:
      LUAmmer.AddEntry( "testroom2_extended", "npc_citizen", function(self) –Code end )

    2. Of using the entity’s name:
      LUAmmer.AddEntry( "testroom2_extended", "thomas", function(self) –Code end )

    3. Of using the entity’s position:
      LUAmmer.AddEntry( "testroom2_extended", "254 2001 -450", function(self) –Code end )

    4. Of using multiple identifiers:
      LUAmmer.AddEntry( "testroom2_extended", "thomas_1, thomas_2, thomas_3", function(self) –Code end )

  • LUAmmer.RemoveEntry(nameORclassORpos)

    Used to remove entries from the LUAmmer. Really should be used only when working on a map.

    nameORclassORpos
    Name of the entry that you wish to remove.

  • LUAmmer.CreateVar(ent, var, val)

    Used to create variables for entities that should be saved by duplication tools (Duplicator and Adv. Duplicator 2). Once set, it can only be changed via SetVar function

    ent
    Entity that you want to create a variable for
    var
    Name of your variable
    val
    Value of your variable

    Example:
    1. Of creating a variable "m_bCanBeUsed". Now it can be overridden with SetVar to false and it will load as such when loading a save:
      LUAmmer.CreateVar(self, "m_bCanBeUsed", true)

  • LUAmmer.SetVar(ent, var, val)

    Used to change/override saved variables

    ent
    Entity that you want to override a variable for
    var
    Name of your variable
    val
    Value of your variable

  • ENT:LUAmmerOutputHook(entOutput, func)

    Used to add functions to entity outputs (I/O)

    entOutput
    Name of an output (OnPlayerPickup for an example)
    func
    Function to run when output gets fired

    Example:
    1. Of using prop_physics’s "OnPlayerPickup" output which runs when players pick it up by hand or via the gravity gun:
      prop:LUAmmerOutputHook("OnPlayerPickup", function(self, activator, caller) — Code end)

  • ENT:LUAmmerRelatedEntity(name)

    Used to easily get a reference of entities related to our entity via name and ID. This function will search for the entity with the provided name and return the first match. If your entity doesn’t have an ID ("tank_turret" and no digit at the and) or has no name at all, the function will look for an entity with an exact provided name.

    name
    Name of the entity (tank_turret for an example)

    Example:
    1. Of finding an entity related to ours. Our entity’s name is "tank_turret1" in this example:
      local seat = self:LUAmmerRelatedEntity("tank_seat")

      Since our entity’s name was "tank_turret1", function looked for an entity named "tank_seat1" and returned it (if found)

———————————————————————-

CREDITS:
  • Me – Coding,
  • Valve – Not Half-Life 3.
Have Fun! :B1:

tags: testroom2 hl2beta beta

Download
Revisions:

Old revisions of this mod are available below. Click the link to download.