Results 1 to 2 of 2

Thread: Lua entities in SourceOP

  1. #1
    Drunken F00l's Avatar



    Join Date
    Dec 11, 2004
    Last Online
    Jun 11, 2019
    Posts
    5,874
    Threads
    182
    Reputation
    SourceOP Thread


        
    Steam: 76561197968459473 
    Steam join date: Aug 23, 2004
    Steam Level: 56
    Profile Status: Public


    Lua entities in SourceOP


    It's still in development and early stages, but I got Lua entities in SourceOP working. Lua scripters can make their own custom entities and can spawn them in SourceOP or any other plugin capable of spawning entities. It works similar to how Garry's mod works so that it is familiar to those with experience using Garry's mod.

    Example:

    lua/entities/sop_luatest2/info.lua
    Code:
    ENT.Type		= "anim"
    ENT.Base		= "base_entity"
    
    ENT.PrintName		= "Test Entity2"
    ENT.Author		= "Drunken F00l"
    ENT.Contact		= ""
    ENT.Purpose		= "Test Entity2"
    ENT.Instructions	= "Spawn and watch in awe as the test entity works."
    lua/entities/sop_luatest2/init.lua
    Code:
    include('info.lua')
    
    function ENT:Precache()
      util.PrecacheModel("models/props_c17/furniturebathtub001a.mdl")
    end
    
    function ENT:Initialize()
      Msg(self.PrintName .. ": Hi. Spawned at (" .. tostring(self:GetAbsOrigin()) .. ")\n")
      self:SetModel("models/props_c17/furniturebathtub001a.mdl")
      self:PhysicsInit(SOLID_VPHYSICS)
    end
    
    function ENT:Think()
      return false
    end
    This entity spawns as a bathtub and prints a message in the server console saying where it spawned when it spawns. Real basic, I know, but there is lots of potential with this. Hopefully I will be able to code the radio and snark completely in Lua.

  2. #2
    Hell-met's Avatar



    Join Date
    Feb 15, 2008
    Last Online
    Jul 17, 2014
    Posts
    4,310
    Threads
    64




    Wisely done, that thing has so much potential.

Tags for this Thread