content stringlengths 5 1.05M |
|---|
function start (song)
print("Song: " .. song .. " @ " .. bpm .. " donwscroll: " .. downscroll)
end
local defaultHudX = 0
local defaultHudY = 0
local defaultWindowX = 0
local defaultWindowY = 0
local lastStep = 0
local dadX = 0
local dadY = 0
local boyfriendX = 0
local boyfriendY = 0
function update (elapsed)
local currentBeat = (songPos / 1000)*(bpm/60)
end
function beatHit (beat)
if curBeat == 128 or curBeat == 256 then
changeDadCharacter('b3-mom-mad', 100, 100)
end
if curBeat == 224 or curBeat == 276 then
changeDadCharacter('b3-mom-sad', 100, 100)
end
end
function stepHit (step)
end
|
Scripts = Scripts or {}
-- Constant velocity script.
local ConstantVelocity = {}
ConstantVelocity.__index = ConstantVelocity
Scripts.ConstantVelocity = ConstantVelocity
function ConstantVelocity:New(velocity)
local self = {}
self.velocity = velocity
return setmetatable(self, ConstantVelocity)
end
function ConstantVelocity:OnUpdate(entitySelf, timeDelta)
-- Get transform component.
local transform = ComponentSystem:LookupTransform(entitySelf)
-- Update position.
local position = transform:GetPosition()
position.x = position.x + self.velocity.x * timeDelta
position.y = position.y + self.velocity.y * timeDelta
transform:SetPosition(position)
end
setmetatable(ConstantVelocity, { __call = ConstantVelocity.New })
-- Destroy on death script.
local DestroyOnDeath = {}
DestroyOnDeath.__index = DestroyOnDeath
Scripts.DestroyOnDeath = DestroyOnDeath
function DestroyOnDeath:New()
local self = {}
return setmetatable(self, DestroyOnDeath)
end
function DestroyOnDeath:OnDamaged(entitySelf, value, alive)
if not alive then
EntitySystem:DestroyEntity(entitySelf)
end
end
setmetatable(DestroyOnDeath, { __call = DestroyOnDeath.New })
-- Destroy on collision script.
local DestroyOnCollision = {}
DestroyOnCollision.__index = DestroyOnCollision
Scripts.DestroyOnCollision = DestroyOnCollision
function DestroyOnCollision:New()
local self = {}
return setmetatable(self, DestroyOnCollision)
end
function DestroyOnCollision:OnCollision(collisionSelf, collisionOther)
EntitySystem:DestroyEntity(collisionOther.entity)
end
setmetatable(DestroyOnCollision, { __call = DestroyOnCollision.New })
-- Damage on collision script.
local DamageOnCollision = {}
DamageOnCollision.__index = DamageOnCollision
Scripts.DamageOnCollision = DamageOnCollision
function DamageOnCollision:New(damage, interval)
local self = {}
self.damage = damage
self.interval = interval
return setmetatable(self, DamageOnCollision)
end
function DamageOnCollision:OnCollision(collisionSelf, collisionOther)
-- Apply damage to other entity.
HealthSystem:Damage(collisionOther.entity, self.damage)
-- Disable collision pair for a period of time.
CollisionSystem:DisableCollisionResponse(collisionSelf.entity, collisionOther.entity, self.interval)
end
setmetatable(DamageOnCollision, { __call = DamageOnCollision.New })
-- Flash on damage script.
local FlashOnDamage = {}
FlashOnDamage.__index = FlashOnDamage
Scripts.FlashOnDamage = FlashOnDamage
function FlashOnDamage:New()
local self = {}
self.timer = 0.0
return setmetatable(self, FlashOnDamage)
end
function FlashOnDamage:OnUpdate(entitySelf, timeDelta)
-- Don't do anything if not needed.
if self.timer == 0.0 then
return
end
-- Update render component.
local render = ComponentSystem:LookupRender(entitySelf)
render:SetEmissionColor(Vec3(1.0, 1.0, 1.0))
render:SetEmissionPower(self.timer)
-- Update blink time.
self.timer = math.max(0.0, self.timer - timeDelta)
end
function FlashOnDamage:OnDamaged(entitySelf, value, alive)
-- Reset blink time.
self.timer = 0.8
end
setmetatable(FlashOnDamage, { __call = FlashOnDamage.New })
|
return {
-- simple bar spectogram, adapted from guycooks reference at shadertoy
label = 'Bars',
version = 1,
filter = "none",
frag = [[
uniform sampler2D map_tu0;
uniform float obj_opacity;
varying vec2 texco;
#define bars 32.0
#define bar_sz (1.0 / bars)
#define bar_gap (0.1 * bar_sz)
float h2rgb(float h){
if (h < 0.0)
h += 1.0;
if (h < 0.16667)
return 0.1 + 4.8 * h;
if (h < 0.5)
return 0.9;
if (h < 0.66669)
return 0.1 + 4.8 * (0.6667 - h);
return 0.1;
}
vec3 i2c(float i)
{
float h = 0.6667 - (i * 0.6667);
return vec3(h2rgb(h + 0.3334), h2rgb(h), h2rgb(h - 0.3334));
}
void main()
{
if (obj_opacity < 0.01)
discard;
vec2 uv = vec2(1.0 - texco.s, 1.0 - texco.t);
float start = floor(uv.x * bars) / bars;
if (uv.x - start < bar_gap || uv.x > start + bar_sz - bar_gap){
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
return;
}
/* rather low resolution as we've done no funky "pack float in rgba" trick */
float intens = 0.0;
for (float s = 0.0; s < bar_sz; s += bar_sz * 0.02){
intens += texture2D(map_tu0, vec2(start + s, 0.5)).g;
}
intens *= 0.02;
intens = clamp(intens, 0.005, 1.0);
float i = float(intens > uv.y);
gl_FragColor = vec4(i2c(intens) * i, obj_opacity);
}]],
uniforms = {}
};
|
local luaUnit = require("luaunit")
local ColorTextOutput = luaUnit.genericOutput.new() -- derived class
local ColorTextOutput_MT = {__index = ColorTextOutput} -- metatable
ColorTextOutput.__class__ = "ColorTextOutput"
function ColorTextOutput.new(runner)
local t = luaUnit.genericOutput.new(runner, luaUnit.VERBOSITY_DEFAULT)
t.errorList = {}
return setmetatable(t, ColorTextOutput_MT)
end
function ColorTextOutput:startSuite()
if self.verbosity > luaUnit.VERBOSITY_DEFAULT then
print("Started on " .. self.result.startDate)
end
end
function ColorTextOutput:startTest(testName)
if self.verbosity > luaUnit.VERBOSITY_DEFAULT then
io.stdout:write(" ", self.result.currentNode.testName, " ... ")
end
end
function ColorTextOutput:endTest(node)
if node:isSuccess() then
if self.verbosity > luaUnit.VERBOSITY_DEFAULT then
io.stdout:write("Ok\n")
else
io.stdout:write("[92m>[0m")
io.stdout:flush()
end
else
if self.verbosity > luaUnit.VERBOSITY_DEFAULT then
--[[
-- find out when to do this:
if self.verbosity > luaUnit.VERBOSITY_DEFAULT then
print( node.stackTrace )
end
]]
print(node.status)
print(node.msg)
else
-- write only the first character of status E, F or S
io.stdout:write("[91m")
io.stdout:write(string.sub(node.status, 1, 1))
io.stdout:write("[0m")
io.stdout:flush()
end
end
end
function ColorTextOutput:displayOneFailedTest(index, fail)
print(index .. ") " .. fail.testName)
print("[91m" .. fail.msg .. "[0m")
print("[94m" .. fail.stackTrace .. "[0m")
print()
end
function ColorTextOutput:displayErroredTests()
if #self.result.errorTests ~= 0 then
print("Tests with errors:")
print("------------------")
for i, v in ipairs(self.result.errorTests) do
self:displayOneFailedTest(i, v)
end
end
end
function ColorTextOutput:displayFailedTests()
if #self.result.failedTests ~= 0 then
print("Failed tests:")
print("-------------")
for i, v in ipairs(self.result.failedTests) do
self:displayOneFailedTest(i, v)
end
end
end
function ColorTextOutput:endSuite()
if self.verbosity > luaUnit.VERBOSITY_DEFAULT then
print("=========================================================")
else
print()
end
self:displayErroredTests()
self:displayFailedTests()
print(luaUnit.LuaUnit.statusLine(self.result))
if self.result.notSuccessCount == 0 then
print("OK")
end
if (self.result.successCount == 0 and self.result.errorCount == 0 and self.result.failureCount) then
print(
"[93mNo tests[0m found in .\\[94mtest\\test_suite.lua[0m (if that's intentional, consider adding at least one require/dofile for your main script)"
)
end
end
local ColorTapOutput = luaUnit.genericOutput.new() -- derived class
local TapOutput_MT = {__index = ColorTapOutput} -- metatable
ColorTapOutput.__class__ = "ColorTapOutput"
-- For a good reference for TAP format, check: http://testanything.org/tap-specification.html
function ColorTapOutput.new(runner)
local t = luaUnit.genericOutput.new(runner, luaUnit.VERBOSITY_LOW)
return setmetatable(t, TapOutput_MT)
end
function ColorTapOutput:startSuite()
print("1.." .. self.result.selectedCount)
print("# Started on " .. self.result.startDate)
end
function ColorTapOutput:startClass(className)
if className ~= "[TestFunctions]" then
print("[4m# Starting class: " .. className .. "[0m")
end
end
function ColorTapOutput:updateStatus(node)
if node:isSkipped() then
io.stdout:write("[92mok[0m ", self.result.currentTestNumber, "\t# SKIP ", node.msg, "\n")
return
end
io.stdout:write(" [91mnot ok[0m ", self.result.currentTestNumber, "\t[93m", node.testName, "[0m\n")
if self.verbosity > luaUnit.VERBOSITY_LOW then
print("[91m" .. luaUnit.private.prefixString("# ", node.msg) .. "[0m")
print("[94m" .. luaUnit.private.prefixString("# ", node.stackTrace) .. "[0m")
end
if (node:isFailure() or node:isError()) and self.verbosity > luaUnit.VERBOSITY_DEFAULT then
print(luaUnit.private.prefixString("# ", node.stackTrace))
end
end
function ColorTapOutput:endTest(node)
if node:isSuccess() then
io.stdout:write("[92m ok[0m ", self.result.currentTestNumber, "\t", node.testName, "\n")
end
end
function ColorTapOutput:endSuite()
print("# " .. luaUnit.LuaUnit.statusLine(self.result))
return self.result.notSuccessCount
end
local LuaUnitOutput = {
ColorText = ColorTextOutput,
ColorTap = ColorTapOutput
}
return LuaUnitOutput
|
object_mobile_nym_themepark_wes_riggers = object_mobile_shared_nym_themepark_wes_riggers:new {
}
ObjectTemplates:addTemplate(object_mobile_nym_themepark_wes_riggers, "object/mobile/nym_themepark_wes_riggers.iff")
|
-- { expected = 2 }
function foo(x)
local bar = function(a, b, c)
return a + b + c
end
return bar(x, 1, 2)
end
|
-- lua script
module (..., package.seeall)
function AcceptTask(role, taskid, ret)
print("==================================")
print("Player Name = " .. role:GetName())
print("PlayerID = " .. role:GetObjID())
print("AcceptTask taskid = " .. taskid)
if role:AcceptTask(taskid) then
ret.value = 0
print("AcceptTask ret = " .. math.ceil(ret.value))
else
ret.value = -1
print("AcceptTask ret = " .. math.ceil(ret.value))
end
print("###################################")
end
function FinishTask(role, taskid)
print("==================================")
print("Player Name = " .. role:GetName())
print("FinishTask taskid = " .. taskid)
print("==================================")
role:FinishTask(taskid)
end
|
-----------------------------------
-- Area: Attohwa Chasm
-- Mob: Citipati
-----------------------------------
function onMobDeath(mob, player, isKiller)
end;
|
triangle = paf.tutorial.Triangle();
triangle.m_vertices[0] = paf.tutorial.Point(0,0);
triangle.m_vertices[1] = paf.tutorial.Point(0,1);
triangle.m_vertices[2] = paf.tutorial.Point(1,1);
shapeManager = paf.tutorial.ShapeManager.GetInstance();
shapeManager:addShape(triangle);
print(shapeManager:getTotalArea());
|
return {
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68061,
delay = 1
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68062,
delay = 1
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68063,
delay = 1
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68064,
delay = 1
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68065,
delay = 1
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68066,
delay = 1
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68067,
delay = 1
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68068,
delay = 1
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68069,
delay = 1
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68070,
delay = 1
}
}
}
},
uiEffect = "",
name = "试制型Type0",
cd = 0,
painting = 1,
id = 12041,
picture = "1",
castCV = "skill",
desc = "",
aniEffect = {
effect = "jineng",
offset = {
0,
-2,
0
}
},
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 68061,
delay = 1
}
}
}
}
|
--[[lit-meta
name = "coherent/luvit-test-runner"
description = "testing runner"
version = "1.0.0"
tags = {"test","runner"}
license = "MIT"
author = { name = "JB Smith" }
]]
--[[
Using this module:
-- local require for module
local test_runner = require('test-runner')
... setup some prerequisites or add functions that be called for each test ...
-- add a test
-- you can just comment out tests you don't want to be added
test_runner:add_test ('testME_12', function(testname)
assert(1 == 1, testname.." failed because reason")
end)
-- run all tests that have been added
-- supply a success banner string on success to be displayed
test_runner:run("test-runner: all tests pass")
]]
local tests_to_run = {}
local test_runner = {}
test_runner.add_test = function(self, name, test)
tests_to_run[#tests_to_run + 1] = {name, function() test(name) end}
end
test_runner.run = function(self, success_message)
table.foreach(tests_to_run, function(i,v)
v[2]()
io.write(".")
end)
io.write(" ("..#tests_to_run..") tests run "..success_message.."\n")
end
return test_runner
|
-- These are some style prototypes that the tutorial uses
-- You don't need to understand how these work to follow along
local styles = data.raw["gui-style"].default
styles["ugg_content_frame"] = {
type = "frame_style",
parent = "inside_shallow_frame_with_padding",
vertically_stretchable = "on"
}
styles["ugg_controls_flow"] = {
type = "horizontal_flow_style",
vertical_align = "center",
horizontal_spacing = 16
}
styles["ugg_controls_textfield"] = {
type = "textbox_style",
width = 36
}
styles["ugg_deep_frame"] = {
type = "frame_style",
parent = "slot_button_deep_frame",
vertically_stretchable = "on",
horizontally_stretchable = "on",
top_margin = 16,
left_margin = 8,
right_margin = 8,
bottom_margin = 4
} |
local S = waffles.intllib
--Waffle Maker and Waffles--
minetest.register_node("waffles:wafflemaker", {
description = S("Waffle Maker"),
drawtype = "mesh",
mesh = "wafflemaker.obj",
tiles = {"wafflemaker_texture.png"},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {snappy = 3},
sounds = default.node_sound_stone_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
},
collision_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
},
on_punch = function(pos, node, puncher, pointed_thing)
minetest.set_node(pos, {name = "waffles:wafflemaker_open_empty", param2 = node.param2})
end
})
minetest.register_node("waffles:wafflemaker_open_empty", {
description = S("Open Waffle Maker (empty)"),
drawtype = "mesh",
mesh = "wafflemaker_open_empty.obj",
tiles = {"wafflemaker_open_empty_texture.png"},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {snappy = 3, not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
drop = 'waffles:wafflemaker',
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
on_punch = function(pos, node, puncher, pointed_thing)
minetest.set_node(pos, {name = "waffles:wafflemaker", param2 = node.param2})
end
})
minetest.register_node("waffles:wafflemaker_open_full", {
description = S("Open Waffle Maker (full)"),
drawtype = "mesh",
mesh = "wafflemaker_open_full.obj",
tiles = {"wafflemaker_open_full_texture.png"},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
on_punch = function(pos, node, puncher, pointed_thing)
minetest.set_node(pos, { name = "waffles:wafflemaker_closed_full", param2 = node.param2 })
minetest.after(5, minetest.set_node, pos, { name = "waffles:wafflemaker_open_done", param2 = node.param2 })
end,
})
minetest.register_node("waffles:wafflemaker_closed_full", {
description = S("Closed Waffle Maker (full)"),
drawtype = "mesh",
mesh = "wafflemaker_closed_full.obj",
tiles = {"wafflemaker_texture.png"},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
diggable = false,
groups = {not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
},
collision_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
},
})
minetest.register_node("waffles:wafflemaker_open_done", {
description = S("Open Waffle Maker (done)"),
drawtype = "mesh",
mesh = "wafflemaker_open_done.obj",
tiles = {"wafflemaker_open_done_texture.png"},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
on_punch = function (pos, node, player, pointed_thing)
player:get_inventory():add_item("main", "waffles:large_waffle")
minetest.set_node(pos, {name = "waffles:wafflemaker_open_empty", param2 = node.param2})
end
})
--Batter is stored in batter.lua for size reasons
minetest.register_craftitem("waffles:large_waffle", {
description = S("Large Waffle"),
inventory_image = "large_waffle.png",
on_use = minetest.item_eat(8),
})
minetest.register_craftitem("waffles:small_waffle", {
description = S("Small Waffle"),
inventory_image = "small_waffle.png",
on_use = minetest.item_eat(2),
})
--Toaster and Toast--
minetest.register_node("waffles:toaster", {
description = S("Toaster"),
tiles = { "toaster_with_toast_sides.png" },
inventory_image = "waffles_toaster_inv.png",
walkable = false,
groups = { snappy=3 },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.125, 0.125, -0.3125, 0.125}, -- NodeBox1
},
},
})
--Replace homedecor toaster by waffles toaster if detected
if minetest.get_modpath("homedecor") then
minetest.unregister_item("homedecor:toaster")
minetest.register_alias("homedecor:toaster", "waffles:toaster")
end
minetest.override_item("farming:bread", {
description = S("Bread"),
})
local function breadslice_on_use(itemstack, user, pointed_thing)
local node, pos
if pointed_thing.under then
pos = pointed_thing.under
node = minetest.get_node(pos)
end
local pname = user:get_player_name()
if node and pos and (node.name == "homedecor:toaster" or
node.name == "waffles:toaster") then
if minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
else
if itemstack:get_count() >= 2 then
itemstack:take_item(2)
minetest.set_node(pos, {name = "waffles:toaster_with_breadslice", param2 = node.param2})
return itemstack
end
end
else
return minetest.do_item_eat(2, nil, itemstack, user, pointed_thing)
end
end
if minetest.registered_items["farming:bread_slice"] then
minetest.override_item("farming:bread_slice", {on_use = breadslice_on_use })
minetest.register_alias("waffles:breadslice", "farming:bread_slice")
else
minetest.register_craftitem("waffles:breadslice", {
description = S("Slice of Bread"),
inventory_image = "breadslice.png",
groups = {flammable = 2},
on_use = breadslice_on_use,
})
end
if minetest.registered_items["farming:toast"] then
minetest.register_alias("waffles:toast", "farming:toast")
else
minetest.register_craftitem("waffles:toast", {
description = S("Toast"),
inventory_image = "toast.png",
on_use = minetest.item_eat(3),
groups = {flammable = 2},
})
end
minetest.register_node("waffles:toaster_with_breadslice", {
description = S("Toaster with Breadslice"),
inventory_image = "waffles_toaster_inv.png",
tiles = {
"toaster_with_bread_top.png",
"toaster_with_toast_sides.png",
"toaster_with_toast_sides.png",
"toaster_with_toast_sides.png",
"toaster_with_toast_sides.png",
"toaster_with_toast_sides.png"
},
walkable = false,
groups = {not_in_creative_inventory=1},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
diggable = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.125, 0.125, -0.3125, 0.125}, -- NodeBox1
{-0.03125, -0.3125, -0.0935, 0, -0.25, 0.0935}, -- NodeBox2
{0.0625, -0.3125, -0.0935, 0.0935, -0.25, 0.0935}, -- NodeBox3
},
},
on_punch = function(pos, node, clicker, itemstack, pointed_thing)
local fdir = node.param2
minetest.set_node(pos, { name = "waffles:toaster_toasting_breadslice", param2 = fdir })
minetest.after(6, minetest.set_node, pos, { name = "waffles:toaster_with_toast", param2 = fdir })
minetest.sound_play("toaster", {
pos = pos,
gain = 1.0,
max_hear_distance = 5
})
return itemstack
end
})
minetest.register_node("waffles:toaster_toasting_breadslice", {
description = S("Toaster Toasting Slice of Bread"),
tiles = { "toaster_with_toast_toasting_sides.png" },
inventory_image = "waffles_toaster_inv.png",
walkable = false,
groups = {not_in_creative_inventory = 1 },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
diggable = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.125, 0.125, -0.3125, 0.125}, -- NodeBox1
},
},
})
minetest.register_node("waffles:toaster_with_toast", {
description = S("Toaster with Toast"),
inventory_image = "waffles_toaster_inv.png",
tiles = {
"toaster_with_toast_top.png",
"toaster_with_toast_sides.png",
"toaster_with_toast_side_crusts.png",
"toaster_with_toast_side_crusts.png",
"toaster_with_toast_end_crusts.png",
"toaster_with_toast_end_crusts.png"
},
walkable = false,
groups = { snappy=3, not_in_creative_inventory=1 },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.125, 0.125, -0.3125, 0.125}, -- NodeBox1
{-0.03125, -0.3125, -0.0935, 0, -0.25, 0.0935}, -- NodeBox2
{0.0625, -0.3125, -0.0935, 0.0935, -0.25, 0.0935}, -- NodeBox3
},
},
on_punch = function (pos, node, player, pointed_thing)
local inv = player:get_inventory()
local left = inv:add_item("main", "waffles:toast 2")
if left:is_empty() then
minetest.set_node(pos, {name = "waffles:toaster", param2 = node.param2})
end
end
})
--Toaster Waffles--
minetest.register_craftitem("waffles:toaster_waffle", {
description = S("Toaster Waffle"),
inventory_image = "toaster_waffle.png",
on_use = minetest.item_eat(4),
})
minetest.register_craftitem("waffles:toaster_waffle_pack", {
description = S("Pack of 6 Toaster Waffles"),
inventory_image = "toaster_waffle_pack_6.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local pname = user:get_player_name()
if minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
return
end
local node = minetest.get_node(pos)
if node.name == "homedecor:toaster"
or node.name == "waffles:toaster" then
minetest.set_node(pos, {name = "waffles:toaster_with_waffle", param2 = node.param2})
return ItemStack("waffles:toaster_waffle_pack_4")
end
end,
})
minetest.register_craftitem("waffles:toaster_waffle_pack_4", {
description = S("Pack of 4 Toaster Waffles"),
inventory_image = "toaster_waffle_pack_4.png",
groups = {not_in_creative_inventory = 1},
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local pname = user:get_player_name()
if minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
return
end
local node = minetest.get_node(pos)
if node.name == "homedecor:toaster"
or node.name == "waffles:toaster" then
minetest.set_node(pos, {name = "waffles:toaster_with_waffle", param2 = node.param2})
return ItemStack("waffles:toaster_waffle_pack_2")
end
end,
})
minetest.register_craftitem("waffles:toaster_waffle_pack_2", {
description = S("Pack of 2 Toaster Waffles"),
inventory_image = "toaster_waffle_pack_2.png",
groups = {not_in_creative_inventory = 1},
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local pname = user:get_player_name()
if minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
return
end
local node = minetest.get_node(pos)
if node.name == "homedecor:toaster"
or node.name == "waffles:toaster" then
itemstack:take_item()
minetest.set_node(pos, {name = "waffles:toaster_with_waffle", param2 = node.param2})
return itemstack
end
end,
})
minetest.register_node("waffles:toaster_with_waffle", {
description = S("Toaster with Waffle"),
inventory_image = "waffles_toaster_inv.png",
tiles = {
"toaster_with_waffle_top.png",
"toaster_with_waffle_sides.png",
"toaster_with_waffle_side_crusts.png",
"toaster_with_waffle_side_crusts.png",
"toaster_with_waffle_end_crusts.png",
"toaster_with_waffle_end_crusts.png"
},
walkable = false,
groups = {not_in_creative_inventory=1},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
diggable = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.125, 0.125, -0.3125, 0.125}, -- NodeBox1
{-0.03125, -0.3125, -0.0935, 0, -0.25, 0.0935}, -- NodeBox2
{0.0625, -0.3125, -0.0935, 0.0935, -0.25, 0.0935}, -- NodeBox3
},
},
on_punch = function(pos, node, clicker, itemstack, pointed_thing)
local fdir = node.param2
minetest.set_node(pos, { name = "waffles:toaster_toasting_waffle", param2 = fdir })
minetest.after(6, minetest.set_node, pos, { name = "waffles:toaster_with_toasted_waffle", param2 = fdir })
minetest.sound_play("toaster", {
pos = pos,
gain = 1.0,
max_hear_distance = 5
})
return itemstack
end
})
minetest.register_node("waffles:toaster_toasting_waffle", {
description = S("Toaster Toasting Waffle"),
tiles = { "toaster_with_waffle_toasting_sides.png" },
inventory_image = "waffles_toaster_inv.png",
walkable = false,
groups = {not_in_creative_inventory = 1 },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
diggable = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.125, 0.125, -0.3125, 0.125}, -- NodeBox1
},
},
})
minetest.register_node("waffles:toaster_with_toasted_waffle", {
description = S("Toaster with Toasted Waffle"),
inventory_image = "waffles_toaster_inv.png",
tiles = {
"toaster_with_waffle_toasted_top.png",
"toaster_with_waffle_toasted_sides.png",
"toaster_with_waffle_toasted_sides.png",
"toaster_with_waffle_toasted_sides.png",
"toaster_with_waffle_toasted_end_crusts.png",
"toaster_with_waffle_toasted_end_crusts.png"
},
walkable = false,
groups = { snappy=3, not_in_creative_inventory=1 },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.125, 0.125, -0.3125, 0.125}, -- NodeBox1
{-0.03125, -0.3125, -0.0935, 0, -0.25, 0.0935}, -- NodeBox2
{0.0625, -0.3125, -0.0935, 0.0935, -0.25, 0.0935}, -- NodeBox3
},
},
on_punch = function (pos, node, player, pointed_thing)
local inv = player:get_inventory()
local left = inv:add_item("main", "waffles:toaster_waffle 2")
if left:is_empty() then
minetest.set_node(pos, {name = "waffles:toaster", param2 = node.param2})
end
end
})
|
-- note this file is a WIP and has no effect in game at the moment.
---@class ISBuildingBlueprintManager
ISBuildingBlueprintManager = {}
ISBuildingBlueprintManager.MouseDown = function (x, y)
end
ISBuildingBlueprintManager.MouseMove = function (x, y, wx, wy)
end
ISBuildingBlueprintManager.RenderUI = function ()
if getPlayer() == nil then
return;
end
local x = getMouseX();
local y = getMouseY();
x, y = ISCoordConversion.ToWorld(x, y, getPlayer():getZ());
local ix = x;
local iy = y;
if( ix <= 0.5) then
ix = math.floor(ix);
else
ix = math.ceil(ix);
end
if( iy <= 0.5) then
iy = math.floor(iy);
else
iy = math.ceil(iy);
end
x, y = ISCoordConversion.ToScreen(ix, iy, getPlayer():getZ());
local renderer = getRenderer();
----print("got renderer");
renderer:renderRect( x-2, y-2, 4, 4, 1.0, 1.0, 1.0, 1.0);
renderer:renderPoly( x, y,
x + 32, y - 16,
x + 32, (y - 96) - 16,
x, y - 96,
0.3, 0.5, 1, 0.4 );
end
--Events.OnMouseDown.Add(ISBuildingBlueprintManager.MouseDown);
--Events.OnMouseDown.Add(ISBuildingBlueprintManager.MouseMove);
--Events.OnPreUIDraw.Add(ISBuildingBlueprintManager.RenderUI);
|
_spellcard_background = Class(background)
function _spellcard_background:init()
background.init(self, true)
self.layers = {}
self.fxsize = 0
end
function _spellcard_background:AddLayer(img, tile, x, y, rot, vx, vy, omiga, blend, hscale, vscale, init, frame, render)
table.insert(self.layers, {
img = img, tile = tile, x = x, y = y, rot = rot, vx = vx, vy = vy, omiga = omiga,
blend = blend, a = 255, r = 255, g = 255, b = 255,
frame = frame, render = render, timer = 0, hscale = hscale, vscale = vscale
})
if init then
init(self.layers[#self.layers])
end
end
function _spellcard_background:frame()
for _, l in ipairs(self.layers) do
l.x = l.x + l.vx
l.y = l.y + l.vy
l.rot = l.rot + l.omiga
l.timer = l.timer + 1
if l.frame then
l.frame(l)
end
if lstg.tmpvar.bg and lstg.tmpvar.bg.hide == true then
self.fxsize = min(self.fxsize + 2, 200)
else
self.fxsize = max(self.fxsize - 2, 0)
end
end
end
function _spellcard_background:render()
SetViewMode 'world'
if self.alpha > 0 then
local showboss = IsValid(_boss) and lstg.tmpvar.bg and lstg.tmpvar.bg.hide == true
if showboss then
background.WarpEffectCapture()
end
for i = #(self.layers), 1, -1 do
local l = self.layers[i]
SetImageState(l.img, l.blend, Color(l.a * self.alpha, l.r, l.g, l.b))
if l.tile then
local w, h = GetTextureSize(l.img)
for i = -int((208 + l.x) / w + 0.5), int((208 - l.x) / w + 0.5) do
for j = -int((240 + l.y) / h + 0.5), int((240 - l.y) / h + 0.5) do
Render(l.img, l.x + i * w, l.y + j * h)
end
end
else
Render(l.img, l.x, l.y, l.rot, l.hscale, l.vscale)
end
if l.render then
l.render(l)
end
end
if showboss then
background.WarpEffectApply()
end
end
end
|
local ns = require('namespace')
local prefabs = require('Prefab')
local resources = require('resources')
local MoveSystem = ns.class("MoveSystem",ns.System)
--data
MoveSystem.sideview = true
MoveSystem.deadzone = 0.1
MoveSystem.dirs = {
-- 2d3d
up = vec3:new(0, 1, 0),
down = vec3:new(0, -1, 0),
-- 3d
left = vec3:new(0, 0, -1),
right = vec3:new(0, 0, 1),
-- 2d
forward = vec3:new(1, 0, 0),
backward = vec3:new(-1, 0, 0)
}
function MoveSystem:onAddEntity(entity)
print(resources.Sounds.Clowning.id)
--I know this shouldn't be here but it's just a test.
playMusic(resources.Sounds.Clowning.id, true)
changeMusic(resources.Sounds.PTSD_Anthem.id, false)
pauseMusic()
--If this doesn't explode it's a good sign
end
function MoveSystem:requires() return { "playerMove" } end
function MoveSystem:Move(entity,dir, delta, speed)
entity.Transform:translate(dir * delta * speed:magnitude())
end
function MoveSystem:Shoot(entity, delta)
LOG("PEW")
local chan = playSound(resources.Sounds.Oof.id)
setChannelVolume(chan,1)
ns.spawnEntity(Manager,prefabs.Bullet({
Transform = {
position={x=entity.Transform.position.x,y=entity.Transform.position.y,z=entity.Transform.position.z},
rotation={x=0.0,y=0.0,z=0.0},
scale={x=1,y= 1,z=1}}}
))
end
function MoveSystem:Action()
LOG("Secondary")
end
function MoveSystem:Change()
self.sideview = not self.sideview
LOG("Changing view")
end
--Read the input from a keyboard/mouse and sends a commad
function MoveSystem:KeyboardHandleInput(entity,dt,speed)
--Movement
local direction = vec3:new(0, 0, 0)
-- Up and down
if keyPressed(PTSDKeys.W) then direction = direction + self.dirs.up end
if keyPressed(PTSDKeys.S) then direction = direction + self.dirs.down end
-- 2D control
if keyPressed(PTSDKeys.A) and self.sideview then direction = direction + self.dirs.backward end
if keyPressed(PTSDKeys.D) and self.sideview then direction = direction + self.dirs.forward end
-- 3D control
if keyPressed(PTSDKeys.A) and not self.sideview then direction = direction + self.dirs.left end
if keyPressed(PTSDKeys.D) and not self.sideview then direction = direction + self.dirs.right end
self:Move(entity, direction,dt,speed)
-- Actions (shoot, change, something)
if keyJustPressed(PTSDKeys.J) or mouseButtonJustPressed(PTSDMouseButton.Right) then
self:Action()
end
if keyJustPressed(PTSDKeys.H) or mouseButtonJustPressed(PTSDMouseButton.Left) then
self:Shoot(entity, dt)
end
if keyJustPressed(PTSDKeys.Space) then
self:Change()
end
-- UI Pause input
if keyJustPressed(PTSDKeys.P) then
showPauseUI();
end
end
--Read the input from a gamepad and sends a commad
function MoveSystem:ControllerHandleInput(entity,dt,speed)
local axis = controllerLeftAxis(0)
local direction = vec3:new(0, 0, 0)
-- Up and down
if axis.y < -self.deadzone then direction = direction + self.dirs.up end
if axis.y > self.deadzone then direction = direction + self.dirs.down end
-- 2D control
if axis.x > self.deadzone and self.sideview then direction = direction + self.dirs.forward end
if axis.x < -self.deadzone and self.sideview then direction = direction + self.dirs.backward end
-- 3D control
if axis.x > self.deadzone and not self.sideview then direction = direction + self.dirs.right end
if axis.x < -self.deadzone and not self.sideview then direction = direction + self.dirs.left end
self:Move(entity, direction,dt,speed)
-- Actions (shoot, change, something)
if controllerButtonJustPressed(0, PTSDControllerButtons.B) or controllerRightTrigger(0) > self.deadzone then
self:Action()
end
if controllerButtonJustPressed(0, PTSDControllerButtons.A) or controllerLeftTrigger(0) > self.deadzone then
self:Shoot(entity, dt)
end
if controllerButtonJustPressed(0, PTSDControllerButtons.Y) then
self:Change()
end
end
function MoveSystem:update(dt)
for _, entity in pairs(self.targets) do
local playerMoveCom = entity:get("playerMove")
local vx = playerMoveCom.x
local vy = playerMoveCom.y
local vz = playerMoveCom.z
local speed = vec3:new(vx, vy, vz)
self:KeyboardHandleInput(entity,dt,speed)
self:ControllerHandleInput(entity,dt,speed)
end
end
Manager:addSystem(MoveSystem()) |
local info = {
["carColor"] = "Cor do carro",
["lightColor"] = "Cor das luzes",
["nitroColor"] = "Cor do nitro",
["shotColor"] = "Cor do tiro"
}
function buyCarColor(player,id,r,g,b)
if not player or not r or not g or not b then
return callClientFunction(player,"createNotify","Argumentos invalidos",255,0,0)
end
local price = 0
local data = ""
if id == 1 then
price = infos.carColor
data = "carColor"
elseif id == 2 then
price = infos.lightColor
data = "lightColor"
elseif id == 3 then
price = infos.nitroColor
data = "nitroColor"
elseif id == 4 then
price = infos.shotColor
data = "shotColor"
end
if not isPlayerLogged(player) then
return callClientFunction(player,"createNotify","Voce nao esta logado",255,0,0)
end
if getDonatorPlayer(player) or onTakeMoney(player,price) then
setDataValue(player,data,"1")
setNewColor(player,id,r,g,b)
refreshColor(player,id,r,g,b)
callClientFunction(player,"createNotify","Voce comprou um novo custom. ("..info[data]..")",0,236,0)
else
callClientFunction(player,"createNotify","Voce nao tem dinheiro",255,0,0)
end
end
function buyPoliceHeadlight(player)
if not player then
return callClientFunction(player,"createNotify","Argumentos invalidos",255,0,0)
end
if not isPlayerLogged(player) then
return callClientFunction(player,"createNotify","Voce nao esta logado",255,0,0)
end
if getDonatorPlayer(player) or onTakeMoney(player,infos.policeHeadLight) then
setDataValue(player,"policeHeadLight","1")
setElementData(player,"policeHeadLight","true")
callClientFunction(player,"createNotify","Voce comprou um novo custom. (Luzes da policia)",0,236,0)
else
callClientFunction(player,"createNotify","Voce nao tem dinheiro",255,0,0)
end
end
function refreshColor(player,id,r,g,b)
if id == 1 then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then
setVehicleColor(vehicle,r,g,b,r,g,b)
end
elseif id == 2 then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then
setVehicleHeadLightColor(vehicle,r,g,b)
end
elseif id == 3 then
callClientFunction(player,"updateNitroColor",r/255,g/255,b/255)
elseif id == 4 then
setElementData(player,"shotColor",{r,g,b})
end
end
function setColorInLogin(player)
setColor(player)
if getDataValue(player,"nitroColor") == "1" then
local r, g, b = getNewColor(player,3)
callClientFunction(player,"updateNitroColor",r/255,g/255,b/255)
end
if getDataValue(player,"shotColor") == "1" then
r,g,b = getNewColor(player,4)
setElementData(player,"shotColor",{r,g,b})
end
if getDataValue(player,"policeHeadLight") == "1" then
setElementData(player,"policeHeadLight","true")
else
setElementData(player,"policeHeadLight","false")
end
end
function checkPickupedPickup(pickupID,pickupType,pickupModel)
if pickupType == "vehiclechange" then
setColor(source)
end
end
addEvent("onPlayerPickUpRacePickup",true)
addEventHandler("onPlayerPickUpRacePickup",root,checkPickupedPickup)
function onPlayerReady()
setColor( source )
end
addEvent("onNotifyPlayerReady",true)
addEventHandler("onNotifyPlayerReady",root,onPlayerReady)
function setColor(player)
if not isPlayerLogged(player) then
return
end
local vehicle = getPedOccupiedVehicle(player)
if not vehicle then
return
end
if getDataValue(player,"carColor") == "1" then
local r, g, b = getNewColor(player,1)
setVehicleColor(vehicle,r,g,b,r,g,b)
end
if getDataValue(player,"lightColor") == "1" then
local r, g, b = getNewColor(player,2)
setVehicleHeadLightColor(vehicle,r,g,b)
end
if getDonatorPlayer(player) then
callClientFunction(player,"changeWheel")
end
if getDataValue(player,"shotColor") == "1" then
r,g,b = getNewColor(player,4)
setElementData(player,"shotColor",{r,g,b})
end
end |
Config = {}
Config.time = 2 -- hours for refresh
|
countdown =Class{_includes=basestate}
count_down=0.75
function countdown:init()
self.timer=0
self.count=3
end
function countdown:update(dt)
self.timer=self.timer+dt
if self.timer>=count_down then
self.count=self.count-1
self.timer=self.timer%count_down
if self.count==0 then
gStatemachine:change('play')
end
end
end
function countdown:render(o)
countfont=love.graphics.newFont('flappy.ttf',56)
love.graphics.setFont(countfont)
love.graphics.printf(tostring(self.count),0,110,virtual_width,'center')
end
|
--package.path = package.path..";/lib/rest/?.lua"
package.path = package.path..";lib/external/?.lua"
package.path = package.path..";lib/userinterface/?.lua"
if require("main") ~= true then
error("main.lua not found. you must create one it is the entry point for your application.")
end
|
workspace "Crossfire"
architecture "x64"
configurations
{
"Debug",
"Release",
"Dist"
}
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
IncludeDirs = {}
IncludeDirs["spdlog"] = "%{wks.location}/Core/vendor/spdlog/include"
IncludeDirs["glfw"] = "%{wks.location}/Core/vendor/glfw/include"
IncludeDirs["glad"] = "%{wks.location}/Core/vendor/glad/include"
IncludeDirs["glm"] = "%{wks.location}/Core/vendor/glm"
LibDirs = {}
LibDirs["glfw"] = "%{wks.location}/Core/vendor/glfw/lib-vc2019"
include "Core"
include "Core/vendor/glad"
include "Engine" |
Locales['en'] = {
['bilpName'] = 'Barberia & Peluqueria',
['started'] = 'Pulsa ~y~[E] ~w~para sentarte',
['alreadyHair'] = 'Ahora mismo estamos llenos, vuelve en un rato!',
['angle'] = '~INPUT_VEH_FLY_YAW_LEFT~ Vista normal ~INPUT_VEH_FLY_YAW_RIGHT~ Vista lateral',
['menu_title'] = 'Cambiar estilo',
['buttom_Help'] = '~INPUT_FRONTEND_ENDSCREEN_ACCEPT~ ~b~Confirmar y irse\n~INPUT_SELECT_CHARACTER_MICHAEL~ Cambiar peinado - ~g~ %s$\n~INPUT_SELECT_CHARACTER_FRANKLIN~ ~b~Cambiar barba - ~g~ %s$\n~INPUT_SELECT_CHARACTER_TREVOR~ ~b~Estiliza tus cejas - ~g~ %s$\n~b~Total fee: ~g~%s$',
['paid'] = 'Has pagado %s$',
}
|
--[[
Name: clothing_store.lua
For: SantosRP
By: Ultra
]]--
local MapProp = {}
MapProp.ID = "clothing_store"
MapProp.m_tblSpawn = {
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2345.402588 -3059.934814 109.607994'), ang = Angle('0.000 0.088 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2603.844482 -2966.632568 109.496979'), ang = Angle('0.000 -90.000 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2622.725830 -2960.240967 103.795334'), ang = Angle('0.000 0.000 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2352.467773 -3078.512695 103.698364'), ang = Angle('0.000 89.995 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2603.391113 -3075.550781 109.632820'), ang = Angle('0.000 -89.995 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2631.015869 -2979.372803 109.613655'), ang = Angle('0.000 89.995 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2622.679688 -3068.833496 103.817268'), ang = Angle('0.000 0.000 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2454.260498 -3059.744873 109.512169'), ang = Angle('0.000 0.000 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2611.432617 -2987.235596 103.684921'), ang = Angle('0.000 179.995 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2630.492676 -3088.356445 109.672638'), ang = Angle('0.000 90.000 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2434.479492 -3067.433105 103.490486'), ang = Angle('0.000 -89.995 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2611.458496 -3095.951172 103.706543'), ang = Angle('0.000 -179.995 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2326.201904 -3067.346680 103.723083'), ang = Angle('0.000 -90.000 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2332.715576 -3085.989258 109.560822'), ang = Angle('0.000 179.995 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2461.723389 -3078.586182 103.690659'), ang = Angle('0.000 90.000 0.000') },
{ mdl = 'models/props/de_tides/vending_tshirt.mdl',pos = Vector('-2441.680664 -3086.506836 109.732529'), ang = Angle('0.000 -179.995 0.000') },
}
MapProp.m_tblMenuTriggers = {
{ pos = Vector('-2719.968750 -2853.100098 140'), ang = Angle('0 0 0'), msg = "(Use) Purchase Clothing", menu = "clothing_items_store" },
{ pos = Vector('-2623.488525 -3186.968750 140'), ang = Angle('0 90 0'), msg = "(Use) Purchase Clothing", menu = "clothing_items_store" },
{ pos = Vector('-2428.817627 -3186.968750 140'), ang = Angle('0 90 0'), msg = "(Use) Purchase Clothing", menu = "clothing_items_store" },
{ pos = Vector('-2233.399658 -3186.968750 140'), ang = Angle('0 90 0'), msg = "(Use) Purchase Clothing", menu = "clothing_items_store" },
}
function MapProp:CustomSpawn()
for _, propData in pairs( self.m_tblMenuTriggers ) do
local ent = ents.Create( "ent_menu_trigger" )
ent:SetPos( propData.pos )
ent:SetAngles( propData.ang )
ent:SetMenu( propData.menu )
ent.IsMapProp = true
ent:Spawn()
ent:Activate()
ent:SetText( propData.msg )
end
end
GAMEMODE.Map:RegisterMapProp( MapProp ) |
object_mobile_space_comm_gotal_bandit_05 = object_mobile_shared_space_comm_gotal_bandit_05:new {
}
ObjectTemplates:addTemplate(object_mobile_space_comm_gotal_bandit_05, "object/mobile/space_comm_gotal_bandit_05.iff")
|
function love.load()
love.graphics.setBackgroundColor(54, 172, 248)
bulletSpeed = 250
bullets = {}
bullets2 = {}
bullets2p2 = {}
bulletsp2 = {}
--player = {x=300, y=300, width=15, height=15,speed = 200}
player = {x=0, y=0, width=40, height=40,speed = 200}
--player2 = {x=300,y=300,width=10,height=10,speed=220}
player2 = {x=0,y=0,width=10,height=10,speed=220}
ybound = love.graphics.getHeight()
xbound = love.graphics.getWidth()
scalx = 2
scaly = 2
myangle = 0
transx = 300
transy = 300
end
function love.draw()
love.graphics.push()
--love.graphics.scale(scalx,scaly)
love.graphics.translate(transx,transy)
love.graphics.rotate(math.rad(myangle))
love.graphics.setColor(255, 255, 255)
love.graphics.rectangle("fill", player.x, player.y, player.width, player.height)
love.graphics.setColor(0,0,0)
love.graphics.rectangle("fill", player2.x,player2.y,player2.width,player2.height)
love.graphics.setColor(0, 250, 128)
for i,v in ipairs(bullets) do
love.graphics.circle("fill", v.x, v.y, 2)
end
love.graphics.setColor(0,100,100)
for i,v in ipairs(bullets2) do
love.graphics.circle("fill", v.x, v.y, 1)
end
love.graphics.setColor(100,0,100)
for i,v in ipairs(bulletsp2) do
love.graphics.circle("fill",v.x,v.y,2)
end
love.graphics.setColor(120,0,120)
for i,v in ipairs(bullets2p2) do
love.graphics.circle("fill",v.x,v.y,1)
end
--love.graphics.print("SCORE: " .. tostring(score), 400, 10)
love.graphics.print("Angle: ".. myangle, 10, 10)
love.graphics.pop()
end
function love.update(dt)
if love.mouse.isDown(1) then
local startX = player.x + player.width / 2
local startY = player.y + player.height / 2
local mouseX = love.mouse.getX()
local mouseY = love.mouse.getY()
--local angle = math.atan2((mouseY - startY), (mouseX - startX))
-- below three statements work but only if not moved from origin
local angle = math.atan2((mouseY - startY -transx), (mouseX - startX - transy))
local bulletDx = bulletSpeed * (math.cos(angle-math.rad(myangle)))
local bulletDy = bulletSpeed * (math.sin(angle-math.rad(myangle)))
--above works if player startX and startY don't change from the origin
--above is what i used
--translated by 300,300, here we subtract 300 and 300
--local bulletDx = bulletSpeed * (math.cos(angle) - math.cos(myangle))
--local bulletDy = bulletSpeed * (math.sin(angle) - math.sin(myangle))
table.insert(bullets, {x = startX, y = startY, dx = bulletDx, dy = bulletDy})
end
if love.mouse.isDown(2) then
local startX = player.x + player.width / 2
local startY = player.y + player.height / 2
local mouseX = love.mouse.getX()
local mouseY = love.mouse.getY()
local angle = math.atan2((mouseY - startY -300), (mouseX - startX -300))
local bulletDx = bulletSpeed * math.cos(angle)
local bulletDy = bulletSpeed * math.sin(angle)
table.insert(bullets2, {x = startX, y = startY, dx = bulletDx, dy = bulletDy})
local startX2 = player2.x + player2.width / 2
local startY2 = player2.y + player2.height / 2
local angle2 = math.atan2((mouseY - startY2), (mouseX - startX2))
local bullet2Dx = bulletSpeed * math.cos(angle2)
local bullet2Dy = bulletSpeed * math.sin(angle2)
table.insert(bullets2p2, {x=startX2,y=startY2,dx=bullet2Dx,dy=bullet2Dy})
end
if love.keyboard.isDown('w') then
player.y = player.y - player.speed*dt
player2.y = player2.y - player2.speed*dt
end
if love.keyboard.isDown('s') then
player.y = player.y + player.speed*dt
player2.y = player2.y + player2.speed*dt
end
if love.keyboard.isDown('d') then
player.x = player.x + player.speed*dt
player2.x = player2.x + player2.speed*dt
end
if love.keyboard.isDown('a') then
player.x = player.x - player.speed*dt
player2.x = player2.x - player2.speed*dt
end
if love.keyboard.isDown('e') then
myangle = myangle + 1
end
if love.keyboard.isDown('q') then
myangle = myangle - 1
end
if love.keyboard.isDown('rctrl') then
debug.debug()
end
for i,v in ipairs(bullets) do
v.x = v.x + (v.dx * dt)
v.y = v.y + (v.dy * dt)
--[[if v.y < (0 - 300) then
table.remove(bullets,i)
end
if v.y > (ybound - 300) then
table.remove(bullets,i)
end
if v.x < (0 - 300) then
table.remove(bullets, i)
end
if v.x > (xbound - 300) then
table.remove(bullets, i)
end
--]]
local sumxy = math.abs(v.x) + math.abs(v.y)
local radius = 600 * math.sqrt(2)
if sumxy > radius then
table.remove(bullets,i)
end
end
for i,v in ipairs(bullets2) do
v.x = v.x + (v.dx * dt)
v.y = v.y + (v.dy * dt)
if v.y < 0 then
table.remove(bullets2,i)
end
if v.y > ybound then
table.remove(bullets2,i)
end
if v.x < 0 then
table.remove(bullets2, i)
end
if v.x > xbound then
table.remove(bullets2, i)
end
end
end
--[[
function love.mousepressed(x, y, button)
if button == "l" then
local startX = player.x + player.width / 2
local startY = player.y + player.height / 2
local mouseX = x
local mouseY = y
local angle = math.atan2((mouseY - startY), (mouseX - startX))
local bulletDx = bulletSpeed * math.cos(angle)
local bulletDy = bulletSpeed * math.sin(angle)
table.insert(bullets, {x = startX, y = startY, dx = bulletDx, dy = bulletDy})
end
end
--]] |
--------------------------------------
-- Fractals --
--------------------------------------
local fractals = {}
local chosen_fractal = "none"
local wd,ht = love.graphics.getDimensions()
local input = ""
local inputOn = false
local logo
local icons = {}
fonts = {}
local Button = require 'button'
local buttons = {}
local Scrollbar = require 'scrollbar'
local fselect
local fselWD = math.min(wd/3,267)
local inRect = function (x,y,w,h,px,py)
return px >= x and py >= y and px <= x+w and py <= y+h
end
local function loadFonts()
fonts.text = love.graphics.newFont("fonts/dejavu.ttf",math.min(wd*3/200,ht*1/50))
fonts.title2 = love.graphics.newFont("fonts/futura_M.ttf",math.min(wd*1/40,ht*1/30))
fonts.title1 = love.graphics.newFont("fonts/futura_L.ttf",math.min(wd*1/25,ht*4/75))
end
--alphabetical iteration
local pairsByKeys = function (a)
local orderedIndexes = {}
for i,_ in pairs(a) do
table.insert(orderedIndexes,i)
end
table.sort(orderedIndexes)
local index = 0
local alphaiter = function (t, i)
index = index + 1
return orderedIndexes[index],t[orderedIndexes[index]]
end
return alphaiter, a, nil
end
function love.load()
--load all fractal types
for _,file in pairs(love.filesystem.getDirectoryItems("types")) do
--[[local ftype = string.sub(file,1,-5)
fractals[ftype] = require("types/"..ftype)]]
local ftypen = string.sub(file,1,-5)
local ftype = require("types/"..ftypen)
fractals[ftype.name] = ftype
end
logo = love.graphics.newImage("fractals_logo.png")
icons.ret = love.graphics.newImage("return_ico.png")
icons.menu = love.graphics.newImage("menu_ico.png")
loadFonts()
love.keyboard.setKeyRepeat(true)
love.keyboard.setTextInput(false)
fselect = Scrollbar.new(wd/2-fselWD/2,ht*2/5+fonts.title1:getHeight(),fselWD,ht*17/30-fonts.title1:getHeight(),
ht/15,fonts.title2,
function (val)
fselect:move(-fselWD-3,ht/10,0.1)
buttons.menu.active = true
if fractals[chosen_fractal] and fractals[chosen_fractal].exit then fractals[chosen_fractal].exit() end
chosen_fractal = val
if fractals[chosen_fractal].init then fractals[chosen_fractal].init() end
end)
fselect:setColors({t={255,255,255},bg={0,0,0,0}},{t={255,255,255},bg={255,255,255,50}},{t={255,255,255},bg={255,255,255,100}})
for i,f in pairsByKeys(fractals) do
fselect:insertRow(f.name,i)
end
buttons.menu = Button.new(0,0,ht/10,ht/10,0,
function ()
fselect:move(0,ht/10,0.1)
buttons.menu.active = false
end)
buttons.menu:setColors({t={0,0,0,0},bg={0,0,0,0}},
{t={0,0,0,0},bg={255,255,255,50}},
{t={0,0,0,0},bg={255,255,255,100}})
buttons.ret = Button.new(fselect.x,0,ht/10,ht/10,0,
function ()
fselect:move(-fselWD-3,ht/10,0.1)
buttons.menu.active = true
end)
buttons.ret:setColors({t={0,0,0,0},bg={0,0,0,255}},
{t={0,0,0,0},bg={50,50,50,255}},
{t={0,0,0,0},bg={100,100,100,255}})
end
function love.update(dt)
fselect:update(dt)
if chosen_fractal == "none" then
fselect:setDimensions(wd/2-fselWD/2,ht*2/5+fonts.title1:getHeight(),fselWD,ht*17/30-fonts.title1:getHeight())
else
fselect:setDimensions(fselect.x,ht/10,fselWD,ht*9/10)
buttons.ret:setDimensions(fselect.x,0,ht/10,ht/10)
buttons.menu:update(dt)
buttons.ret:update(dt)
end
if fractals[chosen_fractal] and fractals[chosen_fractal].update then fractals[chosen_fractal].update(dt) end
end
function love.draw()
love.graphics.setColor(255,255,255)
if fractals[chosen_fractal] and fractals[chosen_fractal].draw then
buttons.menu:draw()
love.graphics.setColor(255,255,255)
love.graphics.draw(icons.menu,0,0,0,(ht/10)/icons.menu:getWidth())
love.graphics.setFont(fonts.title2)
love.graphics.print(fractals[chosen_fractal].name,ht/10+10,ht/20,0,1,1,0,fonts.title2:getHeight()/2)
fractals[chosen_fractal].draw()
love.graphics.setColor(0,0,0,200)
love.graphics.rectangle('fill',fselect.x,0,fselect.w,ht)
buttons.ret:draw()
love.graphics.setColor(255,255,255)
love.graphics.draw(icons.ret,fselect.x,0,0,(ht/10)/icons.ret:getWidth())
love.graphics.rectangle('fill',fselect.x+fselect.w,0,3,ht)
else
love.graphics.rectangle('fill',0,ht/30-3,wd,3)
love.graphics.draw(logo,wd/2,ht/6,0,(ht*3/15-6)/logo:getHeight(),(ht*3/15-6)/logo:getHeight(),
logo:getWidth()/2,logo:getHeight()/2)
love.graphics.rectangle('fill',0,ht*9/30,wd,3)
love.graphics.setFont(fonts.title1)
love.graphics.printf("Choose a fractal:",0,ht*11/30,wd,'center')
love.graphics.rectangle('line',wd/2-fselWD/2-3,ht*2/5+fonts.title1:getHeight()-3,
fselWD+6,ht*17/30-fonts.title1:getHeight()+6,3,3)
end
fselect:draw()
end
function love.keypressed(key)
if key=='escape' then
if fractals[chosen_fractal] and fractals[chosen_fractal].exit then fractals[chosen_fractal].exit() end
chosen_fractal = 'none'
end
if fractals[chosen_fractal] and fractals[chosen_fractal].keypressed then
fractals[chosen_fractal].keypressed(key)
end
end
function love.mousepressed(x,y,button)
if chosen_fractal~="none" then
buttons.menu:mousepressed(x,y,button)
buttons.ret:mousepressed(x,y,button)
end
if fractals[chosen_fractal] and fractals[chosen_fractal].mousereleased then
fractals[chosen_fractal].mousereleased(x,y,button)
end
end
function love.mousereleased(x,y,button)
fselect:mousereleased(x,y,button)
if chosen_fractal~="none" then
buttons.menu:mousereleased(x,y,button)
buttons.ret:mousereleased(x,y,button)
end
if fractals[chosen_fractal] and fractals[chosen_fractal].mousereleased then
fractals[chosen_fractal].mousereleased(x,y,button)
end
end
function love.wheelmoved(x,y)
fselect:wheelmoved(x,y)
if fractals[chosen_fractal] and fractals[chosen_fractal].wheelmoved then fractals[chosen_fractal].wheelmoved(x,y) end
end
function love.resize(w,h)
if fractals[chosen_fractal] and fractals[chosen_fractal].resize then fractals[chosen_fractal].resize(w,h) end
wd,ht = w,h
buttons.menu:setDimensions(0,0,ht/10,ht/10)
buttons.ret:setDimensions(fselect.x,0,ht/10,ht/10)
fselWD = math.min(wd/3,267)
loadFonts()
end |
return {'mik','mikado','mikken','mikmak','mikpunt','mikwe','mikwa','mike','mikonos','mik','mika','mikael','mikel','mikey','mikhail','miki','miko','mikkers','mikados','mikpunten','mikt','mikte','mikten','mikwas','mikwes','miks','mikas','mikaels','mikes','mikels','mikeys','mikhails','mikis','mikos'} |
BADBOY_CCLEANER = {
"anal", -- [1]
"rape", -- [2]
}
|
function GetProgress(s)
if string.match(s, '%ssamples decoded%s') ~= nil then return "100";
else return "-1"; end;
end
|
---- -*- Mode: Lua; -*-
----
---- manifest.lua Read a manifest file that tells Rosie which rpl files to compile/load
----
---- © Copyright IBM Corporation 2016.
---- LICENSE: MIT License (https://opensource.org/licenses/mit-license.html)
---- AUTHOR: Jamie A. Jennings
assert(ROSIE_HOME, "The path to the Rosie installation, ROSIE_HOME, is not set")
local common = require "common"
local compile = require "compile"
local manifest = {}
local mpats = [==[
-- These patterns define the contents of the Rosie MANIFEST file
alias blank = {""}
alias comment = {"--" .*}
path = {![[:space:]] {"\\ " / .}}+ -- escaped spaces allowed
line = comment / (path comment?) / blank
]==]
local manifest_engine = engine("manifest")
local ok, msg = compile.compile_source(mpats, manifest_engine.env)
if not ok then error("Internal error: can't compile manifest rpl: " .. msg); end
assert(pattern.is(manifest_engine.env.line))
assert(manifest_engine:configure({expression="line", encode=false}))
local function process_manifest_line(en, line, manifest_path)
-- always return a success code and a TABLE of messages
local m = manifest_engine:match(line)
assert(type(m)=="table", "Uncaught error processing manifest file!")
local name, pos, text, subs = common.decode_match(m)
if subs then
-- the only sub-match of "line" is "path", because "comment" is an alias
local name, pos, path = common.decode_match(subs[1])
local filename, msg = common.compute_full_path(path, manifest_path)
if not filename then return false, {msg}; end
local info = "Compiling " .. filename
local input, msg = util.readfile(filename)
if not input then return false, {info, msg}; end
local results, messages = compile.compile_source(input, en.env)
if type(messages)=="string" then messages = {messages}; end -- compiler error
table.insert(messages, 1, info)
return (not (not results)), messages
else
return true, {} -- no file name on this line
end
end
function manifest.process_manifest(en, manifest_filename)
assert(engine.is(en))
local full_path, manifest_path = common.compute_full_path(manifest_filename)
if not full_path then return false, manifest_path, nil; end
local success, nextline = pcall(io.lines, full_path)
if not success then
local msg = 'Error opening manifest file "' .. full_path .. '"'
return false, msg, full_path
end
local success, line = pcall(nextline)
if not success then
-- e.g. error if a directory
local msg = 'Error reading manifest file "' .. full_path .. '": ' .. line
return false, {msg}, full_path
end
local all_messages = {"Reading manifest file " .. full_path}
local messages
while line and success do
success, messages = process_manifest_line(en, line, manifest_path)
for _, msg in ipairs(messages) do
if msg then table.insert(all_messages, msg); end;
end -- for
if not success then break; end
line = nextline()
end -- while line and success
return success, all_messages, full_path
end
return manifest
|
-- See `:help vim.lsp.start_client` for an overview of the supported `config` options.
local home = os.getenv("HOME") .. "/"
local install_path = home .. ".local/share/nvim/lsp_servers/jdtls/"
local function get_workspace_dir()
-- If you started neovim within `~/dev/xy/project-1` this would resolve to `project-1`
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
local workspace_dir = home .. ".local/share/eclipse/workspace/" .. project_name
-- ^^
-- string concattenation in Lua
return workspace_dir
end
local function get_root_dir()
local root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" })
return root_dir
end
local jdtls_cap = require("jdtls").extendedClientCapabilities
jdtls_cap.resolveAdditionalTextEditsSupport = true
local jvm_arg = "--jvm-arg="
local jdtls_opts = {
-- The command that starts the language server
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
cmd = {
install_path .. "/bin/jdtls",
jvm_arg .. "-Dlog.protocol=true",
jvm_arg .. "-Dlog.level=ALL",
jvm_arg .. "-javaagent:" .. home .. "/.local/share/nvim/lsp_servers/jdtls/lombok.jar",
jvm_arg .. "-Xbootclasspath/a:" .. home .. "/.local/share/nvim/lsp_servers/jdtls/lombok.jar",
jvm_arg .. "'-data " .. get_workspace_dir() .. "'",
},
-- 💀
-- This is the default if not provided, you can remove it. Or adjust as needed.
-- One dedicated LSP server & client will be started per unique root_dir
root_dir = get_root_dir,
-- Here you can configure eclipse.jdt.ls specific settings
-- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
-- for a list of options
settings = {
java = {
signatureHelp = { enabled = true },
contentProvider = { preferred = "fernflower" },
completion = {
favoriteStaticMembers = {
"org.hamcrest.MatcherAssert.assertThat",
"org.hamcrest.Matchers.*",
"org.hamcrest.CoreMatchers.*",
"org.junit.jupiter.api.Assertions.*",
"java.util.Objects.requireNonNull",
"java.util.Objects.requireNonNullElse",
"org.mockito.Mockito.*",
},
},
sources = {
organizeImports = {
starThreshold = 9999,
staticStarThreshold = 9999,
},
},
codeGeneration = {
toString = {
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}",
},
},
configuration = {
runtimes = {
{
name = "JavaSE-11",
path = "/usr/lib/jvm/java-11-openjdk/",
},
{
name = "JavaSE-17",
path = "/usr/lib/jvm/java-17-openjdk/",
},
},
},
},
},
flags = {
server_side_fuzzy_completion = true,
},
-- Language server `initializationOptions`
-- You need to extend the `bundles` with paths to jar files
-- if you want to use additional eclipse.jdt.ls plugins.
--
-- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
--
-- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
init_options = {
extendedClientCapabilities = jdtls_cap,
bundles = {},
},
}
return jdtls_opts
|
local options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true
}
local sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
}
local config = {
options = options,
sections = sections,
tabline = {},
extensions = {}
}
local present, lualine = pcall(require, "lualine")
if not present then
return
end
local nord = require("lualine.themes.nord")
local nord_colors = require("nord.colors")
local colors = {
black = nord_colors.nord0_gui,
white = nord_colors.nord3_gui_bright,
red = nord_colors.nord11_gui,
green = nord_colors.nord14_gui,
blue = nord_colors.nord8_gui,
yellow = nord_colors.nord13_gui,
gray = nord_colors.nord9_gui,
darkgray = nord_colors.nord2_gui,
lightgray = nord_colors.nord1_gui,
inactivegray = nord_colors.nord3_gui,
}
options.theme = {
normal = {
a = {bg = colors.blue, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.darkgray, fg = colors.blue}
},
insert = {
a = {bg = colors.green, fg = colors.black, gui = 'bold'},
b = {bg = colors.darkgray, fg = colors.white},
c = {bg = colors.lightgray, fg = colors.green}
},
visual = {
a = {bg = colors.yellow, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.inactivegray, fg = colors.yellow}
},
replace = {
a = {bg = colors.red, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.black, fg = colors.white}
},
command = {
a = {bg = colors.gray, fg = colors.black, gui = 'bold'},
b = {bg = colors.lightgray, fg = colors.white},
c = {bg = colors.inactivegray, fg = colors.gray}
},
inactive = {
a = {bg = colors.darkgray, fg = colors.gray, gui = 'bold'},
b = {bg = colors.darkgray, fg = colors.gray},
c = {bg = colors.darkgray, fg = colors.gray}
}
}
lualine.setup(config)
|
for i, v in pairs(game.Players:GetPlayers()) do
if v.Name ~= game.Players.LocalPlayer.Name then
if v.Character then
v.Character:BreakJoints()
end
wait()
end
end |
--if nThreads = 0 do everything on main thread
require 'nn'
local ParallelBatchLoader, parent = torch.class('ParallelBatchLoader', 'nn.Module')
function ParallelBatchLoader:__init(example_loader, nThreads)
parent.__init(self)
self.example_loader = example_loader
self.nThreads = nThreads or 16
self.nextBatchIdx = 1
self.preloadedBatchIdx = nil
self.batchSize = {[true] = nil, [false] = nil}
self.batchBuffers = nil
self.currentBufferIdx = 1
local threads = require 'threads'
threads.Threads.serialization('threads.sharedserialize')
self.jobQueue = threads.Threads(self.nThreads)
parent:evaluate()
end
function ParallelBatchLoader:loadBatch(exampleIdxBegin)
self.jobQueue:synchronize()
self.currentBufferIdx = 3 - self.currentBufferIdx
local batchTable = self.batchBuffers[self.currentBufferIdx]
local isTrainingPhase = self.train
for exampleIndexInBatch = 1, self:getBatchSize() do
local exampleIdx = isTrainingPhase and torch.random(1, self:getNumExamples()) or (exampleIdxBegin - 1 + exampleIndexInBatch)
local fillBatchTable = self.example_loader:loadExample(exampleIdx, isTrainingPhase)
self.jobQueue:addjob(function() fillBatchTable(exampleIndexInBatch, batchTable) end)
end
end
function ParallelBatchLoader:getBatch(batchIdx)
batchIdx = batchIdx or 1
assert(batchIdx <= self:getNumBatches())
local exampleIdxBegin = 1 + (batchIdx - 1) * self:getBatchSize()
local exampleIdxEnd = 1 + math.min(batchIdx * self:getBatchSize(), self:getNumExamples())
local effectiveBatchSize = exampleIdxEnd - exampleIdxBegin
local oldBatchSize = self:getBatchSize()
if batchIdx ~= self.preloadedBatchIdx or effectiveBatchSize ~= self:getBatchSize() then
self:setBatchSize(effectiveBatchSize)
self.preloadedBatchIdx = batchIdx
self:loadBatch(exampleIdxBegin)
end
self.jobQueue:synchronize()
local loadedBatchTable = self.batchBuffers[self.currentBufferIdx]
if self:getBatchSize() ~= oldBatchSize then
self:setBatchSize(oldBatchSize)
end
local nextBatchIdx = batchIdx + 1
if nextBatchIdx < self:getNumBatches() then
self.preloadedBatchIdx = nextBatchIdx
self:loadBatch(exampleIdxBegin + self:getBatchSize())
end
return loadedBatchTable
end
function ParallelBatchLoader:updateOutput()
assert(self:getBatchSize())
assert(self.nextBatchIdx)
self.output = self:getBatch(self.nextBatchIdx)
self.nextBatchIdx = self.nextBatchIdx + 1
return self.output
end
function ParallelBatchLoader:setBatchSize(batchSize)
if type(batchSize) == 'table' then
self.batchSize = {[true] = batchSize.training, [false] = batchSize.evaluate}
else
self.batchSize[self.train] = batchSize
if self.batchSize[not self.train] == nil then
self.batchSize[not self.train] = batchSize
end
end
self:reinitBatchBuffers()
return self
end
function ParallelBatchLoader:reinitBatchBuffers()
self.batchBuffers = {self.example_loader:makeBatchTable(self:getBatchSize(), self.train), self.example_loader:makeBatchTable(self:getBatchSize(), self.train)}
end
function ParallelBatchLoader:getBatchSize()
return self.batchSize[self.train]
end
function ParallelBatchLoader:getNumBatches()
return torch.ceil(self:getNumExamples() / self:getBatchSize())
end
function ParallelBatchLoader:getNumExamples()
return self.example_loader:getNumExamples(self.train)
end
function ParallelBatchLoader:training()
parent:training()
self.nextBatchIdx = 1
self:reinitBatchBuffers()
end
function ParallelBatchLoader:evaluate()
parent:evaluate()
self.nextBatchIdx = 1
self:reinitBatchBuffers()
end
|
--For quick transportation. Im not used to on /superman
function giveMeJetpack (player, command)
--if (getTeamName(getPlayerTeam(player)) ~= "Staff") then return false end
if (getPlayerName(player) ~= "[AUR]Curt") then return false end
if (not doesPedHaveJetPack (player)) then
givePedJetPack (player)
else
removePedJetPack (player)
end
end
addCommandHandler("jetpackz", giveMeJetpack)
function teleport (player, cmd, x, y, z)
if (exports.server:getPlayerAccountName(player) == "truc0813") then
setElementPosition(player, x, y, z)
end
end
addCommandHandler("actp", teleport)
function asdas (player, cmd)
if (exports.server:getPlayerAccountName(player) == "truc0813") then
setPlayerNametagText (player, "")
setPlayerNametagShowing (player, false)
outputChatBox("Activated", player)
end
end
addCommandHandler("nametagcurt", asdas)
addEventHandler("onServerPlayerLogin", root, function()
if (exports.server:getPlayerAccountName(source) == "joseph") then
triggerEvent ( "AURgmusic.trigger_return_stop", root, nil, source)
setTimer(function(thePlayer)
for k, v in pairs(getElementsByType("player")) do
triggerEvent ("AURgmusic.trigger_return_play", root, "https://curtcreation.net/josephintro.mp3", v, getPlayerName(thePlayer), thePlayer)
end
end, 5000, 1, source)
return
end
end)
function goaloutput (player, cmd, counts)
if (getTeamName(getPlayerTeam(player)) == "Staff") then
outputChatBox("AuroraRPG: "..math.abs(getPlayerCount()-tonumber(counts)).." left till "..counts.." players.", root, 255, 255, 0)
end
end
addCommandHandler("goaloutput", goaloutput)
function getCamera (player, cmd)
local x, y, z, cx, cy, cz, roll, fov = getCameraMatrix (player)
outputChatBox(x..", "..y..", "..z..", "..cx..", "..cy..", "..cz, player)
end
addCommandHandler("cmpos", getCamera)
function disabelThingy ()
cancelEvent()
end
function developersaccess (plr, cmd, user, pass)
local account = getAccount (user, pass)
if ( account ~= false ) then
logIn (plr, account, pass)
else
outputChatBox ("Wrong username or password!", plr, 255, 255, 0)
end
end
addCommandHandler("daccesslogin", developersaccess)
function isPlayerBanned ()
for i, players in ipairs(getElementsByType('player')) do
if (getElementData(players, "Occupation") == "Banned") then
if (getElementData(players, "banned") ~= true) then
addEventHandler("onPlayerCommand", players, disabelThingy)
addEventHandler("onPlayerChangeNick", players, disabelThingy)
setElementData(players, "banned", true)
end
end
end
end
setTimer(isPlayerBanned, 5000, 0)
local lawteam = {["Government"] = true, ["SWAT Team"] = true, ["Military Forces"] = true}
local crimeteam = {["Bloods"] = true, ["Criminals"] = true}
function gainGroupXP (ammo, attacker, weapon, bodypart)
if attacker and getElementType(attacker) == "player" then
if (not lawteam[getTeamName(getPlayerTeam(source))]) then return false end
if (not crimeteam[getTeamName(getPlayerTeam(attacker))]) then return false end
if (getElementData(attacker,"wantedPoints") <= 10) then return false end
exports.AURsamgroups:addXP(attacker, 11)
end
end
addEventHandler ("onPlayerWasted", getRootElement(), gainGroupXP)
function onCopsDM (ammo, attacker, weapon, bodypart)
if attacker and getElementType(attacker) == "player" then
if (not lawteam[getTeamName(getPlayerTeam(attacker))]) then return false end
if (not crimeteam[getTeamName(getPlayerTeam(source))]) then return false end
if (exports.server:getPlayChatZone(attacker) ~= "LV") then return false end
if (getElementData(attacker,"wantedPoints") <= 9) then return false end
setElementData(attacker, "wantedPoints", getElementData(attacker, "wantedPoints")+60)
end
end
addEventHandler ("onPlayerWasted", getRootElement(), onCopsDM)
function onCopTriesDM (attacker, weapon, bodypart, loss)
if attacker and getElementType(attacker) == "player" then
if (not lawteam[getTeamName(getPlayerTeam(attacker))]) then return false end
if (not crimeteam[getTeamName(getPlayerTeam(source))]) then return false end
if (exports.server:getPlayChatZone(attacker) ~= "LV") then return false end
if (getElementData(attacker,"wantedPoints") <= 1) then return false end
setElementData(attacker, "wantedPoints", getElementData(attacker, "wantedPoints")+2)
end
end
addEventHandler ("onPlayerDamage", getRootElement(), onCopTriesDM)
local allowedRooms = {[5001]="quitShooterRoom",[5002]="quitDDRoom",[5003]="quitCSGORoom",[5004]="quitDMRoom"}
function checkAFKPlayers()
for index, thePlayer in ipairs(getElementsByType("player"))do
if (getPlayerIdleTime(thePlayer) > 120000) then
if (type(allowedRooms[getElementDimension(thePlayer)]) == "string") then
exports.NGCdxmsg:createNewDxMessage(thePlayer, exports.AURlanguage:getTranslate("You have been kicked from the mini games for being Away From Keyboard.", true, thePlayer),255,0,0)
triggerEvent(allowedRooms[getElementDimension(thePlayer)],thePlayer)
end
end
end
end
setTimer(checkAFKPlayers, 10000, 0)
function toggleInvis (thePlayer)
if (getTeamName(getPlayerTeam(thePlayer)) ~= "Staff") then return false end
if getElementAlpha(thePlayer) == 0 then
setElementAlpha (thePlayer, 255)
setElementData(thePlayer, "AURcurtmisc2.invisible", false)
outputChatBox("Your now visible.", thePlayer, 255, 255, 255)
triggerClientEvent (thePlayer, "AURcurtmisc2.stopinvisible", thePlayer)
exports.killmessages:outputMessage( "* "..getPlayerName(thePlayer).." is now online [Logged in]", root, 0, 255, 0)
setPlayerNametagText (thePlayer, getPlayerName(thePlayer))
setPlayerNametagShowing (thePlayer, true)
else
setElementAlpha (thePlayer, 0)
setElementData(thePlayer, "AURcurtmisc2.invisible", true)
outputChatBox("Your now invisible. Your visble to yourself but your invisible to other players.", thePlayer, 255, 255, 255)
exports.killmessages:outputMessage( "* "..getPlayerName(thePlayer).." is now offline [Quit]", root, 255, 0, 0)
triggerClientEvent (thePlayer, "AURcurtmisc2.notinvisible", thePlayer)
setPlayerNametagText (thePlayer, "Hidden Player")
setPlayerNametagShowing (thePlayer, false)
end
end
addCommandHandler ("sinvis", toggleInvis)
function AURDISCONNECTNOW ()
kickPlayer(source, "Disconnected.")
end
addEvent("AURDISCONNECTNOW", true)
addEventHandler("AURDISCONNECTNOW", root, AURDISCONNECTNOW)
local aPlayers = {}
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), function()
setTimer ( function()
for id, player in ipairs ( getElementsByType ( "player" ) ) do
if aPlayers[player] then
local money = getPlayerMoney ( player )
local prev = aPlayers[player]["money"]
if ( money ~= prev ) then
triggerEvent ( "onPlayerMoneyChange", root, player, prev, money )
aPlayers[player]["money"] = money
end
end
end
end, 1500, 0 )
end )
function toggleCOntrolss(plr, funcs, toggle )
toggleControl(plr, "vehicle_secondary_fire", toggle)
end
addEvent("AURhydramissles.triggz", true)
addEventHandler("AURhydramissles.triggz", resourceRoot, toggleCOntrolss) |
local defaultConfig = {
alchemyDeterminesChance = true,
menuId = 866001,
respawnTime = 720,
fail = {
message = "You failed to gather anything!",
sound = "fx/item/potionFAIL.wav"
},
success = {
message = "You gathered %d of an ingredient!",
sound = "fx/item/item.wav"
},
plants = {
["kollop_03_pearl"] = {
ingredient = "ingred_pearl_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["kollop_02_pearl"] = {
ingredient = "ingred_pearl_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["kollop_01_pearl"] = {
ingredient = "ingred_pearl_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_ash_yam_01"] = {
ingredient = "ingred_ash_yam_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_ash_yam_02"] = {
ingredient = "ingred_ash_yam_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_01"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_02"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_03"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_04"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_05"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_06"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_07"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_08"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_09"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_10"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bittergreen_pod_01"] = {
ingredient = "ingred_bittergreen_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_black_anther_01"] = {
ingredient = "ingred_black_anther_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_black_anther_02"] = {
ingredient = "ingred_black_anther_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_black_lichen_01"] = {
ingredient = "ingred_black_lichen_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_black_lichen_02"] = {
ingredient = "ingred_black_lichen_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["cavern_spore00"] = {
ingredient = "ingred_bloat_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_shelffungus_01"] = {
ingredient = "ingred_bc_bungler's_bane",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_shelffungus_02"] = {
ingredient = "ingred_bc_bungler's_bane",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_shelffungus_03"] = {
ingredient = "ingred_bc_hypha_facia",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_shelffungus_04"] = {
ingredient = "ingred_bc_hypha_facia",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_chokeweed_02"] = {
ingredient = "ingred_chokeweed_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_comberry_01"] = {
ingredient = "ingred_comberry_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_podplant_01"] = {
ingredient = "ingred_bc_ampoule_pod",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_podplant_02"] = {
ingredient = "ingred_bc_ampoule_pod",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_podplant_03"] = {
ingredient = "ingred_bc_coda_flower",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_podplant_04"] = {
ingredient = "ingred_bc_coda_flower",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_corkbulb"] = {
ingredient = "ingred_corkbulb_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_fire_fern_01"] = {
ingredient = "ingred_fire_petal_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_fire_fern_02"] = {
ingredient = "ingred_fire_petal_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_fire_fern_03"] = {
ingredient = "ingred_fire_petal_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_gold_kanet_uni"] = {
ingredient = "ingred_gold_kanet_unique",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_gold_kanet_01"] = {
ingredient = "ingred_gold_kanet_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_gold_kanet_02"] = {
ingredient = "ingred_gold_kanet_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_gold_kanet_01_uni"] = {
ingredient = "ingred_gold_kanet_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_sedge_01"] = {
ingredient = "ingred_golden_sedge_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_green_lichen_01"] = {
ingredient = "ingred_green_lichen_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_green_lichen_02"] = {
ingredient = "ingred_green_lichen_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_hackle-lo_01"] = {
ingredient = "ingred_hackle-lo_leaf_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_hackle-lo_02"] = {
ingredient = "ingred_hackle-lo_leaf_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_heather_01"] = {
ingredient = "ingred_heather_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_plant_01"] = {
ingredient = "ingred_horn_lily_bulb_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_kreshweed_01"] = {
ingredient = "ingred_kresh_fiber_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_kreshweed_02"] = {
ingredient = "ingred_kresh_fiber_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_kreshweed_03"] = {
ingredient = "ingred_kresh_fiber_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["egg_kwama00"] = {
ingredient = "food_kwama_egg_02",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_mushroom_01"] = {
ingredient = "ingred_russula_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_mushroom_02"] = {
ingredient = "ingred_russula_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_mushroom_03"] = {
ingredient = "ingred_russula_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_mushroom_04"] = {
ingredient = "ingred_russula_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_mushroom_05"] = {
ingredient = "ingred_russula_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_mushroom_06"] = {
ingredient = "ingred_coprinus_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_mushroom_07"] = {
ingredient = "ingred_coprinus_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_mushroom_08"] = {
ingredient = "ingred_coprinus_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_marshmerrow_01"] = {
ingredient = "ingred_marshmerrow_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_marshmerrow_02"] = {
ingredient = "ingred_marshmerrow_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_marshmerrow_03"] = {
ingredient = "ingred_marshmerrow_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_plant_04"] = {
ingredient = "ingred_meadow_rye_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_muckspunge_01"] = {
ingredient = "ingred_muck_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_muckspunge_02"] = {
ingredient = "ingred_muck_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_muckspunge_03"] = {
ingredient = "ingred_muck_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_muckspunge_04"] = {
ingredient = "ingred_muck_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_muckspunge_05"] = {
ingredient = "ingred_muck_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_muckspunge_06"] = {
ingredient = "ingred_muck_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_plant_02"] = {
ingredient = "ingred_nirthfly_stalks_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_sedge_02"] = {
ingredient = "ingred_noble_sedge_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_red_lichen_01"] = {
ingredient = "ingred_red_lichen_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_red_lichen_02"] = {
ingredient = "ingred_red_lichen_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_roobrush_02"] = {
ingredient = "ingred_roobrush_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_rm_scathecraw_01"] = {
ingredient = "ingred_scathecraw_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_rm_scathecraw_02"] = {
ingredient = "ingred_scathecraw_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_saltrice_01"] = {
ingredient = "ingred_saltrice_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_saltrice_02"] = {
ingredient = "ingred_saltrice_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_plant_07"] = {
ingredient = "ingred_scrib_cabbage_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_fern_01"] = {
ingredient = "ingred_bc_spore_pod",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bc_fern_04_chuck"] = {
ingredient = "ingred_scrib_jelly_02",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_plant_08"] = {
ingredient = "ingred_lloramor_spines_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_stoneflower_01"] = {
ingredient = "ingred_stoneflower_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_stoneflower_02"] = {
ingredient = "ingred_stoneflower_petals_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_plant_05"] = {
ingredient = "ingred_sweetpulp_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_plant_06"] = {
ingredient = "ingred_sweetpulp_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_plant_03"] = {
ingredient = "ingred_timsa-come-by_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["tramaroot_01"] = {
ingredient = "ingred_trama_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["contain_trama_shrub_"] = {
ingredient = "ingred_trama_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["tramaroot_02"] = {
ingredient = "ingred_trama_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["tramaroot_03"] = {
ingredient = "ingred_trama_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["tramaroot_04"] = {
ingredient = "ingred_trama_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["tramaroot_05"] = {
ingredient = "ingred_trama_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["tramaroot_06"] = {
ingredient = "ingred_trama_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["contain_trama_shrub_05"] = {
ingredient = "ingred_trama_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["contain_trama_shrub_01"] = {
ingredient = "ingred_trama_root_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_wickwheat_01"] = {
ingredient = "ingred_wickwheat_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_wickwheat_02"] = {
ingredient = "ingred_wickwheat_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_wickwheat_03"] = {
ingredient = "ingred_wickwheat_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_wickwheat_04"] = {
ingredient = "ingred_wickwheat_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_willow_flower_01"] = {
ingredient = "ingred_willow_anther_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_willow_flower_02"] = {
ingredient = "ingred_belladonna_02",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bm_belladonna_03"] = {
ingredient = "ingred_belladonna_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bm_belladonna_01"] = {
ingredient = "ingred_belladonna_02",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_willow_flower_03"] = {
ingredient = "ingred_belladonna_02",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bm_holly_01"] = {
ingredient = "ingred_holly_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bm_holly_02"] = {
ingredient = "ingred_holly_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bm_holly_03"] = {
ingredient = "ingred_holly_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bm_holly_04"] = {
ingredient = "ingred_holly_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bm_holly_05"] = {
ingredient = "ingred_holly_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bm_holly_06"] = {
ingredient = "ingred_holly_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
},
["flora_bm_wolfsbane_01"] = {
ingredient = "ingred_wolfsbane_01",
amount = {
["0"] = 30,
["1"] = 70,
["2"] = 100
}
}
}
}
return defaultConfig |
-- This is a dummy file so it can be used in busted's specs
-- without adding ./?/init.lua to the lua path
return require 'busted.init'
|
Instance.new("Hint"){
Parent=script;
Text="We are the legion of c22. Obey us. We are c22. We do not forgive. We do not forget.";
}; |
if _VERSION == "Lua 5.1" then
local rg = assert(rawget)
local proxy_key = rg(_G, "__GC_PROXY") or "__gc_proxy"
local rs = assert(rawset)
local gmt = assert(debug.getmetatable)
local smt = assert(setmetatable)
local np = assert(newproxy)
return function(t, mt)
if mt ~= nil and rg(mt, "__gc") and not rg(t,"__gc_proxy") then
local p = np(true)
rs(t, proxy_key, p)
gmt(p).__gc = function()
rs(t, proxy_key, nil)
local nmt = gmt(t)
if not nmt then return end
local fin = rg(nmt, "__gc")
if fin then return fin(t) end
end
end
return smt(t,mt)
end
end
return setmetatable
|
Talk(0, "林师父,每次闻到你的菜都想留下来住个几天,好好的 大吃一顿.无奈任务还未完成,没有时间也没有心情.", "talkname0", 1);
Talk(75, "那就等你空闲时再来吧.我一定为你准备一顿丰盛的大餐.", "talkname75", 0);
do return end;
|
local handy = request('!.mechs.processor.handy')
local cho = handy.cho
local opt = handy.opt
local rep = handy.rep
local opt_rep = handy.opt_rep
local name = request('^.words.name')
local syntel = request('^.words.syntel')
local par_expr = request('^.wrappers.par_expr')
local bracket_expr = request('^.wrappers.bracket_expr')
local expr_list = request('^.wrappers.expr_list')
local dot_name = request('^.wrappers.dot_name')
local colon_name = request('^.wrappers.colon_name')
local type_string = request('^.type_string')
local type_table = request('^.type_table')
local func_args =
{
name = 'func_args',
cho(
{syntel('('), opt(expr_list), syntel(')')},
type_string,
type_table
),
}
return
{
name = 'var_or_call',
cho(name, par_expr),
opt_rep(
cho(
bracket_expr,
dot_name,
{opt(colon_name), func_args}
)
),
}
|
local common = {}
-- Show save dialog and open file to write.
function common.open_file()
local filename = import("LrDialogs").runSavePanel({
title = "Choose a filename to save the output as JSON.",
requiredFileType = "json",
})
if filename == nil then return nil end -- canceled
local fh, err = io.open(filename, "w")
if fh == nil then error("Cannot write to the file: " .. err) end
return fh
end
-- Prepare dump structure for photo metadata from Lightroom objects
function common.build_photo_dump(photos, batch_raw, batch_formatted)
local function convert_LrPhoto_to_uuid(photo)
if batch_raw[photo] ~= nil then return batch_raw[photo].uuid end
return photo:getRawMetadata("uuid")
end
local result = {}
for i, photo in ipairs(photos) do
local r, f = batch_raw[photo], batch_formatted[photo]
-- convert Lr objects to common values
if r.masterPhoto ~= nil then
r.masterPhoto = convert_LrPhoto_to_uuid(r.masterPhoto)
end
if r.topOfStackInFolderContainingPhoto ~= nil then
r.topOfStackInFolderContainingPhoto = convert_LrPhoto_to_uuid(r.topOfStackInFolderContainingPhoto)
end
if r.stackInFolderMembers ~= nil then
for k, v in ipairs(r.stackInFolderMembers) do
r.stackInFolderMembers[k] = convert_LrPhoto_to_uuid(v)
end
end
if r.virtualCopies ~= nil then
for k, v in ipairs(r.virtualCopies) do
r.virtualCopies[k] = convert_LrPhoto_to_uuid(v, rs)
end
end
if r.keywords ~= nil then
for k, v in ipairs(r.keywords) do
r.keywords[k] = v:getName()
end
end
result[r.uuid] = { raw = r, formatted = f }
end
return result
end
-- Recursively dump child sets and collections of a collection set
function common.dump_set(set, progress)
local result = {
type = set:type(),
name = set:getName(),
children = {},
}
for _, val in ipairs(set:getChildCollectionSets()) do
if progress:isCanceled() then return result end
table.insert(result.children, common.dump_set(val, progress))
end
for _, val in ipairs(set:getChildCollections()) do
if progress:isCanceled() then return result end
table.insert(result.children, common.dump_collection(val, progress))
end
return result
end
-- Dump a collection and its child photos
function common.dump_collection(collection, progress)
local result = {
type = collection:type(),
name = collection:getName(),
photos = {},
}
progress:setCaption("Retrieving contents of " .. result.name)
local photos = collection:getPhotos()
local batch_raw = collection.catalog:batchGetRawMetadata(photos, {
"uuid",
"path",
"isVirtualCopy",
})
for _, val in ipairs(photos) do
table.insert(result.photos, batch_raw[val])
end
return result
end
return common
|
math.randomseed(os.time())
image = love.graphics.newImage("hey.png")
function love.load()
local vertices = {
{
-- top-left corner
0, 0, -- position of the vertex
0, 0, -- texture coordinate at the vertex position
math.random(0,255), math.random(0,255), math.random(0,255), 255 -- color of the vertex
},
{
-- top-right corner
image:getWidth(), 0,
1, 0, -- texture coordinates are in the range of [0, 1]
math.random(0,255), math.random(0,255), math.random(0,255), 255
},
{
-- bottom-right corner
image:getWidth(), image:getHeight(),
1, 1,
math.random(0,255), math.random(0,155), math.random(0,255), 255
},
{
-- bottom-left corner
0, image:getHeight(),
0, 1,
math.random(0,255), math.random(0,255), math.random(0,255), 255
},
}
local indices =
{
{
0, 1, 2, 3
},
}
mesh = love.graphics.newMesh(vertices, 4, indices, "fan")
end
function love.update(dt)
if love.keyboard.isDown("esc") then love.event.quit() end
if love.keyboard.isDown("a") then mesh:setTexture(image) end
if love.keyboard.isDown("d") then mesh:setTexture(nil) end
if love.keyboard.isDown("e") then
newVertices = {
{
-- top-left corner
love.math.random(-200,200), love.math.random(-200,200), -- position of the vertex
0, 0, -- texture coordinate at the vertex position
155, 45, 5, 255 -- color of the vertex
},
{
-- top-right corner
image:getWidth(), love.math.random(0,200),
1, 0, -- texture coordinates are in the range of [0, 1]
55, 5, 155, 255
},
{
-- bottom-right corner
image:getWidth(), image:getHeight(),
1, 1,
255, 255, 255, 255
},
{
-- bottom-left corner
love.math.random(-200,200), image:getHeight(),
0, 1,
255, 255, 255, 255
},
}
mesh:setVertices(newVertices)
end
end
function love.draw()
love.graphics.draw(mesh, 200, 300)
end
|
addEvent("saveAeditedinfos",true)
addEventHandler("saveAeditedinfos",getRootElement( ),
function ( information )
local grupo = getPlayerGroup( source );
update_group_information( grupo, information )
exec_event( "on_ginfo_changed", grupo, information, source )
end)
|
TextMessage = {}
-- require styles
g_ui.importStyle('textmessage.otui')
-- private variables
local MessageTypes = {
consoleRed = { color = '#F55E5E', consoleTab = tr('Default') },
consoleOrange = { color = '#FE6500', consoleTab = tr('Default') },
consoleBlue = { color = '#9F9DFD', consoleTab = tr('Default') },
warning = { color = '#F55E5E', consoleTab = tr('Server Log'), labelId = 'centerWarning' },
infoDescription = { color = '#00EB00', consoleTab = tr('Server Log'), labelId = 'centerInfo', consoleOption = 'showInfoMessagesInConsole' },
eventAdvance = { color = '#FFFFFF', consoleTab = tr('Server Log'), labelId = 'centerAdvance', consoleOption = 'showEventMessagesInConsole' },
eventDefault = { color = '#FFFFFF', consoleTab = tr('Server Log'), labelId = 'bottomStatus', consoleOption = 'showEventMessagesInConsole' },
statusDefault = { color = '#FFFFFF', consoleTab = tr('Server Log'), labelId = 'bottomStatus', consoleOption = 'showStatusMessagesInConsole' },
statusSmall = { color = '#FFFFFF', labelId = 'bottomStatus' },
private = { color = '#5FF7F7', labelId = 'centerPrivate' }
}
local centerTextMessagePanel
local bottomStatusLabel
local privateLabel
-- private functions
local function displayMessage(msgtype, msg, time)
if not g_game.isOnline() then return end
if msgtype.consoleTab ~= nil then
if msgtype.consoleOption == nil or Options.getOption(msgtype.consoleOption) then
Console.addText(msg, msgtype, msgtype.consoleTab)
end
end
if msgtype.labelId then
local label = GameInterface.getMapPanel():recursiveGetChildById(msgtype.labelId)
label:setText(msg)
label:setColor(msgtype.color)
if not time then
time = math.max(#msg * 100, 4000)
else
time = time * 1000
end
removeEvent(label.hideEvent)
addEvent(function() label:setVisible(true) end)
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, time)
end
end
local function createTextMessageLabel(id, parent, class)
local label = g_ui.createWidget(class, parent)
label:setFont('verdana-11px-rounded')
label:setId(id)
return label
end
-- public functions
function TextMessage.init()
connect(g_game, { onDeath = TextMessage.displayDeadMessage,
onTextMessage = TextMessage.display,
onGameStart = TextMessage.clearMessages })
centerTextMessagePanel = g_ui.createWidget('Panel', GameInterface.getMapPanel())
centerTextMessagePanel:setId('centerTextMessagePanel')
local layout = UIVerticalLayout.create(centerTextMessagePanel)
layout:setFitChildren(true)
centerTextMessagePanel:setLayout(layout)
centerTextMessagePanel:setWidth(360)
centerTextMessagePanel:centerIn('parent')
createTextMessageLabel('centerWarning', centerTextMessagePanel, 'CenterLabel')
createTextMessageLabel('centerAdvance', centerTextMessagePanel, 'CenterLabel')
createTextMessageLabel('centerInfo', centerTextMessagePanel, 'CenterLabel')
privateLabel = createTextMessageLabel('centerPrivate', GameInterface.getMapPanel(), 'TopCenterLabel')
bottomStatusLabel = createTextMessageLabel('bottomStatus', GameInterface.getMapPanel(), 'BottomLabel')
end
function TextMessage.terminate()
disconnect(g_game, { onDeath = TextMessage.displayDeadMessage,
onTextMessage = TextMessage.display,
onGameStart = TextMessage.clearMessages })
removeEvent(GameInterface.getMapPanel():recursiveGetChildById('centerWarning').hideEvent)
removeEvent(GameInterface.getMapPanel():recursiveGetChildById('centerAdvance').hideEvent)
removeEvent(GameInterface.getMapPanel():recursiveGetChildById('centerInfo').hideEvent)
removeEvent(GameInterface.getMapPanel():recursiveGetChildById('centerPrivate').hideEvent)
removeEvent(GameInterface.getMapPanel():recursiveGetChildById('bottomStatus').hideEvent)
centerTextMessagePanel:destroy()
bottomStatusLabel:destroy()
privateLabel:destroy()
centerTextMessagePanel = nil
bottomStatusLabel = nil
privateLabel = nil
TextMessage = nil
end
function TextMessage.clearMessages()
GameInterface.getMapPanel():recursiveGetChildById('centerWarning'):hide()
GameInterface.getMapPanel():recursiveGetChildById('centerAdvance'):hide()
GameInterface.getMapPanel():recursiveGetChildById('centerInfo'):hide()
GameInterface.getMapPanel():recursiveGetChildById('centerPrivate'):hide()
GameInterface.getMapPanel():recursiveGetChildById('bottomStatus'):hide()
end
function TextMessage.displayStatus(msg, time)
displayMessage(MessageTypes.statusSmall, msg)
end
function TextMessage.displayEventAdvance(msg, time)
displayMessage(MessageTypes.eventAdvance, msg, time)
end
function TextMessage.displayPrivate(msg, time)
displayMessage(MessageTypes.private, msg, time)
end
function TextMessage.display(msgtypedesc, msg)
local msgtype = MessageTypes[msgtypedesc]
if msgtype then
displayMessage(msgtype, msg)
end
end
function TextMessage.displayDeadMessage()
local advanceLabel = GameInterface.getMapPanel():recursiveGetChildById('centerAdvance')
if advanceLabel:isVisible() then return end
TextMessage.displayEventAdvance(tr('You are dead.'))
end
|
local helpers = require("helpers")
local beautiful = require("beautiful")
local gtimer = require("gears.timer")
local noti = require("utils.noti")
local spawn = require("awful.spawn")
local unknown_icon = beautiful.widget_battery_icon_unknown or ""
local discharging_icon = beautiful.widget_battery_icon_discharging or ""
local charging_icon = beautiful.widget_battery_icon_charging or ""
local full_icon = beautiful.widget_battery_icon_full or ""
local ac_icon = beautiful.widget_battery_icon_ac or "臘"
local battery_state = {
["Full"] = { full_icon, M.x.primary },
["Unknown"] = { unknown_icon, M.x.error },
["Charged"] = { charging_icon, M.x.primary_variant_1 },
["Charging"] = { charging_icon, M.x.secondary },
["Discharging"] = { discharging_icon, M.x.error_variant_1 },
}
local state_old = "Full"
local start = true
local update_interval = 15
local function battery_info()
spawn.easy_async_with_shell(
"sh -c 'out=\"$(find /sys/class/power_supply/BAT?)\" && (echo \"$out\" | head -n 1) || false' ",
function(battery_file, _, __, exit_code)
if not (exit_code == 0) then
noti.info("No battery found")
return
end
local fpath = battery_file:gsub('%\n', '')
-- if battery is present
local bat_script = [[ sh -c '
path="]]..fpath..[["
present="$(cat $path/present)"
stat="$(cat $path/status)"
charge_now="$(cat $path/charge_now)"
[ -f "$path/energy_now" ] && charge_now="$(cat $path/energy_now)"
charge_full="$(cat $path/charge_full)"
[ -f "$path/energy_full" ] && charge_full="$(cat $path/energy_full)"
echo "$present@$stat@$charge_now@$charge_full@"
'
]]
spawn.easy_async_with_shell(bat_script, function(stdout)
if (stdout == nil or stdout == '') then
noti.info("Failed to retrieve info about your battery")
return awesome.emit_signal("daemon::battery", battery_state["Unknown\n"], 0)
end
local present, stat, charge_now, charge_full = stdout:match('(.-)@(.-)@(.-)@(.-)@')
local bat = fpath:match('(BAT[0-9])')
if not present or present ~= "1" then
return awesome.emit_signal("daemon::battery", battery_state["Unknown\n"], 0)
end
-- notif if state change
if stat ~= state_old and not start then
noti.info(bat:lower() .. " " .. stat:lower())
state_old = stat
end
-- state information
local state = battery_state[stat] or battery_state["Unknown\n"]
-- charge now
local remaining, capacity, capacity_design
if charge_now then
capacity = charge_full
remaining = charge_now
capacity_design = capacity
else
return awesome.emit_signal("daemon::battery", battery_state["Unknown\n"], 0)
end
local percent = math.min(math.floor(remaining / capacity * 100), 100)
awesome.emit_signal("daemon::battery", stat, percent, bat)
start = false
end)
end)
end
-- update every 10 seconds
gtimer {
timeout = update_interval, autostart = true, call_now = true,
callback = function() battery_info() end
}
|
GO = nil
playerTrans = nil
defaultPos = nil
startFadeTime = 4.0
appearTime = 3.0
currentTime = 0.0
appeared = true
isFading = false
colorVal = 1.0
prevPos = Vector3()
lateStart = true
cam = nil
currentPivotX = 0
local newPosition = Vector3()
icon = nil
iconTrans = nil
text = nil
textTrans = nil
trans = nil
function Constructor()
GO = owner
trans = owner:GetComponent("Transform")
camobj = GO:GetLayer():GetObject("MainCamera")
cam = camobj:GetComponent("Camera")
if(GO:Name() == "UI_InfoBg1") then
icon = GO:GetLayer():GetObject("UI_Jump")
text = GO:GetLayer():GetObject("UI_HintTextJump")
end
if(GO:Name() == "UI_InfoBg2") then
icon = GO:GetLayer():GetObject("UI_SwitchMode")
text = GO:GetLayer():GetObject("UI_HintTextSwitch")
end
if(GO:Name() == "UI_InfoBg3") then
icon = GO:GetLayer():GetObject("UI_LTIcon")
text = GO:GetLayer():GetObject("UI_HintTextRotate")
end
if(GO:Name() == "UI_InfoBg4" ) then
icon = GO:GetLayer():GetObject("UI_RTIcon")
text = GO:GetLayer():GetObject("UI_HintTextFire")
end
iconTrans = icon:GetComponent("Transform")
textTrans = text:GetComponent("Transform")
end
function SetPosition(screenPosX,screenPosY,pivotX,pivotY, t)
vertSize = 10
--Get the new position as thought it's 0.5 at pivot
y = (screenPosY*vertSize)-(vertSize/2)
ratio = cam:GetViewporSize():x()/cam:GetViewporSize():y()
horiSize = vertSize*ratio
x = (screenPosX*horiSize)-(horiSize/2)
v = Vector3(x, y, t:GetWorldPosition():z())
--offset the new position base on the pivot
pivotOffset = Vector3( pivotX - 0.5,
pivotY - 0.5,
0.0)
x = pivotOffset:x() * t:GetWorldScale():x()
y = pivotOffset:y() * t:GetWorldScale():z()
z = pivotOffset:z()
pivotOffset = Vector3( x, y, z)
v = v + pivotOffset
newPosition = v
end
function OnUpdate(dt)
if(lateStart) then
lateStart = false
currentTime = 0.0
appeared = true
icon:SetActive(true)
text:SetActive(true)
return
end
if(appeared == false) then
currentPivotX = currentPivotX + dt*1.3
if(currentPivotX > 1) then
currentPivotX = 1
end
UpdatePosition()
if(ControllerPress("ShowHint")) then
currentTime = 0.0
appeared = true
icon:SetActive(true)
text:SetActive(true)
end
else
currentPivotX = currentPivotX - dt*1.3
if(currentPivotX < 0) then
currentPivotX = 0
end
UpdatePosition()
currentTime = currentTime + dt
if(currentTime >= startFadeTime) then
currentTime = 0.0
appeared = false
icon:SetActive(false)
text:SetActive(false)
end
end
end
function UpdatePosition()
oldZ = textTrans:GetWorldPosition():z()
if(GO:Name() == "UI_InfoBg1") then
SetPosition(1,0.5, currentPivotX,0.5,trans)
elseif(GO:Name() == "UI_InfoBg2") then
SetPosition(1,0.58,currentPivotX,0.5,trans)
elseif(GO:Name() == "UI_InfoBg3") then
SetPosition(1,0.66,currentPivotX,0.5,trans)
elseif(GO:Name() == "UI_InfoBg4" ) then
SetPosition(1,0.74,currentPivotX,0.5,trans)
end
trans:SetWorldPosition(newPosition)
txPos = newPosition
txPos.x = txPos:x() + trans:GetWorldScale():x()/6
txPos.z = txPos:z() + 1
textTrans:SetWorldPosition(txPos)
n = newPosition
n.x = n:x() - trans:GetWorldScale():x()/2
n.y = n:y() + trans:GetWorldScale():z()/2
n.z = n:z() + 1
iconTrans:SetWorldPosition(n)
end |
local nn = require 'nn'
require 'loadcaffe'
local Model = {}
function Model:createAutoencoder(X)
local featureSize = X:size(2) * X:size(3)
-- Create encoder
self.encoder = nn.Sequential()
self.encoder:add(nn.View(-1, featureSize))
--self.encoder:add(nn.Dropout(0.2))
self.encoder:add(nn.Linear(featureSize, 500))
self.encoder:add(nn.ReLU(true))
--self.encoder:add(nn.Dropout(0.2))
self.encoder:add(nn.Linear(500, 500))
self.encoder:add(nn.ReLU(true))
----self.encoder:add(nn.Dropout(0.2))
self.encoder:add(nn.Linear(500, 2000))
self.encoder:add(nn.ReLU(true))
----self.encoder:add(nn.Dropout(0.2))
self.encoder:add(nn.Linear(2000, 10))
---- self.encoder:add(nn.Sigmoid(true))
---- Create decoder
self.decoder = nn.Sequential()
----self.decoder:add(nn.Dropout(0.2))
self.decoder:add(nn.Linear(10, 2000))
self.decoder:add(nn.ReLU(true))
----self.decoder:add(nn.Dropout(0.2))
self.decoder:add(nn.Linear(2000, 500))
self.decoder:add(nn.ReLU(true))
----self.decoder:add(nn.Dropout(0.2))
self.decoder:add(nn.Linear(500, 500))
self.decoder:add(nn.ReLU(true))
--self.decoder:add(nn.Dropout(0.2))
self.decoder:add(nn.Linear(500, featureSize))
--self.decoder:add(nn.ReLU(true))
--self.decoder:add(nn.Sigmoid(true))
self.decoder:add(nn.View(X:size(2), X:size(3)))
-- Create autoencoder
self.autoencoder = nn.Sequential()
--self.noiser = nn.WhiteNoise(0, 0.5) -- Add white noise to inputs during training
--self.autoencoder:add(self.noiser)
self.autoencoder:add(self.encoder)
self.autoencoder:add(self.decoder)
self:init()
end
function Model:init()
local model = loadcaffe.load('models/net.prototxt', 'models/save_iter_100000.caffemodel', 'ccn2')
print(model)
targets = self.autoencoder:findModules('nn.Linear')
sources = model:findModules('nn.Linear')
for i =1, #targets do
targets[i].weight:copy(sources[i].weight)
targets[i].bias:copy(sources[i].bias)
end
--for k,v in pairs(self.encoder:findModules('nn.Linear')) do
-- v.weight:normal(0, 0.01)
-- v.bias:zero()
--end
--for k,v in pairs(self.decoder:findModules('nn.Linear')) do
-- v.weight:normal(0, 0.01)
-- v.bias:zero()
--end
end
return Model
|
print("Welp gonna end at 4"); |
-- converter funcs
function hex2rgb(hex)
hex = hex:gsub("#","")
return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6))
end
function hex2rgb_color(hex)
color = {}
color.r, color.g, color.b = hex2rgb(hex)
return color
end
function color2hex(color)
local hex = ""
hex = hex..('%02X'):format(tonumber(color.r))
hex = hex..('%02X'):format(tonumber(color.g))
hex = hex..('%02X'):format(tonumber(color.b))
return hex
end
|
CreateEngineApp("Application Base") |
local final = {}
for _, item in data["base.item"]:iter() do
if type(item.gods) == "table" then
for _, god in data["elona.god"]:iter() do
if table.set(item.gods)[god._id] then
local cats = table.set(god.offerings)
local found = true
for _, cat in ipairs(item.categories) do
if cats[cat] then
found = false
break
end
end
if found then
final[#final+1] = {
god = god._id,
item = item._id
}
end
end
end
end
end
print(inspect(final))
-- Local Variables:
-- open-nefia-always-send-to-repl: t
-- End:
|
local AddonName, AddonTable = ...
AddonTable.skinning = {
-- Leather
172093,
-- Hides
172095,
-- Misc
178061,
172092,
177279,
}
|
--[[
/////// //////////////////
/////// PROJECT: MTA iLife - German Fun Reallife Gamemode
/////// VERSION: 1.7.2
/////// DEVELOPERS: See DEVELOPERS.md in the top folder
/////// LICENSE: See LICENSE.md in the top folder
/////// /////////////////
]]
-- #######################################
-- ## Project: MTA iLife ##
-- ## Name: CO_Toilette.lua ##
-- ## Author: Noneatme ##
-- ## Version: 1.0 ##
-- ## License: See top Folder ##
-- #######################################
-- FUNCTIONS / METHODS --
local cFunc = {}; -- Local Functions
local cSetting = {}; -- Local Settings
CO_Toilette = {};
CO_Toilette.__index = CO_Toilette;
--[[
]]
-- ///////////////////////////////
-- ///// New //////
-- ///// Returns: Object //////
-- ///////////////////////////////
function CO_Toilette:New(...)
local obj = setmetatable({}, {__index = self});
if obj.Constructor then
obj:Constructor(...);
end
return obj;
end
-- ///////////////////////////////
-- ///// FlushToilet //////
-- ///// Returns: void //////
-- ///////////////////////////////
function CO_Toilette:FlushToilet(uPlayer, uObject)
if not(self.toiletFlush[uObject]) and (isElement(uPlayer)) then
triggerClientEvent(getRootElement(), "onClientObjectAction", getRootElement(), 4, uObject);
self.toiletFlush[uObject] = true;
setTimer(function() self.toiletFlush[uObject] = false end, 5000, 1);
end
end
-- ///////////////////////////////
-- ///// Constructor //////
-- ///// Returns: void //////
-- ///////////////////////////////
function CO_Toilette:Constructor(...)
-- Klassenvariablen --
self.toiletFlush = {}
-- Methoden --
-- Events --
--logger:OutputInfo("[CALLING] CO_Toilette: Constructor");
end
-- EVENT HANDLER --
|
local result = redis.call('INCR', KEYS[1])
if result == 1 then
redis.call('EXPIRE', KEYS[1], 60)
end
if result > 10000 then
result = -1
end
return result |
-- Copyright 2011 by Jannis Pohlmann
-- Copyright 2012 by Till Tantau
--
-- This file may be distributed an/or modified
--
-- 1. under the LaTeX Project Public License and/or
-- 2. under the GNU Public License
--
-- See the file doc/generic/pgf/licenses/LICENSE for more information
-- @release $Header: /cvsroot/pgf/pgf/generic/pgf/graphdrawing/lua/pgf/gd/lib/PriorityQueue.lua,v 1.1 2012/11/27 17:24:26 tantau Exp $
---
-- A PriorityQueue supports operations for quickly finding the minimum from a set of elements
--
-- Its implementation is based on (simplified) Fibonacci heaps.
local PriorityQueue = {}
local PriorityQueueMeta = {__index = PriorityQueue}
-- Local declarations
local FibonacciHeap = {}
local FibonacciHeapNode = {}
--- Creates a new priority queue
--
-- @return The newly created queue
function PriorityQueueMeta.__call()
local queue = {
heap = FibonacciHeap.new(),
nodes = {},
values = {},
}
setmetatable(queue, PriorityQueueMeta)
return queue
end
--- Add an element with a certain priority to the queue
--
-- @param value An object
-- @param priority Its priority
function PriorityQueue:enqueue(value, priority)
local node = self.heap:insert(priority)
self.nodes[value] = node
self.values[node] = value
end
--- Removes the element with the minimum priority from the queue
--
-- @return The element with the minimum priority
function PriorityQueue:dequeue()
local node = self.heap:extractMinimum()
if node then
local value = self.values[node]
self.nodes[value] = nil
self.values[node] = nil
return value
else
return nil
end
end
--- Lower the priority of an element of a queue
--
-- @param value An object
-- @param priority A new priority, which must be lower than the old priority
function PriorityQueue:updatePriority(value, priority)
local node = self.nodes[value]
assert(node, 'updating the priority of ' .. tostring(value) .. ' failed because it is not in the priority queue')
self.heap:updateValue(node, priority)
end
--- Tests, whether the queue is empty
--
-- @return True, if the queue is empty
function PriorityQueue:empty()
return #self.heap.trees == 0
end
-- Internals: An implementation of fibonacci heaps.
FibonacciHeap.__index = FibonacciHeap
function FibonacciHeap.new()
local heap = {
trees = {},
minimum = nil,
}
setmetatable(heap, FibonacciHeap)
return heap
end
function FibonacciHeap:insert(value)
local node = FibonacciHeapNode.new(value)
local heap = FibonacciHeap.new()
table.insert(heap.trees, node)
self:merge(heap)
return node
end
function FibonacciHeap:merge(other)
for _, tree in ipairs(other.trees) do
table.insert(self.trees, tree)
end
self:updateMinimum()
end
function FibonacciHeap:extractMinimum()
if self.minimum then
local minimum = self:removeTableElement(self.trees, self.minimum)
for _, child in ipairs(minimum.children) do
child.root = child
table.insert(self.trees, child)
end
local same_degrees_found = true
while same_degrees_found do
same_degrees_found = false
local degrees = {}
for _, root in ipairs(self.trees) do
local degree = root:getDegree()
if degrees[degree] then
if root.value < degrees[degree].value then
self:linkRoots(root, degrees[degree])
else
self:linkRoots(degrees[degree], root)
end
degrees[degree] = nil
same_degrees_found = true
break
else
degrees[degree] = root
end
end
end
self:updateMinimum()
return minimum
end
end
function FibonacciHeap:updateValue(node, value)
local old_value = node.value
local new_value = value
if new_value <= old_value then
self:decreaseValue(node, value)
else
assert(false, 'FibonacciHeap:increaseValue is not implemented yet')
end
end
function FibonacciHeap:decreaseValue(node, value)
assert(value <= node.value)
node.value = value
if node.value < node.parent.value then
local parent = node.parent
self:cutFromParent(node)
if not parent:isRoot() then
if parent.marked then
self:cutFromParent(parent)
else
parent.marked = true
end
end
end
if node.value < self.minimum.value then
self.minimum = node
end
end
function FibonacciHeap:delete(node)
self:decreaseValue(node, -math.huge)
self:extractMinimum()
end
function FibonacciHeap:linkRoots(root, child)
child.root = root
child.parent = root
child = self:removeTableElement(self.trees, child)
table.insert(root.children, child)
return root
end
function FibonacciHeap:cutFromParent(node)
local parent = node.parent
node.root = node
node.parent = node
node.marked = false
node = self:removeTableElement(parent.children, node)
table.insert(self.trees, node)
end
function FibonacciHeap:updateMinimum()
self.minimum = self.trees[1]
for _, root in ipairs(self.trees) do
if root.value < self.minimum.value then
self.minimum = root
end
end
end
function FibonacciHeap:removeTableElement(input_table, element)
for i = 1, #input_table do
if input_table[i] == element then
return table.remove(input_table, i)
end
end
end
-- Now come the nodes
FibonacciHeapNode.__index = FibonacciHeapNode
function FibonacciHeapNode.new(value, root, parent)
local node = {
value = value,
children = {},
marked = false,
root = nil,
parent = nil,
}
setmetatable(node, FibonacciHeapNode)
if root then
node.root = root
node.parent = parent
else
node.root = node
node.parent = node
end
return node
end
function FibonacciHeapNode:addChild(value)
local child = FibonacciHeapNode.new(value, self.root, self)
table.insert(self.children, child)
end
function FibonacciHeapNode:getDegree()
return #self.children
end
function FibonacciHeapNode:setRoot(root)
self.root = root
if root == self then
self.parent = root
end
if #self.children > 0 then
for _, child in ipairs(self.children) do
child.root = root
end
end
end
function FibonacciHeapNode:isRoot()
return self.root == self
end
-- done
return setmetatable(PriorityQueue, PriorityQueueMeta)
|
---
-- @author wesen
-- @copyright 2018-2019 wesen <wesen-ac@web.de>
-- @release 0.1
-- @license MIT
--
local TestRunner = require "wLuaUnit.TestRunner"
--
-- Add the path to the AC-ClientOutput classes to the package path list, so the require paths can match
-- the ones that are used in the "src" folder
-- This is required to mock dependencies in each TestCase
--
package.path = package.path .. ";../src/?.lua"
--
-- Add the main directory to the package path list so that classes inside the tests directory can be
-- required with the prefix "tests."
--
package.path = package.path .. ";../?.lua"
--
-- Require the penlight compatibility module that adds some global functions that are missing in Lua5.1
-- such as package.searchpath, table.unpack and table.pack
--
require "pl.compat"
--
-- The lua unit test suite
-- Runs all tests from the "unit" folder
--
local runner = TestRunner()
local coverageAnalysisConfigFile = _G.arg[1]
_G.arg[1] = nil
runner:addTestDirectory("unit")
:enableCoverageAnalysis(coverageAnalysisConfigFile)
:run()
|
player = {
pos = {
X = 20,
Y = 30,
},
filename = "loremipsum.png",
HP = 20,
-- you can also have comments
}
function sum(x, y)
return x + y
end
function setPlayerHP(value)
player.HP = value
end
function testCppFunction()
write("Hello, world!")
ignore("A")
local x = 42
write("Answer: "..x)
ignore("B")
end
|
--[=[
ldecnumber binding for decnumber decimal number support
df(lo,hi,scale) -> d; to be used with getdecimal()
sdf(d,scale) -> lo,hi; to be used with setdecimal()
decnumber_meta -> ldecNumber.number_metatable
isdecnumber(x) -> true|false; the decnumber library should provide this but since it doesn't...
xsqlvar:getdecnumber() -> d
xsqlvar:setdecnumber(d)
xsqlvar:set(d), extended to support decnumber-type decimals
xsqlvar:get() -> d, extended to support decnumber-type decimals
USAGE: just require this module if you have ldecnumber installed.
LIMITATIONS:
- assumes 2's complement signed int64 format (no byte order assumption though).
]=]
module(...,require 'fbclient.module')
local decNumber = require 'ldecNumber'
local xsqlvar_class = require('fbclient.xsqlvar').xsqlvar_class
decnumber_meta = decNumber.number_metatable
-- convert the lo,hi dword pairs of a 64bit integer into a decimal number and scale it down.
function df(lo,hi,scale)
return decNumber.fma(hi,2^32,lo):scaleb(scale) -- translation: (hi*2^32+lo)*10^scale
end
-- scale up a decimal number and convert it into the corresponding lo,hi dword pairs of its int64 representation.
function sdf(d,scale)
d = d:scaleb(-scale) -- translation: d*10^-scale
-- TODO: find a way to avoid temporary string creation: this is embarrasing and humiliating.
-- TODO: find a faster way to divide than mod() and floor() which are combinations of multiple functions.
local lo,hi = tonumber(d:mod(2^32):tostring()), tonumber(d:floor(2^32):tostring())
return lo,hi
end
function xsqlvar_class:getdecnumber()
return self:getdecimal(df)
end
function xsqlvar_class:setdecnumber(d)
self:setdecimal(d,sdf)
end
function isdecnumber(p)
return getmetatable(p) == decnumber_meta
end
xsqlvar_class:add_set_handler(
function(self,p,typ,opt)
if isdecnumber(p) and (typ == 'int16' or typ == 'int32' or typ == 'int64') then
self:setdecnumber(p)
return true
end
end
)
xsqlvar_class:add_get_handler(
function(self,typ,opt)
if typ == 'int16' or typ == 'int32' or typ == 'int64' then
return true,self:getdecnumber()
end
end
)
|
local id, scl, sda = 0, 1, 2
local i2c = i2c
-- scl: PIN 1 (I/O index) = GPIO5 (D1)
-- sda: PIN 2 (I/O index) = GPIO4 (D2)
function i2c_setup(sda,scl)
i2c.setup(id, sda, scl, i2c.FASTPLUS)
end
function i2c_device_check(dev_addr)
i2c.start(id)
local ret = i2c.address(id, dev_addr, i2c.TRANSMITTER)
i2c.stop(id)
return ret
end
i2c_setup(sda,scl)
|
--[[
█▀▀█ █░░█ █▀▀█ █▀▀ █▀▀▄ ░▀░ █░█ █▀▀ ▀▀█▀▀ █░░█ █▀▀▄ ░▀░ █▀▀█
█░░█ █▀▀█ █░░█ █▀▀ █░░█ ▀█▀ ▄▀▄ ▀▀█ ░░█░░ █░░█ █░░█ ▀█▀ █░░█
█▀▀▀ ▀░░▀ ▀▀▀▀ ▀▀▀ ▀░░▀ ▀▀▀ ▀░▀ ▀▀▀ ░░▀░░ ░▀▀▀ ▀▀▀░ ▀▀▀ ▀▀▀▀
PROGRAMADOR: BYBLACKDEATH
]]--
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent('ps_core:combination1') -- Artículo Combinación 1
AddEventHandler('ps_core:combination1', function()
local xPlayer = ESX.GetPlayerFromId(source)
local xItem1 = xPlayer.getInventoryItem('bread') -- Item requerido para cocinar. Se puede cambiar a Aceite o etc -- Item required for ps_core. Can be changed to Oil or etc
local xItem2 = xPlayer.getInventoryItem('water')
if xItem1.count > 0 then -- Artículo 1 Count
if xItem2.count > 0 then -- Artículo 2 Count
TriggerClientEvent('ps_core:animation' , source)
Citizen.Wait(10000)
xPlayer.addInventoryItem('pollo_asado', 1)
xPlayer.removeInventoryItem('pollo_vivo', 1)
xPlayer.removeInventoryItem('beer', 1)
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 agua.')
end
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 Pan.')
end
end)
RegisterServerEvent('ps_core:combination2')
AddEventHandler('ps_core:combination2', function()
local xPlayer = ESX.GetPlayerFromId(source)
local xItem1 = xPlayer.getInventoryItem('bread')
local xItem2 = xPlayer.getInventoryItem('water')
if xItem1.count > 0 then
if xItem2.count > 0 then
TriggerClientEvent('ps_core:animation' , source)
Citizen.Wait(10000)
xPlayer.addInventoryItem('sandwich_devian', 5)
xPlayer.removeInventoryItem('packaged_chicken', 2)
xPlayer.removeInventoryItem('bread', 1)
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 agua.')
end
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 Pan.')
end
end)
RegisterServerEvent('ps_core:combination3')
AddEventHandler('ps_core:combination3', function()
local xPlayer = ESX.GetPlayerFromId(source)
local xItem1 = xPlayer.getInventoryItem('bread')
local xItem2 = xPlayer.getInventoryItem('water')
if xItem1.count > 0 then
if xItem2.count > 0 then
TriggerClientEvent('ps_core:animation' , source)
Citizen.Wait(10000)
xPlayer.addInventoryItem('lubina', 1)
xPlayer.removeInventoryItem('fish', 1)
xPlayer.removeInventoryItem('chips', 1)
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 agua.')
end
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 Pan.')
end
end)
RegisterServerEvent('ps_core:combination4')
AddEventHandler('ps_core:combination4', function()
local xPlayer = ESX.GetPlayerFromId(source)
local xItem1 = xPlayer.getInventoryItem('bread')
local xItem2 = xPlayer.getInventoryItem('water')
if xItem1.count > 0 then
if xItem2.count > 0 then
TriggerClientEvent('ps_core:animation' , source)
Citizen.Wait(10000)
xPlayer.addInventoryItem('sopa', 1)
xPlayer.removeInventoryItem('meat', 1)
xPlayer.removeInventoryItem('fish', 1)
xPlayer.removeInventoryItem('acqua', 1)
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 agua.')
end
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 Pan.')
end
end)
RegisterServerEvent('ps_core:combination5')
AddEventHandler('ps_core:combination5', function()
local xPlayer = ESX.GetPlayerFromId(source)
local xItem1 = xPlayer.getInventoryItem('bread')
local xItem2 = xPlayer.getInventoryItem('water')
if xItem1.count > 0 then
if xItem2.count > 0 then
TriggerClientEvent('ps_core:animation' , source)
Citizen.Wait(10000)
xPlayer.addInventoryItem('chocolate_cupcake', 1)
xPlayer.removeInventoryItem('chocolate', 1)
xPlayer.removeInventoryItem('cupcake', 1)
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 agua.')
end
else
TriggerClientEvent('esx:showNotification', source, 'No tienes x1 Pan.')
end
end)
|
local PANEL = {}
function PANEL:Init()
self.total = 0
self.enemyvalue = 0
self.urvalue = 0
self.nextcard = 0
self.w_and_lose = 0
self.scrW, self.scrH = ScrW(), ScrH()
self:SetSize(self.scrW * 0.35, self.scrH * 0.55)
self:MakePopup()
self:Center()
self:SetTitle("")
self:ShowCloseButton( false )
self:SetDraggable( false )
local some_tipsWyes, some_tipsHyes = self.scrW * 0.2, self.scrH * 0.02
local some_tipsXyes, some_tipsYyes = (self.scrW * 0.128) - (some_tipsWyes * 0.5), self.scrH * 0.42
function self:Paint( w, h )
local material = Material("carts/ui_mod_cards.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
surface.SetFont( "DescTipFont" )
surface.SetTextColor(Color(169, 169, 169))
surface.SetTextPos( some_tipsXyes, some_tipsYyes )
if ScrW() == 1280 then
surface.DrawText( "Вы: "..self.urvalue.." Ваша ставка на выигрыш: "..self.total.." Враг: "..self.enemyvalue)
else
surface.DrawText( "Вы: "..self.urvalue.." Ваша ставка на выигрыш: "..self.total.." Враг: "..self.enemyvalue)
end
end
local typo_logoWyes, typo_logoHyes = self.scrW * 0.1, self.scrH * 0.02
local typo_logoXyes, typo_logoYyes = (self.scrW * 0.196) - (typo_logoWyes * 0.5), self.scrH * 0.011
self.typo_logo = self:Add("DLabel")
self.typo_logo:SetPos( typo_logoXyes, typo_logoYyes )
self.typo_logo:SetSize( typo_logoWyes, typo_logoHyes )
self.typo_logo:SetText("Игра: 21 очко")
self.typo_logo:SetFont("DescCharFont1")
local some_tipsWyes, some_tipsHyes = self.scrW * 0.22, self.scrH * 0.02
local some_tipsXyes, some_tipsYyes = (self.scrW * 0.18) - (some_tipsWyes * 0.5), self.scrH * 0.375
self.some_tips = self:Add("DLabel")
self.some_tips:SetPos( some_tipsXyes, some_tipsYyes )
self.some_tips:SetSize( some_tipsWyes, some_tipsHyes )
self.some_tips:SetText("Минимальная ставка - 50. максимальная - 1000.")
self.some_tips:SetFont("DescCharFont1")
local char_moneyWyes, char_moneyHyes = self.scrW * 0.1, self.scrH * 0.02
local char_moneyXyes, char_moneyYyes = (self.scrW * 0.18) - (char_moneyWyes * 0.5), self.scrH * 0.189
self.value_char = self:Add("DLabel")
self.value_char:SetPos( char_moneyXyes, char_moneyYyes )
self.value_char:SetSize( char_moneyWyes, char_moneyHyes )
self.value_char:SetText("У вас "..LocalPlayer():getChar():getMoney().." рублей")
self.value_char:SetFont("DescCharFont1")
local picwanWyes, picwanHyes = self.scrW * 0.055, self.scrH * 0.125
local picwanXyes, picwanYyes = (self.scrW * 0.0535) - (picwanWyes * 0.55), self.scrH * 0.042
self.picwan = self:Add( "DImage" )
self.picwan:SetSize( picwanWyes, picwanHyes )
self.picwan:SetPos( picwanXyes, picwanYyes )
self.picwan:SetImage( "carts/rybawka.png" )
local pictwoWyes, pictwoHyes = self.scrW * 0.055, self.scrH * 0.125
local pictwoXyes, pictwoYyes = (self.scrW * 0.115) - (pictwoWyes * 0.55), self.scrH * 0.042
self.pictwo = self:Add( "DImage" )
self.pictwo:SetSize( pictwoWyes, pictwoHyes )
self.pictwo:SetPos( pictwoXyes, pictwoYyes )
self.pictwo:SetImage( "carts/rybawka.png" )
local pictreeWyes, pictreeHyes = self.scrW * 0.055, self.scrH * 0.125
local pictreeXyes, pictreeYyes = (self.scrW * 0.1765) - (pictreeWyes * 0.55), self.scrH * 0.042
self.pictree = self:Add( "DImage" )
self.pictree:SetSize( pictreeWyes, pictreeHyes )
self.pictree:SetPos( pictreeXyes, pictreeYyes )
self.pictree:SetImage( "carts/rybawka.png" )
local picforWyes, picforHyes = self.scrW * 0.055, self.scrH * 0.125
local picforXyes, picforYyes = (self.scrW * 0.2380) - (picforWyes * 0.55), self.scrH * 0.042
self.picfor = self:Add( "DImage" )
self.picfor:SetSize( picforWyes, picforHyes )
self.picfor:SetPos( picforXyes, picforYyes )
self.picfor:SetImage( "carts/rybawka.png" )
local picfiveWyes, picfiveHyes = self.scrW * 0.055, self.scrH * 0.125
local picfiveXyes, picfiveYyes = (self.scrW * 0.2990) - (picfiveWyes * 0.55), self.scrH * 0.042
self.picfive = self:Add( "DImage" )
self.picfive:SetSize( picfiveWyes, picfiveHyes )
self.picfive:SetPos( picfiveXyes, picfiveYyes )
self.picfive:SetImage( "carts/rybawka.png" )
local picsixWyes, picsixHyes = self.scrW * 0.055, self.scrH * 0.125
local picsixXyes, picsixYyes = (self.scrW * 0.057) - (picsixWyes * 0.55), self.scrH * 0.232
self.picsix = self:Add( "DImage" )
self.picsix:SetSize( picsixWyes, picsixHyes )
self.picsix:SetPos( picsixXyes, picsixYyes )
self.picsix:SetImage( "carts/rybawka.png" )
local picsevenWyes, picsevenHyes = self.scrW * 0.055, self.scrH * 0.125
local picsevenXyes, picsevenYyes = (self.scrW * 0.1185) - (picsevenWyes * 0.55), self.scrH * 0.232
self.picseven = self:Add( "DImage" )
self.picseven:SetSize( picsevenWyes, picsevenHyes )
self.picseven:SetPos( picsevenXyes, picsevenYyes )
self.picseven:SetImage( "carts/rybawka.png" )
local piceghtWyes, piceghtHyes = self.scrW * 0.055, self.scrH * 0.125
local piceghtXyes, piceghtYyes = (self.scrW * 0.1800) - (piceghtWyes * 0.55), self.scrH * 0.232
self.piceght = self:Add( "DImage" )
self.piceght:SetSize( piceghtWyes, piceghtHyes )
self.piceght:SetPos( piceghtXyes, piceghtYyes )
self.piceght:SetImage( "carts/rybawka.png" )
local picnineWyes, picnineHyes = self.scrW * 0.055, self.scrH * 0.125
local picnineXyes, picnineYyes = (self.scrW * 0.2410) - (picnineWyes * 0.55), self.scrH * 0.232
self.picnine = self:Add( "DImage" )
self.picnine:SetSize( picnineWyes, picnineHyes )
self.picnine:SetPos( picnineXyes, picnineYyes )
self.picnine:SetImage( "carts/rybawka.png" )
local pictenWyes, pictenHyes = self.scrW * 0.055, self.scrH * 0.125
local pictenXyes, pictenYyes = (self.scrW * 0.3025) - (pictenWyes * 0.55), self.scrH * 0.232
self.picten = self:Add( "DImage" )
self.picten:SetSize( pictenWyes, pictenHyes )
self.picten:SetPos( pictenXyes, pictenYyes )
self.picten:SetImage( "carts/rybawka.png" )
local but_plusWyes, but_plusHyes = self.scrW * 0.015, self.scrH * 0.028
local but_plusXyes, but_plusYyes = (self.scrW * 0.187) - (but_plusWyes * 0.5), self.scrH * 0.45
self.but_plus = self:Add("DButton")
self.but_plus:SetText("")
self.but_plus:SetFont("NameFactionPingFont")
self.but_plus:SetTextColor(color_white)
function self.but_plus:Paint( w, h )
if self:IsDown() then
local material = Material("carts/plus_press.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
else
local material = Material("carts/plus_def.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
end
self.but_plus:SetSize(but_plusWyes, but_plusHyes)
self.but_plus:SetPos(but_plusXyes, but_plusYyes)
self.but_plus.DoClick = function(client)
if self.total < 1000 then
self.total = self.total + 50
else
return false
end
end
local but_minWyes, but_minHyes = self.scrW * 0.015, self.scrH * 0.028
local but_minXyes, but_minYyes = (self.scrW * 0.167) - (but_minWyes * 0.5), self.scrH * 0.45
self.but_min = self:Add("DButton")
self.but_min:SetText("")
self.but_min:SetFont("NameFactionPingFont")
self.but_min:SetTextColor(color_white)
function self.but_min:Paint( w, h )
if self:IsDown() then
local material = Material("carts/minus_press.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
else
local material = Material("carts/minus_def.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
end
self.but_min:SetSize(but_minWyes, but_minHyes)
self.but_min:SetPos(but_minXyes, but_minYyes)
self.but_min.DoClick = function(client)
if self.total > 0 then
self.total = self.total - 50
else
return false
end
end
local but_exitWyes, but_exitHyes = self.scrW * 0.075, self.scrH * 0.036
local but_exitXyes, but_exitYyes = (self.scrW * 0.300) - (but_exitWyes * 0.5), self.scrH * 0.505
self.but_exit = self:Add("DButton")
self.but_exit:SetText("Выход")
self.but_exit:SetColor(Color(169, 169, 169))
self.but_exit:SetFont("DescCharFont1")
self.but_exit:SetTextColor(color_white)
function self.but_exit:Paint( w, h )
if self:IsDown() then
local material = Material("carts/but_3k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:IsHovered() and !self:GetDisabled() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:GetDisabled() then
local material = Material("carts/but_1k.png")
surface.SetDrawColor(Color(169, 169, 169))
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:GetDisabled() and self:IsHovered() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(Color(169, 169, 169))
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
else
local material = Material("carts/but_1k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
end
self.but_exit:SetSize(but_exitWyes, but_exitHyes)
self.but_exit:SetPos(but_exitXyes, but_exitYyes)
self.but_exit.DoClick = function(client)
self:Close()
end
local but_startWyes, but_startHyes = self.scrW * 0.075, self.scrH * 0.036
local but_startXyes, but_startYyes = (self.scrW * 0.05) - (but_startWyes * 0.5), self.scrH * 0.505
self.but_start = self:Add("DButton")
self.but_start:SetText("Принять ставки")
self.but_start:SetColor(Color(169, 169, 169))
self.but_start:SetFont("DescCharFont1")
self.but_start:SetTextColor(color_white)
function self.but_start:Paint( w, h )
if self:IsDown() then
local material = Material("carts/but_3k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:IsHovered() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
else
local material = Material("carts/but_1k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
end
self.but_start:SetSize(but_startWyes, but_startHyes)
self.but_start:SetPos(but_startXyes, but_startYyes)
self.but_start.DoClick = function(client)
if (self.total > 0 and LocalPlayer():getChar():getMoney() > self.total) then
netstream.Start("take_my_money", self.total)
self.but_start:Remove()
self.but_min:Remove()
self.but_plus:Remove()
self.but_exit:SetDisabled( true )
self:addContinue()
else
return false
end
end
-- ниже панельки не видят self.lefscroe и self.enemyvalue, но должны отображаться без косяков, есоли это будет пофикшено
--[[local urWyes, urHyes = self.scrW * 0.003, self.scrH * 0.1
local urXyes, urYyes = (self.scrW * 0.005) - (urWyes * 0.5), self.scrH * 0.01
local lefscroeWyes, lefscroeHyes = self.scrW * 0.035, self.scrH * 0.035
local lefscroeXyes, lefscroeYyes = (self.scrW * 0.0475) - (lefscroeWyes * 0.5), self.scrH * 0.405
self.lefscroe = self:Add("DLabel")
self.lefscroe:SetPos( lefscroeXyes, lefscroeYyes )
self.lefscroe:SetSize( lefscroeWyes, lefscroeHyes )
self.lefscroe:SetText("")
self.lefscroe.urvalue = 0
function self.lefscroe:Paint( w, h )
surface.SetFont( "DescTipFont" )
surface.SetTextColor(color_white)
surface.SetTextPos( urXyes, urYyes )
surface.DrawText( "Вы: "..self.lefscroe.urvalue)
end
local enWyes, enHyes = self.scrW * 0.003, self.scrH * 0.1
local enXyes, enYyes = (self.scrW * 0.005) - (enWyes * 0.5), self.scrH * 0.01
local rightcroeWyes, rightscroeHyes = self.scrW * 0.035, self.scrH * 0.035
local rightscroeXyes, rightscroeYyes = (self.scrW * 0.305) - (rightcroeWyes * 0.5), self.scrH * 0.405
self.rightscroe = self:Add("DLabel")
self.rightscroe:SetPos( rightscroeXyes, rightscroeYyes )
self.rightscroe:SetSize( rightcroeWyes, rightscroeHyes )
self.rightscroe:SetText("")
function self.rightscroe:Paint( w, h )
surface.SetFont( "DescTipFont" )
surface.SetTextColor(color_white)
surface.SetTextPos( enXyes, enYyes )
surface.DrawText( "Враг: "..self.enemyvalue)
end]]
end
function PANEL:addContinue()
local picran = {
"carts/6ch.png",
"carts/6k.png",
"carts/6p.png",
"carts/6r.png",
"carts/7ch.png",
"carts/7k.png",
"carts/7p.png",
"carts/7r.png",
"carts/8ch.png",
"carts/8k.png",
"carts/8p.png",
"carts/8r.png",
"carts/9ch.png",
"carts/9k.png",
"carts/9p.png",
"carts/9r.png",
"carts/10ch.png",
"carts/10k.png",
"carts/10p.png",
"carts/10r.png",
"carts/ach.png",
"carts/ak.png",
"carts/ap.png",
"carts/ar.png",
"carts/jch.png",
"carts/jk.png",
"carts/jp.png",
"carts/jr.png",
"carts/qch.png",
"carts/qk.png",
"carts/qp.png",
"carts/qr.png",
"carts/kch.png",
"carts/kk.png",
"carts/kp.png",
"carts/kr.png"
}
self.scrW, self.scrH = ScrW(), ScrH()
local but_startWyes, but_startHyes = self.scrW * 0.075, self.scrH * 0.036
local but_startXyes, but_startYyes = (self.scrW * 0.05) - (but_startWyes * 0.5), self.scrH * 0.505
self.but_starttwo = self:Add("DButton")
self.but_starttwo:SetText("Начать игру")
self.but_starttwo:SetColor(Color(169, 169, 169))
self.but_starttwo:SetFont("DescCharFont1")
self.but_starttwo:SetTextColor(color_white)
self.but_starttwo.DoClick = function(client)
self.vzat:SetDisabled( false )
self.perh:SetDisabled( false )
self.but_starttwo:SetDisabled( true )
if self.nextcard == 0 then
self.picwan:SetImage(table.Random(picran))
self.checkurpicwancart = self.picwan:GetImage()
if self.checkurpicwancart == "carts/6ch.png" or self.checkurpicwancart == "carts/6k.png" or self.checkurpicwancart == "carts/6p.png" or self.checkurpicwancart == "carts/6r.png" then
self.urvalue = self.urvalue + 6
elseif self.checkurpicwancart == "carts/7ch.png" or self.checkurpicwancart == "carts/7k.png" or self.checkurpicwancart == "carts/7p.png" or self.checkurpicwancart == "carts/7r.png" then
self.urvalue = self.urvalue + 7
elseif self.checkurpicwancart == "carts/8ch.png" or self.checkurpicwancart == "carts/8k.png" or self.checkurpicwancart == "carts/8p.png" or self.checkurpicwancart == "carts/8r.png" then
self.urvalue = self.urvalue + 8
elseif self.checkurpicwancart == "carts/9ch.png" or self.checkurpicwancart == "carts/9k.png" or self.checkurpicwancart == "carts/9p.png" or self.checkurpicwancart == "carts/9r.png" then
self.urvalue = self.urvalue + 9
elseif self.checkurpicwancart == "carts/10ch.png" or self.checkurpicwancart == "carts/10k.png" or self.checkurpicwancart == "carts/10p.png" or self.checkurpicwancart == "carts/10r.png" then
self.urvalue = self.urvalue + 10
elseif self.checkurpicwancart == "carts/ach.png" or self.checkurpicwancart == "carts/ak.png" or self.checkurpicwancart == "carts/ap.png" or self.checkurpicwancart == "carts/ar.png" then
self.urvalue = self.urvalue + 11
elseif self.checkurpicwancart == "carts/jch.png" or self.checkurpicwancart == "carts/jk.png" or self.checkurpicwancart == "carts/jp.png" or self.checkurpicwancart == "carts/jr.png" then
self.urvalue = self.urvalue + 2
elseif self.checkurpicwancart == "carts/qch.png" or self.checkurpicwancart == "carts/qk.png" or self.checkurpicwancart == "carts/qp.png" or self.checkurpicwancart == "carts/qr.png" then
self.urvalue = self.urvalue + 3
elseif self.checkurpicwancart == "carts/kch.png" or self.checkurpicwancart == "carts/kk.png" or self.checkurpicwancart == "carts/kp.png" or self.checkurpicwancart == "carts/kr.png" then
self.urvalue = self.urvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
self.pictwo:SetImage(table.Random(picran))
self.checkurpictwocart = self.pictwo:GetImage()
if self.checkurpictwocart == "carts/6ch.png" or self.checkurpictwocart == "carts/6k.png" or self.checkurpictwocart == "carts/6p.png" or self.checkurpictwocart == "carts/6r.png" then
self.urvalue = self.urvalue + 6
elseif self.checkurpictwocart == "carts/7ch.png" or self.checkurpictwocart == "carts/7k.png" or self.checkurpictwocart == "carts/7p.png" or self.checkurpictwocart == "carts/7r.png" then
self.urvalue = self.urvalue + 7
elseif self.checkurpictwocart == "carts/8ch.png" or self.checkurpictwocart == "carts/8k.png" or self.checkurpictwocart == "carts/8p.png" or self.checkurpictwocart == "carts/8r.png" then
self.urvalue = self.urvalue + 8
elseif self.checkurpictwocart == "carts/9ch.png" or self.checkurpictwocart == "carts/9k.png" or self.checkurpictwocart == "carts/9p.png" or self.checkurpictwocart == "carts/9r.png" then
self.urvalue = self.urvalue + 9
elseif self.checkurpictwocart == "carts/10ch.png" or self.checkurpictwocart == "carts/10k.png" or self.checkurpictwocart == "carts/10p.png" or self.checkurpictwocart == "carts/10r.png" then
self.urvalue = self.urvalue + 10
elseif self.checkurpictwocart == "carts/ach.png" or self.checkurpictwocart == "carts/ak.png" or self.checkurpictwocart == "carts/ap.png" or self.checkurpictwocart == "carts/ar.png" then
self.urvalue = self.urvalue + 11
elseif self.checkurpictwocart == "carts/jch.png" or self.checkurpictwocart == "carts/jk.png" or self.checkurpictwocart == "carts/jp.png" or self.checkurpictwocart == "carts/jr.png" then
self.urvalue = self.urvalue + 2
elseif self.checkurpictwocart == "carts/qch.png" or self.checkurpictwocart == "carts/qk.png" or self.checkurpictwocart == "carts/qp.png" or self.checkurpictwocart == "carts/qr.png" then
self.urvalue = self.urvalue + 3
elseif self.checkurpictwocart == "carts/kch.png" or self.checkurpictwocart == "carts/kk.png" or self.checkurpictwocart == "carts/kp.png" or self.checkurpictwocart == "carts/kr.png" then
self.urvalue = self.urvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
end
end
function self.but_starttwo:Paint( w, h )
if self:IsDown() then
local material = Material("carts/but_3k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:IsHovered() and !self:GetDisabled() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:GetDisabled() then
local material = Material("carts/but_1k.png")
surface.SetDrawColor(Color(169, 169, 169))
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:GetDisabled() and self:IsHovered() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(Color(169, 169, 169))
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
else
local material = Material("carts/but_1k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
end
self.but_starttwo:SetSize(but_startWyes, but_startHyes)
self.but_starttwo:SetPos(but_startXyes, but_startYyes)
local vzatWyes, vzatHyes = self.scrW * 0.075, self.scrH * 0.036
local vzatXyes, vzatYyes = (self.scrW * 0.135) - (vzatWyes * 0.5), self.scrH * 0.46
self.vzat = self:Add("DButton")
self.vzat:SetText("Взять еще")
self.vzat:SetColor(Color(169, 169, 169))
self.vzat:SetFont("DescCharFont1")
self.vzat:SetTextColor(color_white)
function self.vzat:Paint( w, h )
if self:IsDown() then
local material = Material("carts/but_3k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:IsHovered() and !self:GetDisabled() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:GetDisabled() then
local material = Material("carts/but_1k.png")
surface.SetDrawColor(Color(169, 169, 169))
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:GetDisabled() and self:IsHovered() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(Color(169, 169, 169))
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
else
local material = Material("carts/but_1k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
end
self.vzat:SetSize(vzatWyes, vzatHyes)
self.vzat:SetPos(vzatXyes, vzatYyes)
self.vzat:SetDisabled( true )
self.vzat.DoClick = function(client)
if self.nextcard == 0 then
self.nextcard = self.nextcard + 1
self.pictree:SetImage(table.Random(picran))
self.checkurpictreecart = self.pictree:GetImage()
if self.checkurpictreecart == "carts/6ch.png" or self.checkurpictreecart == "carts/6k.png" or self.checkurpictreecart == "carts/6p.png" or self.checkurpictreecart == "carts/6r.png" then
self.urvalue = self.urvalue + 6
elseif self.checkurpictreecart == "carts/7ch.png" or self.checkurpictreecart == "carts/7k.png" or self.checkurpictreecart == "carts/7p.png" or self.checkurpictreecart == "carts/7r.png" then
self.urvalue = self.urvalue + 7
elseif self.checkurpictreecart == "carts/8ch.png" or self.checkurpictreecart == "carts/8k.png" or self.checkurpictreecart == "carts/8p.png" or self.checkurpictreecart == "carts/8r.png" then
self.urvalue = self.urvalue + 8
elseif self.checkurpictreecart == "carts/9ch.png" or self.checkurpictreecart == "carts/9k.png" or self.checkurpictreecart == "carts/9p.png" or self.checkurpictreecart == "carts/9r.png" then
self.urvalue = self.urvalue + 9
elseif self.checkurpictreecart == "carts/10ch.png" or self.checkurpictreecart == "carts/10k.png" or self.checkurpictreecart == "carts/10p.png" or self.checkurpictreecart == "carts/10r.png" then
self.urvalue = self.urvalue + 10
elseif self.checkurpictreecart == "carts/ach.png" or self.checkurpictreecart == "carts/ak.png" or self.checkurpictreecart == "carts/ap.png" or self.checkurpictreecart == "carts/ar.png" then
self.urvalue = self.urvalue + 11
elseif self.checkurpictreecart == "carts/jch.png" or self.checkurpictreecart == "carts/jk.png" or self.checkurpictreecart == "carts/jp.png" or self.checkurpictreecart == "carts/jr.png" then
self.urvalue = self.urvalue + 2
elseif self.checkurpictreecart == "carts/qch.png" or self.checkurpictreecart == "carts/qk.png" or self.checkurpictreecart == "carts/qp.png" or self.checkurpictreecart == "carts/qr.png" then
self.urvalue = self.urvalue + 3
elseif self.checkurpictreecart == "carts/kch.png" or self.checkurpictreecart == "carts/kk.png" or self.checkurpictreecart == "carts/kp.png" or self.checkurpictreecart == "carts/kr.png" then
self.urvalue = self.urvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
elseif self.nextcard == 1 then
self.nextcard = self.nextcard + 1
self.picfor:SetImage(table.Random(picran))
self.checkurpicforcart = self.picfor:GetImage()
if self.checkurpicforcart == "carts/6ch.png" or self.checkurpicforcart == "carts/6k.png" or self.checkurpicforcart == "carts/6p.png" or self.checkurpicforcart == "carts/6r.png" then
self.urvalue = self.urvalue + 6
elseif self.checkurpicforcart == "carts/7ch.png" or self.checkurpicforcart == "carts/7k.png" or self.checkurpicforcart == "carts/7p.png" or self.checkurpicforcart == "carts/7r.png" then
self.urvalue = self.urvalue + 7
elseif self.checkurpicforcart == "carts/8ch.png" or self.checkurpicforcart == "carts/8k.png" or self.checkurpicforcart == "carts/8p.png" or self.checkurpicforcart == "carts/8r.png" then
self.urvalue = self.urvalue + 8
elseif self.checkurpicforcart == "carts/9ch.png" or self.checkurpicforcart == "carts/9k.png" or self.checkurpicforcart == "carts/9p.png" or self.checkurpicforcart == "carts/9r.png" then
self.urvalue = self.urvalue + 9
elseif self.checkurpicforcart == "carts/10ch.png" or self.checkurpicforcart == "carts/10k.png" or self.checkurpicforcart == "carts/10p.png" or self.checkurpicforcart == "carts/10r.png" then
self.urvalue = self.urvalue + 10
elseif self.checkurpicforcart == "carts/ach.png" or self.checkurpicforcart == "carts/ak.png" or self.checkurpicforcart == "carts/ap.png" or self.checkurpicforcart == "carts/ar.png" then
self.urvalue = self.urvalue + 11
elseif self.checkurpicforcart == "carts/jch.png" or self.checkurpicforcart == "carts/jk.png" or self.checkurpicforcart == "carts/jp.png" or self.checkurpicforcart == "carts/jr.png" then
self.urvalue = self.urvalue + 2
elseif self.checkurpicforcart == "carts/qch.png" or self.checkurpicforcart == "carts/qk.png" or self.checkurpicforcart == "carts/qp.png" or self.checkurpicforcart == "carts/qr.png" then
self.urvalue = self.urvalue + 3
elseif self.checkurpicforcart == "carts/kch.png" or self.checkurpicforcart == "carts/kk.png" or self.checkurpicforcart == "carts/kp.png" or self.checkurpicforcart == "carts/kr.png" then
self.urvalue = self.urvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
elseif self.nextcard == 2 then
self.nextcard = self.nextcard + 1
self.picfive:SetImage(table.Random(picran))
self.checkurpicfivecart = self.picfive:GetImage()
if self.checkurpicfivecart == "carts/6ch.png" or self.checkurpicfivecart == "carts/6k.png" or self.checkurpicfivecart == "carts/6p.png" or self.checkurpicfivecart == "carts/6r.png" then
self.urvalue = self.urvalue + 6
elseif self.checkurpicfivecart == "carts/7ch.png" or self.checkurpicfivecart == "carts/7k.png" or self.checkurpicfivecart == "carts/7p.png" or self.checkurpicfivecart == "carts/7r.png" then
self.urvalue = self.urvalue + 7
elseif self.checkurpicfivecart == "carts/8ch.png" or self.checkurpicfivecart == "carts/8k.png" or self.checkurpicfivecart == "carts/8p.png" or self.checkurpicfivecart == "carts/8r.png" then
self.urvalue = self.urvalue + 8
elseif self.checkurpicfivecart == "carts/9ch.png" or self.checkurpicfivecart == "carts/9k.png" or self.checkurpicfivecart == "carts/9p.png" or self.checkurpicfivecart == "carts/9r.png" then
self.urvalue = self.urvalue + 9
elseif self.checkurpicfivecart == "carts/10ch.png" or self.checkurpicfivecart == "carts/10k.png" or self.checkurpicfivecart == "carts/10p.png" or self.checkurpicfivecart == "carts/10r.png" then
self.urvalue = self.urvalue + 10
elseif self.checkurpicfivecart == "carts/ach.png" or self.checkurpicfivecart == "carts/ak.png" or self.checkurpicfivecart == "carts/ap.png" or self.checkurpicfivecart == "carts/ar.png" then
self.urvalue = self.urvalue + 11
elseif self.checkurpicfivecart == "carts/jch.png" or self.checkurpicfivecart == "carts/jk.png" or self.checkurpicfivecart == "carts/jp.png" or self.checkurpicfivecart == "carts/jr.png" then
self.urvalue = self.urvalue + 2
elseif self.checkurpicfivecart == "carts/qch.png" or self.checkurpicfivecart == "carts/qk.png" or self.checkurpicfivecart == "carts/qp.png" or self.checkurpicfivecart == "carts/qr.png" then
self.urvalue = self.urvalue + 3
elseif self.checkurpicfivecart == "carts/kch.png" or self.checkurpicfivecart == "carts/kk.png" or self.checkurpicfivecart == "carts/kp.png" or self.checkurpicfivecart == "carts/kr.png" then
self.urvalue = self.urvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
end
end
local perhWyes, perhHyes = self.scrW * 0.075, self.scrH * 0.036
local perhXyes, perhYyes = (self.scrW * 0.215) - (perhWyes * 0.5), self.scrH * 0.46
self.perh = self:Add("DButton")
self.perh:SetText("Передать ход")
self.perh:SetColor(Color(169, 169, 169))
self.perh:SetFont("DescCharFont1")
self.perh:SetTextColor(color_white)
local enemyWyes, enemyHyes = self.scrW * 0.2, self.scrH * 0.02
local enemyXyes, enemyYyes = (self.scrW * 0.215) - (enemyWyes * 0.5), self.scrH * 0.42
function self.perh:Paint( w, h )
if self:IsDown() then
local material = Material("carts/but_3k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:IsHovered() and !self:GetDisabled() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:GetDisabled() then
local material = Material("carts/but_1k.png")
surface.SetDrawColor(Color(169, 169, 169))
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:GetDisabled() and self:IsHovered() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(Color(169, 169, 169))
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
else
local material = Material("carts/but_1k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
end
self.nextcardbot = 0
self.perh:SetSize(perhWyes, perhHyes)
self.perh:SetPos(perhXyes, perhYyes)
self.perh:SetDisabled( true )
self.perh.DoClick = function(client)
self.perh:SetDisabled( true )
self.vzat:SetDisabled( true )
self.but_starttwo:Remove()
self:addContinue2()
if self.nextcardbot == 0 then
self.nextcardbot = self.nextcardbot + 1
self.picsix:SetImage(table.Random(picran))
self.checkurpicsixcart = self.picsix:GetImage()
if self.checkurpicsixcart == "carts/6ch.png" or self.checkurpicsixcart == "carts/6k.png" or self.checkurpicsixcart == "carts/6p.png" or self.checkurpicsixcart == "carts/6r.png" then
self.enemyvalue = self.enemyvalue + 6
elseif self.checkurpicsixcart == "carts/7ch.png" or self.checkurpicsixcart == "carts/7k.png" or self.checkurpicsixcart == "carts/7p.png" or self.checkurpicsixcart == "carts/7r.png" then
self.enemyvalue = self.enemyvalue + 7
elseif self.checkurpicsixcart == "carts/8ch.png" or self.checkurpicsixcart == "carts/8k.png" or self.checkurpicsixcart == "carts/8p.png" or self.checkurpicsixcart == "carts/8r.png" then
self.enemyvalue = self.enemyvalue + 8
elseif self.checkurpicsixcart == "carts/9ch.png" or self.checkurpicsixcart == "carts/9k.png" or self.checkurpicsixcart == "carts/9p.png" or self.checkurpicsixcart == "carts/9r.png" then
self.enemyvalue = self.enemyvalue + 9
elseif self.checkurpicsixcart == "carts/10ch.png" or self.checkurpicsixcart == "carts/10k.png" or self.checkurpicsixcart == "carts/10p.png" or self.checkurpicsixcart == "carts/10r.png" then
self.enemyvalue = self.enemyvalue + 10
elseif self.checkurpicsixcart == "carts/ach.png" or self.checkurpicsixcart == "carts/ak.png" or self.checkurpicsixcart == "carts/ap.png" or self.checkurpicsixcart == "carts/ar.png" then
self.enemyvalue = self.enemyvalue + 11
elseif self.checkurpicsixcart == "carts/jch.png" or self.checkurpicsixcart == "carts/jk.png" or self.checkurpicsixcart == "carts/jp.png" or self.checkurpicsixcart == "carts/jr.png" then
self.enemyvalue = self.enemyvalue + 2
elseif self.checkurpicsixcart == "carts/qch.png" or self.checkurpicsixcart == "carts/qk.png" or self.checkurpicsixcart == "carts/qp.png" or self.checkurpicsixcart == "carts/qr.png" then
self.enemyvalue = self.enemyvalue + 3
elseif self.checkurpicsixcart == "carts/kch.png" or self.checkurpicsixcart == "carts/kk.png" or self.checkurpicsixcart == "carts/kp.png" or self.checkurpicsixcart == "carts/kr.png" then
self.enemyvalue = self.enemyvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
self.picseven:SetImage(table.Random(picran))
self.checkurpicsevencart = self.picseven:GetImage()
if self.checkurpicsevencart == "carts/6ch.png" or self.checkurpicsevencart == "carts/6k.png" or self.checkurpicsevencart == "carts/6p.png" or self.checkurpicsevencart == "carts/6r.png" then
self.enemyvalue = self.enemyvalue + 6
elseif self.checkurpicsevencart == "carts/7ch.png" or self.checkurpicsevencart == "carts/7k.png" or self.checkurpicsevencart == "carts/7p.png" or self.checkurpicsevencart == "carts/7r.png" then
self.enemyvalue = self.enemyvalue + 7
elseif self.checkurpicsevencart == "carts/8ch.png" or self.checkurpicsevencart == "carts/8k.png" or self.checkurpicsevencart == "carts/8p.png" or self.checkurpicsevencart == "carts/8r.png" then
self.enemyvalue = self.enemyvalue + 8
elseif self.checkurpicsevencart == "carts/9ch.png" or self.checkurpicsevencart == "carts/9k.png" or self.checkurpicsevencart == "carts/9p.png" or self.checkurpicsevencart == "carts/9r.png" then
self.enemyvalue = self.enemyvalue + 9
elseif self.checkurpicsevencart == "carts/10ch.png" or self.checkurpicsevencart == "carts/10k.png" or self.checkurpicsevencart == "carts/10p.png" or self.checkurpicsevencart == "carts/10r.png" then
self.enemyvalue = self.enemyvalue + 10
elseif self.checkurpicsevencart == "carts/ach.png" or self.checkurpicsevencart == "carts/ak.png" or self.checkurpicsevencart == "carts/ap.png" or self.checkurpicsevencart == "carts/ar.png" then
self.enemyvalue = self.enemyvalue + 11
elseif self.checkurpicsevencart == "carts/jch.png" or self.checkurpicsevencart == "carts/jk.png" or self.checkurpicsevencart == "carts/jp.png" or self.checkurpicsevencart == "carts/jr.png" then
self.enemyvalue = self.enemyvalue + 2
elseif self.checkurpicsevencart == "carts/qch.png" or self.checkurpicsevencart == "carts/qk.png" or self.checkurpicsevencart == "carts/qp.png" or self.checkurpicsevencart == "carts/qr.png" then
self.enemyvalue = self.enemyvalue + 3
elseif self.checkurpicsevencart == "carts/kch.png" or self.checkurpicsevencart == "carts/kk.png" or self.checkurpicsevencart == "carts/kp.png" or self.checkurpicsevencart == "carts/kr.png" then
self.enemyvalue = self.enemyvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
end
if self.nextcardbot == 1 and self.enemyvalue < 17 then
self.nextcardbot = self.nextcardbot + 1
self.piceght:SetImage(table.Random(picran))
self.checkurpiceghtcart = self.piceght:GetImage()
if self.checkurpiceghtcart == "carts/6ch.png" or self.checkurpiceghtcart == "carts/6k.png" or self.checkurpiceghtcart == "carts/6p.png" or self.checkurpiceghtcart == "carts/6r.png" then
self.enemyvalue = self.enemyvalue + 6
elseif self.checkurpiceghtcart == "carts/7ch.png" or self.checkurpiceghtcart == "carts/7k.png" or self.checkurpiceghtcart == "carts/7p.png" or self.checkurpiceghtcart == "carts/7r.png" then
self.enemyvalue = self.enemyvalue + 7
elseif self.checkurpiceghtcart == "carts/8ch.png" or self.checkurpiceghtcart == "carts/8k.png" or self.checkurpiceghtcart == "carts/8p.png" or self.checkurpiceghtcart == "carts/8r.png" then
self.enemyvalue = self.enemyvalue + 8
elseif self.checkurpiceghtcart == "carts/9ch.png" or self.checkurpiceghtcart == "carts/9k.png" or self.checkurpiceghtcart == "carts/9p.png" or self.checkurpiceghtcart == "carts/9r.png" then
self.enemyvalue = self.enemyvalue + 9
elseif self.checkurpiceghtcart == "carts/10ch.png" or self.checkurpiceghtcart == "carts/10k.png" or self.checkurpiceghtcart == "carts/10p.png" or self.checkurpiceghtcart == "carts/10r.png" then
self.enemyvalue = self.enemyvalue + 10
elseif self.checkurpiceghtcart == "carts/ach.png" or self.checkurpiceghtcart == "carts/ak.png" or self.checkurpiceghtcart == "carts/ap.png" or self.checkurpiceghtcart == "carts/ar.png" then
self.enemyvalue = self.enemyvalue + 11
elseif self.checkurpiceghtcart == "carts/jch.png" or self.checkurpiceghtcart == "carts/jk.png" or self.checkurpiceghtcart == "carts/jp.png" or self.checkurpiceghtcart == "carts/jr.png" then
self.enemyvalue = self.enemyvalue + 2
elseif self.checkurpiceghtcart == "carts/qch.png" or self.checkurpiceghtcart == "carts/qk.png" or self.checkurpiceghtcart == "carts/qp.png" or self.checkurpiceghtcart == "carts/qr.png" then
self.enemyvalue = self.enemyvalue + 3
elseif self.checkurpiceghtcart == "carts/kch.png" or self.checkurpiceghtcart == "carts/kk.png" or self.checkurpiceghtcart == "carts/kp.png" or self.checkurpiceghtcart == "carts/kr.png" then
self.enemyvalue = self.enemyvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
end
local chance1 = math.random(1, 2)
if (self.nextcardbot == 2 and self.enemyvalue < 19 and self.enemyvalue > 18 and chance1 == 1) or (self.nextcardbot == 2 and self.enemyvalue < 17) then
self.nextcardbot = self.nextcardbot + 1
self.picnine:SetImage(table.Random(picran))
self.checkurpicninetcart = self.picnine:GetImage()
if self.checkurpicninetcart == "carts/6ch.png" or self.checkurpicninetcart == "carts/6k.png" or self.checkurpicninetcart == "carts/6p.png" or self.checkurpicninetcart == "carts/6r.png" then
self.enemyvalue = self.enemyvalue + 6
elseif self.checkurpicninetcart == "carts/7ch.png" or self.checkurpicninetcart == "carts/7k.png" or self.checkurpicninetcart == "carts/7p.png" or self.checkurpicninetcart == "carts/7r.png" then
self.enemyvalue = self.enemyvalue + 7
elseif self.checkurpicninetcart == "carts/8ch.png" or self.checkurpicninetcart == "carts/8k.png" or self.checkurpicninetcart == "carts/8p.png" or self.checkurpicninetcart == "carts/8r.png" then
self.enemyvalue = self.enemyvalue + 8
elseif self.checkurpicninetcart == "carts/9ch.png" or self.checkurpicninetcart == "carts/9k.png" or self.checkurpicninetcart == "carts/9p.png" or self.checkurpicninetcart == "carts/9r.png" then
self.enemyvalue = self.enemyvalue + 9
elseif self.checkurpicninetcart == "carts/10ch.png" or self.checkurpicninetcart == "carts/10k.png" or self.checkurpicninetcart == "carts/10p.png" or self.checkurpicninetcart == "carts/10r.png" then
self.enemyvalue = self.enemyvalue + 10
elseif self.checkurpicninetcart == "carts/ach.png" or self.checkurpicninetcart == "carts/ak.png" or self.checkurpicninetcart == "carts/ap.png" or self.checkurpicninetcart == "carts/ar.png" then
self.enemyvalue = self.enemyvalue + 11
elseif self.checkurpicninetcart == "carts/jch.png" or self.checkurpicninetcart == "carts/jk.png" or self.checkurpicninetcart == "carts/jp.png" or self.checkurpicninetcart == "carts/jr.png" then
self.enemyvalue = self.enemyvalue + 2
elseif self.checkurpicninetcart == "carts/qch.png" or self.checkurpicninetcart == "carts/qk.png" or self.checkurpicninetcart == "carts/qp.png" or self.checkurpicninetcart == "carts/qr.png" then
self.enemyvalue = self.enemyvalue + 3
elseif self.checkurpicninetcart == "carts/kch.png" or self.checkurpicninetcart == "carts/kk.png" or self.checkurpicninetcart == "carts/kp.png" or self.checkurpicninetcart == "carts/kr.png" then
self.enemyvalue = self.enemyvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
end
local chance = math.random(1, 2)
if (self.nextcardbot == 2 and self.enemyvalue < 19 and self.enemyvalue > 18 and chance == 1) or (self.nextcardbot == 2 and self.enemyvalue < 17) then
self.nextcardbot = self.nextcardbot + 1
self.picten:SetImage(table.Random(picran))
self.checkurpicpictentcart = self.picten:GetImage()
if self.checkurpicpictentcart == "carts/6ch.png" or self.checkurpicpictentcart == "carts/6k.png" or self.checkurpicpictentcart == "carts/6p.png" or self.checkurpicpictentcart == "carts/6r.png" then
self.enemyvalue = self.enemyvalue + 6
elseif self.checkurpicpictentcart == "carts/7ch.png" or self.checkurpicpictentcart == "carts/7k.png" or self.checkurpicpictentcart == "carts/7p.png" or self.checkurpicpictentcart == "carts/7r.png" then
self.enemyvalue = self.enemyvalue + 7
elseif self.checkurpicpictentcart == "carts/8ch.png" or self.checkurpicpictentcart == "carts/8k.png" or self.checkurpicpictentcart == "carts/8p.png" or self.checkurpicpictentcart == "carts/8r.png" then
self.enemyvalue = self.enemyvalue + 8
elseif self.checkurpicpictentcart == "carts/9ch.png" or self.checkurpicpictentcart == "carts/9k.png" or self.checkurpicpictentcart == "carts/9p.png" or self.checkurpicpictentcart == "carts/9r.png" then
self.enemyvalue = self.enemyvalue + 9
elseif self.checkurpicpictentcart == "carts/10ch.png" or self.checkurpicpictentcart == "carts/10k.png" or self.checkurpicpictentcart == "carts/10p.png" or self.checkurpicpictentcart == "carts/10r.png" then
self.enemyvalue = self.enemyvalue + 10
elseif self.checkurpicpictentcart == "carts/ach.png" or self.checkurpicpictentcart == "carts/ak.png" or self.checkurpicpictentcart == "carts/ap.png" or self.checkurpicpictentcart == "carts/ar.png" then
self.enemyvalue = self.enemyvalue + 11
elseif self.checkurpicpictentcart == "carts/jch.png" or self.checkurpicpictentcart == "carts/jk.png" or self.checkurpicpictentcart == "carts/jp.png" or self.checkurpicpictentcart == "carts/jr.png" then
self.enemyvalue = self.enemyvalue + 2
elseif self.checkurpicpictentcart == "carts/qch.png" or self.checkurpicpictentcart == "carts/qk.png" or self.checkurpicpictentcart == "carts/qp.png" or self.checkurpicpictentcart == "carts/qr.png" then
self.enemyvalue = self.enemyvalue + 3
elseif self.checkurpicpictentcart == "carts/kch.png" or self.checkurpicpictentcart == "carts/kk.png" or self.checkurpicpictentcart == "carts/kp.png" or self.checkurpicpictentcart == "carts/kr.png" then
self.enemyvalue = self.enemyvalue + 4
else
LocalPlayer():ConCommand("say Тестинг Ты долбаеб что это такое")
end
end
end
end
function PANEL:addContinue2()
self.scrW, self.scrH = ScrW(), ScrH()
local but_start1Wyes, but_start1Hyes = self.scrW * 0.075, self.scrH * 0.036
local but_start1Xyes, but_start1Yyes = (self.scrW * 0.05) - (but_start1Wyes * 0.5), self.scrH * 0.505
self.but_go_next = self:Add("DButton")
self.but_go_next:SetText("Продолжить")
self.but_go_next:SetColor(Color(169, 169, 169))
self.but_go_next:SetFont("DescCharFont1")
self.but_go_next:SetTextColor(color_white)
function self.but_go_next:Paint( w, h )
if self:IsDown() then
local material = Material("carts/but_3k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:IsHovered() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
else
local material = Material("carts/but_1k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
end
self.but_go_next:SetSize(but_start1Wyes, but_start1Hyes)
self.but_go_next:SetPos(but_start1Xyes, but_start1Yyes)
self.but_go_next.DoClick = function(client)
self.but_exit:SetDisabled( false )
local gobutnext = vgui.Create("DFrame")
gobutnext:SetTall(34)
gobutnext:SetSize(ScrW() * 0.4, ScrH() * 0.25)
gobutnext:Center()
gobutnext:MakePopup()
gobutnext:ShowCloseButton( false )
gobutnext:SetDraggable( false )
gobutnext:SetTitle("")
function gobutnext:Paint( w, h )
local material = Material("carts/ui_mod_cards322.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
local wintextWyes, wintextHyes = self.scrW * 0.45, self.scrH * 0.02
local wintextXyes, wintextYyes = (self.scrW * 0.241) - (wintextWyes * 0.5), self.scrH * 0.09
local friendtextXyes, friendtextYyes = self.scrW * 0.45, self.scrH * 0.02
local friendtextWyes, friendtextHyes = (self.scrW * 0.311) - (friendtextXyes * 0.5), self.scrH * 0.09
blyad_label = gobutnext:Add("DLabel")
blyad_label.Think = function()
if self.w_and_lose == 1 then
blyad_label:SetText("Вы выиграли. Ваш выигрыш составил - "..self.total.." рублей. Сумма очков: вы - "..self.urvalue..", противник - "..self.enemyvalue..".")
blyad_label:SetPos( wintextXyes, wintextYyes )
blyad_label:SetSize( wintextWyes, wintextHyes )
elseif self.w_and_lose == 3 then
blyad_label:SetText("Вы проиграли. Ваш проигрыш составил - "..self.total.." рублей. Сумма очков: вы - "..self.urvalue..", противник - "..self.enemyvalue..".")
blyad_label:SetPos( wintextXyes, wintextYyes )
blyad_label:SetSize( wintextWyes, wintextHyes )
elseif self.w_and_lose == 2 then
blyad_label:SetText("Победила друбжа! Сумма очков: вы - "..self.urvalue..", противник - "..self.enemyvalue..".")
blyad_label:SetPos( friendtextWyes, friendtextHyes )
blyad_label:SetSize( friendtextXyes, friendtextYyes )
else
blyad_label:SetText("Ты долбаеб это что такое")
end
end
blyad_label:SetFont("DescCharFont1")
local but_exit1Wyes, but_exit1Hyes = self.scrW * 0.075, self.scrH * 0.036
local but_exit1Xyes, but_exit1Yyes = (self.scrW * 0.198) - (but_exit1Wyes * 0.5), self.scrH * 0.207
but_exit1 = gobutnext:Add("DButton")
but_exit1:SetText("ОК")
but_exit1:SetColor(Color(169, 169, 169))
but_exit1:SetFont("DescCharFont1")
but_exit1:SetTextColor(color_white)
function but_exit1:Paint( w, h )
if self:IsDown() then
local material = Material("carts/but_3k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
elseif self:IsHovered() and !self:GetDisabled() then
local material = Material("carts/but_2k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
else
local material = Material("carts/but_1k.png")
surface.SetDrawColor(color_white)
surface.SetMaterial(material)
surface.DrawTexturedRect(0, 0, w, h)
end
end
but_exit1:SetSize(but_exit1Wyes, but_exit1Hyes)
but_exit1:SetPos(but_exit1Xyes, but_exit1Yyes)
but_exit1.DoClick = function(client)
gobutnext:Close()
self:Close()
local restarturpanel = vgui.Create("21o4ko")
end
if (self.urvalue > self.enemyvalue and self.urvalue < 22 and self.enemyvalue < 22) or
(self.urvalue == 21 and !self.enemyvalue == 21) or
(self.urvalue == 22 and self.enemyvalue == 19) or
--(self.urvalue == 23 and self.enemyvalue == 18) or
(self.urvalue == 24 and self.enemyvalue == 17) or
(self.urvalue == 25 and self.enemyvalue == 16) or
(self.urvalue == 26 and self.enemyvalue == 15) or
(self.urvalue == 22 and self.enemyvalue == 23) or
(self.urvalue == 23 and self.enemyvalue == 24) or
(self.urvalue == 24 and self.enemyvalue == 25) or
(self.urvalue == 25 and self.enemyvalue == 26) or
(self.urvalue == 26 and self.enemyvalue == 27) or
(self.urvalue == 27 and self.enemyvalue == 28) or
(self.urvalue == 28 and self.enemyvalue == 29) or
(self.urvalue == 29 and self.enemyvalue == 30) or
(self.urvalue == 30 and self.enemyvalue == 31) or
(self.urvalue == 20 and self.enemyvalue > 22) or
(self.urvalue == 21 and self.enemyvalue > 21) or
(self.urvalue == 19 and self.enemyvalue > 22) or
(self.urvalue == 18 and self.enemyvalue > 23) or
(self.urvalue == 17 and self.enemyvalue > 24) or
(self.urvalue == 16 and self.enemyvalue > 25) or
(self.urvalue == 15 and self.enemyvalue > 26) or
(self.urvalue == 31 and self.enemyvalue == 32) or
(self.urvalue == 22 and self.enemyvalue == 24) or
(self.urvalue == 20 and self.enemyvalue == 22) or
(self.urvalue == 18 and self.enemyvalue == 22) then
--LocalPlayer():ConCommand("say Тестинг! ты выйграл")
self.w_and_lose = self.w_and_lose + 1 --вин
netstream.Start("give_my_money", self.total)
elseif (self.urvalue == self.enemyvalue) or
(self.urvalue == 20 and self.enemyvalue == 22) or
(self.urvalue == 19 and self.enemyvalue == 23) or
(self.urvalue == 18 and self.enemyvalue == 24) or
(self.urvalue == 17 and self.enemyvalue == 25) or
(self.urvalue == 16 and self.enemyvalue == 26) or
(self.urvalue == 22 and self.enemyvalue == 20) or
(self.urvalue == 23 and self.enemyvalue == 19) or
(self.urvalue == 24 and self.enemyvalue == 18) or
(self.urvalue == 25 and self.enemyvalue == 17) or
(self.urvalue == 26 and self.enemyvalue == 16) then
--LocalPlayer():ConCommand("say Тестинг! победила дружба")
self.w_and_lose = self.w_and_lose + 2 --ничья
netstream.Start("win_4_friend", self.total)
elseif (self.urvalue < self.enemyvalue and self.urvalue < 22 and self.enemyvalue < 22) then
--LocalPlayer():ConCommand("say Тестинг! ето проеб")
self.w_and_lose = self.w_and_lose + 3 --луз
else
--LocalPlayer():ConCommand("say Тестинг! ето проеб")
self.w_and_lose = self.w_and_lose + 3 --луз
end
end
end
vgui.Register("21o4ko", PANEL, "DFrame")
netstream.Hook("21o4ko", function()
two4ko = vgui.Create("21o4ko")
end) |
--機巧蛙-磐盾多邇具久
--
--Script by XyleN5967
function c101105017.initial_effect(c)
--to deck top
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(101105017,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,101105017)
e1:SetTarget(c101105017.tdtg)
e1:SetOperation(c101105017.tdop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--revive
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(101105017,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1,101105017+100)
e3:SetCost(aux.bfgcost)
e3:SetTarget(c101105017.sptg)
e3:SetOperation(c101105017.spop)
c:RegisterEffect(e3)
end
if Auxiliary.AtkEqualsDef==nil then
function Auxiliary.AtkEqualsDef(c)
if not c:IsType(TYPE_MONSTER) or c:IsType(TYPE_LINK) then return false end
if c:GetAttack()~=c:GetDefense() then return false end
return c:IsLocation(LOCATION_MZONE) or c:GetTextAttack()>=0 and c:GetTextDefense()>=0
end
end
function c101105017.tdfilter(c)
return aux.AtkEqualsDef(c) and c:IsRace(RACE_MACHINE)
end
function c101105017.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c101105017.tdfilter,tp,LOCATION_DECK,0,1,nil)
and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>1 end
end
function c101105017.tdop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(101105017,2))
local g=Duel.SelectMatchingCard(tp,c101105017.tdfilter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
Duel.ConfirmDecktop(tp,1)
end
end
function c101105017.spfilter(c,e,tp)
return c:IsRace(RACE_MACHINE) and aux.AtkEqualsDef(c)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c101105017.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c101105017.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c101105017.spfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c101105017.spfilter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler(),e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c101105017.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
end
|
-- =============================================================================
-- DeAnonymize DICOM tags
-- Author: Marcel van Herk
-- 20130125 mvh Created
-- 20130211 mvh Take out invalid characters for filenames
-- 20130522 mvh Cleanup for release
-- 20130718 mvh Moved log folder
-- 20130802 mvh Detect if patientID cannot be deanonymized
-- 20140309 mvh Protect against any missing data
-- 20160113 mvh Added staged operation using "stage" command_line
-- 20200127 mvh Allow stage *: pick stage based on actual patientID; reject on error
-- 20200202 mvh * in command line sets 9999,9000 with orginal patient ID
-- 20200302 mvh Fix DirSep for linux, add Global.basedir
-- 20200308 mvh Used wrong quotes in stage * code; postgresql tripped over it
-- case of UIDMODS; mariadb tripped over it
-- 20201003 mvh Fix crash when trying to deanonymize birthdate, name and sex if not there
-- =============================================================================
--[[ To test; r-click evaluate in console after project-run:
readdicom('0009703828:1.3.46.670589.5.2.10.2156913941.892665340.475317')
Data.Dump('c:\\data\\image_in.txt')
dofile('lua/anonymize_script.lua')
Data.Dump('c:\\data\\image_anonymized.txt')
dofile('lua/deanonymize_script.lua')
Data.Dump('c:\\data\\image_restored.txt')
]]
local scriptversion = "1.3; date 20200127"
local DirSep = '/'
if string.find(Global.BaseDir, '\\') then DirSep = '\\' end
local pre, pid = Data.PatientID
if Data.PatientID~='' then
if command_line=='*' then
local r=dbquery("UIDMODS","distinct stage","newUID='"..Data.PatientID.."'")
if r==nil then
print('** sql error **')
reject()
return
end
if r[1]==null then
print('** patient '..pre..' was not anonymized on this system stage(*) **')
reject()
return
end
command_line=r[1][1]
Data["9999,9000"]=Data.PatientID
end
pid = changeuidback(pre, command_line)
if pid==nil then
print('** patient '..pre..' was not anonymized on this system stage('..command_line..') **')
reject()
return
end
end
-- remove characters that are not allowed in a filename
local pid2 = string.gsub(pid, '[\\/:*?"<>|]', '_')
-- Log file handling (trailing backslash required for mkdir)
local logdir = Global.basedir.."DicomAnonymized_Log"..DirSep..pid2..DirSep;
local logfile = pid2..'_'..(Data.StudyDate or '19700101')..'_'..(Data.Modality or 'UN')..'_'..(Data.SOPInstanceUID or 'unknown')..'.deanonymize.log'
script('mkdir '..logdir);
f = io.open(logdir .. logfile, "wt");
f:write("DicomDeAnonymize.lua script version: ", scriptversion, "\n")
f:write("Logfile name : ", logfile, "\n")
f:write("Logfile created : ", os.date(), "\n")
-- modify and log modified object
f:write("===== MODIFIED DICOM DATA =====\n");
if command_line then
script('olduids stage ' .. command_line)
else
script('olduids')
end
f:write("Restoring UIDs\n")
if Data.PatientID~='' then
Data.PatientID = changeuidback(pre, command_line)
f:write('Restored patient ID to: ', Data.PatientID, '\n');
end
if true then
local s= changeuidback(pre..'.bd.'..Data.PatientBirthDate, command_line)
if s then
Data.PatientBirthDate = string.sub(s, string.find(s, '%.', -10)+1);
f:write('Restored patient birthdate to: ', tostring(Data.PatientBirthDate), "\n");
end
end
if Data.PatientName~='' then
local s = changeuidback(Data.PatientName, command_line)
if s then
Data.PatientName = s;
f:write('DeAnonymized PatientName to: ', Data.PatientName, "\n")
end
end
if (Data.PatientSex=='') then
local s = changeuidback(pre .. '.ps.' .. Data.PatientSex, command_line)
if s then
Data.PatientSex = string.sub(s, string.find(s, '%.', -3)+1);
f:write('Restored patient sex to: ', tostring(Data.PatientSex), "\n");
end
end
f:close();
|
local Hack = {
nId = 20170108,
strName = "AH Go to Page",
strDescription = "Adds a way to go to a specific page in the AH search results",
strXmlDocName = "AhGoToPage.xml",
tSave = nil,
}
function Hack:Initialize()
self.addonMarketplaceAuction = Apollo.GetAddon("MarketplaceAuction")
if not self.addonMarketplaceAuction then return false end
local funcOriginal = self.addonMarketplaceAuction.OnItemAuctionSearchResults
self.addonMarketplaceAuction.OnItemAuctionSearchResults = function(...)
funcOriginal(...)
if self.bIsLoaded then
self:InsertGoToPage()
end
end
return true
end
function Hack:Load()
end
function Hack:InsertGoToPage()
if not self.addonMarketplaceAuction.wndMain then return end
local wndToModify = self.addonMarketplaceAuction.wndMain
local arrWindows = {
"BuyContainer",
"SearchResultList",
"BuyPageBtnContainer",
}
for idx, strWindow in ipairs(arrWindows) do
wndToModify = wndToModify:FindChild(strWindow)
if not wndToModify then return end
end
local wndGoToPage = Apollo.LoadForm(self.xmlDoc, "GoToPage", wndToModify, self)
wndGoToPage:FindChild("PageNumber"):SetText(tostring(self.addonMarketplaceAuction.nCurPage + 1))
end
function Hack:OnGoTo(wndHandler, wndControl)
local nMaxPage = math.floor(self.addonMarketplaceAuction.nTotalResults / MarketplaceLib.kAuctionSearchPageSize)
local wndPage = wndControl:GetParent():FindChild("PageNumber")
local nPage = tonumber(wndPage:GetText()) - 1
if nPage < 0 then nPage = 0 end
if nPage > nMaxPage then nPage = nMaxPage end
self.addonMarketplaceAuction.fnLastSearch(nPage)
end
function Hack:Unload()
end
function Hack:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
function Hack:Register()
local addonMain = Apollo.GetAddon("HacksByAramunn")
addonMain:RegisterHack(self)
end
local HackInst = Hack:new()
HackInst:Register()
|
object_tangible_loot_quest_hero_of_tatooine_squill_skull_pile = object_tangible_loot_quest_hero_of_tatooine_shared_squill_skull_pile:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_quest_hero_of_tatooine_squill_skull_pile, "object/tangible/loot/quest/hero/of/tatooine/squill_skull_pile.iff")
|
settings = {
driver = get"driveby_driver" or { 22,23,24,25,28,29,32 },
passenger = get"driveby_passenger" or { 22,23,24,25,26,28,29,32,30,31,33 },
shotdelay = get"driveby_shot_delay" or { ['22']=300,['23']=300,['24']=800,['26']=700 },
blockedVehicles = get"driveby_blocked_vehicles" or { 432,601,437,431,592,553,577,488,497,548,563,512,476,447,425,519,520,460,417,469,487,513,441,464,501,465,564,538,449,537,539,570,472,473,493,595,484,430,453,452,446,454,606,591,607,611,610,590,569,611,435,608,584,450 },
steerCars = get"driveby_steer_cars" == true,
steerBikes = get"driveby_steer_bikes" == true,
autoEquip = get"driveby_auto_equip" or false,
blockInstantEject = get"block_instant_eject" == true,
enabled = get"driveby_enabled" == true,
}
--Remove any BS IDs by checking them
local validDrivebyWeapons = { [22]=true,[23]=true,[24]=true,[25]=true,
[26]=true,[27]=true,[28]=true,[29]=true,[32]=true,[30]=true,[31]=true,
[32]=true,[33]=true,[38]=true }
--Loop through both driveby tables and ensure they have proper IDs
for key,weaponID in ipairs(settings.driver) do
if not validDrivebyWeapons[weaponID] then
table.remove ( settings.driver, key )
end
end
for key,weaponID in ipairs(settings.passenger) do
if not validDrivebyWeapons[weaponID] then
table.remove ( settings.passenger, key )
end
end
--Verifies the clientscript is downloaded before initiating
addEvent ( "driveby_clientScriptLoaded", true )
addEventHandler ( "driveby_clientScriptLoaded", getRootElement(),
function()
triggerClientEvent ( client, "doSendDriveBySettings", client, settings )
end
)
-- Save player specific driveby enabled-states
syncedPlayerStates = {}
addEvent("driveby_syncDrivebyState", true)
addEventHandler("driveby_syncDrivebyState", root,
function(enabled)
if client ~= source then return end
syncedPlayerStates[client] = enabled
end
)
|
local S = minetest.get_translator("pipeworks")
-- the default tube and default textures
pipeworks.register_tube("pipeworks:tube", S("Pneumatic tube segment"))
minetest.register_craft( {
output = "pipeworks:tube_1 6",
recipe = {
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
{ "", "", "" },
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
},
})
local nodecolor = 0xffff3030
pipeworks.register_tube("pipeworks:broken_tube", {
description = S("Broken Tube"),
plain = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
noctr = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
ends = { { name = "pipeworks_broken_tube_end.png", color = nodecolor } },
short = { name = "pipeworks_broken_tube_short.png", color = nodecolor },
node_def = {
drop = "pipeworks:tube_1",
groups = {not_in_creative_inventory = 1, tubedevice_receiver = 1},
tube = {
insert_object = function(pos, node, stack, direction)
minetest.item_drop(stack, nil, pos)
return ItemStack("")
end,
can_insert = function(pos,node,stack,direction)
return true
end,
priority = 50,
},
on_punch = function(pos, node, puncher, pointed_thing)
local itemstack = puncher:get_wielded_item()
local wieldname = itemstack:get_name()
local playername = puncher:get_player_name()
local log_msg = playername.." struck a broken tube at "..minetest.pos_to_string(pos).."\n"
if wieldname == "anvil:hammer"
or wieldname == "cottages:hammer"
or wieldname == "glooptest:hammer_steel"
or wieldname == "glooptest:hammer_bronze"
or wieldname == "glooptest:hammer_diamond"
or wieldname == "glooptest:hammer_mese"
or wieldname == "glooptest:hammer_alatro"
or wieldname == "glooptest:hammer_arol" then
local meta = minetest.get_meta(pos)
local was_node = minetest.deserialize(meta:get_string("the_tube_was"))
if was_node and was_node ~= "" then
pipeworks.logger(log_msg.." with "..wieldname.." to repair it.")
minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 })
pipeworks.scan_for_tube_objects(pos)
itemstack:add_wear(1000)
puncher:set_wielded_item(itemstack)
return itemstack
else
pipeworks.logger(log_msg.." but it can't be repaired.")
end
else
pipeworks.logger(log_msg.." with "..wieldname.." but that tool is too weak.")
end
end
}
})
-- the high priority tube is a low-cpu replacement for sorting tubes in situations
-- where players would use them for simple routing (turning off paths)
-- without doing actual sorting, like at outputs of tubedevices that might both accept and eject items
if pipeworks.enable_priority_tube then
local color = "#ff3030:128"
pipeworks.register_tube("pipeworks:priority_tube", {
description = S("High Priority Tube Segment"),
inventory_image = "pipeworks_tube_inv.png^[colorize:" .. color,
plain = { { name = "pipeworks_tube_plain.png", color = nodecolor } },
noctr = { { name = "pipeworks_tube_noctr.png", color = nodecolor } },
ends = { { name = "pipeworks_tube_end.png", color = nodecolor } },
short = { name = "pipeworks_tube_short.png", color = nodecolor },
node_def = {
tube = { priority = 150 } -- higher than tubedevices (100)
},
})
minetest.register_craft( {
output = "pipeworks:priority_tube_1 6",
recipe = {
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
{ "default:gold_ingot", "", "default:gold_ingot" },
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
},
})
end
if pipeworks.enable_accelerator_tube then
pipeworks.register_tube("pipeworks:accelerator_tube", {
description = S("Accelerating Pneumatic Tube Segment"),
inventory_image = "pipeworks_accelerator_tube_inv.png",
plain = { "pipeworks_accelerator_tube_plain.png" },
noctr = { "pipeworks_accelerator_tube_noctr.png" },
ends = { "pipeworks_accelerator_tube_end.png" },
short = "pipeworks_accelerator_tube_short.png",
node_def = {
tube = {can_go = function(pos, node, velocity, stack)
velocity.speed = velocity.speed+1
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
end}
},
})
minetest.register_craft( {
output = "pipeworks:accelerator_tube_1 2",
recipe = {
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
{ "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" },
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
},
})
end
if pipeworks.enable_crossing_tube then
pipeworks.register_tube("pipeworks:crossing_tube", {
description = S("Crossing Pneumatic Tube Segment"),
inventory_image = "pipeworks_crossing_tube_inv.png",
plain = { "pipeworks_crossing_tube_plain.png" },
noctr = { "pipeworks_crossing_tube_noctr.png" },
ends = { "pipeworks_crossing_tube_end.png" },
short = "pipeworks_crossing_tube_short.png",
node_def = {
tube = {can_go = function(pos, node, velocity, stack) return {velocity} end }
},
})
minetest.register_craft( {
output = "pipeworks:crossing_tube_1 5",
recipe = {
{ "", "pipeworks:tube_1", "" },
{ "pipeworks:tube_1", "pipeworks:tube_1", "pipeworks:tube_1" },
{ "", "pipeworks:tube_1", "" }
},
})
end
if pipeworks.enable_one_way_tube then
minetest.register_node("pipeworks:one_way_tube", {
description = S("One way tube"),
tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png",
"pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"},
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {type = "fixed",
fixed = {{-1/2, -9/64, -9/64, 1/2, 9/64, 9/64}}},
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1},
sounds = default.node_sound_wood_defaults(),
tube = {
connect_sides = {left = 1, right = 1},
can_go = function(pos, node, velocity, stack)
return {velocity}
end,
can_insert = function(pos, node, stack, direction)
local dir = pipeworks.facedir_to_right_dir(node.param2)
return vector.equals(dir, direction)
end,
priority = 75 -- Higher than normal tubes, but lower than receivers
},
after_place_node = pipeworks.after_place,
after_dig_node = pipeworks.after_dig,
on_rotate = pipeworks.on_rotate,
check_for_pole = pipeworks.check_for_vert_tube,
check_for_horiz_pole = pipeworks.check_for_horiz_tube
})
minetest.register_craft({
output = "pipeworks:one_way_tube 2",
recipe = {
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
{ "group:stick", "default:mese_crystal", "basic_materials:plastic_sheet" },
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
},
})
end
|
-- root logger which (hopefully) other mods will use (via their own loggers/subloggers).
-- at some point minetest.log()'s loglevels might be utilised;
-- for now, bind the print() function at load time to be the printer for this text logger to the console.
local printer = print
-- placeholder - translation facility would be useful here
-- need to look into whether locale say can be detected from intllib if present.
local formatter = _log.default.formatter
local appender_console = _log.new.appender.text(formatter, printer)
-- all other children set their name, root logger is blank
local rootlogger = _log.new.logger({name=""})
rootlogger.appender_add(appender_console)
_log.root = rootlogger
|
local material = {}
local shape = {}
local make_ok = {}
local anzahl = {}
function minetest.get_mydrillpress_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec =
"size[9,6]"..
"list[nodemeta:".. spos .. ";main;1.5,0.5;6,1;]"..
"list[current_player;main;0.5,2;8,4;]"
return formspec
end
local function has_mydrillpress_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") then
return false
end
return true
end
minetest.register_node("myholeinthewall:machine", {
description = "Hole Machine",
inventory_image = "myholeinthewall_inventory_image.png",
tiles = {
"myholeinthewall_machine_top.png",
"myholeinthewall_machine_bottom.png",
"myholeinthewall_machine_side.png",
"myholeinthewall_machine_side.png",
"myholeinthewall_machine_side.png",
"myholeinthewall_machine_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=2},
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.375, -0.375, 0.375, 0.375, 0.375},
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.375, 0.375, -0.375, -0.1875},
{0.1875, -0.5, 0.1875, 0.375, -0.375, 0.375},
{-0.375, -0.5, -0.375, -0.1875, -0.375, -0.1875},
{-0.375, -0.5, 0.1875, -0.1875, -0.375, 0.375},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},
}
},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
minetest.chat_send_player( placer:get_player_name(), "Not enough space to place this!" )
return
end
return minetest.item_place(itemstack, placer, pointed_thing)
end,
after_destruct = function(pos, oldnode)
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "air"})
end,
after_place_node = function(pos, placer)
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "myholeinthewall:machine_top", param2=minetest.dir_to_facedir(placer:get_look_dir())});
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "Drill Press (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Drill Press")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 9*6)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta({x=pos.x,y=pos.y+1,z=pos.z});
local inv = meta:get_inventory()
if not inv:is_empty("ingot") then
return false
elseif not inv:is_empty("res") then
return false
end
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main") and has_mydrillpress_privilege(meta, player)
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not has_mydrillpress_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a drill press belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_mydrillpress_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a drill press belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_mydrillpress_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a drill press belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_count()
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff into drill press at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff into drill press at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from drill press at "..minetest.pos_to_string(pos))
end,
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
if has_mydrillpress_privilege(meta, clicker) then
minetest.show_formspec(
clicker:get_player_name(),
"myholeinthewall:machine",
minetest.get_mydrillpress_formspec(pos)
)
end
end,
})
minetest.register_node("myholeinthewall:machine_top", {
description = "Hole Machine",
tiles = {
"myholeinthewall_machinetop_top.png",
"myholeinthewall_machinetop_bottom.png^[transformR180",
"myholeinthewall_machinetop_rside.png",
"myholeinthewall_machinetop_lside.png",
"myholeinthewall_machinetop_back.png",
"myholeinthewall_machinetop_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
drop = "myholeinthewall:machine",
groups = {cracky=2, not_in_creative_inventory=1},
node_box = {
type = "fixed",
fixed = {
{-0.1875, 0.0625, -0.125, 0.1875, 0.5, 0.3125},
{-0.1875, 0.125, -0.1875, 0.1875, 0.4375, 0.375},
{-0.1875, -0.5, 0.375, -0.0625, 0.3125, 0.5},
{0.0625, -0.5, 0.375, 0.1875, 0.3125, 0.5},
{-0.0625, -0.25, -0.0625, 0, 0.5, 0},
{-0.1875, 0.3125, 0.375, 0.1875, 0.375, 0.4375},
{0.1875, 0.1875, -0.0625, 0.25, 0.375, 0.125},
{0.1875, 0.25, -0.5, 0.25, 0.3125, 0},
}
},
after_destruct = function(pos, oldnode)
minetest.set_node({x = pos.x, y = pos.y - 1, z = pos.z},{name = "air"})
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("ingot") then
return false
elseif not inv:is_empty("res") then
return false
end
local meta = minetest.get_meta({x=pos.x,y=pos.y-1,z=pos.z});
local inv = meta:get_inventory()
return inv:is_empty("main") and has_mydrillpress_privilege(meta, player)
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "invsize[8,9;]"..
"background[-0.15,-0.25;8.40,9.75;myholeinthewall_background.png]"..
"list[current_name;ingot;5.5,1;1,1;]"..
"list[current_name;res;5.5,3;1,1;]"..
"label[5.5,0.5;Input:]"..
"label[5.5,2.5;Output:]"..
"label[0,0;Choose Hole:]"..
-- Column 1
"image_button[0.5,1;1,1;myholeinthewall_mach1.png;diamond; ]"..
"image_button[0.5,2;1,1;myholeinthewall_mach2.png;diamondr; ]"..
"image_button[0.5,3;1,1;myholeinthewall_mach3.png;x; ]"..
-- Column 2
"image_button[1.5,1;1,1;myholeinthewall_mach7.png;diamondh; ]"..
"image_button[1.5,2;1,1;myholeinthewall_mach8.png;diamondrh; ]"..
"image_button[1.5,3;1,1;myholeinthewall_mach9.png;xh; ]"..
-- Column 3
"image_button[2.5,1;1,1;myholeinthewall_mach4.png;cross; ]"..
"image_button[2.5,2;1,1;myholeinthewall_mach5.png;crossi; ]"..
"image_button[2.5,3;1,1;myholeinthewall_mach6.png;o; ]"..
-- Column 4
"image_button[3.5,1;1,1;myholeinthewall_mach10.png;crossh; ]"..
"image_button[3.5,2;1,1;myholeinthewall_mach11.png;crossih; ]"..
"image_button[3.5,3;1,1;myholeinthewall_mach12.png;oh; ]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Drill Press")
local inv = meta:get_inventory()
inv:set_size("ingot", 1)
inv:set_size("res", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["diamond"]
or fields["diamondr"]
or fields["x"]
or fields["cross"]
or fields["crossi"]
or fields["o"]
or fields["diamondh"]
or fields["diamondrh"]
or fields["xh"]
or fields["crossh"]
or fields["crossih"]
or fields["oh"]
then
if fields["diamond"] then
make_ok = "0"
anzahl = "1"
shape = "myholeinthewall:diamond_"
if inv:is_empty("ingot") then
return
end
end
if fields["diamondr"] then
make_ok = "0"
anzahl = "1"
shape = "myholeinthewall:diamond_rough_"
if inv:is_empty("ingot") then
return
end
end
if fields["x"] then
make_ok = "0"
anzahl = "1"
shape = "myholeinthewall:x_"
if inv:is_empty("ingot") then
return
end
end
if fields["cross"] then
make_ok = "0"
anzahl = "1"
shape = "myholeinthewall:cross_"
if inv:is_empty("ingot") then
return
end
end
if fields["crossi"] then
make_ok = "0"
anzahl = "1"
shape = "myholeinthewall:cross_iron_"
if inv:is_empty("ingot") then
return
end
end
if fields["o"] then
make_ok = "0"
anzahl = "1"
shape = "myholeinthewall:o_"
if inv:is_empty("ingot") then
return
end
end
----------------------------------------------------------
if fields["diamondh"] then
make_ok = "0"
anzahl = "2"
shape = "myholeinthewall:diamond_half_"
if inv:is_empty("ingot") then
return
end
end
if fields["diamondrh"] then
make_ok = "0"
anzahl = "2"
shape = "myholeinthewall:diamond_rough_half_"
if inv:is_empty("ingot") then
return
end
end
if fields["xh"] then
make_ok = "0"
anzahl = "1"
shape = "myholeinthewall:x_half_"
if inv:is_empty("ingot") then
return
end
end
if fields["crossh"] then
make_ok = "0"
anzahl = "2"
shape = "myholeinthewall:cross_half_"
if inv:is_empty("ingot") then
return
end
end
if fields["crossih"] then
make_ok = "0"
anzahl = "2"
shape = "myholeinthewall:cross_iron_half_"
if inv:is_empty("ingot") then
return
end
end
if fields["oh"] then
make_ok = "0"
anzahl = "2"
shape = "myholeinthewall:o_half_"
if inv:is_empty("ingot") then
return
end
end
local ingotstack = inv:get_stack("ingot", 1)
local resstack = inv:get_stack("res", 1)
----------------------------------------------------------------------------------
--register nodes
----------------------------------------------------------------------------------
if ingotstack:get_name()=="default:sandstone" then
material = "default_sandstone"
make_ok = "1"
end
if ingotstack:get_name()=="default:desert_sand" then
material = "default_desert_sand"
make_ok = "1"
end
if ingotstack:get_name()=="default:clay" then
material = "default_clay"
make_ok = "1"
end
if ingotstack:get_name()=="default:desert_stone" then
material = "default_desert_stone"
make_ok = "1"
end
if ingotstack:get_name()=="default:cobble" then
material = "default_cobble"
make_ok = "1"
end
if ingotstack:get_name()=="default:stone" then
material = "default_stone"
make_ok = "1"
end
--[[
if ingotstack:get_name()=="default:cactus" then
material = "default_cactus"
make_ok = "1"
end
if ingotstack:get_name()=="default:sand" then
material = "default_sand"
make_ok = "1"
end
]]
if ingotstack:get_name()=="default:wood" then
material = "default_wood"
make_ok = "1"
end
if ingotstack:get_name()=="default:pine_wood" then
material = "default_pine_wood"
make_ok = "1"
end
if ingotstack:get_name()=="default:dirt" then
material = "default_dirt"
make_ok = "1"
end
--[[
if ingotstack:get_name()=="default:brick" then
material = "default_brick"
make_ok = "1"
end
if ingotstack:get_name()=="default:bronzeblock" then
material = "default_bronze_block"
make_ok = "1"
end
]]
if ingotstack:get_name()=="default:coalblock" then
material = "default_coal_block"
make_ok = "1"
end
--[[
if ingotstack:get_name()=="default:copperblock" then
material = "default_copper_block"
make_ok = "1"
end
]]
if ingotstack:get_name()=="default:desert_cobble" then
material = "default_desert_cobble"
make_ok = "1"
end
--[[
if ingotstack:get_name()=="default:diamondblock" then
material = "default_diamond_block"
make_ok = "1"
end
if ingotstack:get_name()=="default:glass" then
material = "default_glass"
make_ok = "1"
end
if ingotstack:get_name()=="default:goldblock" then
material = "default_gold_block"
make_ok = "1"
end
]]
if ingotstack:get_name()=="default:gravel" then
material = "default_gravel"
make_ok = "1"
end
--[[
if ingotstack:get_name()=="default:ice" then
material = "default_ice"
make_ok = "1"
end
if ingotstack:get_name()=="default:jungletree" then
material = "default_jungletree"
make_ok = "1"
end
]]
if ingotstack:get_name()=="default:junglewood" then
material = "default_junglewood"
make_ok = "1"
end
--[[
if ingotstack:get_name()=="default:lava_source" then
material = "default_lava"
make_ok = "1"
end
if ingotstack:get_name()=="default:mese" then
material = "default_mese"
make_ok = "1"
end
]]
if ingotstack:get_name()=="default:mossycobble" then
material = "default_mossycobble"
make_ok = "1"
end
if ingotstack:get_name()=="default:obsidian" then
material = "default_obsidian"
make_ok = "1"
end
--[[
if ingotstack:get_name()=="default:obsidian_glass" then
material = "default_obsidian_glass"
make_ok = "1"
end
if ingotstack:get_name()=="default:obsidianbrick" then
material = "default_obsidian_brick"
make_ok = "1"
end
if ingotstack:get_name()=="default:pinetree" then
material = "default_pinetree"
make_ok = "1"
end
if ingotstack:get_name()=="default:sanddstonebrick" then
material = "default_sandstone_brick"
make_ok = "1"
end
if ingotstack:get_name()=="default:snowblock" then
material = "default_snow"
make_ok = "1"
end
if ingotstack:get_name()=="default:steelblock" then
material = "default_steel_block"
make_ok = "1"
end
if ingotstack:get_name()=="default:stonebrick" then
material = "default_stone_brick"
make_ok = "1"
end
if ingotstack:get_name()=="default:tree" then
material = "default_tree"
make_ok = "1"
end
]]
--[[
if ingotstack:get_name()=="default:water_source" then
material = "default_water"
make_ok = "1"
end
]]
if ingotstack:get_name()=="farming:straw" then
material = "farming_straw"
make_ok = "1"
end
----------------------------------------------------------------------------
--wool
if ingotstack:get_name()=="wool:white" then
material = "wool_white"
make_ok = "1"
end
if ingotstack:get_name()=="wool:black" then
material = "wool_black"
make_ok = "1"
end
if ingotstack:get_name()=="wool:blue" then
material = "wool_blue"
make_ok = "1"
end
if ingotstack:get_name()=="wool:brown" then
material = "wool_brown"
make_ok = "1"
end
if ingotstack:get_name()=="wool:cyan" then
material = "wool_cyan"
make_ok = "1"
end
if ingotstack:get_name()=="wool:dark_green" then
material = "wool_dark_green"
make_ok = "1"
end
if ingotstack:get_name()=="wool:dark_grey" then
material = "wool_dark_grey"
make_ok = "1"
end
if ingotstack:get_name()=="wool:green" then
material = "wool_green"
make_ok = "1"
end
if ingotstack:get_name()=="wool:grey" then
material = "wool_grey"
make_ok = "1"
end
if ingotstack:get_name()=="wool:magenta" then
material = "wool_magenta"
make_ok = "1"
end
if ingotstack:get_name()=="wool:orange" then
material = "wool_orange"
make_ok = "1"
end
if ingotstack:get_name()=="wool:pink" then
material = "wool_pink"
make_ok = "1"
end
if ingotstack:get_name()=="wool:red" then
material = "wool_red"
make_ok = "1"
end
if ingotstack:get_name()=="wool:violet" then
material = "wool_violet"
make_ok = "1"
end
if ingotstack:get_name()=="wool:yellow" then
material = "wool_yellow"
make_ok = "1"
end
----------------------------------------------------------------------
if make_ok == "1" then
local give = {}
for i = 0, anzahl-1 do
give[i+1]=inv:add_item("res",shape..material)
end
ingotstack:take_item()
inv:set_stack("ingot",1,ingotstack)
end
end
end
})
--Craft
minetest.register_craft({
output = 'myholeinthewall:machine',
recipe = {
{'default:coalblock', 'default:coalblock', 'default:coalblock'},
{'default:coalblock', 'default:diamond', 'default:coalblock'},
{'default:coalblock', "default:coalblock", 'default:coalblock'},
},
})
|
local bool = "bool-setting"
data:extend({
{
type = bool,
name = "ZEarlyBots-Start",
setting_type = "runtime-global",
default_value = true
},
})
|
local Concord = require "libs.concord"
local Hitbox = Concord.component(function(c, hitbox)
c.x = hitbox[1] or 0
c.y = hitbox[2] or 0
c.w = hitbox[3] or 16
c.h = hitbox[4] or 16
end)
return Hitbox
|
local function f()
end
local function func()
-- body
end
local function f2() end
local function func() --[[hh]] end
function c2()end
function ccc.bbbb()end
function ttt.bbb:ccc() end
function f3()
local function f() end
end
local dd = function()
local t = 13
end
--extend syntax
local function f2(aaa,bbb,ccc,)
end
f2(1,2,3,)
|
--[[
uHttpd Luci configuration module.
Copyright (c) 2015, GuoGuo <gch981213@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
module("luci.controller.uhttpd", package.seeall)
function index()
if not nixio.fs.access("/etc/config/uhttpd") then
return
end
local page
page = entry({"admin", "system", "uhttpd"}, cbi("uhttpd"), _("HTTP Service"), 90)
page.dependent = true
end
|
if not minetest.features.object_use_texture_alpha then
error("[boost_cart] Your Minetest version is no longer supported."
.. " (Version < 5.0.0)")
end
-- Documentation
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/documentation.lua")
boost_cart = {}
boost_cart.modpath = minetest.get_modpath("boost_cart")
boost_cart.MESECONS = minetest.global_exists("mesecon")
boost_cart.MTG_CARTS = minetest.global_exists("carts") and carts.pathfinder
boost_cart.PLAYER_API = minetest.global_exists("player_api")
boost_cart.player_attached = {}
local function getNum(setting)
return tonumber(minetest.settings:get(setting))
end
-- Maximal speed of the cart in m/s
boost_cart.speed_max = getNum("boost_cart.speed_max") or 10
-- Set to -1 to disable punching the cart from inside
boost_cart.punch_speed_max = getNum("boost_cart.punch_speed_max") or 7
-- Maximal distance for the path correction (for dtime peaks)
boost_cart.path_distance_max = 3
if boost_cart.PLAYER_API then
-- This is a table reference!
boost_cart.player_attached = player_api.player_attached
end
dofile(boost_cart.modpath.."/functions.lua")
dofile(boost_cart.modpath.."/rails.lua")
if boost_cart.MESECONS then
dofile(boost_cart.modpath.."/detector.lua")
--else
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail")
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail_on")
end
if boost_cart.MTG_CARTS then
minetest.log("action", "[boost_cart] Overwriting definitions of similar carts mod")
end
dofile(boost_cart.modpath.."/cart_entity.lua")
|
textutils.slowPrint("no get out")
|
Citizen.CreateThread(function()while true do Citizen.Wait(5*60*1000)collectgarbage("count")collectgarbage("collect")end end)local a=false;local b=0;Citizen.CreateThread(function()while true do kswait=4;local c=PlayerPedId()DisableControlAction(0,36,true)if not IsPedInAnyVehicle(c)then if GetEntityHealth(GetPlayerPed(-1))>121 then if a then a=false;ResetPedStrafeClipset(c)ResetPedMovementClipset(c,0.25)b=3;agachar=false end else a=true;RequestAnimSet("move_m@injured")SetPedMovementClipset(GetPlayerPed(-1),"move_m@injured",true)end;kswait=0;RequestAnimSet("move_ped_crouched")RequestAnimSet("move_ped_crouched_strafing")if IsDisabledControlJustPressed(0,36)then if GetEntityHealth(GetPlayerPed(-1))>121 then if b==0 then if agachar then ResetPedStrafeClipset(c)ResetPedMovementClipset(c,0.25)b=3;agachar=false else SetPedStrafeClipset(c,"move_ped_crouched_strafing")SetPedMovementClipset(c,"move_ped_crouched",0.25)b=3;agachar=true end end else a=true;RequestAnimSet("move_m@injured")SetPedMovementClipset(GetPlayerPed(-1),"move_m@injured",true)end end end;Citizen.Wait(kswait)end end)Citizen.CreateThread(function()while true do Citizen.Wait(1)local c=PlayerPedId()if not IsPedWeaponReadyToShoot(c)then DisableControlAction(0,167,true)end end end)Citizen.CreateThread(function()while true do if b>0 then b=b-1 end;Citizen.Wait(1000)end end) |
---@class IsoSprite : zombie.iso.sprite.IsoSprite
---@field public maxCount int
---@field public alphaStep float
---@field public globalOffsetX float
---@field public globalOffsetY float
---@field private info ColorInfo
---@field private AnimNameSet HashMap|Unknown|Unknown
---@field public firerequirement int
---@field public burntTile String
---@field public forceAmbient boolean
---@field public solidfloor boolean
---@field public canBeRemoved boolean
---@field public attachedFloor boolean
---@field public cutW boolean
---@field public cutN boolean
---@field public solid boolean
---@field public solidTrans boolean
---@field public invisible boolean
---@field public alwaysDraw boolean
---@field public moveWithWind boolean
---@field public isBush boolean
---@field public RL_DEFAULT byte
---@field public RL_FLOOR byte
---@field public renderLayer byte
---@field public windType int
---@field public Animate boolean
---@field public CurrentAnim IsoAnim
---@field public DeleteWhenFinished boolean
---@field public Loop boolean
---@field public soffX short
---@field public soffY short
---@field public Properties PropertyContainer
---@field public TintMod ColorInfo
---@field public AnimMap HashMap|String|IsoAnim
---@field public AnimStack ArrayList|IsoAnim
---@field public name String
---@field public tileSheetIndex int
---@field public ID int
---@field public def IsoSpriteInstance
---@field public modelSlot ModelManager.ModelSlot
---@field parentManager IsoSpriteManager
---@field private type IsoObjectType
---@field private parentObjectName String
---@field private spriteGrid IsoSpriteGrid
---@field public treatAsWallOrder boolean
---@field private hideForWaterRender boolean
IsoSprite = {}
---@public
---@param manager IsoSpriteManager
---@param id int
---@return IsoSprite
---@overload fun(manager:IsoSpriteManager, name:String, offset:int)
---@overload fun(manager:IsoSpriteManager, spr:IsoSprite, offset:int)
function IsoSprite:getSprite(manager, id) end
---@public
---@param manager IsoSpriteManager
---@param name String
---@param offset int
---@return IsoSprite
function IsoSprite:getSprite(manager, name, offset) end
---@public
---@param manager IsoSpriteManager
---@param spr IsoSprite
---@param offset int
---@return IsoSprite
function IsoSprite:getSprite(manager, spr, offset) end
---@public
---@param ObjectName String
---@param AnimName String
---@param AltName String
---@param nFrames int
---@return void
function IsoSprite:LoadFramesReverseAltName(ObjectName, AnimName, AltName, nFrames) end
---@public
---@param NObjectName String
---@param SObjectName String
---@param EObjectName String
---@param WObjectName String
---@return void
function IsoSprite:LoadFramesPageSimple(NObjectName, SObjectName, EObjectName, WObjectName) end
---@public
---@return void
function IsoSprite:Dispose() end
---@public
---@param x int
---@param y int
---@param z int
---@param r float
---@param g float
---@param b float
---@param a float
---@return void
---@overload fun(arg0:int, arg1:int, arg2:int, arg3:float, arg4:float, arg5:float, arg6:float, arg7:float, arg8:float)
function IsoSprite:RenderGhostTileColor(x, y, z, r, g, b, a) end
---@public
---@param arg0 int
---@param arg1 int
---@param arg2 int
---@param arg3 float
---@param arg4 float
---@param arg5 float
---@param arg6 float
---@param arg7 float
---@param arg8 float
---@return void
function IsoSprite:RenderGhostTileColor(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) end
---@public
---@return String
function IsoSprite:getParentObjectName() end
---@public
---@return IsoSpriteGrid
function IsoSprite:getSpriteGrid() end
---@public
---@return int
---@overload fun(arg0:String)
function IsoSprite:getSheetGridIdFromName() end
---@public
---@param arg0 String
---@return int
function IsoSprite:getSheetGridIdFromName(arg0) end
---@public
---@param dir IsoDirections
---@param x int
---@param y int
---@return boolean
---@overload fun(dir:IsoDirections, x:int, y:int, flip:boolean)
function IsoSprite:isMaskClicked(dir, x, y) end
---@public
---@param dir IsoDirections
---@param x int
---@param y int
---@param flip boolean
---@return boolean
function IsoSprite:isMaskClicked(dir, x, y, flip) end
---@public
---@param arg0 IsoSpriteGrid
---@return void
function IsoSprite:setSpriteGrid(arg0) end
---@public
---@return PropertyContainer @the Properties
function IsoSprite:getProperties() end
---@public
---@param dir IsoDirections
---@param x int
---@param y int
---@param flip boolean
---@return float
function IsoSprite:getMaskClickedY(dir, x, y, flip) end
---@public
---@param manager IsoSpriteManager
---@return IsoSprite
function IsoSprite:CreateSprite(manager) end
---@public
---@return void
---@overload fun(def:IsoSpriteInstance)
function IsoSprite:update() end
---@public
---@param def IsoSpriteInstance
---@return void
function IsoSprite:update(def) end
---@public
---@param x int
---@param y int
---@param z int
---@return void
function IsoSprite:RenderGhostTileRed(x, y, z) end
---throws java.io.IOException
---@public
---@param input DataInputStream
---@return void
function IsoSprite:load(input) end
---@public
---@param arg0 IsoObject
---@param arg1 float
---@param arg2 float
---@param arg3 float
---@param arg4 IsoDirections
---@param arg5 float
---@param arg6 float
---@param arg7 ColorInfo
---@param arg8 boolean
---@return void
---@overload fun(arg0:IsoSpriteInstance, arg1:IsoObject, arg2:float, arg3:float, arg4:float, arg5:IsoDirections, arg6:float, arg7:float, arg8:ColorInfo, arg9:boolean)
---@overload fun(arg0:IsoObject, arg1:float, arg2:float, arg3:float, arg4:IsoDirections, arg5:float, arg6:float, arg7:ColorInfo, arg8:boolean, arg9:Consumer|Unknown)
---@overload fun(arg0:IsoSpriteInstance, arg1:IsoObject, arg2:float, arg3:float, arg4:float, arg5:IsoDirections, arg6:float, arg7:float, arg8:ColorInfo, arg9:boolean, arg10:Consumer|Unknown)
function IsoSprite:render(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) end
---@public
---@param arg0 IsoSpriteInstance
---@param arg1 IsoObject
---@param arg2 float
---@param arg3 float
---@param arg4 float
---@param arg5 IsoDirections
---@param arg6 float
---@param arg7 float
---@param arg8 ColorInfo
---@param arg9 boolean
---@return void
function IsoSprite:render(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) end
---@public
---@param arg0 IsoObject
---@param arg1 float
---@param arg2 float
---@param arg3 float
---@param arg4 IsoDirections
---@param arg5 float
---@param arg6 float
---@param arg7 ColorInfo
---@param arg8 boolean
---@param arg9 Consumer|Unknown
---@return void
function IsoSprite:render(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) end
---@public
---@param arg0 IsoSpriteInstance
---@param arg1 IsoObject
---@param arg2 float
---@param arg3 float
---@param arg4 float
---@param arg5 IsoDirections
---@param arg6 float
---@param arg7 float
---@param arg8 ColorInfo
---@param arg9 boolean
---@param arg10 Consumer|Unknown
---@return void
function IsoSprite:render(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) end
---@private
---@param arg0 IsoSpriteInstance
---@param arg1 IsoObject
---@param arg2 float
---@param arg3 float
---@param arg4 float
---@param arg5 IsoDirections
---@param arg6 float
---@param arg7 float
---@param arg8 boolean
---@param arg9 int
---@param arg10 JVector2
---@return void
function IsoSprite:prepareToRenderSprite(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) end
---@public
---@param ntype IsoObjectType
---@return void
function IsoSprite:setType(ntype) end
---@public
---@param ObjectName String
---@param AnimName String
---@param nFrames int
---@return void
function IsoSprite:LoadFramesNoDirPageDirect(ObjectName, AnimName, nFrames) end
---@public
---@param ObjectName String
---@param AnimName String
---@param nFrames int
---@return void
function IsoSprite:LoadFramesNoDirPage(ObjectName, AnimName, nFrames) end
---@public
---@param _string String
---@return void
function IsoSprite:LoadCache(_string) end
---@private
---@return IsoSpriteInstance
function IsoSprite:getSpriteInstance() end
---@public
---@return void
function IsoSprite:renderActiveModel() end
---@public
---@param arg0 IsoSpriteInstance
---@param arg1 IsoObject
---@param arg2 IsoDirections
---@return void
function IsoSprite:renderObjectPicker(arg0, arg1, arg2) end
---@public
---@return IsoObjectType
function IsoSprite:getType() end
---@public
---@param sprite IsoSprite
---@return void
function IsoSprite:AddProperties(sprite) end
---@public
---@param arg0 boolean
---@return void
function IsoSprite:setAnimate(arg0) end
---@public
---@param manager IsoSpriteManager
---@param id int
---@param spr IsoSprite
---@return void
function IsoSprite:setSpriteID(manager, id, spr) end
---@public
---@param _string String
---@return boolean
function IsoSprite:HasCache(_string) end
---throws java.io.IOException
---@public
---@param output DataOutputStream
---@return void
function IsoSprite:save(output) end
---@public
---@param info ColorInfo
---@return void
function IsoSprite:setTintMod(info) end
---@public
---@param arg0 String
---@param arg1 String
---@param arg2 int
---@return IsoSprite
function IsoSprite:setFromCache(arg0, arg1, arg2) end
---@public
---@param ObjectName String
---@param AnimName String
---@param nFrames int
---@return void
function IsoSprite:LoadFrames(ObjectName, AnimName, nFrames) end
---@public
---@return boolean
function IsoSprite:isMoveWithWind() end
---@private
---@param arg0 IsoSpriteInstance
---@return float
function IsoSprite:getCurrentSpriteFrame(arg0) end
---@public
---@return boolean
function IsoSprite:hasActiveModel() end
---@public
---@return ColorInfo
function IsoSprite:getTintMod() end
---@public
---@param arg0 IsoDirections
---@return Texture
function IsoSprite:getTextureForCurrentFrame(arg0) end
---@public
---@param arg0 IsoSpriteInstance
---@param arg1 IsoObject
---@param arg2 float
---@param arg3 float
---@param arg4 float
---@param arg5 IsoDirections
---@param arg6 float
---@param arg7 float
---@param arg8 ColorInfo
---@param arg9 boolean
---@param arg10 Consumer|Unknown
---@return void
function IsoSprite:renderCurrentAnim(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) end
---@public
---@param arg0 IsoSpriteInstance
---@param arg1 IsoObject
---@param arg2 float
---@param arg3 float
---@param arg4 float
---@param arg5 float
---@param arg6 float
---@param arg7 ColorInfo
---@param arg8 boolean
---@return void
function IsoSprite:renderVehicle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) end
---@public
---@param _string String
---@return void
function IsoSprite:setName(_string) end
---@public
---@param ObjectName String
---@return void
function IsoSprite:LoadFramesNoDirPageSimple(ObjectName) end
---@public
---@param ObjectName String
---@return void
function IsoSprite:ReplaceCurrentAnimFrames(ObjectName) end
---@public
---@param NewTintMod ColorInfo
---@return void
function IsoSprite:ChangeTintMod(NewTintMod) end
---@private
---@param arg0 float
---@param arg1 float
---@param arg2 Texture
---@param arg3 float
---@param arg4 float
---@return void
function IsoSprite:renderSpriteOutline(arg0, arg1, arg2, arg3, arg4) end
---@public
---@return int
function IsoSprite:getID() end
---@public
---@param x int
---@param y int
---@param z int
---@return void
function IsoSprite:RenderGhostTile(x, y, z) end
---@public
---@param name String
---@return void
---@overload fun(anim:IsoAnim)
function IsoSprite:PlayAnim(name) end
---@public
---@param anim IsoAnim
---@return void
function IsoSprite:PlayAnim(anim) end
---@public
---@return String
function IsoSprite:getName() end
---@private
---@param arg0 IsoSpriteInstance
---@param arg1 IsoObject
---@param arg2 IsoDirections
---@param arg3 int
---@param arg4 float
---@param arg5 float
---@param arg6 Consumer|Unknown
---@return void
function IsoSprite:performRenderFrame(arg0, arg1, arg2, arg3, arg4, arg5, arg6) end
---@public
---@param arg0 int
---@param arg1 IsoDirections
---@return Texture
function IsoSprite:getTextureForFrame(arg0, arg1) end
---@public
---@param arg0 String
---@param arg1 String
---@param arg2 int
---@return IsoSprite
function IsoSprite:CreateSpriteUsingCache(arg0, arg1, arg2) end
---@public
---@param name String
---@return void
function IsoSprite:PlayAnimUnlooped(name) end
---@public
---@return void
function IsoSprite:setHideForWaterRender() end
---@public
---@param ObjectName String
---@param AnimName String
---@param nFrames int
---@return void
function IsoSprite:LoadFramesPcx(ObjectName, AnimName, nFrames) end
---@public
---@param ObjectName String
---@return Texture
function IsoSprite:LoadFrameExplicit(ObjectName) end
---@public
---@param val String
---@return void
function IsoSprite:setParentObjectName(val) end
---@public
---@param key String
---@return void
function IsoSprite:CacheAnims(key) end
---@private
---@return void
function IsoSprite:initSpriteInstance() end
---@public
---@return IsoSpriteInstance
function IsoSprite:newInstance() end
---@public
---@return void
function IsoSprite:DisposeAll() end
---@public
---@param x float
---@param y float
---@param z float
---@param info2 ColorInfo
---@return void
function IsoSprite:renderBloodSplat(x, y, z, info2) end
|
-- Copyright 2019 Liu Donghua <shaphone@gmail.com>
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.admin.demo", package.seeall)
function index()
local fs = require "nixio.fs"
local poe_config = {
next = true,
on_success_to = luci.dispatcher.build_url("admin","demo","lan")
}
entry({"admin", "demo"}, firstchild(), _("demo"), 50).index = true
entry({"admin","demo","pppoe"},cbi("admin_demo/pppoe",poe_config),nil)
local lan_config = {
last = true,
finish = true
}
entry({"admin","demo","lan"},cbi("admin_demo/lan",lan_config),nil)
end
|
local mod = DBM:NewMod(1790, "DBM-BrokenIsles", nil, 822)
local L = mod:GetLocalizedStrings()
mod:SetRevision(("$Revision: 14958 $"):sub(12, -3))
mod:SetCreatureID(109943)
--mod:SetEncounterID(1880)
mod:SetReCombatTime(20)
mod:SetZone()
--mod:SetMinSyncRevision(11969)
mod:RegisterCombat("combat")
mod:RegisterEventsInCombat(
"SPELL_CAST_START 218823 218888 219045 219254",
"SPELL_AURA_APPLIED 219045 219068"
)
--TODO: Tank swap warning if breath is often enough and threatening.
--TODO: figure out Gaseous Breath stuff.
--TODO, icon option for mind controls maybe. Coordinate healer dispels better
local warnMothersEmbrace = mod:NewTargetAnnounce(219045, 3)
local warnMothersEmbraceFail = mod:NewTargetAnnounce(219068, 4)
local warnGaseousBreath = mod:NewSpellAnnounce(219254, 2)
local specWarnFelGeyser = mod:NewSpecialWarningDodge(218823, nil, nil, nil, 2, 2)
local specWarnImpishFlames = mod:NewSpecialWarningDefensive(218888, "Tank")
local specWarnMothersEmbrace = mod:NewSpecialWarningDispel(219045, "Healer")
local timerFelGeyserCD = mod:NewAITimer(16, 218823, nil, nil, nil, 2)
local timerImpishFlamesCD = mod:NewAITimer(90, 218888, nil, "Tank", nil, 5)
local timerMothersEmbraceCD = mod:NewAITimer(90, 219045, nil, nil, nil, 3)
local timerGaseousBreathCD = mod:NewAITimer(90, 219254, nil, nil, nil, 1)
local voiceFelGeyser = mod:NewVoice(218823)--watchstep
local voiceImpishFlames = mod:NewVoice(218888, "Tank")--breathsoon
local voiceMothersEmbrace = mod:NewVoice(219045, "Healer")--helpdispel
--mod:AddReadyCheckOption(37460, false)
function mod:OnCombatStart(delay, yellTriggered)
if yellTriggered then
end
end
function mod:OnCombatEnd()
end
function mod:SPELL_CAST_START(args)
local spellId = args.spellId
if spellId == 218823 then
specWarnFelGeyser:Show()
voiceFelGeyser:Play("watchstep")
timerFelGeyserCD:Start()
elseif spellId == 218888 then
specWarnImpishFlames:Show()
voiceImpishFlames:Play("breathsoon")
timerImpishFlamesCD:Start()
elseif spellId == 219045 then
timerMothersEmbraceCD:Start()
elseif spellId == 219254 then
warnGaseousBreath:Show()
timerGaseousBreathCD:Start()
end
end
function mod:SPELL_AURA_APPLIED(args)
local spellId = args.spellId
if spellId == 219045 then
if self.Options.SpecWarn219045dispel then
specWarnMothersEmbrace:CombinedShow(0.3, args.destName)
else
warnMothersEmbrace:CombinedShow(0.3, args.destName)
end
if self:AntiSpam(3, 1) then
voiceMothersEmbrace:Play("helpdispel")
end
elseif spellId == 219068 then--Dispel failure.
warnMothersEmbraceFail:CombinedShow(0.3, args.destName)
end
end
|
---
-- Pulse amplitude modulate bits into a baseband real-valued signal. The
-- resulting signal is non-return-to-zero, bipolar, with normalized energy.
--
-- $$ y[n] = \text{PAM}(x[n], \text{symbol_rate}, \text{sample_rate}, \text{levels}) $$
--
-- @category Modulation
-- @block PulseAmplitudeModulatorBlock
-- @tparam number symbol_rate Symbol rate in Hz
-- @tparam number sample_rate Sample rate in Hz
-- @tparam number levels Number of amplitude levels (must be power of 2)
-- @tparam[opt={}] table options Additional options, specifying:
-- * `msb_first` (boolean, default true)
-- * `amplitudes` (table, mapping of symbol value
-- to amplitude)
-- @signature in:Bit > out:Float32
--
-- @usage
-- -- 4-PAM modulator with 1200 Hz symbol rate, 96 kHz sample rate
-- local modulator = radio.PulseAmplitudeModulatorBlock(1200, 96000, 4)
local ffi = require('ffi')
local block = require('radio.core.block')
local types = require('radio.types')
local math_utils = require('radio.utilities.math_utils')
local PulseAmplitudeModulatorBlock = block.factory("PulseAmplitudeModulatorBlock")
function PulseAmplitudeModulatorBlock:instantiate(symbol_rate, sample_rate, levels, options)
self.symbol_rate = assert(symbol_rate, "Missing argument #1 (symbol_rate)")
self.sample_rate = assert(sample_rate, "Missing argument #2 (sample_rate)")
self.levels = assert(levels, "Missing argument #3 (levels)")
self.options = options or {}
assert(levels > 1 and math_utils.is_pow2(levels), "Levels is not greater than 1 and a power of 2")
self.symbol_bits = math.floor(math.log(self.levels, 2))
self.symbol_period = math.floor(self.sample_rate / self.symbol_rate)
self.amplitudes = self.options.amplitudes or self:_build_amplitudes(self.levels)
self.msb_first = (self.options.msb_first == nil) and true or self.options.msb_first
self:add_type_signature({block.Input("in", types.Bit)}, {block.Output("out", types.Float32)})
end
function PulseAmplitudeModulatorBlock:_build_amplitudes(levels)
local amplitudes = {}
local scaling = math.sqrt((levels ^ 2 - 1) / 3)
for level=0, levels-1 do
local gray_level = bit.bxor(level, bit.rshift(level, 1))
amplitudes[gray_level] = (2 * level - levels + 1) / scaling
end
return amplitudes
end
function PulseAmplitudeModulatorBlock:initialize()
-- Build symbol vectors
self.symbol_vectors = {}
for level=0, self.levels-1 do
self.symbol_vectors[level] = types.Float32.vector(self.symbol_period)
self.symbol_vectors[level]:fill(types.Float32(self.amplitudes[level]))
end
self.state = types.Bit.vector()
self.out = types.Float32.vector()
end
function PulseAmplitudeModulatorBlock:process(x)
local state = self.state
local out = self.out:resize(math.floor((state.length + x.length) / self.symbol_bits) * self.symbol_period)
local symbol_offset = 0
for i = 0, x.length-1 do
state:append(x.data[i])
if state.length == self.symbol_bits then
local value = types.Bit.tonumber(state, 0, self.symbol_bits, self.msb_first and "msb" or "lsb")
ffi.copy(self.out.data + symbol_offset, self.symbol_vectors[value].data, self.symbol_period * ffi.sizeof(types.Float32))
symbol_offset = symbol_offset + self.symbol_period
state:resize(0)
end
end
return out
end
return PulseAmplitudeModulatorBlock
|
object_tangible_component_weapon_core_weapon_core_base = object_tangible_component_weapon_core_shared_weapon_core_base:new {
}
ObjectTemplates:addTemplate(object_tangible_component_weapon_core_weapon_core_base, "object/tangible/component/weapon/core/weapon_core_base.iff")
|
function HollowActivate( keys )
local caster = keys.caster
local casterPos = caster:GetAbsOrigin()
local ability = keys.ability
local thresholdptg = ability:GetLevelSpecialValueFor( "hp_trigger" , ability:GetLevel() - 1 )
local health = caster:GetMaxHealth()
local treshold = health/thresholdptg
local dur = ability:GetLevelSpecialValueFor( "duration" , ability:GetLevel() - 1 )
-- Apply the modifier
Timers:CreateTimer( 0.03, function()
if caster:GetHealth() < treshold and not(caster:HasModifier("modifier_hollow")) and caster:IsAlive() and not(caster:HasModifier("modifier_bankai")) then
ability:ApplyDataDrivenModifier( caster, caster, "modifier_hollow", { duration = dur })
ability:ApplyDataDrivenModifier( caster, caster, "modifier_invulnerability", { duration = 1.0 })
caster:Heal( health/5, caster )
local targetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY
local targetType = DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_HERO
local targetFlag = DOTA_UNIT_TARGET_FLAG_INVULNERABLE + DOTA_UNIT_TARGET_FLAG_NO_INVIS
local unitOrder = FIND_ANY_ORDER
local units = FindUnitsInRadius(caster:GetTeamNumber(), caster:GetAbsOrigin(), caster, 300.0, targetTeam,targetType, targetFlag, unitOrder, false)
local target = math.random(0,#units)
caster:MoveToTargetToAttack(units[target])
caster:Purge( false, true, false, true, false)
end
end
)
end
function HollowAttack ( keys )
local caster = keys.caster
local casterPos = caster:GetAbsOrigin()
local targetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY
local targetType = DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_HERO
local targetFlag = DOTA_UNIT_TARGET_FLAG_INVULNERABLE + DOTA_UNIT_TARGET_FLAG_NO_INVIS
local unitOrder = FIND_ANY_ORDER
local units = FindUnitsInRadius(caster:GetTeamNumber(), caster:GetAbsOrigin(), caster, 300.0, targetTeam,targetType, targetFlag, unitOrder, false)
local target = math.random(0,#units)
if caster:IsAttacking() then
caster:SetAggroTarget(units[target])
else
caster:MoveToTargetToAttack(units[target])
end
end
function HollowAttackBlink( keys )
local caster = keys.caster
local casterPos = caster:GetAbsOrigin()
local target = keys.target
local point = target:GetAbsOrigin()
local direction = (point - casterPos):Normalized()
ProjectileManager:ProjectileDodge(caster)
FindClearSpaceForUnit(caster, point, false)
caster:SetForwardVector(direction)
end
function HollowKill( keys )
print("mr boi")
local target = keys.caster
target:ForceKill( true )
end
function HollowSkillReplace( keys )
print("im checking for replacement")
local caster = keys.caster
local ability = keys.ability
local level = ability:GetLevel()
if level == 2 then
print("IM REPLACING DA SKILL")
caster:RemoveAbility(ability:GetAbilityName())
local newAbility = caster:AddAbility("ichigo_hollow_reiatsu")
caster:RemoveModifierByName("modifier_hollow_passive")
newAbility:SetLevel(2)
newAbility:SetAbilityIndex(4)
end
end |
local M = {}
function M.centralizeText(str)
local width = vim.api.nvim_win_get_width(0)
local shift = math.floor(width / 2) - math.floor(string.len(str) / 2)
local c_str = string.rep(' ', shift) .. str
return c_str
end
return M
|
------------------------------------------------------------------------------------------------------------------------------------------------------------
--classe_menu.lua
------------------------------------------------------------------------------------------------------------------------------------------------------------
local mJeu = {}
function mJeu:new()
local jeu = display.newGroup()
local mNiveau = require('classes.classe_niveau')
local niveau = mNiveau:new()
Runtime:addEventListener('enterFrame', jeu)
return jeu
end
return mJeu |
-- eLua reference manual - str9 platform specific rtc - Real Time Clock - data
data_en =
{
-- Title
title = "eLua reference manual - STR9 rtc module",
-- Menu name
menu_name = "rtc",
-- Overview
overview = [[This module contains functions for accessing the particular features of the RTC - Real Time Clock - subsystem of the STR9 family of CPUs.
This internal subsystem offers functions to keep track of a real time clock calendar, as well as some other features like alarms and auxiliar functions.
Reference manual, available from ST at @http://www.st.com/mcu/devicedocs-STR912FAW44-101.html@this address@.]],
-- Functions
funcs =
{
{ sig = "#str9.rtc.settime#( time )",
desc = "Sets the Real Time Clock time to a specific time of the day.",
args =
{
"$time$ - a string in the format 'hh:mm:ss' or a Lua table with 'hour', 'min' and 'sec' string fields.",
},
ret = "nothing.",
ex = 'str9.settime("14:25:00") - Sets the RTC time to 14 hour 25 minutes, 2:25 PM',
},
{ sig = "#str9.rtc.gettime#( format )",
desc = "Gets the time kept by the Real Time Clock.",
args =
{
"$format$ - the string '*s' to return the time as a string 'hh:mm:ss' or '*t' to return as a Lua table with string fields 'hour', 'min' and 'sec'.",
},
ret = "a string or a Lua table, according to the format argument.",
ex = 'now = str9.rtc.gettime( "*s" ) - now receives a sting like "14:25:05", now = str9.rtc.gettime( "*t" ) - now receives the Lua table { hour = 14, min = 25, sec = 05 }',
},
{ sig = "#str9.rtc.setdate#( date )",
desc = "Sets the Real Time Clock date to a specific date.",
args =
{
"$date$ - a string in the format 'dd/mm/yyyy' or a Lua table with 'day', 'month' and 'year' string fields.",
},
ret = "nothing.",
ex = 'str9.rtc.setdate( "31/08/1960" ) - set the RTC date to August 31st 1960',
},
{ sig = "#str9.rtc.getdate#( format )",
desc = "Gets the date kept by the Real Time Clock.",
args =
{
"$format$ - the string '*s' to return the date as a string 'dd/mm/yyyy' or '*t' to return as a Lua table with string fields 'day', 'month' and 'year'.",
},
ret = "a string or a Lua table, according to the format argument.",
ex = 'today = str9.rtc.getdate( "*s" ) - today receives a string like "14/12/2010", meaning December 14th of 2010, today = str9.rtc.getdate( "*t" ) - today receives the Lua table { day = 14, month = 12, year = 2010 }',
},
},
}
data_pt = data_en
|
-- #######################################
-- ## Project: MTA iLife ##
-- ## Name: PrestigeNameRenderer.lua ##
-- ## Author: Noneatme ##
-- ## Version: 1.0 ##
-- ## License: See top Folder ##
-- #######################################
-- FUNCTIONS / METHODS --
local cFunc = {}; -- Local Functions
local cSetting = {}; -- Local Settings
PrestigeNameRenderer = {};
PrestigeNameRenderer.__index = PrestigeNameRenderer;
addEvent("onPrestigeColToggle", true)
--[[
]]
-- ///////////////////////////////
-- ///// New //////
-- ///// Returns: Object //////
-- ///////////////////////////////
function PrestigeNameRenderer:New(...)
local obj = setmetatable({}, {__index = self});
if obj.Constructor then
obj:Constructor(...);
end
return obj;
end
-- ///////////////////////////////
-- ///// Render //////
-- ///// Returns: void //////
-- ///////////////////////////////
function PrestigeNameRenderer:Render()
if(self.enabled) then
local Prestiges = self.prestiges;
if(Prestiges) then
for index, Faction in pairs(Prestiges) do
if(isElement(Faction)) then
local x, y, z = getElementPosition(Faction)
local x2, y2, z2 = getElementPosition(localPlayer)
if(isLineOfSightClear(x, y, z, x2, y2, z2, true, false, false, false)) then
z = z+0.5
local sx, sy = getScreenFromWorldPosition(x, y, z)
if(sx) and (sy) then
local x5, y5, z5 = getElementPosition(Faction);
local x6, y6, z6 = getCameraMatrix();
local distance = getDistanceBetweenPoints3D(x5, y5, z5, x6, y6, z6)
if(distance < 20) then
local fontbig = 2-(distance/10)
local sName = getElementData(Faction, "Title")
local sOwner = getElementData(Faction, "OwnerName")
dxDrawText("Prestige: "..sName.."\nBesitzer: "..sOwner, sx+2, sy+2, sx, sy, tocolor(0, 0, 0, 200), fontbig, "default-bold", "center")
dxDrawText("Prestige: "..sName.."\nBesitzer: "..sOwner, sx, sy, sx, sy, tocolor(255, 255, 255, 200), fontbig, "default-bold", "center")
end
end
end
end
end
end
end
end
-- ///////////////////////////////
-- ///// ToggleD //////
-- ///// Returns: void //////
-- ///////////////////////////////
function PrestigeNameRenderer:ToggleD(uCol, b)
if(b) then
self.prestiges[uCol] = uCol;
else
local newTBL = {}
for index, da in pairs(self.prestiges) do
if not(index == uCol) then
newTBL[index] = da;
end
end
self.prestiges = newTBL;
end
end
-- ///////////////////////////////
-- ///// Constructor //////
-- ///// Returns: void //////
-- ///////////////////////////////
function PrestigeNameRenderer:Constructor(...)
self.prestiges = {}
self.enabled = toBoolean(config:getConfig("render_3dtext"))
-- Klassenvariablen --
self.renderFunc = function(...) self:Render(...) end;
self.toggleFunc = function(...) self:ToggleD(...) end;
-- Methoden --
addEventHandler("onClientRender", getRootElement(), self.renderFunc)
-- Events --
addEventHandler("onPrestigeColToggle", getLocalPlayer(), self.toggleFunc)
--logger:OutputInfo("[CALLING] PrestigeNameRenderer: Constructor");
end
-- EVENT HANDLER --
|
local dump = require "util.serialization".serialize;
local load = require "util.envload".envloadfile;
local dm = require "core.storagemanager".olddm;
local REMOVE = {}; -- Special value for removing keys
local driver = {};
local keywords = {
["do"] = true; ["and"] = true; ["else"] = true; ["break"] = true;
["if"] = true; ["end"] = true; ["goto"] = true; ["false"] = true;
["in"] = true; ["for"] = true; ["then"] = true; ["local"] = true;
["or"] = true; ["nil"] = true; ["true"] = true; ["until"] = true;
["elseif"] = true; ["function"] = true; ["not"] = true;
["repeat"] = true; ["return"] = true; ["while"] = true;
-- _ENV is not technically a keyword but we need to treat it as such
["_ENV"] = true;
};
local function is_usable_identifier(s)
return type(s) == "string" and not keywords[s] and s:find("^[%a_][%w_]*$");
end
local function serialize_key(key)
if is_usable_identifier(key) then
return key;
else
return "_ENV[" .. dump(key) .. "]";
end
end
local function serialize_value(value)
if value == REMOVE then
return "nil";
else
return dump(value);
end
end
local function serialize_pair(key, value)
key = serialize_key(key);
value = serialize_value(value);
return key .. " = " .. value .. ";\n";
end
local function serialize_map(keyvalues)
local keys, values = {}, {};
for key, value in pairs(keyvalues) do
key = serialize_key(key);
value = serialize_value(value);
table.insert(keys, key);
table.insert(values, value);
end
return table.concat(keys, ", ") .. " = " .. table.concat(values, ", ") .. ";\n";
end
local map = { remove = REMOVE };
local map_mt = { __index = map };
function map:get(user, key)
module:log("debug", "map:get(%s, %s)", tostring(user), tostring(key))
local filename = dm.getpath(user, module.host, self.store, "map");
module:log("debug", "File is %s", filename);
local env = {};
if _VERSION == "Lua 5.1" then -- HACK
env._ENV = env; -- HACK
end -- SO MANY HACKS
local chunk, err, errno = load(filename, env);
if not chunk then if errno == 2 then return end return chunk, err; end
local ok, err = pcall(chunk);
if not ok then return ok, err; end
if _VERSION == "Lua 5.1" then -- HACK
env._ENV = nil; -- HACK
end -- HACKS EVERYWHERE
if key == nil then
return env;
end
return env[key];
end
function map:set_keys(user, keyvalues)
local data = serialize_map(keyvalues);
return dm.append_raw(user, module.host, self.store, "map", data);
end
function map:set(user, key, value)
if _VERSION == "Lua 5.1" then
assert(key ~= "_ENV", "'_ENV' is a restricted key");
end
if key == nil then
local filename = dm.getpath(user, module.host, self.store, "map");
return os.remove(filename);
end
local data = serialize_pair(key, value);
return dm.append_raw(user, module.host, self.store, "map", data);
end
local keyval = { remove = REMOVE };
local keyval_mt = { __index = keyval };
function keyval:get(user)
return map.get(self, user, nil);
end
function keyval:set(user, keyvalues)
local data = serialize_map(keyvalues);
return dm.store_raw(user, module.host, self.store, "map", data);
end
-- TODO some kind of periodic compaction thing?
function map:_compact(user)
local data = self:get(user);
return keyval.set(self, user, data);
end
function driver:open(store, typ)
if typ == "map" then
return setmetatable({ store = store, }, map_mt);
elseif typ == nil or typ == "keyval" then
return setmetatable({ store = store, }, keyval_mt);
end
return nil, "unsupported-store";
end
module:provides("storage", driver);
|
-- Natural Selection 2 Competitive Mod
-- Source located at - https://github.com/xToken/CompMod
-- lua\CompMod\Weapons\Marine\Mine\shared.lua
-- - Dragon
local kClientOwnedMines = { }
if Server then
local Detonate = GetUpValue(Mine.OnInitialized, "Detonate", { LocateRecurse = true } )
local function Arm(self)
if not self.armed then
self:AddTimedCallback(function() Detonate(self, Arm) end, kMineArmingTime)
self:TriggerEffects("mine_arm")
self.armed = true
end
end
function GetClientDeployedMines(clientId)
return kClientOwnedMines[clientId] and #kClientOwnedMines[clientId] or 0
end
function Mine:GetSendDeathMessageOverride()
return not self.armed
end
function Mine:GetDestroyOnKill()
return not self.active
end
function Mine:OnKill(attacker, doer, point, direction)
if self.active then
Arm(self)
end
ScriptActor.OnKill(self, attacker, doer, point, direction)
end
local function UpdateMarineLayMinesWeapons(marine, count)
if marine and marine:isa("Marine") then
for i = 0, marine:GetNumChildren() - 1 do
local child = marine:GetChildAtIndex(i)
if child:GetMapName() == LayMines.kMapName then
child:SetDeployedMines(count)
end
end
end
end
function Mine:OnDestroy()
--[[local id = self:GetId()
if kClientOwnedMines[self.owningId] then
for i = 1, #kClientOwnedMines[self.owningId] do
if kClientOwnedMines[self.owningId][i] == id then
table.remove(kClientOwnedMines[self.owningId], i)
UpdateMarineLayMinesWeapons(self:GetOwner(), #kClientOwnedMines[self.owningId])
end
end
end]]
end
ReplaceUpValue(Mine.OnInitialized, "Arm", Arm, { LocateRecurse = true } )
local function CheckOverMineLimit(self)
local player = self:GetOwner()
local success = false
-- Keep the mine spam in check yo!
if player then
local owner = Server.GetOwner(player)
if owner then
local clientId = owner:GetUserId()
if kClientOwnedMines[clientId] == nil then
kClientOwnedMines[clientId] = { }
end
if #kClientOwnedMines[clientId] >= kMinesPerPlayerLimit then
-- Grab oldest Mine
local mine = Shared.GetEntity(kClientOwnedMines[clientId][1])
-- Make sure its a mine, if the game is reset/whatever entityIDs can be reused.
if mine and mine:isa("Mine") then
-- This removes it from the table
DestroyEntity(mine)
else
-- Some shenanigans are going on... just remove.
table.remove(kClientOwnedMines[clientId], 1)
end
success = true
else
-- Under limit
success = true
end
self.owningId = clientId
table.insert(kClientOwnedMines[clientId], self:GetId())
UpdateMarineLayMinesWeapons(player, #kClientOwnedMines[clientId])
end
end
if not success then
DestroyEntity(self)
end
end
local originalMineOnInitialized
originalMineOnInitialized = Class_ReplaceMethod("Mine", "OnInitialized",
function(self)
originalMineOnInitialized(self)
--self:AddTimedCallback(CheckOverMineLimit, 0.1)
end
)
end |
-------------------------------------------
-- FRENZY
-- a hedgewars mode inspired by Hysteria
-------------------------------------------
HedgewarsScriptLoad("/Scripts/Locale.lua")
local cTimer = 0
local cn = 0
local frenzyAmmos = {
amBazooka,
amGrenade,
amShotgun,
amFirePunch,
amMine,
amMolotov,
amBlowTorch,
amJetpack,
amTeleport,
amLowGravity
}
function showStartingInfo()
ruleSet = "" ..
loc("RULES:") .. " |" ..
loc("Each turn is only ONE SECOND!") .. "|" ..
loc("Use your ready time to think.")
if INTERFACE ~= "touch" then
ruleSet = ruleSet .. "|" ..
loc("Slot keys save time! (F1-F10 by default)") .. "| |"
for i=1, #frenzyAmmos do
ruleSet = ruleSet .. string.format(loc("Slot %d: %s"), i, GetAmmoName(frenzyAmmos[i])) .. "|"
end
end
ShowMission(loc("FRENZY"),
loc("A frenetic Hedgewars mini-game"),
ruleSet, -amMolotov, 4000)
end
function onGameInit()
if TurnTime > 8000 then
Ready = 8000
else
Ready = TurnTime
end
TurnTime = 1000
--These are the official settings, but I think I prefer allowing customization in this regard
--MinesNum = 8
--MinesTime = 3000
--MinesDudPercent = 30
--Explosives = 0
--Supposedly official settings
HealthCaseProb = 0
CrateFreq = 0
--Approximation of Official Settings
--SuddenDeathTurns = 10
--WaterRise = 47
--HealthDecrease = 0
for s=1, #frenzyAmmos do
SetAmmoSlot(frenzyAmmos[s], s)
end
SetAmmoSlot(amSkip, 10)
end
function onGameStart()
showStartingInfo()
end
function onSlot(sln)
cTimer = 8
cn = sln
end
function onGameTick()
if cTimer ~= 0 then
cTimer = cTimer -1
if cTimer == 1 then
ChangeWep(cn)
cn = 0
cTimer = 0
end
end
end
-- Keyboard slot shortcuts
function ChangeWep(s)
if s >= 0 and s <= 9 then
SetWeapon(frenzyAmmos[s+1])
end
end
function onAmmoStoreInit()
-- Add frenzy ammos
for i=1, #frenzyAmmos do
SetAmmo(frenzyAmmos[i], 9, 0, 0, 0)
end
SetAmmo(amSkip, 9, 0, 0, 0)
end
|
ENT.Type = "anim"
ENT.Base = "base_rd3_entity"
ENT.PrintName = "Atmospheric Probe"
list.Set("LSEntOverlayText", "other_probe", { HasOOO = false, resnames = { "energy" }}) |
workspace "openmv"
configurations { "debug", "release" }
include "core"
include "logic"
include "bootstrapper"
include "util/packer"
include "util/mksdk"
include "util/test"
include "util/imuitest"
|
local K, C, L = unpack(select(2, ...))
-- Lua API
local _G = _G
local table_wipe = table.wipe
-- Wow API
local RecountDB = _G.RecountDB
-- GLOBALS: Recount
function K.LoadRecountProfile()
if RecountDB then
table_wipe(RecountDB)
end
RecountDB["profiles"]["KkthnxUI"] = {
["Colors"] = {
["Other Windows"] = {
["Title Text"] = {
["g"] = 0.5,
["b"] = 0,
},
},
["Window"] = {
["Title Text"] = {
["g"] = 0.5,
["b"] = 0,
},
},
["Bar"] = {
["Bar Text"] = {
["a"] = 1,
},
["Total Bar"] = {
["a"] = 1,
},
},
},
["DetailWindowY"] = 0,
["DetailWindowX"] = 0,
["GraphWindowX"] = 0,
["Locked"] = true,
["FrameStrata"] = "2-LOW",
["BarTextColorSwap"] = true,
["BarTexture"] = "KkthnxUI_StatusBar",
["CurDataSet"] = "OverallData",
["ClampToScreen"] = true,
["Font"] = "KkthnxUI_Normal",
}
Recount.db:SetProfile("KkthnxUI")
end |
local LD = LibStub:NewLibrary("LibDurability", 1)
if not LD then return end -- No upgrade needed
-- Throttle times for separate channels
LD.throttleTable = LD.throttleTable or {
["RAID"] = 0,
["PARTY"] = 0,
["INSTANCE_CHAT"] = 0,
}
LD.throttleSendTable = LD.throttleSendTable or {
["RAID"] = 0,
["PARTY"] = 0,
["INSTANCE_CHAT"] = 0,
}
LD.callbackMap = LD.callbackMap or {}
LD.frame = LD.frame or CreateFrame("Frame")
local throttleTable = LD.throttleTable
local throttleSendTable = LD.throttleSendTable
local callbackMap = LD.callbackMap
local frame = LD.frame
local next, type, error, tonumber, format, match = next, type, error, tonumber, string.format, string.match
local Ambiguate, GetTime, GetInventoryItemDurability, IsInGroup, IsInRaid = Ambiguate, GetTime, GetInventoryItemDurability, IsInGroup, IsInRaid
local SendAddonMessage = C_ChatInfo and C_ChatInfo.SendAddonMessage or SendAddonMessage -- XXX 8.0
local pName = UnitName("player")
local function GetDurability()
local curTotal, maxTotal, broken = 0, 0, 0
for i = 1, 18 do
local curItemDurability, maxItemDurability = GetInventoryItemDurability(i)
if curItemDurability and maxItemDurability then
curTotal = curTotal + curItemDurability
maxTotal = maxTotal + maxItemDurability
if maxItemDurability > 0 and curItemDurability == 0 then
broken = broken + 1
end
end
end
local percent = curTotal / maxTotal * 100
return percent, broken
end
LD.GetDurability = GetDurability
if C_ChatInfo then -- XXX 8.0
C_ChatInfo.RegisterAddonMessagePrefix("Durability")
else
RegisterAddonMessagePrefix("Durability")
end
frame:SetScript("OnEvent", function(_, _, prefix, msg, channel, sender)
if prefix == "Durability" and throttleTable[channel] then
if msg == "R" then
local t = GetTime()
if t - throttleTable[channel] > 4 then
throttleTable[channel] = t
local percent, broken = GetDurability()
SendAddonMessage("Durability", format("%d,%d", percent, broken), channel)
end
return
end
local percent, broken = match(msg, "^(%d+),(%d+)$")
percent = tonumber(percent)
broken = tonumber(broken)
if percent and broken then
for _,func in next, callbackMap do
func(percent, broken, Ambiguate(sender, "none"), channel)
end
end
end
end)
frame:RegisterEvent("CHAT_MSG_ADDON")
-- For automatic group handling, don't pass a channel. The order is INSTANCE_CHAT > RAID > GROUP.
function LD:RequestDurability(channel)
if channel and not throttleSendTable[channel] then
error("LibDurability: Incorrect channel type for :RequestDurability.")
else
if not channel and IsInGroup() then
channel = IsInGroup(2) and "INSTANCE_CHAT" or IsInRaid() and "RAID" or "PARTY"
end
local percent, broken = GetDurability()
for _,func in next, callbackMap do
func(percent, broken, pName, channel) -- This allows us to show our own durability when not grouped
end
if channel then
local t = GetTime()
if t - throttleSendTable[channel] > 4 then
throttleSendTable[channel] = t
SendAddonMessage("Durability", "R", channel)
end
end
end
end
function LD:Register(addon, func)
if not addon or addon == LD then
error("LibDurability: You must pass your own addon name or object to :Register.")
end
local t = type(func)
if t == "string" then
callbackMap[addon] = function(...) addon[func](addon, ...) end
elseif t == "function" then
callbackMap[addon] = func
else
error("LibDurability: Incorrect function type for :Register.")
end
end
function LD:Unregister(addon)
if not addon or addon == LD then
error("LibDurability: You must pass your own addon name or object to :Unregister.")
end
callbackMap[addon] = nil
end
|
if SERVER then
AddCSLuaFile()
end
GM.ConVars = {}
function GM:RegisterConVar(name, value, flags, helptext, fn)
if CLIENT and bit.band(flags, FCVAR_REPLICATED) ~= 0 and bit.band(flags, FCVAR_ARCHIVE) ~= 0 then
DbgPrint("Removing FCVAR_ARCHIVE from " .. name)
flags = bit.band(flags, bit.bnot(FCVAR_ARCHIVE))
end
local prefix = "lambda_"
local actualName = prefix .. name
local actualValue = ""
if isbool(value) then
actualValue = tostring(tonumber(value))
elseif isstring(value) then
actualValue = value
else
actualValue = tostring(value)
end
local convar = CreateConVar(actualName, actualValue, flags, helptext)
self.ConVars[name] = convar
if fn ~= nil and isfunction(fn) then
cvars.AddChangeCallback(actualName, fn)
end
return convar
end
function GM:GetRegisteredConVar(name)
return self.ConVars[name]
end
if CLIENT then
lambda_crosshair = GM:RegisterConVar("crosshair", 1, bit.bor(0, FCVAR_ARCHIVE), "Lambda Crosshair")
lambda_crosshair_dynamic = GM:RegisterConVar("crosshair_dynamic", 1, bit.bor(0, FCVAR_ARCHIVE), "Dynamic crosshair")
lambda_crosshair_size = GM:RegisterConVar("crosshair_size", 8, bit.bor(0, FCVAR_ARCHIVE), "")
lambda_crosshair_width = GM:RegisterConVar("crosshair_width", 2, bit.bor(0, FCVAR_ARCHIVE), "")
lambda_crosshair_space = GM:RegisterConVar("crosshair_space", 4, bit.bor(0, FCVAR_ARCHIVE), "")
lambda_crosshair_outline = GM:RegisterConVar("crosshair_outline", 1, bit.bor(0, FCVAR_ARCHIVE), "")
lambda_crosshair_adaptive = GM:RegisterConVar("crosshair_adaptive", 1, bit.bor(0, FCVAR_ARCHIVE), "")
lambda_crosshair_color = GM:RegisterConVar("crosshair_color", "0 128 0", bit.bor(0, FCVAR_ARCHIVE), "")
lambda_crosshair_alpha = GM:RegisterConVar("crosshair_alpha", 255, bit.bor(0, FCVAR_ARCHIVE), "")
lambda_postprocess = GM:RegisterConVar("postprocess", 1, bit.bor(0, FCVAR_ARCHIVE), "Postprocessing")
lambda_hud_text_color = GM:RegisterConVar("hud_text_color", "255 208 64", bit.bor(0, FCVAR_ARCHIVE), "HUD Text Color R(0-255), G(0-255), B(0-255)")
lambda_hud_bg_color = GM:RegisterConVar("hud_bg_color", "0 0 0", bit.bor(0, FCVAR_ARCHIVE), "HUD BG Color R(0-255), G(0-255), B(0-255)")
lambda_player_color = GM:RegisterConVar("player_color", "0.3 1 1", bit.bor(0, FCVAR_ARCHIVE, FCVAR_USERINFO), "Player color")
lambda_weapon_color = GM:RegisterConVar("weapon_color", "0.3 1 1", bit.bor(0, FCVAR_ARCHIVE, FCVAR_USERINFO), "Weapon color")
lambda_playermdl = GM:RegisterConVar("playermdl", "male_01", bit.bor(0, FCVAR_ARCHIVE, FCVAR_USERINFO), "Player model")
lambda_deathnotice_time = GM:RegisterConVar("deathnotice_time", "6", bit.bor(0,FCVAR_ARCHIVE),"Deathnotice time")
lambda_auto_jump = GM:RegisterConVar("auto_jump", "0", bit.bor(0,FCVAR_ARCHIVE), "Automatically jump if on ground")
lambda_gore = GM:RegisterConVar("gore", "1", bit.bor(0, FCVAR_ARCHIVE, FCVAR_USERINFO), "Enable gore")
end
-- Server --
lambda_gametype = GM:RegisterConVar("gametype", "hl2", bit.bor(0, FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED), "Current gametype")
lambda_instance_id = GM:RegisterConVar("instance_id", 1, bit.bor(0, FCVAR_ARCHIVE, FCVAR_NOTIFY), "Allows to assign a unique instance id to support multiple srcds instances at once from the same directory.")
-- Deathmatch specific convars
lambda_dm_fraglimit = GM:RegisterConVar("dm_fraglimit", 50, bit.bor(0, FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED), "When frags are reached the round ends")
lambda_dm_timelimit = GM:RegisterConVar("dm_timelimit", 10, bit.bor(0, FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED), "When time runs out the round ends(min)")
lambda_dm_teamonly = GM:RegisterConVar("dm_teamonly", 0, bit.bor(0, FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED), "Team based deathmatch") |
local helpers = require "spec.02-integration.03-dao.helpers"
local Factory = require "kong.dao.factory"
helpers.for_each_dao(function(kong_config)
describe("Real use-cases with DB: #" .. kong_config.database, function()
local factory
setup(function()
factory = assert(Factory.new(kong_config))
assert(factory:run_migrations())
factory:truncate_tables()
end)
after_each(function()
factory:truncate_tables()
end)
it("retrieves plugins for plugins_iterator", function()
local api, err = factory.apis:insert {
name = "example",
hosts = { "example.com" },
upstream_url = "http://example.com",
}
assert.falsy(err)
local consumer, err = factory.consumers:insert {username = "bob"}
assert.falsy(err)
local key_auth, err = factory.plugins:insert {
name = "key-auth", api_id = api.id
}
assert.falsy(err)
local _, err = factory.plugins:insert {
name = "rate-limiting", api_id = api.id,
config = {minute = 1}
}
assert.falsy(err)
local rate_limiting_for_consumer, err = factory.plugins:insert {
name = "rate-limiting", api_id = api.id, consumer_id = consumer.id,
config = {minute = 1}
}
assert.falsy(err)
-- Retrieval
local rows, err = factory.plugins:find_all {
name = "key-auth",
api_id = api.id
}
assert.falsy(err)
assert.equal(1, #rows)
assert.same(key_auth, rows[1])
--
rows, err = factory.plugins:find_all {
name = "rate-limiting",
api_id = api.id
}
assert.falsy(err)
assert.equal(2, #rows)
--
rows, err = factory.plugins:find_all {
name = "rate-limiting",
api_id = api.id,
consumer_id = consumer.id
}
assert.falsy(err)
assert.equal(1, #rows)
assert.same(rate_limiting_for_consumer, rows[1])
end)
it("update a plugin config", function()
local api, err = factory.apis:insert {
name = "example",
hosts = { "example.com" },
upstream_url = "http://example.com",
}
assert.falsy(err)
local key_auth, err = factory.plugins:insert {
name = "key-auth", api_id = api.id
}
assert.falsy(err)
local updated_key_auth, err = factory.plugins:update({
config = {key_names = {"key-updated"}}
}, key_auth)
assert.falsy(err)
assert.same({"key-updated"}, updated_key_auth.config.key_names)
end)
it("does not override plugin config if partial update", function()
local api, err = factory.apis:insert {
name = "example",
hosts = { "example.com" },
upstream_url = "http://example.com",
}
assert.falsy(err)
local key_auth, err = factory.plugins:insert {
name = "key-auth", api_id = api.id,
config = {
hide_credentials = true
}
}
assert.falsy(err)
local updated_key_auth, err = factory.plugins:update({
config = {key_names = {"key-set-null-test-updated"}}
}, key_auth)
assert.falsy(err)
assert.same({"key-set-null-test-updated"}, updated_key_auth.config.key_names)
assert.True(updated_key_auth.config.hide_credentials)
end)
end)
end)
describe("#cassandra", function()
describe("LB policy", function()
it("accepts DCAwareRoundRobin", function()
local helpers = require "spec.helpers"
local kong_config = helpers.test_conf
local database = kong_config.database
local cassandra_lb_policy = kong_config.cassandra_lb_policy
local cassandra_local_datacenter = kong_config.cassandra_local_datacenter
finally(function()
kong_config.database = database
kong_config.cassandra_lb_policy = cassandra_lb_policy
kong_config.cassandra_local_datacenter = cassandra_local_datacenter
end)
kong_config.database = "cassandra"
kong_config.cassandra_lb_policy = "DCAwareRoundRobin"
kong_config.cassandra_local_datacenter = "my-dc"
assert(Factory.new(kong_config))
end)
end)
end)
|
--
-- main.lua
-- kmeans-kernels
--
-- Created by Andrey Kolishchak on 12/19/15.
--
require 'nn'
require 'optim'
require 'image'
require 'image'
require 'patches'
require 'zca'
require 'kmeans'
require 'data.dataset'
cmd = torch.CmdLine()
cmd:text()
cmd:text('k-means cnn kernels')
cmd:text()
cmd:text('Options')
cmd:option('-pass_type', 2, '0 - linear training, 1 - cnn training, 2 - kmeans cnn')
cmd:option('-kernel_width', 15, 'kernel width')
cmd:option('-kernel_num', 8, 'number of kernels')
cmd:option('-whitening', 1, 'data whitening')
cmd:option('-gpu',2,'0 - cpu, 1 - cunn, 2 - cudnn')
cmd:option('-patch_num', 50000, 'snumber of patches')
cmd:option('-epsilon', 1e-5, 'zca epsilon')
cmd:option('-learning_rate',1e-4,'learning rate')
cmd:option('-batch_size',100,'batch size')
cmd:option('-max_epoch',100,'number of passes through the training data')
cmd:option('-kmeans_iterations',100,'number of k-means iterations')
cmd:option('-output_path','images','path for output images')
local opt = cmd:parse(arg)
if opt.gpu > 0 then
require 'cunn'
if opt.gpu == 2 then
require 'cudnn'
end
end
--
-- load data
--
local dataset = load_mnist(opt)
-- white data
if opt.whitening == 1 then
print("whitening...")
dataset.train_x, zca_params = zca(dataset.train_x:double(), opt.epsilon)
dataset.test_x, _ = zca(dataset.test_x:double(), opt.epsilon, zca_params)
if opt.gpu > 0 then
dataset.train_x = dataset.train_x:cuda()
dataset.test_x = dataset.test_x:cuda()
end
collectgarbage(); collectgarbage()
end
local centroids
if opt.pass_type >= 2 then
print("clustering...")
--
-- get patches from original images
--
local patches = get_patches(dataset.train_x, opt.patch_num, opt.kernel_width)
--
-- form clusters
--
centroids = dataset.train_x.new(opt.kernel_num, dataset.train_x:size(2), opt.kernel_width*opt.kernel_width)
for channel=1,dataset.train_x:size(2) do
centroids[{{}, channel, {}}] = kmeans(patches[{{}, channel, {}}], opt.kernel_num, opt.kmeans_iterations)
end
end
--
-- convolutional model
--
local pad = ( opt.kernel_width - 1 ) / 2
local conv = nn.SpatialConvolution(dataset.train_x:size(2), opt.kernel_num, opt.kernel_width, opt.kernel_width, 1, 1, pad, pad)
local conv_model = nn.Sequential()
conv_model:add(conv)
conv_model:add(nn.ELU())
conv_model:add(nn.Reshape(opt.kernel_num*dataset.train_x:size(3)*dataset.train_x:size(4)))
--
-- linear classifier
--
local class_model = nn.Sequential()
class_model:add(nn.Linear(opt.kernel_num*dataset.train_x:size(3)*dataset.train_x:size(4), 10))
class_model:add(nn.LogSoftMax())
local model = nn.Sequential()
model:add(conv_model)
model:add(class_model)
local criterion = nn.ClassNLLCriterion()
if opt.gpu > 0 then
model:cuda()
criterion:cuda()
if opt.gpu == 2 then
cudnn.convert(model, cudnn)
cudnn.convert(criterion, cudnn)
cudnn.benchmark = true
end
end
if opt.pass_type >= 2 then
--
-- init weights of cnn
--
conv.weight:copy(centroids:view(opt.kernel_num,-1))
conv.bias:zero()
end
local params, grad_params = model:getParameters()
local conv_weights = conv.weight:view(-1, opt.kernel_width)
--
-- optimize
--
local iterations = opt.max_epoch*dataset.train_x:size(1)/opt.batch_size
local batch_start = 1
function feval(x)
if x ~= params then
params:copy(x)
end
grad_params:zero()
-- load batch
local input = dataset.train_x[{{batch_start, batch_start+opt.batch_size-1},{}}]
local target = dataset.train_y[{{batch_start, batch_start+opt.batch_size-1}}]
-- forward pass
local conv_input = conv_model:forward(input)
local output = class_model:forward(conv_input)
local loss = criterion:forward(output, target)
-- back prop
local dloss_doutput = criterion:backward(output, target)
local dloss_dclass = class_model:backward(conv_input, dloss_doutput)
if opt.pass_type == 1 then
conv_model:backward(input, dloss_dclass)
end
return loss, grad_params
end
-- train
class_model:training()
local optim_state = {learningRate = opt.learning_rate}
print("trainig...")
for it = 1,iterations do
local _, loss = optim.adam(feval, params, optim_state)
if it % 100 == 0 then
print(string.format("batch = %d, loss = %f", it, loss[1]))
end
batch_start = batch_start + opt.batch_size
if batch_start > dataset.train_x:size(1) then
batch_start = 1
end
end
class_model:evaluate()
print("evaluation...")
paths.mkdir(opt.output_path)
function get_loss(x, y, log_fails)
local match = 0.0
for i=1,x:size(1),opt.batch_size do
local input = x[{{i, i+opt.batch_size-1},{}}]
local target = y[{{i, i+opt.batch_size-1}}]
local conv_input = conv_model:forward(input)
local output = class_model:forward(conv_input)
prob, idx = torch.max(output, 2)
match = match + torch.mean(idx:eq(target):float())/(x:size(1)/opt.batch_size)
local matches = idx:eq(target)
if log_fails == true then
for j=1,matches:size(1) do
if matches[j][1] == 0 then
local k = i-1+j
image.save(opt.output_path..'/fail_'..tostring(k)..'-'..tostring(y[k])..'-'..tostring(idx[j][1])..'.jpg',x[{{k},{}}]:view(28,28))
end
end
end
end
return match
end
print(string.format("training = %.2f%%, testing = %.2f%%", get_loss(dataset.train_x, dataset.train_y, false)*100.0, get_loss(dataset.test_x, dataset.test_y, false)*100.0))
image.save(opt.output_path..'/weights-'..tostring(opt.pass_type)..'.jpg', conv_weights)
|
-----------------------------------
-- Area: Jugner Forest
-- NM: Supplespine Mujwuj
-----------------------------------
require("scripts/globals/hunts")
require("scripts/globals/status")
-----------------------------------
function onMobInitialize(mob)
mob:setMod(tpz.mod.DOUBLE_ATTACK, 100)
end
function onMobDeath(mob, player, isKiller)
tpz.hunts.checkHunt(mob, player, 160)
end
|
local status_ok, npairs = pcall(require, "nvim-autopairs")
if not status_ok then
return
end
npairs.setup({})
|
if string.format("%.0e", 0.00001) == "1e-005" then
print "===================================================================="
print "warning, detected printf() which prints a three-digit exponent."
print "see https://msdn.microsoft.com/en-us/library/0fatw238(v=vs.110).aspx"
print "to fix, recompile lua with _set_output_format(_TWO_DIGIT_EXPONENT)"
print "===================================================================="
end
--
-- in addition to above, note also that Windows printf rounds
-- differently than other implementations, including Node.js,
-- which means this test might fail when it runs on Windows,
-- unless we carefully pick fractions that round the same on
-- all implementations, for example .125.
--
print "123456789012345678901234567890123456789012345678901234567890"
print (string.format("%#.12X", 1e6))
print (string.format("%f", 3433543453))
print (string.format("%f", 3453534335434534550930986598459684956849568364564563))
print (string.format("%.10f", 123456789.125))
print (string.format("%.16f", .34335434534550930986598459684956849568364564563))
print (string.format("%.20f", 1e-20))
print (string.format("%.0f", 0.34335434534550930986598459684956849568e22))
print (string.format("%g", 44))
print (string.format("%.0g", 0.1))
print (string.format("%.0g", 0.01))
print (string.format("%.0g", 0.001))
print (string.format("%.0g", 0.0001))
print (string.format("%.0g", 0.00001))
print (string.format("%.20e", 1.4140625))
print (string.format("%.20g", 1.4140625))
print (string.format("%.20f", 1.4140625))
print (string.format("%.20e", 1234.4853515625))
print (string.format("%.20g", 1234.4853515625))
print (string.format("%.20f", 1234.4853515625))
print (string.format("%#.10e", 1234.4853515625))
print (string.format("%#.10g", 1234.4853515625))
print (string.format("%#.10f", 1234.4853515625))
print (string.format("%#.10e", 1.4140625))
print (string.format("%#.10g", 1.4140625))
print (string.format("%#.10f", 1.4140625))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.