content
stringlengths
5
1.05M
-- This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild -- -- This file is compatible with Lua 5.3 local class = require("class") require("kaitaistruct") local stringstream = require("string_stream") ExprSizeofValueSized = class.class(KaitaiStruct) function ExprSizeofValueSized:_init(io, parent, root) KaitaiStruct._init(self, io) self._parent = parent self._root = root or self self:_read() end function ExprSizeofValueSized:_read() self._raw_block1 = self._io:read_bytes(12) local _io = KaitaiStream(stringstream(self._raw_block1)) self.block1 = ExprSizeofValueSized.Block(_io, self, self._root) self.more = self._io:read_u2le() end ExprSizeofValueSized.property.self_sizeof = {} function ExprSizeofValueSized.property.self_sizeof:get() if self._m_self_sizeof ~= nil then return self._m_self_sizeof end self._m_self_sizeof = 14 return self._m_self_sizeof end ExprSizeofValueSized.property.sizeof_block = {} function ExprSizeofValueSized.property.sizeof_block:get() if self._m_sizeof_block ~= nil then return self._m_sizeof_block end self._m_sizeof_block = 12 return self._m_sizeof_block end ExprSizeofValueSized.property.sizeof_block_b = {} function ExprSizeofValueSized.property.sizeof_block_b:get() if self._m_sizeof_block_b ~= nil then return self._m_sizeof_block_b end self._m_sizeof_block_b = 4 return self._m_sizeof_block_b end ExprSizeofValueSized.property.sizeof_block_a = {} function ExprSizeofValueSized.property.sizeof_block_a:get() if self._m_sizeof_block_a ~= nil then return self._m_sizeof_block_a end self._m_sizeof_block_a = 1 return self._m_sizeof_block_a end ExprSizeofValueSized.property.sizeof_block_c = {} function ExprSizeofValueSized.property.sizeof_block_c:get() if self._m_sizeof_block_c ~= nil then return self._m_sizeof_block_c end self._m_sizeof_block_c = 2 return self._m_sizeof_block_c end ExprSizeofValueSized.Block = class.class(KaitaiStruct) function ExprSizeofValueSized.Block:_init(io, parent, root) KaitaiStruct._init(self, io) self._parent = parent self._root = root or self self:_read() end function ExprSizeofValueSized.Block:_read() self.a = self._io:read_u1() self.b = self._io:read_u4le() self.c = self._io:read_bytes(2) end
-- Copyright 2004-present Facebook. All Rights Reserved. require('fb.luaunit') require('math') require('fbtorch') require('nn') require('fbcunn.layers.cpu') require('fbcunn.layers.GroupKMaxPooling') function run_GroupKMaxPooling_updateOutput(n, d, k) -- n = number of words -- d = dimension of embeddings -- k = k-max pooling local input = torch.randn(n, d) local kmax = nn.GroupKMaxPooling(k) local output = kmax:updateOutput(input) assert(output == kmax.output) assert(output:size(1) == k) assert(output:size(2) == input:size(2)) local norms = torch.norm(input, 2, 2) local _, kmax_indices = torch.sort(norms, 1) kmax_indices = kmax_indices[{{-k,-1}}] kmax_indices = torch.sort(kmax_indices, 1) local kmax_result = torch.Tensor(k, input:size(2)) for i = 1, kmax_indices:size(1) do kmax_result:select(1, i):copy(input:select(1, kmax_indices[i][1])) end assert(torch.sum(torch.eq(kmax_result, output)) == torch.numel(output)) end function test_GroupKMaxPooling_updateOutput() run_GroupKMaxPooling_updateOutput(10, 11, 4) end function run_GroupKMaxPooling_updateOutput_batch(b, n, d, k) -- b = batch size -- n = number of words -- d = dimension of embeddings -- k = k-max pooling local input = torch.randn(b, n, d) local kmax = nn.GroupKMaxPooling(k) local output = kmax:updateOutput(input) assert(output == kmax.output) assert(output:size(1) == b) assert(output:size(2) == k) assert(output:size(3) == input:size(3)) local norms = torch.norm(input, 2, 3):squeeze() local _, kmax_indices = torch.sort(norms, 2) kmax_indices = kmax_indices:sub(1, -1, -k, -1) kmax_indices = torch.sort(kmax_indices, 2) local kmax_result = torch.Tensor(input:size(1), k, input:size(3)) kmax_result:fill(0.0) for i = 1, kmax_indices:size(1) do for j = 1, kmax_indices:size(2) do kmax_result:select(1, i):select(1, j):copy( input:select(1, i):select(1, kmax_indices[i][j])) end end assert(torch.sum(torch.eq(kmax_result, output)) == torch.numel(output)) end function test_GroupKMaxPooling_updateOutput_batch() run_GroupKMaxPooling_updateOutput_batch(15, 10, 11, 4) end function run_GroupKMaxPooling_updateGradInput(n, d, k) -- n = number of words -- d = dimension of embeddings -- k = k-max pooling local input = torch.randn(n, d) local kmax = nn.GroupKMaxPooling(k) local output = kmax:updateOutput(input) local delta = torch.randn(output:size()) local gradInput = kmax:updateGradInput(input, delta) assert(gradInput == kmax.gradInput) assert(gradInput:sum() == delta:sum()) end function test_GroupKMaxPooling_updateGradInput() run_GroupKMaxPooling_updateOutput(10, 11, 4) end function run_GroupKMaxPooling_updateGradInput_batch(b, n, d, k) -- n = number of words -- d = dimension of embeddings -- k = k-max pooling local input = torch.randn(b, n, d) local kmax = nn.GroupKMaxPooling(k) local output = kmax:updateOutput(input) local delta = torch.randn(output:size()) local gradInput = kmax:updateGradInput(input, delta) assert(gradInput == kmax.gradInput) assert(gradInput:sum() == delta:sum()) end function test_GroupKMaxPooling_updateGradInput_batch() run_GroupKMaxPooling_updateOutput(12, 10, 11, 4) end LuaUnit:main()
slot0 = class("DragonExploreView", function () return cc.LayerColor:create(cc.c4b(0, 0, 0, 128)) end) slot0.ctor = function (slot0, slot1, slot2, slot3) slot0._score_reward = slot1 slot0.controller = slot2 slot0:initUI(slot3) end slot0.initUI = function (slot0, slot1) slot0:setPositionX(slot1) slot0._skeleton = sp.SkeletonAnimation:create(Serial.Serial_Root .. "reward/lhdb_tbdj.json", Serial.Serial_Root .. "reward/lhdb_tbdj.atlas") slot0._skeleton:setAnimation(0, "start", false) slot0._skeleton:addAnimation(0, "idle", true) slot0._skeleton:setPosition(667 - slot1, slot3) slot0:addChild(slot0._skeleton) slot0._rollText2 = SerialCacheManager:getCacheObject("rolling_text_tanbao", slot4) slot5, slot6, slot7 = SerialFunc.computeIntegerReminder(slot0._score_reward) slot0._rollText2:setNumber(slot8) slot0._rollText2:setCascadeOpacityEnabled(true) slot0._rollText2:setName("rolling_text_tanbao") slot0:addChild(slot0._rollText2) slot0._button = ccui.Button:create(Serial.Serial_Root .. "ingame/fanhuiyouxi.png", Serial.Serial_Root .. "ingame/fanhuiyouxi.png", Serial.Serial_Root .. "ingame/fanhuiyouxi.png") slot0._button:setPosition(689 - slot1, 141) slot0._button:addTouchEventListener(c_func(slot0.onButtonClick_Back, slot0)) slot0:addChild(slot0._button) slot0._event_listener_mask = cc.EventListenerTouchOneByOne:create() slot0._event_listener_mask:registerScriptHandler(function () return true end, cc.Handler.EVENT_TOUCH_BEGAN) slot0._event_listener_mask:registerScriptHandler(function () return end, cc.Handler.EVENT_TOUCH_MOVED) slot0._event_listener_mask:registerScriptHandler(function () return end, cc.Handler.EVENT_TOUCH_ENDED) slot0._event_listener_mask:setSwallowTouches(true) slot0:getEventDispatcher():addEventListenerWithSceneGraphPriority(slot0._event_listener_mask, slot0) slot0._rollText2:setPosition(678 - slot1 - (slot7 * 39 + (math.ceil(slot7 / 3) - 1) * 17) * 0.5, 217.5) slot0._button:setVisible(false) slot0._rollText2:setVisible(false) slot0:runAction(cc.Sequence:create(cc.DelayTime:create(0.5), cc.CallFunc:create(function () slot0._rollText2:setVisible(true) slot0._rollText2.setVisible._rollText2:addNumber2u(slot0._score_reward) end))) slot0._button:runAction(cc.Sequence:create(cc.DelayTime:create(1.5), cc.Show:create())) end slot0.onButtonClick_Back = function (slot0, slot1, slot2) if slot2 == ccui.TouchEventType.ended then slot0._button:setEnabled(false) slot0._skeleton:setAnimation(0, "end", false) slot0:runAction(cc.Sequence:create(cc.DelayTime:create(0.5), cc.CallFunc:create(c_func(slot0.onDestroy, slot0)))) end end slot0.onButtonClick_Hall = function (slot0, slot1, slot2) if slot2 == ccui.TouchEventType.ended then slot0:onDestroy() slot0.controller:try2ExitBattle() end end slot0.onDestroy = function (slot0) slot0:getEventDispatcher():removeEventListener(slot0._event_listener_mask) EventController:dispatchEvent(Serial.Event.dragonRewardUIClose) end return slot0
local networks = {} local net_members = {} local netname = 1 bitumen.mod_storage = minetest.get_mod_storage() local mod_storage = bitumen.mod_storage networks = minetest.deserialize(mod_storage:get_string("networks")) or {} net_members = minetest.deserialize(mod_storage:get_string("net_members")) or {} netname = mod_storage:get_int("netname") or 1 local function save_data() --print("saving") mod_storage:set_string("networks", minetest.serialize(networks)) mod_storage:set_string("net_members", minetest.serialize(net_members)) mod_storage:set_int("netname", netname) end -- centralized network creation for consistency local function new_network(pos) local hash = minetest.hash_node_position(pos) print("new network: hash: ".. hash .." name: " ..netname); networks[hash] = { hash = hash, pos = {x=pos.x, y=pos.y, z=pos.z}, fluid = 'air', name = netname, count = 1, inputs = { [hash] = 1, }, outputs = {}, buffer = 0, in_pressure = -32000, } net_members[hash] = hash netname = netname + 1 return networks[hash], hash end -- check nearby nodes for existing networks local function check_merge(pos) local hash = minetest.hash_node_position(pos) local merge_list = {} local current_net = nil local found_net = 0 local check_net = function(npos) local nhash = minetest.hash_node_position(npos) local nphash = net_members[nhash] if nphash ~= nil then local pnet = networks[nphash] if nil == current_net then print("joining existing network: ".. pnet.name) net_members[hash] = nphash current_net = nphash pnet.count = pnet.count + 1 pnet.inputs[hash] = 1 table.insert(merge_list, pnet) elseif current_net == nphash then print("alternate connection to existing network") else print("found seconday network: "..pnet.name) table.insert(merge_list, pnet) end found_net = 1 end end check_net({x=pos.x, y=pos.y - 1, z=pos.z}) check_net({x=pos.x, y=pos.y + 1, z=pos.z}) check_net({x=pos.x + 1, y=pos.y, z=pos.z}) check_net({x=pos.x - 1, y=pos.y, z=pos.z}) check_net({x=pos.x, y=pos.y, z=pos.z + 1}) check_net({x=pos.x, y=pos.y, z=pos.z - 1}) return found_net, merge_list end -- merge a list of networks, if the are multiple nets in the list local function try_merge(merge_list) if #merge_list > 1 then print("\n merging "..#merge_list.." networks") local biggest = {count = 0} local mlookup = {} for _,n in ipairs(merge_list) do mlookup[n.hash] = 1 if n.count > biggest.count then biggest = n end end mlookup[biggest.hash] = 0 for k,v in pairs(net_members) do if mlookup[v] == 1 then net_members[k] = biggest.hash end end for _,n in ipairs(merge_list) do if n.hash ~= biggest.hash then biggest.count = biggest.count + n.count networks[n.hash] = nil -- delete old networks end end return biggest end return merge_list[1] end local function pnet_for(pos) local hash = minetest.hash_node_position(pos) local ph = net_members[hash] if ph == nil then return nil, hash end return networks[ph], hash end local function walk_net(opos) local members = {} local count = 0 local opnet = pnet_for(opos) if opnet == nil then return nil, 0, nil end local stack = {} table.insert(stack, opos) while #stack > 0 do local pos = table.remove(stack) local pnet, hash = pnet_for(pos) if pnet ~= nil and members[hash] == nil then -- only count members of the original node's network if pnet.name == opnet.name then members[hash] = pos count = count + 1 -- print(" found net node: " .. minetest.pos_to_string(pos)) table.insert(stack, {x=pos.x-1, y=pos.y, z=pos.z}) table.insert(stack, {x=pos.x+1, y=pos.y, z=pos.z}) table.insert(stack, {x=pos.x, y=pos.y-1, z=pos.z}) table.insert(stack, {x=pos.x, y=pos.y+1, z=pos.z}) table.insert(stack, {x=pos.x, y=pos.y, z=pos.z-1}) table.insert(stack, {x=pos.x, y=pos.y, z=pos.z+1}) end end end return members, count, opnet end -- crawls the network and assigns found nodes to the new network local function rebase_network(pos) local net, phash, hash = bitumen.pipes.get_net(pos) -- print(dump(pos)) if hash == phash then print("trying to rebase network to the same spot") return {name = 9999999} end local pipes = walk_net(pos) -- print(dump(pipes)) local new_net, new_phash = new_network(pos) -- switch all the members for h,p in pairs(pipes) do --print("reassigning " .. minetest.pos_to_string(p)) net_members[h] = new_phash new_net.count = new_net.count + 1 end return new_net, new_phash end bitumen.pipes = {} -- used by external machines to connect to a network in their on_construct callback bitumen.pipes.on_construct = function(pos) local found_net, merge_list = check_merge(pos) if found_net == 0 then local hash = minetest.hash_node_position(pos) local net = new_network(pos) end local pnet = try_merge(merge_list) --pnet.count = pnet.count + 1 -- TODO: this might be implicit somewhere else save_data() end bitumen.pipes.after_destruct = function(pos) local hash = minetest.hash_node_position(pos) local phash = net_members[hash] if phash == nil then print("wtf: pipe has no network in after_destruct") return end local pnet = networks[phash] if pnet == nil then print("wtf: no network in after_destruct for pipe") return end -- remove this node from the network net_members[hash] = nil pnet.count = pnet.count - 1 -- neighboring nodes local check_pos = { {x=pos.x+1, y=pos.y, z=pos.z}, {x=pos.x-1, y=pos.y, z=pos.z}, {x=pos.x, y=pos.y+1, z=pos.z}, {x=pos.x, y=pos.y-1, z=pos.z}, {x=pos.x, y=pos.y, z=pos.z+1}, {x=pos.x, y=pos.y, z=pos.z-1}, } local stack = {} local found = 0 -- check neighbors for network membership for _,p in ipairs(check_pos) do local h = minetest.hash_node_position(p) local lphash = net_members[h] if lphash ~= nil then local lpnet = networks[lphash] -- only process pipes/fixtures on the same network as the destroyed pipe if lpnet and lpnet.name == pnet.name then stack[h] = vector.new(p) found = found + 1 --print("check stack: "..p.x..","..p.y..","..p.z) else print("no lpnet") end else print("no lphash "..p.x..","..p.y..","..p.z) end end -- don't need to split the network if this was just on the end if found > 1 then --print("check to split the network") for h,p in pairs(stack) do print(dump(p)) print(dump(h)) -- BUG: spouts and intakes can be counted as pipes when walking the network -- just rename the net local new_pnet = rebase_network(p) -- print("split off pnet ".. new_pnet.name .. " at " .. minetest.pos_to_string(p)) -- all fluid is lost in the network atm -- some networks might get orphaned, for example, the first -- net to be rebased in a loop end end save_data() end -- used by external machines to find the network for a node bitumen.pipes.get_net = function(pos) local hash = minetest.hash_node_position(pos) local phash = net_members[hash] if phash == nil then return nil, nil, hash end return networks[phash], phash, hash end -- used by external machines to add fluid into the pipe network -- returns amount of fluid successfully pushed into the network bitumen.pipes.push_fluid = function(pos, fluid, amount, extra_pressure) local hash = minetest.hash_node_position(pos) local phash = net_members[hash] if phash == nil then --print("no network to push to") return 0 -- no network end local pnet = networks[phash] --print("fluid: "..pnet.fluid.. ", buf: "..pnet.buffer) if pnet.fluid == 'air' or pnet.buffer == 0 then if minetest.registered_nodes[fluid] and minetest.registered_nodes[fluid].groups.petroleum ~= nil then -- BUG: check for "full" nodes pnet.fluid = fluid else --print("here "..fluid.." ".. dump(minetest.registered_nodes[fluid])) return 0 -- no available liquids end else -- only suck in existing fluid if fluid ~= pnet.fluid and fluid ~= pnet.fluid.."_full" then --print("wrong fluid") return 0 end end if amount < 0 then print("!!!!!!!!!!!! push amount less than zero?") return 0 end local input_pres = math.floor(pos.y + extra_pressure + .5) pnet.in_pressure = pnet.in_pressure or -32000 if math.floor(pnet.in_pressure + .5) > input_pres then --print("backflow at intake: " .. pnet.in_pressure.. " > " ..input_pres ) return 0 end pnet.in_pressure = math.max(pnet.in_pressure, input_pres) --print("net pressure: ".. pnet.in_pressure) local rate = amount --math.max(1, math.ceil(ulevel / 2)) local cap = 64 local take = math.max(0, math.min(amount, cap - pnet.buffer)) pnet.buffer = pnet.buffer + take return take end -- used by external machines to remove fluid from the pipe network -- returns amount and fluid type bitumen.pipes.take_fluid = function(pos, max_amount, backpressure) local hash = minetest.hash_node_position(pos) local phash = net_members[hash] if phash == nil then return 0, "air" -- no network end local pnet = networks[phash] if pnet.buffer <= 0 then --print("spout: no water in pipe") return 0, "air" -- no water in the pipe end -- hack pnet.in_pressure = pnet.in_pressure or -32000 if pnet.in_pressure <= pos.y then --print("insufficient pressure at spout: ".. pnet.in_pressure .. " < " ..pos.y ) return 0, "air" end local take = math.min(pnet.buffer, max_amount) pnet.buffer = math.max(pnet.buffer - take, 0) if pnet.buffer == 0 then -- print("pipe drained " .. pnet.name) -- BUG: there might be a bug where a low pressure input can add fluid to the network with a higher spout, then a higher intake with low flow can raise the pressure of the previous fluid to the level of the comparatively lower spout pnet.in_pressure = backpressure or pos.y end return take, pnet.fluid end -- take or push into the network, based on given pressure -- returns change in fluid and fluid type -- negative if fluid was pushed into the network -- positive if fluid was taken from the network bitumen.pipes.buffer = function(pos, fluid, my_pres, avail_push, cap_take, can_change_fluid) local hash = minetest.hash_node_position(pos) local phash = net_members[hash] if phash == nil then --print("no net") return 0, "air" -- no network end local pnet = networks[phash] -- print("pressure ["..pnet.name.."] ".. pnet.in_pressure .. " - " .. my_pres) if pnet.in_pressure <= my_pres then -- push into the network -- print("push") return -bitumen.pipes.push_fluid(pos, fluid, avail_push, my_pres), fluid else -- print("take") if pnet.fluid == fluid or can_change_fluid then -- print("can take " .. cap_take) return bitumen.pipes.take_fluid(pos, cap_take, my_pres) else -- print("wrong type ".. pnet.fluid .. " - ".. fluid) return 0, "air" -- wrong fluid type end end end minetest.register_node("bitumen:intake", { description = "Petroleum Intake", drawtype = "nodebox", node_box = { type = "connected", fixed = {{-.1, -.1, -.1, .1, .1, .1}}, -- connect_bottom = connect_front = {{-.1, -.1, -.5, .1, .1, .1}}, connect_left = {{-.5, -.1, -.1, -.1, .1, .1}}, connect_back = {{-.1, -.1, .1, .1, .1, .5}}, connect_right = {{ .1, -.1, -.1, .5, .1, .1}}, connect_bottom = {{ -.1, -.5, -.1, .1, .1, .1}}, }, connects_to = { "group:petroleum_pipe"--[[, "group:petroleum_fixture"]]}, paramtype = "light", is_ground_content = false, tiles = { "default_tin_block.png" }, walkable = true, groups = { cracky = 3, petroleum_fixture = 1, }, on_construct = function(pos) print("\nintake placed at "..pos.x..","..pos.y..","..pos.z) local found_net, merge_list = check_merge(pos) if found_net == 0 then local hash = minetest.hash_node_position(pos) local net = new_network(pos) net.in_pressure = pos.y net.inputs[hash] = 1 end try_merge(merge_list) save_data() end, after_destruct = bitumen.pipes.after_destruct, }) minetest.register_abm({ nodenames = {"bitumen:intake"}, neighbors = {"group:petroleum"}, interval = 1, chance = 1, action = function(pos) local hash = minetest.hash_node_position(pos) pos.y = pos.y + 1 local unode = minetest.get_node(pos) local phash = net_members[hash] local pnet = networks[phash] if pnet.fluid == 'air' or pnet.buffer == 0 then if minetest.registered_nodes[unode.name].groups.petroleum ~= nil then -- BUG: check for "full" nodes pnet.fluid = minetest.registered_nodes[unode.name].nonfull_name --print("intake: here".. (pnet.fluid or "<nil>")) else --print("intake: no fluid available ".. pos.x.. ",".. pos.y..",".. pos.z) return -- no available liquids end else -- only suck in existing fluid if unode.name ~= pnet.fluid and unode.name ~= pnet.fluid.."_full" then --print("bitumen: no fluid near intake: " .. unode.name .. " != " .. pnet.fluid) return end end local ulevel = minetest.get_node_level(pos) if ulevel < 1 then print("!!!!!!!!!!!! intake level less than one?") return end pnet.in_pressure = pnet.in_pressure or -32000 if pnet.in_pressure > pos.y - 1 then --print("petroleum backflow at intake: " .. pnet.in_pressure.. " > " ..(pos.y - 1) ) return end pnet.in_pressure = math.max(pnet.in_pressure, pos.y - 1) local rate = math.max(1, math.ceil(ulevel / 2)) local cap = 64 local take = math.max(0, math.min(ulevel, cap - pnet.buffer)) pnet.buffer = pnet.buffer + take --print("intake took "..take.. " water") local nl = math.floor(ulevel - take + 0.5) if nl > 0 then minetest.set_node_level(pos, nl) else minetest.set_node(pos, {name = "air"}) end end }) minetest.register_node("bitumen:spout", { description = "Petroleum Spout", drawtype = "nodebox", node_box = { type = "connected", fixed = {{-.1, -.1, -.1, .1, .1, .1}}, -- connect_bottom = connect_front = {{-.1, -.1, -.5, .1, .1, .1}}, connect_left = {{-.5, -.1, -.1, -.1, .1, .1}}, connect_back = {{-.1, -.1, .1, .1, .1, .5}}, connect_right = {{ .1, -.1, -.1, .5, .1, .1}}, connect_top = {{ -.1, -.1, -.1, .1, .5, .1}}, }, connects_to = { "group:petroleum_pipe",--[[ "group:petroleum_fixture" ]]}, paramtype = "light", is_ground_content = false, tiles = { "default_copper_block.png" }, walkable = true, groups = { cracky = 3, petroleum_fixture = 1, }, on_construct = function(pos) print("\nspout placed at "..pos.x..","..pos.y..","..pos.z) local found_net, merge_list = check_merge(pos) if found_net == 0 then local hash = minetest.hash_node_position(pos) local pnet = new_network(pos) pnet.outputs[hash] = 1 end try_merge(merge_list) save_data() end, after_destruct = bitumen.pipes.after_destruct, }) minetest.register_abm({ nodenames = {"bitumen:spout"}, -- neighbors = {"group:fresh_water"}, interval = 1, chance = 1, action = function(pos) local hash = minetest.hash_node_position(pos) local phash = net_members[hash] local pnet = networks[phash] if pnet.buffer <= 0 then --print("spout: no water in pipe") return -- no water in the pipe end -- hack pnet.in_pressure = pnet.in_pressure or -32000 if pnet.in_pressure <= pos.y then --print("insufficient pressure at spout: ".. pnet.in_pressure .. " < " ..pos.y ) return end pos.y = pos.y - 1 local bnode = minetest.get_node(pos) local avail = math.min(16, pnet.buffer) -- pnet.buffer / #pnet.outputs if bnode.name == pnet.fluid then local blevel = minetest.get_node_level(pos) local cap = 64 - blevel local out = math.min(cap, math.min(avail, cap)) --print("cap: ".. cap .." avail: ".. avail .. " out: "..out) pnet.buffer = pnet.buffer - out minetest.set_node_level(pos, blevel + out) elseif bnode.name == "air" or bnode.name == "bitumen:vapor_1" or bnode.name == "bitumen:vapor_2" then local out = math.min(64, math.max(0, avail)) pnet.buffer = pnet.buffer - out minetest.set_node(pos, {name = pnet.fluid}) minetest.set_node_level(pos, out) end end }) minetest.register_node("bitumen:pipe", { description = "petroleum pipe", drawtype = "nodebox", node_box = { type = "connected", fixed = {{-.1, -.1, -.1, .1, .1, .1}}, -- connect_bottom = connect_front = {{-.1, -.1, -.5, .1, .1, .1}}, connect_left = {{-.5, -.1, -.1, -.1, .1, .1}}, connect_back = {{-.1, -.1, .1, .1, .1, .5}}, connect_right = {{ .1, -.1, -.1, .5, .1, .1}}, connect_top = {{ -.1, -.1, -.1, .1, .5, .1}}, connect_bottom = {{ -.1, -.5, -.1, .1, .1, .1}}, }, connects_to = { "group:petroleum_pipe", "group:petroleum_fixture" }, paramtype = "light", is_ground_content = false, tiles = { "default_steel_block.png" }, walkable = true, groups = { cracky = 3, petroleum_pipe = 1, }, on_construct = function(pos) print("\npipe placed at "..pos.x..","..pos.y..","..pos.z) local found_net, merge_list = check_merge(pos) if found_net == 0 then local net = new_network(pos) end try_merge(merge_list) save_data() end, after_destruct = bitumen.pipes.after_destruct, })
cprogram { ins = { "third_party/emu2/src/cpu.c", "third_party/emu2/src/loader.c", "third_party/emu2/src/main.c", "third_party/emu2/src/codepage.c", "third_party/emu2/src/dosnames.c", "third_party/emu2/src/dis.c", "third_party/emu2/src/dos.c", "third_party/emu2/src/keyb.c", "third_party/emu2/src/dbg.c", "third_party/emu2/src/timer.c", "third_party/emu2/src/utils.c", "third_party/emu2/src/video.c", }, ldflags = "-lm", outs = { "bin/emu2" } }
object_tangible_loot_creature_loot_collections_bondar_crystal = object_tangible_loot_creature_loot_collections_shared_bondar_crystal:new { } ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_bondar_crystal, "object/tangible/loot/creature/loot/collections/bondar_crystal.iff")
--------------------------------------------------------------------------------------------------- -- User story: TBD -- Use case: TBD -- -- Requirement summary: -- [SDL_RC] TBD -- -- Description: -- In case: -- 1) RC app1 and RC app2 are registered -- 2) Module_1 is allocated by app1 -- 3) App2 allocates the allocated module_1 by app1 -- SDL must: -- 1) Send OnRCStatus notifications to RC apps and to HMI by app2 tries allocate the allocated module by app1 --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') local common = require('test_scripts/RC/OnRCStatus/commonOnRCStatus') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false --[[ Local Variables ]] local freeModules = common.getAllModules() local allocatedModules = { [1] = {}, [2] = {} } --[[ Local Functions ]] local function alocateModuleFirstApp(pModuleType) local pModuleStatusAllocatedApp, pModuleStatusAnotherApp = common.setModuleStatus(freeModules, allocatedModules, "CLIMATE") common.rpcAllowed(pModuleType, 1, "SetInteriorVehicleData") common.validateOnRCStatusForApp(1, pModuleStatusAllocatedApp) common.validateOnRCStatusForApp(2, pModuleStatusAnotherApp) common.validateOnRCStatusForHMI(2, { pModuleStatusAllocatedApp, pModuleStatusAnotherApp }, 1) end local function alocateModuleSecondApp(pModuleType) local pModuleStatusAllocatedApp, pModuleStatusAnotherApp = common.setModuleStatus(freeModules, allocatedModules, "CLIMATE", 2) common.rpcAllowed(pModuleType, 2, "SetInteriorVehicleData") common.validateOnRCStatusForApp(2, pModuleStatusAllocatedApp) common.validateOnRCStatusForApp(1, pModuleStatusAnotherApp) common.validateOnRCStatusForHMI(2, { pModuleStatusAnotherApp, pModuleStatusAllocatedApp }, 2) end --[[ Scenario ]] runner.Title("Preconditions") runner.Step("Clean environment", common.preconditions) runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) runner.Step("Register RC application 1", common.registerRCApplication, { 1 }) runner.Step("Register RC application 2", common.registerRCApplication, { 2 }) runner.Step("Activate App 1", common.activateApp) runner.Title("Test") runner.Step("App1 allocates module CLIMATE", alocateModuleFirstApp, { "CLIMATE"}) runner.Step("Activate App 2", common.activateApp, { 2 }) runner.Step("App2 allocates module CLIMATE", alocateModuleSecondApp, { "CLIMATE"}) runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions)
--proc/monitor: Multiple display monitors functions setfenv(1, require'winapi') require'winapi.window' --creation ffi.cdef [[ static const int CCHDEVICENAME = 32; typedef struct tagMONITORINFOEXW { DWORD cbSize; RECT rcMonitor; RECT rcWork; DWORD dwFlags; WCHAR szDevice[CCHDEVICENAME]; } MONITORINFOEXW, MONITORINFOEX, *LPMONITORINFOEXW, *LPMONITORINFOEX; BOOL GetMonitorInfoW( HMONITOR hMonitor, LPMONITORINFOEXW lpmi ); HMONITOR MonitorFromWindow( HWND hwnd, DWORD flags ); ]] MONITORINFOEX = struct { ctype='MONITORINFOEX', size='cbSize', } MONITOR_DEFAULTTONULL = 0 MONITOR_DEFAULTTOPRIMARY = 1 MONITOR_DEFAULTTONEAREST = 2 function MonitorFromWindow(hwnd, f) return C.MonitorFromWindow(hwnd, flags(f)) end function GetMonitorInfo(hMonitor, monitorInfo) monitorInfo = MONITORINFOEX(monitorInfo) checknz(C.GetMonitorInfoW(hMonitor, monitorInfo)) return monitorInfo end
--- Class describes CryptoKey object -- -- The object could be created directly, use @{Crypto:Key} instead -- @classmod CryptoKey -- @pragma nostrip setfenv(1, require "sysapi-ns") local CryptoKey = SysapiMod("CryptoKey") local CryptoKey_MT = {__index = CryptoKey, __call = CryptoKey.new} local advapi32 = ffi.load("advapi32") function CryptoKey.new(providerHandle, algo, flags) local key = ffi.new("HCRYPTKEY[1]") if advapi32.CryptGenKey(providerHandle, algo, flags or 0, key) ~= 0 then return setmetatable({handle = ffi.gc(key, advapi32.CryptDestroyKey)[0]}, CryptoKey_MT) end end function CryptoKey.newFromHandle(keyHandle) return setmetatable({handle = keyHandle}, CryptoKey_MT) end function CryptoKey.import(providerHandle, blob) local keyHandle = ffi.new("HCRYPTKEY[1]", 0) if advapi32.CryptImportKey( providerHandle, ffi.cast("char*", blob), ffi.sizeof(blob[0]), 0, CRYPT_EXPORTABLE, keyHandle ) ~= 0 then return setmetatable({handle = ffi.gc(keyHandle, advapi32.CryptDestroyKey)[0]}, CryptoKey_MT) end end function interp(s, tab) return (s:gsub( "%%%((%a%w*)%)([-0-9%.]*[cdeEfgGiouxXsq])", function(k, fmt) return tab[k] and ("%" .. fmt):format(tab[k]) or "%(" .. k .. ")" .. fmt end )) end local function createType(bitlen) local privTypeName = ("PPRIVATEKEYBLOB_${bitlen}"):interpolate({bitlen = bitlen}) pcall( ffi.cdef, ([[ typedef struct { BYTE modulus[${bitlen8}]; BYTE prime1[${bitlen16}]; BYTE prime2[${bitlen16}]; BYTE exponent1[${bitlen16}]; BYTE exponent2[${bitlen16}]; BYTE coefficient[${bitlen16}]; BYTE privateExponent[${bitlen8}]; } ${privTypeName}, *P${privTypeName}; ]]):interpolate( {privTypeName = privTypeName, bitlen = bitlen, bitlen8 = bitlen / 8, bitlen16 = bitlen / 16} ) ) local typeName = ("PRIVATEKEYBLOB_${bitlen}"):interpolate({bitlen = bitlen}) pcall( ffi.cdef, ([[ typedef struct { PUBLICKEYSTRUC hdr; RSAPUBKEY pubkey; ${privTypeName} priv; } ${typeName}, *P${typeName}; ]]):interpolate( {privTypeName = privTypeName, typeName = typeName} ) ) return typeName end --- Export key to a binary blob -- @param blobType key blob type - `CryptExportKey` `dwBlobType` parameter -- @return typed pointer or string depending on `blobType` function CryptoKey:export(blobType) local size = ffi.new("DWORD[1]", 0) if advapi32.CryptExportKey(self.handle, 0, blobType, 0, nil, size) ~= 0 then size[0] = size[0] * 2 local blob = ffi.new("BYTE[?]", size[0]) if advapi32.CryptExportKey(self.handle, 0, blobType, 0, blob, size) ~= 0 then if blobType == PLAINTEXTKEYBLOB then return ffi.cast("PPLAINTEXTKEYBLOB", blob) elseif blobType == PRIVATEKEYBLOB then local b = ffi.cast("PPRIVATEKEYBLOB", blob) local typeName = createType(b.pubkey.bitlen) return ffi.cast(typeName .. "*", blob) else return ffi.string(blob, size[0]) end end end end return CryptoKey
--[[ Seriál "Programovací jazyk Lua" Demonstrační příklad k článku: Lua Fun: knihovna pro zpracování konečných i nekonečných sekvencí v jazyce Lua ]] -- načtení knihovny Lua Fun a současně import symbolů do globálního jmenného prostoru require "fun"() -- pomocná funkce pro tisk několika prvků nekonečné sekvence function printZippedSequence(sequence, n) i = 0 for index, a, b, c in iter(sequence) do i = i + 1 if i > n then break end print(index, a, b, c) end end -- vlastní generátor function my_generator(x) return (x+1)*(x+1) end -- inicializovat vlastní generátor g1 = tabulate(my_generator) -- další generátor nekonečné sekvence g2 = xrepeat("*") -- třetí generátor nekonečné sekvence g3 = zeros() -- vytvoření zipu ze tří sekvencí z1 = zip(g1, g2, g3) print() print("Zipped sequence (first ten items from infinite sequence)") print("--------------------------------------------------------") printZippedSequence(z1, 10) -- finito
object_mobile_vehicle_light_bending_barc = object_mobile_vehicle_shared_light_bending_barc:new { templateType = VEHICLE, decayRate = 15, -- Damage tick per decay cycle decayCycle = 600 -- Time in seconds per cycle } ObjectTemplates:addTemplate(object_mobile_vehicle_light_bending_barc, "object/mobile/vehicle/light_bending_barc.iff")
-- Attack with Antiship Missiles -- -- This script will start a limited-munition-attack task -- for each missile that is to be launched. Each one -- is an instantaneous attack, and each is started -- as soon as the previous one is complete. Multiple-missile -- attacks are implemented as multiple limited-munition-attacks -- so that they each resolve independently for P(hit). -- Anti-ship missile attacks are not "indirect" attacks, -- so it is possible to configure a ship such that the -- missile combat effect is different for different sectors. -- Some basic VRF Utilities defined in a common module. require "vrfutil" require "aggregateUtils" -- Set to true to print more detail to debug console DEBUG_DETAIL = true -- Global Variables. Global variables get saved when a scenario gets checkpointed. -- They get re-initialized when a checkpointed scenario is loaded. local allIFWeapons = this:getStateProperty("Indirect-Fire-Power") local ammoByCategory = this:getStateProperty("Ammunition-Categories") attackingWeapon = "" attackSubtaskId = -1 attacksRemaining = taskParameters.numMissiles -- Task Parameters Available in Script -- taskParameters.targetShip Type: SimObject -- taskParameters.numMissiles Type: Integer function hasAmmo(weaponName) local result = false -- For weapon system ammo, weapon name and category are the same local ammoStatus = ammoByCategory[weaponName] if ammoStatus ~= nil then if ammoStatus.Count >= 1 then result = true end else printDebug("No ammo with category %s", weaponName) for ammoCatName, ammoCatInfo in pairs(ammoByCategory) do printDebug("__ %s", ammoCatName) end end return result end function inRange(weaponInfo, targetRange) local result = false if weaponInfo ~= nil then local maxRange = weaponInfo["Range"] if maxRange ~= nil then if targetRange <= maxRange then result = true end else printWarn(vrf:trUtf8("Attack with anti-ship: can't get range for weapon %1."): arg(weaponName)) end end return result end -- Called when the task first starts. Never called again. function init() if DEBUG_DETAIL then printDebug("Starting attack-with-antiship missile init function") end if allIFWeapons == nil or ammoByCategory == nil then printWarn(vrf:trUtf8("Error: Attack with Anti-ship: Parameter table(s) nil.")) vrf:endTask(false) elseif taskParameters.targetShip == this then printWarn(vrf:trUtf8("Error: Attack with Anti-Surface: cannot target self.")) vrf:endTask(false) elseif not taskParameters.targetShip:isValid() then printWarn(vrf:trUtf8("Error: Attack with Anti-Surface: no target selected.")) vrf:endTask(false) elseif not (vrf:entityTypeMatches(taskParameters.targetShip:getEntityType(), EntityType.AggregateSurface()) or vrf:entityTypeMatches(taskParameters.targetShip:getEntityType(), EntityType.AggregateSubsurface())) then printWarn(vrf:trUtf8("Error: Attack with Anti-Surface: Target is not aggregate surface.")) vrf:endTask(false) elseif this:getEmbarkedOn():isValid() then printWarn(vrf:trUtf8("Attack with Anti-Surface: Cannot attack while embarked.")) vrf:endTask(false) else vrf:setTickPeriod(2.0) local targetLoc = taskParameters.targetShip:getLocation3D() local terrainAlt = vrf:getTerrainAltitude(targetLoc:getLat(), targetLoc:getLon()) if targetLoc:getAlt() - terrainAlt < -0.5 then printWarn(vrf:trUtf8("Cannot attack submerged vessel with missile")) vrf:endTask(false) else local rangeToTarget = this:getLocation3D():distanceToLocation3D(targetLoc) local weapon = "" local weaponInfo = nil local foundWeapon = false local wrongPosture = false local myPosture = this:getStateProperty("Posture") for weapon, weaponInfo in pairs(allIFWeapons) do if DEBUG_DETAIL then printDebug("Considering weapon ", weapon) end if string.find(string.lower(weapon), "missile") and weaponInfo["Damage-Type"] == "Anti-Ship" then if DEBUG_DETAIL then printDebug("...anti-ship type, missile") end if hasAmmo(weapon) and inRange(weaponInfo, rangeToTarget) then if postureAllowsWeaponUse(weaponInfo, myPosture) then attackingWeapon = weapon foundWeapon = true if DEBUG_DETAIL then printDebug(string.format("Weapon %s found for attack", attackingWeapon)) end break else -- If a weapon can't be used just because of posture, warn the user wrongPosture = true end else if DEBUG_DETAIL then if not hasAmmo(weapon) then printDebug("...No ammo") end if not inRange(weaponInfo, rangeToTarget) then printDebug("...Out of range (range ", rangeToTarget, ")") end end end end end if not foundWeapon then printWarn(vrf:trUtf8("Cannot fire. Possible reasons include: no appropriate weapon system, out of ammunition, target out of range.")) if wrongPosture then printWarn(vrf:trUtf8("At least one anti-ship missile cannot be used in the current posture.")) end vrf:endTask(false) end end end end -- Called each tick while this task is active. function tick() if attackSubtaskId == -1 then -- Start indirect fire subtask attackSubtaskId = vrf:startSubtask("Limited_Munition_Attack", {NumberOfAttacks=1, TargetEntity=taskParameters.targetShip, Weapon=attackingWeapon, CheckRange=true, Instantaneous=true, IsIndirect = false}) attacksRemaining = attacksRemaining - 1 if DEBUG_DETAIL then printDebug("Attack-with-antiship is launching a missile") end elseif vrf:isSubtaskComplete(attackSubtaskId) then if attacksRemaining > 0 and vrf:subtaskResult(attackSubtaskId) then -- Start indirect fire subtask attackSubtaskId = vrf:startSubtask("Limited_Munition_Attack", {NumberOfAttacks=1, TargetEntity=taskParameters.targetShip, Weapon=attackingWeapon, CheckRange=true, Instantaneous=true, IsIndirect = false}) attacksRemaining = attacksRemaining - 1 if DEBUG_DETAIL then printDebug("Attack-with-antiship is launching a missile") end else vrf:endTask(true) end end end -- Called when this task is being suspended, likely by a reaction activating. function suspend() -- By default, halt all subtasks and other entity tasks started by this task when suspending. vrf:stopAllSubtasks() vrf:stopAllTasks() end -- Called when this task is being resumed after being suspended. function resume() -- By default, simply call init() to start the task over. init() end -- Called immediately before a scenario checkpoint is saved when -- this task is active. -- It is typically not necessary to add code to this function. function saveState() end -- Called immediately after a scenario checkpoint is loaded in which -- this task is active. -- It is typically not necessary to add code to this function. function loadState() end -- Called when this task is ending, for any reason. -- It is typically not necessary to add code to this function. function shutdown() end -- Called whenever the entity receives a text report message while -- this task is active. -- message is the message text string. -- sender is the SimObject which sent the message. function receiveTextMessage(message, sender) end
local command = wincent.vim.command local nmap = wincent.vim.nmap -- -- Settings. -- vim.g.CommandTCancelMap = {'<ESC>', '<C-c>'} local term = vim.api.nvim_get_option('term') -- because `vim.o.term` goes 💥 if vim.regex('screen|tmux|xterm'):match_str(term) then vim.g.CommandTSelectNextMap = {'<C-j>', '<Down>', '<ESC>OB'} vim.g.CommandTSelectPrevMap = {'<C-k>', '<Up>', '<ESC>OA'} end vim.g.CommandTEncoding = 'UTF-8' vim.g.CommandTFileScanner = 'watchman' vim.g.CommandTInputDebounce = 50 vim.g.CommandTMaxCachedDirectories = 10 vim.g.CommandTMaxFiles = 3000000 vim.g.CommandTScanDotDirectories = 1 vim.g.CommandTTraverseSCM = 'pwd' vim.g.CommandTWildIgnore = vim.o.wildignore .. ',*/.git/*' .. ',*/.hg/*' .. ',*/bower_components/*' .. ',*/tmp/*' .. ',*.class' .. ',*/classes/*' .. ',*/build/*' -- Allow Command-T to open selections in dirvish windows. vim.g.CommandTWindowFilter = '!&buflisted && &buftype == "nofile" && &filetype !=# "dirvish"' -- -- Mappings. -- nmap('<LocalLeader>c', '<Plug>(CommandTCommand)', {unique = true}) nmap('<Leader>h', '<Plug>(CommandTHelp)', {unique = true}) nmap('<LocalLeader>h', '<Plug>(CommandTHistory)', {unique = true}) nmap('<LocalLeader>l', '<Plug>(CommandTLine)', {unique = true}) -- Convenience for starting Command-T at launch without causing freak-out inside -- tmux. -- -- BUG: As of 2021-07-19, it's pretty much freaking out a lot — 😂 local show = nil local tries = 20 show = function() if vim.v.vim_did_enter == 1 then vim.cmd('CommandT') else if tries > 0 then tries = tries - 1 vim.defer_fn(show, 100) else vim.cmd [[ echoerr "Startup too slow: giving up waiting to :CommandTBoot" ]] end end end command('CommandTBoot', show)
local mgn = mgn mgn.VOXList = { ["_comma"] = {Path = "sound/vox/_comma.wav", Duration = 0.248889}, ["_period"] = {Path = "sound/vox/_period.wav", Duration = 0.431202}, ["a"] = {Path = "sound/vox/a.wav", Duration = 0.372789}, ["accelerating"] = {Path = "sound/vox/accelerating.wav", Duration = 1.136871}, ["accelerator"] = {Path = "sound/vox/accelerator.wav", Duration = 1.180136}, ["accepted"] = {Path = "sound/vox/accepted.wav", Duration = 0.876100}, ["access"] = {Path = "sound/vox/access.wav", Duration = 0.817687}, ["acknowledge"] = {Path = "sound/vox/acknowledge.wav", Duration = 0.914558}, ["acknowledged"] = {Path = "sound/vox/acknowledged.wav", Duration = 0.869841}, ["acquired"] = {Path = "sound/vox/acquired.wav", Duration = 0.833923}, ["acquisition"] = {Path = "sound/vox/acquisition.wav", Duration = 0.873379}, ["across"] = {Path = "sound/vox/across.wav", Duration = 0.785669}, ["activate"] = {Path = "sound/vox/activate.wav", Duration = 0.795918}, ["activated"] = {Path = "sound/vox/activated.wav", Duration = 0.954104}, ["activity"] = {Path = "sound/vox/activity.wav", Duration = 0.973333}, ["adios"] = {Path = "sound/vox/adios.wav", Duration = 0.946667}, ["administration"] = {Path = "sound/vox/administration.wav", Duration = 1.241633}, ["advanced"] = {Path = "sound/vox/advanced.wav", Duration = 0.799002}, ["after"] = {Path = "sound/vox/after.wav", Duration = 0.652336}, ["agent"] = {Path = "sound/vox/agent.wav", Duration = 0.634830}, ["alarm"] = {Path = "sound/vox/alarm.wav", Duration = 0.672472}, ["alert"] = {Path = "sound/vox/alert.wav", Duration = 0.539955}, ["alien"] = {Path = "sound/vox/alien.wav", Duration = 0.680000}, ["aligned"] = {Path = "sound/vox/aligned.wav", Duration = 0.792109}, ["all"] = {Path = "sound/vox/all.wav", Duration = 0.528707}, ["alpha"] = {Path = "sound/vox/alpha.wav", Duration = 0.621769}, ["am"] = {Path = "sound/vox/am.wav", Duration = 0.418503}, ["amigo"] = {Path = "sound/vox/amigo.wav", Duration = 0.657052}, ["ammunition"] = {Path = "sound/vox/ammunition.wav", Duration = 0.887075}, ["an"] = {Path = "sound/vox/an.wav", Duration = 0.414331}, ["and"] = {Path = "sound/vox/and.wav", Duration = 0.399909}, ["announcement"] = {Path = "sound/vox/announcement.wav", Duration = 0.784853}, ["anomalous"] = {Path = "sound/vox/anomalous.wav", Duration = 0.821224}, ["antenna"] = {Path = "sound/vox/antenna.wav", Duration = 0.717279}, ["any"] = {Path = "sound/vox/any.wav", Duration = 0.384036}, ["apprehend"] = {Path = "sound/vox/apprehend.wav", Duration = 0.782766}, ["approach"] = {Path = "sound/vox/approach.wav", Duration = 0.807256}, ["are"] = {Path = "sound/vox/are.wav", Duration = 0.312200}, ["area"] = {Path = "sound/vox/area.wav", Duration = 0.556463}, ["arm"] = {Path = "sound/vox/arm.wav", Duration = 0.617959}, ["armed"] = {Path = "sound/vox/armed.wav", Duration = 0.587846}, ["armor"] = {Path = "sound/vox/armor.wav", Duration = 0.529524}, ["armory"] = {Path = "sound/vox/armory.wav", Duration = 0.708390}, ["arrest"] = {Path = "sound/vox/arrest.wav", Duration = 0.553469}, ["ass"] = {Path = "sound/vox/ass.wav", Duration = 0.564082}, ["at"] = {Path = "sound/vox/at.wav", Duration = 0.290884}, ["atomic"] = {Path = "sound/vox/atomic.wav", Duration = 0.769524}, ["attention"] = {Path = "sound/vox/attention.wav", Duration = 0.805714}, ["authorize"] = {Path = "sound/vox/authorize.wav", Duration = 1.081451}, ["authorized"] = {Path = "sound/vox/authorized.wav", Duration = 1.047438}, ["automatic"] = {Path = "sound/vox/automatic.wav", Duration = 0.868390}, ["away"] = {Path = "sound/vox/away.wav", Duration = 0.512744}, ["b"] = {Path = "sound/vox/b.wav", Duration = 0.514286}, ["back"] = {Path = "sound/vox/back.wav", Duration = 0.541950}, ["backman"] = {Path = "sound/vox/backman.wav", Duration = 0.621587}, ["bad"] = {Path = "sound/vox/bad.wav", Duration = 0.581678}, ["bag"] = {Path = "sound/vox/bag.wav", Duration = 0.552472}, ["bailey"] = {Path = "sound/vox/bailey.wav", Duration = 0.661950}, ["barracks"] = {Path = "sound/vox/barracks.wav", Duration = 0.688435}, ["base"] = {Path = "sound/vox/base.wav", Duration = 0.592562}, ["bay"] = {Path = "sound/vox/bay.wav", Duration = 0.546485}, ["be"] = {Path = "sound/vox/be.wav", Duration = 0.348209}, ["been"] = {Path = "sound/vox/been.wav", Duration = 0.407166}, ["before"] = {Path = "sound/vox/before.wav", Duration = 0.684898}, ["beyond"] = {Path = "sound/vox/beyond.wav", Duration = 0.604354}, ["biohazard"] = {Path = "sound/vox/biohazard.wav", Duration = 1.116735}, ["biological"] = {Path = "sound/vox/biological.wav", Duration = 1.108027}, ["birdwell"] = {Path = "sound/vox/birdwell.wav", Duration = 0.722993}, ["bizwarn"] = {Path = "sound/vox/bizwarn.wav", Duration = 0.888435}, ["black"] = {Path = "sound/vox/black.wav", Duration = 0.538141}, ["blast"] = {Path = "sound/vox/blast.wav", Duration = 0.614059}, ["blocked"] = {Path = "sound/vox/blocked.wav", Duration = 0.588934}, ["bloop"] = {Path = "sound/vox/bloop.wav", Duration = 0.609342}, ["blue"] = {Path = "sound/vox/blue.wav", Duration = 0.423039}, ["bottom"] = {Path = "sound/vox/bottom.wav", Duration = 0.569705}, ["bravo"] = {Path = "sound/vox/bravo.wav", Duration = 0.675283}, ["breach"] = {Path = "sound/vox/breach.wav", Duration = 0.632834}, ["breached"] = {Path = "sound/vox/breached.wav", Duration = 0.569796}, ["break"] = {Path = "sound/vox/break.wav", Duration = 0.533061}, ["bridge"] = {Path = "sound/vox/bridge.wav", Duration = 0.567528}, ["bust"] = {Path = "sound/vox/bust.wav", Duration = 0.543673}, ["but"] = {Path = "sound/vox/but.wav", Duration = 0.354739}, ["button"] = {Path = "sound/vox/button.wav", Duration = 0.559728}, ["buzwarn"] = {Path = "sound/vox/buzwarn.wav", Duration = 0.781224}, ["bypass"] = {Path = "sound/vox/bypass.wav", Duration = 0.909297}, ["c"] = {Path = "sound/vox/c.wav", Duration = 0.529887}, ["cable"] = {Path = "sound/vox/cable.wav", Duration = 0.539229}, ["call"] = {Path = "sound/vox/call.wav", Duration = 0.526077}, ["called"] = {Path = "sound/vox/called.wav", Duration = 0.513107}, ["canal"] = {Path = "sound/vox/canal.wav", Duration = 0.729252}, ["cap"] = {Path = "sound/vox/cap.wav", Duration = 0.514830}, ["captain"] = {Path = "sound/vox/captain.wav", Duration = 0.729796}, ["capture"] = {Path = "sound/vox/capture.wav", Duration = 0.738594}, ["ceiling"] = {Path = "sound/vox/ceiling.wav", Duration = 0.611973}, ["celsius"] = {Path = "sound/vox/celsius.wav", Duration = 0.970703}, ["center"] = {Path = "sound/vox/center.wav", Duration = 0.688707}, ["centi"] = {Path = "sound/vox/centi.wav", Duration = 0.533605}, ["central"] = {Path = "sound/vox/central.wav", Duration = 0.729161}, ["chamber"] = {Path = "sound/vox/chamber.wav", Duration = 0.717460}, ["charlie"] = {Path = "sound/vox/charlie.wav", Duration = 0.622222}, ["check"] = {Path = "sound/vox/check.wav", Duration = 0.539501}, ["checkpoint"] = {Path = "sound/vox/checkpoint.wav", Duration = 0.874376}, ["chemical"] = {Path = "sound/vox/chemical.wav", Duration = 0.670748}, ["cleanup"] = {Path = "sound/vox/cleanup.wav", Duration = 0.746848}, ["clear"] = {Path = "sound/vox/clear.wav", Duration = 0.538413}, ["clearance"] = {Path = "sound/vox/clearance.wav", Duration = 0.732880}, ["close"] = {Path = "sound/vox/close.wav", Duration = 0.608435}, ["code"] = {Path = "sound/vox/code.wav", Duration = 0.546304}, ["coded"] = {Path = "sound/vox/coded.wav", Duration = 0.568073}, ["collider"] = {Path = "sound/vox/collider.wav", Duration = 0.769977}, ["command"] = {Path = "sound/vox/command.wav", Duration = 0.642902}, ["communication"] = {Path = "sound/vox/communication.wav", Duration = 1.159274}, ["complex"] = {Path = "sound/vox/complex.wav", Duration = 0.685170}, ["computer"] = {Path = "sound/vox/computer.wav", Duration = 0.757460}, ["condition"] = {Path = "sound/vox/condition.wav", Duration = 0.709478}, ["containment"] = {Path = "sound/vox/containment.wav", Duration = 0.909660}, ["contamination"] = {Path = "sound/vox/contamination.wav", Duration = 1.123537}, ["control"] = {Path = "sound/vox/control.wav", Duration = 0.883447}, ["coolant"] = {Path = "sound/vox/coolant.wav", Duration = 0.526259}, ["coomer"] = {Path = "sound/vox/coomer.wav", Duration = 0.589569}, ["core"] = {Path = "sound/vox/core.wav", Duration = 0.730159}, ["correct"] = {Path = "sound/vox/correct.wav", Duration = 0.553832}, ["corridor"] = {Path = "sound/vox/corridor.wav", Duration = 0.653152}, ["crew"] = {Path = "sound/vox/crew.wav", Duration = 0.541587}, ["cross"] = {Path = "sound/vox/cross.wav", Duration = 0.626122}, ["cryogenic"] = {Path = "sound/vox/cryogenic.wav", Duration = 0.995646}, ["d"] = {Path = "sound/vox/d.wav", Duration = 0.535329}, ["dadeda"] = {Path = "sound/vox/dadeda.wav", Duration = 0.887982}, ["damage"] = {Path = "sound/vox/damage.wav", Duration = 0.724807}, ["damaged"] = {Path = "sound/vox/damaged.wav", Duration = 0.671474}, ["danger"] = {Path = "sound/vox/danger.wav", Duration = 0.707211}, ["day"] = {Path = "sound/vox/day.wav", Duration = 0.446712}, ["deactivated"] = {Path = "sound/vox/deactivated.wav", Duration = 1.097143}, ["decompression"] = {Path = "sound/vox/decompression.wav", Duration = 1.068027}, ["decontamination"] = {Path = "sound/vox/decontamination.wav", Duration = 1.317914}, ["deeoo"] = {Path = "sound/vox/deeoo.wav", Duration = 0.682812}, ["defense"] = {Path = "sound/vox/defense.wav", Duration = 0.812971}, ["degrees"] = {Path = "sound/vox/degrees.wav", Duration = 0.724535}, ["delta"] = {Path = "sound/vox/delta.wav", Duration = 0.490340}, ["denied"] = {Path = "sound/vox/denied.wav", Duration = 0.670113}, ["deploy"] = {Path = "sound/vox/deploy.wav", Duration = 0.752834}, ["deployed"] = {Path = "sound/vox/deployed.wav", Duration = 0.836372}, ["destroy"] = {Path = "sound/vox/destroy.wav", Duration = 0.736780}, ["destroyed"] = {Path = "sound/vox/destroyed.wav", Duration = 0.856236}, ["detain"] = {Path = "sound/vox/detain.wav", Duration = 0.684898}, ["detected"] = {Path = "sound/vox/detected.wav", Duration = 0.799093}, ["detonation"] = {Path = "sound/vox/detonation.wav", Duration = 0.836372}, ["device"] = {Path = "sound/vox/device.wav", Duration = 0.856417}, ["did"] = {Path = "sound/vox/did.wav", Duration = 0.403810}, ["die"] = {Path = "sound/vox/die.wav", Duration = 0.496327}, ["dimensional"] = {Path = "sound/vox/dimensional.wav", Duration = 0.836281}, ["dirt"] = {Path = "sound/vox/dirt.wav", Duration = 0.403810}, ["disengaged"] = {Path = "sound/vox/disengaged.wav", Duration = 1.095147}, ["dish"] = {Path = "sound/vox/dish.wav", Duration = 0.625397}, ["disposal"] = {Path = "sound/vox/disposal.wav", Duration = 0.813878}, ["distance"] = {Path = "sound/vox/distance.wav", Duration = 0.696961}, ["distortion"] = {Path = "sound/vox/distortion.wav", Duration = 0.947302}, ["do"] = {Path = "sound/vox/do.wav", Duration = 0.459955}, ["doctor"] = {Path = "sound/vox/doctor.wav", Duration = 0.600907}, ["doop"] = {Path = "sound/vox/doop.wav", Duration = 1.145669}, ["door"] = {Path = "sound/vox/door.wav", Duration = 0.477914}, ["down"] = {Path = "sound/vox/down.wav", Duration = 0.536508}, ["dual"] = {Path = "sound/vox/dual.wav", Duration = 0.458231}, ["duct"] = {Path = "sound/vox/duct.wav", Duration = 0.443447}, ["e"] = {Path = "sound/vox/e.wav", Duration = 0.455147}, ["east"] = {Path = "sound/vox/east.wav", Duration = 0.509841}, ["echo"] = {Path = "sound/vox/echo.wav", Duration = 0.522086}, ["ed"] = {Path = "sound/vox/ed.wav", Duration = 0.362268}, ["effect"] = {Path = "sound/vox/effect.wav", Duration = 0.572971}, ["egress"] = {Path = "sound/vox/egress.wav", Duration = 0.709206}, ["eight"] = {Path = "sound/vox/eight.wav", Duration = 0.481542}, ["eighteen"] = {Path = "sound/vox/eighteen.wav", Duration = 0.645714}, ["eighty"] = {Path = "sound/vox/eighty.wav", Duration = 0.507302}, ["electric"] = {Path = "sound/vox/electric.wav", Duration = 0.691156}, ["electromagnetic"] = {Path = "sound/vox/electromagnetic.wav", Duration = 1.430476}, ["elevator"] = {Path = "sound/vox/elevator.wav", Duration = 0.746304}, ["eleven"] = {Path = "sound/vox/eleven.wav", Duration = 0.643628}, ["eliminate"] = {Path = "sound/vox/eliminate.wav", Duration = 0.812336}, ["emergency"] = {Path = "sound/vox/emergency.wav", Duration = 0.943764}, ["energy"] = {Path = "sound/vox/energy.wav", Duration = 0.643356}, ["engage"] = {Path = "sound/vox/engage.wav", Duration = 0.848889}, ["engaged"] = {Path = "sound/vox/engaged.wav", Duration = 0.826667}, ["engine"] = {Path = "sound/vox/engine.wav", Duration = 0.570340}, ["enter"] = {Path = "sound/vox/enter.wav", Duration = 0.462404}, ["entry"] = {Path = "sound/vox/entry.wav", Duration = 0.536689}, ["environment"] = {Path = "sound/vox/environment.wav", Duration = 0.959728}, ["error"] = {Path = "sound/vox/error.wav", Duration = 0.469297}, ["escape"] = {Path = "sound/vox/escape.wav", Duration = 0.708934}, ["evacuate"] = {Path = "sound/vox/evacuate.wav", Duration = 0.937778}, ["exchange"] = {Path = "sound/vox/exchange.wav", Duration = 0.945669}, ["exit"] = {Path = "sound/vox/exit.wav", Duration = 0.613787}, ["expect"] = {Path = "sound/vox/expect.wav", Duration = 0.685896}, ["experiment"] = {Path = "sound/vox/experiment.wav", Duration = 0.957370}, ["experimental"] = {Path = "sound/vox/experimental.wav", Duration = 1.106485}, ["explode"] = {Path = "sound/vox/explode.wav", Duration = 0.817687}, ["explosion"] = {Path = "sound/vox/explosion.wav", Duration = 0.914830}, ["exposure"] = {Path = "sound/vox/exposure.wav", Duration = 0.865578}, ["exterminate"] = {Path = "sound/vox/exterminate.wav", Duration = 0.982041}, ["extinguish"] = {Path = "sound/vox/extinguish.wav", Duration = 0.931791}, ["extinguisher"] = {Path = "sound/vox/extinguisher.wav", Duration = 0.981950}, ["extreme"] = {Path = "sound/vox/extreme.wav", Duration = 0.801451}, ["f"] = {Path = "sound/vox/f.wav", Duration = 0.523175}, ["facility"] = {Path = "sound/vox/facility.wav", Duration = 0.890431}, ["fahrenheit"] = {Path = "sound/vox/fahrenheit.wav", Duration = 0.956735}, ["failed"] = {Path = "sound/vox/failed.wav", Duration = 0.637732}, ["failure"] = {Path = "sound/vox/failure.wav", Duration = 0.698594}, ["farthest"] = {Path = "sound/vox/farthest.wav", Duration = 0.785850}, ["fast"] = {Path = "sound/vox/fast.wav", Duration = 0.636735}, ["feet"] = {Path = "sound/vox/feet.wav", Duration = 0.493515}, ["field"] = {Path = "sound/vox/field.wav", Duration = 0.546667}, ["fifteen"] = {Path = "sound/vox/fifteen.wav", Duration = 0.806531}, ["fifth"] = {Path = "sound/vox/fifth.wav", Duration = 0.589478}, ["fifty"] = {Path = "sound/vox/fifty.wav", Duration = 0.625760}, ["final"] = {Path = "sound/vox/final.wav", Duration = 0.634195}, ["fine"] = {Path = "sound/vox/fine.wav", Duration = 0.691156}, ["fire"] = {Path = "sound/vox/fire.wav", Duration = 0.690249}, ["first"] = {Path = "sound/vox/first.wav", Duration = 0.574331}, ["five"] = {Path = "sound/vox/five.wav", Duration = 0.693696}, ["flooding"] = {Path = "sound/vox/flooding.wav", Duration = 0.812971}, ["floor"] = {Path = "sound/vox/floor.wav", Duration = 0.586395}, ["fool"] = {Path = "sound/vox/fool.wav", Duration = 0.554286}, ["for"] = {Path = "sound/vox/for.wav", Duration = 0.549660}, ["forbidden"] = {Path = "sound/vox/forbidden.wav", Duration = 0.907029}, ["force"] = {Path = "sound/vox/force.wav", Duration = 0.680726}, ["forms"] = {Path = "sound/vox/forms.wav", Duration = 0.762449}, ["found"] = {Path = "sound/vox/found.wav", Duration = 0.670930}, ["four"] = {Path = "sound/vox/four.wav", Duration = 0.471927}, ["fourteen"] = {Path = "sound/vox/fourteen.wav", Duration = 0.800000}, ["fourth"] = {Path = "sound/vox/fourth.wav", Duration = 0.596644}, ["fourty"] = {Path = "sound/vox/fourty.wav", Duration = 0.795011}, ["foxtrot"] = {Path = "sound/vox/foxtrot.wav", Duration = 0.957370}, ["freeman"] = {Path = "sound/vox/freeman.wav", Duration = 0.688526}, ["freezer"] = {Path = "sound/vox/freezer.wav", Duration = 0.659955}, ["from"] = {Path = "sound/vox/from.wav", Duration = 0.520454}, ["front"] = {Path = "sound/vox/front.wav", Duration = 0.608254}, ["fuel"] = {Path = "sound/vox/fuel.wav", Duration = 0.684807}, ["g"] = {Path = "sound/vox/g.wav", Duration = 0.554286}, ["get"] = {Path = "sound/vox/get.wav", Duration = 0.387211}, ["go"] = {Path = "sound/vox/go.wav", Duration = 0.482358}, ["going"] = {Path = "sound/vox/going.wav", Duration = 0.654422}, ["good"] = {Path = "sound/vox/good.wav", Duration = 0.511474}, ["goodbye"] = {Path = "sound/vox/goodbye.wav", Duration = 0.762721}, ["gordon"] = {Path = "sound/vox/gordon.wav", Duration = 0.572063}, ["got"] = {Path = "sound/vox/got.wav", Duration = 0.533878}, ["government"] = {Path = "sound/vox/government.wav", Duration = 0.803810}, ["granted"] = {Path = "sound/vox/granted.wav", Duration = 0.683537}, ["great"] = {Path = "sound/vox/great.wav", Duration = 0.533878}, ["green"] = {Path = "sound/vox/green.wav", Duration = 0.572608}, ["grenade"] = {Path = "sound/vox/grenade.wav", Duration = 0.764172}, ["guard"] = {Path = "sound/vox/guard.wav", Duration = 0.546032}, ["gulf"] = {Path = "sound/vox/gulf.wav", Duration = 0.548753}, ["gun"] = {Path = "sound/vox/gun.wav", Duration = 0.471111}, ["guthrie"] = {Path = "sound/vox/guthrie.wav", Duration = 0.624399}, ["handling"] = {Path = "sound/vox/handling.wav", Duration = 0.625125}, ["hangar"] = {Path = "sound/vox/hangar.wav", Duration = 0.686349}, ["has"] = {Path = "sound/vox/has.wav", Duration = 0.589478}, ["have"] = {Path = "sound/vox/have.wav", Duration = 0.567800}, ["hazard"] = {Path = "sound/vox/hazard.wav", Duration = 0.698866}, ["head"] = {Path = "sound/vox/head.wav", Duration = 0.514558}, ["health"] = {Path = "sound/vox/health.wav", Duration = 0.625397}, ["heat"] = {Path = "sound/vox/heat.wav", Duration = 0.543129}, ["helicopter"] = {Path = "sound/vox/helicopter.wav", Duration = 0.985034}, ["helium"] = {Path = "sound/vox/helium.wav", Duration = 0.780680}, ["hello"] = {Path = "sound/vox/hello.wav", Duration = 0.602449}, ["help"] = {Path = "sound/vox/help.wav", Duration = 0.481542}, ["here"] = {Path = "sound/vox/here.wav", Duration = 0.372245}, ["hide"] = {Path = "sound/vox/hide.wav", Duration = 0.527347}, ["high"] = {Path = "sound/vox/high.wav", Duration = 0.628209}, ["highest"] = {Path = "sound/vox/highest.wav", Duration = 0.641995}, ["hit"] = {Path = "sound/vox/hit.wav", Duration = 0.433379}, ["hole"] = {Path = "sound/vox/hole.wav", Duration = 0.573243}, ["hostile"] = {Path = "sound/vox/hostile.wav", Duration = 0.664943}, ["hot"] = {Path = "sound/vox/hot.wav", Duration = 0.458594}, ["hotel"] = {Path = "sound/vox/hotel.wav", Duration = 0.681542}, ["hour"] = {Path = "sound/vox/hour.wav", Duration = 0.440635}, ["hours"] = {Path = "sound/vox/hours.wav", Duration = 0.626667}, ["hundred"] = {Path = "sound/vox/hundred.wav", Duration = 0.596190}, ["hydro"] = {Path = "sound/vox/hydro.wav", Duration = 0.724989}, ["i"] = {Path = "sound/vox/i.wav", Duration = 0.206349}, ["idiot"] = {Path = "sound/vox/idiot.wav", Duration = 0.596100}, ["illegal"] = {Path = "sound/vox/illegal.wav", Duration = 0.635374}, ["immediate"] = {Path = "sound/vox/immediate.wav", Duration = 0.823764}, ["immediately"] = {Path = "sound/vox/immediately.wav", Duration = 0.929977}, ["in"] = {Path = "sound/vox/in.wav", Duration = 0.452608}, ["inches"] = {Path = "sound/vox/inches.wav", Duration = 0.664943}, ["india"] = {Path = "sound/vox/india.wav", Duration = 0.565261}, ["ing"] = {Path = "sound/vox/ing.wav", Duration = 0.390930}, ["inoperative"] = {Path = "sound/vox/inoperative.wav", Duration = 0.917551}, ["inside"] = {Path = "sound/vox/inside.wav", Duration = 0.753016}, ["inspection"] = {Path = "sound/vox/inspection.wav", Duration = 0.821134}, ["inspector"] = {Path = "sound/vox/inspector.wav", Duration = 0.762449}, ["interchange"] = {Path = "sound/vox/interchange.wav", Duration = 0.941134}, ["intruder"] = {Path = "sound/vox/intruder.wav", Duration = 0.822222}, ["invallid"] = {Path = "sound/vox/invallid.wav", Duration = 0.720726}, ["invasion"] = {Path = "sound/vox/invasion.wav", Duration = 0.736599}, ["is"] = {Path = "sound/vox/is.wav", Duration = 0.398095}, ["it"] = {Path = "sound/vox/it.wav", Duration = 0.280363}, ["johnson"] = {Path = "sound/vox/johnson.wav", Duration = 0.789297}, ["juliet"] = {Path = "sound/vox/juliet.wav", Duration = 0.726984}, ["key"] = {Path = "sound/vox/key.wav", Duration = 0.414240}, ["kill"] = {Path = "sound/vox/kill.wav", Duration = 0.609433}, ["kilo"] = {Path = "sound/vox/kilo.wav", Duration = 0.579864}, ["kit"] = {Path = "sound/vox/kit.wav", Duration = 0.327982}, ["lab"] = {Path = "sound/vox/lab.wav", Duration = 1.245624}, ["lambda"] = {Path = "sound/vox/lambda.wav", Duration = 0.691791}, ["laser"] = {Path = "sound/vox/laser.wav", Duration = 0.624218}, ["last"] = {Path = "sound/vox/last.wav", Duration = 0.582766}, ["launch"] = {Path = "sound/vox/launch.wav", Duration = 0.743311}, ["leak"] = {Path = "sound/vox/leak.wav", Duration = 0.472018}, ["leave"] = {Path = "sound/vox/leave.wav", Duration = 0.643628}, ["left"] = {Path = "sound/vox/left.wav", Duration = 0.515556}, ["legal"] = {Path = "sound/vox/legal.wav", Duration = 0.568254}, ["level"] = {Path = "sound/vox/level.wav", Duration = 0.496780}, ["lever"] = {Path = "sound/vox/lever.wav", Duration = 0.494603}, ["lie"] = {Path = "sound/vox/lie.wav", Duration = 0.443084}, ["lieutenant"] = {Path = "sound/vox/lieutenant.wav", Duration = 0.803719}, ["life"] = {Path = "sound/vox/life.wav", Duration = 0.771973}, ["light"] = {Path = "sound/vox/light.wav", Duration = 0.480998}, ["lima"] = {Path = "sound/vox/lima.wav", Duration = 0.513469}, ["liquid"] = {Path = "sound/vox/liquid.wav", Duration = 0.580317}, ["loading"] = {Path = "sound/vox/loading.wav", Duration = 0.836100}, ["locate"] = {Path = "sound/vox/locate.wav", Duration = 0.699320}, ["located"] = {Path = "sound/vox/located.wav", Duration = 0.869841}, ["location"] = {Path = "sound/vox/location.wav", Duration = 0.847710}, ["lock"] = {Path = "sound/vox/lock.wav", Duration = 0.537234}, ["locked"] = {Path = "sound/vox/locked.wav", Duration = 0.511383}, ["locker"] = {Path = "sound/vox/locker.wav", Duration = 0.568345}, ["lockout"] = {Path = "sound/vox/lockout.wav", Duration = 0.731066}, ["lower"] = {Path = "sound/vox/lower.wav", Duration = 0.529796}, ["lowest"] = {Path = "sound/vox/lowest.wav", Duration = 0.641361}, ["magnetic"] = {Path = "sound/vox/magnetic.wav", Duration = 0.703855}, ["main"] = {Path = "sound/vox/main.wav", Duration = 0.655238}, ["maintenance"] = {Path = "sound/vox/maintenance.wav", Duration = 0.818776}, ["malfunction"] = {Path = "sound/vox/malfunction.wav", Duration = 1.073560}, ["man"] = {Path = "sound/vox/man.wav", Duration = 0.577959}, ["mass"] = {Path = "sound/vox/mass.wav", Duration = 0.547392}, ["materials"] = {Path = "sound/vox/materials.wav", Duration = 0.944036}, ["maximum"] = {Path = "sound/vox/maximum.wav", Duration = 0.852971}, ["may"] = {Path = "sound/vox/may.wav", Duration = 0.354921}, ["medical"] = {Path = "sound/vox/medical.wav", Duration = 0.634558}, ["men"] = {Path = "sound/vox/men.wav", Duration = 0.491247}, ["mercy"] = {Path = "sound/vox/mercy.wav", Duration = 0.590023}, ["mesa"] = {Path = "sound/vox/mesa.wav", Duration = 0.646349}, ["message"] = {Path = "sound/vox/message.wav", Duration = 0.705125}, ["meter"] = {Path = "sound/vox/meter.wav", Duration = 0.532698}, ["micro"] = {Path = "sound/vox/micro.wav", Duration = 0.665215}, ["middle"] = {Path = "sound/vox/middle.wav", Duration = 0.501224}, ["mike"] = {Path = "sound/vox/mike.wav", Duration = 0.525986}, ["miles"] = {Path = "sound/vox/miles.wav", Duration = 0.717732}, ["military"] = {Path = "sound/vox/military.wav", Duration = 0.834830}, ["milli"] = {Path = "sound/vox/milli.wav", Duration = 0.463311}, ["million"] = {Path = "sound/vox/million.wav", Duration = 0.592472}, ["minefield"] = {Path = "sound/vox/minefield.wav", Duration = 0.812517}, ["minimum"] = {Path = "sound/vox/minimum.wav", Duration = 0.644807}, ["minutes"] = {Path = "sound/vox/minutes.wav", Duration = 0.593379}, ["mister"] = {Path = "sound/vox/mister.wav", Duration = 0.627664}, ["mode"] = {Path = "sound/vox/mode.wav", Duration = 0.556281}, ["motor"] = {Path = "sound/vox/motor.wav", Duration = 0.504580}, ["motorpool"] = {Path = "sound/vox/motorpool.wav", Duration = 0.938050}, ["move"] = {Path = "sound/vox/move.wav", Duration = 0.485533}, ["must"] = {Path = "sound/vox/must.wav", Duration = 0.435465}, ["nearest"] = {Path = "sound/vox/nearest.wav", Duration = 0.636281}, ["nice"] = {Path = "sound/vox/nice.wav", Duration = 0.679365}, ["nine"] = {Path = "sound/vox/nine.wav", Duration = 0.597551}, ["nineteen"] = {Path = "sound/vox/nineteen.wav", Duration = 0.782676}, ["ninety"] = {Path = "sound/vox/ninety.wav", Duration = 0.631474}, ["no"] = {Path = "sound/vox/no.wav", Duration = 0.604172}, ["nominal"] = {Path = "sound/vox/nominal.wav", Duration = 0.757370}, ["north"] = {Path = "sound/vox/north.wav", Duration = 0.468844}, ["not"] = {Path = "sound/vox/not.wav", Duration = 0.485170}, ["november"] = {Path = "sound/vox/november.wav", Duration = 0.818322}, ["now"] = {Path = "sound/vox/now.wav", Duration = 0.403175}, ["number"] = {Path = "sound/vox/number.wav", Duration = 0.599365}, ["objective"] = {Path = "sound/vox/objective.wav", Duration = 0.760635}, ["observation"] = {Path = "sound/vox/observation.wav", Duration = 1.066757}, ["of"] = {Path = "sound/vox/of.wav", Duration = 0.409161}, ["officer"] = {Path = "sound/vox/officer.wav", Duration = 0.705034}, ["ok"] = {Path = "sound/vox/ok.wav", Duration = 0.629025}, ["on"] = {Path = "sound/vox/on.wav", Duration = 0.633923}, ["one"] = {Path = "sound/vox/one.wav", Duration = 0.473923}, ["open"] = {Path = "sound/vox/open.wav", Duration = 0.562177}, ["operating"] = {Path = "sound/vox/operating.wav", Duration = 0.793469}, ["operations"] = {Path = "sound/vox/operations.wav", Duration = 1.004263}, ["operative"] = {Path = "sound/vox/operative.wav", Duration = 0.818866}, ["option"] = {Path = "sound/vox/option.wav", Duration = 0.614059}, ["order"] = {Path = "sound/vox/order.wav", Duration = 0.558367}, ["organic"] = {Path = "sound/vox/organic.wav", Duration = 0.911474}, ["oscar"] = {Path = "sound/vox/oscar.wav", Duration = 0.611066}, ["out"] = {Path = "sound/vox/out.wav", Duration = 0.404989}, ["outside"] = {Path = "sound/vox/outside.wav", Duration = 0.821043}, ["over"] = {Path = "sound/vox/over.wav", Duration = 0.454875}, ["overload"] = {Path = "sound/vox/overload.wav", Duration = 0.826122}, ["override"] = {Path = "sound/vox/override.wav", Duration = 0.914649}, ["pacify"] = {Path = "sound/vox/pacify.wav", Duration = 0.868118}, ["pain"] = {Path = "sound/vox/pain.wav", Duration = 0.530159}, ["pal"] = {Path = "sound/vox/pal.wav", Duration = 0.518367}, ["panel"] = {Path = "sound/vox/panel.wav", Duration = 0.592018}, ["percent"] = {Path = "sound/vox/percent.wav", Duration = 0.716644}, ["perimeter"] = {Path = "sound/vox/perimeter.wav", Duration = 0.675556}, ["permitted"] = {Path = "sound/vox/permitted.wav", Duration = 0.673923}, ["personnel"] = {Path = "sound/vox/personnel.wav", Duration = 0.807891}, ["pipe"] = {Path = "sound/vox/pipe.wav", Duration = 0.481814}, ["plant"] = {Path = "sound/vox/plant.wav", Duration = 0.511565}, ["platform"] = {Path = "sound/vox/platform.wav", Duration = 0.828209}, ["please"] = {Path = "sound/vox/please.wav", Duration = 0.647166}, ["point"] = {Path = "sound/vox/point.wav", Duration = 0.499592}, ["portal"] = {Path = "sound/vox/portal.wav", Duration = 0.522358}, ["power"] = {Path = "sound/vox/power.wav", Duration = 0.555011}, ["presence"] = {Path = "sound/vox/presence.wav", Duration = 0.919002}, ["press"] = {Path = "sound/vox/press.wav", Duration = 0.540136}, ["primary"] = {Path = "sound/vox/primary.wav", Duration = 0.765624}, ["proceed"] = {Path = "sound/vox/proceed.wav", Duration = 0.682086}, ["processing"] = {Path = "sound/vox/processing.wav", Duration = 1.008617}, ["progress"] = {Path = "sound/vox/progress.wav", Duration = 0.791202}, ["proper"] = {Path = "sound/vox/proper.wav", Duration = 0.629569}, ["propulsion"] = {Path = "sound/vox/propulsion.wav", Duration = 0.889977}, ["prosecute"] = {Path = "sound/vox/prosecute.wav", Duration = 0.900227}, ["protective"] = {Path = "sound/vox/protective.wav", Duration = 0.812608}, ["push"] = {Path = "sound/vox/push.wav", Duration = 0.525533}, ["quantum"] = {Path = "sound/vox/quantum.wav", Duration = 0.720726}, ["quebec"] = {Path = "sound/vox/quebec.wav", Duration = 0.669932}, ["question"] = {Path = "sound/vox/question.wav", Duration = 0.717732}, ["questioning"] = {Path = "sound/vox/questioning.wav", Duration = 0.837370}, ["quick"] = {Path = "sound/vox/quick.wav", Duration = 0.478549}, ["quit"] = {Path = "sound/vox/quit.wav", Duration = 0.454240}, ["radiation"] = {Path = "sound/vox/radiation.wav", Duration = 0.963537}, ["radioactive"] = {Path = "sound/vox/radioactive.wav", Duration = 1.189660}, ["rads"] = {Path = "sound/vox/rads.wav", Duration = 0.641723}, ["rapid"] = {Path = "sound/vox/rapid.wav", Duration = 0.666032}, ["reach"] = {Path = "sound/vox/reach.wav", Duration = 0.588481}, ["reached"] = {Path = "sound/vox/reached.wav", Duration = 0.569342}, ["reactor"] = {Path = "sound/vox/reactor.wav", Duration = 0.702494}, ["red"] = {Path = "sound/vox/red.wav", Duration = 0.457778}, ["relay"] = {Path = "sound/vox/relay.wav", Duration = 0.613243}, ["released"] = {Path = "sound/vox/released.wav", Duration = 0.689161}, ["remaining"] = {Path = "sound/vox/remaining.wav", Duration = 0.672109}, ["renegade"] = {Path = "sound/vox/renegade.wav", Duration = 0.783946}, ["repair"] = {Path = "sound/vox/repair.wav", Duration = 0.722630}, ["report"] = {Path = "sound/vox/report.wav", Duration = 0.795011}, ["reports"] = {Path = "sound/vox/reports.wav", Duration = 0.919637}, ["required"] = {Path = "sound/vox/required.wav", Duration = 0.873651}, ["research"] = {Path = "sound/vox/research.wav", Duration = 0.799819}, ["resevoir"] = {Path = "sound/vox/resevoir.wav", Duration = 0.995283}, ["resistance"] = {Path = "sound/vox/resistance.wav", Duration = 0.846531}, ["right"] = {Path = "sound/vox/right.wav", Duration = 0.531701}, ["rocket"] = {Path = "sound/vox/rocket.wav", Duration = 0.566077}, ["roger"] = {Path = "sound/vox/roger.wav", Duration = 0.589660}, ["romeo"] = {Path = "sound/vox/romeo.wav", Duration = 0.706213}, ["room"] = {Path = "sound/vox/room.wav", Duration = 0.496599}, ["round"] = {Path = "sound/vox/round.wav", Duration = 0.635011}, ["run"] = {Path = "sound/vox/run.wav", Duration = 0.462132}, ["safe"] = {Path = "sound/vox/safe.wav", Duration = 0.517914}, ["safety"] = {Path = "sound/vox/safety.wav", Duration = 0.686531}, ["sargeant"] = {Path = "sound/vox/sargeant.wav", Duration = 0.809705}, ["satellite"] = {Path = "sound/vox/satellite.wav", Duration = 0.828481}, ["save"] = {Path = "sound/vox/save.wav", Duration = 0.623492}, ["science"] = {Path = "sound/vox/science.wav", Duration = 0.749116}, ["scream"] = {Path = "sound/vox/scream.wav", Duration = 0.667755}, ["screen"] = {Path = "sound/vox/screen.wav", Duration = 0.739864}, ["search"] = {Path = "sound/vox/search.wav", Duration = 0.595374}, ["second"] = {Path = "sound/vox/second.wav", Duration = 0.558730}, ["secondary"] = {Path = "sound/vox/secondary.wav", Duration = 0.972698}, ["seconds"] = {Path = "sound/vox/seconds.wav", Duration = 0.626213}, ["sector"] = {Path = "sound/vox/sector.wav", Duration = 0.602812}, ["secure"] = {Path = "sound/vox/secure.wav", Duration = 0.778231}, ["secured"] = {Path = "sound/vox/secured.wav", Duration = 0.873651}, ["security"] = {Path = "sound/vox/security.wav", Duration = 0.938413}, ["select"] = {Path = "sound/vox/select.wav", Duration = 0.664580}, ["selected"] = {Path = "sound/vox/selected.wav", Duration = 0.782766}, ["service"] = {Path = "sound/vox/service.wav", Duration = 0.702222}, ["seven"] = {Path = "sound/vox/seven.wav", Duration = 0.603810}, ["seventeen"] = {Path = "sound/vox/seventeen.wav", Duration = 1.000816}, ["seventy"] = {Path = "sound/vox/seventy.wav", Duration = 0.716009}, ["severe"] = {Path = "sound/vox/severe.wav", Duration = 0.686893}, ["sewage"] = {Path = "sound/vox/sewage.wav", Duration = 0.675646}, ["sewer"] = {Path = "sound/vox/sewer.wav", Duration = 0.543946}, ["shield"] = {Path = "sound/vox/shield.wav", Duration = 0.547029}, ["shipment"] = {Path = "sound/vox/shipment.wav", Duration = 0.745397}, ["shock"] = {Path = "sound/vox/shock.wav", Duration = 0.541859}, ["shoot"] = {Path = "sound/vox/shoot.wav", Duration = 0.518277}, ["shower"] = {Path = "sound/vox/shower.wav", Duration = 0.674286}, ["shut"] = {Path = "sound/vox/shut.wav", Duration = 0.483175}, ["side"] = {Path = "sound/vox/side.wav", Duration = 0.662041}, ["sierra"] = {Path = "sound/vox/sierra.wav", Duration = 0.617959}, ["sight"] = {Path = "sound/vox/sight.wav", Duration = 0.601361}, ["silo"] = {Path = "sound/vox/silo.wav", Duration = 0.636916}, ["six"] = {Path = "sound/vox/six.wav", Duration = 0.549116}, ["sixteen"] = {Path = "sound/vox/sixteen.wav", Duration = 0.844626}, ["sixty"] = {Path = "sound/vox/sixty.wav", Duration = 0.652789}, ["slime"] = {Path = "sound/vox/slime.wav", Duration = 0.699955}, ["slow"] = {Path = "sound/vox/slow.wav", Duration = 0.590295}, ["soldier"] = {Path = "sound/vox/soldier.wav", Duration = 0.722540}, ["some"] = {Path = "sound/vox/some.wav", Duration = 0.471927}, ["someone"] = {Path = "sound/vox/someone.wav", Duration = 0.795556}, ["something"] = {Path = "sound/vox/something.wav", Duration = 0.603447}, ["son"] = {Path = "sound/vox/son.wav", Duration = 0.524082}, ["sorry"] = {Path = "sound/vox/sorry.wav", Duration = 0.570159}, ["south"] = {Path = "sound/vox/south.wav", Duration = 0.655873}, ["squad"] = {Path = "sound/vox/squad.wav", Duration = 0.660952}, ["square"] = {Path = "sound/vox/square.wav", Duration = 0.637370}, ["stairway"] = {Path = "sound/vox/stairway.wav", Duration = 0.778231}, ["status"] = {Path = "sound/vox/status.wav", Duration = 0.675646}, ["sterile"] = {Path = "sound/vox/sterile.wav", Duration = 0.556825}, ["sterilization"] = {Path = "sound/vox/sterilization.wav", Duration = 1.198639}, ["storage"] = {Path = "sound/vox/storage.wav", Duration = 0.877460}, ["sub"] = {Path = "sound/vox/sub.wav", Duration = 0.509478}, ["subsurface"] = {Path = "sound/vox/subsurface.wav", Duration = 0.964082}, ["sudden"] = {Path = "sound/vox/sudden.wav", Duration = 0.569070}, ["suit"] = {Path = "sound/vox/suit.wav", Duration = 0.462132}, ["superconducting"] = {Path = "sound/vox/superconducting.wav", Duration = 1.196644}, ["supercooled"] = {Path = "sound/vox/supercooled.wav", Duration = 0.957279}, ["supply"] = {Path = "sound/vox/supply.wav", Duration = 0.809252}, ["surface"] = {Path = "sound/vox/surface.wav", Duration = 0.773061}, ["surrender"] = {Path = "sound/vox/surrender.wav", Duration = 0.718005}, ["surround"] = {Path = "sound/vox/surround.wav", Duration = 0.749660}, ["surrounded"] = {Path = "sound/vox/surrounded.wav", Duration = 0.861497}, ["switch"] = {Path = "sound/vox/switch.wav", Duration = 0.663220}, ["system"] = {Path = "sound/vox/system.wav", Duration = 0.658776}, ["systems"] = {Path = "sound/vox/systems.wav", Duration = 0.659592}, ["tactical"] = {Path = "sound/vox/tactical.wav", Duration = 0.793107}, ["take"] = {Path = "sound/vox/take.wav", Duration = 0.520907}, ["talk"] = {Path = "sound/vox/talk.wav", Duration = 0.501950}, ["tango"] = {Path = "sound/vox/tango.wav", Duration = 0.679002}, ["tank"] = {Path = "sound/vox/tank.wav", Duration = 0.666485}, ["target"] = {Path = "sound/vox/target.wav", Duration = 0.588662}, ["team"] = {Path = "sound/vox/team.wav", Duration = 0.529887}, ["temperature"] = {Path = "sound/vox/temperature.wav", Duration = 0.919274}, ["temporal"] = {Path = "sound/vox/temporal.wav", Duration = 0.753832}, ["ten"] = {Path = "sound/vox/ten.wav", Duration = 0.503855}, ["terminal"] = {Path = "sound/vox/terminal.wav", Duration = 0.608798}, ["terminated"] = {Path = "sound/vox/terminated.wav", Duration = 0.884263}, ["termination"] = {Path = "sound/vox/termination.wav", Duration = 0.928526}, ["test"] = {Path = "sound/vox/test.wav", Duration = 0.688707}, ["that"] = {Path = "sound/vox/that.wav", Duration = 0.550476}, ["the"] = {Path = "sound/vox/the.wav", Duration = 0.359002}, ["then"] = {Path = "sound/vox/then.wav", Duration = 0.574331}, ["there"] = {Path = "sound/vox/there.wav", Duration = 0.454694}, ["third"] = {Path = "sound/vox/third.wav", Duration = 0.646168}, ["thirteen"] = {Path = "sound/vox/thirteen.wav", Duration = 0.765805}, ["thirty"] = {Path = "sound/vox/thirty.wav", Duration = 0.577415}, ["this"] = {Path = "sound/vox/this.wav", Duration = 0.454331}, ["those"] = {Path = "sound/vox/those.wav", Duration = 0.598367}, ["thousand"] = {Path = "sound/vox/thousand.wav", Duration = 0.696689}, ["threat"] = {Path = "sound/vox/threat.wav", Duration = 0.550385}, ["three"] = {Path = "sound/vox/three.wav", Duration = 0.464036}, ["through"] = {Path = "sound/vox/through.wav", Duration = 0.413152}, ["time"] = {Path = "sound/vox/time.wav", Duration = 0.593379}, ["to"] = {Path = "sound/vox/to.wav", Duration = 0.502948}, ["top"] = {Path = "sound/vox/top.wav", Duration = 0.560998}, ["topside"] = {Path = "sound/vox/topside.wav", Duration = 0.854059}, ["touch"] = {Path = "sound/vox/touch.wav", Duration = 0.481270}, ["towards"] = {Path = "sound/vox/towards.wav", Duration = 0.571429}, ["track"] = {Path = "sound/vox/track.wav", Duration = 0.688980}, ["train"] = {Path = "sound/vox/train.wav", Duration = 0.590658}, ["transportation"] = {Path = "sound/vox/transportation.wav", Duration = 1.352834}, ["truck"] = {Path = "sound/vox/truck.wav", Duration = 0.566440}, ["tunnel"] = {Path = "sound/vox/tunnel.wav", Duration = 0.495057}, ["turn"] = {Path = "sound/vox/turn.wav", Duration = 0.496236}, ["turret"] = {Path = "sound/vox/turret.wav", Duration = 0.470295}, ["twelve"] = {Path = "sound/vox/twelve.wav", Duration = 0.525170}, ["twenty"] = {Path = "sound/vox/twenty.wav", Duration = 0.585306}, ["two"] = {Path = "sound/vox/two.wav", Duration = 0.507483}, ["unauthorized"] = {Path = "sound/vox/unauthorized.wav", Duration = 1.177143}, ["under"] = {Path = "sound/vox/under.wav", Duration = 0.518639}, ["uniform"] = {Path = "sound/vox/uniform.wav", Duration = 0.837642}, ["unlocked"] = {Path = "sound/vox/unlocked.wav", Duration = 0.774331}, ["until"] = {Path = "sound/vox/until.wav", Duration = 0.636463}, ["up"] = {Path = "sound/vox/up.wav", Duration = 0.541950}, ["upper"] = {Path = "sound/vox/upper.wav", Duration = 0.542222}, ["uranium"] = {Path = "sound/vox/uranium.wav", Duration = 0.891701}, ["us"] = {Path = "sound/vox/us.wav", Duration = 0.165079}, ["usa"] = {Path = "sound/vox/usa.wav", Duration = 0.778050}, ["use"] = {Path = "sound/vox/use.wav", Duration = 0.479365}, ["used"] = {Path = "sound/vox/used.wav", Duration = 0.670295}, ["user"] = {Path = "sound/vox/user.wav", Duration = 0.584490}, ["vacate"] = {Path = "sound/vox/vacate.wav", Duration = 0.741678}, ["valid"] = {Path = "sound/vox/valid.wav", Duration = 0.612971}, ["vapor"] = {Path = "sound/vox/vapor.wav", Duration = 0.589388}, ["vent"] = {Path = "sound/vox/vent.wav", Duration = 0.435556}, ["ventillation"] = {Path = "sound/vox/ventillation.wav", Duration = 0.966531}, ["victor"] = {Path = "sound/vox/victor.wav", Duration = 0.584580}, ["violated"] = {Path = "sound/vox/violated.wav", Duration = 0.895873}, ["violation"] = {Path = "sound/vox/violation.wav", Duration = 0.937324}, ["voltage"] = {Path = "sound/vox/voltage.wav", Duration = 0.708027}, ["walk"] = {Path = "sound/vox/walk.wav", Duration = 0.471927}, ["wall"] = {Path = "sound/vox/wall.wav", Duration = 0.559274}, ["want"] = {Path = "sound/vox/want.wav", Duration = 0.479184}, ["wanted"] = {Path = "sound/vox/wanted.wav", Duration = 0.604172}, ["warm"] = {Path = "sound/vox/warm.wav", Duration = 0.476372}, ["warn"] = {Path = "sound/vox/warn.wav", Duration = 0.466848}, ["warning"] = {Path = "sound/vox/warning.wav", Duration = 0.564444}, ["waste"] = {Path = "sound/vox/waste.wav", Duration = 0.557732}, ["water"] = {Path = "sound/vox/water.wav", Duration = 0.506485}, ["we"] = {Path = "sound/vox/we.wav", Duration = 0.295692}, ["weapon"] = {Path = "sound/vox/weapon.wav", Duration = 0.550113}, ["west"] = {Path = "sound/vox/west.wav", Duration = 0.483719}, ["whiskey"] = {Path = "sound/vox/whiskey.wav", Duration = 0.522993}, ["white"] = {Path = "sound/vox/white.wav", Duration = 0.459683}, ["wilco"] = {Path = "sound/vox/wilco.wav", Duration = 0.627302}, ["will"] = {Path = "sound/vox/will.wav", Duration = 0.320998}, ["with"] = {Path = "sound/vox/with.wav", Duration = 0.339592}, ["without"] = {Path = "sound/vox/without.wav", Duration = 0.604898}, ["woop"] = {Path = "sound/vox/woop.wav", Duration = 0.630295}, ["xeno"] = {Path = "sound/vox/xeno.wav", Duration = 0.702404}, ["yankee"] = {Path = "sound/vox/yankee.wav", Duration = 0.692880}, ["yards"] = {Path = "sound/vox/yards.wav", Duration = 0.533333}, ["year"] = {Path = "sound/vox/year.wav", Duration = 0.538050}, ["yellow"] = {Path = "sound/vox/yellow.wav", Duration = 0.526893}, ["yes"] = {Path = "sound/vox/yes.wav", Duration = 0.517732}, ["you"] = {Path = "sound/vox/you.wav", Duration = 0.456871}, ["your"] = {Path = "sound/vox/your.wav", Duration = 0.403265}, ["yourself"] = {Path = "sound/vox/yourself.wav", Duration = 0.930068}, ["zero"] = {Path = "sound/vox/zero.wav", Duration = 0.648798}, ["zone"] = {Path = "sound/vox/zone.wav", Duration = 0.687891}, ["zulu"] = {Path = "sound/vox/zulu.wav", Duration = 0.713741} }
--********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_anakin_forearm = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_anakin_forearm.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_anakin_forearm, "object/tangible/wearables/cybernetic/shared_cybernetic_anakin_forearm.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_forearm_l_01 = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_forearm_l_01.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_forearm_l_01, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_forearm_l_01.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_forearm_r_01 = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_forearm_r_01.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_forearm_r_01, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_forearm_r_01.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_hand_l_01 = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_hand_l_01.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_hand_l_01, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_hand_l_01.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_hand_r_01 = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_hand_r_01.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_hand_r_01, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_hand_r_01.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s01_arm_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s01_arm_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s01_arm_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s01_arm_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s01_arm_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s01_arm_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s01_arm_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s01_arm_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s01_legs = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s01_legs.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s01_legs, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s01_legs.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s01_torso = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s01_torso.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s01_torso, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s01_torso.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_arm_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_arm_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_arm_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_arm_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_arm_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_arm_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_arm_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_arm_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_forearm_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_forearm_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_forearm_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_forearm_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_forearm_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_forearm_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_forearm_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_forearm_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_hand_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_hand_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_hand_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_hand_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_hand_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_hand_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_hand_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_hand_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_legs = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_legs.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_legs, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_legs.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_torso = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_torso.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s02_torso, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s02_torso.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_arm_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_arm_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_arm_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_arm_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_arm_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_arm_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_arm_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_arm_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_forearm_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_forearm_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_forearm_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_forearm_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_forearm_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_forearm_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_forearm_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_forearm_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_hand_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_hand_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_hand_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_hand_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_hand_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_hand_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s03_hand_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s03_hand_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_arm_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_arm_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_arm_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_arm_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_arm_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_arm_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_arm_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_arm_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_forearm_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_forearm_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_forearm_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_forearm_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_forearm_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_forearm_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_forearm_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_forearm_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_hand_l = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_hand_l.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_hand_l, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_hand_l.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_hand_r = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_hand_r.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_hand_r, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_hand_r.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_legs = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_legs.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_legs, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_legs.iff") --********************************************** object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_torso = SharedTangibleObjectTemplate:new { clientTemplateFileName = "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_torso.iff" } ObjectTemplates:addClientTemplate(object_tangible_wearables_cybernetic_shared_cybernetic_crafted_s05_torso, "object/tangible/wearables/cybernetic/shared_cybernetic_crafted_s05_torso.iff")
-- vim.cmd([[ -- highlight Normal guibg=none ctermbg=none -- highlight NonText guibg=none ctermbg=none -- ]]) vim.cmd([[ autocmd! BufWinLeave * let b:winview = winsaveview() autocmd! BufWinEnter * if exists('b:winview') | call winrestview(b:winview) | unlet b:winview autocmd FileType css,javascript,json,scss setl iskeyword+=- autocmd FileType git set nofoldenable ]]) vim.cmd([[ augroup highlight_yank autocmd! " autocmd TextYankPost * silent! lua vim.highlight.on_yank { higroup='IncSearch', timeout=200 } autocmd TextYankPost * silent! lua vim.highlight.on_yank { higroup='IncSearch', timeout=400 } augroup END augroup rods_highlights autocmd! highlight breakSpace ctermfg=46 guifg=#00ff00 " match does not work if has more than one " match breakSpace /\%xa0/ call matchadd('breakSpace', '\%xa0') " highlight ColorColumn88 ctermbg=magenta guibg=#b41158 " call matchadd('ColorColumn88', '\%88v') augroup END ]]) vim.cmd([[au VimEnter * highlight Folded guifg=#465a7d]]) vim.cmd([[au ColorScheme * highlight Folded guifg=#465a7d]]) vim.cmd([[au VimEnter * highlight IncSearch guifg=#ab7f54 guibg=#00000000 ]]) vim.cmd([[au ColorScheme * highlight IncSearch guifg=#ab7f54 guibg=#00000000 ]]) -- Line Column Colors vim.cmd [[ highlight LineNrAbove guibg=#1e2127 guifg=#414855 ]] vim.cmd [[ highlight LineNr guifg=#93a2bf ]] vim.cmd [[ highlight LineNrBelow guibg=#1e2127 guifg=#414855 ]] -- git vim.cmd [[ highlight SignColumn guibg=#1e2127 ]] vim.cmd [[ highlight GitSignsAdd guibg=#1e2127 ]] vim.cmd [[ highlight GitSignsChange guibg=#1e2127 ]] vim.cmd [[ highlight GitSignsDelete guibg=#1e2127 ]] -- lsp vim.cmd [[ highlight DiagnosticInfo guibg=#1e2127 ]] vim.cmd [[ highlight DiagnosticError guibg=#1e2127 ]] vim.cmd [[ highlight DiagnosticWarn guibg=#1e2127 ]] vim.cmd [[ highlight DiagnosticHint guibg=#1e2127 ]] -- require("rods/funcs").toggle_transparency()
local M = {} function Solution_1() term_cur = 2 term_last = 1 sum = 0 while term_cur < 4000000 do if term_cur % 2 == 0 then sum = sum + term_cur end temp = term_cur term_cur = term_cur + term_last term_last = temp end return sum end function Test_Solution_1() assert( Solution_1() == 4613732 ) end function M.Get_Solutions() func = {} func[1] = Test_Solution_1 return func end return M
impulse.Ops.ST = impulse.Ops.ST or {} util.AddNetworkString("impulseOpsSTOpenTool") util.AddNetworkString("impulseOpsSTDoRefund") util.AddNetworkString("impulseOpsSTGetRefund") util.AddNetworkString("impulseOpsSTDoOOCEnabled") util.AddNetworkString("impulseOpsSTDoTeamLocked") util.AddNetworkString("impulseOpsSTDoGroupRemove") local function isSupport(ply) if not ply:IsSuperAdmin() then if ply:GetUserGroup() != "communitymanager" then return false end end return true end local lockedTeams = lockedTeams or {} net.Receive("impulseOpsSTDoOOCEnabled", function(len, ply) if not isSupport(ply) then return end local enabled = net.ReadBool() impulse.OOCClosed = !enabled ply:Notify("OOC enabled set to "..(enabled and "true" or "false")..".") end) net.Receive("impulseOpsSTDoGroupRemove", function(len, ply) if not isSupport(ply) then return end local name = net.ReadString() local groupData = impulse.Group.Groups[name] if not groupData or not groupData.ID then impulse.Group.DBRemoveByName(name) ply:Notify("No loaded group found, however, we have attempted to remove it from the database.") return end for v,k in pairs(groupData.Members) do local targEnt = player.GetBySteamID(v) if IsValid(targEnt) then targEnt:SetSyncVar(SYNC_GROUP_NAME, nil, true) targEnt:SetSyncVar(SYNC_GROUP_RANK, nil, true) targEnt:Notify("You were removed from the "..name.." group as it has been removed by the staff team for violations of the RP group rules.") end end impulse.Group.DBRemove(groupData.ID) impulse.Group.DBRemovePlayerMass(groupData.ID) impulse.Group.Groups[name] = nil ply:Notify("The "..name.." group has been removed.") end) net.Receive("impulseOpsSTDoTeamLocked", function(len, ply) if not isSupport(ply) then return end local teamid = net.ReadUInt(8) local locked = net.ReadBool() if teamid == impulse.Config.DefaultTeam then return ply:Notify("You can't lock the default team.") end lockedTeams[teamid] = locked ply:Notify("Team "..teamid.." has been "..(locked and "locked" or "unlocked")..".") end) net.Receive("impulseOpsSTDoRefund", function(len, ply) if not isSupport(ply) then return end local s64 = net.ReadString() local len = net.ReadUInt(32) local items = pon.decode(net.ReadData(len)) local steamid = util.SteamIDFrom64(s64) local query = mysql:Select("impulse_players") query:Select("id") query:Where("steamid", steamid) query:Callback(function(result) if not IsValid(ply) then return end if not type(result) == "table" or #result == 0 then return ply:Notify("This Steam account has not joined the server yet or the SteamID is invalid.") end local impulseID = result[1].id local refundData = {} for v,k in pairs(items) do if not impulse.Inventory.ItemsRef[v] then continue end refundData[v] = k end impulse.Data.Write("SupportRefund_"..s64, refundData) ply:Notify("Issued support refund for user "..s64..".") end) query:Execute() end) function impulse.Ops.ST.Open(ply) net.Start("impulseOpsSTOpenTool") net.Send(ply) end function PLUGIN:PostInventorySetup(ply) impulse.Data.Read("SupportRefund_"..ply:SteamID64(), function(refundData) if not IsValid(ply) then return end for v,k in pairs(refundData) do if not impulse.Inventory.ItemsRef[v] then continue end for i=1,k do ply:GiveInventoryItem(v, INV_STORAGE) -- refund to storage end end impulse.Data.Remove("SupportRefund_"..ply:SteamID64()) local data = pon.encode(refundData) net.Start("impulseOpsSTGetRefund") net.WriteUInt(#data, 32) net.WriteData(data, #data) net.Send(ply) end) end function PLUGIN:CanPlayerChangeTeam(ply, newTeam) if lockedTeams[newTeam] then if SERVER then ply:Notify("Team temporarily locked.") end return false end end
local tunnelStartTrigger = script.parent local tunnelEndTrigger = script:GetCustomProperty("TunnelEndTrigger"):WaitForObject() local speedKeyBinding = "ability_extra_17" local slowFallSpeed = 2500 local fallingWalkSpeed = 2000 local function IsPlayerFalling(player) return player.maxWalkSpeed == fallingWalkSpeed and not player.isDead end local function OnBindingPressed(player, bindingPressed) if not IsPlayerFalling(player) then return end if bindingPressed == speedKeyBinding then player.gravityScale = 1.9 end end local function OnBindingReleased(player, bindingReleased) if not IsPlayerFalling(player) then return end if bindingReleased == speedKeyBinding then player.gravityScale = 0 local velocity = player:GetVelocity() velocity.z = math.max(velocity.z, -slowFallSpeed) player:SetVelocity(velocity) end end local function OnMovementModeChanged(player, mode) if not IsPlayerFalling(player) then return end if mode == MovementMode.WALKING then player:Die() end end local function TogglePlayerFalling(player, state) if state then player.maxAcceleration = 10000 player.maxWalkSpeed = fallingWalkSpeed player.maxJumpCount = 0 player.isCrouchEnabled = false player.gravityScale = 0 local velocity = player:GetVelocity() velocity.z = -slowFallSpeed player:SetVelocity(velocity) else player.maxAcceleration = 1800 player.maxWalkSpeed = 640 player.maxJumpCount = 1 player.gravityScale = 1.9 end end local function OnEnterTunnel(theTrigger, player) TogglePlayerFalling(player, true) end local function OnRoundEnd() for _, player in ipairs(Game.GetPlayers()) do TogglePlayerFalling(player, false) end end local function OnFinishTunnel(theTrigger, player) TogglePlayerFalling(player, false) print("player finished") end local function OnPlayerJoin(player) player.respawnedEvent:Connect(function (player) TogglePlayerFalling(player, false) end) player.movementModeChangedEvent:Connect(OnMovementModeChanged) player.bindingPressedEvent:Connect(OnBindingPressed) player.bindingReleasedEvent:Connect(OnBindingReleased) end tunnelStartTrigger.beginOverlapEvent:Connect(OnEnterTunnel) tunnelEndTrigger.beginOverlapEvent:Connect(OnFinishTunnel) Game.roundEndEvent:Connect(OnRoundEnd) Game.playerJoinedEvent:Connect(OnPlayerJoin)
---------------------- -- Define hyper key -- ---------------------- hyper = {"ctrl", "alt", "cmd"} meta = {"cmd", "shift"}
FROM("gcr.io/distroless/static", "traefik") UPLOAD("traefik.v2.4.8", "/traefik") ENTRYPOINT("/traefik", "--config", "/config/traefik.yaml") COMMIT("traefik:2.4.8")
------------------------------------------------------------------------------ -- Tabs class ------------------------------------------------------------------------------ local ctrl = { nick = "tabs", parent = WIDGET, creation = "v", callback = { tabchange_cb = "ii", }, funcname = "Tabsv", createfunc = [[ static int Tabsv(lua_State *L) { Ihandle **hlist = iuplua_checkihandle_array(L, 1); Ihandle *h = IupTabsv(hlist); iuplua_plugstate(L, h); iuplua_pushihandle_raw(L, h); free(hlist); return 1; } ]], } function ctrl.createElement(class, arg) return Tabsv(arg) end iupRegisterWidget(ctrl) iupSetClass(ctrl, "iup widget")
-- Additions for Space Exploration mod. local util = require("__bztitanium__.data-util"); if data.raw.recipe["se-space-pipe"] then -- Space Exploration space stuff util.steel_to_titanium(data.raw.recipe["se-space-pipe"]) util.steel_to_titanium(data.raw.recipe["se-space-pipe"].normal) util.steel_to_titanium(data.raw.recipe["se-space-pipe"].expensive) util.steel_to_titanium(data.raw.recipe["se-space-transport-belt"]) util.steel_to_titanium(data.raw.recipe["se-space-transport-belt"].normal) util.steel_to_titanium(data.raw.recipe["se-space-transport-belt"].expensive) util.steel_to_titanium(data.raw.recipe["se-space-underground-belt"]) util.steel_to_titanium(data.raw.recipe["se-space-underground-belt"].normal) util.steel_to_titanium(data.raw.recipe["se-space-underground-belt"].expensive) util.steel_to_titanium(data.raw.recipe["se-space-splitter"]) util.steel_to_titanium(data.raw.recipe["se-space-splitter"].normal) util.steel_to_titanium(data.raw.recipe["se-space-splitter"].expensive) util.steel_to_titanium(data.raw.recipe["se-space-rail"]) util.steel_to_titanium(data.raw.recipe["se-space-rail"].normal) util.steel_to_titanium(data.raw.recipe["se-space-rail"].expensive) util.add_titanium_ingredient(1, data.raw.recipe["se-space-platform-scaffold"]) util.add_titanium_ingredient(1, data.raw.recipe["se-space-platform-scaffold"].normal) util.add_titanium_ingredient(1, data.raw.recipe["se-space-platform-scaffold"].expensive) -- Space Exploration alternative LDS util.steel_to_titanium(data.raw.recipe["se-low-density-structure-beryllium"]) util.steel_to_titanium(data.raw.recipe["se-low-density-structure-beryllium"].normal) util.steel_to_titanium(data.raw.recipe["se-low-density-structure-beryllium"].expensive) -- Space Exploration buildings util.add_titanium_ingredient(20, data.raw.recipe["se-condenser-turbine"]) util.add_titanium_ingredient(20, data.raw.recipe["se-condenser-turbine"].normal) util.add_titanium_ingredient(20, data.raw.recipe["se-condenser-turbine"].expensive) -- A couple more deeper tech thematic items to use titanium in. util.add_titanium_ingredient(2, data.raw.recipe["se-lattice-pressure-vessel"]) util.add_titanium_ingredient(2, data.raw.recipe["se-lattice-pressure-vessel"].normal) util.add_titanium_ingredient(2, data.raw.recipe["se-lattice-pressure-vessel"].expensive) util.add_titanium_ingredient(2, data.raw.recipe["se-aeroframe-bulkhead"]) util.add_titanium_ingredient(2, data.raw.recipe["se-aeroframe-bulkhead"].normal) util.add_titanium_ingredient(2, data.raw.recipe["se-aeroframe-bulkhead"].expensive) -- Organization data.raw.item["titanium-plate"].subgroup = "plates" -- deadlock loaders for SE -- mods["deadlock-beltboxes-loaders"] if mods["Deadlock-SE-bridge"] then if data.raw.recipe["se-space-transport-belt-loader"] then util.steel_to_titanium(data.raw.recipe["se-space-transport-belt-loader"]) util.steel_to_titanium(data.raw.recipe["se-space-transport-belt-loader"].normal) util.steel_to_titanium(data.raw.recipe["se-space-transport-belt-loader"].expensive) end if data.raw.recipe["se-space-transport-belt-beltbox"] then util.steel_to_titanium(data.raw.recipe["se-space-transport-belt-beltbox"]) util.steel_to_titanium(data.raw.recipe["se-space-transport-belt-beltbox"].normal) util.steel_to_titanium(data.raw.recipe["se-space-transport-belt-beltbox"].expensive) end end end
return {'opeen','opeendringen','opeengeklemd','opeengepakt','opeengepropt','opeenhopen','opeenhoping','opeens','opeenstapelen','opeenstapeling','opeenvolgen','opeenvolgend','opeenvolging','opeisbaar','opeisbaarheid','opeisen','opeising','open','openbaar','openbaarheid','openbaarheidsbeginsel','openbaarmaking','openbaarvervoerbedrijf','openbaarvervoerkaart','openbaarvervoermaatschappij','openbaarvervoerskaart','openbaarvervoertarief','openbaren','openbaring','openbaringsleer','openbarsten','openblijven','openbloeien','openbreken','openbreking','openbuigen','opendeurbeleid','opendeurdag','opendeurpolitiek','opendoen','opendraaien','openduwen','openeinderegeling','openeindregeling','openen','opener','opengaan','opengehakt','opengewerkt','opengooien','openhaardhout','openhakken','openhalen','openhangen','openhartchirurgie','openhartig','openhartigheid','openhartoperatie','openheid','openhouden','opening','openingsact','openingsartikel','openingsavond','openingsbalans','openingsbod','openingsceremonie','openingsceremonien','openingsconcert','openingsdag','openingsdatum','openingsdoelpunt','openingsduel','openingsetappe','openingsfase','openingsfeest','openingsfilm','openingsfolder','openingsgala','openingsgedicht','openingsgoal','openingshandeling','openingshoofdstuk','openingsklassieker','openingskoers','openingslied','openingsmanifestatie','openingsmatch','openingsnieuwtje','openingsnummer','openingspagina','openingspartij','openingsplechtigheid','openingsprogramma','openingsrace','openingsrede','openingsrit','openingsronde','openingsscene','openingssessie','openingsspeech','openingstheorie','openingstijd','openingstijden','openingstoespraak','openingstreffer','openingsuren','openingsuur','openingsverhaal','openingsverhouding','openingsvoorbereiding','openingsvoorstelling','openingsvraag','openingswedstrijd','openingsweekeinde','openingsweekend','openingswoord','openingszet','openingszin','openingszitting','openklappen','openknippen','openkrabben','openlaten','openleggen','openlegging','openliggen','openlijk','openluchtbad','openluchtconcert','openluchtdienst','openluchtexpositie','openluchtfestival','openluchtmis','openluchtmissen','openluchtmuseum','openluchtpodium','openluchtrecreatie','openluchtschool','openluchtspel','openluchttentoonstelling','openluchttheater','openluchtviering','openluchtvoorstelling','openluchtzwembad','openmaken','openpeuteren','openprikken','openrijten','openritsen','openrukken','openscheuren','openschuiven','openslaan','openslaand','opensnijden','opensourcelicentie','opensourceprogramma','opensourceproject','opensourcesoftware','openspalken','opensperren','opensplijten','openspringen','openstaan','openstaand','openstellen','openstelling','opentrappen','opentrekken','openvallen','openvliegen','openvouwen','openwerken','openwerpen','openzetten','openzwaaien','opera','operabel','operacomponist','operadebuut','operadirigent','operadiva','operafestival','operagebouw','operagezelschap','operahuis','operaklas','operalibretto','operamuziek','operand','operanden','operaorkest','operaproductie','operaregie','operaregisseur','operarepertoire','operaseizoen','operaster','operatesk','operateur','operatheater','operatie','operatieafdeling','operatiebasis','operatiecapaciteit','operatief','operatiegebied','operatiekamer','operatiemicroscoop','operatiepatient','operatieplan','operatietafel','operatietechniek','operatieterrein','operatieveld','operatiezaal','operatiezuster','operationaliseren','operationalisering','operationaliteit','operationeel','operator','operavoorstelling','operawereld','operazaal','operazanger','operazangeres','opereren','operette','operetteachtig','operettefiguur','operettegezelschap','operettezanger','operment','opeten','openluchtrecreatiebeleid','opeenklemmen','operakoor','operatiekamerpersoneel','openboektentamen','opendeurdienst','openingsdefile','openschieten','operarol','operaliefhebber','openingspost','operatiekwartier','openingsdans','openingsbel','openingsdeel','openingsgebed','openingshoek','openingskoor','openingskwartier','openingsreceptie','openingsscherm','openingsshot','openingsshow','openingsstoet','openingsstuk','openingstijdrit','openingstoernooi','openingstrack','openingstune','openingsweek','operatieassistent','operatiecentrum','operatiedatum','operatiehemd','operatiekleding','operatieteam','operatietijd','operatieverslag','operatiewond','operagebied','openingstentoonstelling','openingstekst','operapubliek','openingsdebat','openingscollege','openingsthema','openbaarvervoersysteem','openbronsoftware','openingstitel','opendocument','opentaal','opel','opeengehoopt','opeengehoopte','opeengepakte','opeengestapeld','opeengestapelde','opeenhoopt','opeenhoopten','opeenhopingen','opeenstapelde','opeenstapelingen','opeenstapelt','opeenvolgende','opeenvolgingen','opeet','opeis','opeisbare','opeisingen','opeist','opeiste','opeisten','openbaarde','openbaargemaakt','openbaarmakingen','openbaart','openbaarvervoerbedrijven','openbare','openbaringen','openbarst','openbarstte','openbarstten','openbleef','openbleven','openblijft','openbrak','openbraken','openbreek','openbreekt','opende','opendeden','opendeed','opendoe','opendoet','opendraai','opendraaide','opendraaiden','opendraait','openduw','openduwde','openduwden','openduwt','openend','openers','openga','opengaat','opengebarsten','opengebleven','opengebogen','opengebroken','opengedaan','opengedraaid','opengeduwd','opengegaan','opengegane','opengehaald','opengehaalde','opengehakte','opengehouden','opengeknipt','opengeknipte','opengeknoopt','opengeknoopte','opengekrabd','opengelaten','opengelegd','opengelegde','opengelegen','opengemaakt','opengemaakte','opengepeuterd','opengeprikt','opengereten','opengerukt','opengerukte','opengescheurd','opengescheurde','opengeschoven','opengeslagen','opengesneden','opengespalkt','opengespalkte','opengesperde','opengesprongen','opengestaan','opengesteld','opengetrapt','opengetrapte','opengetrokken','opengevallen','opengevlogen','opengevouwen','opengewerkte','opengezet','opengezette','openging','opengingen','openhangend','openhangende','openhartige','openhartiger','openhartigere','openhartigst','openhartigste','openhield','openhoud','openhoudt','openingen','openingetje','openingetjes','openingsceremonies','openingsfestiviteiten','openingshaakje','openingsplechtigheden','openingsredes','openingsspeeches','openingsvarianten','openingszinnen','openlaat','openliet','openlijke','openlijker','openlijkere','openlijkst','openlijkste','openluchtmusea','openluchtmuseums','openluchtscholen','openluchtspelen','openluchttheaters','openluchtvieringen','openmaak','openmaakt','openmaakte','openmaakten','openprikt','openruk','openrukt','openrukte','opensla','openslaande','openslaat','opensloeg','opensloegen','opensneden','opensneed','opensnijd','opensnijdt','opensourceprogrammas','opensourceprojecten','openspring','openspringt','opensprong','opensprongen','opensta','openstaande','openstaat','openstellingstijden','openstond','opent','opentrek','opentrekt','opentrok','opentrokken','openval','openvallende','openvalt','openviel','openvielen','openvliegt','openvlogen','openvloog','openvouw','openvouwde','openvouwden','openvouwt','openzet','openzette','operas','operaatje','operaatjes','operacomponisten','operafragmenten','operagebouwen','operakostuums','operaliefhebbers','operateurs','operatieafdelingen','operatieassistenten','operatiekamers','operatielittekens','operaties','operatietechnieken','operatieve','operatievelden','operationaliseer','operationaliseerde','operationaliseerden','operationaliseert','operationaliseringen','operationele','operatoren','operators','operazangeressen','operazangers','opereer','opereerde','opereerden','opereert','opererend','opererende','operettegezelschappen','operettes','operettetje','opeengedrongen','opeengevolgd','openbaarden','openbaarvervoerkaarten','openbarend','openbarende','openden','opendeurdagen','openende','opengaande','opengegooid','opengehangen','opengeklapt','opengesperd','opengespleten','opengestelde','opengeworpen','opengezwaaid','opengooit','openhartoperaties','openingskoersen','openingstoespraken','openingswedstrijden','openingswoorden','openingszetten','openklapt','openliggende','openligt','openluchtbaden','openluchtconcerten','openluchtfestivals','openluchtvoorstellingen','openluchtzwembaden','opens','openscheurde','openscheurt','openschuift','openspringende','openstelde','openstelt','openstonden','operabele','operagezelschappen','operahuizen','operaorkesten','operasterren','operatiebasissen','operatiegebieden','operatiepatienten','operatieplannen','operatietafels','operatiezalen','operavoorstellingen','operazalen','operettezangers','operarollen','operatiebases','operetje','operateske','openbaarvervoertarieven','operatiezusters','operettefiguren','operakoren','operaregisseurs','openbaarvervoerskaarten','openboektentamens','opendeurdiensten','opengeschoten','openhartigheden','openingsdata','openingsraces','openingsspeechen','operetteachtige','opels','openingsdagen','openingsfeestje','operaproducties','openingsscenes','openingshandelingen','openingsfilmpje','openingsbalansen','openingsnummers','operatheaters','openingshoeken','operatiehemdje','openingswoordje','operatieterreinen','openingszinnetje','openingshoofdstukken','operatiecentra','operaregies','openingsliedje','operalibrettos','openingsvragen','openingsdelen','operadivas','openbaarvervoersystemen'}
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Workspace = game:GetService("Workspace") local world = require(ReplicatedStorage.tetris.shared.world) for _, system in pairs(ReplicatedStorage.tetris.client.systems:GetChildren()) do world:addSystem(system) end local board = Instance.new("Part") board.Anchored = true board.CanCollide = false board.Transparency = 1 board.Name = "TetrisBoard" board.Parent = Workspace world:addComponent("tetris", board, { })
local M = {} local fn = vim.fn local shellescape = fn.shellescape local function range(from, to) local step = 1 return function(_, lastvalue) local nextvalue = lastvalue + step if step > 0 and nextvalue <= to or step < 0 and nextvalue >= to or step == 0 then return nextvalue end end,nil, from - step end function M.tests(first, last) local bin = vim.g.gotests_bin if fn.executable(bin) == nil then print('gotests.nvim: gotests binary not found.') return end -- search function names local matchstr = vim.fn.matchstr local getline = vim.fn.getline local funcMatch = '' for lineno in range(first, last) do local funcName = matchstr(getline(lineno), [[^func\s*\(([^)]\+)\)\=\s*\zs\w\+\ze(]]) if funcName ~= '' then funcMatch = funcMatch .. '|' .. funcName end end if funcMatch ~= '' then -- remove first pipe('|') funcMatch = string.sub(funcMatch, 2) else print('gotests.nvim: No function selected!') return end local tmplDir = '' if vim.g.gotests_template_dir ~= '' then tmplDir = '-template_dir ' .. shellescape(vim.g.gotests_template_dir) end local file = vim.fn.expand('%') local out = vim.fn.system(bin .. ' -w -only ' .. shellescape(funcMatch) .. ' ' .. tmplDir .. ' ' .. shellescape(file)) print('gotests.nvim: ' .. out) end function M.alltests() local bin = vim.g.gotests_bin if fn.executable(bin) == nil then print('gotests.nvim: gotests binary not found.') return end local tmplDir = '' if vim.g.gotests_template_dir ~= '' then tmplDir = '-template_dir ' .. shellescape(vim.g.gotests_template_dir) end local file = vim.fn.expand('%') local out = vim.fn.system(bin .. ' -w -all ' .. tmplDir .. ' ' .. shellescape(file)) print('gotests.nvim: ' .. out) end return M
do function run(msg, matches) return [[ > Alomina Bot Super GP > Anti spam bot in Lua SUDO : @AttackerTeleagent > with lots of COOL stuffs! ⚙ from now on you can have your own ANTI SPAM Group! just contact to our SUDO for buying GP!🎁 dont forget to visit our channel : @Alominateam Our Team: 👥 @spammer021 @AttackerTeleagent < Alomina , Group Manager > ]] end return { description = "", usage = "", patterns = { "^[/!#]alomina$" }, run = run } end
--inbetween.lua inbetween = {} require "states/game" local curSpecial = { {0, 255, 0, 255}, -- 1 {255, 255, 255, 255}, -- 2 {255, 255, 255, 255}, -- 3 {255, 255, 255, 255}, -- 4 {255, 255, 255, 255}, -- 5 {255, 255, 255, 255}, -- 6 } local states = { {"battle ", "level ", "special ", "help "}, {"vitality ", "endurance ", "strength ", "agility ", {255, 255, 0, 255}, "done "}, {"health ", "move ", "s-points ", "vitality ", "endurance ", "strength ", "agility ", "special ", {255, 255, 0, 255}, "done "}, {curSpecial[1], "heal ", curSpecial[2], "attack ", curSpecial[3], "perfect ", curSpecial[4], "gains ", curSpecial[5], "stamina ", curSpecial[6], "done "} } local state = 1 local function resetCurSpecial(x) for i = 1, #curSpecial do curSpecial[i] = {255, 255, 255, 255} end curSpecial[x] = {0, 255, 0, 255} states[4] = {curSpecial[1], "heal ", curSpecial[2], "attack ", curSpecial[3], "perfect ", curSpecial[4], "gains ", curSpecial[5], "stamina ", curSpecial[6], "done "} end local stats = {} local string = "" function inbetween:enter() inbetweenBG = maid64.newImage("img/inbetween.png") textBox = maid64.newImage("img/textbox.png") stats = getPlayerStats() end local function inbetweenParser(text) if state == 1 then if stripSpaces(text) == 'battle' then state = 1 correctWord:play() Gamestate.switch(game) elseif stripSpaces(text) == 'level' then state = 2 correctWord:play() setHelpLog("select a stat to improve!", {255, 255, 255, 255}) elseif stripSpaces(text) == 'help' then setHelpLog("type any stat for a description!", {255, 255, 255, 255}) state = 3 correctWord:play() elseif stripSpaces(text) == 'special' then setHelpLog("select a special ability!", {255, 255, 255, 255}) state = 4 correctWord:play() end elseif state == 2 then if stripSpaces(text) == 'vitality' then stats.vitality = stats.vitality + 1 if updatePlayerStats(stats) then setLog("vitality upgraded!") else setLog("you're out of skill points!") end correctWord:play() elseif stripSpaces(text) == 'endurance' then stats.endurance = stats.endurance + 1 if updatePlayerStats(stats) then setLog("endurance upgraded!") else setLog("you're out of skill points!") end correctWord:play() elseif stripSpaces(text) == 'strength' then stats.strength = stats.strength + 1 if updatePlayerStats(stats) then setLog("strength upgraded!") else setLog("you're out of skill points!") end correctWord:play() elseif stripSpaces(text) == 'agility' then stats.agility = stats.agility + 1 if updatePlayerStats(stats) then setLog("agility upgraded!") else setLog("you're out of skill points!") end correctWord:play() elseif stripSpaces(text) == 'done' then state = 1 clearHelpLog() correctWord:play() end elseif state == 3 then if stripSpaces(text) == 'health' then setHelpLog("health - your lifeforce, let it drop to 0 and you're out of the tournament!", {255, 255, 255, 255}) correctWord:play() elseif stripSpaces(text) == 'move' then setHelpLog("move - the number of words required for your next move. stamina is only added when a sentence is complete.", {255, 255, 255, 255}) correctWord:play() elseif stripSpaces(text) == 's-points' then setHelpLog({"s-points - points used to level up your stats between battles. you can do this now by selecting the ", {255, 255, 0, 255}, "level ", {255, 255, 255, 255}, "command on the previous menu. you currently have:", {255, 255, 0, 255}, " " .. stats.skillPoints}, {255, 255, 255, 255}) correctWord:play() elseif stripSpaces(text) == 'vitality' then setHelpLog("vitality - directly impacts your max health. more vitality means more health!", {255, 255, 255, 255}) correctWord:play() elseif stripSpaces(text) == 'endurance' then setHelpLog("endurance - affects how much damage you can negate during an enemy attack. essentially your defense!", {255, 255, 255, 255}) correctWord:play() elseif stripSpaces(text) == 'strength' then setHelpLog("strength - the amount of damage you can dish out when attacking!", {255, 255, 255, 255}) correctWord:play() elseif stripSpaces(text) == 'agility' then setHelpLog("agility - determines how much stamina you need for your next move. the more agility the less stamina you need!", {255, 255, 255, 255}) correctWord:play() elseif stripSpaces(text) == 'special' then setHelpLog("special - excess correct words will slowly power up your special bar allowing you to perform special moves without the cost of stamina! this transfers between fights so feel free to save it!", {255, 255, 255, 255}) correctWord:play() elseif stripSpaces(text) == 'done' then state = 1 correctWord:play() clearHelpLog() end elseif state == 4 then if stripSpaces(text) == 'heal' then setHelpLog("heal - heals the player for 5 health.", {255, 255, 255, 255}) setPlayerSpecial(getSpecials().heal) -- set player special correctWord:play() resetCurSpecial(1) elseif stripSpaces(text) == 'attack' then setHelpLog("attack - performs an extra attack without the cost of stamina.", {255, 255, 255, 255}) setPlayerSpecial(getSpecials().attack) -- set player special correctWord:play() resetCurSpecial(2) elseif stripSpaces(text) == 'perfect' then setHelpLog("perfect - perfect sentences deal 1 damage and heal 1 health! this is a passive special.", {255, 255, 255, 255}) setPlayerSpecial(getSpecials().perfect) -- set player special correctWord:play() resetCurSpecial(3) elseif stripSpaces(text) == 'gains' then setHelpLog("gains - gain stamina or special while defending incoming attacks! this is a passive special.", {255, 255, 255, 255}) setPlayerSpecial(getSpecials().gains) -- set player special correctWord:play() resetCurSpecial(4) elseif stripSpaces(text) == 'stamina' then setHelpLog("stamina - gain 5 percent more stamina per word! this is a passive special.", {255, 255, 255, 255}) setPlayerSpecial(getSpecials().stamina) -- set player special correctWord:play() resetCurSpecial(5) elseif stripSpaces(text) == 'done' then state = 1 correctWord:play() clearHelpLog() end end return '' end function inbetween:textinput(t) if t == ' ' then string = inbetweenParser(string .. t) else string = string .. t end if #string >= 20 then string = "" end clickClack() end function inbetween:keypressed(key, code) -- pressed backspace if key == "backspace" then string = string.sub(string, 1, #string - 1) clickClack() elseif key == "return" then string = inbetweenParser(string) end end function inbetween:update(dt) if stats.skillPoints > 0 then states[1] = {"battle ", {0, 255, 0, 255}, "level ", {255, 255, 255, 255}, "special ", "help "} else states[1] = {"battle ", "level ", "special ", "help "} end updatePoints(dt) stats = getPlayerStats() if fast:isPlaying() then fast:setVolume(fast:getVolume() - dt * 0.1) if fast:getVolume() <= 0 then fast:stop() fast:setVolume(0.25) end end if bossMusic:isPlaying() then bossMusic:setVolume(bossMusic:getVolume() - dt * 0.1) if bossMusic:getVolume() <= 0 then bossMusic:stop() bossMusic:setVolume(0.25) end end if menuMusic:isPlaying() then menuMusic:setVolume(menuMusic:getVolume() - dt * 0.1) if menuMusic:getVolume() <= 0 then menuMusic:stop() menuMusic:setVolume(1) end end end function inbetween:draw() maid64.start() love.graphics.draw(theTyper, 36, 30, 0, 1, 1, 0, 0) love.graphics.draw(getCurrentEnemy().portrait, 300, 36, 0, 1, 1, 0, 0) love.graphics.draw(inbetweenBG, 0, 0, 0, 1, 1, 0, 0) love.graphics.draw(textBox, 32, 189, 0, 1, 1, 32, 32) love.graphics.setFont(medFont) -- love.graphics.printf("next battle", 0, 10, 408, "center") love.graphics.printf("you", 32, 27, 80, "center") love.graphics.printf(getCurrentEnemy().name, 297, 27, 80, "center") -- draw player stats love.graphics.printf("health: " .. stats.healthMAX, 22, 120, 300, "left") love.graphics.printf("to move: " .. stats.staminaMAX, 22, 130, 300, "left") love.graphics.printf("s-points: " .. stats.skillPoints, 22, 140, 300, "left") love.graphics.printf("vitality: " .. stats.vitality, 155, 120, 300, "left") love.graphics.printf("endurance: " .. stats.endurance, 155, 130, 300, "left") love.graphics.printf("strength: " .. stats.strength, 155, 140, 300, "left") love.graphics.printf("agility: " .. stats.agility, 155, 150, 300, "left") love.graphics.printf("AKA:", 297, 120, 80, "center") love.graphics.printf(getCurrentEnemy().aka, 297, 130, 80, "center") love.graphics.printf(string, 0, 230, 102*4, "center") love.graphics.printf(states[state], 12, 190, 390, "center") drawHelpLog() drawLog() maid64.finish() end
data:extend({ { type = "technology", name = "orbital-ion-cannon", icon = "__Orbital Ion Cannon__/graphics/icon64.png", icon_size = 64, prerequisites = {"rocket-silo", "energy-weapons-damage-6"}, effects = { { type = "unlock-recipe", recipe = "orbital-ion-cannon" }, { type = "unlock-recipe", recipe = "ion-cannon-targeter" } }, unit = { count = 2500, ingredients = { {"automation-science-pack", 2}, {"logistic-science-pack", 2}, {"chemical-science-pack", 2}, {"military-science-pack", 2}, {"utility-science-pack", 2}, {"production-science-pack", 2}, {"space-science-pack", 1} }, time = 60 }, order = "k-a" }, { type = "technology", name = "auto-targeting", icon = "__Orbital Ion Cannon__/graphics/AutoTargetingTech.png", icon_size = 64, prerequisites = {"orbital-ion-cannon"}, effects = {}, unit = { count = 2000, ingredients = { {"automation-science-pack", 2}, {"logistic-science-pack", 2}, {"chemical-science-pack", 2}, {"military-science-pack", 2}, {"utility-science-pack", 2}, {"production-science-pack", 2}, {"space-science-pack", 2} }, time = 60 }, order = "k-b" }, }) if data.raw["item"]["bob-laser-turret-5"] and settings.startup["ion-cannon-bob-updates"].value then data.raw["technology"]["orbital-ion-cannon"].prerequisites = {"rocket-silo", "energy-weapons-damage-6", "bob-laser-turrets-5"} end if data.raw["item"]["fast-accumulator-3"] and data.raw["item"]["solar-panel-large-3"] and settings.startup["ion-cannon-bob-updates"].value then data.raw["technology"]["orbital-ion-cannon"].prerequisites = {"rocket-silo", "energy-weapons-damage-6", "bob-solar-energy-4", "bob-electric-energy-accumulators-4"} end if data.raw["item"]["fast-accumulator-3"] and data.raw["item"]["solar-panel-large-3"] and data.raw["item"]["bob-laser-turret-5"] and settings.startup["ion-cannon-bob-updates"].value then data.raw["technology"]["orbital-ion-cannon"].prerequisites = {"rocket-silo", "energy-weapons-damage-6", "bob-solar-energy-4", "bob-electric-energy-accumulators-4", "bob-laser-turrets-5"} end
--- Remote interface functions remote.add_interface("advanced-logistics-system", { showSettings = function(player) local index = player.index hideGUI(player, index) showSettings(player, index) end, activateSystem = function(player) local index = player.index local forceName = player.force.name init() initForce(player.force) global.hasSystem[forceName] = true initPlayer(player) initGUI(player, true) end } )
E2Lib.RegisterExtension("glon", true) if not glon then pcall(require,"glon") end local last_glon_error = "" -- GLON output validation local DEFAULT = {n={},ntypes={},s={},stypes={},size=0,depth=0} --[[ wire_expression2_glon = {} wire_expression2_glon.history = {} wire_expression2_glon.players = {} local function logGlonCall( self, glonString, ret, safeGlonObject ) local logEntry = { Expression2 = { Name = self.entity.name, Owner = self.entity.player, OwnerID = self.entity.player:IsValid() and self.entity.player:SteamID() or "[Unknown]", OwnerName = self.entity.player:IsValid() and self.entity.player:Name() or "[Unknown]", }, GLON = glonString, GLONOutput = ret, SafeOutput = safeGlonObject, Timestamp = os.date("%c") } wire_expression2_glon.history[#wire_expression2_glon.history + 1] = logEntry if self.entity.player:IsValid() then wire_expression2_glon.players[self.entity.player] = wire_expression2_glon.players[self.entity.player] or {} wire_expression2_glon.players[self.entity.player][#wire_expression2_glon.players[self.entity.player] + 1] = logEntry end end ]] local forbiddenTypes = { ["xgt"] = true, ["xwl"] = true } local typeSanitizers local function sanitizeGlonOutput ( self, glonOutputObject, objectType, safeGlonObjectMap ) self.prf = self.prf + 1 if not objectType then return nil end if forbiddenTypes[objectType] then return nil end if not wire_expression_types2[objectType] then return nil end safeGlonObjectMap = safeGlonObjectMap or { r = {}, t = {} } if not typeSanitizers[objectType] then if wire_expression_types2[objectType][6](glonOutputObject) then return nil end -- failed type validity check return glonOutputObject end return typeSanitizers[objectType] ( self, glonOutputObject, safeGlonObjectMap ) end typeSanitizers = { ["r"] = function ( self, glonOutputObject, safeGlonObjectMap ) if safeGlonObjectMap["r"][glonOutputObject] then return safeGlonObjectMap["r"][glonOutputObject] end local safeArray = {} if not glonOutputObject then return safeArray end safeGlonObjectMap["r"][glonOutputObject] = safeArray if !istable(glonOutputObject) then return safeArray end for k, v in pairs(glonOutputObject) do if type (k) == "number" then safeArray[k] = v end end return safeArray end, ["t"] = function ( self, glonOutputObject, safeGlonObjectMap ) if safeGlonObjectMap["t"][glonOutputObject] then return safeGlonObjectMap["t"][glonOutputObject] end local safeTable = table.Copy(DEFAULT) if not glonOutputObject then return safeTable end safeGlonObjectMap["t"][glonOutputObject] = safeTable if !istable(glonOutputObject) then return safeTable end if istable(glonOutputObject.s) and istable(glonOutputObject.stypes) then for k, v in pairs(glonOutputObject.s) do local objectType = glonOutputObject.stypes[k] local safeObject = sanitizeGlonOutput( self, v, objectType, safeGlonObjectMap ) if safeObject then safeTable.s[tostring(k)] = safeObject safeTable.stypes[tostring(k)] = objectType end end end if istable(glonOutputObject.n) and istable(glonOutputObject.ntypes) then for k, v in pairs(glonOutputObject.n) do if isnumber(k) then local objectType = glonOutputObject.ntypes[k] local safeObject = sanitizeGlonOutput( self, v, objectType, safeGlonObjectMap ) if safeObject then safeTable.n[k] = safeObject safeTable.ntypes[k] = objectType end end end end safeTable.size = table.Count(safeTable.s) + #safeTable.n return safeTable end, ["v"] = function ( self, glonOutputObject, safeGlonObjectMap ) if not glonOutputObject then return table.Copy(wire_expression_types2["v"][2]) end if isvector(glonOutputObject) then return { glonOutputObject.x, glonOutputObject.y, glonOutputObject.z } end if !istable(glonOutputObject) then return table.Copy(wire_expression_types2["v"][2]) end local safeValue = {} for i = 1, 3 do safeValue[i] = tonumber(glonOutputObject[i]) or wire_expression_types2["v"][2][i] end return safeValue end } -- Default sanitizer for types that are arrays of numbers local numericArrayDataTypes = { ["a"] = 3, ["c"] = 2, ["m"] = 9, ["q"] = 4, ["xm2"] = 4, ["xm4"] = 16, ["xv2"] = 2, ["xv4"] = 4 } for objectType, arrayLength in pairs(numericArrayDataTypes) do typeSanitizers[objectType] = function ( self, glonOutputObject, sanitizedGlonObjectMap ) if !istable(glonOutputObject) then return table.Copy(wire_expression_types2[objectType][2]) end local safeValue = {} for i = 1, arrayLength do safeValue[i] = tonumber(glonOutputObject[i]) or wire_expression_types2[objectType][2][i] end return safeValue end end __e2setcost(10) --- Encodes <data> into a string, using [[GLON]]. e2function string glonEncode(array data) if not glon then error( "Glon is not installed on this server. Please use von instead.", 0 ) end local ok, ret = pcall(glon.encode, data) if not ok then last_glon_error = ret ErrorNoHalt("glon.encode error: "..ret) return "" end if ret then self.prf = self.prf + #ret / 2 end return ret or "" end --- Decodes <data> into an array, using [[GLON]]. e2function array glonDecode(string data) if not glon then error( "Glon is not installed on this server. Please use von instead.", 0 ) end if not data then return {} end self.prf = self.prf + #data / 2 local ok, ret = pcall(glon.decode, data) if not ok then last_glon_error = ret ErrorNoHalt("glon.decode error: "..ret) return {} end local safeArray = sanitizeGlonOutput( self, ret, "r" ) -- logGlonCall( self, data, ret, safeArray ) return safeArray or {} end e2function string glonError() if not glon then error( "Glon is not installed on this server. Please use von instead.", 0 ) end return last_glon_error or "" end if glon then hook.Add("InitPostEntity", "wire_expression2_glonfix", function() -- Fixing other people's bugs... for i = 1,20 do local name, encode_types = debug.getupvalue(glon.Write, i) if name == "encode_types" then for _,tp in ipairs({"NPC","Vehicle","Weapon"}) do if not encode_types[tp] then encode_types[tp] = encode_types.Entity end end break end end end) end --------------------------------------------------------------------------- -- table glon --------------------------------------------------------------------------- __e2setcost(15) --- Encodes <data> into a string, using [[GLON]]. e2function string glonEncode(table data) = e2function string glonEncode(array data) __e2setcost(25) -- decodes a glon string and returns an table e2function table glonDecodeTable(string data) if not glon then error( "Glon is not installed on this server. Please use von instead.", 0 ) end if not data then return table.Copy(DEFAULT) end self.prf = self.prf + #data / 2 local ok, ret = pcall(glon.decode, data) if not ok then last_glon_error = ret ErrorNoHalt("glon.decode error: "..ret) return table.Copy(DEFAULT) end local safeTable = sanitizeGlonOutput( self, ret, "t" ) return safeTable or table.Copy(DEFAULT) end --------------------------------------------------------------------------- -- von --------------------------------------------------------------------------- local last_von_error __e2setcost(10) --- Encodes <data> into a string, using [[von]]. e2function string vonEncode(array data) local ok, ret = pcall(WireLib.von.serialize, data) if not ok then last_von_error = ret WireLib.ClientError("von.encode error: "..ret, self.player) return "" end if ret then self.prf = self.prf + #ret / 2 end return ret or "" end --- Decodes <data> into an array, using [[von]]. e2function array vonDecode(string data) if not data then return {} end self.prf = self.prf + #data / 2 local ok, ret = pcall(WireLib.von.deserialize, data) if not ok then last_von_error = ret WireLib.ClientError("von.decode error: "..ret, self.player) return {} end local safeArray = sanitizeGlonOutput( self, ret, "r" ) return safeArray or {} end e2function string vonError() return last_von_error or "" end __e2setcost(15) --- Encodes <data> into a string, using [[von]]. e2function string vonEncode(table data) = e2function string vonEncode(array data) __e2setcost(25) -- decodes a glon string and returns an table e2function table vonDecodeTable(string data) if not data then return table.Copy(DEFAULT) end self.prf = self.prf + #data / 2 local ok, ret = pcall(WireLib.von.deserialize, data) if not ok then last_von_error = ret WireLib.ClientError("von.decode error: "..ret, self.player) return table.Copy(DEFAULT) end local safeTable = sanitizeGlonOutput( self, ret, "t" ) return safeTable or table.Copy(DEFAULT) end
struct = { name = "messageStruct", fields = { {name = "term", type = "int"}, {name = "fromNode", type = "int"}, {name = "toNode", type = "int"}, {name = "type", type = "string"}, {name = "value", type = "string"} } } interface = { name = "minhaInt", methods = { ReceiveMessage = { resulttype = "string", args = { {direction = "in", type = "messageStruct"} } }, InitializeNode = { resulttype = "void", args = { {direction = "in", type = "string"}, {direction = "in", type = "string"} } }, StopNode ={ resulttype = "void", args = { } }, ApplyEntry ={ resulttype = "string", args = { {direction= "in", type="int"} }, }, Snapshot ={ resulttype = "void", args = { } }, } }
local menu = {} function menu.load( prev_state, ... ) music:play() end function menu.update( dt ) end function menu.draw() love.graphics.print("Menu gamestate. Press Enter to continue.", 280, 250) end function menu.keyreleased( key, code ) if key == "return" then gamestates.set_state( "game", { current_level = 1 } ) elseif key == 'escape' then love.event.quit() end end function menu.mousereleased( x, y, button, istouch ) if button == 'l' or button == 1 then gamestates.set_state( "game", { current_level = 1 } ) elseif button == 'r' or button == 2 then love.event.quit() end end return menu
-- //////////////////////////////////// -- // MYSQL // -- //////////////////////////////////// sqlUsername = exports.mysql:getMySQLUsername() sqlPassword = exports.mysql:getMySQLPassword() sqlDB = exports.mysql:getMySQLDBName() sqlHost = exports.mysql:getMySQLHost() sqlPort = exports.mysql:getMySQLPort() handler = mysql_connect(sqlHost, sqlUsername, sqlPassword, sqlDB, sqlPort) function checkMySQL() if not (mysql_ping(handler)) then handler = mysql_connect(sqlHost, sqlUsername, sqlPassword, sqlDB, sqlPort) end end setTimer(checkMySQL, 300000, 0) function closeMySQL() if (handler) then mysql_close(handler) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), closeMySQL) -- //////////////////////////////////// -- // MYSQL END // -- //////////////////////////////////// function addCandidate( thePlayer, commandName, targetPlayer ) if exports.global:isPlayerAdmin( thePlayer ) then if not targetPlayer then outputChatBox("SYNTAX: /" .. commandName .. " [player]", thePlayer, 255, 194, 14 ) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick( thePlayer, targetPlayer ) if targetPlayer then if getElementData( targetPlayer, "loggedin" ) == 1 then mysql_free_result( mysql_query( handler, "UPDATE characters SET election_candidate = 1 WHERE id = " .. getElementData( targetPlayer, "dbid" ) ) ) outputChatBox(targetPlayerName .. " is now a candidate for the election.", thePlayer, 0, 255, 0) candidates[ getElementData( targetPlayer, "dbid" ) ] = targetPlayerName setElementData( getResourceRootElement( ), "candidates", candidates ) else outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) end end end end end addCommandHandler( "addcandidate", addCandidate ) function delCandidate( thePlayer, commandName, targetPlayer ) if exports.global:isPlayerAdmin( thePlayer ) then if not targetPlayer then outputChatBox("SYNTAX: /" .. commandName .. " [player]", thePlayer, 255, 194, 14 ) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick( thePlayer, targetPlayer ) if targetPlayer then if getElementData( targetPlayer, "loggedin" ) == 1 then mysql_free_result( mysql_query( handler, "UPDATE characters SET election_candidate = 0 WHERE id = " .. getElementData( targetPlayer, "dbid" ) ) ) outputChatBox(targetPlayerName .. " is now no candidate for the election anymore.", thePlayer, 0, 255, 0) candidates[ getElementData( targetPlayer, "dbid" ) ] = nil setElementData( getResourceRootElement( ), "candidates", candidates ) else outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) end end end end end addCommandHandler( "delcandidate", delCandidate ) -- /resetpoll - deletes all votes function resetPoll( thePlayer ) if exports.global:isPlayerHeadAdmin( thePlayer ) then -- nobody voted for anyone mysql_free_result( mysql_query( handler, "UPDATE characters SET election_candidate = 0, election_canvote = 0, election_votedfor = 0" ) ) candidates = { } setElementData( getResourceRootElement( ), "candidates", candidates ) outputChatBox( "The poll has been reset.", thePlayer, 0, 255, 0 ) setElementData( getResourceRootElement( ), "open", false ) end end addCommandHandler( "resetpoll", resetPoll ) function openPoll( thePlayer ) if exports.global:isPlayerAdmin( thePlayer ) then -- check if there is an open poll local result = mysql_query( handler, "SELECT COUNT(*) FROM characters WHERE election_canvote > 0" ) if result then if tonumber( mysql_result( result, 1, 1 ) ) == 0 then -- noone can vote, evil -- grant permissions to vote if you have 12 hours ingame and a license mysql_free_result( mysql_query( handler, "UPDATE characters SET election_canvote = 1 WHERE hoursplayed > 12 AND car_license = 1 AND cked = 0" ) ) outputChatBox( "The poll has been opened.", thePlayer, 0, 255, 0 ) else -- people can vote already mysql_free_result( mysql_query( handler, "UPDATE characters SET election_canvote = 1 WHERE election_canvote > 0" ) ) outputChatBox( "The poll has been re-opened.", thePlayer, 0, 255, 0 ) end setElementData( getResourceRootElement( ), "open", true ) mysql_free_result( result ) else outputDebugString( mysql_error( handler ) ) outputChatBox( "Failed to open the Poll.", thePlayer ) end end end addCommandHandler( "openpoll", openPoll ) function closePoll( thePlayer ) if exports.global:isPlayerAdmin( thePlayer ) then -- check if there is an open poll local result = mysql_query( handler, "SELECT COUNT(*) FROM characters WHERE election_canvote > 0" ) if result then if tonumber( mysql_result( result, 1, 1 ) ) == 0 then -- noone can vote, can't stop outputChatBox( "There is no running poll!", thePlayer, 255, 0, 0 ) else -- people can vote already mysql_free_result( mysql_query( handler, "UPDATE characters SET election_canvote = 2 WHERE election_canvote > 0" ) ) outputChatBox( "The poll has been stopped.", thePlayer, 0, 255, 0 ) end setElementData( getResourceRootElement( ), "open", false ) mysql_free_result( result ) else outputDebugString( mysql_error( handler ) ) outputChatBox( "Failed to close the Poll.", thePlayer ) end end end addCommandHandler( "closepoll", closePoll )
local route = {map = {}, instance = nil} function route:new() local cls = {} setmetatable(cls, self) self.__index = self return cls end function route:get_instance() if self.instance == nil then self.instance = self:new() end return self.instance end function route:free() if self.instance then self.map = nil self.map = {} self.instance = nil end end function route:add(method, pattern, callback) local ele = {} ele.method = method ele.pattern = pattern ele.callback = callback self.map[#(self.map) + 1] = ele end function route:run(req, res) local uri = req:uri() for i = 1, #(self.map) do local ele = self.map[i] for j, m in pairs(ele.method) do if m == req:method() then local param = string.match(uri, ele.pattern) if param then ele.callback(req, res, {param}) return end end end end end return route
require("freq") EventHandler.instance:on(Events.INIT, function(ev) FreqTraffic.instance = FreqTraffic() end) require("traffic") require("traffic_events") EventHandler.instance:on(Events.INIT, function(ev) Traffic.instance = Traffic() TrafficEvents.instance = TrafficEvents(Traffic.instance) end)
fprp.initDatabase = fprp.stub{ name = "initDatabase", description = "Initialize the fprp database.", parameters = { }, returns = { }, metatable = fprp } fprp.storeRPName = fprp.stub{ name = "storeRPName", description = "Store an RP name in the database.", parameters = { { name = "ply", description = "The player that gets the RP name.", type = "Player", optional = false }, { name = "name", description = "The new name of the player.", type = "string", optional = false } }, returns = { }, metatable = fprp } fprp.retrieveRPNames = fprp.stub{ name = "retrieveRPNames", description = "Whether a given RP name is taken by someone else.", parameters = { { name = "name", description = "The RP name.", type = "string", optional = false }, { name = "callback", description = "The function that receives the boolean answer in its first parameter.", type = "function", optional = false } }, returns = { }, metatable = fprp } fprp.retrievePlayerData = fprp.stub{ name = "retrievePlayerData", description = "Get a player's information from the database.", parameters = { { name = "ply", description = "The player to get the data for.", type = "Player", optional = false }, { name = "callback", description = "The function that receives the information.", type = "function", optional = false } }, returns = { }, metatable = fprp } fprp.createPlayerData = fprp.stub{ name = "createPlayerData", description = "Internal function: creates an entry in the database for a player who has joined for the first time.", parameters = { { name = "ply", description = "The player to create the data for.", type = "Player", optional = false }, { name = "name", description = "The name of the player.", type = "string", optional = false }, { name = "wallet", description = "The amount of shekel the player has.", type = "number", optional = false }, { name = "salary", description = "The salary of the player.", type = "number", optional = false } }, returns = { }, metatable = fprp } fprp.storeshekel = fprp.stub{ name = "storeshekel", description = "Internal function. Store a player's shekel in the database. Do not call this if you just want to set someone's shekel, the player will not see the change!", parameters = { { name = "ply", description = "The player.", type = "Player", optional = false }, { name = "amount", description = "The new contents of the player's wallet.", type = "number", optional = false } }, returns = { }, metatable = fprp } fprp.storeSalary = fprp.stub{ name = "storeSalary", description = "Internal function. Store a player's salary in the database. Do not call this if you just want to set someone's salary, the player will not see the change!", parameters = { { name = "ply", description = "The player.", type = "Player", optional = false }, { name = "amount", description = "The new contents of the player's wallet.", type = "number", optional = false } }, returns = { { name = "amount", description = "The new contents of the player's wallet.", type = "number" } }, metatable = fprp } fprp.retrieveSalary = fprp.stub{ name = "retrieveSalary", description = "Get a player's salary from the database.", parameters = { { name = "ply", description = "The player to get the data for.", type = "Player", optional = false }, { name = "callback", description = "The function that receives the salary.", type = "function", optional = false } }, returns = { }, metatable = fprp } fprp.restorePlayerData = fprp.stub{ name = "restorePlayerData", description = "Internal function that restores a player's fprp information when they join.", parameters = { }, returns = { }, metatable = fprp } fprp.storeDoorData = fprp.stub{ name = "storeDoorData", description = "Store the information about a door in the database.", parameters = { { name = "ent", description = "The door.", type = "Entity", optional = false } }, returns = { }, metatable = fprp } fprp.storeTeamDoorOwnability = fprp.stub{ name = "storeTeamDoorOwnability", description = "Store the ownability information of a door in the database.", parameters = { { name = "ent", description = "The door.", type = "Entity", optional = false } }, returns = { }, metatable = fprp } fprp.storeDoorGroup = fprp.stub{ name = "storeDoorGroup", description = "Store the group of a door in the database.", parameters = { { name = "ent", description = "The door.", type = "Entity", optional = false }, { name = "group", description = "The group of the door.", type = "string", optional = false } }, returns = { }, metatable = fprp } fprp.notify = fprp.stub{ name = "notify", description = "Make a notification pop up on the player's screen.", parameters = { { name = "ply", description = "The receiver of the message.", type = "Player", optional = false }, { name = "MsgType", description = "The type of the message.", type = "number", optional = false }, { name = "time", description = "For how long the notification should stay on the screen.", type = "number", optional = false }, { name = "message", description = "The actual message.", type = "string", optional = false } }, returns = { }, metatable = fprp } fprp.notifyAll = fprp.stub{ name = "notifyAll", description = "Make a notification pop up on the everyone's screen.", parameters = { { name = "msgType", description = "The type of the message.", type = "number", optional = false }, { name = "time", description = "For how long the notification should stay on the screen.", type = "number", optional = false }, { name = "message", description = "The actual message.", type = "string", optional = false } }, returns = { }, metatable = fprp } fprp.printMessageAll = fprp.stub{ name = "printMessageAll", description = "Make a notification pop up in the middle of everyone's screen.", parameters = { { name = "msgType", description = "The type of the message.", type = "number", optional = false }, { name = "message", description = "The actual message.", type = "string", optional = false } }, returns = { }, metatable = fprp } fprp.talkToRange = fprp.stub{ name = "talkToRange", description = "Send a chat message to people close to a player.", parameters = { { name = "ply", description = "The sender of the message.", type = "Player", optional = false }, { name = "playerName", description = "The name of the sender of the message.", type = "string", optional = false }, { name = "message", description = "The actual message.", type = "string", optional = false }, { name = "size", description = "The radius of the circle in which players can see the message in chat.", type = "number", optional = false } }, returns = { }, metatable = fprp } fprp.talkToPerson = fprp.stub{ name = "talkToPerson", description = "Send a chat message to a player.", parameters = { { name = "receiver", description = "The receiver of the message.", type = "Player", optional = false }, { name = "col1", description = "The color of the first part of the message.", type = "Color", optional = false }, { name = "text1", description = "The first part of the message.", type = "string", optional = false }, { name = "col2", description = "The color of the second part of the message.", type = "Color", optional = false }, { name = "text2", description = "The secpnd part of the message.", type = "string", optional = false }, { name = "sender", description = "The sender of the message.", type = "Player", optional = true } }, returns = { }, metatable = fprp } fprp.isEmpty = fprp.stub{ name = "isEmpty", description = "Check whether the given position is empty.", parameters = { { name = "pos", description = "The position to check for emptiness.", type = "Vector", optional = false }, { name = "ignore", description = "Table of things the algorithm can ignore.", type = "table", optional = true } }, returns = { { name = "empty", description = "Whether the given position is empty.", type = "boolean" } }, metatable = fprp } -- findEmptyPos(pos, ignore, distance, step, area) -- returns pos fprp.findEmptyPos = fprp.stub{ name = "findEmptyPos", description = "Find an empty position as close as possible to the given position (Note: this algorithm is slow!).", parameters = { { name = "pos", description = "The position to check for emptiness.", type = "Vector", optional = false }, { name = "ignore", description = "Table of things the algorithm can ignore.", type = "table", optional = true }, { name = "distance", description = "The maximum distance to look for empty positions.", type = "number", optional = false }, { name = "step", description = "The size of the steps to check (it places it will look are STEP units removed from one another).", type = "number", optional = false }, { name = "area", description = "The hull to check, this is Vector(16, 16, 64) for players.", type = "Vector", optional = false } }, returns = { { name = "pos", description = "A found position. When no position was found, the parameter is returned", type = "Vector" } }, metatable = fprp } fprp.PLAYER.removefprpVar = fprp.stub{ name = "removefprpVar", description = "Remove a shared variable. Exactly the same as ply:setfprpVar(nil).", parameters = { { name = "variable", description = "The name of the variable.", type = "string", optional = false }, { name = "target", description = "the clients to whom this variable is sent.", type = "CRecipientFilter", optional = true } }, returns = {}, metatable = fprp.PLAYER } fprp.PLAYER.setfprpVar = fprp.stub{ name = "setfprpVar", description = "Set a shared variable. Make sure the variable is registered with fprp.registerfprpVar!", parameters = { { name = "variable", description = "The name of the variable.", type = "string", optional = false }, { name = "value", description = "The value of the variable.", type = "any", optional = false }, { name = "target", description = "the clients to whom this variable is sent.", type = "CRecipientFilter", optional = true } }, returns = {}, metatable = fprp.PLAYER } fprp.PLAYER.setSelffprpVar = fprp.stub{ name = "setSelffprpVar", description = "Set a shared variable that is only seen by the player to whom this variable applies.", parameters = { { name = "variable", description = "The name of the variable.", type = "string", optional = false }, { name = "value", description = "The value of the variable.", type = "any", optional = false } }, returns = {}, metatable = fprp.PLAYER } fprp.PLAYER.sendfprpVars = fprp.stub{ name = "sendfprpVars", description = "Internal function. Sends all visiblefprpVars of all players to this player.", parameters = { }, returns = {}, metatable = fprp.PLAYER } fprp.PLAYER.setRPName = fprp.stub{ name = "setRPName", description = "Set the RPName of a player.", parameters = { { name = "name", description = "The new name of the player.", type = "string", optional = false }, { name = "firstrun", description = "Whether to play nice and find a different name if it has been taken (true) or to refuse the name change when taken (false).", type = "boolean", optional = true } }, returns = {}, metatable = fprp.PLAYER } fprp.PLAYER.addCustomEntity = fprp.stub{ name = "addCustomEntity", description = "Add a custom entity to the player's limit.", parameters = { { name = "tblEnt", description = "The entity table (from the fprpEntities table).", type = "table", optional = false } }, returns = {}, metatable = fprp.PLAYER } fprp.PLAYER.removeCustomEntity = fprp.stub{ name = "removeCustomEntity", description = "Remove a custom entity to the player's limit.", parameters = { { name = "tblEnt", description = "The entity table (from the fprpEntities table).", type = "table", optional = false } }, returns = {}, metatable = fprp.PLAYER } fprp.PLAYER.customEntityLimitReached = fprp.stub{ name = "customEntityLimitReached", description = "Set a shared variable.", parameters = { { name = "tblEnt", description = "The entity table (from the fprpEntities table).", type = "table", optional = false } }, returns = { { name = "limitReached", description = "Whether the limit has been reached.", type = "boolean" } }, metatable = fprp.PLAYER } fprp.PLAYER.getPreferredModel = fprp.stub{ name = "getPreferredModel", description = "Get the preferred model of a player for a job.", parameters = { { name = "TeamNr", description = "The job number.", type = "number", optional = false } }, returns = { { name = "model", description = "The preferred model for the job.", type = "string" } }, metatable = fprp.PLAYER } fprp.hookStub{ name = "UpdatePlayerSpeed", description = "Change a player's walking and running speed.", parameters = { { name = "ply", description = "The player for whom the speed changes.", type = "Player" } }, returns = { } } fprp.hookStub{ name = "fprpDBInitialized", description = "Called when fprp is done initializing the database.", parameters = { }, returns = { } } fprp.hookStub{ name = "CanChangeRPName", description = "Whether a player can change their RP name.", parameters = { { name = "ply", description = "The player.", type = "Player" }, { name = "name", description = "The name.", type = "string" } }, returns = { { name = "answer", description = "Whether the player can change their RP names.", type = "boolean" }, { name = "reason", description = "When answer is false, this return value is the reason why.", type = "string" } } } fprp.hookStub{ name = "onPlayerChangedName", description = "Called when a player's fprp name has been changed.", parameters = { { name = "ply", description = "The player.", type = "Player" }, { name = "oldName", description = "The old name.", type = "string" }, { name = "newName", description = "The new name.", type = "string" } }, returns = { } } fprp.hookStub{ name = "playerBoughtPistol", description = "Called when a player bought a pistol.", parameters = { { name = "ply", description = "The player.", type = "Player" }, { name = "weaponTable", description = "The table (from the CustomShipments table).", type = "table" }, { name = "ent", description = "The spawned weapon.", type = "Weapon" }, { name = "price", description = "The eventual price.", type = "number" } }, returns = { } } fprp.hookStub{ name = "playerBoughtShipment", description = "Called when a player bought a shipment.", parameters = { { name = "ply", description = "The player.", type = "Player" }, { name = "shipmentTable", description = "The table (from the CustomShipments table).", type = "table" }, { name = "ent", description = "The spawned entity.", type = "Entity" }, { name = "price", description = "The eventual price.", type = "number" } }, returns = { } } fprp.hookStub{ name = "playerBoughtCustomVehicle", description = "Called when a player bought a vehicle.", parameters = { { name = "ply", description = "The player.", type = "Player" }, { name = "vehicleTable", description = "The table (from the CustomVehicles table).", type = "table" }, { name = "ent", description = "The spawned vehicle.", type = "Entity" }, { name = "price", description = "The eventual price.", type = "number" } }, returns = { } } fprp.hookStub{ name = "playerBoughtCustomEntity", description = "Called when a player bought an entity (like a shekel printer or a gun lab).", parameters = { { name = "ply", description = "The player.", type = "Player" }, { name = "entityTable", description = "The table of the custom entity (from the fprpEntities table).", type = "table" }, { name = "ent", description = "The spawned vehicle.", type = "Entity" }, { name = "price", description = "The eventual price.", type = "number" } }, returns = { } } fprp.hookStub{ name = "canDemote", description = "Whether a player can demote another player.", parameters = { { name = "ply", description = "The player who wants to demote.", type = "Player" }, { name = "target", description = "The player whom is to be demoted.", type = "Player" }, { name = "reason", description = "The reason provided for the demote.", type = "string" } }, returns = { { name = "canDemote", description = "Whether the player can change demote the target.", type = "boolean" }, { name = "message", description = "The message to show when the player cannot demote the other player. Only useful when canDemote is false.", type = "string" } } } fprp.hookStub{ name = "onPlayerDemoted", description = "Called when a player is demoted.", parameters = { { name = "source", description = "The player who demoted the target.", type = "Player" }, { name = "target", description = "The player who has been demoted.", type = "Player" }, { name = "reason", description = "The reason provided for the demote.", type = "string" } }, returns = { } } fprp.hookStub{ name = "canDropWeapon", description = "Whether a player can drop a certain weapon.", parameters = { { name = "ply", description = "The player who wants to drop the weapon.", type = "Player" }, { name = "weapon", description = "The weapon the player wants to drop.", type = "Weapon" } }, returns = { { name = "canDrop", description = "Whether the player can drop the weapon.", type = "boolean" } } } fprp.hookStub{ name = "canSeeLogMessage", description = "Whether a player can see a fprp log message in the console.", parameters = { { name = "ply", description = "The player.", type = "Player" }, { name = "message", description = "The log message.", type = "string" }, { name = "color", description = "The color of the message.", type = "Color" } }, returns = { { name = "canHear", description = "Whether the player can see the log message.", type = "boolean" } } } fprp.hookStub{ name = "canVote", description = "Whether a player can cast a vote.", parameters = { { name = "ply", description = "The player.", type = "Player" }, { name = "vote", description = "Table containing all information about the vote.", type = "table" } }, returns = { { name = "canVote", description = "Whether the player can vote.", type = "boolean" }, { name = "message", description = "The message to show when the player cannot vote. Only useful when canVote is false.", type = "string" } } } fprp.hookStub{ name = "playerGetSalary", description = "When a player receives salary.", parameters = { { name = "ply", description = "The player who is receiving salary.", type = "Player" }, { name = "amount", description = "The amount of shekel given to the player.", type = "number" } }, returns = { { name = "suppress", description = "Suppress the salary message.", type = "boolean" }, { name = "message", description = "Override the default message (suppress must be false).", type = "string" }, { name = "amount", description = "Override the salary.", type = "number" } } } fprp.hookStub{ name = "playerWalletChanged", description = "When a player receives shekel.", parameters = { { name = "ply", description = "The player who is getting shekel.", type = "Player" }, { name = "amount", description = "The amount of shekel given to the player.", type = "number" } }, returns = { { name = "total", description = "Override the total amount of shekel (optional).", type = "number" } } }
local TradeTicket = {} local BUY = 0 local SELL = 1 function TradeTicket:new(o) o = o or {} -- create object if user does not provide one setmetatable(o, self) self.__index = self local window = Apollo.LoadForm(TradeTicket.xmlDoc, "TradeTicket", nil, o) o.window = window Apollo.RegisterEventHandler("PostCommodityOrderResult", "OnPostCommodityOrderResult", o) o:Init() return o end function TradeTicket:Init() self:DisableExecuteButton() self.buySell = BUY self.volume = 1 self.price = 0 self:SetTextFields() self:SetIcon() self:Validate() end function TradeTicket:SetTextFields() self.window:FindChild("CommodityName"):SetText(self.commodity:GetName()) self:SetBuyPrices() end function TradeTicket:SetBuyPrices() self.window:FindChild("Top1Value"):SetText(self.commodity.buy1) self.window:FindChild("Top10Value"):SetText(self.commodity.buy10) self.window:FindChild("Top50Value"):SetText(self.commodity.buy50) self.window:FindChild("OrderCount"):SetText(self.commodity.sellOrderCount) end function TradeTicket:SetSellPrices() self.window:FindChild("Top1Value"):SetText(self.commodity.sell1) self.window:FindChild("Top10Value"):SetText(self.commodity.sell10) self.window:FindChild("Top50Value"):SetText(self.commodity.sell50) self.window:FindChild("OrderCount"):SetText(self.commodity.buyOrderCount) end function TradeTicket:SetIcon() self.window:FindChild("TradeWindow"):FindChild("CommodityItem"):SetSprite(self.commodity:GetIcon()) local tItem = self.commodity:GetItem() local tooltip = Tooltip.GetItemTooltipForm(self, self.window:FindChild("TradeWindow"):FindChild("CommodityItem"), tItem, {bPrimary = true, bSelling = false, itemCompare = tItem:GetEquippedItemForItemType()} ) end function TradeTicket:OnPostCommodityOrderResult(eAuctionPostResult, orderSource, nActualCost) MarketplaceLib.RequestOwnedCommodityOrders() local isBuy = orderSource:IsBuy() local isLimitOrder = false if orderSource:GetExpirationTime() then isLimitOrder = true end self:HideTradeWindow() self:ShowConfirmationWindow() --Print(isBuy .. " | " .. count .. " | " .. itemName) local okMessage = "You succesfully " .. self:BoughtOrSoldString() .. " " .. orderSource:GetCount() .. " [" .. orderSource:GetItem():GetName() .. "] at " .. orderSource:GetPricePerUnit():GetAmount() .. "c each" if isLimitOrder then okMessage = "You succesfully created a Limit Order to " .. self:BuyOrSellString() .. " " .. orderSource:GetCount() .. " [" .. orderSource:GetItem():GetName() .. "] at " .. orderSource:GetPricePerUnit():GetAmount() .. "c each" end local responseString = { [MarketplaceLib.AuctionPostResult.Ok] = okMessage, [MarketplaceLib.AuctionPostResult.DbFailure] = Apollo.GetString("MarketplaceAuction_TechnicalDifficulties"), [MarketplaceLib.AuctionPostResult.Item_BadId] = Apollo.GetString("MarketplaceAuction_CantPostInvalidItem"), [MarketplaceLib.AuctionPostResult.NotEnoughToFillQuantity] = Apollo.GetString("GenericError_Vendor_NotEnoughToFillQuantity"), [MarketplaceLib.AuctionPostResult.NotEnoughCash] = Apollo.GetString("GenericError_Vendor_NotEnoughCash"), [MarketplaceLib.AuctionPostResult.NotReady] = Apollo.GetString("MarketplaceAuction_TechnicalDifficulties"), [MarketplaceLib.AuctionPostResult.CannotFillOrder] = Apollo.GetString("MarketplaceCommodities_NoOrdersFound"), [MarketplaceLib.AuctionPostResult.TooManyOrders] = Apollo.GetString("MarketplaceAuction_MaxOrders"), [MarketplaceLib.AuctionPostResult.OrderTooBig] = Apollo.GetString("MarketplaceAuction_OrderTooBig") } local confirmationString = responseString[eAuctionPostResult] -- .. "\n\n" .. Apollo.GetString("MarketplaceCommodity_CannotFillBuyOrder") .. "\n\n" .. Apollo.GetString("MarketplaceCommodity_CannotFillSellOrder") Print(confirmationString) self:SetConfirmationString(confirmationString) end function TradeTicket:OnListInputNumberChanged() self.volume = self.window:FindChild("TradeWindow"):FindChild("ListInputNumber"):GetText() self:Validate() end function TradeTicket:OnListInputPriceAmountChanged() self.price = math.max(0, tonumber(self.window:FindChild("TradeWindow"):FindChild("ListInputPrice"):GetAmount() or 0)) self:Validate() end function TradeTicket:OnListInputNumberDownBtn() self.volume = math.max(0, self.volume - 1) self:UpdateVolumeField() end function TradeTicket:OnListInputNumberUpBtn() self.volume = self.volume + 1 self:UpdateVolumeField() end function TradeTicket:OnCloseTicket() self.window:Close() end function TradeTicket:OnExecuteTrade() end function TradeTicket:UpdateVolumeField() self.window:FindChild("TradeWindow"):FindChild("ListInputNumber"):SetText(self.volume) self:Validate() end function TradeTicket:HideTradeWindow() self.window:FindChild("TradeWindow"):Show(false) end function TradeTicket:ShowConfirmationWindow() self.window:FindChild("ConfirmationWindow"):Show(true) end function TradeTicket:SetConfirmationString(string) self.window:FindChild("ConfirmationMessage"):SetText(string) end function TradeTicket:EnableExecuteButton() function round(num, idp) local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult end local executeButton = self.window:FindChild("ExecuteButton") local order if self.buySell == BUY then order = CommodityOrder.newBuyOrder(self.commodity:GetId()) order:SetForceImmediate(false) -- If false then a Order will be created, rather than booking at market else order = CommodityOrder.newSellOrder(self.commodity:GetId()) order:SetForceImmediate(false) -- If false then a Order will be created, rather than booking at market end local volume = tonumber(self.window:FindChild("TradeWindow"):FindChild("ListInputNumber"):GetText()) order:SetCount(volume) order:SetPrices(self.window:FindChild("TradeWindow"):FindChild("ListInputPrice"):GetCurrency()) if order:CanPost() then local execBtn = self.window:FindChild("Button") execBtn:SetActionData(GameLib.CodeEnumConfirmButtonType.MarketplaceCommoditiesSubmit, order) executeButton:Enable(true) local totalPrice = order:GetCount() * order:GetPricePerUnit():GetAmount() + order:GetTax():GetAmount() local each = round(totalPrice / order:GetCount(),2) local text = "You are going to " .. self:BuyOrSellString() .. " " .. order:GetCount() .. " [" .. self.commodity:GetName() .. "] for " .. order:GetPricePerUnit():GetAmount() .. "c each plus a fee of " .. order:GetTax():GetAmount() .. "c for total price of " .. totalPrice .. "c costing roughly " .. each .. " per unit" self.window:FindChild("TradeWindow"):FindChild("SummaryText"):SetText(text) else end end function TradeTicket:DisableExecuteButton() self.window:FindChild("ExecuteButton"):Enable(false) local text = "Set a valid price and volume" self.window:FindChild("TradeWindow"):FindChild("SummaryText"):SetText(text) end function TradeTicket:OnBuySellToggle() if self.buySell == BUY then self.buySell = SELL self.window:FindChild("BuySellButton"):SetText("Sell") self:SetSellPrices() else self.buySell = BUY self.window:FindChild("BuySellButton"):SetText("Buy") self:SetBuyPrices() end self:Validate() end function TradeTicket:Validate() local orderPrice = self.price * self.volume local orderFee = math.max(orderPrice * MarketplaceLib.kfCommodityBuyOrderTaxMultiplier, MarketplaceLib.knCommodityBuyOrderTaxMinimum) local totalPrice = orderPrice + orderFee if totalPrice > 0 then self:EnableExecuteButton() else self:DisableExecuteButton() end end function TradeTicket:BuyOrSellString() if self.buySell == BUY then return "Buy" else return "Sell" end end function TradeTicket:BoughtOrSoldString() if self.buySell == BUY then return "Bought" else return "Sold" end end function TradeTicket:HelperFormatTimeString(oExpirationTime) local strResult = "" local nInSeconds = math.floor(math.abs(Time.SecondsElapsed(oExpirationTime))) -- CLuaTime object local nHours = math.floor(nInSeconds / 3600) local nMins = math.floor(nInSeconds / 60 - (nHours * 60)) if nHours > 0 then strResult = String_GetWeaselString(Apollo.GetString("MarketplaceListings_Hours"), nHours) elseif nMins > 0 then strResult = String_GetWeaselString(Apollo.GetString("MarketplaceListings_Minutes"), nMins) else strResult = Apollo.GetString("MarketplaceListings_LessThan1m") end return strResult end Apollo.RegisterPackage(TradeTicket, "TradeTicket", 1, {})
-- Copyright (c) 2018 Redfern, Trevor <trevorredfern@gmail.com> -- -- This software is released under the MIT License. -- https://opensource.org/licenses/MIT local Queue = require "moonpie.collections.queue" local results = Queue:new() local oldrandom = math.random local function setreturnvalues(o) for _, v in ipairs(o) do results:enqueue(v) end end local function nextresult(...) if results:isempty() then return oldrandom(...) end return results:dequeue() end math.random = nextresult return { setreturnvalues = setreturnvalues }
------------------------------------------------------------------------------- -- Spine Runtimes License Agreement -- Last updated January 1, 2020. Replaces all prior versions. -- -- Copyright (c) 2013-2020, Esoteric Software LLC -- -- Integration of the Spine Runtimes into software or otherwise creating -- derivative works of the Spine Runtimes is permitted under the terms and -- conditions of Section 2 of the Spine Editor License Agreement: -- http://esotericsoftware.com/spine-editor-license -- -- Otherwise, it is permitted to integrate the Spine Runtimes into software -- or otherwise create derivative works of the Spine Runtimes (collectively, -- "Products"), provided that each user of the Products must obtain their own -- Spine Editor license and redistribution of the Products in any form must -- include this license and copyright notice. -- -- THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY -- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -- DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY -- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, -- BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND -- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -- THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- local interpolation = {} local math_pow = math.pow function interpolation.apply (func, start, _end, a) return start + (_end - start) * func(a) end function interpolation.pow2(a) if (a <= 0.5) then return math_pow(a * 2, 2) / 2 end return math_pow((a - 1) * 2, 2) / -2 + 1 end function interpolation.pow2out(a) return math_pow(a - 1, 2) * -1 + 1 end return interpolation
local util = require("util") vim.o.completeopt = "menuone,noselect" require("compe").setup({ enabled = true, autocomplete = true, debug = false, min_length = 1, preselect = "always", -- changed to "enable" to prevent auto select throttle_time = 80, source_timeout = 200, incomplete_delay = 400, max_abbr_width = 100, max_kind_width = 100, max_menu_width = 100, documentation = { border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, }, source = { path = true, buffer = true, calc = true, nvim_lsp = true, nvim_lua = false, vsnip = false, luasnip = true, treesitter = false, emoji = true, spell = true, }, }) util.inoremap("<C-Space>", "compe#complete()", { expr = true }) util.inoremap("<C-e>", "compe#close('<C-e>')", { expr = true }) local function complete() if vim.fn.pumvisible() == 1 then return vim.fn["compe#confirm"]({ keys = "<cr>", select = true }) else return require("nvim-autopairs").autopairs_cr() end end util.imap("<CR>", complete, { expr = true }) vim.cmd([[autocmd User CompeConfirmDone silent! lua vim.lsp.buf.signature_help()]])
-- {{{ other files -- todo: too many things require too many other things, needs fix local config = require("celediel.NPCsGoHome.config").getConfig() local common = require("celediel.NPCsGoHome.common") local checks = require("celediel.NPCsGoHome.functions.checks") local processors = require("celediel.NPCsGoHome.functions.processors") local interop = require("celediel.NPCsGoHome.interop") -- }}} -- {{{ variables and such -- timers local updateTimer local postDialogueTimer -- }}} -- {{{ helper functions local function log(level, ...) if config.logLevel >= level then common.log(...) end end local function message(...) if config.showMessages then tes3.messageBox(...) end end -- build a list of followers on cellChange local function buildFollowerList() local f = {} -- build our followers list for friend in tes3.iterate(tes3.mobilePlayer.friendlyActors) do -- todo: check for ignored NPCs if followers list is ever used for anything other than part of checks.ignoredNPC() if friend ~= tes3.mobilePlayer then -- ? why is the player friendly towards the player ? f[friend.object.id] = true log(common.logLevels.large, "[MAIN] %s is follower", friend.object.id) end end return f end -- {{{ cell change checks local function checkEnteredNPCHome(cell) local home = common.runtimeData.homes.byCell[cell.id] if home then local msg = string.format("Entering home of %s, %s", home.name, home.homeName) log(common.logLevels.small, "[MAIN] " .. msg) -- message(msg) -- this one is mostly for debugging, so it doesn't need to be shown end end local function checkEnteredPublicHouse(cell, city) local typeOfPub = common.pickPublicHouseType(cell) local publicHouse = common.runtimeData.publicHouses.byName[city] and common.runtimeData.publicHouses.byName[city][cell.id] if publicHouse then local msg = string.format("Entering public space %s, a%s %s in the town of %s.", publicHouse.name, common.vowel(typeOfPub), typeOfPub:gsub("s$", ""), publicHouse.city) -- todo: check for more servicers, not just proprietor if publicHouse.proprietor and checks.isServicer(publicHouse.proprietor) then msg = msg .. string.format(" Talk to %s, %s for services.", publicHouse.proprietor.object.name, publicHouse.proprietor.object.class) end log(common.logLevels.small, "[MAIN] " .. msg) message(msg) -- this one is more informative, and not entirely for debugging, and reminiscent of Daggerfall's messages end end -- }}} local function applyChanges(cell) if not cell then cell = tes3.getPlayerCell() end if checks.isIgnoredCell(cell) then return end -- Interior cell, except Canton cells, don't do anything if checks.isInteriorCell(cell) and not (config.cantonCells == common.canton.exterior and common.isCantonWorksCell(cell)) then return end -- don't do anything to public houses if checks.isPublicHouse(cell) then return end -- Deal with NPCs and mounts/pets in cell processors.processNPCs(cell) processors.processPets(cell) processors.processSiltStriders(cell) -- check doors in cell, locking those that aren't inns/clubs processors.processDoors(cell) end local function updateCells() log(common.logLevels.medium, "[MAIN] Updating active cells!") common.runtimeData.followers = buildFollowerList() for _, cell in pairs(tes3.getActiveCells()) do log(common.logLevels.large, "[MAIN] Applying changes to cell %s", cell.id) -- initialize runtime data if needed for _, t in pairs(common.runtimeData.NPCs) do t[cell.id] = t[cell.id] or {} end applyChanges(cell) end -- update interop runtime data after changes have been applied interop.setRuntimeData(common.runtimeData) end -- todo: more robust trespass checking... maybe take faction and rank into account? -- maybe something like faction members you outrank don't mind you being in their house -- also whether guildhalls are public or not, members can come and go as they please -- todo maybe an esp with keys for guildhalls that are added when player joins or reaches a certain rank? -- todo: maybe re-implement some or all features of Trespasser local function updatePlayerTrespass(cell, previousCell) cell = cell or tes3.getPlayerCell() local inCity = previousCell and (previousCell.id:match(cell.id) or cell.id:match(previousCell.id)) if checks.isInteriorCell(cell) and not checks.isIgnoredCell(cell) and not checks.isPublicHouse(cell) and inCity then if checks.isNight() then tes3.player.data.NPCsGoHome.intruding = true else tes3.player.data.NPCsGoHome.intruding = false end else tes3.player.data.NPCsGoHome.intruding = false end log(common.logLevels.small, "[MAIN] Updating player trespass status to %s", tes3.player.data.NPCsGoHome.intruding) end -- }}} -- {{{ event functions local eventFunctions = {} eventFunctions.onActivate = function(e) if e.activator ~= tes3.player or e.target.object.objectType ~= tes3.objectType.npc or not config.disableInteraction then return end local npc = e.target if tes3.player.data.NPCsGoHome.intruding and not checks.isIgnoredNPC(npc) then if npc.object.disposition and npc.object.disposition <= config.minimumTrespassDisposition then log(common.logLevels.medium, "[MAIN] Disabling dialogue with %s because trespass and disposition: %s", npc.object.name, npc.object.disposition) tes3.messageBox(string.format("%s: Get out before I call the guards!", npc.object.name)) return false end end end eventFunctions.onLoaded = function() tes3.player.data.NPCsGoHome = tes3.player.data.NPCsGoHome or {} if not updateTimer or updateTimer.state ~= timer.active then updateTimer = timer.start({ type = timer.simulate, duration = config.timerInterval, iterations = -1, callback = updateCells }) end end eventFunctions.onCellChanged = function(e) updateCells() processors.searchCellsForPositions() processors.searchCellsForNPCs() updatePlayerTrespass(e.cell, e.previousCell) checkEnteredNPCHome(e.cell) if e.cell.name then -- exterior wilderness cells don't have name checkEnteredPublicHouse(e.cell, common.split(e.cell.name, ",")[1]) end end eventFunctions.onInfoResponse = function(e) -- the dialogue option clicked on local dialogue = tostring(e.dialogue):lower() -- what that dialogue option triggers; this will catch AIFollow commands local command = e.command:lower() for _, item in pairs({"follow", "together", "travel", "wait", "stay"}) do if command:match(item) or dialogue:match(item) then -- wait until game time restarts, and don't set multiple timers if not postDialogueTimer or postDialogueTimer.state ~= timer.active then log(common.logLevels.small, "Found %s in dialogue, rebuilding followers", item) postDialogueTimer = timer.start({ type = timer.simulate, duration = 0.25, iteration = 1, callback = function() common.runtimeData.followers = buildFollowerList() end }) end end end end -- debug events eventFunctions.onKeyDown = function(e) if e.keyCode ~= tes3.scanCode.c then return end -- if alt log runtimeData if e.isAltDown then -- ! this crashes my fully modded setup and I dunno why -- ? doesn't crash my barely modded testing setup though -- log(common.logLevels.none, json.encode(common.runtimeData, { indent = true })) -- inspect handles userdata and tables within tables badly log(common.logLevels.none, common.inspect(common.runtimeData)) end -- if ctrl log position data formatted for positions.lua if e.isControlDown then local pos = tostring(tes3.player.position):gsub("%(", "{"):gsub("%)", "}") local ori = tostring(tes3.player.orientation):gsub("%(", "{"):gsub("%)", "}") log(common.logLevels.none, "[POSITIONS] {position = %s, orientation = %s},", pos, ori) end end -- }}} -- {{{ init local function onInitialized() -- Register events log(common.logLevels.small, "[MAIN] Registering events...") for name, func in pairs(eventFunctions) do local eventName = name:gsub("on(%u)", string.lower) event.register(eventName, func) log(common.logLevels.small, "[MAIN] %s event registered", eventName) end log(common.logLevels.none, "Successfully initialized") end event.register("initialized", onInitialized) -- MCM event.register("modConfigReady", function() mwse.mcm.register(require("celediel.NPCsGoHome.mcm")) end) -- }}} -- vim:fdm=marker
--[[ _______ ______ ______ _____ _ _ _______ ______ ______ _____ _ _ | |______ |_____] |_____/ | |____/ |_____| |_____] |_____/ | | |____/ |_____ |______ |_____] | \_ __|__ | \_ | | |_____] | \_ |_____| | \_ MIT License Copyright (c) 2018 BinarySpace Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --]] local Brikabrok = LibStub("AceAddon-3.0"):GetAddon("Brikabrok") BrikabrokMINIMAP= Brikabrok:NewModule("MINIMAP", "AceEvent-3.0","AceComm-3.0") ----------------------------------- ------------- MINI-MAP ------------ ----------------------------------- -- No documentation needed Brikabrok.Settings = { MinimapPos = 45 } function Brikabrok.MinimapButton_Reposition() BrikabrokMinimapButton:SetPoint("TOPLEFT","Minimap","TOPLEFT",52-(80*cos(Brikabrok.Settings.MinimapPos)),(80*sin(Brikabrok.Settings.MinimapPos))-52) end function Brikabrok.MinimapButton_DraggingFrame_OnUpdate() local xpos,ypos = GetCursorPosition() local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom() xpos = xmin-xpos/UIParent:GetScale()+70 ypos = ypos/UIParent:GetScale()-ymin-70 Brikabrok.Settings.MinimapPos = math.deg(math.atan2(ypos,xpos)) Brikabrok.MinimapButton_Reposition() end function Brikabrok.MinimapButton_OnEnter(self) if (self.dragging) then return end GameTooltip:SetOwner(self or UIParent, "ANCHOR_LEFT") Brikabrok.MinimapButton_Details(GameTooltip) end function Brikabrok.MinimapButton_Details(tt, ldb) tt:SetText("Le Brikabrok") tt:AddLine("Version : "..Brikabrok.setColor("o")..Brikabrok.versionmode..Brikabrok.setColor("w").." Release",1,1,1) tt:AddLine("Clic gauche:"..Brikabrok.setColor("o").. " Ouvrir le menu principal",1,1,1) tt:AddLine("Clic droit:"..Brikabrok.setColor("o").. " Ouvrir le menu rapide",1,1,1) tt:AddLine("Clic Molette:"..Brikabrok.setColor("o").. " Ouvrir le menu d'ajout",1,1,1) tt:SetSize(270,90) end function Brikabrok.MinimapButton_OnClick() buttonMod = GetMouseButtonClicked() if buttonMod == "LeftButton" then mainFrame:Show() elseif buttonMod == "MiddleButton" then easyDev:Show() elseif buttonMod == "RightButton" then easyFrame:Show() end end
-- -- Please see the readme.txt file included with this distribution for -- attribution and copyright information. -- function hide() setVisible(false); window[trigger[1]].setVisible(true); end function onEnter() hide(); return true; end function onLoseFocus() hide(); end function onValueChanged() -- The target value is a series of consecutive window lists or sub windows local targetnesting = {}; for w in string.gmatch(target[1], "(%w+)") do table.insert(targetnesting, w); end local target = window[targetnesting[1]]; applyTo(target, targetnesting, 2); window[trigger[1]].updateWidget(getValue() ~= ""); end function applyTo(target, nesting, index) local targettype = type(target); if targettype == "windowlist" then if index > #nesting then target.applyFilter(); return; end for k, w in pairs(target.getWindows()) do applyTo(w[nesting[index]], nesting, index+1); end elseif targettype == "subwindow" then applyTo(target.subwindow[nesting[index]], nesting, index+1); end end
local ObjectManager = require("managers.object.object_manager") kidnappedNobleConvoHandler = conv_handler:new {} function kidnappedNobleConvoHandler:runScreenHandlers(pConvTemplate, pPlayer, pNpc, selectedOption, pConvScreen) local screen = LuaConversationScreen(pConvScreen) local screenID = screen:getScreenID() local pConvScreen = screen:cloneScreen() local clonedConversation = LuaConversationScreen(pConvScreen) if (screenID == "init") then CreatureObject(pNpc):doAnimation("angry") elseif (screenID == "of_course") then CreatureObject(pNpc):doAnimation("nod_head_multiple") elseif (screenID == "my_hero") then CreatureObject(pNpc):doAnimation("celebrate") local objectName = AiAgent(pNpc):getCreatureTemplateName() if (readScreenPlayData(pPlayer, "kidnappedNoble:" .. objectName, "completed") == "") then CreatureObject(pPlayer):awardExperience("combat_general", 250, true) writeScreenPlayData(pPlayer, "kidnappedNoble:" .. objectName, "completed", 1) end createEvent(2000, "kidnappedNobleConvoHandler", "doRunAway", pNpc, "") end return pConvScreen end function kidnappedNobleConvoHandler:doRunAway(pCreature) if (pCreature == nil or not CreatureObject(pCreature):isAiAgent()) then return end local xPos = SceneObject(pCreature):getWorldPositionX() + 60 local yPos = SceneObject(pCreature):getWorldPositionY() + 60 local zPos = getTerrainHeight(pCreature, xPos, yPos) AiAgent(pCreature):setAiTemplate("manualescort") -- Don't move unless patrol point is added to list AiAgent(pCreature):setFollowState(4) -- Patrolling AiAgent(pCreature):stopWaiting() AiAgent(pCreature):setWait(0) AiAgent(pCreature):setNextPosition(xPos, zPos, yPos, 0) AiAgent(pCreature):executeBehavior() createEvent(30000, "kidnappedNobleConvoHandler", "destroyNoble", pCreature, "") end function kidnappedNobleConvoHandler:destroyNoble(pCreature) if (pCreature == nil or not CreatureObject(pCreature):isAiAgent()) then return end AiAgent(pCreature):doDespawn() end
return { version = "1.5", luaversion = "5.1", tiledversion = "1.7.1", orientation = "orthogonal", renderorder = "right-down", width = 60, height = 32, tilewidth = 32, tileheight = 32, nextlayerid = 2, nextobjectid = 1, properties = {}, tilesets = { { name = "&Grass&", firstgid = 1, tilewidth = 32, tileheight = 32, spacing = 0, margin = 0, columns = 1, image = "../../Assets/Ground Textures/&Grass&.png", imagewidth = 32, imageheight = 32, objectalignment = "unspecified", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 32, height = 32 }, properties = {}, wangsets = {}, tilecount = 1, tiles = {} }, { name = "&Saand&", firstgid = 2, tilewidth = 32, tileheight = 32, spacing = 0, margin = 0, columns = 1, image = "../../Assets/Ground Textures/&Saand&.png", imagewidth = 32, imageheight = 32, objectalignment = "unspecified", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 32, height = 32 }, properties = {}, wangsets = {}, tilecount = 1, tiles = {} }, { name = "&Fire&", firstgid = 3, tilewidth = 32, tileheight = 32, spacing = 0, margin = 0, columns = 1, image = "../../Assets/Ground Textures/&Fire&.png", imagewidth = 32, imageheight = 32, objectalignment = "unspecified", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 32, height = 32 }, properties = {}, wangsets = {}, tilecount = 1, tiles = {} }, { name = "piza", firstgid = 4, tilewidth = 32, tileheight = 32, spacing = 0, margin = 0, columns = 1, image = "../../Assets/Items/piza.png", imagewidth = 32, imageheight = 32, objectalignment = "unspecified", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 32, height = 32 }, properties = {}, wangsets = {}, tilecount = 1, tiles = {} }, { name = "pole", firstgid = 5, tilewidth = 32, tileheight = 32, spacing = 0, margin = 0, columns = 1, image = "../../Assets/Items/pole.png", imagewidth = 32, imageheight = 32, objectalignment = "unspecified", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 32, height = 32 }, properties = {}, wangsets = {}, tilecount = 1, tiles = {} }, { name = "LevelFlag.png", firstgid = 6, tilewidth = 32, tileheight = 32, spacing = 0, margin = 0, columns = 1, image = "../../Assets/Items/Your on your way to flag/LevelFlag.png.Png", imagewidth = 32, imageheight = 32, objectalignment = "unspecified", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 32, height = 32 }, properties = {}, wangsets = {}, tilecount = 1, tiles = {} } }, layers = { { type = "tilelayer", x = 0, y = 0, width = 60, height = 32, id = 1, name = "Tile Layer 1", visible = true, opacity = 1, offsetx = 0, offsety = 0, parallaxx = 1, parallaxy = 1, properties = {}, encoding = "lua", data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } } }
local ffi = require("ffi") function getFPGATimestamp() return ffi.C.GetFPGATimestamp() end function getTimeSeconds() return ffi.C.GetFPGATimestamp() end
-- Copyright 2022 SmartThings -- -- 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 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. local Configuration = (require "st.zwave.CommandClass.Configuration")({ version=4 }) local MultichannelAssociation = (require "st.zwave.CommandClass.MultiChannelAssociation")({ version = 3 }) local function can_handle_qubino_din_dimmer(opts, driver, device, ...) -- Qubino Din Dimmer: mfr = 0x0159, prod = 0x0001, model = 0x0052 if device:id_match(0x0159, 0x0001, 0x0052) then return true end return false end local function do_configure(self, device) device:send(MultichannelAssociation:Remove({grouping_identifier = 1, node_ids = {}})) device:send(MultichannelAssociation:Set({grouping_identifier = 1, node_ids = {self.environment_info.hub_zwave_id}})) device:send(Configuration:Set({parameter_number=42, size=2, configuration_value=1920})) end local qubino_din_dimmer = { NAME = "qubino DIN dimmer", lifecycle_handlers = { doConfigure = do_configure }, can_handle = can_handle_qubino_din_dimmer } return qubino_din_dimmer
vRPas = {} Tunnel.bindInterface("vrp_armorshop",vRPas) ASserver = Tunnel.getInterface("vrp_armorshop","vrp_armorshop") function vRPas.getArmour() return GetPedArmour(GetPlayerPed(-1)) end function vRPas.setArmour(armour,vest) local player = GetPlayerPed(-1) if vest then if(GetEntityModel(player) == GetHashKey("mp_m_freemode_01")) then SetPedComponentVariation(player, 9, 4, 1, 2) --Bulletproof Vest else if(GetEntityModel(player) == GetHashKey("mp_f_freemode_01")) then SetPedComponentVariation(player, 9, 6, 1, 2) end end end local n = math.floor(armour) AddArmourToPed(player,n) end function vRPas.setsArmour(armour,vest) local player = GetPlayerPed(-1) local n = math.floor(armour) SetPedArmour(player,n) end local state_ready = false AddEventHandler("playerSpawned",function() -- delay state recording state_ready = false Citizen.CreateThread(function() Citizen.Wait(30000) state_ready = true end) end) Citizen.CreateThread(function() while true do Citizen.Wait(10000) if IsPlayerPlaying(PlayerId()) and state_ready then ASserver.updateArmor({vRPas.getArmour()}) if vRPas.getArmour() == 0 then if(GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_m_freemode_01")) or (GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_f_freemode_01")) then SetPedComponentVariation(GetPlayerPed(-1), 9, 0, 1, 2) end end end end end)
local PerlinWorms = { } function PerlinWorms.new(Size, Seed, Resolution, TargetCFrame) local TargetCFrame = TargetCFrame or CFrame.new(math.random(5, 10), math.random(5, 10), math.random(5, 10)) local Resolution = (Resolution or 4) + .1 local Seed = Seed or tick() local Points = { } for _ = 1, Size do local X = math.noise(TargetCFrame.X / Resolution, Seed) local Y = math.noise(TargetCFrame.Y / Resolution, Seed) local Z = math.noise(TargetCFrame.Z / Resolution, Seed) TargetCFrame *= CFrame.Angles(X * 2, Y * 2, Z * 2) * CFrame.new(0, 0, -Resolution) Points[#Points + 1] = TargetCFrame.Position end return Points end return PerlinWorms
local awful = require('awful') local beautiful = require('beautiful') local wibox = require('wibox') local apps = require('configuration.apps') local dpi = require('beautiful').xresources.apply_dpi local left_panel = function(screen) local action_bar_width = dpi(48) local panel_content_width = dpi(400) local panel = wibox { screen = screen, width = action_bar_width, height = screen.geometry.height, x = screen.geometry.x, y = screen.geometry.y, ontop = true, bg = beautiful.background.hue_800, fg = beautiful.fg_normal } panel.opened = false panel:struts( { left = action_bar_width } ) local backdrop = wibox { ontop = true, screen = screen, bg = '#00000000', type = 'dock', x = screen.geometry.x, y = screen.geometry.y, width = screen.geometry.width, height = screen.geometry.height } function panel:run_rofi() _G.awesome.spawn( apps.default.rofi, false, false, false, false, function() panel:toggle() end ) end local openPanel = function(should_run_rofi) panel.width = action_bar_width + panel_content_width panel:get_children_by_id('panel_content')[1].visible = true if should_run_rofi then panel:run_rofi() end panel:emit_signal('opened') end local closePanel = function() panel.width = action_bar_width panel:get_children_by_id('panel_content')[1].visible = false backdrop.visible = false panel:emit_signal('closed') end function panel:toggle(should_run_rofi) self.opened = not self.opened if self.opened then openPanel(should_run_rofi) else closePanel() end end backdrop:buttons( awful.util.table.join( awful.button( {}, 1, function() panel:toggle() end ) ) ) panel:setup { layout = wibox.layout.align.horizontal, nil, { id = 'panel_content', bg = beautiful.background.hue_900, widget = wibox.container.background, visible = false, forced_width = panel_content_width, { require('layout.left-panel.dashboard')(screen, panel), layout = wibox.layout.stack } }, require('layout.left-panel.action-bar')(screen, panel, action_bar_width) } return panel end return left_panel
local itemDatas = {} local names = {} -- local defaultItemData = API.ItemData'????????', '????????', 0.1) function API.getItemDataFromId(id) return itemDatas[id] end function API.getItemDataFromName(name) if names[name] ~= nil then return itemDatas[names[name]] end end Citizen.CreateThread( function() for id, values in pairs(ItemList) do local ItemData = API.ItemData(id, values.name, values.description, values.type, values.stackSize, values.weight) if values.varOnUse ~= nil then ItemData.varOnUse = values.varOnUse end itemDatas[id] = ItemData names[values.name] = id end end )
//I will most likely coroutine this whole process later. local CD = CurTime() local min = math.min local PowerGridRange = 300^2 --Ill make a local range for each generator some time maybe. function UpdatePowerGrid() if (CD > CurTime()) then return end //local s = SysTime() --Reset everythings power consumption before appending local bwEntsAll = ents.FindByClass("bw_*"); local bwEnts = {} local bwEntsGenerators = {} for k,v in pairs(bwEntsAll) do if (v:GetClass():find("bw_generator")) then bwEntsGenerators[k] = v else bwEnts[k] = v end v.ConsumedPower = 0 end for _,Gen in pairs(bwEntsGenerators) do local pos = Gen:GetPos() for _,Ent in pairs(bwEnts) do if (Ent.Power and Ent.ConsumedPower < Ent.Power and Ent:GetPos():DistToSqr(pos) < PowerGridRange) then --if (Ent.GetPlayerOwner and Ent:GetPlayerOwner() != Gen:GetPlayerOwner()) then continue end local p = min(Gen.Power-Gen.ConsumedPower,Ent.Power-Ent.ConsumedPower) Ent.ConsumedPower = Ent.ConsumedPower+p Gen.ConsumedPower = Gen.ConsumedPower+p if (Gen.ConsumedPower == Gen.Power) then break end end end end //print("Time: " .. (SysTime() - s)) CD = CurTime()+1 end hook.Add( "Tick", "checkPowerGrid", function() UpdatePowerGrid() end)
local _2afile_2a = "fnl/nvim-minimap/config.fnl" local _0_ do local name_0_ = "nvim-minimap.config" local module_0_ do local x_0_ = package.loaded[name_0_] if ("table" == type(x_0_)) then module_0_ = x_0_ else module_0_ = {} end end module_0_["aniseed/module"] = name_0_ module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {}) do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {}) do end (package.loaded)[name_0_] = module_0_ _0_ = module_0_ end local autoload local function _1_(...) return (require("nvim-minimap.aniseed.autoload")).autoload(...) end autoload = _1_ local function _2_(...) local ok_3f_0_, val_0_ = nil, nil local function _2_() return {autoload("nvim-minimap.aniseed.core"), autoload("nvim-minimap.aniseed.nvim"), autoload("nvim-minimap.aniseed.string")} end ok_3f_0_, val_0_ = pcall(_2_) if ok_3f_0_ then _0_["aniseed/local-fns"] = {autoload = {a = "nvim-minimap.aniseed.core", nvim = "nvim-minimap.aniseed.nvim", string = "nvim-minimap.aniseed.string"}} return val_0_ else return print(val_0_) end end local _local_0_ = _2_(...) local a = _local_0_[1] local nvim = _local_0_[2] local string = _local_0_[3] local _2amodule_2a = _0_ local _2amodule_name_2a = "nvim-minimap.config" do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end local defaults do local v_0_ = ((_0_)["aniseed/locals"].defaults or {default_auto_cmds_enabled = 1, filetype = {excludes = {"help", "qf"}}, highlight = {group = "MinimapCurrentLine"}, window = {height = 10, width = 20}}) local t_0_ = (_0_)["aniseed/locals"] t_0_["defaults"] = v_0_ defaults = v_0_ end local ks__3ename do local v_0_ local function ks__3ename0(ks) return ("minimap#" .. string.join("#", ks)) end v_0_ = ks__3ename0 local t_0_ = (_0_)["aniseed/locals"] t_0_["ks->name"] = v_0_ ks__3ename = v_0_ end local get_in do local v_0_ do local v_0_0 local function get_in0(ks) local v = a.get(nvim.g, ks__3ename(ks)) if v then if (a["table?"](v) and a.get(v, vim.type_idx) and a.get(v, vim.val_idx)) then return a.get(v, vim.val_idx) else return v end else return a["get-in"](defaults, ks) end end v_0_0 = get_in0 _0_["get-in"] = v_0_0 v_0_ = v_0_0 end local t_0_ = (_0_)["aniseed/locals"] t_0_["get-in"] = v_0_ get_in = v_0_ end -- (->> (ks->name table: 0x7fbc06198868) (a.get nvim.g)) (get-in table: 0x7fbc06150af0) (get-in table: 0x7fbc06118488) (get-in table: 0x7fbc05ec5f90) return nil
if( SERVER ) then AddCSLuaFile( "shared.lua" ) resource.AddFile("materials/vgui/ttt/icon_bb_katana.vmt") resource.AddFile( "models/weapons/W_katana.dx80.vtx" ) resource.AddFile( "models/weapons/W_katana.dx90.vtx" ) resource.AddFile( "models/weapons/w_katana.mdl" ) resource.AddFile( "models/weapons/W_katana.phy" ) resource.AddFile( "models/weapons/W_katana.sw.vtx" ) resource.AddFile( "models/weapons/w_katana.vvd" ) resource.AddFile("models/weapons/v_katana.mdl") resource.AddFile("materials/models/weapons/v_katana/katana_normal.vtf") resource.AddFile("materials/models/weapons/v_katana/katana.vtf") resource.AddFile("materials/models/weapons/v_katana/katana.vmt") resource.AddFile("materials/vgui/entities/weapon_katana.vmt") resource.AddFile("materials/vgui/entities/weapon_katana.vtf") resource.AddFile("sound/katana/glass_hit_1.wav") resource.AddFile("sound/katana/glass_hit_2.wav") resource.AddFile("sound/katana/glass_hit_3.wav") resource.AddFile("sound/katana/wood_hit_1.wav") resource.AddFile("sound/katana/wood_hit_2.wav") resource.AddFile("sound/katana/wood_hit_3.wav") resource.AddFile("sound/katana/ground_hit_1.wav") resource.AddFile("sound/katana/ground_hit_2.wav") resource.AddFile("sound/katana/ground_hit_3.wav") resource.AddFile("sound/katana/ground_hit_4.wav") resource.AddFile("sound/katana/ground_hit_5.wav") resource.AddFile("sound/katana/metal_hit_1.wav") resource.AddFile("sound/katana/metal_hit_2.wav") resource.AddFile("sound/katana/metal_hit_3.wav") resource.AddFile("sound/katana/metal_hit_4.wav") resource.AddFile("sound/katana/metal_hit_5.wav") resource.AddFile("sound/katana/metal_hit_6.wav") resource.AddFile("sound/katana/metal_hit_7.wav") resource.AddFile("sound/katana/draw.wav") end if CLIENT then SWEP.PrintName = "Katana" SWEP.Slot = 6 SWEP.ViewModelFlip = false SWEP.EquipMenuData = { type="Weapon", desc="Katana, the famous japanese sword.\nDeadly." }; SWEP.Icon = "vgui/ttt/icon_bb_katana" end SWEP.Base = "weapon_tttbase" SWEP.PrintName = "Katana" SWEP.DrawAmmo = false SWEP.Author = "Baddog" SWEP.Instructions = "Left click to slash. Right click to bash." SWEP.Contact = "" SWEP.Purpose = "Cut people up." SWEP.Category = "Baddog's Weapons" SWEP.ViewModelFOV = 60 SWEP.ViewModelFlip = false SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_katana.mdl" SWEP.WorldModel = "models/weapons/w_katana.mdl" SWEP.Primary.Delay = 0.6 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Secondary.Delay = 0.4 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.Kind = WEAPON_EQUIP1 SWEP.CanBuy = {ROLE_TRAITOR} -- only traitors can buy SWEP.LimitedStock = true -- only buyable once function SWEP:Initialize() self:SetWeaponHoldType("sword") SWoodHit = { Sound( "katana/wood_hit_1.wav" ), Sound( "katana/wood_hit_2.wav" ), Sound( "katana/wood_hit_3.wav" )} SFleshHit = { Sound( "ambient/machines/slicer1.wav" ), Sound( "ambient/machines/slicer2.wav" ), Sound( "ambient/machines/slicer3.wav" ), Sound( "ambient/machines/slicer4.wav" )} SGlassHit = { Sound( "katana/glass_hit_1.wav" ), Sound( "katana/glass_hit_2.wav" ), Sound( "katana/glass_hit_3.wav" )} SMetalHit = { Sound( "katana/metal_hit_1.wav" ), Sound( "katana/metal_hit_2.wav" ), Sound( "katana/metal_hit_3.wav" ), Sound( "katana/metal_hit_4.wav" ), Sound( "katana/metal_hit_5.wav" ), Sound( "katana/metal_hit_6.wav" ), Sound( "katana/metal_hit_7.wav" )} SGroundHit = { Sound( "katana/ground_hit_1.wav" ), Sound( "katana/ground_hit_2.wav" ), Sound( "katana/ground_hit_3.wav" ), Sound( "katana/ground_hit_4.wav" ), Sound( "katana/ground_hit_5.wav" )} BWoodHit = { Sound( "physics/wood/wood_box_impact_hard1.wav" ), Sound( "physics/wood/wood_box_impact_hard2.wav" ), Sound( "physics/wood/wood_box_impact_hard3.wav" ), Sound( "physics/wood/wood_box_impact_hard4.wav" ), Sound( "physics/wood/wood_box_impact_hard5.wav" ), Sound( "physics/wood/wood_box_impact_hard6.wav" )} BFleshHit = { Sound( "physics/flesh/flesh_impact_hard1.wav" ), Sound( "physics/flesh/flesh_impact_hard2.wav" ), Sound( "physics/flesh/flesh_impact_hard3.wav" ), Sound( "physics/flesh/flesh_impact_hard4.wav" ), Sound( "physics/flesh/flesh_impact_hard5.wav" ), Sound( "physics/flesh/flesh_impact_hard6.wav" )} BGlassHit = { Sound( "physics/glass/glass_sheet_impact_hard1.wav" ), Sound( "physics/glass/glass_sheet_impact_hard2.wav" ), Sound( "physics/glass/glass_sheet_impact_hard3.wav" )} BRockHit = { Sound( "physics/concrete/concrete_impact_hard1.wav" ), Sound( "physics/concrete/concrete_impact_hard2.wav" ), Sound( "physics/concrete/concrete_impact_hard3.wav" )} BMetalHit = { Sound( "physics/metal/metal_barrel_impact_hard1.wav" ), Sound( "physics/metal/metal_barrel_impact_hard2.wav" ), Sound( "physics/metal/metal_barrel_impact_hard3.wav" ), Sound( "physics/metal/metal_barrel_impact_hard5.wav" ), Sound( "physics/metal/metal_barrel_impact_hard6.wav" ), Sound( "physics/metal/metal_barrel_impact_hard7.wav" ), Sound( "physics/metal/metal_box_impact_hard1.wav" ), Sound( "physics/metal/metal_box_impact_hard2.wav" ), Sound( "physics/metal/metal_box_impact_hard3.wav" ), Sound( "physics/metal/metal_computer_impact_hard1.wav" ), Sound( "physics/metal/metal_computer_impact_hard2.wav" ), Sound( "physics/metal/metal_computer_impact_hard3.wav" ), Sound( "physics/metal/metal_grate_impact_hard1.wav" ), Sound( "physics/metal/metal_grate_impact_hard2.wav" ), Sound( "physics/metal/metal_grate_impact_hard3.wav" ), Sound( "physics/metal/metal_sheet_impact_hard2.wav" ), Sound( "physics/metal/metal_sheet_impact_hard6.wav" ), Sound( "physics/metal/metal_sheet_impact_hard7.wav" ), Sound( "physics/metal/metal_sheet_impact_hard8.wav" ), Sound( "physics/metal/metal_solid_impact_hard1.wav" ), Sound( "physics/metal/metal_solid_impact_hard4.wav" ), Sound( "physics/metal/metal_solid_impact_hard5.wav" )} BGroundHit = { Sound( "physics/surfaces/sand_impact_bullet1.wav" ), Sound( "physics/surfaces/sand_impact_bullet2.wav" ), Sound( "physics/surfaces/sand_impact_bullet3.wav" ), Sound( "physics/surfaces/sand_impact_bullet4.wav" )} end function SWEP:Holster() return true end function SWEP:Deploy() self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) self:SetNextPrimaryFire(CurTime() + 0.7) self:SetNextSecondaryFire(CurTime() + 0.7) self.Weapon:EmitSound("katana/draw.wav") return true end function SWEP:OnRemove() return true end function SWEP:PreDrop() -- for consistency, dropped knife should not have DNA/prints self.fingerprints = {} end function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) timer.Simple(0.10,self.Bash, self) self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) self.Owner:SetAnimation( PLAYER_ATTACK1 ) end function SWEP:PrimaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) timer.Simple(0.15,self.Slash, self) self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER) self.Owner:SetAnimation( PLAYER_ATTACK1 ) end function SWEP:Slash() local phtr = self.Owner:GetEyeTrace() local trace = util.GetPlayerTrace(self.Owner) local tr = util.TraceLine(trace) local ph = phtr.Entity:GetPhysicsObject() if (self.Owner:GetPos() - tr.HitPos):Length() < 100 then if tr.Entity:IsPlayer() or string.find(tr.Entity:GetClass(),"npc") or string.find(tr.Entity:GetClass(),"prop_ragdoll") or tr.MatType == MAT_FLESH or tr.MatType == MAT_ALIENFLESH or tr.MatType == MAT_ANTLION then self.Weapon:EmitSound( SFleshHit[math.random(1,#SFleshHit)] ) bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(0, 0, 0) bullet.Tracer = 0 bullet.Force = 20 bullet.Damage = 65 self.Owner:FireBullets(bullet) else util.Decal("ManhackCut", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal) if (tr.MatType == MAT_METAL or tr.MatType == MAT_VENT or tr.MatType == MAT_COMPUTER) then self.Weapon:EmitSound(SMetalHit[math.random(1,#SMetalHit)]) elseif (tr.MatType == MAT_WOOD or tr.MatType == "MAT_FOLIAGE") then self.Weapon:EmitSound(SWoodHit[math.random(1,#SWoodHit)]) elseif (tr.MatType == MAT_GLASS) then self.Weapon:EmitSound(SGlassHit[math.random(1,#SGlassHit)]) elseif (tr.MatType == MAT_DIRT or tr.MatType == MAT_SAND or tr.MatType == MAT_SLOSH or tr.MatType == MAT_TILE or tr.MatType == MAT_PLASTIC or tr.MatType == MAT_CONCRETE) then self.Weapon:EmitSound(SGroundHit[math.random(1,#SGroundHit)]) else self.Weapon:EmitSound(SGroundHit[math.random(1,#SGroundHit)]) end if not tr.HitWorld and not string.find(tr.Entity:GetClass(),"prop_static") then if SERVER then ph:ApplyForceCenter(self.Owner:GetAimVector()*5000) tr.Entity:TakeDamage(65, self.Owner, self) end end end else self.Weapon:EmitSound("Weapon_Knife.Slash") end end function SWEP:Bash() local phtr = self.Owner:GetEyeTrace() local trace = util.GetPlayerTrace(self.Owner) local tr = util.TraceLine(trace) local ph = phtr.Entity:GetPhysicsObject() if (self.Owner:GetPos() - tr.HitPos):Length() < 100 then if tr.Entity:IsPlayer() or string.find(tr.Entity:GetClass(),"npc") or string.find(tr.Entity:GetClass(),"prop_ragdoll") or tr.MatType == MAT_FLESH then self.Weapon:EmitSound( BFleshHit[math.random(1,#BFleshHit)] ) tr.Entity:SetVelocity((phtr.Entity:GetPos() - self.Owner:GetPos()) * 35) if SERVER then tr.Entity:TakeDamage(25, self.Owner, self) end else if (tr.MatType == MAT_METAL or tr.MatType == MAT_VENT or tr.MatType == MAT_COMPUTER) then self.Weapon:EmitSound(BMetalHit[math.random(1,#BMetalHit)]) elseif (tr.MatType == MAT_WOOD or tr.MatType == "MAT_FOLIAGE") then self.Weapon:EmitSound(BWoodHit[math.random(1,#BWoodHit)]) elseif (tr.MatType == MAT_GLASS) then self.Weapon:EmitSound(BGlassHit[math.random(1,#BGlassHit)]) elseif (tr.MatType == MAT_DIRT or tr.MatType == MAT_SAND or tr.MatType == MAT_SLOSH or tr.MatType == MAT_TILE or tr.MatType == MAT_PLASTIC) then self.Weapon:EmitSound(BGroundHit[math.random(1,#BGroundHit)]) elseif (tr.MatType == MAT_CONCRETE) then self.Weapon:EmitSound(BRockHit[math.random(1,#BRockHit)]) else self.Weapon:EmitSound(BGroundHit[math.random(1,#BGroundHit)]) end if not tr.HitWorld and not string.find(tr.Entity:GetClass(),"prop_static") then if SERVER then ph:ApplyForceCenter(self.Owner:GetAimVector()*20000) tr.Entity:TakeDamage(25, self.Owner, self) end end end else self.Weapon:EmitSound("Weapon_Knife.Slash") end end local ActIndex = {} ActIndex["pistol"] = ACT_HL2MP_IDLE_PISTOL ActIndex["smg"] = ACT_HL2MP_IDLE_SMG1 ActIndex["grenade"] = ACT_HL2MP_IDLE_GRENADE ActIndex["ar2"] = ACT_HL2MP_IDLE_AR2 ActIndex["shotgun"] = ACT_HL2MP_IDLE_SHOTGUN ActIndex["rpg"] = ACT_HL2MP_IDLE_RPG ActIndex["physgun"] = ACT_HL2MP_IDLE_PHYSGUN ActIndex["crossbow"] = ACT_HL2MP_IDLE_CROSSBOW ActIndex["melee"] = ACT_HL2MP_IDLE_MELEE ActIndex["slam"] = ACT_HL2MP_IDLE_SLAM ActIndex["normal"] = ACT_HL2MP_IDLE ActIndex["knife"] = ACT_HL2MP_IDLE_KNIFE ActIndex["sword"] = ACT_HL2MP_IDLE_MELEE2 ActIndex["passive"] = ACT_HL2MP_IDLE_PASSIVE ActIndex["fist"] = ACT_HL2MP_IDLE_FIST function SWEP:SetWeaponHoldType(t) local index = ActIndex[t] if (index == nil) then Msg("SWEP:SetWeaponHoldType - ActIndex[ \""..t.."\" ] isn't set!\n") return end self.ActivityTranslate = {} self.ActivityTranslate [ ACT_MP_STAND_IDLE ] = index self.ActivityTranslate [ ACT_MP_WALK ] = index+1 self.ActivityTranslate [ ACT_MP_RUN ] = index+2 self.ActivityTranslate [ ACT_MP_CROUCH_IDLE ] = index+3 self.ActivityTranslate [ ACT_MP_CROUCHWALK ] = index+4 self.ActivityTranslate [ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = index+5 self.ActivityTranslate [ ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ] = index+5 self.ActivityTranslate [ ACT_MP_RELOAD_STAND ] = index+6 self.ActivityTranslate [ ACT_MP_RELOAD_CROUCH ] = index+6 self.ActivityTranslate [ ACT_MP_JUMP ] = index+7 self.ActivityTranslate [ ACT_RANGE_ATTACK1 ] = index+8 if t == "normal" then self.ActivityTranslate [ ACT_MP_JUMP ] = ACT_HL2MP_JUMP_SLAM end if t == "passive" then self.ActivityTranslate [ ACT_MP_CROUCH_IDLE ] = ACT_HL2MP_CROUCH_IDLE end self:SetupWeaponHoldTypeForAI(t) end function SWEP:TranslateActivity(act) if (self.Owner:IsNPC()) then if (self.ActivityTranslateAI[act]) then return self.ActivityTranslateAI[act] end return -1 end if (self.ActivityTranslate[act] != nil) then return self.ActivityTranslate[act] end return -1 end
#!/usr/bin/lua --[[ Copyright (c) 2007-2009 Mauro Iazzi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --]] local base_types = (...) or {} local number_type = function(d) return { get = function(j) return 'lua_tonumber(L, '..tostring(j)..')', 1 end, push = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lua_pushnumber(L, '..tostring(j)..')', 1 end, test = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lqtL_isnumber(L, '..tostring(j)..')', 1 end, onstack = 'number,', defect = d, } end local integer_type = function(d) return { get = function(j) return 'lua_tointeger(L, '..tostring(j)..')', 1 end, push = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lua_pushinteger(L, '..tostring(j)..')', 1 end, test = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lqtL_isinteger(L, '..tostring(j)..')', 1 end, onstack = 'integer,', defect = d, } end local bool_type = function(d) return { get = function(j) return 'lua_toboolean(L, '..tostring(j)..')', 1 end, push = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lua_pushboolean(L, '..tostring(j)..')', 1 end, test = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lqtL_isboolean(L, '..tostring(j)..')', 1 end, onstack = 'boolean,', defect = d, } end base_types['char const*'] = { get = function(j) return 'lua_tostring(L, '..tostring(j)..')', 1 end, push = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lua_pushstring(L, '..tostring(j)..')', 1 end, test = function(j) return 'lqtL_isstring(L, '..tostring(j)..')', 1 end, onstack = 'string,', } base_types['char'] = integer_type(3) base_types['unsigned char'] = integer_type(3) base_types['int'] = integer_type(1) base_types['unsigned'] = integer_type(1) base_types['unsigned int'] = integer_type(1) base_types['short'] = integer_type(2) base_types['short int'] = integer_type(2) base_types['unsigned short'] = integer_type(2) base_types['unsigned short int'] = integer_type(2) base_types['short unsigned int'] = integer_type(2) base_types['long'] = integer_type(0) base_types['unsigned long'] = integer_type(0) base_types['long int'] = integer_type(0) base_types['unsigned long int'] = integer_type(0) base_types['long unsigned int'] = integer_type(0) base_types['long long'] = integer_type(0) base_types['__int64'] = integer_type(0) base_types['unsigned long long'] = integer_type(0) base_types['long long int'] = integer_type(0) base_types['unsigned long long int'] = integer_type(0) base_types['float'] = number_type(1) base_types['double'] = number_type(0) base_types['double const&'] = number_type(1) base_types['bool'] = bool_type() ---[[ base_types['bool*'] = { get = function(j) return 'lqtL_toboolref(L, '..j..')', 1 end, push = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lua_pushboolean(L, *'..tostring(j)..')', 1 end, test = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lqtL_isboolean(L, '..tostring(j)..')', 1 end, onstack = 'boolean,', } base_types['int&'] = { get = function(j) return '*lqtL_tointref(L, '..j..')', 1 end, push = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lua_pushinteger(L, '..tostring(j)..')', 1 end, test = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lqtL_isinteger(L, '..tostring(j)..')', 1 end, onstack = 'integer,', } base_types['int*'] = { get = function(j) return 'lqtL_tointref(L, '..j..')', 1 end, push = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lua_pushinteger(L, *'..tostring(j)..')', 1 end, test = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lqtL_isinteger(L, '..tostring(j)..')', 1 end, onstack = 'integer,', } base_types['char**'] = { get = function(j) return 'lqtL_toarguments(L, '..tostring(j)..')', 1 end, push = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lqtL_pusharguments(L, '..tostring(j)..')', 1 end, test = function(j) -- must handle arguments (e.g. in virtual callbacks) and return values return 'lua_istable(L, '..tostring(j)..')', 1 end, onstack = 'table,', } --]] base_types['std::string const&'] = { get = function(i) return 'std::string(lua_tostring(L, '..i..'), lua_objlen(L, '..i..'))', 1 end, push = function(i) return 'lua_pushlstring(L, '..i..'.c_str(), '..i..'.size())', 1 end, test = function(i) return 'lua_isstring(L, '..i..')', 1 end, onstack = 'string,', } base_types['std::string'] = base_types['std::string const&'] return base_types
-- -- Created by IntelliJ IDEA. -- User: huanghaojing -- Date: 16/1/5 -- Time: 上午9:49 -- To change this template use File | Settings | File Templates. -- local platform_ios = true if getOSType and getOSType()=="android" then platform_ios = false end local json = platform_ios and require('sz').json or require('cjson') local socket = platform_ios and require('szocket') or require('socket') local thread = require('thread') local socket_help = require('socket_help') --local nLog = require('nLog') local nLog = print local webServer = {} --url解码 local function decodeURI(s) s = string.gsub(s, '%%(%x%x)', function(h) return string.char(tonumber(h, 16)) end) return s end function string.split(str, delimiter) if str==nil or str=='' or delimiter==nil then return nil end local result = {} for match in (str..delimiter):gmatch("(.-)"..delimiter) do table.insert(result, match) end return result end --循环发送 local function sock_send(task,sock,data,i) i = i or 1 -- print("send",data,i) local pos,err,pos2= sock:send(data,i) -- print("pos=",pos,err,pos2) if not pos then if err == "timeout" then task.sleep(1) return sock_send(task,sock,data,pos2+1) else return false end elseif pos == #data then return true else --没发送完整,等10毫秒再发送 task.sleep(1) return sock_send(task,sock,data,pos+1) end end --处理一个httpclient local function httpClient(parent_task,sock,respond_func,conf) local conf = conf or {} local client = {} sock:settimeout(0) local client_ip,client_port = sock:getpeername() parent_task.createSubTask(function(task) nLog("begin httpClient") local print = task.log local method,path,http_protocol task.log("准备接收协议") task.setTimeout(3000) local line = socket_help.receive_line(task,sock) _,_,method,path,http_protocol = string.find(line, "(.+)%s+(.+)%s+(.+)") if method~='GET' and method~='get' and method~='POST' and method~='post' and method~='OPTIONS' and method~='options' then task.throw("无效的method:"..method) end if type(path) ~= "string" then task.throw("无效的 path:") end nLog('path=',path) if type(http_protocol) ~= "string" then task.throw("无效的 http_protocol:") end local is_post = false if not (method=='GET' or method=='get') then is_post = true end --提取get参数 local split_result = string.split(path, "?") path = split_result[1] local params = {} --开始查分参数 if split_result[2] then local params_str = split_result[2] local split_result = string.split(params_str, "&") for i,param in pairs(split_result) do if #param > 0 then local split_param = string.split(param, "=") if #split_param == 2 then params[split_param[1]] = decodeURI(split_param[2]) end end end end -- 接收headers local headers = {} while true do local line = socket_help.receive_line(task,sock) if #line == 0 then print('结束header') break; end local _,_,name,value = string.find(line, "^(.-):%s*(.*)") line = '' if name then print('header:'..name..": "..value) headers[string.lower(name)] = value; else print("无效的header!") end end local post_data = '' if is_post and headers['content-length'] then local post_length = tonumber(headers['content-length']) print('post_length=',post_length) while true do local chunk, status, partial = sock:receive(post_length - #post_data) post_data = post_data..(chunk or partial) if status == 'timeout' then task.sleep(1) end if status == 'closed' then task.throw("connection is closed") end if #post_data >= post_length then break; end end end --调用返回 local body = nil local respond = {code=200,headers={}} if true then --判断直接返回文件 if conf and conf.root and conf.files and type(conf.files)=="table" then for index,file_grep in pairs(conf.files) do print("file_grep.grep=",file_grep.grep) if type(file_grep) == "table" and type(file_grep['grep'])== "string" and string.find(path,file_grep["grep"])~=nil then local filename = conf.root..path local f = io.open(filename,"rb") if f then body = f:read("*all") f:close() if type(file_grep["Content_Type"])== "string" then --写Content_Type respond.headers["Content-Type"] = file_grep["Content_Type"] end respond.headers["Connection"] = "close" break else -- body = "" -- respond.code = 404 end end end end if body == nil then task.clearTimeout() body = respond_func({ method=method,path=path,headers=headers, params=params,post_data=post_data, client_ip=client_ip,client_port=client_port },respond,task) end end if body then headers['Content-Length']=#body -- sock:send(http_protocol.." "..respond.code.."\r\n") sock_send(task,sock,http_protocol.." "..respond.code.."\r\n") for name,value in pairs(respond.headers) do -- sock:send(name..': '..value.."\r\n") sock_send(task,sock,name..': '..value.."\r\n") end -- sock:send("\r\n"); sock_send(task,sock,"\r\n"); -- sock:send(body); sock_send(task,sock,body); end -- sock:close() end,{ task_name="httpClient"..(conf.name or "")..conf.port, -- filelog = true, callBack = function(output) sock:close() end, }) return client end function webServer.create(port,respond_func,conf) local conf = conf or {} local port = port or 0 local server = { } conf.port = port --运行服务 function server:run() server.socket = socket.tcp() server.socket:setoption("reuseaddr",true) local ok,msg = server.socket:bind("*",port) if not ok then nLog("绑定失败:",msg) return end server.socket:listen(1024) server.running = true server.socket:settimeout(0) --获取端口号 local server_ip,server_port = server.socket:getsockname() server.port = server_port nLog("webserver port:",server_port) thread.create(function(task) while server.running do local conn = server.socket:accept() if conn then task.log("accept ok") httpClient(task,conn,respond_func,conf) end task.sleep(1) end server.socket:close() end,{ task_name="webServer-"..port..(conf.name or ""), -- filelog = true, }) return server.port end --停止服务 function server:stop() server.running = false end return server end return webServer
-- Clean warning on openresty 1.15.8.1, where some global variables are set -- using ngx.timer that triggers an invalid warning message. -- Code related: https://github.com/openresty/lua-nginx-module/blob/61e4d0aac8974b8fad1b5b93d0d3d694d257d328/src/ngx_http_lua_util.c#L795-L839 getmetatable(_G).__newindex = nil if ngx ~= nil then ngx.exit = function()end end if os.getenv('CI') == 'true' then local luacov = require('luacov.runner') local pwd = os.getenv('PWD') for _, option in ipairs({"statsfile", "reportfile"}) do -- properly expand current working dir, workaround for https://github.com/openresty/resty-cli/issues/35 luacov.defaults[option] = pwd .. package.config:sub(1, 1) .. luacov.defaults[option] end table.insert(arg, '--coverage') end -- Busted command-line runner require 'busted.runner'({ standalone = false })
ENT.Base = "base_entity" ENT.Type = "anim" ENT.PrintName = "Element Skill" ENT.isskill = true AccessorFunc( ENT, "maxlive", "MaxLive", FORCE_INT ) local function StageChange( ent, name, oldval, newval ) ent.stage = newval if (!oldval) then return end if (oldval == newval) then return end local skill = ent:GetSkill() ecall( skill["Transition" .. oldval], skill, ent ) end function ENT:SetupDataTables() self.skill = nil --{} self.lastThink = CurTime() self.alive = 0 --Use Timestamp instead TODO self.stage = 1 self:SetMaxLive( 60 ) --immediately networked & reliable but no proxy self:NetworkVar("String", 0, "Skillname") self:NetworkVar("Entity", 0, "Caster") self:NetworkVar("Entity", 1, "Target") self:NetworkVar("Bool", 0, "Invisible") self:NetworkVar("Float", 0, "Birth") --faster? has proxys though self:SetNWVarProxy("stage", StageChange) self:SetNWInt("stage", 1) if SERVER then self.touchCooldown = {} self.casterCollision = false self.removeOnWorldTrace = false self.touchPlayerOnce = false self.touchCaster = false self.touchRate = 1 self.collidePlayers = true self.collideSkills = false self.touchedPlayers = {} self.touching = {} self.dots = {} end self:DrawShadow( false ) end function ENT:SetSkill( skill ) self.skill = skill if SERVER then self:SetSkillname(skill.name) end end function ENT:GetSkill() if (!self.skill) then self.skill = skill_manager.GetSkill(self:GetSkillname()) end return self.skill end function ENT:Update( stage ) if (!self.loaded) then return false end local now = CurTime() self.deltaTime = now - self.lastThink self.alive = self.alive + self.deltaTime self.lastThink = now self:NextThink( now ) return true end function ENT:UpdateSkill( stage ) stage = stage or self:GetNW2Int("stage") local skill = self:GetSkill() skill:Update( self, stage ) return skill end function ENT:SetCustomCollider( collider ) self.collider = collider self.collider:SetEntity( self ) local filter = { self } if SERVER and !self:GetTouchCaster() then table.insert(filter, self:GetCaster()) end self.collider:Filter( filter ) return self.collider end function ENT:GetCustomCollider() return self.collider end function ENT:OnRemove() local skill = self:GetSkill() ecall(skill.OnRemove, skill, self) end
function love.draw() love.graphics.rectangle("fill", 100, 200, 50, 80) love.graphics.print("Hello World", 400, 300) end
ghomrassen_cupa_cupa_neutral_medium_boss_01 = Lair:new { mobiles = {{"gr_cu_pa",1}}, bossMobiles = {{"gr_wonderous_cu_pa",1}}, spawnLimit = 15, buildingsVeryEasy = {"object/tangible/lair/base/poi_all_lair_garbage_small.iff"}, buildingsEasy = {"object/tangible/lair/base/poi_all_lair_garbage_small.iff"}, buildingsMedium = {"object/tangible/lair/base/poi_all_lair_garbage_small.iff"}, buildingsHard = {"object/tangible/lair/base/poi_all_lair_garbage_small.iff"}, buildingsVeryHard = {"object/tangible/lair/base/poi_all_lair_garbage_small.iff"}, } addLairTemplate("ghomrassen_cupa_cupa_neutral_medium_boss_01", ghomrassen_cupa_cupa_neutral_medium_boss_01)
local IAspectModdable = require("api.IAspectModdable") local IAspect = class.interface("IAspect", { localize_action = "function" }, { IAspectModdable }) function IAspect:localize_action(obj, iface) return "???" end function IAspect.__on_require(t) -- HACK Require the aspect's default impl so its deserializer will get loaded on startup. -- See #162. if t.default_impl then require(t.default_impl) end end return IAspect
-- require "/lib/stardust/color.lua" appearance = { } local wingFront = Prop.new(2) local wingBack = Prop.new(-2) local wingAlpha = 0 local wingEffDir = 1.0 local wingsVisible = false local wingEnergyColor local wingBaseRot = 0 local wingBaseOffset = 0 wingFront:scale({0, 0}) wingBack:scale({0, 0}) local fieldAlpha = 0.00001 -- update on first frame local fieldColor = "9771e4" local energyPalette = { } function appearance.update(p) do -- wings local ta = wingsVisible and 1.0 or 0.0 if wingAlpha ~= ta then wingAlpha = util.clamp(wingAlpha + (ta*2 - 1) * 5 * p.dt, 0.0, 1.0) local ov = util.clamp(wingAlpha * 1.5, 0.0, 1.0) local fv = util.clamp(-.5 + wingAlpha * 1.5, 0.0, 1.0) local fade = string.format("%s?fade=%s;%.3f", color.alphaDirective(ov), color.toHex(wingEnergyColor or "ffffff"), (1.0 - fv)) wingFront:setDirectives(fade, fade) wingBack:setDirectives(fade .. "?brightness=-40", fade .. "?multiply=ffffffbf") end wingFront:scale({mcontroller.facingDirection() * wingEffDir, 1.0}, {0.0, 0.0}) wingBack:scale({mcontroller.facingDirection() * wingEffDir, 1.0}, {0.0, 0.0}) wingEffDir = mcontroller.facingDirection() end if fieldAlpha > 0 then fieldAlpha = fieldAlpha - p.dt * 3 local a = util.clamp(fieldAlpha, 0.0, 1.0) if a == 0 then tech.setParentDirectives("") else tech.setParentDirectives(string.format("?border=1;%s;0000", color.hexWithAlpha(energyPalette[2] or fieldColor, a))) end end end function appearance.setEnergyColor(c) if not c then energyPalette = { } else local h, s, l, a = table.unpack(color.toHsl(c)) energyPalette = { color.fromHsl {h, s, math.min(l * 75, 0.9), a }, c, color.fromHsl {h, s, l * 0.64, a }, } end world.sendEntityMessage(entity.id(), "startech:refreshEnergyColor") end message.setHandler("startech:getEnergyColor", function() return energyPalette[1] and energyPalette or nil end) function appearance.pulseForceField(amt) fieldAlpha = math.max(fieldAlpha, (amt or 1.0) + script.updateDt() * 3) end function appearance.setWings(w) local imgFront, imgBack = w.imgFront, w.imgBack if type(imgFront) == "string" then imgFront = {imgFront} end if type(imgBack) == "string" then imgBack = {imgBack} end wingFront:setImage(table.unpack(imgFront)) wingBack:setImage(table.unpack(imgBack)) wingEnergyColor = w.energyColor wingBaseRot = w.baseRotation or 0 wingBaseOffset = w.baseOffset or 0 if w.providesEnergyColor then appearance.setEnergyColor(w.energyColor) end wingAlpha = wingAlpha - 0.001 -- kick things a bit end function appearance.setWingsVisible(f) wingsVisible = not not f end function appearance.positionWings(r) local offset = {-5 / 16, -15 / 16 + wingBaseOffset} wingFront:resetTransform() wingBack:resetTransform() -- base rotation first wingFront:rotate(wingBaseRot) wingBack:rotate(wingBaseRot) -- rotate wings relative to attachment wingFront:rotate(r * math.pi * .14) wingBack:rotate(r * math.pi * .07) wingBack:rotate(-0.11) -- then handle attachment sync wingFront:translate(offset) wingFront:rotate(mcontroller.rotation() * mcontroller.facingDirection()) wingBack:translate(offset) wingBack:translate({3 / 16, 0 / 16}) wingBack:rotate(mcontroller.rotation() * mcontroller.facingDirection()) wingEffDir = 1.0 end
slot0 = class_C("BulletVisual", ClassLoader:aquireClass("Visual")) slot0.onCreate = function (slot0, slot1, slot2) slot0.super.onCreate(slot0) slot0:addProperty("boneData", slot2) slot0:addProperty("isDead", slot2) slot0:addProperty("isRemoved", slot2) slot0._textureName = slot1.szResourceName slot0._texturePath = GET_PATH(FilePath.ANIMATION, "%s/%s_other.png", slot0._textureName, slot0._textureName) slot0._sprite = cc.Sprite:create(slot0._texturePath) if cc.Node.setCullFace then slot0._sprite:setCullFace(true) end slot0._visualNode:addChild(slot0._sprite) slot0.gameConfig = ClassLoader:aquireSingleton("GameConfig") slot0.mirroredPosition = { z = 0, x = 0, y = 0 } slot0.lastPosition = { z = 0, x = 0, y = 0 } end slot0.onLoad = function (slot0) slot0.super.onLoad(slot0) slot1 = slot0:getValue("owner") slot0:bindSameName("boneData", slot1, "TWO_WAY") slot0:bindSameName("isDead", slot1, "TWO_WAY") slot0:bindSameName("isRemoved", slot1, "TWO_WAY") slot0.boneData:trigger(slot0._visualNode) end slot0.onUnload = function (slot0) slot0.super.onUnload(slot0) if not slot0.gameConfig.PLATFORM_ANDROID then slot0.boneData._value.transformation = nil slot0.boneData._value.skeleton = nil end slot0:unBindAll() end slot0.onEnter = function (slot0, slot1) slot0.super.onEnter(slot0, slot1) ClassLoader:aquireSingleton("CocosLayerManager"):getLayer("BulletLayer"):addChild(slot0._visualNode, 2) end slot0.onExit = function (slot0) slot0.super.onExit(slot0) slot0._visualNode:removeFromParent() end slot0.on_scale_changed = function (slot0) return end slot0.onUpdate = function (slot0) slot1 = cc.Director:getInstance():getVisibleSize() if slot0.gameConfig.MirrorFlag then slot0.mirroredPosition.x = slot0.gameConfig.Width - slot0.position._value.x slot0.mirroredPosition.y = slot0.gameConfig.Height - slot0.position._value.y slot0.mirroredPosition.z = 0 slot0._visualNode:setPosition3D(slot0.mirroredPosition) slot0._visualNode:setRotation(270 - slot0.rotation._value * 57.29578) else slot0.mirroredPosition.x = slot0.position._value.x slot0.mirroredPosition.y = slot0.position._value.y slot0.mirroredPosition.z = 0 slot0._visualNode:setPosition3D(slot0.mirroredPosition) slot0._visualNode:setRotation(90 - slot0.rotation._value * 57.29578) end slot0.lastPosition.x = slot0.mirroredPosition.x slot0.lastPosition.y = slot0.mirroredPosition.y slot0.lastPosition.z = slot0.mirroredPosition.z if not slot0.gameConfig.PLATFORM_ANDROID then slot0.boneData._value.transformation = slot0._visualNode:getNodeToWorldTransform() slot0:trigger("boneData", slot0.boneData._value) end end slot0.onReset = function (slot0, slot1) slot0.super.onReset(slot0) slot0._sprite:setVisible(true) slot0._textureName = slot1.szResourceName slot0._texturePath = GET_PATH(FilePath.ANIMATION, "%s/%s_other.png", slot0._textureName, slot0._textureName) slot0._sprite:setTexture(slot0._texturePath) end slot0.onDestroy = function (slot0) slot0.mirroredPosition = nil slot0._sprite:removeFromParent() slot0._sprite = nil slot0.super.onDestroy(slot0) end return slot0
require "cutorch" require "cunn" model = nn.Sequential() l1 = nn.Linear(1,20):cuda() l2 = nn.Linear(20, 20):cuda() l3 = nn.Linear(20, 1):cuda() model:add(l1) model:add(nn.Tanh():cuda()) model:add(l2) model:add(nn.Tanh():cuda()) model:add(l3) criterion = nn.MSECriterion():cuda() for i = 1,100000 do local x = torch.CudaTensor(1) x[1] = torch.uniform(0, 6.28) local correct = torch.sin(x):cuda() local output = model:forward(x) criterion:forward(output, correct) model:zeroGradParameters() local critback = criterion:backward(model.output:cuda(), correct) model:backward(x, critback) model:updateParameters(0.01) end
--- old junk --[[ -- This contact force pair is artificial, but prevents the sticking of objects due to constraints (during stacking. I do not fully understand this yet) -- Contact force pair, obj2 on obj1 if (obj2.fX*normal_x+obj2.fY*normal_y)<=0 then fContact_mag=(obj2.fX*normal_x+obj2.fY*normal_y) fContact_x=fContact_mag*normal_x fContact_y=fContact_mag*normal_y obj1.fAppliedX=obj1.fAppliedX+fContact_x obj1.fAppliedY=obj1.fAppliedY+fContact_y obj2.fAppliedX=obj2.fAppliedX-fContact_x obj2.fAppliedY=obj2.fAppliedY-fContact_y end -- Contact force pair, obj1 on obj2 if (obj1.fX*normal_x+obj1.fY*normal_y)>=0 then fContact_mag=(obj1.fX*normal_x+obj1.fY*normal_y) fContact_x=fContact_mag*normal_x fContact_y=fContact_mag*normal_y obj2.fAppliedX=obj2.fAppliedX+fContact_x obj2.fAppliedY=obj2.fAppliedY+fContact_y obj1.fAppliedX=obj1.fAppliedX-fContact_x obj1.fAppliedY=obj1.fAppliedY-fContact_y end --]] --[[ factor=(1.0+cR)/(obj2.mass+obj1.mass) local deltaV2_x=factor*(obj1.vX-obj2.vX) local deltaV2_y=factor*(obj1.vY-obj2.vY) local deltaV2_mag=(deltaV2_x*normal_x+deltaV2_y*normal_y) if deltaV2_mag<=0 then deltaV2_mag=0 end deltaV2_x=deltaV2_mag*normal_x deltaV2_y=deltaV2_mag*normal_y if obj2.mass < infiniteMass then obj2.vX = obj2.vX+obj1.mass*deltaV2_x obj2.vY = obj2.vY+obj1.mass*deltaV2_y end if obj1.mass < infiniteMass then obj1.vX = obj1.vX-obj2.mass*deltaV2_x obj1.vY = obj1.vY-obj2.mass*deltaV2_y end --]] --adaptive timestep this does not work well with many balls, the timestep becomes too small, and the program slows -- down to a crawl --[[ function adaptiveEvolve(dt) -- optionally: take small steps instead of one big one to increase accuracy of collisions local stepTime=dt local currentTime=0 while currentTime<dt do for i,obj in ipairs(objects) do if obj.type=="player" then obj.fAppliedX=inputX obj.fAppliedY=inputY else obj.fAppliedX = 0 obj.fAppliedY = 0 end end for i,obj in ipairs(objects) do obj.oldVX=obj.vX obj.oldVY=obj.vY obj.oldX=obj.x obj.oldY=obj.y obj.oldFx=obj.fAppliedX obj.oldFY=obj.fAppliedY end takeTimeStep(stepTime) if penetration() and stepTime>0.002 then for i,obj in ipairs(objects) do obj.VX=obj.oldVX obj.VY=obj.oldVY obj.x=obj.oldX obj.y=obj.oldY end stepTime=stepTime/2 else resolveCollisions(stepTime) for i,obj in ipairs(objects) do obj.VX=obj.oldVX obj.VY=obj.oldVY obj.x=obj.oldX obj.y=obj.oldY end takeTimeStep(stepTime) checkBorders() -- artificially change object's positions to prevent interpenetration resolveConstraints() currentTime=currentTime+stepTime stepTime=dt-currentTime end end end --]]
-- Author: Hua Liang[Stupid ET] <et@everet.org> require 'VisibleRect' require 'logger'
AddCSLuaFile("shared.lua") AddCSLuaFile("cl_init.lua") include("shared.lua") local ACF = ACF ACF.RegisterClassLink("acf_computer", "acf_rack", function(Computer, Target) if Computer.Weapons[Target] then return false, "This rack is already linked to this computer!" end if Target.Computer == Computer then return false, "This rack is already linked to this computer!" end Computer.Weapons[Target] = true Target.Computer = Computer Computer:UpdateOverlay() Target:UpdateOverlay() return true, "Rack linked successfully!" end) ACF.RegisterClassUnlink("acf_computer", "acf_rack", function(Computer, Target) if Computer.Weapons[Target] or Target.Computer == Computer then Computer.Weapons[Target] = nil Target.Computer = nil Computer:UpdateOverlay() Target:UpdateOverlay() return true, "Rack unlinked successfully!" end return false, "This rack is not linked to this computer." end) ACF.RegisterClassLink("acf_computer", "acf_gun", function(Computer, Target) if Computer.Weapons[Target] then return false, "This computer is already linked to this weapon!" end if Target.Computer == Computer then return false, "This computer is already linked to this weapon!" end Computer.Weapons[Target] = true Target.Computer = Computer Computer:UpdateOverlay() Target:UpdateOverlay() return true, "Computer linked successfully!" end) ACF.RegisterClassUnlink("acf_computer", "acf_gun", function(Computer, Target) if Computer.Weapons[Target] or Target.Computer == Computer then Computer.Weapons[Target] = nil Target.Computer = nil Computer:UpdateOverlay() Target:UpdateOverlay() return true, "Computer unlinked successfully!" end return false, "This computer is not linked to this weapon." end) --===============================================================================================-- -- Local Funcs and Vars --===============================================================================================-- local CheckLegal = ACF_CheckLegal local Components = ACF.Classes.Components local UnlinkSound = "physics/metal/metal_box_impact_bullet%s.wav" local MaxDistance = ACF.LinkDistance * ACF.LinkDistance local HookRun = hook.Run local function CheckDistantLinks(Entity, Source) local Position = Entity:GetPos() for Link in pairs(Entity[Source]) do if Position:DistToSqr(Link:GetPos()) > MaxDistance then local Sound = UnlinkSound:format(math.random(1, 3)) Entity:EmitSound(Sound, 70, 100, ACF.Volume) Link:EmitSound(Sound, 70, 100, ACF.Volume) Entity:Unlink(Link) end end end --===============================================================================================-- do -- Spawn and update function local function VerifyData(Data) if not Data.Computer then Data.Computer = Data.Component or Data.Id end local Class = ACF.GetClassGroup(Components, Data.Computer) if not Class or Class.Entity ~= "acf_computer" then Data.Computer = "CPR-LSR" Class = ACF.GetClassGroup(Components, "CPR-LSR") end do -- External verifications if Class.VerifyData then Class.VerifyData(Data, Class) end HookRun("ACF_VerifyData", "acf_computer", Data, Class) end end local function CreateInputs(Entity, Data, Class, Computer) local List = {} if Class.SetupInputs then Class.SetupInputs(List, Entity, Data, Class, Computer) end HookRun("ACF_OnSetupInputs", "acf_computer", List, Entity, Data, Class, Computer) if Entity.Inputs then Entity.Inputs = WireLib.AdjustInputs(Entity, List) else Entity.Inputs = WireLib.CreateInputs(Entity, List) end end local function CreateOutputs(Entity, Data, Class, Computer) local List = { "Entity [ENTITY]" } if Class.SetupOutputs then Class.SetupOutputs(List, Entity, Data, Class, Computer) end HookRun("ACF_OnSetupOutputs", "acf_computer", List, Entity, Data, Class, Computer) if Entity.Outputs then Entity.Outputs = WireLib.AdjustOutputs(Entity, List) else Entity.Outputs = WireLib.CreateOutputs(Entity, List) end end local function UpdateComputer(Entity, Data, Class, Computer) Entity.ACF = Entity.ACF or {} Entity.ACF.Model = Computer.Model -- Must be set before changing model Entity:SetModel(Computer.Model) Entity:PhysicsInit(SOLID_VPHYSICS) Entity:SetMoveType(MOVETYPE_VPHYSICS) if Entity.OnLast then Entity:OnLast() end -- Storing all the relevant information on the entity for duping for _, V in ipairs(Entity.DataStore) do Entity[V] = Data[V] end Entity.Name = Computer.Name Entity.ShortName = Entity.Computer Entity.EntType = Class.Name Entity.ClassData = Class Entity.OnUpdate = Computer.OnUpdate or Class.OnUpdate Entity.OnLast = Computer.OnLast or Class.OnLast Entity.OverlayTitle = Computer.OnOverlayTitle or Class.OnOverlayTitle Entity.OverlayBody = Computer.OnOverlayBody or Class.OnOverlayBody Entity.OnDamaged = Computer.OnDamaged or Class.OnDamaged Entity.OnEnabled = Computer.OnEnabled or Class.OnEnabled Entity.OnDisabled = Computer.OnDisabled or Class.OnDisabled Entity.OnThink = Computer.OnThink or Class.OnThink Entity:SetNWString("WireName", "ACF " .. Computer.Name) Entity:SetNW2String("ID", Entity.Computer) CreateInputs(Entity, Data, Class, Computer) CreateOutputs(Entity, Data, Class, Computer) ACF.Activate(Entity, true) Entity.ACF.LegalMass = Computer.Mass Entity.ACF.Model = Computer.Model local Phys = Entity:GetPhysicsObject() if IsValid(Phys) then Phys:SetMass(Computer.Mass) end if Entity.OnUpdate then Entity:OnUpdate(Data, Class, Computer) end if Entity.OnDamaged then Entity:OnDamaged() end end hook.Add("ACF_OnSetupInputs", "ACF Computer Inputs", function(Class, List, _, _, _, Computer) if Class ~= "acf_computer" then return end if not Computer.Inputs then return end local Count = #List for I, Input in ipairs(Computer.Inputs) do List[Count + I] = Input end end) hook.Add("ACF_OnSetupOutputs", "ACF Computer Outputs", function(Class, List, _, _, _, Computer) if Class ~= "acf_computer" then return end if not Computer.Outputs then return end local Count = #List for I, Output in ipairs(Computer.Outputs) do List[Count + I] = Output end end) ------------------------------------------------------------------------------- function MakeACF_Computer(Player, Pos, Angle, Data) VerifyData(Data) local Class = ACF.GetClassGroup(Components, Data.Computer) local Computer = Class.Lookup[Data.Computer] local Limit = Class.LimitConVar.Name if not Player:CheckLimit(Limit) then return false end local Entity = ents.Create("acf_computer") if not IsValid(Entity) then return end Entity:SetPlayer(Player) Entity:SetAngles(Angle) Entity:SetPos(Pos) Entity:Spawn() Player:AddCleanup("acf_computer", Entity) Player:AddCount(Limit, Entity) Entity.Owner = Player -- MUST be stored on ent for PP Entity.Weapons = {} Entity.DataStore = ACF.GetEntityArguments("acf_computer") UpdateComputer(Entity, Data, Class, Computer) if Class.OnSpawn then Class.OnSpawn(Entity, Data, Class, Computer) end HookRun("ACF_OnEntitySpawn", "acf_computer", Entity, Data, Class, Computer) WireLib.TriggerOutput(Entity, "Entity", Entity) Entity:UpdateOverlay(true) do -- Mass entity mod removal local EntMods = Data and Data.EntityMods if EntMods and EntMods.mass then EntMods.mass = nil end end CheckLegal(Entity) timer.Create("ACF Computer Clock " .. Entity:EntIndex(), 3, 0, function() if not IsValid(Entity) then return end CheckDistantLinks(Entity, "Weapons") end) return Entity end ACF.RegisterEntityClass("acf_opticalcomputer", MakeACF_Computer, "Computer") -- Backwards compatibility ACF.RegisterEntityClass("acf_computer", MakeACF_Computer, "Computer") ACF.RegisterLinkSource("acf_computer", "Weapons") ------------------- Updating --------------------- function ENT:Update(Data) VerifyData(Data) local Class = ACF.GetClassGroup(Components, Data.Computer) local Computer = Class.Lookup[Data.Computer] local OldClass = self.ClassData if OldClass.OnLast then OldClass.OnLast(self, OldClass) end HookRun("ACF_OnEntityLast", "acf_computer", self, OldClass) ACF.SaveEntity(self) UpdateComputer(self, Data, Class, Computer) ACF.RestoreEntity(self) if Class.OnUpdate then Class.OnUpdate(self, Data, Class, Computer) end HookRun("ACF_OnEntityUpdate", "acf_computer", self, Data, Class, Computer) self:UpdateOverlay(true) net.Start("ACF_UpdateEntity") net.WriteEntity(self) net.Broadcast() return true, "Computer updated successfully!" end end function ENT:ACF_OnDamage(Energy, FrArea, Angle, Inflictor) local HitRes = ACF.PropDamage(self, Energy, FrArea, Angle, Inflictor) --self.Spread = ACF.MaxDamageInaccuracy * (1 - math.Round(self.ACF.Health / self.ACF.MaxHealth, 2)) if self.OnDamaged then self:OnDamaged() end return HitRes end function ENT:Enable() if self.OnEnabled then self:OnEnabled() end end function ENT:Disable() if self.OnDisabled then self:OnDisabled() end end function ENT:UpdateOverlayText() local Title = self.OverlayTitle and self:OverlayTitle() or "Idle" local Body = self.OverlayBody and self:OverlayBody() Body = Body and ("\n\n" .. Body) or "" return Title .. Body end function ENT:Think() if self.OnThink then self:OnThink() end self:NextThink(ACF.CurTime) return true end function ENT:PreEntityCopy() if next(self.Weapons) then local Entities = {} for Weapon in pairs(self.Weapons) do Entities[#Entities + 1] = Weapon:EntIndex() end duplicator.StoreEntityModifier(self, "ACFWeapons", Entities) end -- wire dupe info self.BaseClass.PreEntityCopy(self) end function ENT:PostEntityPaste(Player, Ent, CreatedEntities) local EntMods = Ent.EntityMods if EntMods.ACFWeapons then for _, EntID in pairs(EntMods.ACFWeapons) do self:Link(CreatedEntities[EntID]) end EntMods.ACFWeapons = nil end -- Wire dupe info self.BaseClass.PostEntityPaste(self, Player, Ent, CreatedEntities) end function ENT:OnRemove() local OldClass = self.ClassData if OldClass.OnLast then OldClass.OnLast(self, OldClass) end HookRun("ACF_OnEntityLast", "acf_computer", self, OldClass) for Weapon in pairs(self.Weapons) do self:Unlink(Weapon) end if self.OnLast then self:OnLast() end timer.Remove("ACF Computer Clock " .. self:EntIndex()) WireLib.Remove(self) end
local doc = {} function doc.record() doc.__record = {} end function doc.stop() local md = table.concat(doc.__record) doc.__record = nil return md end function doc.doc(str) if doc.__record then table.insert(doc.__record, str) end end setmetatable(doc, {__call= function(self, ...) return self.doc(...) end}) return doc
local Actor = require "actor" local Vector2 = require "vector" local Tiles = require "tiles" local Sqeeto = Actor:extend() Sqeeto.char = Tiles["sqeeto"] Sqeeto.name = "sqeeter" Sqeeto.color = {0.8, 0.7, 0.09} Sqeeto.components = { components.Sight{ range = 4, fov = true, explored = false }, components.Move{ speed = 100, passable = false}, components.Stats { ATK = 0, MGK = 0, PR = 1, MR = 0, maxHP = 4, AC = 2 }, components.Attacker { defaultAttack = { name = "Probiscus", stat = "ATK", dice = "1d1" } }, components.Aicontroller(), components.Animated() } local actUtil = components.Aicontroller function Sqeeto:act(level) local highest = 0 local highestActor = nil local wowFactor = false local function playAnim(animateBool, actor) if not animateBool then return end level:addEffectAfterAction(effects.CharacterDynamic(actor, 0, -1, Tiles["bubble_surprise"], {1, 1, 1}, .5)) end for k, v in pairs(self.seenActors) do if v:is(actors.Player) and self:getRange("box", v) == 1 then return self:getAction(actions.Attack)(self, v) elseif v:hasComponent(components.Light) then local lightVal = ROT.Color.value(v.light) * v.lightIntensity if lightVal > highest then highest = lightVal highestActor = v end end end local x, y, brightest = actUtil.getLightestTile(level, self) local spider = actUtil.closestSeenActorByType(self, actors.Webweaver) if highestActor then if not (highestActor == self.actTarget) then wowFactor = true end self.actTarget = highestActor else self.actTarget = nil end if spider then level:addEffect(effects.CharacterDynamic(self, 0, -1, Tiles["bubble_lines"], {1, 1, 1}, .5)) return actUtil.moveAway(self, spider) end if self.actTarget then if brightest > ROT.Color.value(self.actTarget.light) * self.actTarget.lightIntensity then self.actTarget = nil else if math.random() > .75 then local action, moveVec = actUtil.randomMove(level, self) playAnim(wowFactor, self) return action end local action, moveVec = actUtil.moveTowardObject(self, self.actTarget) playAnim(wowFactor, self) return action end end return actUtil.moveTowardLight(level, self) end return Sqeeto
X = {} local IBUtil = require(GetScriptDirectory() .. "/ItemBuildlogic"); local npcBot = GetBot(); local talents = IBUtil.FillTalenTable(npcBot); local skills = IBUtil.FillSkillTable(npcBot, IBUtil.GetSlotPattern(1)); X["items"] = { "item_poor_mans_shield", "item_boots", "item_magic_wand", "item_power_treads_agi", "item_ring_of_aquila", "item_diffusal_blade_1", "item_manta", "item_butterfly", "item_heart", "item_radiance" }; X["skills"] = IBUtil.GetBuildPattern( "normal", {3,2,3,2,3,4,3,2,2,1,4,1,1,1,4}, skills, {1,3,5,7}, talents ); return X
local m = {} local string = string local concat = table.concat function string.pgsub(str, from, to, count) from = from:gsub('%p', '%%%0') -- lazy version return string.gsub(str, from, to, count) end --[[ Process the contents of a file with a function. ]] local sformat = string.format local function errorf(msg, level, ...) error(sformat(msg, ...), level) end local function printf(...) print(sformat(...)) end local function typeassert(actualtype, expectedtype, funcname, i) if actualtype ~= expectedtype then errorf('bad argument #%d to %s (%s expected, got %s)', 2, i, funcname, expectedtype, actualtype) end end local function write (filepath, text, checked) if not checked then typeassert(type(filepath), 'string', 'write', 1) typeassert(type(text), 'string', 'write', 2) end -- If 'rb' mode is used and the old file length is greater than the length -- of the text being written, bytes from the old file will remain in the -- new version. local file = assert(io.open(filepath, 'wb'), sformat('Could not open file %s', filepath)) if not file:write(text) then printf('Could not write to file %s', filepath) elseif not file:flush() then printf('Could not flush changes to file %s', filepath) else printf('Modified %s', filepath) end file:close() end m.write = write local function modify (filepath, modify) if filepath:find([[%.%.?$]]) then return end typeassert(type(filepath), 'string', 'modifyfile', 1) typeassert(type(modify), 'function', 'modifyfile', 2) local file = assert(io.open(filepath, 'rb'), sformat('Could not open file %s', filepath)) local text = file:read 'a' file:close() if not text then printf('Could not read file %s', filepath) return end if text == '' then return end -- Unlikely; if file is empty, read returns nil? text = modify(text) if type(text) ~= 'string' then printf('Modify function returned %s rather than a string for %s; file not modified', type(text), filepath) file:close() return end write(filepath, text, true) end m.modify = modify local function readall (filepath) typeassert(type(filepath), 'string', 'readall', 1) local file = assert(io.open(filepath, 'rb')) -- Avoid weird modifications done in Windows text mode. local text = assert(file:read 'a', sformat('The file %s is empty.', filepath)) file:close() return text end m.readall = readall local mt = {} setmetatable(m, mt) -- Automatically create functions for each of the string-matching functions if needed. function mt.__index (self, key) local out if key == 'find' or key == 'match' or key == 'gmatch' then out = function (filepath, ...) typeassert(type(filepath), 'string', key, 1) local text = readall(filepath) return string[key](text, ...) end elseif key == 'gsub' or key == 'pgsub' then out = function (filepath, from, to, count) typeassert(type(filepath), 'string', key, 1) modify( filepath, function (text) return string[key](text, from, to, count) end) end end self[key] = out return out end m.string_matching_funcs = concat({ 'find', 'match', 'gmatch', 'gsub', 'pgsub' }, ' ') local function length (filepath) local file = assert(io.open(filepath, 'rb'), sformat('Could not open file %s', filepath)) local len = file:seek 'end' file:close() return len end m.length = length return m
return { { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 500 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 720 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 940 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 1160 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 1380 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 1600 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 1820 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 2040 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 2260 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "antiAirPower", number = 2500 } } } }, time = 3, name = "天真烂漫的少女", init_effect = "jinengchufablue", color = "yellow", picture = "", desc = "自身防空提高", stack = 1, id = 12231, icon = 12231, last_effect = "", blink = { 0, 0.7, 1, 0.3, 0.3 }, effect_list = {} }
terrain_low_poly_mat = { passes = { base = { queue='opaque', shader='terrain_low_poly' }, depthPrepass = { shader='depth_prepass', } }, resources = { heightmap = { resType='texture2D', uv='clamp', --texFormat='r16f', texFormat='red', storeData=true, useMipMaps=false, usedAsStorageInCompute=true, }, colorMap = { resType='texture2D', --filter="nearest", texFormat='rgba8', storeData=true }, } }
states.win = {} function states.win:draw() cls() print("you win the game!",8,48) print(states.start.time.." seconds",8,64) spr(0,48,16,2,3) spr(208,64,16,2,3) end function states.win:update(dt) if btn(5) then switch_state("start") end end
return function(f) local ok, v = pcall(f) return ok and v or nil end
--This macro calculates the relative humidity of ice --from HIRLAM surface variables temperature, pressure and dew point. --Toni Amnell 26.10.2010 function rhice(p,t,dp) -- p = air pressure in hPa -- t = temperature in *C -- dp = dew point in *C --Saturated vapor pressure of pure ice or water local ei=6.112*math.exp(22.46*t/(272.62+t)) local ew=6.112*math.exp(17.62*dp/(243.12+dp)) --Saturated vapor pressure of water/ice in moist air using approximated enhancement factors by Sonntag local ei_prime=(1+(1.0e-5*ei/(273+t))*((2100-65*t)*(1-ei/p)+(109-0.35*t+t*t/338)*(p/ei-1)))*ei local e_prime=(1+(1.0e-4*ew/(273+dp))*((38+173*math.exp(-dp/43))*(1-ew/p)+(6.39+4.28*math.exp(-dp/107))*(p/ew-1)))*ew return 100*(p-ei_prime)*e_prime/((p-e_prime)*ei_prime) end --Main program -- local PParam = param("P-PA") local prod = configuration:GetSourceProducer(0) if prod:GetId() == 131 then PParam = param("PGR-PA") end local Missing = missing local p = luatool:FetchWithType(current_time, level(HPLevelType.kHeight, 0), PParam, current_forecast_type) local t = luatool:FetchWithType(current_time, level(HPLevelType.kHeight, 2), param("T-K"), current_forecast_type) local dp = luatool:FetchWithType(current_time, level(HPLevelType.kHeight, 2), param("TD-K"), current_forecast_type) local i = 0 local res = {} for i=1, #t do t[i] = t[i]-273.15 dp[i] = dp[i]-273.15 p[i] = p[i]/100.0 if (t[i]<0) then res[i] = rhice(p[i],t[i],dp[i]) else res[i] = Missing end end result:SetValues(res) result:SetParam(param("RHICE-PRCNT")) luatool:WriteToFile(result)
local radio = require('radio') if #arg < 1 then io.stderr:write("Usage: " .. arg[0] .. " <FM radio frequency>\n") os.exit(1) end local frequency = tonumber(arg[1]) local tune_offset = -250e3 -- Blocks local source = radio.RtlSdrSource(frequency + tune_offset, 1102500) local tuner = radio.TunerBlock(tune_offset, 200e3, 5) local fm_demod = radio.FrequencyDiscriminatorBlock(1.25) local af_filter = radio.LowpassFilterBlock(128, 15e3) local af_deemphasis = radio.FMDeemphasisFilterBlock(75e-6) local af_downsampler = radio.DownsamplerBlock(5) local sink = os.getenv('DISPLAY') and radio.PulseAudioSink(1) or radio.WAVFileSink('wbfm_mono.wav', 1) -- Plotting sinks local plot1 = radio.GnuplotSpectrumSink(2048, 'Demodulated FM Spectrum', {yrange = {-120, -40}}) local plot2 = radio.GnuplotSpectrumSink(2048, 'L+R AF Spectrum', {yrange = {-120, -40}, xrange = {0, 15e3}, update_time = 0.05}) -- Connections local top = radio.CompositeBlock() top:connect(source, tuner, fm_demod, af_filter, af_deemphasis, af_downsampler, sink) if os.getenv('DISPLAY') then top:connect(fm_demod, plot1) top:connect(af_deemphasis, plot2) end top:run()
--Children folder includes includeFile("custom_content/tangible/powerup/weapon/serverobjects.lua")
-- programme pour faire un test depuis de le webide function a4() print("\n a4.lua zf190601.1304 \n") end
-- -- Raspberry Pi ARM target in Visual Studio for premake5 -- harry denholm 2020, ishani.org / github.com/ishani -- -- portions adapted from https://github.com/LORgames/premake-vslinux, Copyright (c) 2013-2015 Samuel Surtees local p = premake local raspberry = p.modules.raspberry local vstudio = p.vstudio local vc2010 = vstudio.vc2010 local project = p.project local config = p.config -- ----------------------------------------------------------------------------------- -- rewrite the globals section to have the magic Raspberry configuration VS uses function raspberry.applicationType(cfg) vc2010.element("ApplicationType", nil, "Linux") end function raspberry.applicationTypeRevision(cfg) vc2010.element("ApplicationTypeRevision", nil, "1.0") end function raspberry.targetLinuxPlatform(cfg) vc2010.element("TargetLinuxPlatform", nil, "Raspberry") end function raspberry.targetLinuxProjectType(cfg) vc2010.element("LinuxProjectType", nil, "{8748239F-558C-44D1-944B-07B09C35B330}") end function raspberry.minimumVisualStudioVersion(cfg) vc2010.element("MinimumVisualStudioVersion", nil, "15.0") end p.override(vc2010.elements, "globals", function(oldfn, cfg) local elements = oldfn(cfg) if isRaspberryPi(cfg) then elements = table.join(elements, { raspberry.applicationType, raspberry.applicationTypeRevision, raspberry.targetLinuxPlatform, raspberry.targetLinuxProjectType, raspberry.minimumVisualStudioVersion, }); end return elements end) p.override(vc2010, "keyword", function(oldfn, cfg) if isRaspberryPi(cfg) then vc2010.element("Keyword", nil, "Linux") vc2010.element("RootNamespace", nil, "%s", cfg.name) else oldfn(cfg) end end) -- ----------------------------------------------------------------------------------- p.override(vc2010, "debugInformationFormat", function(oldfn, cfg) if isRaspberryPi(cfg) then if cfg.symbols == p.OFF then vc2010.element("DebugInformationFormat", nil, "None") elseif cfg.symbols == p.ON then vc2010.element("DebugInformationFormat", nil, "FullDebug") end else oldfn(cfg) end end) -- ----------------------------------------------------------------------------------- -- disable or force entries that are not useful / valid for Raspberry Pi p.override(vc2010, "warningLevel", function(oldfn, cfg) if not isRaspberryPi(cfg) then oldfn(cfg) else vc2010.element("warningLevel", nil, "") end end) p.override(vc2010, "characterSet", function(oldfn, cfg) if not isRaspberryPi(cfg) then oldfn(cfg) end end) p.override(vc2010, "platformToolset", function(oldfn, cfg) if not isRaspberryPi(cfg) then oldfn(cfg) else vc2010.element("PlatformToolset", nil, "Remote_Clang_1_0") end end) p.override(vc2010, "localDebuggerWorkingDirectory", function(oldfn, cfg) if not isRaspberryPi(cfg) then oldfn(cfg) end end) p.override(vc2010, "subSystem", function(oldfn, cfg) if not isRaspberryPi(cfg) then return oldfn(cfg) end end) p.override(vc2010, "targetExt", function(oldfn, cfg) if not isRaspberryPi(cfg) then return oldfn(cfg) else local addToCopy = table.implode(cfg.additionalcopy, "", "", ";") .. ";$(AdditionalSourcesToCopyMapping)" vc2010.element("AdditionalSourcesToCopyMapping", nil, addToCopy) end end) p.override(vc2010, "debuggerFlavor", function(oldfn, cfg) if not isRaspberryPi(cfg) then oldfn(cfg) else p.w('<DebuggerFlavor>LinuxDebugger</DebuggerFlavor>') end end)
module("luci.controller.dnsfilter",package.seeall) function index() if not nixio.fs.access("/etc/config/dnsfilter") then return end local page = entry({"admin","services","dnsfilter"},alias("admin","services","dnsfilter","base"),_("DNS Filter"),9) page.dependent = true page.acl_depends = { "luci-app-dnsfilter" } entry({"admin","services","dnsfilter","base"},cbi("dnsfilter/base"),_("Base Setting"),10).leaf=true entry({"admin","services","dnsfilter","white"},form("dnsfilter/white"),_("White Domain List"),20).leaf=true entry({"admin","services","dnsfilter","black"},form("dnsfilter/black"),_("Block Domain List"),30).leaf=true entry({"admin","services","dnsfilter","ip"},form("dnsfilter/ip"),_("Block IP List"),40).leaf=true entry({"admin","services","dnsfilter","log"},form("dnsfilter/log"),_("Update Log"),50).leaf=true entry({"admin","services","dnsfilter","run"},call("act_status")).leaf = true entry({"admin","services","dnsfilter","refresh"},call("refresh_data")) end function act_status() local e={} e.running=luci.sys.call("[ -s /tmp/dnsmasq.dnsfilter/rules.conf ]")==0 luci.http.prepare_content("application/json") luci.http.write_json(e) end function refresh_data() local set=luci.http.formvalue("set") local icount=0 luci.sys.exec("/usr/share/dnsfilter/dnsfilter down") icount=luci.sys.exec("find /tmp/ad_tmp -type f -name rules.conf -exec cat {} \\; 2>/dev/null | wc -l") if tonumber(icount)>0 then oldcount=luci.sys.exec("find /tmp/dnsfilter -type f -name rules.conf -exec cat {} \\; 2>/dev/null | wc -l") if tonumber(icount) ~= tonumber(oldcount) then luci.sys.exec("[ -h /tmp/dnsfilter/url ] && (rm -f /etc/dnsfilter/rules/*;cp -a /tmp/ad_tmp/* /etc/dnsfilter/rules) || (rm -f /tmp/dnsfilter/*;cp -a /tmp/ad_tmp/* /tmp/dnsfilter)") luci.sys.exec("/etc/init.d/dnsfilter restart &") retstring=tostring(math.ceil(tonumber(icount))) else retstring=0 end luci.sys.call("echo `date +'%Y-%m-%d %H:%M:%S'` > /tmp/dnsfilter/dnsfilter.updated") else retstring="-1" end luci.sys.exec("rm -rf /tmp/ad_tmp") luci.http.prepare_content("application/json") luci.http.write_json({ret=retstring,retcount=icount}) end
Config = {} -- Colour for action messages (/me) Config.ActionColor = {200, 0, 255} -- Default colour for local messages Config.DefaultLocalColor = {0, 153, 204} -- Default colour for global messages Config.DefaultGlobalColor = {212, 175, 55} -- Colour for private messages received from other players Config.WhisperColor = {254, 127, 156} -- Colour for private messages sent to other players Config.WhisperEchoColor = {204, 77, 106} -- Default colour for staff messages Config.DefaultStaffColor = {255, 64, 0} -- Distance at which action messages are visible Config.ActionDistance = 50 -- Distance at which local messages are visible Config.LocalMessageDistance = 50
rednet.Open("Right") if rednet.isOpen("Right") then rednet.Host("CNC", "CNC_SVR") print("Wireless AP Is Active!") goto :NetworkHandler end :NetworkHandler senderID, msg, dist, proto = rednet.receive() print(msg) goto :NetworkHandler
-- Brine ele.helpers.register_liquid("brine", { description = "Brine", drawtype = "liquid", tiles = {"elenuclear_brine.png"}, special_tiles = {"elenuclear_brine.png", "elenuclear_brine.png"}, alpha = 240, liquid_viscosity = 7, post_effect_color = {a = 200, r = 215, g = 221, b = 187}, groups = {brine = 3, saline = 1, liquid = 3, puts_out_fire = 1, cools_lava = 1}, }) if minetest.get_modpath("bucket") ~= nil then bucket.register_liquid("elepower_thermal:brine_source", "elepower_thermal:brine_flowing", "elepower_thermal:bucket_heavy_water", "#d7ddbb", "Brine Bucket") fluid_tanks.register_tank(":elepower_dynamics:portable_tank", { description = "Portable Tank", capacity = 8000, accepts = true, tiles = { "elepower_tank_base.png", "elepower_tank_side.png", "elepower_tank_base.png^elepower_power_port.png", } }) end
local class = require("lib/middleclass") local module = {} module.DecayingObject = class('components/decayingObject') function module.DecayingObject:initialize(parameters) parameters = parameters or {} self.lifetimeTotal = parameters.lifetime or 5 self.lifetimeLeft = self.lifetimeTotal end return module
modifier_imba_ward_deniable = modifier_imba_ward_deniable or class({}) function modifier_imba_ward_deniable:IsHidden() return true end function modifier_imba_ward_deniable:IsPurgable() return false end function modifier_imba_ward_deniable:GetEffectName() return "particles/msg_fx/msg_deniable.vpcf" end function modifier_imba_ward_deniable:CheckState() return { [MODIFIER_STATE_SPECIALLY_DENIABLE] = true, } end
local gears = require("gears") local beautiful = require("beautiful") local op = beautiful.flash_focus_start_opacity or 0.6 local stp = beautiful.flash_focus_step or 0.01 local flashfocus = function(c) if c and #c.screen.clients > 1 then c.opacity = op local q = op local g = gears.timer({ timeout = stp, call_now = false, autostart = true, }) g:connect_signal("timeout", function() if not c.valid then return end if q >= 1 then c.opacity = 1 g:stop() else c.opacity = q q = q + stp end end) end -- Bring the focused client to the top if c then c:raise() end end local enable = function() client.connect_signal("focus", flashfocus) end local disable = function() client.disconnect_signal("focus", flashfocus) end return { enable = enable, disable = disable, flashfocus = flashfocus }
local ReplicatedStorage = game:GetService("ReplicatedStorage") local common = ReplicatedStorage.common local by = require(common.util.by) local compileSubmodulesToArray = require(common.util.compileSubmodulesToArray) local assets = compileSubmodulesToArray(script, true) return { all = assets, byType = by("npcType", assets), }
local Workspace = game:GetService("Workspace") --- local root = script.Parent.Parent local PluginModules = root:FindFirstChild("PluginModules") local Util = require(PluginModules:FindFirstChild("Util")) local Terrain = Workspace.Terrain --- local copy = Util.copy local terrainMaterialColorProperties = {} local terrainMaterialColorBehaviours = {} local materialEnumItems = Enum.Material:GetEnumItems() local propertyDataTemplate = { Category = "Terrain Colors", MemberType = "Property", Security = { Read = "None", Write = "None", }, Serialization = { CanLoad = false, CanSave = false, }, ValueType = { Category = "DataType", Name = "Color3" }, ThreadSafety = "ReadOnly", } for _, materialEnumItem in pairs(materialEnumItems) do local success = pcall(function() Terrain:GetMaterialColor(materialEnumItem) end) if success then local newPropertyData = copy(propertyDataTemplate) newPropertyData.Name = materialEnumItem.Name .. " Color" local newPropertyBehaviour = { Get = function(terrain) return terrain:GetMaterialColor(materialEnumItem) end, Set = function(terrain, color) terrain:SetMaterialColor(materialEnumItem, color) end, } table.insert(terrainMaterialColorProperties, newPropertyData) table.insert(terrainMaterialColorBehaviours, newPropertyBehaviour) end end return { Properties = terrainMaterialColorProperties, Behaviours = terrainMaterialColorBehaviours }
-- Old VAE stuff, ended up not being used. -- Most of the code is adapted from https://github.com/y0ast/VAE-Torch . require 'torch' require 'nn' require 'nngraph' require 'layers.GaussianCriterion' require 'layers.KLDCriterion' require 'layers.Sampler' local VAE = {} VAE.continuous = false function VAE.createVAE() local input_size = IMG_DIMENSIONS_AE[1] * IMG_DIMENSIONS_AE[2] * IMG_DIMENSIONS_AE[3] local hidden_layer_size = 1024 local latent_variable_size = 512 local encoder = VAE.get_encoder(input_size, hidden_layer_size, latent_variable_size) local decoder = VAE.get_decoder(input_size, hidden_layer_size, latent_variable_size, VAE.continuous) local input = nn.Identity()() local mean, log_var = encoder(input):split(2) local z = nn.Sampler()({mean, log_var}) local reconstruction = decoder(z) local model = nn.gModule({input},{reconstruction, mean, log_var}) local criterion_reconstruction = nn.BCECriterion() criterion_reconstruction.sizeAverage = false local criterion_latent = nn.KLDCriterion() local parameters, gradients = model:getParameters() return model, criterion_latent, criterion_reconstruction, parameters, gradients end function VAE.get_encoder(input_size, hidden_layer_size, latent_variable_size) -- The Encoder local encoder = nn.Sequential() if GPU then encoder:add(nn.Copy('torch.FloatTensor', 'torch.CudaTensor', true, true)) end encoder:add(nn.SpatialConvolution(IMG_DIMENSIONS_AE[1], 8, 5, 5, 2, 2, (5-1)/2, (5-1)/2)) encoder:add(nn.SpatialBatchNormalization(8)) encoder:add(nn.LeakyReLU(0.2, true)) encoder:add(nn.SpatialConvolution(8, 16, 5, 5, 2, 2, (5-1)/2, (5-1)/2)) encoder:add(nn.SpatialBatchNormalization(16)) encoder:add(nn.LeakyReLU(0.2, true)) encoder:add(nn.SpatialConvolution(16, 32, 5, 5, 2, 2, (5-1)/2, (5-1)/2)) encoder:add(nn.SpatialBatchNormalization(32)) encoder:add(nn.LeakyReLU(0.2, true)) encoder:add(nn.SpatialConvolution(32, 64, 5, 5, 2, 2, (5-1)/2, (5-1)/2)) encoder:add(nn.SpatialBatchNormalization(64)) encoder:add(nn.LeakyReLU(0.2, true)) --encoder:add(nn.Reshape(input_size)) local outSize = 64 * IMG_DIMENSIONS_AE[2]/2/2/2/2 * IMG_DIMENSIONS_AE[3]/2/2/2/2 encoder:add(nn.Reshape(outSize)) --encoder:add(nn.Linear(input_size, hidden_layer_size)) encoder:add(nn.Linear(outSize, hidden_layer_size)) encoder:add(nn.BatchNormalization(hidden_layer_size)) encoder:add(nn.LeakyReLU(0.2, true)) --if GPU then -- encoder:add(nn.Copy('torch.CudaTensor', 'torch.FloatTensor', true, true)) --end mean_logvar = nn.ConcatTable() if GPU then mean_logvar:add(nn.Sequential():add(nn.Linear(hidden_layer_size, latent_variable_size)):add(nn.Copy('torch.CudaTensor', 'torch.FloatTensor', true, true))) mean_logvar:add(nn.Sequential():add(nn.Linear(hidden_layer_size, latent_variable_size)):add(nn.Copy('torch.CudaTensor', 'torch.FloatTensor', true, true))) else mean_logvar:add(nn.Linear(hidden_layer_size, latent_variable_size)) mean_logvar:add(nn.Linear(hidden_layer_size, latent_variable_size)) end encoder:add(mean_logvar) if GPU then encoder:cuda() end return encoder end function VAE.get_decoder(input_size, hidden_layer_size, latent_variable_size, continuous) --local c, h, w = unpack(IMG_DIMENSIONS) -- The Decoder local decoder = nn.Sequential() if GPU then decoder:add(nn.Copy('torch.FloatTensor', 'torch.CudaTensor', true, true)) end decoder:add(nn.Linear(latent_variable_size, hidden_layer_size)) decoder:add(nn.BatchNormalization(hidden_layer_size)) decoder:add(nn.LeakyReLU(0.2, true)) if continuous then mean_logvar = nn.ConcatTable() mean_logvar:add(nn.Linear(hidden_layer_size, input_size)) mean_logvar:add(nn.Linear(hidden_layer_size, input_size)) decoder:add(mean_logvar) else decoder:add(nn.Linear(hidden_layer_size, input_size/2/2)) decoder:add(nn.Sigmoid(true)) decoder:add(nn.Reshape(IMG_DIMENSIONS_AE[1], IMG_DIMENSIONS_AE[2]/2, IMG_DIMENSIONS_AE[3]/2)) decoder:add(nn.SpatialUpSamplingNearest(2)) --[[ local c, h, w = unpack(IMG_DIMENSIONS) decoder:add(nn.Linear(latent_variable_size, 16*h/2/2*w/2/2)) decoder:add(nn.ReLU(true)) decoder:add(nn.Reshape(16, h/2/2, w/2/2)) -- 16x32 decoder:add(nn.SpatialUpSamplingNearest(2)) -- 32x64 decoder:add(nn.SpatialConvolution(16, 32, 3, 3, 1, 1, (3-1)/2, (3-1)/2)) decoder:add(nn.ReLU(true)) decoder:add(nn.SpatialUpSamplingNearest(2)) -- 64x128 decoder:add(nn.SpatialConvolution(32, 1, 3, 3, 1, 1, (3-1)/2, (3-1)/2)) decoder:add(nn.Sigmoid(true)) --]] end if GPU then decoder:add(nn.Copy('torch.CudaTensor', 'torch.FloatTensor', true, true)) decoder:cuda() end return decoder end function VAE.train(inputs, model, criterionLatent, criterionReconstruction, parameters, gradParameters, optconfig, optstate) local opfunc = function(x) assert(inputs ~= nil) assert(model ~= nil) assert(criterionLatent ~= nil) assert(criterionReconstruction ~= nil) assert(parameters ~= nil) assert(gradParameters ~= nil) assert(optconfig ~= nil) assert(optstate ~= nil) if x ~= parameters then parameters:copy(x) end model:zeroGradParameters() local reconstruction, reconstruction_var, mean, log_var if VAE.continuous then reconstruction, reconstruction_var, mean, log_var = unpack(model:forward(inputs)) reconstruction = {reconstruction, reconstruction_var} else reconstruction, mean, log_var = unpack(model:forward(inputs)) end local err = criterionReconstruction:forward(reconstruction, inputs) local df_dw = criterionReconstruction:backward(reconstruction, inputs) local KLDerr = criterionLatent:forward(mean, log_var) local dKLD_dmu, dKLD_dlog_var = unpack(criterionLatent:backward(mean, log_var)) if VAE.continuous then error_grads = {df_dw[1], df_dw[2], dKLD_dmu, dKLD_dlog_var} else error_grads = {df_dw, dKLD_dmu, dKLD_dlog_var} end model:backward(inputs, error_grads) local batchlowerbound = err + KLDerr print(string.format("[BATCH AE] lowerbound=%.8f", batchlowerbound)) util.displayBatch(inputs, 10, "Training images for AE (input)") util.displayBatch(reconstruction, 11, "Training images for AE (output)") return batchlowerbound, gradParameters end local x, batchlowerbound = optim.adam(opfunc, parameters, optconfig, optstate) return batchlowerbound end return VAE
-- 辅助打印table function print_r ( t ) local print_r_cache={} local function sub_print_r(t,indent) if (print_r_cache[tostring(t)]) then print(indent.."*"..tostring(t)) else print_r_cache[tostring(t)]=true if (type(t)=="table") then for pos,val in pairs(t) do if (type(val)=="table") then print(indent.."["..pos.."] => "..tostring(t).." {") sub_print_r(val,indent..string.rep(" ",string.len(pos)+8)) print(indent..string.rep(" ",string.len(pos)+6).."}") else print(indent.."["..pos.."] => "..tostring(val)) end end else print(indent..tostring(t)) end end end sub_print_r(t," ") end -- 扩展,修改project生成xml doc local function WriteDocumentationFileXml(_premake, _prj, value) _premake.w('<DocumentationFile>' .. string.gsub(_prj.buildtarget.relpath, "\.dll", ".xml") .. '</DocumentationFile>') end -- Write the current Premake version into our generated files, for reference premake.override(premake.vstudio.cs2005, "compilerProps", function(base, prj) base(prj) WriteDocumentationFileXml(premake, prj, XmlDocFileName) end) --- Premake5 Dev ----- solution "KEngine.Solution" configurations { "Debug", "Release" } location ("../Solution/" .. (_ACTION or "")) debugdir ("../bin") --PATCHED debugargs { } --PATCHED defines {"KENGINE_DLL"} configuration "Debug" flags { "Symbols" } defines { "_DEBUG", "DEBUG", "TRACE" } targetdir "../Build/Debug" configuration "Release" flags { "Optimize" } targetdir "../Build/Release" configuration "vs*" defines { "MS_DOTNET" } local UNITY_ENGINE_DLL = "./UnityEngine.dll"-- "C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll" local UNITY_UI_DLL = "./UnityEngine.UI.dll" --C:/Program Files (x86)/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.4/UnityEngine.UI.dll" local SharpZipLib_DLL = "../KEngine.UnityProject/Assets/KEngine.Tools/SharpZipLib/ICSharpCode.SharpZipLib.dll" local UNITY_EDITOR_DLL = "./UnityEditor.dll" --C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll" local IniDll = "../KEngine.UnityProject/Assets/KEngine.Lib/INIFileParser.dll" local TableMLDLL = "../KEngine.UnityProject/Assets/KEngine.Lib/TableML/TableML.dll" local TableMLCompilerDLL = "../KEngine.UnityProject/Assets/KEngine.Editor/Editor/TableMLCompiler/TableMLCompiler.dll" ------------------KEngine Base Library -------------------- project "KEngine.Lib" language "C#" kind "SharedLib" framework "3.5" files { "../KEngine.UnityProject/Assets/KEngine.Lib/**.cs", "../AssemblyInfo.cs", } defines { } links { "System", IniDll, TableMLDLL, } ------------------KEngine Main-------------------- project "KEngine" language "C#" kind "SharedLib" framework "3.5" files { "../KEngine.UnityProject/Assets/KEngine/**.cs", "../AssemblyInfo.cs", } defines { "UNITY_5" } links { IniDll, TableMLDLL, "KEngine.Lib", "System", UNITY_ENGINE_DLL, UNITY_UI_DLL, } ------------------KEngine UIModule-------------------- project "KEngine.UI" language "C#" kind "SharedLib" framework "3.5" files { "../KEngine.UnityProject/Assets/KEngine.UI/**.cs", "../AssemblyInfo.cs", } defines { "UNITY_5" } links { "KEngine", "KEngine.Lib", "System", UNITY_ENGINE_DLL, UNITY_UI_DLL, } ------------------KEngine UIModule Editor-------------------- project "KEngine.UI.Editor" language "C#" kind "SharedLib" framework "3.5" files { "../KEngine.UnityProject/Assets/KEngine.UI.Editor/**.cs", "../AssemblyInfo.cs", } defines { "UNITY_5" } links { "KEngine", "KEngine.Lib", "System", UNITY_ENGINE_DLL, UNITY_UI_DLL, "KEngine.UI", UNITY_EDITOR_DLL, "KEngine.Editor", } ----------------------- KEngine Editor project "KEngine.Editor" language "C#" kind "SharedLib" framework "3.5" files { "../KEngine.UnityProject/Assets/KEngine.Editor/Editor/**.cs", "../KEngine.UnityProject/Assets/KEngine.EditorTools/Editor/**.cs", "../AssemblyInfo.cs", } defines { "UNITY_5" } links { IniDll, TableMLDLL, TableMLCompilerDLL, "KEngine.Lib", "KEngine", "System", UNITY_ENGINE_DLL, -- UNITY_UI_DLL, UNITY_EDITOR_DLL, "../KEngine.UnityProject/Assets/KEngine.Editor/Editor/CosmosTable.Compiler/DotLiquid.dll", "../KEngine.UnityProject/Assets/KEngine.Editor/Editor/NPOI/NPOI.dll", "../KEngine.UnityProject/Assets/KEngine.Editor/Editor/NPOI/NPOI.OOXML.dll", "../KEngine.UnityProject/Assets/KEngine.Editor/Editor/NPOI/NPOI.OpenXml4Net.dll", "../KEngine.UnityProject/Assets/KEngine.Editor/Editor/NPOI/NPOI.OpenXmlFormats.dll", } ----------------------- KEngine Tools ---------------- project "KEngine.Tools" language "C#" kind "SharedLib" framework "3.5" files { "../KEngine.UnityProject/Assets/KEngine.Tools/**.cs", "../AssemblyInfo.cs", } defines { "UNITY_5" } links { "System", "KEngine.Lib", "KEngine", SharpZipLib_DLL, UNITY_ENGINE_DLL } ----------------------- KEngine AssetDep --[[ project "KEngine.AssetDep" language "C#" kind "SharedLib" framework "3.5" files { "../KEngine.UnityProject/Assets/KEngine.AssetDep/**.cs", "../AssemblyInfo.cs", } defines { } links { "KEngine", "System", UNITY_ENGINE_DLL, UNITY_UI_DLL, } ]]-- ----------------------- KEngine AssetDep Editor --[[ project "KEngine.AssetDep.Editor" language "C#" kind "SharedLib" framework "3.5" files { "../KEngine.UnityProject/Assets/KEngine.AssetDep.Editor/Editor/**.cs", "../AssemblyInfo.cs", } defines { } links { "KEngine.Lib", "KEngine", "KEngine.AssetDep", "KEngine.Editor", "KEngine.Tools", "System", UNITY_ENGINE_DLL, UNITY_UI_DLL, UNITY_EDITOR_DLL, } ]]-- ----------------------- KEngine Test ---------------- project "KEngine.Tests" language "C#" kind "SharedLib" framework "3.5" files { "../KEngine.UnityProject/Assets/KEngine.Tests/**.cs", "../AssemblyInfo.cs", } defines { "NUNIT", "UNITY_5", } links { "KEngine", "KEngine.AssetDep", "KEngine.Editor", "KEngine.AssetDep.Editor", "System", "KEngine.Tools", UNITY_ENGINE_DLL, UNITY_UI_DLL, UNITY_EDITOR_DLL, "packages/NUnit.3.0.0/lib/net20/nunit.framework.dll", }
board = {} tArgs = { ... } generation = 0 sleeptime = 0.5 if(tArgs[1] == "left" or tArgs[1] == "right" or tArgs[1] == "top" or tArgs[1] == "bottom" or tArgs[1] == "front" or tArgs[1] == "back")then mon = peripheral.wrap(tArgs[1]) else mon = term end if(mon.isColor() or mon.isColor)then colored = true else colored = false end w, h = mon.getSize() for x = 1, w do board[x] = {} for y = 1, h do board[x][y] = 0 end end function drawScreen() w, h = mon.getSize() for x = 1, w do for y = 1, h do nei = getNeighbours(x, y) if(board[x][y] == 1)then if colored then if(nei < 2 or nei > 3)then mon.setBackgroundColor(colors.red) else mon.setBackgroundColor(colors.green) end else mon.setBackgroundColor(colors.white) end else if colored then if(nei == 3)then mon.setBackgroundColor(colors.yellow) else mon.setBackgroundColor(colors.black) end else mon.setBackgroundColor(colors.black) end end mon.setCursorPos(x, y) mon.write(" ") end end mon.setCursorPos(1,1) if colored then mon.setTextColor(colors.blue) end mon.write(generation) end function getNeighbours(x, y) w, h = mon.getSize() total = 0 if(x > 1 and y > 1)then if(board[x-1][y-1] == 1)then total = total + 1 end end if(y > 1)then if(board[x][y-1] == 1)then total = total + 1 end end if(x < w and y > 1)then if(board[x+1][y-1] == 1)then total = total + 1 end end if(x > 1)then if(board[x-1][y] == 1)then total = total + 1 end end if(x < w)then if(board[x+1][y] == 1)then total = total + 1 end end if(x > 1 and y < h)then if(board[x-1][y+1] == 1)then total = total + 1 end end if(y < h)then if(board[x][y+1] == 1)then total = total + 1 end end if(x < w and y < h)then if(board[x+1][y+1] == 1)then total = total + 1 end end return total end function compute() w, h = mon.getSize() while true do newBoard = {} for x = 1, w do newBoard[x] = {} for y = 1, h do nei = getNeighbours(x, y) if(board[x][y] == 1)then if(nei < 2)then newBoard[x][y] = 0 elseif(nei > 3)then newBoard[x][y] = 0 else newBoard[x][y] = 1 end else if(nei == 3)then newBoard[x][y] = 1 end end end end board = newBoard generation = generation + 1 sleep(sleeptime) end end function loop() while true do event, variable, xPos, yPos = os.pullEvent() if event == "mouse_click" or event == "monitor_touch" or event == "mouse_drag" then if variable == 1 then board[xPos][yPos] = 1 else board[xPos][yPos] = 0 end end if event == "key" then if tostring(variable) == "28" then return true elseif tostring(variable) == "57" then if(mon.isColor() or mon.isColor)then colored = not colored end elseif tostring(variable) == "200" then if sleeptime > 0.1 then sleeptime = sleeptime - 0.1 end elseif tostring(variable) == "208" then if sleeptime < 1 then sleeptime = sleeptime + 0.1 end end end drawScreen() end end function intro() mon.setBackgroundColor(colors.black) mon.clear() mon.setCursorPos(1,1) mon.write("Conway's Game Of Life") mon.setCursorPos(1,2) mon.write("It is a game which represents life.") mon.setCursorPos(1,3) mon.write("The game runs by 4 basic rules:") mon.setCursorPos(1,4) mon.write("1. If a cell has less than 2 neighbours, it dies.") mon.setCursorPos(1,5) mon.write("2. If a cell has 2 or 3 neightbours, it lives.") mon.setCursorPos(1,6) mon.write("3. If a cell has more than 3 neighbours, it dies.") mon.setCursorPos(1,7) mon.write("4. If a cell has exactly 3 neighbours it is born.") mon.setCursorPos(1,9) mon.write("At the top left is the generation count.") mon.setCursorPos(1,10) mon.write("Press spacebar to switch between color modes") mon.setCursorPos(1,11) mon.write("Press enter to start the game") mon.setCursorPos(1,13) mon.write("Colors:") mon.setCursorPos(1,14) mon.write("Red - Cell will die in next generation") mon.setCursorPos(1,15) mon.write("Green - Cell will live in next generation") mon.setCursorPos(1,16) mon.write("Yellow - Cell will be born in next generation") mon.setCursorPos(1,18) mon.write("Press any key to continue!") event, variable, xPos, yPos = os.pullEvent("key") end intro() drawScreen() while true do loop() parallel.waitForAny(loop, compute) end
local sass = require "resty.sass" local styles = require "resty.sass.styles" local tonumber = tonumber local pairs = pairs local ngx = ngx local print = ngx.print local exit = ngx.exit local var = ngx.var local notfound = ngx.HTTP_NOT_FOUND local error = ngx.HTTP_INTERNAL_SERVER_ERROR local io = io local open = io.open local close = io.close local sub = string.sub local nginx = {} local function enabled(val) if val == nil then return nil end return val == true or (val == "1" or val == "true" or val == "on") end local defaults = { cache = enabled(var.sass_cache), precision = tonumber(var.sass_precision) or 5, output_style = tonumber(var.sass_output_style) or styles[var.sass_output_style] or 0, source_comments = enabled(var.sass_source_comments) or false, source_map = enabled(var.sass_source_map) or false, source_map_embed = enabled(var.sass_source_map_embed) or false, source_map_contents = enabled(var.sass_source_map_contents) or false, source_map_url = var.sass_source_map_url, omit_source_map_url = enabled(var.sass_omit_source_map_url) or false, is_indented_syntax_src = enabled(var.sass_is_indented_syntax_src) or false, include_path = var.sass_include_path, plugin_path = var.sass_plugin_path } function nginx.compile(options) local out = var.request_filename local len = #out local map = sub(out, len - 2) == "map" local inp if map then out = sub(out, 1, len - 4) inp = sub(out, 1, len - 7) .. "scss" else inp = sub(out, 1, len - 3) .. "scss" end local f = open(inp, "r") if not f then exit(notfound) end close(f) local c = options or defaults local s = sass.new() local o = s.options for k, v in pairs(defaults) do local opt = c[k] or v if opt then o[k] = opt end end if o.source_map then o.source_map_file = out .. ".map" end if o.cache then if map then local ok, c = s:compile_file(inp, out) if ok then return print(c) end else local c = s:compile_file(inp, out) if c then return print(c) end end else if map then local ok, c = s:compile_file(inp) if ok then return print(c) end else local c = s:compile_file(inp) if c then return print(c) end end end return exit(error) end return nginx
-- Dialogue for NPC "npc_ingrid" loadDialogue = function(DL) DL:createChoiceNode(0) if (DL:isQuestState("meat_delivery", "started") and DL:isQuestComplete("meat_delivery")) then DL:addChoice(10, "DL_Choice_IGotMeat") -- I got some meat for you with the best regards from Edmond. end if (DL:isQuestState("roast_meat_for_ingrid", "started") and DL:isQuestComplete("roast_meat_for_ingrid")) then DL:addChoice(20, "DL_Choice_IGotRoastedMeat") -- Here is your roasted meat. end if (not DL:isConditionFulfilled("npc_ingrid", "meat_given")) then DL:addChoice(32, "DL_Choice_ImHungry") -- I'm hungry. end if (not DL:isConditionFulfilled("npc_ingrid", "who_are_you")) then DL:addChoice(30, "DL_Choice_WhoAreYou") -- Who are you? end if (not DL:isConditionFulfilled("npc_rhendal", "talked") and not DL:isConditionFulfilled("npc_ingrid", "who_am_i")) then if (DL:isConditionFulfilled("npc_edmond", "who_am_i")) then DL:addChoice(40, "DL_Choice_WhereIsElder") -- Do you know where the village elder lives? else DL:addChoice(40, "DL_Choice_WhoCanHelp") -- I lost my memory. Do you know someone who could help me? end end DL:addChoice(-1, "DL_Choice_CU") -- See you later DL:addNode() DL:setRoot(0) DL:createNPCNode(10, 11, "DL_Ingrid_TakesRawMeat") -- How nice of you! But, I'm pretty busy at the moment. DL:changeQuestState("meat_delivery", "completed") DL:addNode() DL:createNPCNode(11, -1, "DL_Ingrid_GoRoastMeat") -- I could need your help. Take the meat, roast it over the fire and bring it back to me when you're finished. DL:changeQuestState("roast_meat_for_ingrid", "started") DL:addNode() DL:createNPCNode(20, -1, "DL_Ingrid_TakesRoastedMeat") -- Perfect, thanks a lot. Boy, you look hungry. Take this stew as a reward, it will strengthen you. DL:changeQuestState("roast_meat_for_ingrid", "completed") DL:removeItem("fo_roastedmeat", 5) DL:addItem("pe_ingridstew", 1) DL:addNode() DL:createNPCNode(30, 31, "DL_Ingrid_IAmIngrid") -- I'm Ingrid, the cook of this humble village, responsible to feed all the hungry mouths here. And what brings you here? DL:addConditionProgress("npc_ingrid", "who_are_you") DL:addNode() DL:createChoiceNode(31) if (not DL:isConditionFulfilled("npc_ingrid", "meat_given")) then DL:addChoice(32, "DL_Choice_ImHungry") -- I'm hungry. end DL:addChoice(33, "DL_Choice_ImLost") -- I'm lost. DL:addChoice(34, "DL_Choice_ImJustHavingALook") -- I'm just having a look around. if (DL:isQuestState("meat_delivery", "started") and DL:isQuestComplete("meat_delivery")) then DL:addChoice(10, "DL_Choice_IGotMeat") -- I got some meat for you with the best regards from Edmond. end if (DL:isQuestState("roast_meat_for_ingrid", "started") and DL:isQuestComplete("roast_meat_for_ingrid")) then DL:addChoice(20, "DL_Choice_IGotRoastedMeat") -- Here is your roasted meat. end DL:addNode() DL:createNPCNode(32, -2, "DL_Ingrid_GivesMeat") -- Oh, you poor, poor boy. Here, take this piece of meat, this should help for now. DL:addItem("fo_roastedmeat", 1) DL:addConditionProgress("npc_ingrid", "meat_given") DL:addNode() DL:createNPCNode(33, -2, "DL_Ingrid_Location") -- You're lost? You're in the middle of the meadows, in the lands of Admantris. Why don't you just take a look on your map you got there? DL:addHint("Map") DL:addNode() DL:createNPCNode(34, -2, "DL_Ingrid_DontTrouble") -- Don't make trouble. DL:addNode() DL:createNPCNode(40, -2, "DL_Ingrid_ElderLocation") -- Ah, you're looking for our village elder. A very wise man who always has an open ear for our problems. He lives in the wooden house in the middle of the village. DL:addConditionProgress("npc_ingrid", "who_am_i") DL:addNode() end
---- -- Test cases for xlsxwriter.lua. -- -- Simple test case to test data writing. -- -- Copyright 2014-2015, John McNamara, jmcnamara@cpan.org -- local Workbook = require "xlsxwriter.workbook" local workbook = Workbook:new("test_simple05.xlsx") local worksheet = workbook:add_worksheet() local format1 = workbook:add_format({bold = 1}) local format2 = workbook:add_format({italic = 1}) local format3 = workbook:add_format({bold = 1, italic = 1}) local format4 = workbook:add_format({underline = 1}) local format5 = workbook:add_format({font_strikeout = 1}) local format6 = workbook:add_format({font_script = 1}) local format7 = workbook:add_format({font_script = 2}) worksheet:set_row(5, 18) worksheet:set_row(6, 18) worksheet:write_string(0, 0, 'Foo', format1) worksheet:write_string(1, 0, 'Foo', format2) worksheet:write_string(2, 0, 'Foo', format3) worksheet:write_string(3, 0, 'Foo', format4) worksheet:write_string(4, 0, 'Foo', format5) worksheet:write_string(5, 0, 'Foo', format6) worksheet:write_string(6, 0, 'Foo', format7) workbook:close()
--[[ Minetest Mod Storage Drawers - A Mod adding storage drawers Copyright (C) 2017-2020 Linus Jahn <lnj@kaidan.im> Copyright (C) 2018 isaiah658 MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]]-- --[[ The gist of how the drawers mod stores data is that there are entities and the drawer node itself. The entities are needed to allow having multiple drawers in one node. The entities and node each store metadata about the item counts and such. It is necessary to change both at once otherwise in some cases the entity values are used and in other cases the node metadata is used. The gist of how the controller works is this. The drawer controller scans the adjacent tiles and puts the item names and other info such as coordinates and the visualid of the entity in a table. That table is saved in the controllers metadata. The table is used to help prevent needing to scan all the drawers to deposit an item in certain situations. The table is only updated on an as needed basis, not by a specific time/interval. Controllers that have no items will not continue scanning drawers. ]]-- -- Load support for intllib. local MP = core.get_modpath(core.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") local default_loaded = core.get_modpath("default") and default local mcl_loaded = core.get_modpath("mcl_core") and mcl_core local digilines_loaded = core.get_modpath("digilines") and digilines local function controller_formspec(pos) local formspec = "size[8,8.5]".. drawers.gui_bg.. drawers.gui_bg_img.. drawers.gui_slots.. "label[0,0;" .. S("Drawer Controller") .. "]" .. "list[current_name;src;3.5,1.75;1,1;]".. "list[current_player;main;0,4.25;8,1;]".. "list[current_player;main;0,5.5;8,3;8]".. "listring[current_player;main]".. "listring[current_name;src]".. "listring[current_player;main]" if digilines_loaded and pipeworks_loaded then formspec = formspec .. "field[1,3.5;4,1;digilineChannel;" .. S("Digiline Channel") .. ";${digilineChannel}]" formspec = formspec .. "button_exit[5,3.2;2,1;saveChannel;" .. S("Save") .. "]" end return formspec end local function is_valid_drawer_index_slot(net_index, item_name) return net_index and net_index[item_name] and net_index[item_name].drawer_pos and net_index[item_name].drawer_pos.x and net_index[item_name].drawer_pos.y and net_index[item_name].drawer_pos.z and net_index[item_name].visualid end local function controller_index_slot(pos, visualid) return { drawer_pos = pos, visualid = visualid } end local function compare_pos(pos1, pos2) return pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z end local function contains_pos(list, p) for _,v in ipairs(list) do if compare_pos(v, p) then return true end end return false end -- iterator for iterating from 1 -> to local function range(to) local i = 0 return function() if i == to then return nil end i = i + 1 return i, i end end local function pos_in_range(pos1, pos2) local diff = { pos1.x - pos2.x, pos1.y - pos2.y, pos1.z - pos2.z } for _,v in ipairs(diff) do if v < 0 then v = v * -1 end if v > drawers.CONTROLLER_RANGE then return false end end return true end local function add_drawer_to_inventory(controllerInventory, pos) -- the number of slots is saved as drawer group local slots = core.get_item_group(core.get_node(pos).name, "drawer") if not slots then return end local meta = core.get_meta(pos) if not meta then return end local i = 1 while i <= slots do -- nothing is appended in case the drawer has only one slot local slot_id = "" if slots ~= 1 then slot_id = tostring(i) end local item_id = meta:get_string("name" .. slot_id) local drawer_meta_entity_infotext = meta:get_string("entity_infotext" .. slot_id) if item_id == "" and not controllerInventory["empty"] then controllerInventory["empty"] = controller_index_slot(pos, slot_id) elseif item_id ~= "" then -- If we already indexed this item previously, check which drawer -- has the most space and have that one be the one indexed if controllerInventory[item_id] then local content = drawers.drawer_get_content(controllerInventory[item_id].drawer_pos, controllerInventory[item_id].visualid) local new_content = drawers.drawer_get_content(pos, slot_id) -- If the already indexed drawer has less space, we override the -- table index for that item with the new drawer if (new_content.maxCount - new_content.count) > (content.maxCount - content.count) then controllerInventory[item_id] = controller_index_slot(pos, slot_id) end else controllerInventory[item_id] = controller_index_slot(pos, slot_id) end end i = i + 1 end end local function find_connected_drawers(controller_pos, pos, foundPositions) foundPositions = foundPositions or {} pos = pos or controller_pos local newPositions = core.find_nodes_in_area( {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1}, {"group:drawer", "group:drawer_connector"} ) for _,p in ipairs(newPositions) do -- check that this node hasn't been scanned yet if not compare_pos(pos, p) and not contains_pos(foundPositions, p) and pos_in_range(controller_pos, pos) then -- add new position table.insert(foundPositions, p) -- search for other drawers from the new pos find_connected_drawers(controller_pos, p, foundPositions) end end return foundPositions end local function index_drawers(pos) --[[ The pos parameter is the controllers position We store the item name as a string key and the value is a table with position x, position y, position z, and visualid. Those are all strings as well with the values assigned to them that way we don't need to worry about the ordering of the table. The count and max count are not stored as those values have a high potential of being outdated quickly. It's better to grab the values from the drawer when needed so you know you are working with accurate numbers. ]] local controllerInventory = {} for _,drawerPos in ipairs(find_connected_drawers(pos)) do add_drawer_to_inventory(controllerInventory, drawerPos) end return controllerInventory end --[[ Returns a table of all stored itemstrings in the drawer network with their drawer position and visualid. It uses the cached data, if possible, but if the itemstring is not contained the network is reindexed. ]] local function controller_get_drawer_index(pos, itemstring) local meta = core.get_meta(pos) -- If the index has not been created, the item isn't in the index, the -- item in the drawer is no longer the same item in the index, or the item -- is in the index but it's full, run the index_drawers function. local drawer_net_index = core.deserialize(meta:get_string("drawers_table_index")) -- If the index has not been created -- If the item isn't in the index (or the index is corrupted) if not is_valid_drawer_index_slot(drawer_net_index, itemstring) then drawer_net_index = index_drawers(pos) meta:set_string("drawers_table_index", core.serialize(drawer_net_index)) -- There is a valid entry in the index: check that the entry is still up-to-date else local content = drawers.drawer_get_content( drawer_net_index[itemstring].drawer_pos, drawer_net_index[itemstring].visualid) if content.name ~= itemstring or content.count >= content.maxCount then drawer_net_index = index_drawers(pos) meta:set_string("drawers_table_index", core.serialize(drawer_net_index)) end end return drawer_net_index end local function controller_insert_to_drawers(pos, stack) -- Inizialize metadata local meta = core.get_meta(pos) local inv = meta:get_inventory() local drawer_net_index = controller_get_drawer_index(pos, stack:get_name()) -- We check if there is a drawer with the item and it isn't full. We will -- put the items we can into it. if drawer_net_index[stack:get_name()] then local drawer_pos = drawer_net_index[stack:get_name()]["drawer_pos"] local visualid = drawer_net_index[stack:get_name()]["visualid"] local content = drawers.drawer_get_content(drawer_pos, visualid) -- If the the item in the drawer is the same as the one we are trying to -- store, the drawer is not full, and the drawer entity is loaded, we -- will put the items in the drawer if content.name == stack:get_name() and content.count < content.maxCount and drawers.drawer_visuals[core.hash_node_position(drawer_pos)] then return drawers.drawer_insert_object(drawer_pos, stack, visualid) end end if drawer_net_index["empty"] then local drawer_pos = drawer_net_index["empty"]["drawer_pos"] local visualid = drawer_net_index["empty"]["visualid"] local content = drawers.drawer_get_content(drawer_pos, visualid) -- If the drawer is still empty and the drawer entity is loaded, we will -- put the items in the drawer if content.name == "" and drawers.drawer_visuals[core.hash_node_position(drawer_pos)] then drawers.drawer_insert_object(drawer_pos, stack, visualid) -- Add the item to the drawers table index and set the empty one to nil drawer_net_index["empty"] = nil drawer_net_index[stack:get_name()] = controller_index_slot(drawer_pos, visualid) -- Set the controller metadata meta:set_string("drawers_table_index", core.serialize(drawer_net_index)) end end return stack end local function controller_can_dig(pos, player) local meta = core.get_meta(pos); local inv = meta:get_inventory() return inv:is_empty("src") end local function controller_on_construct(pos) local meta = core.get_meta(pos) meta:set_string("drawers_table_index", "") meta:set_string("formspec", controller_formspec(pos)) meta:get_inventory():set_size("src", 1) end local function controller_on_blast(pos) local drops = {} default.get_inventory_drops(pos, "src", drops) drops[#drops+1] = "drawers:controller" core.remove_node(pos) return drops end local function controller_allow_metadata_inventory_put(pos, listname, index, stack, player) if (player and core.is_protected(pos, player:get_player_name())) or listname ~= "src" then return 0 end local drawer_net_index = controller_get_drawer_index(pos, stack:get_name()) if drawer_net_index[stack:get_name()] then local drawer = drawer_net_index[stack:get_name()] local meta = core.get_meta(pos) if drawers.drawer_get_content(drawer.drawer_pos, drawer.visualid).name == stack:get_name() then num_allowed = drawers.drawer_can_insert_stack(drawer.drawer_pos, stack, drawer["visualid"]) if num_allowed > 0 then return num_allowed end end end if drawer_net_index["empty"] then local drawer = drawer_net_index["empty"] if drawers.drawer_get_content(drawer.drawer_pos, drawer.visualid).name == "" then return drawers.drawer_can_insert_stack(drawer.drawer_pos, stack, drawer.visualid) end end return 0 end local function controller_allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player) local meta = core.get_meta(pos) local inv = meta:get_inventory() local stack = inv:get_stack(from_list, from_index) return controller_allow_metadata_inventory_put(pos, to_list, to_index, stack, player) end local function controller_allow_metadata_inventory_take(pos, listname, index, stack, player) if core.is_protected(pos, player:get_player_name()) then return 0 end return stack:get_count() end local function controller_on_metadata_inventory_put(pos, listname, index, stack, player) if listname ~= "src" then return end local inv = core.get_meta(pos):get_inventory() local complete_stack = inv:get_stack("src", 1) local leftover = controller_insert_to_drawers(pos, complete_stack) inv:set_stack("src", 1, leftover) end local function controller_on_digiline_receive(pos, _, channel, msg) local meta = core.get_meta(pos) if channel ~= meta:get_string("digilineChannel") then return end local item = ItemStack(msg) local drawers_index = controller_get_drawer_index(pos, item:get_name()) if not drawers_index[item:get_name()] then -- we can't do anything: the requested item doesn't exist return end local taken_stack = drawers.drawer_take_item( drawers_index[item:get_name()]["drawer_pos"], item) local dir = core.facedir_to_dir(core.get_node(pos).param2) -- prevent crash if taken_stack ended up with a nil value if taken_stack then pipeworks.tube_inject_item(pos, pos, dir, taken_stack:to_string()) end end local function controller_on_receive_fields(pos, formname, fields, sender) if core.is_protected(pos, sender:get_player_name()) then return end local meta = core.get_meta(pos) if fields.saveChannel then meta:set_string("digilineChannel", fields.digilineChannel) end end -- Registers the drawer controller local function register_controller() -- Set the controller definition using a table to allow for pipeworks and -- potentially other mod support local def = {} def.description = S("Drawer Controller") def.drawtype = "nodebox" def.node_box = { type = "fixed", fixed = drawers.node_box_simple } def.collision_box = { type = "regular" } def.selection_box = { type = "regular" } def.paramtype = "light" def.paramtype2 = "facedir" def.legacy_facedir_simple = true -- add pipe connectors, if pipeworks is enabled if pipeworks_loaded then def.tiles = { "drawers_controller_top.png^pipeworks_tube_connection_metallic.png", "drawers_controller_top.png^pipeworks_tube_connection_metallic.png", "drawers_controller_side.png^pipeworks_tube_connection_metallic.png", "drawers_controller_side.png^pipeworks_tube_connection_metallic.png", "drawers_controller_top.png^pipeworks_tube_connection_metallic.png", "drawers_controller_front.png" } else def.tiles = { "drawers_controller_top.png", "drawers_controller_top.png", "drawers_controller_side.png", "drawers_controller_side.png", "drawers_controller_top.png", "drawers_controller_front.png" } end -- MCL2 requires a few different groups and parameters that MTG does not if mcl_loaded then def.groups = { pickaxey = 1, stone = 1, building_block = 1, material_stone = 1 } def._mcl_blast_resistance = 30 def._mcl_hardness = 1.5 else def.groups = { cracky = 3, level = 2 } end def.can_dig = controller_can_dig def.on_construct = controller_on_construct def.on_blast = controller_on_blast def.on_receive_fields = controller_on_receive_fields def.on_metadata_inventory_put = controller_on_metadata_inventory_put def.allow_metadata_inventory_put = controller_allow_metadata_inventory_put def.allow_metadata_inventory_move = controller_allow_metadata_inventory_move def.allow_metadata_inventory_take = controller_allow_metadata_inventory_take if pipeworks_loaded then def.groups.tubedevice = 1 def.groups.tubedevice_receiver = 1 def.tube = {} def.tube.insert_object = function(pos, node, stack, tubedir) return controller_insert_to_drawers(pos, stack) end def.tube.can_insert = function(pos, node, stack, tubedir) return controller_allow_metadata_inventory_put(pos, "src", nil, stack, nil) end def.tube.connect_sides = { left = 1, right = 1, back = 1, top = 1, bottom = 1 } def.after_place_node = pipeworks.after_place def.after_dig_node = pipeworks.after_dig end if tubelib_loaded then tubelib.register_node("drawers:controller", {}, { on_push_item = controller_tl_on_push, on_unpull_item = controller_tl_on_push, on_pull_item = function(pos, side, player_name) return controller_tl_on_pull(pos, player_name, false) end, on_pull_stack = function(pos, side, player_name) return controller_tl_on_pull(pos, player_name, true) end }) def.after_place_node = function(pos, placer) tubelib.add_node(pos, "drawers:controller") end def.after_dig_node = tubelib.remove_node end if digilines_loaded and pipeworks_loaded then def.digiline = { receptor = {}, effector = { action = controller_on_digiline_receive }, } end core.register_node("drawers:controller", def) end function controller_tl_on_pull(pos, player_name, full_stack) if not controller_allow_metadata_inventory_take then return nil end local meta = core.get_meta(pos) local drawer_list = index_drawers(pos) meta:set_string("drawers_table_index", core.serialize(drawer_list)) -- lets grab a random drawer/slot so that a pusher doesn't get stuck on one full slot local tlen = 0 for _,_ in pairs(drawer_list) do tlen = tlen + 1 end if drawer_list["empty"] then tlen = tlen - 1 end math.randomseed(os.time()) local loop = math.random(1, tlen) for item,_ in pairs(drawer_list) do if item ~= "empty" then loop = loop - 1 if loop == 0 then local stack = ItemStack(item) if full_stack then stack:set_count(stack:get_stack_max()) end local drawer_pos = drawer_list[item]["drawer_pos"] local taken_stack = drawers.drawer_take_item(drawer_pos, stack) if taken_stack then return taken_stack end break end end end return nil end function controller_tl_on_push(pos, side, item, player_name) if core.is_protected(pos,player_name) then core.record_protection_violation(pos,player_name) return false end controller_insert_to_drawers(pos, item) return (item:get_count() == 0) end -- register drawer controller register_controller() if default_loaded then core.register_craft({ output = 'drawers:controller', recipe = { {'default:steel_ingot', 'default:diamond', 'default:steel_ingot'}, {'default:tin_ingot', 'group:drawer', 'default:copper_ingot'}, {'default:steel_ingot', 'default:diamond', 'default:steel_ingot'}, } }) elseif mcl_loaded then core.register_craft({ output = 'drawers:controller', recipe = { {'mcl_core:iron_ingot', 'mcl_core:diamond', 'mcl_core:iron_ingot'}, {'mcl_core:gold_ingot', 'group:drawer', 'mcl_core:gold_ingot'}, {'mcl_core:iron_ingot', 'mcl_core:diamond', 'mcl_core:iron_ingot'}, } }) else -- Because the rest of the drawers mod doesn't have a hard depend on -- default, I changed the recipe to have an alternative core.register_craft({ output = 'drawers:controller', recipe = { {'group:stone', 'group:stone', 'group:stone'}, {'group:stone', 'group:drawer', 'group:stone'}, {'group:stone', 'group:stone', 'group:stone'}, } }) end
local player local prev_positions = {} local TRAIL_LEN = 20 function start(this_id) id = this_id local x = 10 + rand(get_battle_width()-20) local y = 10 + rand(get_battle_height()-20) set_entity_position(id, x, y) set_battle_entity_flying(id, true) local right = rand(2) if (right == 1) then set_entity_right(id, true) else set_entity_right(id, false) end set_hp(id, 10) set_battle_entity_attack(id, 1) set_enemy_aggressiveness(id, LOGIC_RATE * 20) player = ai_get(id, "A_PLAYER") for i=1,TRAIL_LEN do prev_positions[i] = { x, y } end set_battle_entity_speed_multiplier(id, 0.5) end function get_attack_sound() return "" end local turn_attack_off = false local attack_off_count = 0 local laughing = false function dist() local x, y = get_entity_position(id) local px, py = get_entity_position(player) local dx = x - px local dy = y - py local dist = math.sqrt(dx*dx + dy*dy) return dist end function decide() if (get_hp(player) <= 0) then player = ai_get(id, "A_PLAYER") return "rest 0.01 nostop" end if (dist() < 5) then local w = get_battle_width() local x = get_entity_position(id) local m = math.fmod(get_time(), 2) if ((x < 100 or x > (w-100)) and m < 1) then if (not laughing) then laughing = true set_entity_animation(id, "laugh") end else if (laughing) then laughing = false set_entity_animation(id, "battle-idle") end set_battle_entity_attacking(id, true) turn_attack_off = true end return "rest 0.01 nostop" else if (laughing) then laughing = false set_entity_animation(id, "battle-idle") end local x, y = get_entity_position(player) local xx, yy = get_entity_position(id) local dx = x - xx local dy = y - yy local a = math.atan2(dy, dx) local dest_x = xx + math.cos(a) * 10 local dest_y = yy + math.sin(a) * 10 return "direct_move " .. dest_x .. " " .. dest_y .. " nostop" end end function get_should_auto_attack() return false end function die() if (rand(5) == 0) then local coin = add_battle_enemy("coin1") local x, y = get_entity_position(id) set_entity_position(coin, x, y-5) elseif (rand(3) == 0) then local coin = add_battle_enemy("coin0") local x, y = get_entity_position(id) set_entity_position(coin, x, y-5) end end function stop() end function logic() local x, y = get_entity_position(id) for i=TRAIL_LEN,2,-1 do prev_positions[i] = prev_positions[i-1] end prev_positions[1] = { x, y } if (turn_attack_off) then attack_off_count = attack_off_count + 1 if (attack_off_count >= 2) then turn_attack_off = false attack_off_count = 0 set_battle_entity_attacking(id, false) end end end function pre_draw() local top_x, top_y = get_battle_top() local bmp = get_entity_bitmap(id) local w, h = get_bitmap_size(bmp) local flags if (get_entity_right(id)) then flags = 0 else flags = ALLEGRO_FLIP_HORIZONTAL end for i=TRAIL_LEN,1,-1 do draw_tinted_rotated_bitmap( bmp, (TRAIL_LEN-i)/TRAIL_LEN, (TRAIL_LEN-i)/TRAIL_LEN, (TRAIL_LEN-i)/TRAIL_LEN, (TRAIL_LEN-i)/TRAIL_LEN, w/2, h/2, prev_positions[i][1]-top_x, prev_positions[i][2]-h/2-top_y+BOTTOM_SPRITE_PADDING, 0, flags ) end end
--[[ Breed either cows or sheep. Must be run on a mob with the same height. ]] local Array = require('opus.array') local Config = require('opus.config') local neural = require('neural.interface') local Sound = require('opus.sound') local Map = require('opus.map') local os = _G.os local config = Config.load('mobRancher', { animal = 'Cow', maxAdults = 12, }) local WALK_SPEED = 1.5 neural.assertModules({ 'plethora:sensor', 'plethora:scanner', 'plethora:laser', 'plethora:kinetic', 'plethora:introspection', }) local fed = { } local function resupply() local slot = neural.getEquipment().list()[1] if slot and slot.count > 32 then return end print('resupplying') for _ = 1, 2 do local dispenser = Map.find(neural.scan(), 'name', 'minecraft:dispenser') if not dispenser then print('dispenser not found') break end if math.abs(dispenser.x) <= 1 and math.abs(dispenser.z) <= 1 then neural.lookAt(dispenser) for _ = 1, 8 do neural.use(0, 'off') os.sleep(.2) neural.getEquipment().suck(1, 64) end break else neural.walkTo({ x = dispenser.x, y = 0, z = dispenser.z }, WALK_SPEED) end end end local function breed(entity) print('breeding') entity.lastFed = os.clock() fed[entity.id] = entity neural.walkTo(entity, WALK_SPEED, 1) entity = neural.getMetaByID(entity.id) if entity then neural.lookAt(entity) neural.use(1) os.sleep(.1) end end local function kill(entity) print('killing') neural.walkTo(entity, WALK_SPEED, 2.5) entity = neural.getMetaByID(entity.id) if entity then neural.lookAt(entity) neural.fireAt({ x = entity.x, y = 0, z = entity.z }) Sound.play('entity.firework.launch') os.sleep(.2) end end local function getEntities() local sheep = Array.filter(neural.sense(), function(entity) if entity.name == 'Sheep' and entity.y > -.5 then return true end end) if #sheep > config.maxAdults then return sheep end return Map.filter(neural.sense(), function(entity) if entity.name == config.animal and entity.y > -.5 then return true end end) end local function getHungry(entities) for _,v in pairs(entities) do if not fed[v.id] or os.clock() - fed[v.id].lastFed > 60 then return v end end end local function randomEntity(entities) local r = math.random(1, Map.size(entities)) local i = 1 for _, v in pairs(entities) do i = i + 1 if i > r then return v end end end while true do resupply() local entities = getEntities() if Map.size(entities) > config.maxAdults then kill(randomEntity(entities)) else local entity = getHungry(entities) if entity then breed(entity) else os.sleep(5) end end end
createObject(966,617.08233642578,-1509.9791259766,13.887590408325,0,0,270) createObject(3550,610.09759521484,-1493.7347412109,14.039214134216,0,180,0) createObject(967,615.99676513672,-1511.2054443359,13.873171806335) createObject(3475,616.22961425781,-1514.8422851563,13.391963005066,0,0,180) createObject(3475,613.46704101563,-1496.8249511719,13.335960388184,0,0,270) createObject(3475,610.26287841797,-1493.5834960938,13.335960388184,0,0,179.99450683594) createObject(3475,610.26214599609,-1487.6069335938,13.335960388184,0,0,179.99450683594) createObject(3475,616.23724365234,-1520.8256835938,13.391963005066,0,0,179.99450683594) createObject(3475,616.2294921875,-1499.7076416016,13.391963005066,0,0,179.99450683594) createObject(3475,580.58227539063,-1488.6381835938,13.335960388184,0,0,270) createObject(3475,586.06817626953,-1523.7708740234,13.335960388184,0,0,90) createObject(3550,610.0966796875,-1487.7429199219,14.039214134216,0,179.99450683594,0) createObject(3550,616.06683349609,-1499.7663574219,14.039214134216,0,179.99450683594,0) createObject(3550,616.06640625,-1515.0694580078,14.039214134216,0,179.99450683594,0) createObject(3550,616.06640625,-1520.8837890625,14.039214134216,0,179.99450683594,0) createObject(3550,613.61810302734,-1497.0014648438,14.039214134216,0,179.99450683594,90) createObject(3550,580.9833984375,-1488.7824707031,14.039214134216,0,179.99450683594,90) createObject(3550,585.93115234375,-1524.412109375,14.039214134216,0,179.99450683594,90) createObject(1215,617.11804199219,-1512.2396240234,14.528000831604) createObject(1215,617.1171875,-1502.6828613281,14.528000831604) createObject(2949,585.73889160156,-1488.775390625,14.405815124512,0,0,89.730041503906) createObject(1536,606.21960449219,-1460.0242919922,13.327764511108,0,0,89.730041503906) createObject(1536,606.1953125,-1457.0073242188,13.327764511108,0,0,270.26550292969) createObject(7091,612.00762939453,-1471.1375732422,23.179527282715) createObject(7091,612.0068359375,-1446.5072021484,23.179527282715)