Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[=====[
- Outpost Omega - Lua API Examples
- --]=====]
- -- 1: Hello World!
- print("Example 1: Hello World")
- print("Hello World!")
- -- 2: Get a GameObject and do stuff with it
- print("Example 2: Get a GameObject and do stuff")
- firstgameobject = GetFirstGO("")
- print(firstgameobject.ID)
- print(firstgameobject.Position)
- print(firstgameobject.Static)
- print(firstgameobject.IsPhysical)
- firstgameobject:SetPosition(Vector3(10, 10, 10))
- if(firstgameobject.IsPhysical) then
- firstgameobject:PhysicDisable()
- end
- -- 3: Get all GameObjects and print details about them
- print("Example 3: All loaded GameObjects")
- gameobjects = GetGO("")
- for k, v in pairs(gameobjects) do
- print(k .. " - " .. v.Position:ToString())
- end
- -- 4: Create a new GameObject
- print("Example 4: Create a new GameObject")
- builder = NewBuilder()
- builder.ClassName = "NiceObject"
- builder:SetParent("OutpostOmega.Game.gObject.structure.machinery.machinery")
- builder:AddAttribute("OutpostOmega.Game.gObject.attributes.Definition", {"Nice Object", "What a nice object. Holy sheeet"})
- builder:AddAttribute("OutpostOmega.Game.gObject.attributes.Construction", { getType("OutpostOmega.Game.gObject.structure.Frame"), getType("OutpostOmega.Game.gObject.item.tool"), "Content\\\Model\\\Structure\\Machinery\\\Doors\\\Airlock.dae"})
- builder:Hook("Constructor",
- function(myObject) -- the constructor point will pass the new created instance
- myObject.Model = "Content\\\Model\\\Structure\\Machinery\\\Dooars\\\Airlock.dae"
- end)
- builder:Hook("KeyPress",
- function(myObject, Key, IsRepeat)
- if(IsKey(Key, "E") and IsRepeat) then
- myObject:Dispose()
- end
- end)
- newType = builder:Compile()
- print(newType)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement