This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name NPC bodygroup and bone manipulation example | |
--@author Name | |
--@shared | |
-- USAGE: | |
-- Place the chip on G-Man NPC (npc_gman) | |
local owner, client, chip, world = owner(), player(), chip(), entity(0) | |
if SERVER then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Basic continuous chair controller | |
--@author Name | |
--@server | |
-- USAGE: | |
-- Place chip on the ground, a chair will spawn, sit in it and press W or S | |
local owner, client, chip, world = owner(), player(), chip(), entity(0) | |
-- Create a frozen SENT chair 20 units above the chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Basic event chair controller | |
--@author Name | |
--@server | |
-- USAGE: | |
-- Place chip on the ground, a chair will spawn, sit in it and press W or S | |
local owner, client, chip, world = owner(), player(), chip(), entity(0) | |
-- Create a frozen SENT chair 20 units above the chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Find Closest Chair in Area Example | |
--@author Name | |
--@server | |
local owner, client, chip, world = owner(), player(), chip(), entity(0) | |
local origin = chip:getPos() -- Origin of the search | |
local distance = 200^2 -- Maximum distance of the chair (still 200, but square it so it's faster to compare later on) | |
-- Find all chairs and disregard those that are not owned by us or are farther than the specified distance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Link Chair via Wire Example | |
--@author Name | |
--@server | |
local owner, client, chip, world = owner(), player(), chip(), entity(0) | |
-- Just a simple function that will set a "random" color to the provided entity | |
local function set_random_color(ent) | |
local color = Color(math.random(0, 360), 1, 1):hsvToRGB() | |
ent:setColor(color) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if SERVER then | |
local function spawn_ent(pos) | |
local ent = ents.Create("prop_physics") | |
ent:SetModel("models/hunter/blocks/cube05x05x05.mdl") | |
ent:SetPos(pos) | |
ent:Spawn() | |
-- Make use of the `PhysicsCollide` callback to know when entity collides | |
ent:AddCallback("PhysicsCollide", function(self, data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Solution #1: Add `set_value_direct` only for the specified slider instance | |
local slider = wibox.widget.slider() -- ...or any other valid way to create the slider object | |
function slider:set_value_direct(value) | |
value = math.min(math.max(value, self:get_minimum()), self:get_maximum()) | |
if value ~= self._private.value then | |
self._private.value = value | |
self:emit_signal("property::value", value, true) -- Pass an additional `true` value to the callback | |
self:emit_signal("widget::redraw_needed") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Generic | |
--@author Name | |
local track_seats = {} | |
local track_drivers = {} | |
local empty_func = function(...) end | |
------------------------------------------- | |
local Pod = class("Pod") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Focus different client | |
-- The input is passed to the client before switching focus *(just like in `unfocus_client.lua)* | |
client.connect_signal("request::default_mousebindings", function() | |
awful.mouse.append_client_mousebindings { | |
awful.button({ "Mod4" }, 4, function(c) | |
for _, other in ipairs(client.get()) do | |
if other ~= c then | |
client.focus = other | |
break | |
end |
OlderNewer