content
stringlengths 5
1.05M
|
|---|
-- Copyright (c) 2021 Trevor Redfern
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
describe("game.rules.fog_of_war.selectors", function()
local Selectors = require "game.rules.fog_of_war.selectors"
local Position = require "game.rules.world.position"
describe("SELECTOR: get", function()
it("retrieves the perspectives fog of war for a position", function()
local perspective, pos = {}, Position(1, 3, 2)
local state = {
fogOfWar = {
[perspective] = {
[pos.hashKey] = {
a = 1, b = 2, c = 3
}
}
}
}
local fow = Selectors.get(state, perspective, pos)
assert.equals(1, fow.a)
assert.equals(2, fow.b)
assert.equals(3, fow.c)
end)
it("return nil if position does not exist", function()
local perspective = {}
local state = {
fogOfWar = {
[perspective] = {}
}
}
assert.is_nil(Selectors.get(state, perspective, Position(1,1,1)))
end)
it("returns nil if perspective does not exist", function()
local state = {
fogOfWar = {}
}
assert.is_nil(Selectors.get(state, {}, Position(1,2,1)))
end)
end)
end)
|
object_tangible_furniture_all_frn_all_trophy_mutant_acklay = object_tangible_furniture_all_shared_frn_all_trophy_mutant_acklay:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_all_frn_all_trophy_mutant_acklay, "object/tangible/furniture/all/frn_all_trophy_mutant_acklay.iff")
|
---@meta
resty_core_exit={}
resty_core_exit.version="0.1.17"
return resty_core_exit
|
--[[ LootSecretary by Annasia
Core.lua Contains core elements of the addon
-----------
TODO/Notes
The whole addon
https://etherpad.openstack.org/p/PL_council
]]
local LootSecretary = LibStub("AceAddon-3.0"):NewAddon("LootSecretary", "AceConsole-3.0", "AceEvent-3.0")
local libwin = LibStub("LibWindow-1.1")
local mFrame = CreateFrame("Frame")
LootSecretary:Print("Hello, world!")
function LootSecretary:OnInitialize()
LootSecretary:Print("Welcome to OnInit")
-- create the table to hold loot listings
end
function LootSecretary:OnEnable()
LootSecretary:Print("Welcome to OnEnable")
end
function LootSecretary:OnDisable()
LootSecretary:Print("Welcome to OnDisable")
end
LootSecretary:RegisterChatCommand("lsc", "LSConfig")
function LootSecretary:LSConfig(input)
LootSecretary:Print("This is the config")
end
function LootSecretary:CHAT_MSG_LOOT(message, sender, ...)
LootSecretary:Print(sender)
end
LootSecretary:RegisterEvent("CHAT_MSG_LOOT")
|
local beer = require('beer-song')
describe('beer-song', function()
it('prints an arbitrary verse', function()
local expected = '8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n'
local result = beer.verse(8)
assert.are.equal(expected, result)
end)
it('handles 1 bottle', function()
local expected = '1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n'
local result = beer.verse(1)
assert.are.equal(expected, result)
end)
it('handles 0 bottles', function()
local expected = 'No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n'
local result = beer.verse(0)
assert.are.equal(expected, result)
end)
it('sings several verses', function()
local expected = '8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n'
local result = beer.sing(8, 6)
assert.are.equal(expected, result)
end)
it('sings the rest of the verses', function()
local expected = '3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n'
local result = beer.sing(3)
assert.are.equal(expected, result)
end)
end)
|
--------------------------------------------------------------------------
-- GTFO_FF_WOD.lua
--------------------------------------------------------------------------
--[[
GTFO Friendly Fire List - Warlords of Draenor
Author: Zensunim of Malygos
]]--
-- *********************
-- * Blackrock Foundry *
-- *********************
GTFO.FFSpellID["155484"] = {
--desc = "Blazing Radiance (Flamebender Ka'graz)";
sound = 1;
tankSound = 0;
ignoreSelfInflicted = true;
};
GTFO.FFSpellID["155718"] = {
--desc = "Conflagration (Beastlord Darmac)";
sound = 1;
tankSound = 0;
ignoreSelfInflicted = true;
};
GTFO.FFSpellID["175585"] = {
--desc = "Living Blaze (Forgemistress Flamehand)";
sound = 1;
ignoreSelfInflicted = true;
};
-- ***********
-- * Draenor *
-- ***********
GTFO.FFSpellID["187671"] = {
--desc = "Mark of Kazzak (Supreme Lord Kazzak)";
sound = 1;
ignoreSelfInflicted = true;
};
GTFO.SpellID["187632"] = {
--desc = "Explosive Doom (Supreme Lord Kazzak)";
sound = 3;
ignoreSelfInflicted = true;
};
|
local skynet = require "skynet"
require "skynet.manager"
local logger = require "logger"
local Match = {}
local match_queue = {}
--local class = require "class"
--local CRoom = class() --房间信息
local DOUNIU = {}
local MAX_PLAYER = 5
local max_room_idx = 1000
local room_queue = {} --待机房
local running_room_queue = {} --比赛中的房间
local function make_room_info(room)
if room == nil then
return nil
end
local players = {}
for uid,player in pairs(room.player_lst) do
table.insert(players,
{
icon = player.icon,
money = player.money,
name = player.nick_name,
odds = 0,
is_leader = false,
uid = player.uid,
}
)
end
print("update_room_info room_id:"..room.room_id)
return
{
room_id = room.room_id,
room_odds = room.room_odds,
status = room.status,
players = players,
}
end
local function get_table_nums(tb)
local num = 0
for k,v in pairs(tb) do
num = num + 1
end
return num
end
function DOUNIU:create_room(odds, player)
local room_info = {
room_odds = odds, --房间基本码
player_lst = {player}, --1
room_id = max_room_idx,
status = 0, --0待机,1比赛中
room_begin_ts = os.time()
}
max_room_idx = max_room_idx + 1
room_queue[room_info.room_id] = room_info
end
function DOUNIU:enter_room(player)
local v_room = nil
for k,v in pairs(room_queue) do
print("room "..k.." player size "..get_table_nums(v.player_lst))
if v.status == 0 and get_table_nums(v.player_lst) < MAX_PLAYER then
v_room = v
break
end
end
if v_room == nil then
local room_info = {
room_odds = 25, --房间基本码
player_lst = {}, --1
room_id = max_room_idx,
status = 0, --0待机,1比赛中
room_begin_ts = os.time()
}
max_room_idx = max_room_idx + 1
--table.insert(room_queue, room_info)
room_queue[room_info.room_id] = room_info
v_room = room_info
end
if v_room ~= nil then
print_t(player)
v_room.player_lst[player.uid] = player
--table.insert(v_room.player_lst, tonumber(player.uid), player)
else
assert(false, 'enter room fail ')
return nil
end
for uid, room_player in pairs(v_room.player_lst) do
print("update room info")
--if uid ~= player.uid then
--skynet.call(room_player.agent, "lua", "update_room_info", v_room)
--end
skynet.call(room_player.agent, "lua",
"send_pack_cli", "update_room_info",
make_room_info(v_room))
end
print("enterRoom success uid:", player.uid, " room_id:", v_room.room_id)
--local fightsvr_inst = skynet.newservice("fight")
--skynet.call(fightsvr_inst, "lua", "start", player)
--skynet.call(player.agent, "game", "onFightStart", fightsvr_inst)
return v_room
end
function DOUNIU:leave_room(room_id, uid)
print("remove room begin "..room_id.." player id "..uid)
for k,v in pairs(room_queue) do
if v.room_id == room_id then
v.player_lst[uid] = nil
skynet.call(v.fight_ins, "lua", "onKickOut", uid)
for uid, room_player in pairs(v.player_lst) do
print("update room info")
--if uid ~= player.uid then
--skynet.call(room_player.agent, "lua", "update_room_info", v_room)
--end
skynet.call(room_player.agent, "lua",
"send_pack_cli", "update_room_info",
make_room_info(v))
end
return 0
end
end
print("remove fail room_id "..room_id.." player id "..uid)
return -1
end
function DOUNIU:startGame(v_room)
if v_room.status ~= 1 then
print("start game, room_id: ", v_room.room_id)
if v_room.fight_ins == nil then
local fight_ins = skynet.newservice "douniu_fight"
v_room.fight_ins = fight_ins
end
for uid, p in pairs(v_room.player_lst) do
skynet.call(p.agent, "lua", "set_fight", v_room.fight_ins)
end
skynet.call(v_room.fight_ins, "lua", "onStart", v_room )
v_room.status = 1
--local fightsvr_inst = skynet.newservice("douniu_fight")
--for player in ipairs(v_room.player) do
-- skynet.call(player.agent, "game", "onFightStart", fightsvr_inst)
--end
end
--local fightsvr_inst = skynet.newservice("fight")
--skynet.call(fightsvr_inst, "lua", "start", player_1, player_2)
--skynet.call(player_1.agent, "game", "onFightStart", fightsvr_inst)
--skynet.call(player_2.agent, "game", "onFightStart", fightsvr_inst)
end
function DOUNIU:matchLoop()
for k,v_room in pairs(room_queue) do
--print("match loop room_id :"..v_room.room_id.. " status:".. v_room.status)
if v_room.status == 0 then
local room_num = get_table_nums(v_room.player_lst)
print("room "..v_room.room_id.." player size "..room_num)
if room_num >= 2 and os.time() - v_room.room_begin_ts > 10 then
print("room "..v_room.room_id.." begin match ")
--大于两个人可以开游戏
DOUNIU:startGame(v_room)
else
v_room.fight_ins = nil
end
if room_num == 0 then
room_queue[k] = nil
end
end
end
skynet.timeout(500, DOUNIU.matchLoop)
end
function DOUNIU:onPackCard(room_id, uid, card_info)
--table.insert(match_queue, player)
--print('[DOUNIU] start', player.uid, player)
end
function DOUNIU:unlock_room(room_id)
local u_room = room_queue[room_id]
if u_room ~= nil then
u_room.status = 0
u_room.room_begin_ts = os.time()
for uid,p in pairs(u_room.player_lst) do
skynet.call(p.agent, "lua", "set_fight", nil)
end
end
end
skynet.start(function()
skynet.dispatch("lua", function(session, source, cmd, ...)
print('douniu server !', session, source, cmd)
local f = DOUNIU[cmd]
skynet.ret(skynet.pack(f(DOUNIU, ...)))
end)
skynet.timeout(500, DOUNIU.matchLoop)
skynet.register "DOUNIUSERVER"
end)
|
--[[
name: cl_main.lua
]]--
local MAT_NOTIFY = Material( "materials/seth_area/notification.png" )
local MAT_POINT = Material( "materials/seth_area/point.png" )
--[[-------------------------------------------------------------------------
Name: Frame
---------------------------------------------------------------------------]]
local PANEL = {}
function PANEL:Init()
self.strTitle = "Title"
self.matTexture = Material( "materials/seth_area/settings.png" )
end
function PANEL:SetTexture( matTexture )
self.matTexture = matTexture
end
function PANEL:SetTitle( strTitle )
self.strTitle = strTitle
end
function PANEL:Paint( intW, intH )
draw.RoundedBox( 16, 0, 0, intW, intH, Color( 34, 34, 34 ) )
surface.SetDrawColor( 40, 40, 40 )
surface.DrawLine( 0, 50, intW, 50 )
surface.SetDrawColor( 255, 255, 255 )
surface.SetMaterial( self.matTexture )
surface.DrawTexturedRect( 15, ( 50 *.5 ) -( 27 *.5 ), 27, 27 )
draw.SimpleText( self.strTitle, "Seth:Area:Purista:16", 30 +27, 25, Color( 150, 150, 150 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
end
vgui.Register( "SethArea_Frame", PANEL, "EditablePanel" )
--[[-------------------------------------------------------------------------
Name: Button
---------------------------------------------------------------------------]]
local PANEL = {}
function PANEL:Init()
self:SetText( "" )
end
function PANEL:SetRounded( intRounded, bolRoundFirst, bolRoundTwo, bolRoundThree, bolRoundFour )
self.intRounded, self.bolRoundFirst, self.bolRoundTwo, self.bolRoundThree, self.bolRoundFour = intRounded, bolRoundFirst, bolRoundTwo, bolRoundThree, bolRoundFour
end
function PANEL:SetButtonText( strText )
self.strText = strText
end
function PANEL:SetTextFont( fntText )
self.fntText = fntText
end
function PANEL:SetBackgroundColor( colBackground )
self.colBackground = colBackground
end
function PANEL:SetBackgroundHoveredColor( colBackgroundHovered )
self.colBackgroundHovered = colBackgroundHovered
end
function PANEL:SetTextColor( colText )
self.colText = colText
end
function PANEL:SetTextHoveredColor( colTextHovered )
self.colTextHovered = colTextHovered
end
function PANEL:SetTexture( matTexture, intTextureWeight, intTextureHeight )
self.matTexture, self.intTextureWeight, self.intTextureHeight = matTexture, intTextureWeight, intTextureHeight
end
function PANEL:Paint( intW, intH )
if self.Hovered then
self.colDefineText = self.colTextHovered or Color( 255, 255, 255 )
self.colDefineBackground = self.colBackgroundHovered or Color( 0, 0, 0, 0 )
else
self.colDefineText = self.colText or Color( 220, 220, 220 )
self.colDefineBackground = self.colBackground or Color( 0, 0, 0, 0 )
end
if self.colBackground and self.colBackgroundHovered then
draw.RoundedBoxEx( self.intRounded, 0, 0, intW, intH, self.colDefineBackground, self.bolRoundFirst, self.bolRoundTwo, self.bolRoundThree, self.bolRoundFour )
end
if !self.matTexture then
draw.SimpleText( self.strText or "Label", self.fntText or "Seth:Area:Purista:16", intW *.5, intH *.5, self.colDefineText, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
else
surface.SetFont( self.fntText or "Seth:Area:Purista:16" )
local intTextWeight = select( 1, surface.GetTextSize( self.strText or "Label" ) )
local intSpacing = ( intTextWeight +self.intTextureWeight ) *.5
surface.SetDrawColor( 255, 255, 255 )
surface.SetMaterial( self.matTexture )
surface.DrawTexturedRect( intW *.5 - intSpacing -7.5, ( intH *.5 ) -( self.intTextureHeight *.5 ), self.intTextureWeight, self.intTextureHeight )
draw.SimpleText( self.strText or "Label", self.fntText or "Seth:Area:Purista:16", intW *.5 -intSpacing +self.intTextureHeight +7.5, intH *.5, self.colDefineText, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
end
end
vgui.Register( "SethArea_Button", PANEL, "DButton" )
--[[-------------------------------------------------------------------------
Name: Check box
---------------------------------------------------------------------------]]
local PANEL = {}
function PANEL:Init()
self:SetSize( 30, 16 )
self:SetText( "" )
self.bolIsOn = false
end
function PANEL:SetCheckToggle( bolToggle )
if bolToggle then
self.bolIsOn = false
else
self.bolIsOn = !self.bolIsOn
end
end
function PANEL:SetActive()
end
function PANEL:DoClick()
if !self:SetActive() then return end
self:SetCheckToggle()
end
function PANEL:Paint( intW, intH )
draw.RoundedBox( 6, 0, 2, intW, intH -4, Color( 50, 50, 50 ) )
self.intLerpActive = self.intLerpActive or 0
self.intLerpActive = Lerp( FrameTime() *10, self.intLerpActive, self.bolIsOn and intW -intH or 0 )
draw.RoundedBox( 8, self.intLerpActive, 0, intH, intH, self.bolIsOn and Color( 35, 155, 86 ) or Color( 176, 58, 46 ) )
end
vgui.Register( "SethArea_CheckBox", PANEL, "DButton" )
--[[-------------------------------------------------------------------------
Name: Scroll
---------------------------------------------------------------------------]]
local PANEL = {}
function PANEL:Init()
local tblBars = self:GetVBar()
function tblBars.btnUp:Paint() end
function tblBars.btnDown:Paint() end
function tblBars:Paint( intW, intH )
draw.RoundedBox( 0, intW *.5 -intW *.2 *.5, intH *.05, intW *.2, intH *.9, Color( 50, 50, 50 ) )
end
function tblBars.btnGrip:Paint( intW, intH )
draw.RoundedBox( 8, intW *.5 -intW *.4 *.5, 0, intW *.4, intH, Color( 60, 60, 60 ) )
end
end
vgui.Register( "SethArea_Scroll", PANEL, "DScrollPanel" )
--[[-------------------------------------------------------------------------
Name: Text entry
---------------------------------------------------------------------------]]
local PANEL = {}
function PANEL:Init()
self:SetDrawBackground( false )
self:SetDrawLanguageID( false )
self:SetFont( "Seth:Area:Purista:16:Italic" )
end
function PANEL:SetPlaceHolderText( strHolder )
self.strHolder = strHolder
end
function PANEL:Paint( intW, intH )
surface.SetDrawColor( 40, 40, 40 )
surface.DrawRect( 0, 0, intW, intH )
surface.SetDrawColor( 30, 30, 30 )
surface.DrawOutlinedRect( 0, 0, intW, intH )
self:DrawTextEntryText( Color( 150, 150, 150 ), Color( 212, 172, 13, 20 ), Color( 150, 150, 150 ) )
if self.strHolder and self:GetText() == nil or self:GetText() == "" then
draw.SimpleText( self.strHolder, "Seth:Area:Purista:16:Italic", 5, 2.5, Color( 150, 150, 150 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
end
end
vgui.Register( "SethArea_TextEntry", PANEL, "DTextEntry" )
--[[-------------------------------------------------------------------------
Name: Valid panel
---------------------------------------------------------------------------]]
local PANEL = {}
function PANEL:Init()
self:SetWide( 350 )
self:Center()
self:SetTitle( Seth.Area.LANGUAGE:Get( "VGUI:ChoicePanelTItle" ) )
self:MakePopup()
self:SetTexture( MAT_POINT )
self.pnlQuestionLabel = vgui.Create( "DLabel", self )
self.pnlQuestionLabel:SetContentAlignment( 8 )
self.pnlQuestionLabel:SetFont( "Seth:Area:Purista:16:Italic" )
self.pnlQuestionLabel:SetColor( Color( 150, 150, 150 ) )
self.pnlYesBtn = vgui.Create( "SethArea_Button", self )
self.pnlYesBtn:SetSize( self:GetWide() *.5, 30 )
self.pnlYesBtn:SetButtonText( Seth.Area.LANGUAGE:Get( "VGUI:ChoicePanelYes" ) )
self.pnlYesBtn:SetRounded( 16, false, false, true, false )
self.pnlYesBtn:SetBackgroundColor( Color( 35, 155, 86 ) )
self.pnlYesBtn:SetBackgroundHoveredColor( Color( 46, 204, 113 ) )
function self.pnlYesBtn:DoClick()
local pnlParent = self:GetParent()
if !pnlParent or !IsValid( pnlParent ) then return end
pnlParent:Remove()
net.Start( "NET:Seth:Area" )
net.WriteUInt( pnlParent.intID, 8 )
net.SendToServer()
end
self.pnlNoBtn = vgui.Create( "SethArea_Button", self )
self.pnlNoBtn:SetSize( self:GetWide() *.5, 30 )
self.pnlNoBtn:SetButtonText( Seth.Area.LANGUAGE:Get( "VGUI:ChoicePanelNo" ) )
self.pnlNoBtn:SetRounded( 16, false, false, false, true )
self.pnlNoBtn:SetBackgroundColor( Color( 176, 58, 46 ) )
self.pnlNoBtn:SetBackgroundHoveredColor( Color( 203, 67, 53 ) )
function self.pnlNoBtn:DoClick()
local pnlParent = self:GetParent()
if !pnlParent or !IsValid( pnlParent ) then return end
pnlParent:Remove()
end
end
function PANEL:SetNetID( intID )
self.intID = intID
end
function PANEL:SetText( strText )
self.strText, self.intCountLine = Seth.Area.UTIL:SplitString( strText, self:GetWide() /4.5 -30 )
self:SetTall( self.intCountLine *18 +30 +65 +15 )
self.pnlQuestionLabel:SetSize( self:GetWide() -30, 18 *self.intCountLine )
self.pnlQuestionLabel:SetPos( 15, 65 )
self.pnlQuestionLabel:SetText( self.strText )
self.pnlYesBtn:SetPos( 0, self:GetTall() -self.pnlYesBtn:GetTall() )
self.pnlNoBtn:SetPos( self:GetWide() *.5, self:GetTall() -self.pnlNoBtn:GetTall() )
end
vgui.Register( "SethArea_ValidPanel", PANEL, "SethArea_Frame" )
--[[-------------------------------------------------------------------------
Name: Notify
---------------------------------------------------------------------------]]
local PANEL = {}
function PANEL:Init()
self:SetTall( 50 )
self.tblTriangle = { { x = self:GetTall() -5, y = 0 }, { x = self:GetTall() +15, y = 0 }, { x = self:GetTall() -5, y = self:GetTall() } }
end
function PANEL:SetType( bolType )
self.strTitle = bolType and string.upper( Seth.Area.LANGUAGE:Get( "VGUI:Success" ) ) or string.upper( Seth.Area.LANGUAGE:Get( "VGUI:Error" ) )
end
function PANEL:SetText( strText )
self.strText = strText
surface.SetFont( "Seth:Area:Purista:16:Italic" )
local intWeight = surface.GetTextSize( strText )
self:SetWide( self:GetTall() +35 +intWeight +10 )
end
function PANEL:KillSelf()
if ( self.intStartTime +self.intLength < SysTime() ) then
self:Remove()
return true
end
return false
end
function PANEL:Paint( intW, intH )
draw.RoundedBox( 16, 0, 0, intW, intH, Color( 40, 40, 40 ) )
draw.RoundedBoxEx( 16, 0, 0, intH -5, intH, Color( 26, 82, 118 ), true, false, true, false )
surface.SetDrawColor( 26, 82, 118 )
draw.NoTexture()
surface.DrawPoly( self.tblTriangle )
surface.SetDrawColor( 200, 200, 200 )
surface.SetMaterial( MAT_NOTIFY )
surface.DrawTexturedRect( intH *.5 -16, intH *.5 -16, 32, 32 )
draw.SimpleText( self.strTitle or string.upper( Seth.Area.LANGUAGE:Get( "VGUI:Success" ) ), "Seth:Area:Purista:18:Bold", intH +25, intH *.5 -8, Color( 200, 200, 200 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
draw.SimpleText( self.strText or Seth.Area.LANGUAGE:Get( "VGUI:NotificationExemple" ), "Seth:Area:Purista:16:Italic", intH +25, intH *.5 +7, Color( 200, 200, 200 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
end
vgui.Register( "SethArea_Notify", PANEL, "DPanel" )
local PANEL = {}
function PANEL:Init()
self.bolSwitch = true
self.pnlLeftBtn = vgui.Create("SethArea_Button", self)
self.pnlLeftBtn:SetButtonText("LEFT")
self.pnlLeftBtn:SetRounded(24, true, false, true, false)
self.pnlLeftBtn:SetBackgroundColor(Color(35,155,86))
self.pnlLeftBtn:SetBackgroundHoveredColor(Color(53,187,110))
self.pnlLeftBtn:SetTextColor(color_white)
self.pnlLeftBtn:SetTextFont("Seth:Area:Purista:20:Italic")
function self.pnlLeftBtn:DoClick()
local pnlParent = self:GetParent()
if !pnlParent then return end
pnlParent.bolSwitch = true
pnlParent:Switch()
end
self.pnlRightBtn = vgui.Create("SethArea_Button", self)
self.pnlRightBtn:SetButtonText("RIGHT")
self.pnlRightBtn:SetRounded(24, false, true, false, true)
self.pnlRightBtn:SetBackgroundColor(Color(70,70,70))
self.pnlRightBtn:SetBackgroundHoveredColor(Color(75, 75, 75))
self.pnlRightBtn:SetTextColor(Color(150,150,150))
self.pnlRightBtn:SetTextFont("Seth:Area:Purista:20:Italic")
function self.pnlRightBtn:DoClick()
local pnlParent = self:GetParent()
if !pnlParent then return end
pnlParent.bolSwitch = false
pnlParent:Switch()
end
end
function PANEL:Switch()
self.pnlRightBtn:SetTextColor(self.bolSwitch and Color(150,150,150) or color_white)
self.pnlRightBtn:SetBackgroundColor(self.bolSwitch and Color(70,70,70) or Color(35,155,86))
self.pnlRightBtn:SetBackgroundHoveredColor(self.bolSwitch and Color(75, 75, 75) or Color(53,187,110))
self.pnlLeftBtn:SetTextColor(self.bolSwitch and color_white or Color(150,150,150))
self.pnlLeftBtn:SetBackgroundColor( self.bolSwitch and Color(35,155,86) or Color(70,70,70))
self.pnlLeftBtn:SetBackgroundHoveredColor(self.bolSwitch and Color(53,187,110) or Color(75, 75, 75))
end
function PANEL:GetSwitchValue()
return self.bolSwitch or false
end
function PANEL:PerformLayout(intW, intH)
self.pnlLeftBtn:Dock(LEFT)
self.pnlLeftBtn:SetWide(self:GetWide() *.5)
self.pnlRightBtn:Dock(RIGHT)
self.pnlRightBtn:SetWide(self:GetWide() *.5)
end
function PANEL:Paint()
end
vgui.Register("SethArea_ButtonGroup", PANEL, "DPanel")
local PANEL = {}
function PANEL:Init()
self:SetTall(50)
self:SetTall(100)
self:SetDecimals(0)
self:SetText("")
self:SetValue(0)
self.Scratch:SetVisible(false)
self.Label:SetVisible(false)
self.TextArea:SetVisible(false)
function self.Slider:Paint(intW, intH)
draw.RoundedBox(4, 0, intH *.5 -3, intW, 6, Color(50, 50, 50))
end
function self.Slider.Knob:Paint(intW, intH)
draw.RoundedBox(16, 0, 0, 16, 16, Color(100, 100, 100))
end
self.pnlIndicator = vgui.Create("DPanel", self)
self.pnlIndicator:Dock(BOTTOM)
self.pnlIndicator:SetTall(30)
function self.pnlIndicator:Paint(intW, intH)
local strValue = (self:GetParent().strValueTitle or "Value").. ": ".. self:GetParent().TextArea:GetText().. "px"
surface.SetFont("Seth:Area:Purista:18:Italic")
local intWeightValue = select(1, surface.GetTextSize(strValue))
draw.RoundedBox(8, 0, 0, intWeightValue +20, intH, Color(50, 50, 50))
draw.SimpleText( strValue, "Seth:Area:Purista:18:Italic", 10, intH *.5, Color(150, 150, 150), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
end
end
function PANEL:SetValueTitle(strValueTitle)
self.strValueTitle = strValueTitle
end
vgui.Register("SethArea_Slider", PANEL, "DNumSlider")
|
-- Copyright (C) 2017-2020 DBotThePony
-- 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 DLib = DLib
DLib.DEBUG_MODE = CreateConVar('dlib_debug', '0', {FCVAR_REPLICATED}, 'Enable debug mode. Setting this to 1 can help you solve weird bugs.')
DLib.STRICT_MODE = CreateConVar('dlib_strict', '0', {FCVAR_REPLICATED}, 'Enable strict mode. Enabling this turns all ErrorNoHalts into execution halting errors. The best way to fix bad code.')
function DLib.simpleInclude(fil)
if SERVER then AddCSLuaFile('dlib/' .. fil) end
return include('dlib/' .. fil)
end
local startupText = [[
___ _ _ ___
| \ | | |__]
|__/ |___ | |__]
____ ____ ___ ____ ____ _ _ _ _ _ _ ____
|__/ |___ | \ |___ |___ | |\ | | |\ | | __
| \ |___ |__/ |___ | | | \| | | \| |__]
____ _ _ _ ____
| __ | | | |__|
|__] |___ |__| | |
]]
local startupText2 = [[
___ _ _ ___
| \ | | |__]
|__/ |___ | |__]
___ ____ ____ ____ _ _ _ _ _ ____
|__] |__/ |___ |__| |_/ | |\ | | __
|__] | \ |___ | | | \_ | | \| |__]
_ _ ____ _ _ ____
\_/ | | | | |__/
| |__| |__| | \
____ _ _ _ ___
[__ |__| | |
___] | | | |
___ _ _
| |\/|
| | |
]]
MsgC('---------------------------------------------------------------\n')
if math.random() > 0.1 then
for line in string.gmatch(startupText, '(.-)\r?\n') do
MsgC(line .. '\n')
end
else
for line in string.gmatch(startupText2, '(.-)\r?\n') do
MsgC(line .. '\n')
end
end
local MsgC = MsgC
local SysTime = SysTime
local timeStart = SysTime()
MsgC('---------------------------------------------------------------\n')
MsgC('[DLib] Initializing DLib core ... ')
DLib.simpleInclude('core/core.lua')
DLib.simpleInclude('core/luaify.lua')
DLib.simpleInclude('core/funclib.lua')
DLib.simpleInclude('modules/color.lua')
DLib.MessageMaker = DLib.simpleInclude('util/message.lua')
DLib.MessageMaker(DLib, 'DLib')
DLib.simpleInclude('core/sandbox.lua')
DLib.simpleInclude('core/promise.lua')
if jit then
if SERVER then
AddCSLuaFile('dlib/core/vmdef.lua')
AddCSLuaFile('dlib/core/vmdef_x64.lua')
end
if jit.arch == 'x86' then
local vmdef = CompileFile('dlib/core/vmdef.lua')
jit.vmdef = nil
vmdef('jit_vmdef')
jit.vmdef = jit_vmdef
elseif jit.arch == 'x64' then
jit.vmdef = include('dlib/core/vmdef_x64.lua')
end
end
DLib.CMessage = DLib.MessageMaker
DLib.ConstructMessage = DLib.MessageMaker
DLib.simpleInclude('util/combathelper.lua')
DLib.simpleInclude('util/util.lua')
DLib.simpleInclude('util/vector.lua')
DLib.node = DLib.simpleInclude('util/node.lua')
if CLIENT then
DLib.simpleInclude('util/client/localglobal.lua')
end
file.mkdir('dlib')
DLib.simpleInclude('core/tableutil.lua')
DLib.simpleInclude('core/fsutil.lua')
DLib.simpleInclude('core/loader.lua')
DLib.simpleInclude('core/loader_modes.lua')
MsgC(string.format('%.2f ms\n', (SysTime() - timeStart) * 1000))
timeStart = SysTime()
MsgC('[DLib] Initializing DLib GLua extensions ... ')
DLib.Loader.shmodule('bitworker.lua')
DLib.simpleInclude('luabridge/luaify.lua')
DLib.simpleInclude('extensions/extensions.lua')
DLib.simpleInclude('extensions/string.lua')
DLib.simpleInclude('extensions/ctakedmg.lua')
DLib.simpleInclude('extensions/cvar.lua')
DLib.simpleInclude('extensions/entity.lua')
DLib.simpleInclude('extensions/render.lua')
DLib.simpleInclude('extensions/player.lua')
DLib.Loader.shmodule('hook.lua')
DLib.simpleInclude('luabridge/luaify2.lua')
DLib.simpleInclude('luabridge/lobject.lua')
DLib.simpleInclude('util/http.lua')
DLib.simpleInclude('util/httpclient.lua')
DLib.simpleInclude('util/promisify.lua')
MsgC(string.format('%.2f ms\n', (SysTime() - timeStart) * 1000))
timeStart = SysTime()
MsgC('[DLib] Initializing DLib modules ... ')
DLib.Loader.shmodule('luavector.lua')
DLib.Loader.shmodule('net_ext.lua')
DLib.Loader.shmodule('bytesbuffer.lua')
DLib.Loader.shmodule('nbt.lua')
DLib.Loader.shmodule('lerp.lua')
DLib.Loader.shmodule('sh_cami.lua')
DLib.Loader.shmodule('getinfo.lua')
DLib.Loader.shmodule('predictedvars.lua')
DLib.Loader.start('nw')
DLib.Loader.load('dlib/modules/nwvar')
DLib.Loader.finish()
DLib.simpleInclude('util/queue.lua')
DLib.Loader.loadPureSHTop('dlib/enums')
MsgC(string.format('%.2f ms\n', (SysTime() - timeStart) * 1000))
timeStart = SysTime()
MsgC('[DLib] Initializing DLib classes ... ')
DLib.Loader.shclass('astar.lua')
DLib.Loader.shclass('dmginfo.lua')
DLib.Loader.shclass('collector.lua')
DLib.Loader.shclass('set.lua')
DLib.Loader.shclass('freespace.lua')
DLib.Loader.shclass('cvars.lua')
DLib.Loader.shclass('rainbow.lua')
DLib.Loader.shclass('camiwatchdog.lua')
DLib.Loader.shclass('measure.lua')
DLib.Loader.shclass('bezier.lua')
DLib.Loader.shclass('predictedvars.lua')
DLib.Loader.clclass('keybinds.lua')
DLib.Loader.start('i18n')
DLib.Loader.load('dlib/modules/i18n')
DLib.Loader.finish()
DLib.Loader.start('friends', true)
DLib.Loader.load('dlib/modules/friendsystem')
DLib.Loader.finish()
if CLIENT then
DLib.VGUI = DLib.VGUI or {}
end
MsgC(string.format('%.2f ms\n', (SysTime() - timeStart) * 1000))
timeStart = SysTime()
MsgC('[DLib] Initializing DLib LuaBridge ... ')
DLib.simpleInclude('luabridge/luabridge.lua')
DLib.simpleInclude('luabridge/physgunhandler.lua')
DLib.simpleInclude('luabridge/loading_stages.lua')
DLib.simpleInclude('luabridge/savetable.lua')
DLib.Loader.loadPureSHTop('dlib/modules/workarounds')
DLib.hl2wdata = DLib.simpleInclude('data/hl2sweps.lua')
MsgC(string.format('%.2f ms\n', (SysTime() - timeStart) * 1000))
|
-- define all language properties Transaltion by Baavoz
local lang = {
common = {
welcome = "Tervetuloa serverille paina K avataksesi menu.~n~",
no_player_near = "~r~Ei pelaajia lähellä.",
invalid_value = "~r~Virheellinen arvo.",
invalid_name = "~r~Virheellinen nimi.",
not_found = "~r~ei löytynyt.",
request_refused = "~r~Pyyntö hylätty .",
wearing_uniform = "~r~ole varovainen käytöt uniformua.",
not_allowed = "~r~Ei ole sallittua."
},
weapon = {
pistol = "Pistooli"
},
survival = {
starving = "Nälkä",
thirsty = "Jano"
},
money = {
display = "<span class=\"symbol\">$</span> {1}",
bdisplay = "<span class=\"symbol\">$</span> {1}",
given = "Annettu ~r~{1}$.",
received = "Saatu ~g~{1}$.",
not_enough = "~r~Ei tarpeeksi rahaa.",
paid = "Maksettu ~r~{1}$.",
give = {
title = "Anna rahaa",
description = "Anna rahaa lähimmälle pelaajalle.",
prompt = "Annettava määrä:"
}
},
inventory = {
title = "Reppu",
description = "Avaa reppu.",
iteminfo = "({1})<br /><br />{2}<br /><em>{3} kg</em>",
info_weight = "Paino {1}/{2} kg",
give = {
title = "Anna",
description = "Anna tavaroita lähimmälle pelaajalle.",
prompt = "Annettava määrä(max {1}):",
given = "Annettu ~r~{1} ~s~{2}.",
received = "Saatu ~g~{1} ~s~{2}.",
},
trash = {
title = "roska",
description = "Tuhoa tavaroita.",
prompt = "Määrä roskata (max {1}):",
done = "Roskattu ~r~{1} ~s~{2}."
},
missing = "~r~Puuttuva {2} {1}.",
full = "~r~Reppu täynnä.",
chest = {
title = "Arkku",
already_opened = "~r~Joku muu on jo avannut tämän arkun :(.",
full = "~r~Arkku on täynnä.",
take = {
title = "Ota",
prompt = "Otettava määrä (max {1}):"
},
put = {
title = "Laita",
prompt = "Laitettava määrä (max {1}):"
}
}
},
atm = {
title = "Pankkiautomaatti",
info = {
title = "Info",
bank = "Pankki: {1} $"
},
deposit = {
title = "Talleta",
description = "lompakosta pankkiin",
prompt = "Anna talletettavan rahan määrä:",
deposited = "~r~{1}$~s~ talletettu."
},
withdraw = {
title = "Nosta",
description = "pankista lompakkoon",
prompt = "Anna nostettavan rahan määrä:",
withdrawn = "~g~{1}$ ~s~nostettu.",
not_enough = "~r~Sinulla ei ole tarpeeksi rahaa pankissa."
}
},
business = {
title = "Kauppakamari",
directory = {
title = "Hakemisto",
description = "Luiiketoiminta hakemisto.",
dprev = "> Edellinen",
dnext = "> Seuraava",
info = "<em>Pääoma: </em>{1} $<br /><em>omistaja: </em>{2} {3}<br /><em>rekisteröinti n°: </em>{4}<br /><em>puhelin: </em>{5}"
},
info = {
title = "Yrityksen tietoja",
info = "<em>nimi: </em>{1}<br /><em>pääoma: </em>{2} $<br /><em>pääoman siirto: </em>{3} $<br /><br/>pääoma siirto on liiketoiminnan taloudellisen ajanjakson aikana siirretty rahamäärä, enimmäismäärä on liiketoiminan pääoma."
},
addpääoma = {
title = "Lisää pääomaa",
description = "AddLisää pääomaa yritykseesi.",
prompt = "Määrä pääomaa listtävänä yritykseesi",
added = "~r~{1}$ ~s~pää omaa lisätyy yritykseen."
},
launder = {
title = "Rahan pesu",
description = "Käytä yritystäsi rahanpesuun.",
prompt = "Määrä likaista rahaa pestävänä (max {1} $): ",
laundered = "~g~{1}$ ~s~pestynä.",
not_enough = "~r~Ei tarpeeksi likaistarahaa."
},
open = {
title = "Avaa yritys",
description = "Avaa yrityksesi, minimi pääoma on {1} $.",
prompt_name = "Yrityksen nimi (ei voi vaihtaa myöhemmin, max {1} merkkiä):",
prompt_pääoma = "Alku pääoma (min {1})",
created = "~g~yritys luotu."
}
},
cityhall = {
title = "Kaupungin talo",
identity = {
title = "Uusi identiteetti",
description = "Luo uusi identiteetti, maksaa = {1} $.",
prompt_firstname = "Anna etunimi:",
prompt_name = "Anna sukunimi:",
prompt_age = "Anna ikäsi:",
},
menu = {
title = "Identiteetti",
info = "<em>Etunimi: </em>{2}<br /><em>Sukunimi: </em>{1}<br /><em>Ikä: </em>{3}<br /><em>Rekisteröintuí n°: </em>{4}<br /><em>Puhelin: </em>{5}<br /><em>Osoite: </em>{7}, {6}"
}
},
police = {
title = "Poliisi",
wanted = "Haluttu sijoitus {1}",
not_handcuffed = "~r~EI ole käsiraudoitettu",
cloakroom = {
title = "Vaatehuone",
uniform = {
title = "Työvaate",
description = "Laita työvaate."
}
},
pc = {
title = "PC",
searchreg = {
title = "Rekisteri haku",
description = "Etsi identiteettiä rekisteristä.",
prompt = "Anna rekisterinumero:"
},
closebusiness = {
title = "Sulje yritys",
description = "Sulje lähimmän pelaajan yritys.",
request = "Oletko varma että haluat poistaa yrityksen. {3} Omistaja {1} {2} ?",
closed = "~g~yritys suljettu."
},
trackveh = {
title = "Jäljitä kulkuneuvo",
description = "Jäljitä kulkuneuvo sen rekisterinumerolla.",
prompt_reg = "Anna rekisterinumero:",
prompt_note = "Anna jäljitys merkintä/syy:",
tracking = "~b~Jäljitys aloitettu.",
track_failed = "~b~Jäljitys {1}~s~ ({2}) ~n~~r~Epäonnistui.",
tracked = "Jäljitetty {1} ({2})"
},
records = {
show = {
title = "Näytä kirjaukset",
description = "Näytä poliisin kirjaukset rekisteröintinumeron mukaan."
},
delete = {
title = "Siivoa kirjaukset",
description = "Siivoa poliisi rekisteröinnit rekisterinumeron mukaan.",
deleted = "~b~Poliisi kirjaukset poistettu"
}
}
},
menu = {
handcuff = {
title = "Käsiraudat",
description = "Käsiraudoita lähin pelaaja."
},
putinveh = {
title = "Laita kulkuneuvoon",
description = "Laita lähin käsirautoitettu ajoneuvvoosi matkustajaksi."
},
getoutveh = {
title = "poista kulkuneuvosta",
description = "Poista lähin käsiraudoitettu pelaaja autosta."
},
askid = {
title = "Kysy ID",
description = "Ksy ID korttia lähiimältä pelaajalta.",
request = "Haluatko antaa minulle ID korttisi?",
request_hide = "Piilota ID kortti.",
asked = "Kysytään ID..."
},
check = {
title = "Tarkista pelaaja",
description = "Kysy rahaa, reppua ja asetta lähiimältä pelaajalta.",
request_hide = "Piiloita tarkistus raportti.",
info = "<em>raha: </em>{1} $<br /><br /><em>reppu: </em>{2}<br /><br /><em>aseet: </em>{3}",
checked = "Sinut on tarkistettu."
},
seize = {
seized = "Takavarikoitu {2} ~r~{1}",
weapons = {
title = "takavarikoi aseita",
description = "Takavarikoi lähimmän pelaajan ase",
seized = "~b~Aseesi on takavarikoitu."
},
items = {
title = "Takavarkoi laittomat",
description = "Takavarikoi laittomat esineet",
seized = "~b~Sinun laittomat tavarasi on takavarikoitu."
}
},
jail = {
title = "Vankila",
description = "Vankiloi/Poista vankilasta lähinpelaaja vankilasta/lähiimästä vankilasta.",
not_found = "~r~Vankilaa ei löydetty.",
jailed = "~b~Vankiloitu.",
unjailed = "~b~Poistettu vankilasta.",
notify_jailed = "~b~Sinut on vankiloitu.",
notify_unjailed = "~b~Sinut on poistettu vankilasta."
},
fine = {
title = "Sakko",
description = "Sakota lähintä pelaajaa.",
fined = "~b~Sakotettu ~s~{2} $ ~b~{1}.",
notify_fined = "~b~Sinua on sakotettu ~s~ {2} $ ~b~{1}.",
record = "[Sakko] {2} $ {1}"
},
store_weapons = {
title = "Säilytä aseita",
description = "Säilytä aseesi reppuun."
}
},
identity = {
info = "<em>Nimi: </em>{1}<br /><em>Etunimi: </em>{2}<br /><em>Ikä: </em>{3}<br /><em>Rekisteröinti n°: </em>{4}<br /><em>Puhelin: </em>{5}<br /><em>Yritys: </em>{6}<br /><em>Yrityksen pääoma: </em>{7} $<br /><em>Osoite: </em>{9}, {8}"
}
},
emergency = {
menu = {
revive = {
title = "Elvytä",
description = "Elvytä lähin pelaaja henkiin.",
not_in_coma = "~r~Ei ole koomassa."
}
}
},
phone = {
title = "Puhelin",
directory = {
title = "Luettelo",
description = "Avaa puhelinluettelo.",
add = {
title = "➕ LIsää",
prompt_number = "Anna lisättävä puhelinnumero:",
prompt_name = "Anna merkinnän nimi:",
added = "~g~Merkintä lisätty."
},
sendsms = {
title = "Lähetä SMS",
prompt = "Lähetä viesti (max {1} merkkiä):",
sent = "~g~ Lähetä n°{1}.",
not_sent = "~r~ n°{1} ei saatavilla."
},
sendpos = {
title = "Lähetä sijainti",
},
remove = {
title = "Poista"
}
},
sms = {
title = "SMS historia",
description = "Vastaan otettu SMS historia.",
info = "<em>{1}</em><br /><br />{2}",
notify = "SMS~b~ {1}:~s~ ~n~{2}"
},
smspos = {
notify = "SMS-Sijainti ~b~ {1}"
},
service = {
title = "Palavelu",
description = "Soita palvelulle tai hätänumeroon.",
prompt = "Jos tarvitaan anna palvelulle viesti:",
ask_call = "Vastaanotettu {1} puhelu, otatko sen ? <em>{2}</em>",
taken = "~r~Tämä puhelu on jo otettu."
},
announce = {
title = "Ilmoita",
description = "Julkaise ilmoitus, näkyvissä kaikille muutama sekunttia.",
item_desc = "{1} $<br /><br/>{2}",
prompt = "Ilmoita sisältöä (10-1000 chars): "
}
},
emotes = {
title = "Näyttely jutut",
clear = {
title = "> Siivoa",
description = "Siivoa kaikki päälläolevat näytös jutut :D."
}
},
home = {
buy = {
title = "Osta",
description = "Osta täältä talo, hinta {1} $.",
bought = "~g~Ostettu.",
full = "~r~Tämä paikka on täynnä.",
have_home = "~r~Sinulla on jo koti."
},
sell = {
title = "Myy",
description = "Myy kotisi hintaan {1} $",
sold = "~g~Myyty.",
no_home = "~r~Sinulla ei ole kotia täällä."
},
intercom = {
title = "Ovipuhelin",
description = "Käytä ovipuhelinta mennäksesi taloon.",
prompt = "Numero:",
not_available = "~r~Ei saatavilla.",
refused = "~r~Kieltäytyi tulemasta.",
prompt_who = "Sano kuka olet:",
asked = "Kysyy...",
request = "Joku haluaa avata kotisi oven: <em>{1}</em>"
},
slot = {
leave = {
title = "Poistu"
},
ejectall = {
title = "Poista kaikki",
description = "Poista kaikki vierailijat talosta sinut mukaanlukien, lukitset myös talon."
}
},
wardrobe = {
title = "Vaatekaappi",
save = {
title = "> tallenna",
prompt = "Tallenna nimi:"
}
},
gametable = {
title = "pelipöytä",
bet = {
title = "Aloitus panos",
description = "Aloita uhkapeli lähelläolevien pelaajien kanssa, voittaja valitaan satunnaisesti.",
prompt = "Panoksen määrä:",
request = "[BET] Haluatko uhkapelata {1} $ ?",
started = "~g~Uhkapeli aloitettu."
}
}
},
garage = {
title = "Autotalli ({1})",
owned = {
title = "Omistaja",
description = "Omistajan kulkuneuvot."
},
buy = {
title = "Osta",
description = "Osta kulkuneuvoja.",
info = "{1} $<br /><br />{2}"
},
sell = {
title = "Myy",
description = "Myy kulkuneuvoja."
},
rent = {
title = "Vuokraa",
description = "Vuokraa kulkuneuvo tälle pelikerralle (poistuu kun lähdet servulta)."
},
store = {
title = "Säilö",
description = "laita nykyinen kulkuneuvosi autotalliin."
}
},
ajoneuvo = {
title = "Kulkuneuvo",
no_owned_near = "~r~Et omista kulkuneuvoja lähellä.",
trunk = {
title = "Takakontti",
description = "Avaa kulkuneuvon takakontti."
},
detach_trailer = {
title = "Irroita perävaunu",
description = "Irroita perävaunu."
},
detach_towtruck = {
title = "Irroita hinausauto",
description = "Irroita hinausauto."
},
detach_cargobob = {
title = "irroita cargobob",
description = "irroita cargobob."
},
lock = {
title = "Lukitse/Avaa",
description = "Lukitse tai avaa kulkuneuvo."
},
engine = {
title = "Moottori on/off",
description = "Käynnistä tai sammuta moottori."
},
asktrunk = {
title = "Kysy takakontin avausta",
asked = "~g~Kysytään...",
request = "Haluatko avata takakontin ?"
},
replace = {
title = "Vaihda ajoneuvo",
description = "Vaihda maassaoleva lähin ajoneuvo."
},
repair = {
title = "Korjaa ajoneuvo",
description = "Korjaa lähin ajoneuvo."
}
},
gunshop = {
title = "Asekauppa ({1})",
prompt_ammo = "Ostettavien patruunoiden määrä {1}:",
info = "<em>body: </em> {1} $<br /><em>ammo: </em> {2} $/u<br /><br />{3}"
},
market = {
title = "Marketti ({1})",
prompt = "ostettavan tavaran määrä {1}:",
info = "{1} $<br /><br />{2}"
},
skinshop = {
title = "Nahkakauppa xD"
},
cloakroom = {
title = "Vaatekaappi ({1})",
undress = {
title = "> Riisu"
}
},
itemtr = {
informer = {
title = "laiton tiedoittaja",
description = "{1} $",
bought = "~g~Sijainti lähetetty GPS:ssääsi."
}
},
mission = {
blip = "Tehtävä ({1}) {2}/{3}",
display = "<span class=\"nimi\">{1}</span> <span class=\"askel\">{2}/{3}</span><br /><br />{4}",
cancel = {
title = "peruuta tehtävä"
}
},
aptitude = {
title = "Kyvyt",
description = "Näytä kyvyt.",
lose_exp = "Kyky ~b~{1}/{2} ~r~-{3} ~s~exp.",
earn_exp = "Kyky ~b~{1}/{2} ~g~+{3} ~s~exp.",
level_down = "kyky ~b~{1}/{2} ~r~menetä tasoa ({3}).",
level_up = "kyky ~b~{1}/{2} ~g~taso ylös ({3}).",
display = {
group = "{1}: ",
aptitude = "--- {1} | exp {2} | lvl {3} | edistyminen {4}%"
}
}
}
return lang
|
local Modules = script.Parent.Parent.Parent
local Roact = require(Modules.Roact)
local StudioThemeAccessor = require(script.Parent.StudioThemeAccessor)
local function Checkbox(props)
local state = Enum.StudioStyleGuideModifier.Default
if props.Disabled then
state = Enum.StudioStyleGuideModifier.Disabled
elseif props.Checked then
state = Enum.StudioStyleGuideModifier.Selected
end
return StudioThemeAccessor.withTheme(function(theme: StudioTheme)
return Roact.createElement("ImageButton", {
Size = UDim2.new(0, 20, 0, 20),
BackgroundColor3 = theme:GetColor("CheckedFieldBackground", state),
BorderColor3 = theme:GetColor("CheckedFieldBorder", state),
AutoButtonColor = false,
Position = props.Position,
AnchorPoint = props.AnchorPoint,
LayoutOrder = props.LayoutOrder,
[Roact.Event.MouseButton1Click] = props.leftClick,
}, {
Check = Roact.createElement("ImageLabel", {
Size = UDim2.new(0, 16, 0, 12),
BackgroundTransparency = 1,
Position = UDim2.new(0.5, 0, 0.5, 0),
AnchorPoint = Vector2.new(0.5, 0.5),
Visible = not not props.Checked,
ImageColor3 = theme:GetColor("CheckedFieldIndicator", state),
Image = props.Checked == true and "rbxassetid://2617163557" or "rbxassetid://6826221991",
}),
})
end)
end
return Checkbox
|
StaticLibrary {
Name = "docking_system",
Env = { CPPPATH = { "include", }, },
Sources = FGlob {
Dir = "core",
Extensions = { ".c", ".h", ".s", ".m" },
Filters = {
{ Pattern = "[/\\]windows[/\\]"; Config = { "win32-*", "win64-*" } },
{ Pattern = "[/\\]macosx[/\\]"; Config = "mac*-*" },
{ Pattern = "[/\\]x11[/\\]"; Config = { "x11-*" } },
},
Recursive = true,
},
Propagate = {
Libs = {
"user32.lib"; Config = "win32-*",
"ws2_32.lib"; Config = "win32-*",
"gdi32.lib"; Config = "win32-*",
},
Frameworks = { "Cocoa" },
},
}
StaticLibrary {
Name = "minifb",
Env = { CPPPATH = { "minifb/include", }, },
Sources = FGlob {
Dir = "minifb/src",
Extensions = { ".cpp", ".c", ".h", ".s", ".m" },
Filters = {
{ Pattern = "[/\\]windows[/\\]"; Config = { "win32-*", "win64-*" } },
{ Pattern = "[/\\]macosx[/\\]"; Config = "mac*-*" },
{ Pattern = "[/\\]x11[/\\]"; Config = { "x11-*" } },
},
Recursive = true,
},
Propagate = {
Libs = {
"user32.lib"; Config = "win32-*",
"ws2_32.lib"; Config = "win32-*",
"gdi32.lib"; Config = "win32-*",
},
Frameworks = { "Cocoa" },
},
}
Program {
Name = "test",
Env = { CPPPATH = { "include", "minifb/include" }, },
Depends = { "docking_system", "minifb" },
Sources = { "tests/test.c" },
Libs = { "X11"; Config = "x11-*" },
}
Default "test"
|
---@meta
---@class cc.ScaleTo :cc.ActionInterval
local ScaleTo={ }
cc.ScaleTo=ScaleTo
---@overload fun(float:float,float:float,float:float):self
---@overload fun(float:float,float:float):self
---@overload fun(float:float,float:float,float:float,float:float):self
---@param duration float
---@param sx float
---@param sy float
---@param sz float
---@return boolean
function ScaleTo:initWithDuration (duration,sx,sy,sz) end
---@overload fun(float:float,float:float,float:float):self
---@overload fun(float:float,float:float):self
---@overload fun(float:float,float:float,float:float,float:float):self
---@param duration float
---@param sx float
---@param sy float
---@param sz float
---@return self
function ScaleTo:create (duration,sx,sy,sz) end
---*
---@param target cc.Node
---@return self
function ScaleTo:startWithTarget (target) end
---*
---@return self
function ScaleTo:clone () end
---*
---@return self
function ScaleTo:reverse () end
---* param time In seconds.
---@param time float
---@return self
function ScaleTo:update (time) end
---*
---@return self
function ScaleTo:ScaleTo () end
|
local co
local function update(self, delta)
--SCREENMAN:SystemMessage(delta)
if coroutine.status(co) ~= "dead" then
coroutine.resume(co)
end
end
local barMaxHeight = 200
local barCurMaxValue = 0
local maxMSD = 40
local MSDTable = {}
for i = 1, maxMSD+1 do
MSDTable[i] = 0
end
local song = GAMESTATE:GetCurrentSong()
local group
if song == nil then
group = GHETTOGAMESTATE.lastSelectedFolder
else
group = song:GetGroupName()
end
local function updateFromGroup()
local songs = SONGMAN:GetSongsInGroup(group)
local steps
local numSongs = #songs
local numSteps = 0
for k,v in ipairs(songs) do
local steps = v:GetAllSteps()
numSteps = numSteps + #steps
for k2, v2 in ipairs(steps) do
local msd = v2:GetMSD(getCurRateValue(), 1)
if msd > maxMSD then
MSDTable[maxMSD+1] = MSDTable[maxMSD+1]+ 1
barCurMaxValue = math.max(barCurMaxValue, MSDTable[maxMSD+1])
else
MSDTable[math.floor(msd)+1] = MSDTable[math.floor(msd)+1] + 1
barCurMaxValue = math.max(barCurMaxValue, MSDTable[math.floor(msd)+1])
end
end
MESSAGEMAN:Broadcast("Yield", {numSongs = k, numSteps = numSteps})
coroutine.yield()
end
MESSAGEMAN:Broadcast("Update", {group = group, numSongs = numSongs, numSteps = numSteps})
end
local function input(event)
if event.type == "InputEventType_FirstPress" then
if event.button == "Back" or event.button == "Start" then
SCREENMAN:GetTopScreen():Cancel()
end
end
return false
end
local pn = GAMESTATE:GetEnabledPlayers()[1]
local frameWidth = SCREEN_WIDTH - 20
local frameHeight = 40
local function topRow()
local t = Def.ActorFrame{
}
t[#t+1] = Def.Quad{
InitCommand = function(self)
self:zoomto(frameWidth, frameHeight)
self:diffuse(color("#000000")):diffusealpha(0.8)
end
}
t[#t+1] = Def.Sprite {
Name = "Banner",
InitCommand = function(self)
self:x(-frameWidth/2 + 5)
self:halign(0)
self:scaletoclipped(96, 30)
local bnpath = SONGMAN:GetSongGroupBannerPath(group)
if not bnpath or bnpath == "" then
bnpath = THEME:GetPathG("Common", "fallback banner")
end
self:LoadBackground(bnpath)
end
}
t[#t+1] = LoadFont("Common BLarge") .. {
Name = "SongTitle",
InitCommand = function(self)
self:xy(-frameWidth/2 + 96 +10, -2)
self:zoom(0.3)
self:halign(0)
self:settext(group)
end
}
t[#t+1] = LoadFont("Common Normal") .. {
InitCommand = function(self)
self:xy(frameWidth/2-5,9)
self:zoom(0.35)
self:halign(1)
self:playcommand("Set")
end,
YieldMessageCommand = function(self, params)
self:settextf("%d Songs / %d Steps", params.numSongs, params.numSteps)
end
}
return t
end
local function barGraphBars(i)
local t = Def.ActorFrame{
InitCommand = function(self)
self:xy(20*i,SCREEN_HEIGHT-50)
end
}
t[#t+1] = Def.Quad{
InitCommand = function(self)
self:y(-5)
self:diffuse(getMSDColor(i))
self:valign(1)
end,
YieldMessageCommand = function(self)
self:zoomto(10,MSDTable[i]/barCurMaxValue*barMaxHeight)
end
}
t[#t+1] = LoadFont("Common Normal") .. {
YieldMessageCommand = function(self)
self:zoom(0.4)
self:diffuse(color("#000000"))
self:settextf("%d", MSDTable[i])
end
}
t[#t+1] = LoadFont("Common Normal") .. {
InitCommand = function(self)
self:y(10)
self:zoom(0.4)
self:diffuse(getMSDColor(i))
if i == 1 then
self:settext("N/A")
elseif i == maxMSD+1 then
self:settextf("%d+", i-1)
else
self:settextf("%d", i-1)
end
end
}
return t
end
local top
local t = Def.ActorFrame {
OnCommand = function(self)
self:SetUpdateFunction(update)
top = SCREENMAN:GetTopScreen()
top:AddInputCallback(input)
co = coroutine.create(updateFromGroup)
SCREENMAN:GetTopScreen():AddInputCallback(MPinput)
end
}
t[#t+1] = topRow() .. {
InitCommand = function(self)
self:xy(SCREEN_CENTER_X, 50)
end
}
for i=1, maxMSD+1 do
t[#t+1] = barGraphBars(i)
end
t[#t+1] = LoadActor("../_mouse", "ScreenGroupInfo")
t[#t+1] = LoadActor("../_frame")
--[[
local tab = TAB:new({"Difficulty Distribution"})
t[#t+1] = tab:makeTabActors() .. {
OnCommand = function(self)
self:y(SCREEN_HEIGHT+tab.height/2)
self:easeOut(0.5)
self:y(SCREEN_HEIGHT-tab.height/2)
end,
OffCommand = function(self)
self:y(SCREEN_HEIGHT+tab.height/2)
end,
TabPressedMessageCommand = function(self, params)
end
}
]]
t[#t+1] = LoadActor("../_cursor")
return t
|
index_valuemd5_mapping_tbl = {}
valuemd5_index_mapping_tbl = {}
DEBUG = false
DISPLAY_BYTES = 120
NOTE_PREFIX = "note_"
INDEX_FILENAME = "index"
function debug_print(fmt, ...)
local t = {...}
if DEBUG then
print(fmt, unpack(t))
end
end
function dump_indexs()
for key, md5_tbl in pairs(index_valuemd5_mapping_tbl) do
print(string.format("%s %s", key, table.concat(md5_tbl, ",")))
end
end
function add_note(tagname, md5)
local function update_mapping(array, value)
local need_insert = true
for _, v in pairs(array) do
if v == value then
need_insert = false
end
end
if need_insert then
table.insert(array, value)
end
end
index_valuemd5_mapping_tbl[tagname] = index_valuemd5_mapping_tbl[tagname] or {}
update_mapping(index_valuemd5_mapping_tbl[tagname], md5)
valuemd5_index_mapping_tbl[md5] = valuemd5_index_mapping_tbl[md5] or {}
update_mapping(valuemd5_index_mapping_tbl[md5], tagname)
if DEBUG then
table.print(index_valuemd5_mapping_tbl)
table.print(valuemd5_index_mapping_tbl)
end
end
-- add multi tag mapping to one note
function add_notes(tagnames, md5)
local tagname_tbl = string.split(tagnames, " ")
for _, tagname in ipairs(tagname_tbl) do
add_note(tagname, md5)
end
end
function rm_note(tagname, md5)
local function update_mapping(array, value)
local need_remove = 0
for idx, v in ipairs(array) do
if v == value then
need_remove = idx
break
end
end
if need_remove > 0 then
table.remove(array, need_remove)
end
end
index_valuemd5_mapping_tbl[tagname] = index_valuemd5_mapping_tbl[tagname] or {}
update_mapping(index_valuemd5_mapping_tbl[tagname], md5)
valuemd5_index_mapping_tbl[md5] = valuemd5_index_mapping_tbl[md5] or {}
update_mapping(valuemd5_index_mapping_tbl[md5], tagname)
end
function load_indexs(base, index_filename)
debug_print("index filename=", index_filename, base, type(base))
local filename = base .. "/" .. index_filename
debug_print("filename=", filename)
local f = io.open(filename)
assert(f)
for line in f:lines() do
debug_print("line data:", line)
local key_values = string.split(line, " ")
local key = key_values[1]
local md5_strings = key_values[2]
if key and md5_strings then
local md5_tbl = string.split(md5_strings, ",")
-- fill index -- values mapping
if not table.empty(md5_tbl) then
index_valuemd5_mapping_tbl[key] = md5_tbl
end
-- fill md5 values -- index mapping
for _, md5 in pairs(md5_tbl) do
if md5 and string.len(md5) > 0 then
valuemd5_index_mapping_tbl[md5] = valuemd5_index_mapping_tbl[md5] or {}
table.insert(valuemd5_index_mapping_tbl[md5], key)
end
end
end
end
if DEBUG then
table.print(index_valuemd5_mapping_tbl)
table.print(valuemd5_index_mapping_tbl)
end
io.close(f)
end
function foreach_note(base, cb, ...)
if not base and not cb then
return
end
for tagname, md5_tbl in pairs(index_valuemd5_mapping_tbl) do
for index, md5 in ipairs(md5_tbl) do
local content, raw_tbl = getnote(base, md5)
if content and raw_tbl then
cb(tagname, md5, index, content, raw_tbl, ...)
end
end
end
end
function create_note_tbl(index, md5, content, raw_tbl)
return {
index = index,
md5 = md5,
content = content,
raw_tbl = raw_tbl,
}
end
function list_notes(base, tagname)
local notes_tbl = {}
local md5_tbl = index_valuemd5_mapping_tbl[tagname]
if not md5_tbl then
return notes_tbl
end
for index, md5 in ipairs(md5_tbl) do
local content, raw_tbl = getnote(base, md5)
if content and raw_tbl then
local note_tbl = create_note_tbl(index, md5, content, raw_tbl)
table.insert(notes_tbl, note_tbl)
end
end
return notes_tbl
end
function list_all_notes(base)
local result_tbl = {}
for key, md5_tbl in pairs(index_valuemd5_mapping_tbl) do
local note_tbl = list_notes(base, key)
result_tbl[key] = note_tbl
end
return result_tbl
end
-- the format: tag@idx1#line, e.g. "ssh@1" or "ssh@1#2"
function split_file_sign(file_sign)
local file_and_location = string.split(file_sign, "@")
if table.size(file_and_location) ~= 2 then
return
end
local tag = file_and_location[1]
local target_tbl = string.split(file_and_location[2], "#")
local target_idx = tonumber(target_tbl[1])
local target_line = tonumber(target_tbl[2]) -- this may be missed
if not target_idx or target_idx < 1 then
return
end
return tag, target_idx, target_line
end
function searchkey(tag, target_idx)
if not tag or not target_idx then
return
end
local md5_tbl = index_valuemd5_mapping_tbl[tag]
if md5_tbl and not table.empty(md5_tbl) then
for index, md5 in ipairs(md5_tbl) do
if index == target_idx then
return md5
end
end
end
end
function getnote(base, md5)
if base and md5 then
local content, raw_tbl = load_file(base .. "/" .. NOTE_PREFIX .. md5)
return content, raw_tbl
end
end
function update_md5(tagname, old_md5, new_md5)
local md5_tbl = index_valuemd5_mapping_tbl[tagname]
if not md5_tbl then
return false
end
for index, md5 in ipairs(md5_tbl) do
if md5 == old_md5 then
md5_tbl[index] = new_md5
end
end
end
function clear_find_tags(find_tags_tbl)
for tagname, ismark in pairs(find_tags_tbl) do
find_tags_tbl[tagname] = false
end
end
function is_all_match(find_tags_tbl)
for _, ismark in pairs(find_tags_tbl) do
if ismark == false then
return false;
end
end
return true
end
function is_any_match(find_tags_tbl)
for _, ismark in pairs(find_tags_tbl) do
if ismark == true then
return true
end
end
return false
end
function find_note(base, find_tags)
local result_tbl = {}
local function match_tags(content)
for tag, is_match in pairs(find_tags) do
local i, j = string.find(content, tag)
if i then
-- we match a tag, then mark this as true
find_tags[tag] = true
end
end
end
local function each_note_process(tagname, md5, index, content, raw_tbl)
local lower_cont = string.lower(content)
local lower_tagname = string.lower(tagname)
-- start match, both tagname and content
clear_find_tags(find_tags)
match_tags(lower_tagname)
match_tags(lower_cont)
if is_all_match(find_tags) then
result_tbl[tagname] = result_tbl[tagname] or {}
local note_tbl = create_note_tbl(index, md5, content, raw_tbl)
table.insert(result_tbl[tagname], note_tbl)
end
end
foreach_note(base, each_note_process)
return result_tbl
end
function is_empty_line(line)
local trimed_line = string.trim(line)
if string.len(trimed_line) == 0 then
return true
end
return false
end
function is_valid_line(line)
if is_empty_line(line) then
return false
end
local trimed_line = string.trim(line)
local location = string.find(trimed_line, "#")
if location ~= 1 then
return true
end
return false
end
function dump_note_tbl(note_tbl)
local index = note_tbl.index
local content = note_tbl.content
local raw_tbl = note_tbl.raw_tbl
local real_lineno = 0
local valid_lineno = 0
local index_sign = ""
for lineno, line in ipairs(raw_tbl) do
if not is_empty_line(line) then
valid_lineno = valid_lineno + 1
if valid_lineno == 1 then
index_sign = string.format("@%d", index)
else
index_sign = " "
end
if is_valid_line(line) then
real_lineno = real_lineno + 1
local display = string.format(" |- %s #%d: %s", index_sign, real_lineno, line)
if DISPLAY_BYTES > 0 and string.len(display) > DISPLAY_BYTES then
display = string.sub(display, 1, DISPLAY_BYTES) .. "..."
end
print(display)
else
print(string.format(" |- %s : %s", index_sign, line))
end
end
end
end
function dump_notes_tbl(tagname, notes_tbl)
if not table.empty(notes_tbl) then
-- print tagname
print(string.format("%s", tagname))
for _, note in ipairs(notes_tbl) do
dump_note_tbl(note)
end
end
end
function dump_result_tbl(result_tbl)
for tagname, notes_tbl in pairs(result_tbl) do
dump_notes_tbl(tagname, notes_tbl)
end
end
function dump_raw_info_all(content, raw_tbl, target_lineno)
print(string.format("%s", content))
end
function dump_raw_info_byline(raw_tbl, target_lineno)
local real_lineno = 0
for _, line in ipairs(raw_tbl) do
if is_valid_line(line) then
-- this is a valid line, which can run in the shell
real_lineno = real_lineno + 1
if real_lineno == target_lineno then
print(string.format("%s", line))
end
end
end
end
function dump_raw_info(content, raw_tbl, target_lineno)
if target_lineno and target_lineno >= 1 then
return dump_raw_info_byline(raw_tbl, target_lineno)
end
return dump_raw_info_all(content)
end
function get_unuseful_files(base, file_list)
local files_tbl = string.split(file_list, "\n")
local mark_tbl = {}
local unuseful = {}
for key, filename in pairs(files_tbl) do
mark_tbl[filename] = false
end
for md5, key_tbl in pairs(valuemd5_index_mapping_tbl) do
local filename = NOTE_PREFIX..md5
mark_tbl[filename] = true
end
for filename, useful in pairs(mark_tbl) do
if not useful then
table.insert(unuseful, filename)
end
end
return unuseful
end
function dump_tags_info(result_tbl, show_detail)
for tagname, notes_tbl in pairs(result_tbl) do
if not table.empty(notes_tbl) then
if show_detail then
print(string.format("%s %d", tagname, table.size(notes_tbl)))
else
print(string.format("%s", tagname))
end
end
end
end
if ( not arg[1] ) then
print("missing binary top arg")
return
end
if not arg[2] then
print("missing action arg")
return
end
if DEBUG then
table.print(arg)
end
package.path = package.path .. ";" .. arg[1] .. "/?.lua"
require("magicnote_util")
if arg[2] == "add" then
local base = arg[3]
local index_filename = arg[4]
local md5 = arg[5]
local tagnames = arg[6]
load_indexs(base, index_filename)
add_notes(tagnames, md5)
dump_indexs()
elseif arg[2] == "list" then
local base = arg[3]
local index_filename = arg[4]
DISPLAY_BYTES = tonumber(arg[5])
local tagname = arg[6]
load_indexs(base, index_filename)
if not tagname then
local result_tbl = list_all_notes(base)
dump_result_tbl(result_tbl)
else
local notes_tbl = list_notes(base, tagname)
dump_notes_tbl(tagname, notes_tbl)
end
elseif arg[2] == "searchkey" then
local base = arg[3]
local index_filename = arg[4]
local file_sign = arg[5]
load_indexs(base, index_filename)
local tag, target_idx, target_line = split_file_sign(file_sign)
local md5 = searchkey(tag, target_idx)
if not md5 then
return
end
if not target_line then
print(string.format("%s %s", tag, md5))
else
print(string.format("%s %s %d", tag, md5, target_line))
end
elseif arg[2] == "rm" then
local base = arg[3]
local index_filename = arg[4]
local file_sign = arg[5]
load_indexs(base, index_filename)
local tag, target_idx = split_file_sign(file_sign)
local md5 = searchkey(tag, target_idx)
if not md5 then
return
end
rm_note(tag, md5)
dump_indexs()
elseif arg[2] == "updatemd5" then
local base = arg[3]
local index_filename = arg[4]
local tagname = arg[5]
local old_md5 = arg[6]
local new_md5 = arg[7]
load_indexs(base, index_filename)
update_md5(tagname, old_md5, new_md5)
dump_indexs()
elseif arg[2] == "find" then
local base = arg[3]
local index_filename = arg[4]
DISPLAY_BYTES = tonumber(arg[5])
local find_tags_size = table.size(arg) - 5 - 2
if find_tags_size == 0 then
return
else
local find_tags = {}
for i=6, 6+find_tags_size-1 do
find_tags[string.lower(arg[i])] = false -- first, mark all tags false
end
load_indexs(base, index_filename)
local result_tbl = find_note(base, find_tags)
dump_result_tbl(result_tbl)
end
elseif arg[2] == "getnote" then
local base = arg[3]
local index_filename = arg[4]
local file_sign = arg[5]
load_indexs(base, index_filename)
local tag, target_idx, target_line = split_file_sign(file_sign)
local md5 = searchkey(tag, target_idx)
if not md5 then
return
end
local content, raw_tbl = getnote(base, md5)
if content and raw_tbl then
dump_raw_info(content, raw_tbl, target_line)
end
elseif arg[2] == "gc" then
local base = arg[3]
local index_filename = arg[4]
local file_list = arg[5]
load_indexs(base, index_filename)
local unuseful = get_unuseful_files(base, file_list)
for _, filename in pairs(unuseful) do
print(string.format("%s", filename))
end
elseif arg[2] == "showtags" then
local base = arg[3]
local index_filename = arg[4]
local show_detail = arg[5]
load_indexs(base, index_filename)
local result_tbl = list_all_notes(base)
dump_tags_info(result_tbl, show_detail)
end
|
--ZW-天風精靈翼
--Script by XyLeN
function c100278025.initial_effect(c)
c:SetUniqueOnField(1,0,100278025)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100278025,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_HAND+LOCATION_MZONE)
e1:SetCondition(c100278025.eqcon)
e1:SetTarget(c100278025.eqtg)
e1:SetOperation(c100278025.eqop)
c:RegisterEffect(e1)
--atk up
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100278025,1))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCondition(c100278025.atkcon)
e2:SetOperation(c100278025.atkop)
c:RegisterEffect(e2)
--remove overlay replace
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100278025,2))
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_OVERLAY_REMOVE_REPLACE)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c100278025.repcon)
e3:SetOperation(c100278025.repop)
c:RegisterEffect(e3)
end
function c100278025.eqcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():CheckUniqueOnField(tp)
end
function c100278025.eqfilter(c)
return c:IsFaceup() and c:IsSetCard(0x107f)
end
function c100278025.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c100278025.eqfilter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c100278025.eqfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c100278025.eqfilter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c100278025.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return end
local tc=Duel.GetFirstTarget()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:GetControler()~=tp or tc:IsFacedown() or not tc:IsRelateToEffect(e) or not c:CheckUniqueOnField(tp) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
c100278025.zw_equip_monster(c,tp,tc)
end
function c100278025.zw_equip_monster(c,tp,tc)
if not Duel.Equip(tp,c,tc) then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(c100278025.eqlimit)
e1:SetLabelObject(tc)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(800)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
end
function c100278025.eqlimit(e,c)
return c==e:GetLabelObject()
end
function c100278025.cfilter(c,tp)
return c:IsSummonPlayer(1-tp) and Duel.GetCurrentChain()>0
end
function c100278025.atkcon(e,tp,eg,ep,ev,re,r,rp)
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c100278025.cfilter,1,nil,tp)
end
function c100278025.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(1600)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
function c100278025.repcon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_COST)~=0 and re:IsActivated() and re:IsActiveType(TYPE_XYZ) and re:GetHandler():GetOverlayCount()>=ev-1
and e:GetHandler():GetEquipTarget()==re:GetHandler() and e:GetHandler():IsAbleToGraveAsCost() and ep==e:GetOwnerPlayer()
end
function c100278025.repop(e,tp,eg,ep,ev,re,r,rp)
return Duel.SendtoGrave(e:GetHandler(),POS_FACEUP,REASON_COST)
end
|
Object = {}
-- Metamethods
function Object:__call(...)
return self:new(...)
end
-- Constructor
function Object:__new()
end
-- Static Methods
function Object.__cast(o, m)
setmetatable(o, m)
m.__index = m
m.__call = Object.__call
return o
end
-- Methods
function Object:new(...)
local o = {}
Object.__cast(o, self)
o:__new(...)
return o
end
Object = Object:new()
|
-- Copyright (C) 2020-2022 Dmitrii Maximenko <d.s.maximenko@gmail.com>
-- Use of this source code is governed by an MIT-style
-- license that can be found in the LICENSE file or at
-- https://opensource.org/licenses/MIT
ffi = require("ffi")
ffi.cdef[[
void sb_event_start(int thread_id);
void sb_event_stop(int thread_id);
bool sb_more_events(int thread_id);
double sb_rand_uniform_double(void);
static double sb_rand_exp(double lambda, double uniform_parameter)
{
return -lambda * log(1 - uniform_parameter);
}
typedef struct timeval {
long tv_sec;
long tv_usec;
} timeval;
int gettimeofday(struct timeval* t, void* tzp);
int usleep(unsigned int usec);
]]
gettimeofday_struct = ffi.new("struct timeval")
local function gettimeofday()
ffi.C.gettimeofday(gettimeofday_struct, nil)
return tonumber(gettimeofday_struct.tv_sec) * 1000000 + tonumber(gettimeofday_struct.tv_usec)
end
-- ----------------------------------------------------------------------
-- This event loop can work with muliple groups of threads.
-- For that purpose global variable 'thread_groups' should
-- be defined in benchmark script.end
-- thread_groups = {{id=i, event=func1, rate_controller=func2, rate=k, thread_amount=n}, {}, ...}
-- id is any number or string.
-- func1 is function as event(), func2 is functions witch controls sleeps period (optional),
-- n is amount of threads in the group (im sum of groups threads_amount less then in --threads
-- than all other threads go to the last group)
-- rate is integer corresponding rate of the thread
-- ----------------------------------------------------------------------
function thread_run(thread_id)
while ffi.C.sb_more_events(thread_id) do
ffi.C.sb_event_start(thread_id)
local event_func = nil
local rate_controller_func = nil
local rate = 0
local acc = 0
for i = 1, #thread_groups
do
acc = acc + thread_groups[i].thread_amount
if thread_id < acc
then
event_func = thread_groups[i].event
rate_controller_func = thread_groups[i].rate_controller
rate = thread_groups[i].rate
break
end
-- if total amount of threads more then sum of amounts in groups
-- all other threads rely to the last group
if i == #thread_groups
then
event_func = thread_groups[i].event
rate_controller_func = thread_groups[i].rate_controller
rate = thread_groups[i].rate
end
end
local success, ret
repeat
success, ret = pcall(event_func, thread_id)
if not success then
if type(ret) == "table" and
ret.errcode == sysbench.error.RESTART_EVENT
then
if sysbench.hooks.before_restart_event then
sysbench.hooks.before_restart_event(ret)
end
else
error(ret, 2) -- propagate unknown errors
end
end
until success
-- Stop the benchmark if event() returns a value other than nil or false
if ret then
break
end
ffi.C.sb_event_stop(thread_id)
-- It supposed that rete controller return execution flow after some pause
if rate_controller_func ~= nil and rate > 0
then
pcall(rate_controller_func, rate)
end
end
end
-- This function controls rate of thread's events in that way:
-- It stores the last time it was called and calculate random
-- exponentially distributed interval to the next event (with median 1sec/rate).
-- When it called again it measure time and if it passed less time then 'inteval'
-- it sleeps for the rest part of interval.
function default_rate_controller(rate)
local Tcur = gettimeofday()
local lambda = 1e6 / rate
local uniform_parameter = ffi.C.sb_rand_uniform_double()
local interval = -lambda * math.log(uniform_parameter)
if Tnext == nil
then
Tnext = Tcur + interval
else
Tnext = Tnext + interval
if Tnext > Tcur
then
ffi.C.usleep(Tnext - Tcur);
end
end
end
|
pg = pg or {}
pg.activity_skirmish_event = {
[101] = {
event = "1242017",
name = "P1-演习",
type = 1,
id = 101,
task_id = 16500,
award_display = {}
},
[102] = {
event = "1250031",
name = "P2-护航",
type = 2,
id = 102,
task_id = 16501,
award_display = {}
},
[103] = {
event = "FENGBAOQIANXI3",
name = "P3-任务",
type = 1,
id = 103,
task_id = 16502,
award_display = {}
},
[104] = {
event = "1250032",
name = "P4-合流",
type = 2,
id = 104,
task_id = 16503,
award_display = {}
},
[105] = {
event = "1250033",
name = "P5-扫荡",
type = 2,
id = 105,
task_id = 16504,
award_display = {}
},
[106] = {
event = "FENGBAOQIANXI7",
name = "P6-干扰",
type = 1,
id = 106,
task_id = 16505,
award_display = {}
},
[107] = {
event = "1250034",
name = "P7-联络",
type = 2,
id = 107,
task_id = 16506,
award_display = {}
},
all = {
101,
102,
103,
104,
105,
106,
107
}
}
return
|
turtle.select(1)
while true do
while not turtle.detect() do
turtle.forward()
local slot = turtle.getSelectedSlot()
if turtle.getItemCount(slot) < 1 then
turtle.select(slot+1)
end
if not turtle.detectDown() then
turtle.placeDown()
end
end
local slot = turtle.getSelectedSlot()
if turtle.getItemCount(slot) < 1 then
turtle.select(slot+1)
end
turtle.up()
turtle.turnLeft()
turtle.turnLeft()
turtle.placeDown()
end
|
local assets = require "src/common/assets"
local sceneManager = require 'src/common/sceneManager'
local dictionary = require 'src/common/dictionary'
local drawUtils = require 'src/common/drawUtils'
local globals = require 'src/common/globals'
local colors = require 'src/common/colors'
local buttonManager = (require 'src/components/buttonManager').new()
local screen = {};
local fromSettings = false;
local titleFont
local music
local function goToNextScreen()
if fromSettings then
sceneManager.changeScene(require 'src/menu/settings')
else
sceneManager.changeScene(require 'src/menu/mainMenu')
end
end
local function chooseEnglish()
globals.language = 'en'
goToNextScreen()
end
local function choosePortuguese()
globals.language = 'pt'
goToNextScreen()
end
function screen.load(comingFromSettings)
love.graphics.setBackgroundColor(colors.gray)
fromSettings = comingFromSettings
titleFont = assets.bigFont
buttonManager:load()
buttonManager:newImageButton({
fn = chooseEnglish,
x = 200,
y = 250,
image = assets.flagUK,
imageWidth = 1024,
imageHeight = 512,
scaleX = 0.25,
scaleY = 0.25,
})
buttonManager:newImageButton({
fn = choosePortuguese,
x = 550,
y = 250,
image = assets.flagBR,
imageWidth = 1024,
imageHeight = 716,
scaleX = 0.25,
scaleY = 0.18,
})
music = assets.menuMusic
music:play()
end
function screen.unload()
buttonManager:unload()
music:pause()
end
function screen.update(dt)
buttonManager:update(dt)
end
function screen.draw()
love.graphics.setColor(1, 1, 1)
local enText = 'Choose your language'
drawUtils.drawTextRectangle({
font = titleFont,
posX = globals.baseScreenWidth / 2 - titleFont:getWidth(enText) / 2,
posY = 50,
text = 'Choose your language',
})
local ptText = 'Escolha sua língua'
drawUtils.drawTextRectangle({
font = titleFont,
posX = globals.baseScreenWidth / 2 - titleFont:getWidth(ptText) / 2,
posY = 100,
text = ptText,
})
buttonManager:draw()
end
function screen.mousereleased(_, _, button)
buttonManager:mouseReleased(button)
end
return screen;
|
local old_print, old_printError = print, printError
local function log(x)
local a = fs.open("log.txt", "a")
a.writeLine(x)
a.close()
end
local function print(msg)
old_print(msg)
log(msg)
commands.say(msg)
end
local function printError(msg)
old_printError(msg)
log(msg)
commands.say(msg)
end
--- Waits for one or more commands to finish, and verifies they have all been executed successfully.
--
-- @usage commands.wait { commands.async.say("Testing"), commands.async.say("things!") }
function commands.wait(commands)
local n, remaining = #commands, {}
for i = 1, n do
remaining[commands[i]] = i
end
while n > 0 do
local _, id, ok, res = os.pullEvent("task_complete")
local i = remaining[id]
if i then
n = n - 1
remaining[id] = nil
if not ok then
error(("Command %d failed: %s"):format(i, res), 2)
end
end
end
end
local ok, err = pcall(function()
print("Booting test monitor")
if not fs.exists("cloud.lua") then
local request, err = http.get("https://cloud-catcher.squiddev.cc/cloud.lua")
if not request then
printError(("Cannot load cloud-catcher (%s)"):format(err))
else
local contents = request.readAll()
request.close()
local handle = fs.open("cloud.lua", "w")
handle.write(contents)
handle.close()
print("Fetched cloud-catcher")
end
end
print(("Run '/computercraft queue #%d cloud|test' to control the test runner"):format(os.getComputerID()))
while true do
local command = table.pack(os.pullEvent("computer_command"))
if command[2] == "cloud" then
if cloud then
printError("Already running cloud-catcher")
else
local token = command[3]
if not token then
-- Generate a random token.
local tok_items = {}
for i = 1, 32 do
local idx = math.random(36)
tok_items[i] = ("abcdefghijklmnopqrstuvwxyz0123456789"):sub(idx, idx)
end
token = table.concat(tok_items)
end
print(("Visit https://cloud-catcher.squiddev.cc/?id=%s to control the computer"):format(token))
shell.run("bg", "cloud.lua", "-t80x30", token)
end
elseif command[2] == "test" then
print("Running tests")
shell.run("test-rom/mcfly.lua test-rom/spec")
else
printError("Unknown command")
end
end
end)
if not ok then
printError(tostring(err))
end
os.shutdown()
|
local async = require('lualine.async')
local git_branch
local get_git_branch = async:new({
cmd = 'git branch --show-current',
on_stdout = function(_, data)
if data then
git_branch = data:gsub('\n', '')
end
end,
on_stderr = function (_, data)
if data then
if data:find("fatal: not a git repository") then
git_branch = ''
end
end
end,
})
local timer = vim.loop.new_timer()
timer:start(0, 1000, vim.schedule_wrap(function()
local cur_dir = vim.fn.getcwd()
local buffer_working_directory = vim.fn.expand("%:p:h")
local status, _ = pcall(vim.api.nvim_set_current_dir, buffer_working_directory)
if status == true then
get_git_branch:start()
vim.api.nvim_set_current_dir(cur_dir)
end
end))
local function branch()
if not git_branch or #git_branch == 0 then return '' end
local ok,devicons = pcall(require,'nvim-web-devicons')
if ok then
local icon = devicons.get_icon('git')
if icon ~= nil then
return icon .. ' ' .. git_branch
end
return git_branch
end
ok = vim.fn.exists("*WebDevIconsGetFileTypeSymbol")
if ok ~= 0 then
local icon = ''
return icon .. ' ' .. git_branch
end
return git_branch
end
return branch
|
--[[
Copyright 2020 Manticore Games, Inc.
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.
--]]
--[[
This component introduces concept of Level and XP to player.
The player level is increased based on required XP threshold. Both Level and XP are set as resources.
As part of pregression, with each level increase player also gets max HP increased.
Open the "Levels List" group in hierarchy that comes with this component to edit the progression per level.
Level and XP resources can be named differently if needed.
--]]
-- Internal custom properties
local COMPONENT_ROOT = script:GetCustomProperty("ComponentRoot"):WaitForObject()
local LEVELS_LIST = script:GetCustomProperty("LevelsList"):WaitForObject()
-- User exposed properties
local LEVEL_RESOURCE = COMPONENT_ROOT:GetCustomProperty("LevelResource")
local XP_RESOURCE = COMPONENT_ROOT:GetCustomProperty("XPResource")
-- Internal variables
local levelsTable = {}
-- nil Init()
-- Create the table of level information from the LEVELS_LIST group
function Init()
for _, child in ipairs(LEVELS_LIST:GetChildren()) do
local requiredXP = child:GetCustomProperty("RequiredXP")
local maxHP = child:GetCustomProperty("MaxHP")
table.insert(levelsTable,
{
requiredXP = requiredXP,
maxHP = maxHP
})
end
end
-- int GetPlayerLevel(Player)
-- Get player level based on current XP resource
function GetPlayerLevel(player)
local resultLevel = 1
local currentXP = player:GetResource(XP_RESOURCE)
for i, levelInfo in ipairs(levelsTable) do
if currentXP >= levelInfo.requiredXP then
resultLevel = i
end
end
return resultLevel
end
-- nil SetNewMaxHealth(Player)
-- Set player max HP based on level
function SetNewMaxHealth(player)
local currentLevel = player:GetResource(LEVEL_RESOURCE)
player.hitPoints = levelsTable[currentLevel].maxHP
player.maxHitPoints = levelsTable[currentLevel].maxHP
end
-- nil UpdatePlayerLevel(Player)
-- Check and update player level resource
function UpdatePlayerLevel(player)
local currentLevel = player:GetResource(LEVEL_RESOURCE)
local nextLevel = GetPlayerLevel(player)
if nextLevel ~= currentLevel then
player:SetResource(LEVEL_RESOURCE, nextLevel)
SetNewMaxHealth(player)
end
end
-- nil OnResourceChanged(Player, string, number)
-- Checking if the XP resource is changed to update the level
function OnResourceChanged(player, resource, value)
if resource == XP_RESOURCE then
UpdatePlayerLevel(player)
end
end
-- nil OnPlayerJoined(Player)
-- Register resource changed event and update player level
function OnPlayerJoined(player)
player.resourceChangedEvent:Connect(OnResourceChanged)
-- Short wait time to load level data and player max HP
Task.Wait(.1)
UpdatePlayerLevel(player)
SetNewMaxHealth(player)
end
-- Initialize
Init()
Game.playerJoinedEvent:Connect(OnPlayerJoined)
|
-- math.lua: math-related utilities
-- This file is a part of lua-nucleo library
-- Copyright (c) lua-nucleo authors (see file `COPYRIGHT` for the license)
local math_ceil, math_floor = math.ceil, math.floor
--
-- Drops fractional part of a number
--
-- trunc(1.x) --> 1
-- trunc(-1.x) --> -1
--
-- ceil(1.x) --> 2
-- ceil(-1.x) --> -1
--
-- floor(1.x) --> 1
-- floor(-1.x) --> -2
--
-- TODO: Why not 'return (math.modf(n))'? Do benchmark.
local trunc = function(n)
return ((n < 0) and math_ceil or math_floor)(n)
end
return
{
trunc = trunc;
}
|
local capi = { client = client , mouse = mouse ,
screen = screen , keygrabber = keygrabber,}
local setmetatable = setmetatable
local ipairs = ipairs
local util = require( "awful.util" )
local client = require( "awful.client" )
local alayout = require( "awful.layout" )
local wibox = require( "wibox" )
local cairo = require( "lgi" ).cairo
local beautiful = require( "beautiful" )
local color = require( "gears.color" )
local module = {}
local wiboxes,delta = nil,100
---------------- Visual -----------------------
local function gen(item_height)
local img = cairo.ImageSurface(cairo.Format.ARGB32, item_height,item_height)
local cr = cairo.Context(img)
local rad = 10
cr:set_source_rgba(0,0,0,0)
cr:paint()
cr:set_source_rgba(1,1,1,1)
cr:arc(rad,rad,rad,0,2*math.pi)
cr:arc(item_height-rad,rad,rad,0,2*math.pi)
cr:arc(rad,item_height-rad,rad,0,2*math.pi)
cr:arc(item_height-rad,item_height-rad,rad,0,2*math.pi)
cr:fill()
cr:rectangle(0,rad, item_height, item_height-2*rad)
cr:rectangle(rad,0, item_height-2*rad, item_height)
cr:fill()
return img._native
end
local function constructor(width)
local img = cairo.ImageSurface(cairo.Format.ARGB32, width, width)
local cr = cairo.Context(img)
cr:move_to(0,0)
cr:set_source(color(beautiful.fg_normal))
cr:paint()
cr:set_source(color(beautiful.bg_normal))
cr:set_antialias(1)
cr:rectangle(0, (width/2), 10, (width/2))
cr:rectangle(width-10, (width/2), 10, (width/2))
for i=0,(width/2) do
cr:rectangle(i, 0, 1, (width/2)-i)
cr:rectangle(width-i, 0, 1, (width/2)-i)
end
cr:fill()
return cairo.Pattern.create_for_surface(img)
end
local function init()
local bounding,arrow = gen(75),constructor(55)
wiboxes = {}
for k,v in ipairs({"up","right","down","left","center"}) do
wiboxes[v] = wibox({})
wiboxes[v].height = 75
wiboxes[v].width = 75
wiboxes[v].ontop = true
if v ~= "center" then
local ib,m = wibox.widget.imagebox(),wibox.layout.margin()
local img = cairo.ImageSurface(cairo.Format.ARGB32, 55, 55)
local cr = cairo.Context(img)
cr:translate(55/2,55/2)
cr:rotate((k-1)*(2*math.pi)/4)
cr:translate(-(55/2),-(55/2))
cr:set_source(arrow)
cr:paint()
ib:set_image(img)
m:set_margins(10)
m:set_widget(ib)
wiboxes[v]:set_widget(m)
wiboxes[v].shape_bounding = bounding
end
end
wiboxes["center"]:set_bg(beautiful.bg_urgent)
local img = cairo.ImageSurface(cairo.Format.ARGB32, 75,75)
local cr = cairo.Context(img)
cr:set_source_rgba(0,0,0,0)
cr:paint()
cr:set_source_rgba(1,1,1,1)
cr:arc( 75/2,75/2,75/2,0,2*math.pi )
cr:fill()
wiboxes["center"].shape_bounding = img._native
end
local function display_wiboxes(cltbl,geomtbl,float,swap,c)
if not wiboxes then
init()
end
for k,v in ipairs({"left","right","up","down","center"}) do
local next_clients = (not (float and swap)) and cltbl[util.get_rectangle_in_direction(v , geomtbl, capi.client.focus:geometry())] or c
if next_clients or k==5 then
local same, center = capi.client.focus == next_clients,k==5
local geo = center and capi.client.focus:geometry() or next_clients:geometry()
wiboxes[v].visible = true
wiboxes[v].x = (swap and float and (not center)) and (geo.x + (k>2 and (geo.width/2) or 0) + (k==2 and geo.width or 0) - 75/2) or (geo.x + geo.width/2 - 75/2)
wiboxes[v].y = (swap and float and (not center)) and (geo.y + (k<=2 and geo.height/2 or 0) + (k==4 and geo.height or 0) - 75/2) or (geo.y + geo.height/2 - 75/2)
else
wiboxes[v].visible = false
end
end
end
---------------- Position -----------------------
local function float_move(dir,c)
return ({left={x=c:geometry().x-delta},right={x=c:geometry().x+delta},up={y=c:geometry().y-delta},down={y=c:geometry().y+delta}})[dir]
end
local function float_move_max(dir,c)
return ({left={x=capi.screen[c.screen].workarea.x},right={x=capi.screen[c.screen].workarea.width+capi.screen[c.screen].workarea.x-c:geometry().width}
,up={y=capi.screen[c.screen].workarea.y},down={y=capi.screen[c.screen].workarea.y+capi.screen[c.screen].workarea.height-c:geometry().height}})[dir]
end
local function floating_clients()
local ret = {}
for v in util.table.iterate(client.visible(),function(c) return client.floating.get(c) end) do
ret[#ret+1] = v
end
return ret
end
local function bydirection(dir, c, swap,max)
if c then
local float = client.floating.get(c) or alayout.get(c.screen) == alayout.suit.floating
-- Move the client if floating, swaping wont work anyway
if swap and float then
c:geometry((max and float_move_max or float_move)(dir,c))
display_wiboxes(nil,nil,float,swap,c)
else
-- Get all clients rectangle
local cltbl,geomtbl = max and floating_clients() or client.tiled(),{}
for i,cl in ipairs(cltbl) do
geomtbl[i] = cl:geometry()
end
local target = util.get_rectangle_in_direction(dir, geomtbl, c:geometry())
-- If we found a client to focus, then do it.
if target then
if swap ~= true then
capi.client.focus = cltbl[((not cltbl[target] and #cltbl == 1) and 1 or target)]
capi.client.focus:raise()
else
c:swap(cltbl[target])
end
display_wiboxes(cltbl,geomtbl,float,swap,c)
end
end
end
end
function module.global_bydirection(dir, c,swap,max)
bydirection(dir, c or capi.client.focus, swap,max)
end
function module._global_bydirection_key(mod,key,event,direction,is_swap,is_max)
bydirection(direction,capi.client.focus,is_swap,is_max)
return true
end
function module.display(mod,key,event,direction,is_swap,is_max)
local c = capi.client.focus
local cltbl,geomtbl = max and floating_clients() or client.tiled(),{}
for i,cl in ipairs(cltbl) do
geomtbl[i] = cl:geometry()
end
display_wiboxes(cltbl,geomtbl,client.floating.get(c) or alayout.get(c.screen) == alayout.suit.floating,is_swap,c)
end
function module._quit()
for k,v in ipairs({"left","right","up","down","center"}) do
wiboxes[v].visible = false
end
end
return setmetatable(module, { __call = function(_, ...) return new(...) end })
-- kate: space-indent on; indent-width 2; replace-tabs on;
|
------------------------------------------------------------------------------
--
-- This file is part of the Corona game engine.
-- For overview and more information on licensing please refer to README.md
-- Home page: https://github.com/coronalabs/corona
-- Contact: support@coronalabs.com
--
------------------------------------------------------------------------------
simulator =
{
device = "android-phone",
screenOriginX = 75,
screenOriginY = 223,
screenWidth = 1080,
screenHeight = 1920,
androidDisplayApproximateDpi = 480, -- xxhdpi
deviceImage = "Samsung-Galaxy-S5.png",
displayManufacturer = "samsung",
displayName = "SM-G900S",
supportsScreenRotation = true,
hasAccelerometer = true,
windowTitleBarName = "Samsung Galaxy S5",
}
simulator.defaultFontSize = 18.0 * (simulator.androidDisplayApproximateDpi / 160)
|
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local NP = E:GetModule('NamePlates')
local LSM = E.LSM
--Lua functions
--WoW API / Variables
local UnitHealth = UnitHealth
local UnitIsUnit = UnitIsUnit
local UnitHealthMax = UnitHealthMax
--[[ Target Glow Style Option Variables
style1:'Border',
style2:'Background',
style3:'Top Arrow Only',
style4:'Side Arrows Only',
style5:'Border + Top Arrow',
style6:'Background + Top Arrow',
style7:'Border + Side Arrows',
style8:'Background + Side Arrows'
]]
local _, ns = ...
local oUF = ns.oUF
local function Update(self, event)
local element = self.TargetIndicator
if (element.PreUpdate) then
element:PreUpdate()
end
if element.TopIndicator then element.TopIndicator:Hide() end
if element.LeftIndicator then element.LeftIndicator:Hide() end
if element.RightIndicator then element.RightIndicator:Hide() end
if element.Shadow then element.Shadow:Hide() end
if element.Spark then element.Spark:Hide() end
if UnitIsUnit(self.unit, 'target') and (element.style ~= 'none') then
if element.TopIndicator and (element.style == 'style3' or element.style == 'style5' or element.style == 'style6') then
element.TopIndicator:Show()
end
if (element.LeftIndicator and element.RightIndicator) and (element.style == 'style4' or element.style == 'style7' or element.style == 'style8') then
element.RightIndicator:Show()
element.LeftIndicator:Show()
end
if element.Shadow and (element.style == 'style1' or element.style == 'style5' or element.style == 'style7') then
element.Shadow:Show()
end
if element.Spark and (element.style == 'style2' or element.style == 'style6' or element.style == 'style8') then
element.Spark:Show()
end
end
local r, g, b
local showIndicator
if UnitIsUnit(self.unit, 'target') then
showIndicator = true
r, g, b = NP.db.colors.glowColor.r, NP.db.colors.glowColor.g, NP.db.colors.glowColor.b
elseif (not UnitIsUnit(self.unit, 'target') and element.lowHealthThreshold > 0) then
local health, maxHealth = UnitHealth(self.unit), UnitHealthMax(self.unit)
local perc = (maxHealth > 0 and health/maxHealth) or 0
if perc <= element.lowHealthThreshold then
showIndicator = true
if perc <= element.lowHealthThreshold / 2 then
r, g, b = 1, 0, 0
else
r, g, b = 1, 1, 0
end
end
end
if showIndicator then
if element.TopIndicator and (element.style == 'style3' or element.style == 'style5' or element.style == 'style6') then
element.TopIndicator:SetVertexColor(r, g, b)
local TopArrow = "Interface\\AddOns\\ElvUI\\media\\textures\\targetIndicator\\"..NP.db.units.TARGET.topArrowType
if element.TopIndicator:IsObjectType('Texture') and not InCombatLockdown() then
element.TopIndicator:SetTexture(TopArrow)
element.TopIndicator:Size(NP.db.units.TARGET.topArrowTypeSize)
if NP.db.units.TARGET.topArrowType == 'ArrowUp' then
element.TopIndicator:SetRotation(3.14)
end
end
end
if (element.LeftIndicator and element.RightIndicator) and (element.style == 'style4' or element.style == 'style7' or element.style == 'style8') then
element.RightIndicator:SetVertexColor(r, g, b)
element.LeftIndicator:SetVertexColor(r, g, b)
local LeftArrow = "Interface\\AddOns\\ElvUI\\media\\textures\\targetIndicator\\"..NP.db.units.TARGET.leftArrowType
if element.LeftIndicator:IsObjectType('Texture') and not InCombatLockdown() then
element.LeftIndicator:SetTexture(LeftArrow)
element.LeftIndicator:Size(NP.db.units.TARGET.leftArrowTypeSize)
if NP.db.units.TARGET.leftArrowType == 'ArrowUp' then
element.LeftIndicator:SetRotation(1.57)
else
element.LeftIndicator:SetRotation(-1.57)
end
end
if element.RightIndicator:IsObjectType('Texture') and not InCombatLockdown() then
element.RightIndicator:SetTexture(LeftArrow)
element.RightIndicator:Size(NP.db.units.TARGET.leftArrowTypeSize)
if NP.db.units.TARGET.leftArrowType == 'ArrowUp' then
element.RightIndicator:SetRotation(-1.57)
else
element.RightIndicator:SetRotation(1.57)
end
end
end
if element.Shadow and (element.style == 'style1' or element.style == 'style5' or element.style == 'style7') then
element.Shadow:Show()
element.Shadow:SetBackdropBorderColor(r, g, b)
end
if element.Spark and (element.style == 'style2' or element.style == 'style6' or element.style == 'style8') then
element.Spark:Show()
element.Spark:SetVertexColor(r, g, b)
end
end
if (element.PostUpdate) then
return element:PostUpdate(self.unit)
end
end
local function Path(self, ...)
return (self.TargetIndicator.Override or Update) (self, ...)
end
local function ForceUpdate(element)
return Path(element.__owner, 'ForceUpdate', element.__owner.unit)
end
local function Enable(self)
local element = self.TargetIndicator
if (element) then
element.__owner = self
element.ForceUpdate = ForceUpdate
if not element.style then
element.style = 'style1'
end
if not element.lowHealthThreshold then
element.lowHealthThreshold = .4
end
if element.Shadow then
if element.Shadow:IsObjectType('Frame') and not element.Shadow:GetBackdrop() == nil then
element.Shadow:SetBackdrop({edgeFile = LSM:Fetch('border', 'ElvUI GlowBorder'), edgeSize = E:Scale(5)})
end
end
if element.Spark then
if element.Spark:IsObjectType('Texture') and not element.Spark:GetTexture() then
element.Spark:SetTexture(E.Media.Textures.Spark)
end
end
if element.TopIndicator then
local TopArrow = "Interface\\AddOns\\ElvUI\\media\\textures\\targetIndicator\\"..NP.db.units.TARGET.topArrowType
if element.TopIndicator:IsObjectType('Texture') and not element.TopIndicator:GetTexture() then
element.TopIndicator:SetTexture(TopArrow)
element.TopIndicator:Size(NP.db.units.TARGET.topArrowTypeSize)
if NP.db.units.TARGET.topArrowType == 'ArrowUp' then
element.TopIndicator:SetRotation(3.14)
end
end
end
if element.LeftIndicator then
local LeftArrow = "Interface\\AddOns\\ElvUI\\media\\textures\\targetIndicator\\"..NP.db.units.TARGET.leftArrowType
if element.LeftIndicator:IsObjectType('Texture') then
element.LeftIndicator:SetTexture(LeftArrow)
element.LeftIndicator:Size(NP.db.units.TARGET.leftArrowTypeSize)
if NP.db.units.TARGET.leftArrowType == 'ArrowUp' then
element.LeftIndicator:SetRotation(1.57)
else
element.LeftIndicator:SetRotation(-1.57)
end
end
end
if element.RightIndicator then
local LeftArrow = "Interface\\AddOns\\ElvUI\\media\\textures\\targetIndicator\\"..NP.db.units.TARGET.leftArrowType
if element.RightIndicator:IsObjectType('Texture') and not element.RightIndicator:GetTexture() then
element.RightIndicator:SetTexture(LeftArrow)
element.RightIndicator:Size(NP.db.units.TARGET.leftArrowTypeSize)
if NP.db.units.TARGET.leftArrowType == 'ArrowUp' then
element.RightIndicator:SetRotation(-1.57)
else
element.RightIndicator:SetRotation(1.57)
end
end
end
self:RegisterEvent('PLAYER_TARGET_CHANGED', Path, true)
self:RegisterEvent('UNIT_HEALTH_FREQUENT', Path)
return true
end
end
local function Disable(self)
local element = self.TargetIndicator
if (element) then
if element.TopIndicator then element.TopIndicator:Hide() end
if element.LeftIndicator then element.LeftIndicator:Hide() end
if element.RightIndicator then element.RightIndicator:Hide() end
if element.Shadow then element.Shadow:Hide() end
if element.Spark then element.Spark:Hide() end
self:UnregisterEvent('PLAYER_TARGET_CHANGED', Path)
self:UnregisterEvent('UNIT_HEALTH_FREQUENT', Path)
end
end
oUF:AddElement('TargetIndicator', Path, Enable, Disable)
|
DantariVillageScreenPlay = ScreenPlay:new {
numberOfActs = 1,
}
registerScreenPlay("DantariVillageScreenPlay", true)
function DantariVillageScreenPlay:start()
if (isZoneEnabled("dantooine")) then
self:spawnMobiles()
end
end
function DantariVillageScreenPlay:spawnMobiles()
spawnMobile("dantooine", "dantari_battlelord",900,-3848.4,2,-5722.2,-50,0)
spawnMobile("dantooine", "dantari_battlelord",900,-3839.2,6,-5696.3,-165,0)
spawnMobile("dantooine", "dantari_battlelord",900,-3848.6,6,-5695,-170,0)
spawnMobile("dantooine", "dantari_battlelord",900,-3865.1,2.5,-5696.2,-96,0)
spawnMobile("dantooine", "dantari_battlelord",900,-3873.1,2.5,-5697.2,76,0)
spawnMobile("dantooine", "dantari_battlelord",900,-7207.8,3,-913.9,160,0)
spawnMobile("dantooine", "dantari_battlelord",900,-7202.1,3,-921.8,-78,0)
spawnMobile("dantooine", "dantari_battlelord",900,-7242.2,3,-864,127,0)
spawnMobile("dantooine", "dantari_battlelord",900,-7158.5,3,-836.6,-158,0)
spawnMobile("dantooine", "dantari_battlelord",900,-7132.3,3,-894.6,-98,0)
spawnMobile("dantooine", "dantari_battlelord",900,-7134.5,3,-886.6,-120,0)
spawnMobile("dantooine", "dantari_battlelord",900,5584.4,0.5,-657.8,-88,0)
spawnMobile("dantooine", "dantari_battlelord",900,5557.1,0.2,-619.2,154,0)
spawnMobile("dantooine", "dantari_battlelord",900,5592.4,1.4,-619.1,-151,0)
spawnMobile("dantooine", "dantari_battlelord",900,5593.2,0.8,-645.8,-76,0)
spawnMobile("dantooine", "dantari_chief",900,-3839.3,8,-5753.5,30,0)
spawnMobile("dantooine", "dantari_chief",900,-3886.9,2.5,-5686,-159,0)
spawnMobile("dantooine", "dantari_chief",900,-7209.2,3,-923.1,32,0)
spawnMobile("dantooine", "dantari_chief",900,5567,0.2,-648.2,-145,0)
spawnMobile("dantooine", "dantari_raider",900,-3893.6,2.4,-5708.2,85,0)
spawnMobile("dantooine", "dantari_raider",900,-3088.7,2.5,-5720.3,61,0)
spawnMobile("dantooine", "dantari_raider",900,-3882.9,2.5,-5730.6,28,0)
spawnMobile("dantooine", "dantari_raider",900,-3871.6,2.5,-5735.8,7,0)
spawnMobile("dantooine", "dantari_raider",900,-3860.9,2.5,-5734.5,-49,0)
spawnMobile("dantooine", "dantari_raider",900,-3797.3,5,-5717.5,-136,0)
spawnMobile("dantooine", "dantari_raider",900,-3787.6,4.4,-5727.9,-120,0)
spawnMobile("dantooine", "dantari_raider",900,-7166.9,3,-938.9,-26,0)
spawnMobile("dantooine", "dantari_raider",900,-7186.7,3,-941.2,3,0)
spawnMobile("dantooine", "dantari_raider",900,-7225.4,3,-898.7,41,0)
spawnMobile("dantooine", "dantari_raider",900,-7242.7,3,-886.4,87,0)
spawnMobile("dantooine", "dantari_raider",900,-7220.4,3,-856.4,169,0)
spawnMobile("dantooine", "dantari_raider",900,-7180.3,3,-842.1,156,0)
spawnMobile("dantooine", "dantari_raider",900,-7146.8,3,-856.4,-130,0)
spawnMobile("dantooine", "dantari_raider",900,-7143.2,3,-913.4,-55,0)
spawnMobile("dantooine", "dantari_raider",900,5514.5,0.4,-707.7,144,0)
spawnMobile("dantooine", "dantari_raider",900,5540.9,0.2,-699,-74,0)
spawnMobile("dantooine", "dantari_raider",900,5544.9,0.2,-678.5,136,0)
end
|
return {
PlacesList = "PlacesList",
PeopleList = "PeopleList",
GameDetailMore = "GameDetailMore",
PurchaseGame = "PurchaseGame",
PurchaseGameRobuxShortfall = "PurchaseGameRobuxShortfall",
LeaveRobloxAlert = "LeaveRobloxAlert",
ConfirmSignOut = "ConfirmSignOut",
PremiumMigrationNotice = "PremiumMigrationNotice",
AutoUpgradePrompt = "AutoUpgradePrompt",
DevSubMore = "DevSubMore",
DevSubConfirmCancel = "DevSubConfirmCancel",
PurchaseCatalogItem = "PurchaseCatalogItem",
LeaveCatalogToAvatarPrompt = "LeaveCatalogToAvatarPrompt",
CatalogContextMenu = "CatalogContextMenu",
SignUpBirthdayPickerOverlay = "SignUpBirthdayPickerOverlay",
CategoryFiltersPrompt = "CategoryFiltersPrompt",
PriceFilterPrompt = "PriceFilterPrompt",
}
|
local clipboard = require('clipboard')
local command = require('command')
local math = require('math')
local memory = require('memory')
local unicode = require('unicode')
local paste = command.new('paste')
local max_chat_size = 0x96
paste:register(function()
local chat = memory.chat_input
if not chat.open then
return
end
local text = unicode.to_shift_jis(clipboard.get())
if text == nil then
return
end
local original = chat.internal
text = text:sub(1, math.max(max_chat_size - #original, 0))
local modified = original:sub(1, chat.position_internal) .. text .. original:sub(chat.position_internal + 1)
do -- Set internal value
local buffer = modified
if #buffer > max_chat_size then
buffer = buffer:sub(1, max_chat_size)
end
chat.internal = buffer
chat.length_internal = #buffer
chat.position_internal = math.min(chat.position_internal + #text, max_chat_size)
end
do -- Set the stripped buffer
local buffer = unicode.to_shift_jis(unicode.expand_autotranslate((unicode.from_shift_jis(modified)), '', ''))
if #buffer > max_chat_size then
buffer = buffer:sub(1, max_chat_size)
end
chat.stripped = buffer
chat.length_stripped = #buffer
end
do -- Set the display buffer
local buffer =
unicode.to_shift_jis(unicode.expand_autotranslate((unicode.from_shift_jis(modified:sub(1, chat.position_internal))), '\u{F569}', '\u{F564}')) ..
'\x7F\xFF' ..
unicode.to_shift_jis(unicode.expand_autotranslate((unicode.from_shift_jis(modified:sub(chat.position_internal + 1))), '\u{F569}', '\u{F564}'))
if #buffer > max_chat_size + 2 then
buffer = buffer:sub(1, max_chat_size + 2)
end
chat.display = buffer
end
chat.update_history = true
end)
--[[
Copyright © 2019, Windower Dev Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Windower Dev Team nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE WINDOWER DEV TEAM BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
|
include("Scripts/Interactable.lua")
include("Scripts/Objects/PlaceableObject.lua")
-------------------------------------------------------------------------------
PortalStone = PlaceableObject.Subclass("PortalStone")
-------------------------------------------------------------------------------
function PortalStone:Constructor(args)
self.linkedPosition = nil
self.linkID = nil
self.targetID = nil
self.active = false
self.EnergyRequired = 90
end
-------------------------------------------------------------------------------
function PortalStone:Interact(args)
if args.player then
local x = args.player.m_energy:Value()
if (x - self.EnergyRequired) > 0 then
if self.targetID then
local position = DarkAgesModScript.LinkManager:Get(self.targetID)
if position then
args.player:_ModifyEnergy(-self.EnergyRequired)
Eternus.World:NKGetLocalWorldPlayer():NKTeleportToLocation(position)
end
end
end
end
end
-------------------------------------------------------------------------------
function PortalStone:GetDebuggingText( outData )
local str = ""
str = str .. "linkID " .. tostring(self.linkID) .. "\n"
local linkPos = DarkAgesModScript.LinkManager:Get(self.linkID)
str = str .. "linkPos " .. (linkPos and linkPos:NKToString() or "nil" ) .. "\n"
str = str .. "targetID " .. tostring(self.targetID) .. "\n"
local targetPos = DarkAgesModScript.LinkManager:Get(self.targetID)
str = str .. "targetPos " .. (targetPos and targetPos:NKToString() or "nil" ) .. "\n"
return str
end
-------------------------------------------------------------------------------
function PortalStone:Save( outData )
PortalStone.__super.Save(self, outData)
outData.linkID = self.linkID
outData.targetID = self.targetID
if self.linkedPosition then
outData.linkedPosition = {x=self.linkedPosition:x(), y=self.linkedPosition:y(), z=self.linkedPosition:z()}
end
end
-------------------------------------------------------------------------------
function PortalStone:Restore( inData, version )
PortalStone.__super.Restore(self, inData, version)
self.linkID = inData.linkID
self.targetID = inData.targetID
end
-------------------------------------------------------------------------------
function PortalStone:NetSerialize( stream )
PortalStone.__super.NetSerialize(self, stream)
stream:NKWriteBool(self.active)
end
-------------------------------------------------------------------------------
function PortalStone:NetDeserialize( stream )
PortalStone.__super.NetDeserialize(self, stream)
local active = stream:NKReadBool()
self:SetActive(active)
end
-------------------------------------------------------------------------------
function PortalStone:SetActive( active )
if self.active ~= active then
self.active = active
NKPrint("PortalStone:SetActive( " .. tostring(active) .. " )")
if Eternus.IsClient then
if active then
self:NKSetEmitterActive(true)
self:NKGetStaticGraphics():NKSetSubmeshTexture(0, "MagicStonePillar:pCube1", "diffuse_on")
self:NKGetStaticGraphics():NKSetSubmeshTexture(2, "MagicStonePillar:pCube1", "glow_on")
else
self:NKSetEmitterActive(false)
self:NKGetStaticGraphics():NKSetSubmeshTexture(0, "MagicStonePillar:pCube1", "diffuse_off")
self:NKGetStaticGraphics():NKSetSubmeshTexture(2, "MagicStonePillar:pCube1", "NULL")
end
end
end
end
-------------------------------------------------------------------------------
function PortalStone:Spawn()
if Eternus.IsClient then
self:NKSetEmitterActive(false)
self:NKGetStaticGraphics():NKSetSubmeshTexture(0, "MagicStonePillar:pCube1", "diffuse_off")
self:NKGetStaticGraphics():NKSetSubmeshTexture(2, "MagicStonePillar:pCube1", "NULL")
end
if Eternus.IsServer then
self:NKEnableScriptProcessing(true, 1000)
end
end
-------------------------------------------------------------------------------
function PortalStone:PickedUp()
self:BreakLink()
end
-------------------------------------------------------------------------------
function PortalStone:OnDestroy()
self:BreakLink()
end
-------------------------------------------------------------------------------
function PortalStone:BreakLink()
if Eternus.IsServer then
if self.linkID then
DarkAgesModScript.LinkManager:Remove(self.linkID)
end
self.linkID = nil
self.targetID = nil
end
self:SetActive(false)
end
-------------------------------------------------------------------------------
function PortalStone:GetLinkID()
if not self.linkID and not self:NKIsPhysicsDynamic() then
self.linkID = DarkAgesModScript.LinkManager:GetUniqueID()
local position = self:NKGetWorldPosition() + vec3.new(0.0, 0.0, 2.0):mul_quat(self:NKGetWorldOrientation())
DarkAgesModScript.LinkManager:Add(self.linkID, position)
end
return self.linkID
end
-------------------------------------------------------------------------------
function PortalStone:SetTargetID(linkID)
if linkID and DarkAgesModScript.LinkManager:Get(linkID) then
self.targetID = linkID
else
self.targetID = nil
end
end
-------------------------------------------------------------------------------
function PortalStone:Despawn()
-- Server only logic
if Eternus.IsServer then
self:NKEnableScriptProcessing(false)
end
end
-------------------------------------------------------------------------------
function PortalStone:Update( )
-- Server only logic
if Eternus.IsServer then
if self.targetID and DarkAgesModScript.LinkManager:Get(self.targetID) then
self:SetActive(true)
else
self:SetActive(false)
end
end
end
-------------------------------------------------------------------------------
EntityFramework:RegisterGameObject(PortalStone)
|
return {
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.08
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.2
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.092
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.23
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.104
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.26
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.12
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.3
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.132
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.33
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.144
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.36
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.16
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.4
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.172
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.43
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.184
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.46
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = -0.2
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.5
}
}
}
},
time = 0,
name = "决死突袭",
init_effect = "jinengchufared",
picture = "",
desc = "属性变化",
stack = 1,
id = 10841,
icon = 10841,
last_effect = "Darkness",
blink = {
1,
0,
0,
0.3,
0.3
},
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "injureRatio",
number = 0.08
}
},
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach",
"onRemove"
},
arg_list = {
attr = "damageRatioBullet",
number = 0.2
}
}
}
}
|
if CLIENT then
SWEP.PrintName = "Hemotoxin Gun"
SWEP.Author = "TFlippy"
SWEP.Slot = 6 -- add 1 to get the slot number key
SWEP.Icon = "tflippy/vgui/ttt/icon_hemotoxin"
SWEP.ViewModelFOV = 55
SWEP.ViewModelFlip = false
SWEP.CSMuzzleFlashes = true
SWEP.EquipMenuData = {
type = "Gun",
desc = "A gas pistol utilizing a hemotoxic agent.\n\nCauses tissue damage and results in a painful\ndeath if not treated quickly."
};
end
SWEP.Base = "weapon_tttbase"
SWEP.HoldType = "revolver"
SWEP.AutoSpawnable = false
SWEP.AllowDrop = true
SWEP.IsSilent = true
SWEP.NoSights = false
SWEP.Kind = WEAPON_EQUIP1
SWEP.Primary.Delay = 1.00
SWEP.Primary.Recoil = 1.50
SWEP.Primary.Automatic = false
SWEP.Primary.SoundLevel = 30
SWEP.Primary.ClipSize = 2
SWEP.Primary.ClipMax = 1
SWEP.Primary.DefaultClip = 2
SWEP.Primary.Ammo = "AR2AltFire"
SWEP.HeadshotMultiplier = 5
SWEP.CanBuy = { ROLE_TRAITOR }
SWEP.LimitedStock = true
SWEP.Primary.Damage = 5
SWEP.Primary.Cone = 0.00025
SWEP.Primary.NumShots = 0
SWEP.IronSightsPos = Vector( -5.91, -4, 2.84 )
SWEP.IronSightsAng = Vector(-0.5, 0, 0)
SWEP.UseHands = true
SWEP.ViewModel = Model("models/tflippy/cstrike/c_pist_usp.mdl")
SWEP.WorldModel = Model("models/tflippy/w_pist_usp_silencer.mdl")
SWEP.Primary.Sound = Sound( "TFlippy_Neurotoxin.Single" )
SWEP.PrimaryAnim = ACT_VM_PRIMARYATTACK_SILENCED
SWEP.ReloadAnim = ACT_VM_RELOAD_SILENCED
function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW_SILENCED)
return true
end
function SWEP:Shoot()
local cone = self.Primary.Cone
local bullet = {}
bullet.Num = self.Primary.NumShots
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Tracer = 0
bullet.Force = 1
bullet.Damage = self.Primary.Damage
--bullet.TracerName = "AntlionGib"
self.Owner:FireBullets( bullet )
end
function SWEP:PrimaryAttack(worldsnd)
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
if not self:CanPrimaryAttack() then return end
self.Owner:LagCompensation(true)
self.Weapon:EmitSound( self.Primary.Sound )
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK_SILENCED)
self:Shoot()
local trEntity = self.Owner:GetEyeTrace().Entity
ParticleEffect("tflippy_poison01", self.Owner:GetEyeTrace().HitPos, trEntity:GetAngles())
if SERVER then
if self.Owner:GetEyeTrace().HitNonWorld and self.Owner:GetEyeTrace().Entity:IsPlayer() then
local id = trEntity:UniqueID()
trEntity:EmitSound("TFlippy_Neurotoxin.Poisoned")
if trEntity:GetNWBool("WasAntidoted") == false then
DamageLog("POISON:\t " .. self.Owner:Nick() .. " [" .. self.Owner:GetRoleString() .. "]" .. " poisoned " .. (IsValid(trEntity) and trEntity:Nick() or "<disconnected>") .." [" .. trEntity:GetRoleString() .. "]" .. " with a Hemotoxin Gun.")
trEntity:SetColor(Color( 230, 255, 210, 255 ))
trEntity:SetNWString("PoisonID", self.Owner:UniqueID())
timer.Create(trEntity:UniqueID() .. "hemotoxin", 5, 0, function()
if IsValid(trEntity) and trEntity:IsTerror() then
if IsValid(self.Owner) then
trEntity:TakeDamage(math.random(3, 8), player.GetByUniqueID(trEntity:GetNWString("PoisonID")), self.Weapon)
local jitter = VectorRand() * 30
jitter.z = 20
util.PaintDown(trEntity:GetPos() + jitter, "Blood", trEntity)
trEntity:ViewPunch( Angle( -0.75, 0, 0 ) )
if math.random(0,2) == 0 then
trEntity:EmitSound("TFlippy_Neurotoxin.Pain")
end
else
trEntity:TakeDamage(math.random(3, 8), player.GetByUniqueID(trEntity:GetNWString("PoisonID")), self.Weapon)
end
else
timer.Destroy(id .. "hemotoxin")
end
end)
else
DamageLog("POISON:\t " .. self.Owner:Nick() .. " [" .. self.Owner:GetRoleString() .. "]" .. " failed to poison " .. (IsValid(trEntity) and trEntity:Nick() or "<disconnected>") .." [" .. trEntity:GetRoleString() .. "]" .. " with a Hemotoxin Gun.")
end
end
end
self:TakePrimaryAmmo( 1 )
if IsValid(self.Owner) then
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self.Owner:ViewPunch( Angle( math.Rand(-0.8,-0.8) * self.Primary.Recoil, math.Rand(-0.1,0.1) *self.Primary.Recoil, 0 ) )
end
self.Owner:LagCompensation(false)
end
function SWEP:WasBought(buyer)
if IsValid(buyer) then
buyer:GiveAmmo( 0, "AR2AltFire" )
end
end
hook.Add("TTTEndRound", "KillPoisonTimer_End", function()
for k,v in pairs(player.GetAll()) do
timer.Destroy(v:UniqueID() .. "hemotoxin")
end
end)
hook.Add("TTTPrepareRound", "KillPoisonTimer_Prep", function()
for k,v in pairs(player.GetAll()) do
timer.Destroy(v:UniqueID() .. "hemotoxin")
end
end)
|
Config = {}
Config.Locale = 'en'
Config.DrawDistance = 100.0
Config.MarkerColor = { r = 120, g = 120, b = 240 }
Config.EnableOwnedVehicles = true -- If true then it will set the Vehicle Owner to the Player who bought it.
Config.ResellPercentage = 75 -- Sets the Resell Percentage | Example: $100 Car will resell for $75
Config.LicenseEnable = false -- Require people to own a Boating License when buying Vehicles? Requires esx_license
Config.LicensePrice = 1000 -- Sets the License Price if Config.LicenseEnable is true
-- looks like this: 'LLL NNN'
-- The maximum plate length is 8 chars (including spaces & symbols), don't go past it!
Config.PlateLetters = 3
Config.PlateNumbers = 3
Config.PlateUseSpace = true
Config.Zones = {
ShopEntering = { -- Marker for Accessing Shop
Pos = { x = -1521.78, y = -412.11, z = 34.9},
Size = { x = 1.5, y = 1.5, z = 1.5 },
Type = 35
},
ShopInside = { -- Marker for Viewing Vehicles
Pos = {x = -1518.25, y = -426.81, z = 35.44 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Heading = 138.4,
Type = -1
},
ShopOutside = { -- Marker for Purchasing Vehicles
Pos = { x = -1518.25, y = -426.81, z = 35.44 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Heading = 90.0,
Type = -1
},
ResellVehicle = { -- Marker for Selling Vehicles
Pos = { x = -134.52, y = 6764.52, z = 0 },
Size = { x = 3.0, y = 3.0, z = 1.0 },
Type = 1
}
}
|
local pos = vector.new()
local rot = 0
local shortenText(txt, length)
local shortened = #txt > 8
return (txt:sub(1, (shortened and 8) or -1) .. ((shortened and "...") or "")):replace(" ", "_")
end
local getRotVector = function()
return ({
vector.new(1, 0, 0),
vector.new(0, 0, 1),
vector.new(-1, 0, 0),
vector.new(0, 0, -1)
})[rot + 1]
end
function right()
turtle.turnRight()
rot = (rot + 1) % 4
end
function left()
turtle.turnLeft()
rot = (rot - 1) % 4
end
function up()
if turtle.up() then
pos = pos + vector.new(0, 1, 0)
return true
end
return false
end
function down()
if turtle.down() then
pos = pos + vector.new(0, -1, 0)
return true
end
return false
end
function forward()
if turtle.forward() then
pos = pos + getRotVector()
return true
end
return false
end
function back()
if turtle.back() then
pow = pos - getRotVector()
return true
end
return false
end
local maps = {}
function newMaps(...)
for k, name in args do
if maps[name] then
printError("[WARN] Overriding Map " .. shortenText(name, 8))
end
maps[name] = {
["dict"] = {},
["points"] = {},
["nextIndex"] = 1
}
end
end
function removeMaps(...)
for k, name in args do
maps[name] = nil
end
end
function insertPoint(mapName, pointName, pointX, pointY, pointZ)
local pointPos = vector.new(pointX, pointY, pointZ)
local index = maps[mapName].nextIndex
if maps[mapName].dict[pointName] then
printError("[WARN] Overriding Point " .. shortenText(pointName, 8) .. " on map " .. shortenText(name, 8))
index = maps[name].dict[pointName]
else
while
maps[mapName].nextIndex = index + 1
end
maps[mapName].points[index] = {
["name"] = pointName,
["pos"] = pointPos
}
maps[mapName].dict[pointName] = index
end
function removePoint(mapName, pointName)
local index = maps[mapName].dict[pointName]
maps[mapName].points[index] = nil
maps[mapName].dict[pointName] = nil
if maps[mapName].nextIndex > index then
maps[mapName].nextIndex = index
end
end
|
--
-- Created by IntelliJ IDEA.
-- User: nander
-- Date: 01/03/2019
-- Time: 20:00
-- To change this template use File | Settings | File Templates.
--
return function(line, route_count, capacity)
local train_ID = GET_ID()
return {
isTrain = true,
line = line,
capacity = capacity or 1,
route_count = route_count,
station = GET(GET(GET(line).routes[route_count]).to).ID,
ID = train_ID,
}, train_ID
end
|
local Bag = {}
-- Keeps adding order only when no child has been removed.
function Bag:add(child)
self[#self+1] = child
end
function Bag:remove(child)
local last = #self
for i, v in ipairs(self) do
if child == v then
if i < last then
self[i] = self[last]
end
self[last] = nil
break
end
end
end
return Bag
|
return {
summary = 'Types of physics joints.',
description = [[
Represents the different types of physics Joints available.
]],
values = {
{
name = 'ball',
description = 'A BallJoint.'
},
{
name = 'distance',
description = 'A DistanceJoint.'
},
{
name = 'hinge',
description = 'A HingeJoint.'
},
{
name = 'slider',
description = 'A SliderJoint.'
}
},
related = {
'Joint',
'BallJoint',
'DistanceJoint',
'HingeJoint',
'SliderJoint'
}
}
|
local Modules = game:GetService("Players").LocalPlayer.PlayerGui.AvatarEditorInGame.Modules
local Roact = require(Modules.Packages.Roact)
local UIBlox = require(Modules.Packages.UIBlox)
local withStyle = UIBlox.Style.withStyle
local ImageSetButton = UIBlox.Core.ImageSet.Button
local ImageSetLabel = UIBlox.Core.ImageSet.Label
local Images = UIBlox.App.ImageSet.Images
local BUTTON_SIZE = UDim2.new(0, 44, 0, 44)
local BUTTON_ICON_IMAGE = Images["icons/common/more"]
local BUTTON_ICON_SIZE = UDim2.new(0, 37, 0, 37)
local BUTTON_FILL_9S_IMAGE = Images["component_assets/circle_17"]
local BUTTON_FILL_9S_CENTER = Rect.new(8, 8, 9, 9)
local ItemDetailMoreButton = Roact.PureComponent:extend("ItemDetailMoreButton")
function ItemDetailMoreButton:init()
self.state = {
isButtonPressed = false,
}
self.onInputBegan = function()
self:setState({
isButtonPressed = true
})
end
self.onInputEnded = function()
self:setState({
isButtonPressed = false
})
end
self.moreButtonRef = Roact.createRef()
end
function ItemDetailMoreButton:renderWithStyle(stylePalette)
local theme = stylePalette.Theme
local onActivated = self.props.onActivated
local isButtonPressed = self.state.isButtonPressed
local buttonTransparency = theme.BackgroundDefault.Transparency
if isButtonPressed then
buttonTransparency = theme.Overlay.Transparency
end
return Roact.createElement(ImageSetButton, {
BorderSizePixel = 0,
BackgroundTransparency = 1,
Size = BUTTON_SIZE,
Image = BUTTON_FILL_9S_IMAGE,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = BUTTON_FILL_9S_CENTER,
ImageTransparency = buttonTransparency,
ImageColor3 = theme.BackgroundDefault.Color,
LayoutOrder = 1,
ClipsDescendants = false,
[Roact.Event.Activated] = onActivated,
[Roact.Event.InputBegan] = self.onInputBegan,
[Roact.Event.InputEnded] = self.onInputEnded,
[Roact.Ref] = self.moreButtonRef,
}, {
Icon = Roact.createElement(ImageSetLabel, {
Size = BUTTON_ICON_SIZE,
AnchorPoint = Vector2.new(0.5, 0.5),
Position = UDim2.new(0.5, 0, 0.5, 0),
BorderSizePixel = 0,
BackgroundTransparency = 1,
Image = BUTTON_ICON_IMAGE,
ImageTransparency = theme.IconEmphasis.Transparency,
ImageColor3 = theme.IconEmphasis.Color,
}),
})
end
function ItemDetailMoreButton:willUnmount()
if true and self.props.onUnmount ~= nil then
self.props.onUnmount()
end
end
function ItemDetailMoreButton:render()
return withStyle(function(stylePalette)
return self:renderWithStyle(stylePalette)
end)
end
return ItemDetailMoreButton
|
mainrule_flag = 1
function mainrule_updating()
if mainrule_flag == 1 then
objectivePrimary = Objective_Add("$3005", OT_Primary)
Objective_AddDescription(objectivePrimary, "$3006")
Subtitle_Message_Handler("$3007", 2, "data:sound\\speech\\allships\\emperor\\CHALLENGE_DESTROYMOTHERSHIPS_2", Universe_CurrentPlayer())
mainrule_flag = 0
end
local playerIndex = 0
local playerCount = Universe_PlayerCount()
while (playerIndex < playerCount) do
if (Player_IsAlive(playerIndex) == 1 and Player_HasShipWithBuildQueue(playerIndex) == 0) then
Player_Kill(playerIndex)
if playerIndex ~= Universe_CurrentPlayer() then
-- UI_SetScreenEnabled("PlayerDestroyedScreen", 1)
-- UI_SetScreenVisible("PlayerDestroyedScreen", 1)
local playerNameW = Player_GetName(playerIndex)
-- UI_SetTextLabelTextWF1("PlayerDestroyedScreen", "lblDescription1", "$1231", playerNameW);
Sound_SpeechPlay("data:sound\\speech\\missions\\m_15\\47100")
Player_AddLocalChatMessage("$1231", playerNameW);
end
end
playerIndex = playerIndex+1
end
local numAlive = 0
local numEnemies = 0
local gameOver = 1
playerIndex = 0
while (playerIndex < playerCount) do
if (Player_IsAlive(playerIndex) == 1) then
local otherPlayerIndex = 0
while (otherPlayerIndex < playerCount) do
if (AreAllied(playerIndex, otherPlayerIndex) == 0) then
if (Player_IsAlive(otherPlayerIndex) == 1) then
gameOver = 0
else
numEnemies = numEnemies + 1
end
end
otherPlayerIndex = otherPlayerIndex + 1
end
numAlive = numAlive + 1
end
playerIndex = playerIndex + 1
end
if (numEnemies == 0 and numAlive > 0) then
gameOver = 0
end
if (gameOver == 1) then
Rule_AddInterval("waitForEnd",2)
--Rule_Add("waitForEnd")
--Event_Start("endGame")
Rule_Remove("mainrule_updating")
end
end
function waitForEnd()
--if(Event_IsDone("endGame")) then
setGameOver()
Rule_Remove("waitForEnd")
--end
end
|
return {
id = 100,
value = "导出",
}
|
-- spritelib-start
cursorhanddown={width=2,spriteIDs={97,98,129,130}}
cursorhand={width=2,spriteIDs={15,16,53,54}}
cursorhelp={width=2,spriteIDs={101,102,133,134}}
cursorpointer={width=2,spriteIDs={13,14,51,52}}
cursortext={width=2,spriteIDs={17,18,55,56}}
instrumentbutton1down={width=2,spriteIDs={571,572,616,617}}
instrumentbutton1over={width=2,spriteIDs={467,468,511,512}}
instrumentbutton1up={width=2,spriteIDs={345,346,370,371}}
instrumentbutton2down={width=2,spriteIDs={573,574,618,619}}
instrumentbutton2over={width=2,spriteIDs={469,470,513,514}}
instrumentbutton2up={width=2,spriteIDs={347,348,372,373}}
instrumentbutton3down={width=2,spriteIDs={575,576,620,621}}
instrumentbutton3over={width=2,spriteIDs={471,472,515,516}}
instrumentbutton3up={width=2,spriteIDs={349,350,374,375}}
instrumentbutton4down={width=2,spriteIDs={577,578,622,623}}
instrumentbutton4over={width=2,spriteIDs={473,474,517,518}}
instrumentbutton4up={width=2,spriteIDs={351,352,376,377}}
instrumentbutton5down={width=2,spriteIDs={579,580,624,625}}
instrumentbutton5over={width=2,spriteIDs={475,476,519,520}}
instrumentbutton5up={width=2,spriteIDs={353,354,378,379}}
instrumentbutton6down={width=2,spriteIDs={581,582,626,627}}
instrumentbutton6over={width=2,spriteIDs={477,478,521,522}}
instrumentbutton6up={width=2,spriteIDs={355,356,380,381}}
instrumentbutton7down={width=2,spriteIDs={583,584,628,629}}
instrumentbutton7over={width=2,spriteIDs={479,480,523,524}}
instrumentbutton7up={width=2,spriteIDs={357,358,382,383}}
instrumentbutton8down={width=2,spriteIDs={585,586,630,631}}
instrumentbutton8over={width=2,spriteIDs={481,482,525,526}}
instrumentbutton8up={width=2,spriteIDs={359,360,384,385}}
knob100={width=3,spriteIDs={234,235,236,416,343,256,369,277,276}}
knob110={width=3,spriteIDs={388,235,236,417,418,256,369,277,276}}
knob120={width=3,spriteIDs={389,390,236,419,420,256,369,277,276}}
knob130={width=3,spriteIDs={391,390,236,421,422,256,369,277,276}}
knob140={width=3,spriteIDs={392,393,236,423,422,256,369,277,276}}
knob150={width=3,spriteIDs={505,506,236,423,343,256,369,277,276}}
knob160={width=3,spriteIDs={234,507,236,423,343,256,369,277,276}}
knob170={width=3,spriteIDs={234,508,236,423,343,256,369,277,276}}
knob180={width=3,spriteIDs={234,509,236,423,343,256,369,277,276}}
knob190={width=3,spriteIDs={234,510,236,423,343,256,369,277,276}}
knob200={width=3,spriteIDs={234,565,236,423,343,256,369,277,276}}
knob210={width=3,spriteIDs={234,566,236,423,343,256,369,277,276}}
knob220={width=3,spriteIDs={234,567,236,423,613,256,369,277,276}}
knob230={width=3,spriteIDs={234,568,236,423,614,256,369,277,276}}
knob240={width=3,spriteIDs={234,569,570,423,615,256,369,277,276}}
knob250={width=3,spriteIDs={234,663,570,423,677,678,369,277,276}}
knob260={width=3,spriteIDs={234,235,236,423,679,680,369,277,276}}
knob270={width=3,spriteIDs={234,235,236,423,681,682,369,277,276}}
knob280={width=3,spriteIDs={234,235,236,423,683,684,369,277,276}}
knob290={width=3,spriteIDs={234,235,236,423,685,686,369,277,276}}
knob30={width=3,spriteIDs={234,235,236,254,255,256,274,275,276}}
knob300={width=3,spriteIDs={234,235,236,423,766,767,369,277,276}}
knob310={width=3,spriteIDs={234,235,236,423,768,256,369,277,276}}
knob320={width=3,spriteIDs={234,235,236,423,769,256,369,803,276}}
knob330={width=3,spriteIDs={234,235,236,423,770,256,369,804,276}}
knob40={width=3,spriteIDs={234,235,236,257,258,256,274,277,276}}
knob50={width=3,spriteIDs={234,235,236,336,337,256,369,277,276}}
knob60={width=3,spriteIDs={234,235,236,338,339,256,369,277,276}}
knob70={width=3,spriteIDs={234,235,236,340,341,256,369,277,276}}
knob80={width=3,spriteIDs={234,235,236,342,343,256,369,277,276}}
knob90={width=3,spriteIDs={234,235,236,344,343,256,369,277,276}}
modalcancelbuttonover={width=4,spriteIDs={151,152,153,154,184,185,186,187}}
modalcancelbuttonup={width=4,spriteIDs={76,77,78,79,117,118,119,120}}
modalokbuttonover={width=4,spriteIDs={147,148,149,150,180,181,182,183}}
modalokbuttonup={width=4,spriteIDs={72,73,74,75,113,114,115,116}}
modalokcancelover={width=4,spriteIDs={151,152,153,154,184,185,186,187}}
modalokcancelup04={width=4,spriteIDs={151,152,153,154,184,185,186,187}}
modalokcancelup={width=4,spriteIDs={76,77,78,79,117,118,119,120}}
mutatebuttondown={width=2,spriteIDs={758,759,795,796,807,808}}
mutatebuttonover={width=2,spriteIDs={752,753,789,790,805,806}}
mutatebuttonup={width=2,spriteIDs={239,240,261,262,205,206}}
playbuttonover={width=2,spriteIDs={809,810,821,822,805,806}}
playbuttonselectedover={width=2,spriteIDs={817,818,829,830,850,851}}
playbuttonselectedup={width=2,spriteIDs={813,814,825,826,807,808}}
playbuttonup={width=2,spriteIDs={123,124,160,161,205,206}}
powerbuttonon={width=2,spriteIDs={362,363,386,387,410,411}}
pv8toolbaricondown={width=2,spriteIDs={27,28,65,66}}
pv8toolbariconup={width=2,spriteIDs={29,30,67,68}}
redobuttondisabled={width=2,spriteIDs={764,765,801,802,205,206}}
redobuttondown={width=2,spriteIDs={760,761,797,798,807,808}}
redobuttonover={width=2,spriteIDs={754,755,791,792,805,806}}
redobuttonup={width=2,spriteIDs={241,242,263,264,205,206}}
sfxbutton1down={width=2,spriteIDs={531,532,547,548}}
sfxbutton1over={width=2,spriteIDs={394,395,424,425}}
sfxbutton1up={width=2,spriteIDs={278,279,300,301}}
sfxbutton2down={width=2,spriteIDs={533,534,549,550}}
sfxbutton2over={width=2,spriteIDs={396,397,426,427}}
sfxbutton2up={width=2,spriteIDs={280,281,302,303}}
sfxbutton3down={width=2,spriteIDs={535,536,551,552}}
sfxbutton3over={width=2,spriteIDs={398,399,428,429}}
sfxbutton3up={width=2,spriteIDs={282,283,304,305}}
sfxbutton4down={width=2,spriteIDs={537,538,553,554}}
sfxbutton4over={width=2,spriteIDs={400,401,430,431}}
sfxbutton4up={width=2,spriteIDs={284,285,306,307}}
sfxbutton5down={width=2,spriteIDs={539,540,555,556}}
sfxbutton5over={width=2,spriteIDs={402,403,432,433}}
sfxbutton5up={width=2,spriteIDs={286,287,308,309}}
sfxbutton6down={width=2,spriteIDs={541,542,557,558}}
sfxbutton6over={width=2,spriteIDs={404,405,434,435}}
sfxbutton6up={width=2,spriteIDs={288,289,310,311}}
sfxbutton7down={width=2,spriteIDs={543,544,559,560}}
sfxbutton7over={width=2,spriteIDs={406,407,436,437}}
sfxbutton7up={width=2,spriteIDs={290,291,312,313}}
sfxbutton8down={width=2,spriteIDs={545,546,561,562}}
sfxbutton8over={width=2,spriteIDs={408,409,438,439}}
sfxbutton8up={width=2,spriteIDs={292,293,314,315}}
sprites_01={width=32,spriteIDs={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,34,34,34,34,34,34,34,34,34,34,34,34,35,36,37,38,34,34,34,34,34,34,34,34,34,34,39,34,34,34,40}}
sprites_03={width=18,spriteIDs={9,10,11,-1,13,14,15,16,17,18,19,20,21,22,23,24,25,26,49,0,50,-1,51,52,53,54,55,56,57,58,59,60,61,62,63,64,92,93,94,-1,95,96,97,98,99,100,101,102,103,104,105,106,107,108}}
sprites_06={width=2,spriteIDs={31,32,69,70,111,112,145,146,178,179,222,223,-1,-1,-1,-1}}
sprites_07={width=1,spriteIDs={71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,847}}
sprites_10={width=23,spriteIDs={-1,-1,-1,80,81,82,83,84,85,85,85,85,85,85,85,86,-1,-1,87,85,-1,-1,88,-1,-1,-1,121,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,122,-1,-1,-1,-1,-1,-1,88,-1,-1,-1,155,156,156,156,156,156,156,156,156,156,156,156,157,-1,-1,156,156,-1,-1,88,-1,-1,-1,-1,-1,-1,-1,-1,188,189,190,190,191,191,191,191,192,193,194,195,196,192,88,-1,-1,-1,-1,-1,-1,-1,-1,224,225,226,227,228,228,228,228,229,230,231,232,233,192,88,-1,-1,-1,-1,-1,-1,-1,-1,253,191,191,191,191,191,191,191,191,191,191,191,191,192,88,-1,-1,-1,-1,-1,-1,-1,-1,273,228,228,228,228,228,228,228,228,228,228,228,228,229,88,297,297,297,297,297,297,297,297,297,297,297,297,297,298,299,297,297,297,297,297,297,298,88,297,297,297,297,324,325,326,327,328,297,297,297,297,329,330,324,331,332,333,334,335,329,88,366,366,366,366,366,366,366,366,366,366,366,366,366,367,368,366,366,366,366,366,366,367,88,366,366,366,366,366,366,366,366,366,366,366,366,366,367,368,366,366,366,366,366,366,367,88,366,414,366,415,414,366,415,414,366,415,414,366,415,367,368,414,366,415,414,366,415,367,88}}
sprites_105={width=8,spriteIDs={483,644,645,646,647,648,635,498,527,528,528,528,528,528,528,530,527,528,528,528,528,528,528,530,527,563,528,564,563,528,564,530,714,724,725,726,718,719,720,729}}
sprites_11={width=4,spriteIDs={109,110,-1,-1,141,142,143,144,174,175,176,177,218,219,220,221,-1,-1,-1,-1,-1,-1,-1,-1}}
sprites_128={width=6,spriteIDs={191,191,191,191,191,749,228,228,228,228,228,786,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,848,848,848,848,848,848}}
sprites_14={width=14,spriteIDs={127,128,129,130,131,132,133,134,135,136,137,138,139,140,164,165,21,22,166,167,166,167,168,169,170,171,172,173,207,136,208,209,210,211,210,211,212,213,214,215,216,217}}
sprites_147={width=16,spriteIDs={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,848,848,848,848,848,848,848,848,848,848,848,848,848,848,848,848}}
sprites_17={width=8,spriteIDs={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,294,295,295,295,295,295,295,296,316,317,318,319,320,321,322,323}}
sprites_23={width=8,spriteIDs={243,244,245,246,247,248,249,250,265,266,267,268,269,270,271,272}}
sprites_51={width=1,spriteIDs={361,361,361,440,483,527,527,527,587,483,527,527,527,714,744,785,-1,-1,848}}
sprites_53={width=5,spriteIDs={364,364,364,364,365,364,364,364,364,365,364,412,364,413,365,443,444,445,446,447,486,487,484,484,488,528,528,528,528,529,528,528,528,528,529,564,563,528,564,529,590,591,592,593,594,633,634,635,484,488,528,528,528,528,529,528,528,528,528,529,564,563,528,564,529,717,718,719,720,721,747,748,191,191,191,228,228,228,228,228,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,848,848,848,848,848}}
sprites_67={width=2,spriteIDs={441,442,484,485,528,528,528,528,563,528,588,589,484,632,528,528,528,528,563,528,715,716,745,746,228,228,-1,-1,-1,-1,848,848}}
sprites_68={width=14,spriteIDs={448,449,450,448,451,452,453,454,455,456,457,458,459,460,484,489,490,491,492,484,488,484,493,494,495,496,497,498,528,528,528,528,528,528,529,528,528,528,528,528,528,530,528,528,528,528,528,528,529,528,528,528,528,528,528,530,563,528,564,563,528,564,529,563,528,564,563,528,564,530,591,595,596,597,598,599,600,601,602,590,603,604,605,606,636,637,638,488,484,484,639,640,641,642,643,484,484,498,528,528,528,529,528,528,528,528,528,528,528,528,528,530,528,528,528,529,528,528,528,528,528,528,528,528,528,530,563,528,564,529,563,528,564,563,528,564,563,528,564,530,722,719,723,721,724,725,726,718,719,720,727,728,726,729}}
sprites_70={width=1,spriteIDs={88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,849}}
squarewavepaneldisabled={width=8,spriteIDs={1,2,3,4,5,6,7,8,41,42,43,44,45,46,47,48,89,90,90,90,90,90,90,91,89,90,90,90,90,90,90,91,89,158,90,159,158,90,159,91,197,198,199,200,201,202,203,204}}
squarewavepanelenabled={width=8,spriteIDs={461,462,463,464,465,466,448,460,483,499,500,501,502,503,504,498,527,528,528,528,528,528,528,530,527,528,528,528,528,528,528,530,527,563,528,564,563,528,564,530,587,607,608,609,610,598,611,612}}
stepperbackdisabled={width=2,spriteIDs={137,138,170,171,214,215}}
stepperbackdown={width=2,spriteIDs={145,146,178,179,222,223}}
stepperbackover={width=2,spriteIDs={141,142,174,175,218,219}}
stepperbackup={width=2,spriteIDs={139,140,172,173,216,217}}
steppernextdisabled={width=2,spriteIDs={23,24,61,62,105,106}}
steppernextdown={width=2,spriteIDs={31,32,69,70,111,112}}
steppernextover={width=2,spriteIDs={25,26,63,64,107,108}}
steppernextup={width=2,spriteIDs={143,144,176,177,220,221}}
stopbuttonover={width=2,spriteIDs={811,812,823,824,805,806}}
stopbuttonselectedover={width=2,spriteIDs={819,820,831,832,850,851}}
stopbuttonselectedup={width=2,spriteIDs={815,816,827,828,807,808}}
stopbuttonup={width=2,spriteIDs={125,126,162,163,205,206}}
titlebarvolumeoff={width=1,spriteIDs={109}}
titlebarvolumeon={width=1,spriteIDs={110}}
toolbariconfile={width=1,spriteIDs={251}}
toolbaricontool={width=1,spriteIDs={252}}
undobuttondisabled={width=2,spriteIDs={762,763,799,800,205,206}}
undobuttondown={width=2,spriteIDs={756,757,793,794,807,808}}
undobuttonover={width=2,spriteIDs={750,751,787,788,805,806}}
undobuttonup={width=2,spriteIDs={237,238,259,260,205,206}}
wavebutton1down={width=4,spriteIDs={730,731,732,733,771,772,773,774}}
wavebutton1over={width=4,spriteIDs={687,688,689,690,701,702,703,704}}
wavebutton1selectedover={width=4,spriteIDs={833,834,835,836,852,853,854,855}}
wavebutton1selectedup={width=4,spriteIDs={730,731,732,733,771,772,773,774}}
wavebutton1up={width=4,spriteIDs={649,650,651,652,664,665,666,667}}
wavebutton2down={width=4,spriteIDs={734,735,736,733,775,776,777,778}}
wavebutton2over={width=4,spriteIDs={691,692,693,690,701,705,706,707}}
wavebutton2selectedover={width=4,spriteIDs={837,838,839,836,856,857,858,859}}
wavebutton2selectedup={width=4,spriteIDs={734,735,736,733,775,776,777,778}}
wavebutton2up={width=4,spriteIDs={653,654,655,652,664,668,669,670}}
wavebutton3down={width=4,spriteIDs={737,738,739,733,775,779,780,774}}
wavebutton3over={width=4,spriteIDs={694,695,696,690,701,708,709,704}}
wavebutton3selectedover={width=4,spriteIDs={840,841,842,836,856,860,861,855}}
wavebutton3selectedup={width=4,spriteIDs={737,738,739,733,775,779,780,774}}
wavebutton3up={width=4,spriteIDs={656,657,658,652,664,671,672,667}}
wavebutton4down={width=4,spriteIDs={740,741,742,743,781,782,783,784}}
wavebutton4over={width=4,spriteIDs={697,698,699,700,710,711,712,713}}
wavebutton4selectedover={width=4,spriteIDs={843,844,845,846,862,863,864,865}}
wavebutton4selectedup={width=4,spriteIDs={740,741,742,743,781,782,783,784}}
wavebutton4up={width=4,spriteIDs={659,660,661,662,673,674,675,676}}
-- spritelib-end
|
--[[
Mining power is 3, same as electric miner
Mining Speeds, for reference, burner is 0.35, electric is 0.5
]]--
local animation_speed = 60
local vehicle = {
type = "car",
name = "harvester",
icon = "__Red-Alert-Harvester__/graphics/icons/harv_icon.png",
icon_size = 32,
flags = {"placeable-neutral", "player-creation", "placeable-off-grid"},
minable = {mining_time = 1, result = "harvester"},
max_health = 600,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances = {
{
type = "fire",
decrease = 15,
percent = 50
},
{
type = "physical",
decrease = 0,
percent = 20
},
{
type = "impact",
decrease = 50,
percent = 60
},
},
selection_box = {{-2, -2.4}, {2, 2.4}},
collision_box = {{-1.4, -1.4}, {1.4, 1.4}},
burner =
{
effectivity = 1,
fuel_inventory_size = 2,
smoke = {
{
name = "tank-smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
starting_frame = 0,
starting_frame_deviation = 60
}
}
},
effectivity = 2,
--weight = 15000,
weight = 6000,
consumption = "150kW",
braking_power = "150kW",
terrain_friction_modifier = 0.01,
--friction = 0.03,
friction = 0.045,
rotation_speed = 0.003,
turret_rotation_speed = 0.01,
turret_return_timeout = 300,
tank_driving = true,
light =
{
{
intensity = 0.6,
minimum_darkness = 0.3,
size = 30
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 140,
height = 110,
frame_count = 1,
direction_count = 64,
shift = {0.0, -0.1875},
animation_speed = 8,
max_advance = 0.2,
priority = "low",
stripes =
{
{
filename = "__Red-Alert-Harvester__/graphics/entity/harvester/harv-sheet.png",
width_in_frames = 8,
height_in_frames = 8,
},
}
},
}
},
stop_trigger_speed = 0.2,
sound_no_fuel = { { filename = "__base__/sound/fight/tank-no-fuel-1.ogg", volume = 0.6 }, },
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
working_sound =
{
sound = { filename = "__base__/sound/fight/tank-engine.ogg", volume = 0.6 },
activate_sound = { filename = "__base__/sound/fight/tank-engine-start.ogg", volume = 0.6 },
deactivate_sound = { filename = "__base__/sound/fight/tank-engine-stop.ogg", volume = 0.6 },
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
inventory_size = 50,
track_particle_triggers = data.raw.car.tank.track_particle_triggers
}
--vehicle.animation = data.raw.car.car.animation
data:extend{vehicle}
|
addEventHandler("onColShapeHit", LV,
function (ele, matchingDimension)
if (not ele or not isElement(ele)) then return end
if (ele.type == "player" and matchingDimension) then
--outputDebugString("Entered LV")
triggerEvent("onPlayerEnterLV", ele)
end
end
)
addEventHandler("onColShapeLeave", LV,
function (ele, matchingDimension)
if (not ele) then return end
if (ele.type == "player" and matchingDimension) then
--outputDebugString("Left LV")
triggerEvent("onPlayerLeaveLV", ele)
end
end
)
function onPlayerLeaveLV()
end
addEvent("onPlayerLeaveLV", true)
addEventHandler("onPlayerLeaveLV", root, onPlayerLeaveLV)
function onPlayerEnterLV()
end
addEvent("onPlayerEnterLV", true)
addEventHandler("onPlayerEnterLV", root, onPlayerEnterLV)
|
local class = require "class"
return class "State" {
__init__ = function(self)
self.resolution = GetResolution()
self.titleFont = Font("Silkscreen", 36, 1, false)
self.uiFont = Font("Silkscreen", 14, 1, false)
end,
enter = function(self) end,
leave = function(self) end,
draw = function(self) end,
draw2d = function(self) end,
update = function(self) end,
input = function(self) end,
}
|
--
-- Author: wangdi
-- Date: 2016-02-11 21:19:47
--
local Buff = import("src/app/view/Buff.lua")
local BossEnemy = class("BossEnemy", import("src/app/view/BaseEnemy"))
BossEnemyType = {}
BossEnemyType.kTiny = 0
BossEnemyType.kBig = 1
function BossEnemy:ctor()
BossEnemy.super.ctor(self)
self:pos()
if math.random(0, 100) <= 40 then
self.type = BossEnemyType.kTiny
else
self.type = BossEnemyType.kBig
end
if self.type == BossEnemyType.kTiny then
self:setSpriteFrame(display.newSpriteFrame("enemy_black.png"))
self:setMoveSpeed(26)
self:setScore(400)
self.life = 10
self:addTailParticle(130, 1)
self:setTimerName("#speedBar.png")
self:addHP(0.6)
else
self:setSpriteFrame(display.newSpriteFrame("enemy_boss.png"))
self:setMoveSpeed(30)
self:setScore(500)
self.life = 18
self:addTailParticle(150, 1.8)
self:setTimerName("#hpBar.png")
self:addHP(0.9)
end
self.maxLife = self.life
end
function BossEnemy:reduceHP(bullet)
self.life = self.life - bullet:getBulletPower()
if self.life <=0 then
self.life = 0
if self.type == 0 then
self:splitBullet(18)
self:createBuff()
else
self:splitBullet(22)
--self:splitBullet(22)
self:createBuff()
self:createBuff()
self:createBuff()
end
self:remove()
else
self.hp:setPercentage(100 / self.maxLife * self.life)
end
end
function BossEnemy:createBuff()
local buff = Buff.new(math.random(0, 6))
local x = self:getPositionX()
if x < 0 then
x = 5
elseif x > display.width then
x = display.width - 5
end
buff:setPosition(x, self:getPositionY())
buff:setRotation(math.random(0, 180))
self:getParent():add(buff, 2)
end
return BossEnemy
|
---@<error descr="Alias 'CircularAlias1' circularly references itself.">alias CircularAlias1 string | CircularAlias2</error>
---@<error descr="Alias 'CircularAlias2' circularly references itself.">alias CircularAlias2 number | CircularAlias1</error>
---@<error descr="Alias 'CircularGenericAlias1' circularly references itself.">alias CircularGenericAlias1<T> T | CircularGenericAlias2<T></error>
---@<error descr="Alias 'CircularGenericAlias2' circularly references itself.">alias CircularGenericAlias2<T> CircularGenericAlias1<T></error>
|
local telescope = require('telescope')
telescope.setup({
defaults = {
-- Default configuration for telescope goes here:
-- config_key = value,
-- ..
-- layout_config = {
-- prompt_position = "top"
-- }
},
pickers = {
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
-- Your extension configuration goes here:
-- extension_name = {
-- extension_config_key = value,
-- }
-- please take a look at the readme of the extension you want to configure
}
})
telescope.load_extension('fzy_native')
|
Class = require 'class'
require 'Ball'
require 'Paddle'
require 'AiPaddle'
require 'Menu'
require 'PauseMenu'
require 'Powerup'
WINDOW_WIDTH = 1000
WINDOW_HEIGHT = 560
fonts = {
['retroS'] = love.graphics.newFont('assets/fonts/Retro_Gaming.ttf', 16),
['retroL'] = love.graphics.newFont('assets/fonts/Retro_Gaming.ttf', 26),
['retroXL'] = love.graphics.newFont('assets/fonts/Retro_Gaming.ttf', 42)
}
sounds = {
['paddleHit'] = love.audio.newSource('assets/sounds/PaddleHit.wav', 'static'),
['wallHit'] = love.audio.newSource('assets/sounds/WallHit.wav', 'static'),
['background'] = love.audio.newSource('assets/sounds/Background.mp3', 'static'),
['death'] = love.audio.newSource('assets/sounds/Death.wav', 'static'),
['powerUp'] = love.audio.newSource('assets/sounds/PowerUp.wav', 'static'),
['powerDown'] = love.audio.newSource('assets/sounds/PowerDown.wav', 'static'),
['gameOver'] = love.audio.newSource('assets/sounds/GameOver.wav', 'static'),
['menuOpen'] = love.audio.newSource('assets/sounds/MenuOpen.wav', 'static'),
['menuOption'] = love.audio.newSource('assets/sounds/MenuOption.wav', 'static')
}
gameState = {
['startMenu'] = 'Start Menu',
['pauseMenu'] = 'Pause Menu',
['setAi'] = 'AI Start',
['setPlayer'] = 'Player Start',
['start'] = 'Start',
['play'] = 'Play',
['pause'] = 'Pause',
['winPlayer1'] = 'Player 1 Won',
['winPlayer2'] = 'Player 2 Won'
}
function love.keypressed(key)
if key == 'escape' then
if currentState == gameState.play then
sounds['menuOpen']:play()
currentState = gameState.pauseMenu
elseif currentState == gameState.pauseMenu then
currentState = gameState.play
end
end
if currentState == gameState.startMenu then
if startMenu:changeSelection(key) then
return
end
end
if currentState == gameState.pauseMenu then
if pauseMenu:changeSelection(key) then
return
end
end
if key == 'enter' or key == 'return' or key == 'space' then
if currentState == gameState.startMenu then
startMenu:performSelection()
elseif currentState == gameState.pauseMenu then
pauseMenu:performSelection()
end
return
end
end
function love.load()
-- set love's default to "nearest-neighbour" which means there will be no filtering of pixels for a better 2D look
love.graphics.setDefaultFilter('nearest', 'nearest')
-- set the title of our application window
love.window.setTitle('Pong Remade')
-- set random seed for random number
math.randomseed(os.time())
-- set window properties
love.window.setMode(WINDOW_WIDTH, WINDOW_HEIGHT, {
fullscreen = false,
resizable = false,
vsync = true
})
love.graphics.setFont(fonts.retroS)
sounds['background']:setLooping(true)
sounds['background']:play()
startMenu = Menu()
pauseMenu = PauseMenu()
ball = Ball(WINDOW_WIDTH/2, WINDOW_HEIGHT/2, 10, 10)
aiPlayer = AiPaddle(30, 80, 8, 120)
realPlayer = Paddle(30, 80, 8, 120, 'w', 's')
player1 = realPlayer
player2 = Paddle(WINDOW_WIDTH-30, WINDOW_HEIGHT-80, 8, 120, 'up', 'down')
powerup = Powerup()
gameOver = 'none'
currentState = gameState.startMenu
end
function love.update(dt)
if currentState == gameState.winPlayer1 or currentState == gameState.winPlayer2 then
sounds['background']:pause()
sounds['death']:play()
gameOver = currentState
love.timer.sleep(0.5)
currentState = gameState.startMenu
sounds['gameOver']:play()
love.timer.sleep(1.6)
end
if currentState == gameState.setAi then
player1 = aiPlayer
currentState = gameState.start
elseif currentState == gameState.setPlayer then
player1 = realPlayer
currentState = gameState.start
end
if currentState == gameState.start then
gameOver = 'none'
ball:reset()
player1:reset()
player2:reset()
currentState = gameState.play
end
if currentState == gameState.startMenu or currentState == gameState.play then
if not sounds['background']:isPlaying() then
sounds['background']:play()
end
ball:update(dt)
end
if currentState == gameState.play then
player1:update(dt)
player2:update(dt)
end
collision = 'none'
if ball:collides(player1) then
collision = player1
elseif ball:collides(player2) then
collision = player2
end
if collision ~= 'none' then
sounds['paddleHit']:play()
-- ball-paddle-Dist
bottomTopDist = (ball.y+ball.height/2) - (collision.y-collision.height/2)
topBottomDist = (collision.y+collision.height/2) - (ball.y-ball.height/2)
leftRightDist = (collision.x+collision.width/2) - (ball.x-ball.width/2)
rightLeftDist = (ball.x+ball.width/2) - (collision.x-collision.width/2)
if ball.y > collision.y-collision.height/2 and ball.y < collision.y+collision.height/2 then
ball.dx = -ball.dx
elseif bottomTopDist < topBottomDist then
-- handling corner cases
-- collision at top side of paddle
if bottomTopDist < leftRightDist or bottomTopDist < rightLeftDist then
ball.dy = -ball.dy
ball.y = ball.y - (bottomTopDist + 1)
else
ball.dx = - ball.dx
end
else
-- collision at the bottom side of the paddle
if topBottomDist < leftRightDist or topBottomDist < rightLeftDist then
ball.dy = -ball.dy
ball.y = ball.y + (topBottomDist + 1)
else
ball.dx = -ball.dx
end
end
if ball.dx > 0 then
ball.x = ball.x + (leftRightDist + 1)
else
ball.x = ball.x - (rightLeftDist + 1)
end
end
if powerup.active == false and math.random(1, 50) == 10 then
powerup:spawn()
end
powerup:update(dt)
collision = 'none'
if powerup:collides(player1) then
collision = player1
elseif powerup:collides(player2) then
collision = player2
end
if collision ~= 'none' then
powerup:apply(collision)
end
player1.powerup.update(player1, dt)
player2.powerup.update(player2, dt)
ball.powerup.update(ball, dt)
end
function love.draw()
-- wipe screen
love.graphics.clear(20/255, 20/255, 20/255, 1)
powerup:render()
ball:render()
player1:render()
player2:render()
if currentState == gameState.startMenu then
startMenu:render()
elseif currentState == gameState.pauseMenu then
pauseMenu:render()
end
if gameOver ~= 'none' then
love.graphics.setFont(fonts.retroXL)
love.graphics.setColor(1, 1, 1, 1)
love.graphics.print(gameOver, WINDOW_WIDTH/2-fonts['retroXL']:getWidth(gameOver)/2, WINDOW_HEIGHT/6)
end
end
|
local b4={}; for k,_ in pairs(_ENV) do b4[k]=k end
package.path = '../src/?.lua;' .. package.path
local _=require"tricks"
local the=require"the"
local go, ok, oo, eg = _.go, _.ok, _.oo, {}
local the = require"the"
local THINK = require"THINK"
local ABCD = require"ABCD"
function eg.thing(tst, abcd)
abcd = ABCD()
for _,x in pairs(THINK:new4file(the.file).log) do
abcd:add(x.want, x.got) end
abcd:show()
end
go(the, eg, b4)
|
local class = require 'middleclass'
-- クラス:ヒットポイント
local HitPoint = class 'HitPoint'
-- 組み込み
HitPoint:include(require 'Class')
HitPoint:include(require 'Clamp')
HitPoint:include(require 'Readonly')
-- 初期化
function HitPoint:initialize(t)
self:initializeClamp(t)
end
return HitPoint
|
pfUI:RegisterSkin("Options - Sound", "vanilla:tbc", function ()
local rawborder, border = GetBorderSize()
local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel()
-- Compatibility
local SoundOptionsFrameHeaderText, NUM_CHECKBOXES, NUM_SLIDERS
if SOUND_OPTIONS then -- tbc
SoundOptionsFrameHeaderText = GetNoNameObject(SoundOptionsFrame, "FontString", "BACKGROUND", SOUND_OPTIONS)
NUM_CHECKBOXES = 11
NUM_SLIDERS = 6
StripTextures(AudioOptionsFrame)
CreateBackdrop(SoundOptionsFramePlayback, nil, true, .75)
CreateBackdrop(SoundOptionsFrameHardware, nil, true, .75)
CreateBackdrop(SoundOptionsFrameVolume, nil, true, .75)
SkinDropDown(SoundOptionsOutputDropDown)
SoundOptionsFrameDefaults:ClearAllPoints()
SoundOptionsFrameDefaults:SetPoint("TOPLEFT", SoundOptionsFramePlayback, "BOTTOMLEFT", 0, -10)
SoundOptionsFrameCancel:ClearAllPoints()
SoundOptionsFrameCancel:SetPoint("TOPRIGHT", SoundOptionsFrameVolume, "BOTTOMRIGHT", 0, -10)
SoundOptionsFrameOkay:ClearAllPoints()
SoundOptionsFrameOkay:SetPoint("RIGHT", SoundOptionsFrameCancel, "LEFT", -2*bpad, 0)
else -- vanilla
SoundOptionsFrameHeaderText = GetNoNameObject(SoundOptionsFrame, "FontString", "ARTWORK", SOUNDOPTIONS_MENU)
NUM_CHECKBOXES = 8
NUM_SLIDERS = 4
SoundOptionsFrameOkay:ClearAllPoints()
SoundOptionsFrameOkay:SetPoint("RIGHT", SoundOptionsFrameCancel, "LEFT", -2*bpad, 0)
SoundOptionsFrameSlider1:ClearAllPoints()
SoundOptionsFrameSlider1:SetPoint("TOPRIGHT", SoundOptionsFrame, "TOPRIGHT", -18, -43)
for i=2, NUM_SLIDERS do
_G["SoundOptionsFrameSlider"..i]:ClearAllPoints()
_G["SoundOptionsFrameSlider"..i]:SetPoint("TOP", _G["SoundOptionsFrameSlider"..i-1], "BOTTOM", 0, -30)
end
end
StripTextures(SoundOptionsFrame)
CreateBackdrop(SoundOptionsFrame, nil, true, .75)
CreateBackdropShadow(SoundOptionsFrame)
EnableMovable(SoundOptionsFrame)
HookScript(SoundOptionsFrame, "OnShow", function()
this:ClearAllPoints()
this:SetPoint("CENTER", 0, 0)
end)
SoundOptionsFrameHeaderText:ClearAllPoints()
SoundOptionsFrameHeaderText:SetPoint("TOP", 0, -10)
SkinButton(SoundOptionsFrameDefaults)
SkinButton(SoundOptionsFrameCancel)
SkinButton(SoundOptionsFrameOkay)
for i=1, NUM_CHECKBOXES do
local btn = _G["SoundOptionsFrameCheckButton"..i]
if btn then
SkinCheckbox(btn, 28)
end
end
for i=1, NUM_SLIDERS do
SkinSlider(_G["SoundOptionsFrameSlider"..i])
end
end)
|
-- luacheck: globals describe it expect
return function()
local function helper()
expect(1).to.never.equal(2)
end
describe("from within a describe block", function()
it("helpers should be able to access expect", function()
helper()
end)
end)
end
|
#!/usr/bin/env lua
-- This file is part of MXE.
-- See index.html for further information.
-- build-pkg, Build binary packages from MXE packages
-- Instructions: http://mxe.redjohn.tk
-- Requirements: MXE, lua, tsort, fakeroot, dpkg-deb.
-- Usage: lua tools/build-pkg.lua
-- Packages are written to `*.tar.xz` files.
-- Debian packages are written to `*.deb` files.
local max_packages = tonumber(os.getenv('MXE_MAX_PACKAGES'))
local ARCH = 'amd64'
local MXE_DIR = '/usr/lib/mxe'
local BLACKLIST = {
'^usr/installed/check%-requirements$',
'^usr/share/',
}
local COMMON_FILES = {
['gcc-isl'] = {
'^usr/include/isl/',
'^usr/lib/libisl%.',
'^usr/lib/pkgconfig/isl.pc$',
},
['gcc-mpc'] = {
'^usr/include/mpc.h$',
'^usr/lib/libmpc%.',
},
['gcc-gmp'] = {
'^usr/include/gmp.h$',
'^usr/lib/libgmp%.',
},
['gcc-mpfr'] = {
'^usr/include/mpf2mpfr.h$',
'^usr/include/mpfr.h$',
'^usr/lib/libmpfr%.',
},
['gcc'] = {
'^usr/lib/libcc1%.',
},
['yasm'] = {
'^usr/include/libyasm',
'^usr/lib/libyasm.a$',
},
['ncurses'] = {
'^usr/lib/pkgconfig/',
},
['pkgconf'] = {
'^usr/bin/config.guess$',
},
}
local ARCH_FOR_COMMON = 'i686-w64-mingw32.static'
local target -- used by many functions
local function log(...)
print(target, ...)
end
-- based on http://lua-users.org/wiki/SplitJoin
local function split(self, sep, nMax, plain)
if not sep then
sep = '%s+'
end
assert(sep ~= '')
assert(nMax == nil or nMax >= 1)
local aRecord = {}
if self:len() > 0 then
nMax = nMax or -1
local nField = 1
local nStart = 1
local nFirst, nLast = self:find(sep, nStart, plain)
while nFirst and nMax ~= 0 do
aRecord[nField] = self:sub(nStart, nFirst - 1)
nField = nField + 1
nStart = nLast + 1
nFirst, nLast = self:find(sep, nStart, plain)
nMax = nMax - 1
end
aRecord[nField] = self:sub(nStart)
end
return aRecord
end
local function trim(str)
local text = str:gsub("%s+$", "")
text = text:gsub("^%s+", "")
return text
end
local function shell(cmd)
local f = io.popen(cmd, 'r')
local text = f:read('*all')
f:close()
return text
end
-- return several tables describing packages
-- * list of packages
-- * map from package to list of deps
-- * map from package to version of package
local function getPkgs()
-- create file deps.mk showing deps
-- (make show-upstream-deps-% does not present in
-- stable MXE)
local deps_mk_content = [[
include Makefile
NOTHING:=
SPACE:=$(NOTHING) $(NOTHING)
NAME_WITH_UNDERSCORES:=$(subst $(SPACE),_,$(NAME))
print-deps:
@$(foreach pkg,$(PKGS),echo \
for-build-pkg $(pkg) \
$(subst $(SPACE),-,$($(pkg)_VERSION)) \
$($(pkg)_DEPS);)]]
local deps_mk_file = io.open('deps.mk', 'w')
deps_mk_file:write(deps_mk_content)
deps_mk_file:close()
local pkgs = {}
local pkg2deps = {}
local pkg2ver = {}
local cmd = 'make -f deps.mk print-deps MXE_TARGETS=%s'
cmd = cmd:format(target)
local make = io.popen(cmd)
for line in make:lines() do
local deps = split(trim(line))
if deps[1] == 'for-build-pkg' then
-- first value is marker 'for-build-pkg'
table.remove(deps, 1)
-- first value is name of package which depends on
local pkg = table.remove(deps, 1)
-- second value is version of package
local ver = table.remove(deps, 1)
table.insert(pkgs, pkg)
pkg2deps[pkg] = deps
pkg2ver[pkg] = ver
end
end
make:close()
os.remove('deps.mk')
return pkgs, pkg2deps, pkg2ver
end
-- return packages ordered in build order
-- this means, if pkg1 depends on pkg2, then
-- pkg2 preceeds pkg1 in the list
local function sortForBuild(pkgs, pkg2deps)
-- use sommand tsort
local tsort_input_fname = os.tmpname()
local tsort_input = io.open(tsort_input_fname, 'w')
for _, pkg1 in ipairs(pkgs) do
for _, pkg2 in ipairs(pkg2deps[pkg1]) do
tsort_input:write(pkg2 .. ' ' .. pkg1 .. '\n')
end
end
tsort_input:close()
--
local build_list = {}
local tsort = io.popen('tsort ' .. tsort_input_fname, 'r')
for line in tsort:lines() do
local pkg = trim(line)
table.insert(build_list, pkg)
end
tsort:close()
os.remove(tsort_input_fname)
return build_list
end
local function isListed(file, list)
for _, pattern in ipairs(list) do
if file:match(pattern) then
return true
end
end
return false
end
local function isBlacklisted(file)
return isListed(file, BLACKLIST)
end
-- return set of all filepaths under ./usr/
local function findFiles()
local files = {}
local find = io.popen('find usr -type f -or -type l', 'r')
for line in find:lines() do
local file = trim(line)
if not isBlacklisted(file) then
files[file] = true
end
end
find:close()
return files
end
-- builds package, returns list of new files
local function buildPackage(pkg)
local files_before = findFiles()
local cmd = 'make %s MXE_TARGETS=%s --jobs=1'
os.execute(cmd:format(pkg, target))
local files_after = findFiles()
local new_files = {}
for file in pairs(files_after) do
if not files_before[file] then
table.insert(new_files, file)
end
end
return new_files
end
local function nameToDebian(pkg, t)
local name = 'mxe-%s-%s'
name = name:format(t or target, pkg)
name = name:gsub('_', '-')
return name
end
local function protectVersion(ver)
ver = ver:gsub('_', '-')
if ver:sub(1, 1):match('%d') then
return ver
else
-- version number does not start with digit
return '0.' .. ver
end
end
local CONTROL = [[Package: %s
Version: %s
Section: devel
Priority: optional
Architecture: %s
Depends: %s
Maintainer: Boris Nagaev <bnagaev@gmail.com>
Homepage: http://mxe.cc
Description: MXE package %s for %s
MXE (M cross environment) is a Makefile that compiles
a cross compiler and cross compiles many free libraries
such as SDL and Qt for various target platforms (MinGW).
.
This package contains the files for MXE package %s.
]]
local function makeDeb(pkg, list_path, deps, ver, add_common)
local deb_pkg = nameToDebian(pkg)
local dirname = ('%s_%s'):format(deb_pkg,
protectVersion(ver))
-- make .tar.xz file
local tar_name = dirname .. '.tar.xz'
local cmd = 'tar -T %s --owner=0 --group=0 -cJf %s'
os.execute(cmd:format(list_path, tar_name))
-- unpack .tar.xz to the path for Debian
local usr = dirname .. MXE_DIR
os.execute(('mkdir -p %s'):format(usr))
-- use tar to copy files with paths
local cmd = 'fakeroot -s deb.fakeroot tar -C %s -xf %s'
os.execute(cmd:format(usr, tar_name))
-- prepare dependencies
local deb_deps = {'mxe-requirements'}
for _, dep in ipairs(deps) do
table.insert(deb_deps, nameToDebian(dep))
end
if add_common then
table.insert(deb_deps, nameToDebian(pkg, 'common'))
end
local deb_deps_str = table.concat(deb_deps, ', ')
-- make DEBIAN/control file
os.execute(('mkdir -p %s/DEBIAN'):format(dirname))
local control_fname = dirname .. '/DEBIAN/control'
local control = io.open(control_fname, 'w')
control:write(CONTROL:format(deb_pkg, protectVersion(ver),
ARCH, deb_deps_str, pkg, target, pkg))
control:close()
-- make .deb file
local cmd = 'fakeroot -i deb.fakeroot dpkg-deb -b %s'
os.execute(cmd:format(dirname))
-- cleanup
os.execute(('rm -fr %s deb.fakeroot'):format(dirname))
end
local function readFileList(list_file)
local list = {}
for installed_file in io.lines(list_file) do
table.insert(list, installed_file)
end
return list
end
local function saveFileList(list_file, list)
local file = io.open(list_file, 'w')
for _, installed_file in ipairs(list) do
file:write(installed_file .. '\n')
end
file:close()
end
local function isBuilt(pkg, files)
local INSTALLED = 'usr/%s/installed/%s'
local installed = INSTALLED:format(target, pkg)
for _, file in ipairs(files) do
if file == installed then
return true
end
end
return false
end
-- build all packages, save filelist to file #pkg.list
local function buildPackages(pkgs, pkg2deps)
local broken = {}
local unbroken = {}
local function brokenDep(pkg)
for _, dep in ipairs(pkg2deps[pkg]) do
if broken[dep] then
return dep
end
end
return false
end
for _, pkg in ipairs(pkgs) do
if not brokenDep(pkg) then
local files = buildPackage(pkg)
if isBuilt(pkg, files) then
saveFileList(pkg .. '.list', files)
table.insert(unbroken, pkg)
else
-- broken package
broken[pkg] = true
log('The package is broken: ' .. pkg)
end
else
broken[pkg] = true
local msg = 'Package %s depends on broken %s'
log(msg:format(pkg, brokenDep(pkg)))
end
end
return unbroken
end
local function filterFiles(pkg, filter_common)
local list = readFileList(pkg .. '.list')
local list2 = {}
local common_list = COMMON_FILES[pkg]
for _, installed_file in ipairs(list) do
local listed = isListed(installed_file, common_list)
if listed == filter_common then
table.insert(list2, installed_file)
end
end
return list2
end
local function excludeCommon(pkg)
local noncommon_files = filterFiles(pkg, false)
saveFileList(pkg .. '.list', noncommon_files)
end
local function makeCommonDeb(pkg, ver)
local common_files = filterFiles(pkg, true)
local list_path = pkg .. '.common-list'
saveFileList(list_path, common_files)
local orig_target = target
target = 'common'
makeDeb(pkg, list_path, {}, ver)
target = orig_target
end
local function makeDebs(pkgs, pkg2deps, pkg2ver)
for _, pkg in ipairs(pkgs) do
local deps = assert(pkg2deps[pkg], pkg)
local ver = assert(pkg2ver[pkg], pkg)
local list_path = pkg .. '.list'
local add_common = false
if COMMON_FILES[pkg] then
if target == ARCH_FOR_COMMON then
makeCommonDeb(pkg, ver)
end
add_common = true
excludeCommon(pkg)
end
makeDeb(pkg, list_path, deps, ver, add_common)
end
end
local function clean()
local cmd = 'make clean MXE_TARGETS=%s'
os.execute(cmd:format(target))
end
local function buildForTarget(mxe_target)
target = mxe_target
local pkgs, pkg2deps, pkg2ver = getPkgs()
local build_list = sortForBuild(pkgs, pkg2deps)
if max_packages then
while #build_list > max_packages do
table.remove(build_list)
end
end
clean()
local unbroken = buildPackages(build_list, pkg2deps)
makeDebs(unbroken, pkg2deps, pkg2ver)
clean()
end
local function getMxeVersion()
local index_html = io.open 'index.html'
local text = index_html:read('*all')
index_html:close()
return text:match('Release ([^<]+)')
end
local MXE_REQUIREMENTS_CONTROL = [[Package: %s
Version: %s
Section: devel
Priority: optional
Architecture: %s
Depends: %s
Maintainer: Boris Nagaev <bnagaev@gmail.com>
Homepage: http://mxe.cc
Description: MXE requirements package
MXE (M cross environment) is a Makefile that compiles
a cross compiler and cross compiles many free libraries
such as SDL and Qt for various target platforms (MinGW).
.
This package depends on all Debian dependencies of MXE.
Other MXE packages depend on this package.
]]
local function makeMxeRequirementsDeb(release)
local name = 'mxe-requirements'
local ver = getMxeVersion()
-- dependencies
local deps = {
'autoconf', 'automake', 'autopoint', 'bash', 'bison',
'bzip2', 'cmake', 'flex', 'gettext', 'git', 'g++',
'gperf', 'intltool', 'libffi-dev', 'libtool',
'libltdl-dev', 'libssl-dev', 'libxml-parser-perl',
'make', 'openssl', 'patch', 'perl', 'p7zip-full',
'pkg-config', 'python', 'ruby', 'scons', 'sed',
'unzip', 'wget', 'xz-utils',
'g++-multilib', 'libc6-dev-i386',
}
if release ~= 'wheezy' then
-- Jessie+
table.insert(deps, 'libtool-bin')
end
local deps_str = table.concat(deps, ', ')
-- directory
local DIRNAME = '%s/%s_%s_%s'
local dirname = DIRNAME:format(release, name, ver, ARCH)
-- make DEBIAN/control file
os.execute(('mkdir -p %s/DEBIAN'):format(dirname))
local control_fname = dirname .. '/DEBIAN/control'
local control = io.open(control_fname, 'w')
control:write(MXE_REQUIREMENTS_CONTROL:format(name,
ver, ARCH, deps_str))
control:close()
-- make .deb file
local cmd = 'fakeroot -i deb.fakeroot dpkg-deb -b %s'
os.execute(cmd:format(dirname))
-- cleanup
os.execute(('rm -fr %s deb.fakeroot'):format(dirname))
end
assert(trim(shell('pwd')) == MXE_DIR,
"Clone MXE to " .. MXE_DIR)
buildForTarget('i686-w64-mingw32.static')
buildForTarget('x86_64-w64-mingw32.static')
buildForTarget('i686-w64-mingw32.shared')
buildForTarget('x86_64-w64-mingw32.shared')
makeMxeRequirementsDeb('wheezy')
makeMxeRequirementsDeb('jessie')
|
local function init()
--Load all styles
getAllStyles()
--Debug testing
if(DEBUG) then
end
end
addEventHandler("onClientResourceStart", resourceRoot, init)
|
local time = 0
local update_time = tonumber(minetest.setting_get("3d_armor_update_time"))
if not update_time then
update_time = 1
minetest.setting_set("3d_armor_update_time", tostring(update_time))
end
armor = {
player_hp = {},
elements = {"head", "torso", "legs", "feet"},
formspec = "size[8,8.5]button[0,0;2,0.5;main;Back]"
.."list[current_player;main;0,4.5;8,4;]"
.."list[detached:player_name_armor;armor_head;3,0;1,1;]"
.."list[detached:player_name_armor;armor_torso;3,1;1,1;]"
.."list[detached:player_name_armor;armor_legs;3,2;1,1;]"
.."list[detached:player_name_armor;armor_feet;3,3;1,1;]",
textures = {},
default_skin = "character.png",
}
-- armor.def - Added by BlockMen for HUD integration
armor.def = {
state = 0,
count = 0,
level = 0,
}
armor.update_player_visuals = function(self, player)
if not player then
return
end
local name = player:get_player_name()
if self.textures[name] then
default.player_set_textures(player, {
self.textures[name].skin,
self.textures[name].armor,
self.textures[name].wielditem,
})
end
end
armor.set_player_armor = function(self, player)
if not player then
return
end
local name = player:get_player_name()
local player_inv = player:get_inventory()
local armor_texture = "3d_armor_trans.png"
local armor_level = 0
local state = 0
local items = 0
local textures = {}
local elements = {}
local physics_o = {}
for i, v in ipairs(self.elements) do
local stack = player_inv:get_stack("armor_"..v, 1)
local level = stack:get_definition().groups["armor_"..v]
local item = stack:get_name()
elements[i] = string.match(item, "%:.+_(.+)$")
if level then
table.insert(textures, item:gsub("%:", "_")..".png")
armor_level = armor_level + level
state = state + stack:get_wear()
items = items + 1
end
-- PHYSICS ARE PERSISTANT ACROSS SESSIONS SO NO NEED TO REAPPLY PHYSICS HERE, ONLY WHEN
-- ARMOR IS PUT ON, REMOVED, OR DESTROYED
--if player_physics_applied[name] == false then
-- physics.apply_item_physics(player,item)
--end
end
--if player_physics_applied[name] == false then
-- player_physics_applied[name] = true
--end
if minetest.get_modpath("shields") then
armor_level = armor_level * 0.9
end
if elements[1] == elements[2] and
elements[1] == elements[3] and
elements[1] == elements[4] then
armor_level = armor_level * 1.1
end
if #textures > 0 then
armor_texture = table.concat(textures, "^")
end
local armor_groups = {fleshy=100}
if armor_level > 0 then
armor_groups.level = math.floor(armor_level / 20)
armor_groups.fleshy = 100 - armor_level
end
player:set_armor_groups(armor_groups)
self.textures[name].armor = armor_texture
self.def[name].state = state
self.def[name].count = items
self.def[name].level = armor_level
self:update_player_visuals(player)
end
armor.update_armor = function(self, player)
if not player then
return
end
local name = player:get_player_name()
local hp = player:get_hp() or 0
if hp == 0 or hp == self.player_hp[name] then
return
end
if self.player_hp[name] > hp then
local player_inv = player:get_inventory()
local armor_inv = minetest.get_inventory({type="detached", name=name.."_armor"})
if not armor_inv then
return
end
local heal_max = 0
local state = 0
local items = 0
for _,v in ipairs(self.elements) do
local stack = armor_inv:get_stack("armor_"..v, 1)
if stack:get_count() > 0 then
local use = stack:get_definition().groups["armor_use"] or 0
local heal = stack:get_definition().groups["armor_heal"] or 0
local item = stack:get_name()
stack:add_wear(use)
armor_inv:set_stack("armor_"..v, 1, stack)
player_inv:set_stack("armor_"..v, 1, stack)
state = state + stack:get_wear()
items = items + 1
if stack:get_count() == 0 then
local desc = minetest.registered_items[item].description
if desc then
minetest.chat_send_player(name, "Your "..desc.." got destroyed!")
end
-- TODO REVERSE DESTROYED ARMOR PHYSICS HERE
physics.remove_item_physics(player,item)
self:set_player_armor(player)
end
heal_max = heal_max + heal
end
end
self.def[name].state = state
self.def[name].count = items
if heal_max > math.random(100) then
player:set_hp(self.player_hp[name])
return
end
end
self.player_hp[name] = hp
end
-- Register Player Model
default.player_register_model("3d_armor_character.x", {
animation_speed = 30,
textures = {
armor.default_skin,
"3d_armor_trans.png",
"3d_armor_trans.png",
},
animations = {
stand = {x=0, y=79},
lay = {x=162, y=166},
walk = {x=168, y=187},
mine = {x=189, y=198},
walk_mine = {x=200, y=219},
sit = {x=81, y=160},
},
})
-- Register Callbacks
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if fields.armor then
local formspec = armor.formspec:gsub("player_name", name)
inventory_plus.set_inventory_formspec(player, formspec)
return
end
for field, _ in pairs(fields) do
if string.find(field, "^skins_set_") then
minetest.after(0, function(player)
armor.textures[name].skin = skins.skins[name]..".png"
armor:update_player_visuals(player)
end, player)
end
end
end)
minetest.register_on_joinplayer(function(player)
default.player_set_model(player, "3d_armor_character.x")
inventory_plus.register_button(player,"armor", "Armor")
local player_inv = player:get_inventory()
local name = player:get_player_name()
local armor_inv = minetest.create_detached_inventory(name.."_armor",{
on_put = function(inv, listname, index, stack, player)
player:get_inventory():set_stack(listname, index, stack)
physics.apply_item_physics(player,stack:get_name())
armor:set_player_armor(player)
end,
on_take = function(inv, listname, index, stack, player)
player:get_inventory():set_stack(listname, index, nil)
physics.remove_item_physics(player,stack:get_name())
armor:set_player_armor(player)
end,
allow_put = function(inv, listname, index, stack, player)
if inv:is_empty(listname) then
return 1
end
return 0
end,
allow_take = function(inv, listname, index, stack, player)
return stack:get_count()
end,
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
return 0
end,
})
for _,v in ipairs(armor.elements) do
local list = "armor_"..v
player_inv:set_size(list, 1)
armor_inv:set_size(list, 1)
armor_inv:set_stack(list, 1, player_inv:get_stack(list, 1))
end
armor.player_hp[name] = 0
armor.def[name] = {
state = 0,
count = 0,
}
armor.textures[name] = {
skin = armor.default_skin,
armor = "3d_armor_trans.png",
wielditem = "3d_armor_trans.png",
}
if minetest.get_modpath("skins") then
local skin = skins.skins[name]
if skin and skins.get_type(skin) == skins.type.MODEL then
armor.textures[name].skin = skin..".png"
end
end
if minetest.get_modpath("player_textures") then
local filename = minetest.get_modpath("player_textures").."/textures/player_"..name
local f = io.open(filename..".png")
if f then
f:close()
armor.textures[name].skin = "player_"..name..".png"
end
end
minetest.after(1, function(player)
armor:set_player_armor(player)
end, player)
end)
local function update_armor_wrapper(player,name,dtime)
armor:update_armor(player)
end
adventuretest.register_pl_hook(update_armor_wrapper,update_time)
|
local make = vim.api.nvim_set_keymap
function make_map(mode, def_opts)
return function (from, to, opts)
local newopts = vim.tbl_extend('force', def_opts or {}, opts or {})
vim.api.nvim_set_keymap(mode, from, to, newopts)
end
end
return {
noremap = make_map('', {noremap = true}),
nnoremap = make_map('n', {noremap = true}),
nnoremap_silent = make_map('n', {noremap = true, silent = true}),
vnoremap = make_map('v', {noremap = true}),
inoremap = make_map('i', {noremap = true}),
inoremap_silent = make_map('i', {noremap = true, silent = true}),
nmap = make_map('n'),
nmap_silent = make_map('n', {silent = true}),
vmap = make_map('v'),
omap = make_map('o'),
xmap = make_map('x'),
xmap_silent = make_map('x', {silent = true}),
}
|
pg = pg or {}
pg.enemy_data_statistics_354 = {
[15102503] = {
cannon = 115,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
base = 535,
air = 188,
durability_growth = 0,
dodge = 0,
antiaircraft = 0,
speed = 120,
luck = 0,
reload_growth = 0,
dodge_growth = 0,
icon = "jiguan_tu",
antiaircraft_growth = 0,
hit = 30,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 0,
durability = 9999999,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 0,
armor = 0,
id = 15102503,
equipment_list = {}
},
[15102504] = {
cannon = 115,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
base = 535,
air = 188,
durability_growth = 0,
dodge = 0,
antiaircraft = 0,
speed = 120,
luck = 0,
reload_growth = 0,
dodge_growth = 0,
icon = "jiguan_shengming",
antiaircraft_growth = 0,
hit = 30,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 0,
durability = 9999999,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 0,
armor = 0,
id = 15102504,
equipment_list = {}
},
[15103001] = {
cannon = 7,
reload = 150,
speed_growth = 0,
cannon_growth = 560,
pilot_ai_template_id = 20005,
air = 0,
battle_unit_type = 25,
dodge = 0,
base = 123,
durability_growth = 10000,
antiaircraft = 60,
reload_growth = 0,
dodge_growth = 0,
speed = 15,
luck = 0,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antiaircraft_growth = 1000,
torpedo = 33,
durability = 300,
armor_growth = 0,
torpedo_growth = 3250,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 15103001,
bubble_fx = "",
antisub = 0,
specific_fx_scale = {},
equipment_list = {
1000593,
1000598,
1000603
},
buff_list = {}
},
[15103002] = {
cannon = 16,
reload = 150,
speed_growth = 0,
cannon_growth = 880,
pilot_ai_template_id = 20005,
air = 0,
battle_unit_type = 30,
dodge = 0,
base = 124,
durability_growth = 19200,
antiaircraft = 120,
reload_growth = 0,
dodge_growth = 0,
speed = 15,
luck = 0,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antiaircraft_growth = 2250,
torpedo = 26,
durability = 510,
armor_growth = 0,
torpedo_growth = 2250,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 15103002,
bubble_fx = "",
antisub = 0,
specific_fx_scale = {},
equipment_list = {
1000608,
1000613
},
buff_list = {}
},
[15103003] = {
cannon = 18,
reload = 150,
speed_growth = 0,
cannon_growth = 1800,
pilot_ai_template_id = 20004,
air = 0,
battle_unit_type = 35,
dodge = 0,
base = 125,
durability_growth = 35200,
antiaircraft = 95,
reload_growth = 0,
dodge_growth = 0,
speed = 15,
luck = 0,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antiaircraft_growth = 1400,
torpedo = 17,
durability = 1190,
armor_growth = 0,
torpedo_growth = 1250,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 15103003,
bubble_fx = "",
antisub = 0,
specific_fx_scale = {},
equipment_list = {
1000618,
1000623,
1000628
},
buff_list = {}
},
[15103004] = {
cannon = 43,
reload = 150,
speed_growth = 0,
cannon_growth = 2200,
pilot_ai_template_id = 20004,
air = 0,
battle_unit_type = 60,
dodge = 0,
base = 126,
durability_growth = 70400,
antiaircraft = 105,
reload_growth = 0,
dodge_growth = 0,
speed = 15,
luck = 0,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antiaircraft_growth = 1400,
torpedo = 0,
durability = 4930,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 15103004,
bubble_fx = "",
antisub = 0,
specific_fx_scale = {},
equipment_list = {
1000633,
1000638,
1000643
},
buff_list = {}
},
[15103005] = {
cannon = 0,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 20004,
air = 48,
battle_unit_type = 65,
dodge = 0,
base = 127,
durability_growth = 65600,
antiaircraft = 115,
reload_growth = 0,
dodge_growth = 0,
speed = 15,
luck = 0,
hit = 10,
antisub_growth = 0,
air_growth = 2000,
antiaircraft_growth = 1800,
torpedo = 0,
durability = 4420,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 15103005,
bubble_fx = "",
antisub = 0,
specific_fx_scale = {},
equipment_list = {
1000648,
1000653,
1000658,
1000663
},
buff_list = {}
},
[15103006] = {
cannon = 60,
hit_growth = 1200,
bubble_fx = "",
speed_growth = 0,
pilot_ai_template_id = 80000,
air = 0,
luck = 0,
dodge = 0,
cannon_growth = 0,
speed = 30,
reload = 150,
reload_growth = 0,
dodge_growth = 0,
id = 15103006,
torpedo = 120,
hit = 81,
antisub_growth = 0,
air_growth = 0,
durability_growth = 2550,
base = 518,
durability = 80,
armor_growth = 0,
torpedo_growth = 900,
luck_growth = 0,
battle_unit_type = 15,
armor = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
antisub = 0,
specific_fx_scale = {},
appear_fx = {
"appearsmall"
},
equipment_list = {
1000868
},
buff_list = {}
},
[15103007] = {
cannon = 5,
reload = 150,
speed_growth = 0,
cannon_growth = 300,
pilot_ai_template_id = 10002,
air = 0,
battle_unit_type = 65,
dodge = 0,
base = 439,
durability_growth = 4000,
antiaircraft = 0,
reload_growth = 0,
dodge_growth = 0,
speed = 12,
luck = 0,
hit = 8,
antisub_growth = 0,
air_growth = 0,
antiaircraft_growth = 0,
torpedo = 24,
durability = 200,
armor_growth = 0,
torpedo_growth = 2200,
luck_growth = 0,
hit_growth = 120,
armor = 0,
id = 15103007,
antisub = 0,
specific_fx_scale = {},
equipment_list = {
1100698,
1100713
},
buff_list = {}
},
[15103101] = {
cannon = 45,
reload = 150,
speed_growth = 0,
cannon_growth = 640,
battle_unit_type = 50,
air = 0,
base = 248,
dodge = 28,
durability_growth = 23600,
antiaircraft = 125,
speed = 36,
reload_growth = 0,
dodge_growth = 450,
luck = 0,
antiaircraft_growth = 3000,
hit = 33,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 135,
durability = 4340,
armor_growth = 0,
torpedo_growth = 5200,
luck_growth = 0,
hit_growth = 350,
armor = 0,
id = 15103101,
equipment_list = {
1000713,
1000718,
1000723
}
},
[15103102] = {
cannon = 74,
reload = 150,
speed_growth = 0,
cannon_growth = 936,
battle_unit_type = 55,
air = 0,
base = 249,
dodge = 11,
durability_growth = 33600,
antiaircraft = 255,
speed = 24,
reload_growth = 0,
dodge_growth = 162,
luck = 0,
antiaircraft_growth = 3744,
hit = 25,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 112,
durability = 5270,
armor_growth = 0,
torpedo_growth = 3366,
luck_growth = 0,
hit_growth = 210,
armor = 0,
id = 15103102,
equipment_list = {
1000683,
1000688,
1000693,
1000698
}
},
[15103103] = {
cannon = 102,
reload = 150,
speed_growth = 0,
cannon_growth = 1750,
battle_unit_type = 60,
air = 0,
base = 250,
dodge = 17,
durability_growth = 43200,
antiaircraft = 192,
speed = 18,
reload_growth = 0,
dodge_growth = 170,
luck = 0,
antiaircraft_growth = 3880,
hit = 18,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 84,
durability = 6040,
armor_growth = 0,
torpedo_growth = 3200,
luck_growth = 0,
hit_growth = 350,
armor = 0,
id = 15103103,
equipment_list = {
1000743,
1000748,
1000753,
1000758
}
},
[15103104] = {
cannon = 120,
reload = 150,
speed_growth = 0,
cannon_growth = 3600,
battle_unit_type = 65,
air = 0,
base = 251,
dodge = 17,
durability_growth = 68000,
antiaircraft = 212,
speed = 14,
reload_growth = 0,
dodge_growth = 170,
luck = 0,
antiaircraft_growth = 4680,
hit = 18,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 0,
durability = 9010,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 350,
armor = 0,
id = 15103104,
equipment_list = {
1000778,
1000783,
1000788
},
buff_list = {
{
ID = 50510,
LV = 1
}
}
},
[15103105] = {
cannon = 86,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
battle_unit_type = 70,
air = 145,
base = 252,
dodge = 15,
durability_growth = 59600,
antiaircraft = 230,
speed = 16,
reload_growth = 0,
dodge_growth = 120,
luck = 0,
antiaircraft_growth = 5280,
hit = 22,
antisub_growth = 0,
air_growth = 4500,
antisub = 0,
torpedo = 0,
durability = 7820,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 350,
armor = 0,
id = 15103105,
equipment_list = {
1000803,
1000808,
1000818,
1000823
}
},
[15103201] = {
cannon = 60,
reload = 150,
speed_growth = 0,
cannon_growth = 1200,
pilot_ai_template_id = 10001,
air = 0,
battle_unit_type = 90,
dodge = 19,
base = 248,
durability_growth = 115200,
antiaircraft = 105,
reload_growth = 0,
dodge_growth = 270,
speed = 36,
luck = 0,
hit = 24,
antisub_growth = 0,
air_growth = 0,
antiaircraft_growth = 2800,
torpedo = 205,
durability = 8140,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
hit_growth = 210,
armor = 0,
id = 15103201,
bubble_fx = "",
antisub = 0,
appear_fx = {
"appearQ"
},
equipment_list = {
1000713,
1000718,
1000723,
1000728,
1000733
},
buff_list = {}
},
[15103202] = {
cannon = 115,
reload = 150,
speed_growth = 0,
cannon_growth = 1600,
pilot_ai_template_id = 10001,
air = 0,
battle_unit_type = 90,
dodge = 11,
base = 249,
durability_growth = 193600,
antiaircraft = 280,
reload_growth = 0,
dodge_growth = 156,
speed = 20,
luck = 18,
hit = 20,
antisub_growth = 0,
air_growth = 0,
antiaircraft_growth = 3600,
torpedo = 165,
durability = 10470,
armor_growth = 0,
torpedo_growth = 2000,
luck_growth = 0,
hit_growth = 210,
armor = 0,
id = 15103202,
bubble_fx = "",
antisub = 0,
appear_fx = {
"appearQ"
},
equipment_list = {
1000683,
1000688,
1000693,
1000698,
1000703
},
buff_list = {}
}
}
return
|
local cutils = require 'libcutils'
local qmem = require 'Q/UTILS/lua/qmem'
local function reset()
local data_dir = qmem.q_data_dir
assert(cutils.isdir(data_dir))
local meta_file = data_dir .. "/q_meta.lua" -- note .lua suffix
local aux_file = data_dir .. "/q_aux" -- note *NO* .lua suffix
cutils.delete(meta_file)
cutils.delete(aux_file)
-- TODO TODO P0 cVector.set_globals("max_file_num", 0)
local cmd = string.format("rm -f %s/_*.bin", data_dir)
os.execute(cmd) -- TODO P3 Move this to rmdir in cutils
return true
end
return require('Q/q_export').export('reset', reset)
|
local console = {
cmdList = {},
currentListInd = 0,
txtCmdLine = nil,
mtlOutput = nil,
hold_caret = false,
}
if (not loadstring) then
loadstring = load
end
--------------------- Command History ---------------------
function iup.ConsoleKeyUpCommand()
if #console.cmdList > 0 then
if console.currentListInd >= 1 then
console.txtCmdLine.value = console.cmdList[console.currentListInd]
if console.currentListInd > 1 then
console.currentListInd = console.currentListInd - 1
end
end
end
end
function iup.ConsoleKeyDownCommand()
if #console.cmdList > 0 then
if console.currentListInd <= #console.cmdList then
console.txtCmdLine.value = console.cmdList[console.currentListInd]
if console.currentListInd < #console.cmdList then
console.currentListInd = console.currentListInd + 1
end
end
end
end
function iup.ConsoleEnterCommandStr(text)
table.insert(console.cmdList, text)
console.currentListInd = #console.cmdList
iup.ConsolePrint("> " .. text)
end
function iup.ConsoleEnterCommand()
local command = console.txtCmdLine.value
if command == nil or command == "" then
return
end
iup.ConsoleEnterCommandStr(command)
local cmd, msg = loadstring(command)
if (not cmd) then
cmd = loadstring("return " .. command)
end
if (not cmd) then
iup.ConsolePrint("Error: ".. msg) -- the original error message
else
local result = {pcall(cmd)}
if result[1] then
for i = 2, #result do
iup.ConsolePrintValue(result[i])
end
else
iup.ConsolePrint("Error: ".. result[2])
end
end
console.txtCmdLine.value = ""
end
--------------------- Print Replacement ---------------------
function iup.ConsolePrint(...)
local param = {...}
local str = ""
if (#param == 0) then
str = "nil"
else
for i, k in ipairs(param) do
if (i > 1) then str = str .."\t" end
str = str .. tostring(k)
end
end
console.mtlOutput.append = str
if (not console.hold_caret) then
console.mtlOutput.scrollto = "99999999:1"
end
end
print_old = print
print = iup.ConsolePrint
write_old = io.write
io.write = function(...)
console.mtlOutput.appendnewline="No"
iup.ConsolePrint(...)
console.mtlOutput.appendnewline="Yes"
end
function iup.ConsoleValueToString(v)
if (type(v) == "string") then
return "\"" .. v .. "\""
else
return tostring(v)
end
end
function iup.ConsolePrintTable(t)
local str = "{\n"
local tmp = {}
for i, k in ipairs(t) do
str = str .. " ["..tostring(i).. "] = " .. iup.ConsoleValueToString(k) .. ",\n"
tmp[i] = true
end
for i, k in pairs(t) do
if (not tmp[i]) then
str = str .. " ["..tostring(i).. "] = ".. iup.ConsoleValueToString(k) .. ",\n"
end
end
str = str .. "}"
iup.ConsolePrint(str)
end
function iup.ConsolePrintFunction(f)
local info = debug.getinfo(f, "S")
local defined
if info.what == "C" then
defined = " [Defined in C"
else
local s = string.sub(info.source, 1, 1)
if s == "@" then
local filename = string.sub(info.source, 2)
defined = " [Defined in the file: \"" .. filename .. "\""
else
local short_src = string.sub(info.short_src, 2, -2)
defined = " [Defined in a " .. short_src
end
end
if info.linedefined > 0 then
defined = defined .. ", line " .. info.linedefined .. "]"
else
defined = defined .. "]"
end
iup.ConsolePrint(defined)
end
function iup.ConsolePrintValue(v)
if (type(v) == "table") then
iup.ConsolePrintTable(v)
elseif (type(v) == "function") then
iup.ConsolePrintFunction(v)
else
iup.ConsolePrint(iup.ConsoleValueToString(v))
end
end
--------------------- Utilities ---------------------
function iup.ConsoleListFuncs()
iup.ConsoleEnterCommandStr("iup.ConsoleListFuncs()")
console.hold_caret = true
local global = _G
local n,v = next(global, nil)
while n ~= nil do
if type(v) == "function" then
iup.ConsolePrint(n)
end
n,v = next(global, n)
end
console.hold_caret = false
console.mtlOutput.scrollto = "99999999:1"
end
function iup.ConsoleListVars()
iup.ConsoleEnterCommandStr("iup.ConsoleListVars()")
console.hold_caret = true
local global = _G
local n,v = next(global, nil)
while n ~= nil do
if type(v) ~= "function" and n ~= "_G" then
iup.ConsolePrint(n)
end
n,v = next(global, n)
end
console.hold_caret = false
console.mtlOutput.scrollto = "99999999:1"
end
function iup.ConsolePrintStack()
local info, desc, defined
iup.ConsoleEnterCommandStr("iup.ConsolePrintStack()")
local level = 2 -- skip level 0, getinfo
-- skip level 1, ConsolePrintStack
info = debug.getinfo(level, "Snl") -- source, name, namewhat, what, currentline, linedefined
while info ~= nil do
if info.what == "main" then
desc = "<main>"
elseif info.name and info.name ~= "" then
desc = info.name
else
desc = "<noname>"
end
if info.namewhat ~= "" then
desc = desc .. " <".. info.namewhat .. ">"
end
if info.currentline > 0 then
desc = desc .. " at line " .. info.currentline
end
if info.what == "C" then
defined = " [Defined in C"
else
local s = string.sub(info.source, 1, 1)
if s == "@" then
local filename = string.sub(info.source, 2)
defined = " [Defined in the file: \"" .. filename .. "\""
else
local short_src = string.sub(info.short_src, 2, -2)
defined = " [Defined in a " .. short_src
end
end
if info.linedefined > 0 then
defined = defined .. ", line " .. info.linedefined .. "]"
else
defined = defined .. "]"
end
iup.ConsolePrint(level - 1 .. " - " .. desc .. defined)
level = level + 1
info = debug.getinfo(level, "Snl") -- source, name, namewhat, what, currentline, linedefined
end
end
--------------------- Construction ---------------------
local function txt_cmdline_kany_cb(txt_cmdLine, c)
if c == iup.K_CR then
iup.ConsoleEnterCommand()
return IUP_IGNORE
elseif c == iup.K_ESC then
txt_cmdLine.value = ""
return IUP_IGNORE
elseif c == iup.K_UP then
iup.ConsoleKeyUpCommand()
return IUP_IGNORE
elseif c == iup.K_DOWN then
iup.ConsoleKeyDownCommand()
return IUP_IGNORE
end
return IUP_CONTINUE
end
local function btn_tools_action_cb(btn_tools)
local item_listfuncs = iup.item{
title = "List Global Functions",
action = iup.ConsoleListFuncs,
}
local item_listvars = iup.item{
title = "List Global Variables",
action = iup.ConsoleListVars,
}
local item_printstack = iup.item{
title = "Print Stack",
action = iup.ConsolePrintStack,
}
local item_clear = iup.item{
title = "Clear Output",
action = function() console.mtlOutput.value = "" end
}
local tools_menu = iup.menu{
item_listfuncs,
item_listvars,
item_printstack,
iup.separator{},
item_clear,
}
local x = btn_tools.x
local y = btn_tools.y
local elem_width, elem_height = string.match(btn_tools.rastersize, "(%d*)x(%d*)")
y = tonumber(y) + tonumber(elem_height)
iup.Popup(tools_menu, x, y)
iup.Destroy(tools_menu)
end
function iup.ConsoleCreate(parent)
local txt_cmdLine = iup.text{
expand = "HORIZONTAL",
k_any = txt_cmdline_kany_cb,
}
local mtl_output = iup.multiline{
expand = "YES",
readonly = "YES",
bgcolor = "224 224 2254",
}
local btn_tools = iup.button{
action = btn_tools_action_cb,
image = "IUP_ToolsSettings",
flat = "Yes",
tip = "Console Tools",
canfocus = "No",
}
local console_bts = iup.hbox{
txt_cmdLine,
btn_tools;
margin = "5x5",
gap = "5",
alignment = "ACENTER",
}
local frm_consolebts = iup.frame{
console_bts;
title = "Command Line:",
}
local console_box = iup.vbox{
frm_consolebts,
mtl_output;
margin = "5x5",
gap = "5",
tabtitle = "Console",
}
iup.Append(parent, console_box)
iup.ConsoleInit(txt_cmdLine, mtl_output)
end
function iup.ConsoleInit(txt_cmdLine, mtl_output)
console.txtCmdLine = txt_cmdLine
console.mtlOutput = mtl_output
console.mtlOutput.value = _COPYRIGHT .. "\n" ..
"IUP " .. iup._VERSION .. " " .. iup._COPYRIGHT
end
|
-- Горячие клавиши для Neovim
-- Author: Daniil Shilo
-- Email: crckhd10@gmail.com
-- License: MIT
-- Переменные
local map = vim.api.nvim_set_keymap -- Метод, для назначения новых комбинаций
-- Настройки
vim.g.mapleader = ' ' -- Используем Space, как клавишу для альтернативных хотекеев
-- Экраны
map('n', '<s-->', '<cmd>vertical resize -5<CR>', {noremap = true})
-- LSP (все горячие клавиши начинаются с g), кроме ховера
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', {noremap = true}) -- Ховер для объекта
map('n', 'gf', '<cmd>lua vim.lsp.buf.formatting()<CR>', {noremap = true}) -- Форматировать документ
map('n', 'ga', '<cmd>lua vim.lsp.buf.code_action()<CR>', {noremap = true}) -- Действия с кодом
map('n', 'gR', '<cmd>lua vim.lsp.buf.rename()<CR>', {noremap = true}) -- Переименовать объект
map('n', 'gd', '<cmd>Telescope lsp_definitions<CR>', {noremap = true}) -- Объявления в LSP
map('n', 'gr', '<cmd>Trouble lsp_references<CR>', {noremap = true}) -- Референсы в LSP
-- Плагины
map('n', '<leader>v', '<cmd>NvimTreeToggle<CR>', {noremap = true}) -- Открыть Neovim Tree
map('n', '<leader>p', '<cmd>Telescope oldfiles<CR>', {noremap = true}) -- Просмотр недавних файлов
map('n', '<leader>o', '<cmd>Telescope git_files<CR>', {noremap = true}) -- Поиск файлов
map('n', '<leader>b', '<cmd>Telescope git_branches<CR>', {noremap = true}) -- Ветки в Git
map('n', '<leader>f', '<cmd>Telescope live_grep<CR>', {noremap = true}) -- Поиск строки
map('n', '<leader>q', '<cmd>Telescope buffers<CR>', {noremap = true}) -- Буфферы
map('n', '<leader>l', '<cmd>Telescope git_status<CR>', {noremap = true}) -- Изменения в Git
map('n', '<leader>s', '<cmd>SymbolsOutline<CR>', {noremap = true}) -- Структура для файла
map('n', '<A-c>', '<cmd>bd<CR>', {noremap = true}) -- Закрыть буффер
map('n', '<A-,>', '<cmd>BufferLineCyclePrev<CR>', {noremap = true}) -- Перейти в предыдущий буффер
map('n', '<A-.>', '<cmd>BufferLineCycleNext<CR>', {noremap = true}) -- Перейти в следующий буффер
map('n', '<A->>', '<cmd>BufferLineMoveNext<CR>', {noremap = true}) -- Закрыть буффер слева
map('n', '<A-<>', '<cmd>BufferLineMovePrev<CR>', {noremap = true}) -- Закрыть буффер справа
map('n', '<leader>z', '<cmd>ZenMode<CR>', {noremap = true}) -- Закрыть буффер справа
map('n', '<leader>x', '<cmd>TroubleToggle<CR>', {noremap = true}) -- Открыть меню с проблемами LSP
|
--[[
JSON4Lua example script.
Demonstrates the simple functionality of the json module.
]]--
json = require('json')
-- Object to JSON encode
test = {
one='first',two='second',three={2,3,5}
}
jsonTest = json.encode(test)
print('JSON encoded test is: ' .. jsonTest)
-- Now JSON decode the json string
result = json.decode(jsonTest)
print ("The decoded table result:")
table.foreach(result,print)
print ("The decoded table result.three")
table.foreach(result.three, print)
|
-- luacheck: globals vim
require("astronauta.keymap")
local mapper = function(opt)
vim.keymap.nnoremap { opt.lhs or opt[1], function()
(opt.fn or opt[2])(opt.arg or opt[3] or {})
end
}
end
--mapper{"<C-M-p>", cv2.project}
--mapper{"<C-f>", cv2.cd}
--mapper{"<C-p>", cv2.files}
--mapper{"<C-g>", cv2.dirty}
--mapper{"<C-s>", cv2.checkout}
--mapper{"<C-l>", cv2.buffers}
--mapper{"<C-t>", cv2.todo, {open_cmd = "rightbelow new"}}
mapper{"<C-n>", require("neogit").open}
mapper{"<space>b", require("sidebar-nvim").open}
-- vim.keymap.nnoremap{"<localleader>/", cv2.grep}
|
-- Create the Dimensional Ore resource --
local resource_autoplace = require("resource-autoplace")
-- Resource --
local dmOR = {}
dmOR.name = "DimensionalOre"
dmOR.type = "resource"
dmOR.flags = {"placeable-neutral"}
dmOR.order="a"
dmOR.tree_removal_probability = 1
dmOR.tree_removal_max_distance = 32 * 32
dmOR.minable =
{
hardness = 0.9,
mining_particle = "coal-particle",
mining_time = 2,
result = "DimensionalOre"
}
dmOR.collision_box = {{ -0.1, -0.1}, {0.1, 0.1}}
dmOR.selection_box = {{ -0.5, -0.5}, {0.5, 0.5}}
dmOR.icon = "__Mobile_Factory_Graphics__/graphics/icones/DimensionalOreI.png"
dmOR.icon_size = 256
dmOR.stage_counts = {1500, 1200, 700, 600, 300}
dmOR.stages =
{
sheet =
{
filename = "__Mobile_Factory_Graphics__/graphics/entity/DimensionalOreR.png",
priority = "extra-high",
size = 128,
frame_count = 3,
variation_count = 5,
scale = 0.25
}
}
dmOR.map_color = {102/255, 0, 102/255}
dmOR.autoplace = resource_autoplace.resource_autoplace_settings{
name = "DimensionalOre",
order = "b",
base_density = 10,
has_starting_area_placement = true,
regular_rq_factor_multiplier = 1.10,
starting_rq_factor_multiplier = 1.5
}
data:extend{dmOR}
-- Auto Place Control --
local dmOAPC = {}
dmOAPC.type = "autoplace-control"
dmOAPC.category = "resource"
dmOAPC.name = "DimensionalOre"
dmOAPC.richness = true
data:extend{dmOAPC}
-- Item --
local dmOI = {}
dmOI.name = "DimensionalOre"
dmOI.type = "item"
dmOI.icon = "__Mobile_Factory_Graphics__/graphics/icones/DimensionalOreO.png"
dmOI.icon_size = 64
dmOI.subgroup = "Resources"
dmOI.order = "a"
dmOI.stack_size = 1000
data:extend{dmOI}
-- Noise Layer --
local dmONL = {}
dmONL.name = "DimensionalOre"
dmONL.type = "noise-layer"
data:extend{dmONL}
-- Recipe --
local dmOR = {}
dmOR.type = "recipe"
dmOR.name = "DimensionalOre"
dmOR.energy_required = 1
dmOR.ingredients =
{
{"DimensionalSample", 3}
}
dmOR.result = "DimensionalOre"
dmOR.result_count = 1
data:extend{dmOR}
-- Technology --
local dmT = {}
dmT.name = "DimensionalOre"
dmT.type = "technology"
dmT.icon = "__Mobile_Factory_Graphics__/graphics/icones/DimensionalOreI.png"
dmT.icon_size = 256
dmT.unit = {
count=100,
time=1,
ingredients={
{"DimensionalSample", 1}
}
}
dmT.effects = {
{type="unlock-recipe", recipe="MobileFactory"},
{type="unlock-recipe", recipe="DimensionalTile"},
{type="unlock-recipe", recipe="mfStone"}
}
data:extend{dmT}
-- Dimensional Ore to Stone Recipe --
local sR = {}
sR.type = "recipe"
sR.name = "mfStone"
sR.enabled = false
sR.energy_required = 0.3
sR.ingredients =
{
{"DimensionalOre", 1}
}
sR.result = "stone"
sR.result_count = 3
data:extend{sR}
|
--̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷
-- في حال تبدل اسم الملف مارح يشتغل السكربت
--̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷-̷
RegisterNetEvent("B3-Afk:webhook") -- Webhook
AddEventHandler("B3-Afk:webhook", function(Value, ValueTwo, Decimal)
local date = os.date()
local connect = {
{
["color"] = Decimal,
["fields"] = {
{
["name"] = ValueTwo,
["value"] = Value,
}
},
["author"] = {
["name"] = "B3-Team",
["url"] = "https://discord.gg/2mNts9zxdn",
["icon_url"] = "https://media.discordapp.net/attachments/822416718709784626/828410763680677898/B3-AFK.png"
},
["footer"] = {
["text"] = "Action Happened: " .. date,
["icon_url"] = Config.webhookImage,
},
}
}
PerformHttpRequest(Config.webhook, function(err, text, headers) end, 'POST', json.encode({username = DISCORD_NAME, embeds = connect, avatar_url = Config.webhookImage}), {['Content-Type'] = 'application/json'})
end)
RegisterCommand( -- الكوماند لتشغيل السكربت
"الخروج",
function(source, args, rawCommand)
TriggerClientEvent("B3-Afk:setAFK", source)
end, false)
RegisterNetEvent("B3-Afk:sendAFKmessagetoServer") --
AddEventHandler("B3-Afk:sendAFKmessagetoServer", function(name)
if Config.afkmessagestoServer then
TriggerClientEvent("chatMessage", -1, "^7[^4"..GetPlayerName(source).."^7]".." has gone afk.")
end
end)
RegisterCommand(-- AFKالكوماند حق وقف ال
"العودة",
function(source, args, rawCommand)
TriggerClientEvent("B3-Afk:setNot", source)
end, false)
RegisterServerEvent("B3-Afk:kickPlayer") -- kick the player as long as AFKkick config is on
AddEventHandler("B3-Afk:kickPlayer", function(time)
DropPlayer(source, "You were AFK for "..time.. ". therefore, you were kicked to clear a spot on the server.")
end)
-- Updates
print("^4"..GetCurrentResourceName() .."^7 is on the ^2newest ^7version!^7")
|
-- Developer: sbx320
-- License: MIT
-- Github Repos: https://github.com/sbx320/lua_utils
--// classlib
--|| A library providing several tools to enhance OOP with MTA and Lua
--\\
SERVER = triggerServerEvent == nil
CLIENT = not SERVER
DEBUG = DEBUG or false
function enew(element, class, ...)
-- DEBUG: Validate that we are not instantiating a class with pure virtual methods
if DEBUG then
for k, v in pairs(class) do
assert(v ~= pure_virtual, "Attempted to instanciate a class with an unimplemented pure virtual method ("..tostring(k)..")")
end
end
local instance = setmetatable( { element = element },
{
__index = class;
__super = { class };
__newindex = class.__newindex;
__call = class.__call;
__len = class.__len;
__unm = class.__unm;
__add = class.__add;
__sub = class.__sub;
__mul = class.__mul;
__div = class.__div;
__pow = class.__pow;
__concat = class.__concat;
})
oop.elementInfo[element] = instance
local callDerivedConstructor;
callDerivedConstructor = function(parentClasses, instance, ...)
for k, v in pairs(parentClasses) do
if rawget(v, "virtual_constructor") then
rawget(v, "virtual_constructor")(instance, ...)
end
local s = super(v)
if s then callDerivedConstructor(s, instance, ...) end
end
end
callDerivedConstructor(super(instance), element, ...)
-- Call constructor
if rawget(class, "constructor") then
rawget(class, "constructor")(element, ...)
end
element.constructor = false
return element
end
function new(class, ...)
assert(type(class) == "table", "first argument provided to new is not a table")
-- DEBUG: Validate that we are not instantiating a class with pure virtual methods
if DEBUG then
for k, v in pairs(class) do
assert(v ~= pure_virtual, "Attempted to instanciate a class with an unimplemented pure virtual method ("..tostring(k)..")")
end
end
local instance = setmetatable( { },
{
__index = class;
__super = { class };
__newindex = class.__newindex;
__call = class.__call;
__len = class.__len;
__unm = class.__unm;
__add = class.__add;
__sub = class.__sub;
__mul = class.__mul;
__div = class.__div;
__pow = class.__pow;
__concat = class.__concat;
})
-- Call derived constructors
local callDerivedConstructor;
callDerivedConstructor = function(self, instance, ...)
for k, v in pairs(super(self)) do
if rawget(v, "virtual_constructor") then
rawget(v, "virtual_constructor")(instance, ...)
end
local s = super(v)
if s then callDerivedConstructor(s, instance, ...) end
end
end
callDerivedConstructor(class, instance, ...)
-- Call constructor
if rawget(class, "constructor") then
rawget(class, "constructor")(instance, ...)
end
instance.constructor = false
return instance
end
function delete(self, ...)
if self.destructor then --if rawget(self, "destructor") then
self:destructor(...)
end
-- Prevent the destructor to be called twice
self.destructor = false
local callDerivedDestructor;
callDerivedDestructor = function(parentClasses, instance, ...)
for k, v in pairs(parentClasses) do
if rawget(v, "virtual_destructor") then
rawget(v, "virtual_destructor")(instance, ...)
end
local s = super(v)
if s then callDerivedDestructor(s, instance, ...) end
end
end
callDerivedDestructor(super(self), self, ...)
end
function super(self)
if isElement(self) then
assert(oop.elementInfo[self], "Cannot get the superclass of this element") -- at least: not yet
self = oop.elementInfo[self]
end
local metatable = getmetatable(self)
if metatable then return metatable.__super
else
return {}
end
end
function inherit(from, what)
assert(from, "Attempt to inherit a nil table value")
if not what then
local classt = setmetatable({}, { __index = _inheritIndex, __super = { from } })
if from.onInherit then
from.onInherit(classt)
end
return classt
end
local metatable = getmetatable(what) or {}
local oldsuper = metatable and metatable.__super or {}
table.insert(oldsuper, 1, from)
metatable.__super = oldsuper
metatable.__index = _inheritIndex
-- Inherit __call
for k, v in ipairs(metatable.__super) do
if v.__call then
metatable.__call = v.__call
break
end
end
return setmetatable(what, metatable)
end
function _inheritIndex(self, key)
for k, v in pairs(super(self) or {}) do
if v[key] then return v[key] end
end
return nil
end
function instanceof(self, class, direct)
for k, v in pairs(super(self)) do
if v == class then return true end
end
if direct then return false end
local check = false
-- Check if any of 'self's base classes is inheriting from 'class'
for k, v in pairs(super(self)) do
check = instanceof(v, class, false)
end
return check
end
function pure_virtual()
error("Function implementation missing")
end
function bind(func, ...)
if not func then
if DEBUG then
outputConsole(debug.traceback())
end
error("Bad function pointer @ bind. See console for more details")
end
local boundParams = {...}
return
function(...)
local params = {}
local boundParamSize = select("#", unpack(boundParams))
for i = 1, boundParamSize do
params[i] = boundParams[i]
end
local funcParams = {...}
for i = 1, select("#", ...) do
params[boundParamSize + i] = funcParams[i]
end
return func(unpack(params))
end
end
function load(class, ...)
assert(type(class) == "table", "first argument provided to load is not a table")
local instance = setmetatable( { },
{
__index = class;
__super = { class };
__newindex = class.__newindex;
__call = class.__call;
})
-- Call load
if rawget(class, "load") then
rawget(class, "load")(instance, ...)
end
instance.load = false
return instance
end
-- Magic to allow MTA elements to be used as data storage
-- e.g. localPlayer.foo = 12
oop = {}
oop.mta_metatable = {}
oop.elementInfo = setmetatable({}, { __mode = "k" })
oop.elementClasses = {}
oop.getMTATypeMetatable = function(t)
local element = false
if t == "player" then return debug.getmetatable(localPlayer or getRandomPlayer())
elseif t == "vehicle" then element = createVehicle(411, 0, 0, 0)
elseif t == "colshape" then element = createColCircle(0, 0, 1)
elseif t == "element" then element = createElement("oopelement")
elseif t == "marker" then element = createMarker(0, 0, 0, "ring")
elseif t == "object" then element = createObject(1337, 0, 0, 0)
elseif t == "ped" then element = createPed(0, 0, 0, 0)
elseif t == "pickup" then element = createPickup(0, 0, 0, 0, 0)
elseif t == "radarArea" then element = createRadarArea(0, 0, 1, 1)
elseif t == "water" then element = createWater(0, 0, 0, 2, 2, 2, 4, 4, 4)
elseif SERVER then
if t == "team" then element = createTeam("oopteam") end
elseif CLIENT then
if t == "sound" then element = playSFX("feet", 1, 1)
elseif t == "camera" then return debug.getmetatable(getCamera())
elseif t == "effect" then element = createEffect("fire", 0, 0, 0)
elseif t == "weapon" then element = createWeapon("m4", 0, 0, 0)
-- todo: check if GUI elements have OOP
end
end
assert(element, t)
local mt = debug.getmetatable(element)
destroyElement(element)
return mt
end
oop.prepareClass = function(name)
local mt = oop.mta_metatable[name]
-- Store MTA's metafunctions
local __mtaindex = mt.__index
local __mtanewindex = mt.__newindex
local __set= mt.__set
mt.__index = function(self, key)
if not oop.handled then
if not oop.elementInfo[self] then
enew(self, oop.elementClasses[getElementType(self)] or {})
end
if oop.elementInfo[self][key] ~= nil then
oop.handled = false
return oop.elementInfo[self][key]
end
oop.handled = true
end
local value = __mtaindex(self, key)
oop.handled = false
return value
end
mt.__newindex = function(self, key, value)
if __set[key] ~= nil then
__mtanewindex(self, key, value)
return
end
if not oop.elementInfo[self] then
enew(self, oop.elementClasses[getElementType(self)] or {})
end
oop.elementInfo[self][key] = value
end
end
function registerElementClass(class, name)
oop.elementClasses[name] = class
end
oop.initClasses = function()
oop.mta_metatable["vehicle"] = oop.getMTATypeMetatable("vehicle")
oop.mta_metatable["colshape"] = oop.getMTATypeMetatable("colshape")
oop.mta_metatable["element"] = oop.getMTATypeMetatable("element")
oop.mta_metatable["marker"] = oop.getMTATypeMetatable("marker")
oop.mta_metatable["object"] = oop.getMTATypeMetatable("object")
oop.mta_metatable["ped"] = oop.getMTATypeMetatable("ped")
oop.mta_metatable["pickup"] = oop.getMTATypeMetatable("pickup")
oop.mta_metatable["radarArea"] = oop.getMTATypeMetatable("radarArea")
oop.mta_metatable["water"] = oop.getMTATypeMetatable("water")
if SERVER then
oop.mta_metatable["team"] = oop.getMTATypeMetatable("team")
end
if CLIENT then
oop.mta_metatable["sound"] = oop.getMTATypeMetatable("sound")
oop.mta_metatable["camera"] = oop.getMTATypeMetatable("camera")
oop.mta_metatable["effect"] = oop.getMTATypeMetatable("effect")
oop.mta_metatable["weapon"] = oop.getMTATypeMetatable("weapon")
end
for k, v in pairs(oop.mta_metatable) do
oop.prepareClass(k)
end
if SERVER then
if getPlayerCount() >= 1 then
oop.initPlayerClass()
else
addEventHandler("onPlayerConnect", root, oop.initPlayerClass)
end
else
oop.initPlayerClass()
end
end
oop.initPlayerClass = function()
oop.mta_metatable["player"] = oop.getMTATypeMetatable("player")
removeEventHandler("onPlayerConnect", root, oop.initPlayerClass)
oop.prepareClass("player")
end
oop.initClasses()
|
local anim8 = require 'vendor/anim8'
local Gamestate = require 'vendor/gamestate'
local window = require 'window'
local fonts = require 'fonts'
local camera = require 'camera'
local sound = require 'vendor/TEsound'
local Player = require 'player'
local state = Gamestate.new()
local Character = require 'character'
local map = {}
map.tileWidth = 12
map.tileHeight = 12
map.width = 193
map.height = 111
local scale = 2
local overworld = {
love.graphics.newImage('images/overworld/world_01.png'),
love.graphics.newImage('images/overworld/world_02.png'),
love.graphics.newImage('images/overworld/world_03.png'),
love.graphics.newImage('images/overworld/world_04.png'),
love.graphics.newImage('images/overworld/world_05.png'),
love.graphics.newImage('images/overworld/world_06.png'),
love.graphics.newImage('images/overworld/world_07.png'),
love.graphics.newImage('images/overworld/world_08.png'),
}
local overlay = {
love.graphics.newImage('images/overworld/world_overlay_01.png'),
love.graphics.newImage('images/overworld/world_overlay_02.png'),
false,
false,
love.graphics.newImage('images/overworld/world_overlay_05.png'),
love.graphics.newImage('images/overworld/world_overlay_06.png'),
false,
false,
}
local board = love.graphics.newImage('images/overworld/titleboard.png')
local charactersprites = love.graphics.newImage('images/characters/overworld.png')
local g = anim8.newGrid(25, 31, charactersprites:getWidth(),
charactersprites:getHeight())
-- free_ride_ferry
local wheelchair = love.graphics.newImage('images/overworld/free_ride_ferry.png')
local wc_x1, wc_x2, wc_y1, wc_y2 = 1685, 1956, 816, 680
local offset_x, offset_y = math.floor( wheelchair:getHeight() / 2 ) - 10, math.floor( wheelchair:getWidth() / 2 )
-- animated water
local watersprite = love.graphics.newImage('images/overworld/world_water.png')
local h2o = anim8.newGrid(36, 36, watersprite:getWidth(), watersprite:getHeight())
local water = anim8.newAnimation('loop', h2o('1-2,1'), 1)
-- cloud puffs
local cloudpuffsprite = love.graphics.newImage('images/overworld/cloud_puff.png')
local spunk = anim8.newGrid(100,67, cloudpuffsprite:getWidth(), cloudpuffsprite:getHeight())
-- ( cloud animations will be generated on the fly )
-- gay sparkles
local sparklesprite = love.graphics.newImage('images/overworld/gay_sparkle.png')
local bling = anim8.newGrid(24, 24, sparklesprite:getWidth(), sparklesprite:getHeight())
local sparkles = {{1028,456},{1089,442},{1403,440},{1348,591},{1390,633},{1273,698},{1160,657},{1088,702},{1048,665},{1072,604},{1060,552},{1104,548},{1172,555},{1199,727},{1263,735},{1313,505},{1337,459},{1358,429},{1270,617},{1289,571},{1123,505},{1124,472},{1359,709},{1389,555},{1376,677},{1057,624},{1169,710},{1149,592},{1297,639}}
for _,_sp in pairs(sparkles) do
_sp[3] = anim8.newAnimation('loop', bling('1-4,1','1-4,2'), ( math.random(15) / 100 ) + 0.15)
_sp[3]:gotoFrame( math.random( 8 ) )
end
-- overworld clouds
local cloudquads = {
love.graphics.newQuad( 0, 0, 100, 67, cloudpuffsprite:getWidth(), cloudpuffsprite:getHeight() ), --small
love.graphics.newQuad( 100, 0, 100, 67, cloudpuffsprite:getWidth(), cloudpuffsprite:getHeight() ), --medium
love.graphics.newQuad( 200, 0, 100, 67, cloudpuffsprite:getWidth(), cloudpuffsprite:getHeight() ), --large
love.graphics.newQuad( 300, 0, 200, 67, cloudpuffsprite:getWidth(), cloudpuffsprite:getHeight() ) --x-large
}
local clouds = {}
function insertrandomcloud(nofade)
table.insert( clouds, {
x = math.random( map.width * map.tileWidth ), -- x position
y = math.random( map.height * map.tileHeight ), -- y position
q = math.random( #cloudquads ), -- quad ( cloud size )
s = ( math.random( 15 ) + 5 ) * ( math.random(2) == 1 and 1 or -1 ), -- speed / direction
o = nofade and 0.8 or 0 -- opacity
} )
end
for i=0,15 do insertrandomcloud(true) end
-- overworld state machine
state.zones = {
forest_1 = { x=66, y=100, UP=nil, DOWN=nil, RIGHT='forest_2', LEFT=nil, name='Greendale', level='studyroom' },
forest_2 = { x=91, y=100, UP='forest_3', DOWN=nil, RIGHT=nil, LEFT='forest_1', name='Forest', level='forest' },
forest_3 = { x=91, y=89, UP='town_1', DOWN='forest_2', RIGHT=nil, LEFT=nil, name='Forest', level='forest-2' },
forest_4 = { x=122, y=36, UP='forest_5', DOWN=nil, RIGHT=nil, LEFT='island_4', name=nil, level=nil },
forest_5 = { x=122, y=22, UP=nil, DOWN='forest_4', RIGHT=nil, LEFT=nil, name=nil, level=nil },
town_1 = { x=91, y=76, UP=nil, DOWN='forest_3', RIGHT=nil, LEFT='town_2', name='Town', level='town' },
town_2 = { x=71, y=76, UP=nil, DOWN=nil, RIGHT='town_1', LEFT='town_3', name='New Abedtown', level='new-abedtown' },
town_3 = { x=51, y=76, UP=nil, DOWN=nil, RIGHT='town_2', LEFT='town_4', name='Village Forest', level='treeline' },
town_4 = { x=37, y=76, UP='valley_1', DOWN=nil, RIGHT='town_3', LEFT=nil, name='Village Forest', level='village-forest' },
valley_1 = { x=37, y=45, UP=nil, DOWN='town_4', RIGHT='valley_2', LEFT=nil, name='Valley of Laziness', level='valley' },
valley_2 = { x=66, y=45, UP='valley_3', DOWN=nil, RIGHT=nil, LEFT='valley_1', name='Valley of Laziness', level=nil, bypass={RIGHT='UP', DOWN='LEFT'} },
valley_3 = { x=66, y=36, UP=nil, DOWN='valley_2', RIGHT='island_1', LEFT=nil, name='Valley of Laziness', level=nil, bypass={UP='RIGHT', LEFT='DOWN'} },
island_1 = { x=93, y=36, UP=nil, DOWN='island_2', RIGHT=nil, LEFT='valley_3', name='Gay Island', level=nil, bypass={RIGHT='DOWN', UP='LEFT'} },
island_2 = { x=93, y=56, UP='island_1', DOWN=nil, RIGHT='island_3', LEFT=nil, name='Gay Island', level='gay-island' },
island_3 = { x=109, y=56, UP='island_4', DOWN='island_5', RIGHT=nil, LEFT='island_2', name='Gay Island', level='gay-island-2' },
island_4 = { x=109, y=36, UP=nil, DOWN='island_3', RIGHT='forest_4', LEFT=nil, name=nil, level=nil, bypass={UP='RIGHT', LEFT='DOWN'} },
island_5 = { x=109, y=68, UP='island_3', DOWN=nil, RIGHT='ferry', LEFT=nil, name='Gay Island', level='gay-island-4' },
ferry = { x=163, y=68, UP='caverns', DOWN=nil, RIGHT=nil, LEFT='island_5', name='Free Ride Ferry', level=nil, bypass={DOWN='LEFT', RIGHT='UP'} },
caverns = { x=163, y=44, UP=nil, DOWN='ferry', RIGHT=nil, LEFT=nil, name='Black Caverns', level='black-caverns' },
}
function state:init()
self:reset()
end
function state:enter(previous)
camera:scale(scale, scale)
camera.max.x = map.width * map.tileWidth - (window.width * 2)
fonts.set( 'big' )
sound.playMusic( "overworld" )
self.stand = anim8.newAnimation('once', g(Character:current().ow, 1), 1)
self.walk = anim8.newAnimation('loop', g(Character:current().ow,2,Character:current().ow,3), 0.2)
self.facing = 1
end
function state:leave()
camera:scale(window.scale)
fonts.reset()
end
function state:reset()
self.zone = self.zones['forest_1']
self.tx = self.zone.x * map.tileWidth --self.zone.x * map.tileWidth
self.ty = self.zone.y * map.tileHeight --self.zone.y * map.tileWidth
self.vx = 0
self.vy = 0
self.moving = false
self.entered = false
self.spunk_counter = 0
self.spunk_rate = 1.5
self.spunk_x = 1170
self.spunk_y = 460
self.spunk_dx = 20
self.spunk_dy = -100
self.spunks = {}
end
function state:update(dt)
water:update(dt)
for _,_sp in pairs(sparkles) do
_sp[3]:update(dt)
end
for i,cloud in pairs( clouds ) do
if cloud then
cloud.x = cloud.x + ( cloud.s * dt ) / ( cloud.q / 2 )
if cloud.o <= 0.8 then cloud.o = cloud.o + dt end -- fade in
--check for out of bounds
if cloud.x + 200 < 0 or cloud.x > map.width * map.tileWidth then
clouds[i] = false
insertrandomcloud()
end
end
end
self.walk:update(dt)
local dx = self.vx * dt * 300
local dy = self.vy * dt * 300
self.tx = self.tx + dx
self.ty = self.ty + dy
if self.pzone and self.moving then
if ( self.tx / map.tileHeight ) * self.vx <= lerp(self.pzone.x, self.zone.x, 0.5) * self.vx and
( self.ty / map.tileWidth ) * self.vy <= lerp(self.pzone.y, self.zone.y, 0.5) * self.vy then
self.show_prev_zone_name = true
else
self.show_prev_zone_name = false
end
end
if math.abs(self.tx - self.zone.x * map.tileWidth) <= math.abs(dx) and
math.abs(self.ty - self.zone.y * map.tileHeight) <= math.abs(dy) then
self.tx = self.zone.x * map.tileWidth
self.ty = self.zone.y * map.tileHeight
self.vx = 0
self.vy = 0
if self.entered and self.zone.bypass then
self.show_prev_zone_name = true
self:move(self.zone.bypass[self.entered])
else
self.moving = false
self.entered = false
end
end
self.spunk_counter = self.spunk_counter + dt
if self.spunk_counter > self.spunk_rate then
self.spunk_counter = 0
-- release a new spunk
local rand = math.random(3)
table.insert(self.spunks, {
_spunk = anim8.newAnimation('once', spunk('1-3,1'), 0.2),
x = self.spunk_x,
y = self.spunk_y,
dx = ( rand == 3 and self.spunk_dx or ( rand == 2 and 0 or -self.spunk_dx ) ),
dy = self.spunk_dy
})
end
for i,_spunk in pairs(self.spunks) do
if _spunk then
_spunk.x = _spunk.x + _spunk.dx * dt
_spunk.y = _spunk.y + _spunk.dy * dt
_spunk._spunk:update(dt)
if _spunk.y + ( cloudpuffsprite:getHeight() * 2 ) < 0 then
self.spunks[i] = nil
end
end
end
camera:setPosition(self.tx - window.width * scale / 2, self.ty - window.height * scale / 2)
end
function state:move( button )
if button == "UP" and self.zone.UP then
self.pzone = self.zone
self.zone = self.zones[self.zone.UP]
self.moving = 'up'
self.vx = 0
self.vy = -1
self.entered = button
elseif button == "DOWN" and self.zone.DOWN then
self.pzone = self.zone
self.zone = self.zones[self.zone.DOWN]
self.moving = 'down'
self.vx = 0
self.vy = 1
self.entered = button
elseif button == "LEFT" and self.zone.LEFT then
self.pzone = self.zone
self.zone = self.zones[self.zone.LEFT]
self.moving = 'LEFT'
self.facing = -1
self.vx = -1
self.vy = 0
self.entered = button
elseif button == "RIGHT" and self.zone.RIGHT then
self.pzone = self.zone
self.zone = self.zones[self.zone.RIGHT]
self.moving = 'RIGHT'
self.facing = 1
self.vx = 1
self.vy = 0
self.entered = button
end
end
function state:keypressed( button )
if button == "START" then
Gamestate.switch('pause')
return
end
if self.moving then
return
end
if button == "SELECT" or button == "JUMP" or button == "ATTACK" then
if not self.zone.level then
return
end
local level = Gamestate.get(self.zone.level)
local coordinates = level.default_position
level.player = Player.factory() --no collider necessary yet
--set the position before the switch to prevent automatic exiting from touching instant doors
level.player.position = {x=coordinates.x, y=coordinates.y} -- Copy, or player position corrupts entrance data
Gamestate.switch(self.zone.level)
end
self:move( button )
end
function state:title()
local zone = self.zone
if self.pzone and self.show_prev_zone_name then
zone = self.pzone
end
if not zone.name and not zone.level then
return 'UNCHARTED'
else
return zone.name
end
end
function state:draw()
love.graphics.setBackgroundColor(133, 185, 250)
for x=math.floor( camera.x / 36 ), math.floor( ( camera.x + camera:getWidth() ) / 36 ) do
for y=math.floor( camera.y / 36 ), math.floor( ( camera.y + camera:getHeight() ) / 36 ) do
water:draw(watersprite, x * 36, y * 36 )
end
end
for i, image in ipairs(overworld) do
local x = (i - 1) % 4
local y = i > 4 and 1 or 0
love.graphics.draw(image, x * image:getWidth(), y * image:getHeight())
end
for _,_spunk in pairs(self.spunks) do
if _spunk then
_spunk._spunk:draw( cloudpuffsprite, _spunk.x, _spunk.y )
end
end
for _,_sp in pairs(sparkles) do
_sp[3]:draw( sparklesprite, _sp[1] - 12, _sp[2] - 12 )
end
local face_offset = self.facing == -1 and 25 or 0
if self.moving then
self.walk:draw(charactersprites, math.floor(self.tx) + face_offset, math.floor(self.ty) - 15,0,self.facing,1)
else
self.stand:draw(charactersprites, math.floor(self.tx) + face_offset, math.floor(self.ty) - 15,0,self.facing,1)
end
if ( self.ty == wc_y1 and self.tx > wc_x1 and self.tx <= wc_x2 ) or
( self.tx == wc_x2 and self.ty > wc_y2 and self.ty <= wc_y1 ) then
-- follow the player
love.graphics.draw( wheelchair, self.tx - offset_x, self.ty - offset_y )
elseif self.zone == self.zones['caverns'] or
( self.tx == wc_x2 and self.ty <= wc_y2 ) then
-- cavern dock
love.graphics.draw( wheelchair, wc_x2 - offset_x, wc_y2 - offset_y )
else
-- island dock
love.graphics.draw( wheelchair, wc_x1 - offset_x, wc_y1 - offset_y )
end
for i, image in ipairs(overlay) do
if image then
local x = (i - 1) % 4
local y = i > 4 and 1 or 0
love.graphics.draw(image, x * image:getWidth(), y * image:getHeight())
end
end
for _,cloud in pairs( clouds ) do
if cloud then
love.graphics.setColor( 255, 255, 255, cloud.o * 255 )
love.graphics.drawq( cloudpuffsprite, cloudquads[cloud.q], cloud.x, cloud.y )
love.graphics.setColor( 255, 255, 255, 255 )
end
end
love.graphics.draw(board, camera.x + window.width - board:getWidth() / 2,
camera.y + window.height + board:getHeight() * 2)
love.graphics.printf(self:title(),
camera.x + window.width - board:getWidth() / 2,
camera.y + window.height + board:getHeight() * 2.5 - 10,
board:getWidth(), 'center')
end
return state
|
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You 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 core = require("apisix.core")
local upstream = require("apisix.upstream")
local schema_def = require("apisix.schema_def")
local init = require("apisix.init")
local roundrobin = require("resty.roundrobin")
local ipmatcher = require("resty.ipmatcher")
local expr = require("resty.expr.v1")
local pairs = pairs
local ipairs = ipairs
local type = type
local table_insert = table.insert
local lrucache = core.lrucache.new({
ttl = 0, count = 512
})
local vars_schema = {
type = "array",
}
local match_schema = {
type = "array",
items = {
type = "object",
properties = {
vars = vars_schema
}
},
-- When there is no `match` rule, the default rule passes.
-- Perform upstream logic of plugin configuration.
default = {{ vars = {{"server_port", ">", 0}}}}
}
local upstreams_schema = {
type = "array",
items = {
type = "object",
properties = {
upstream_id = schema_def.id_schema,
upstream = schema_def.upstream,
weight = {
description = "used to split traffic between different" ..
"upstreams for plugin configuration",
type = "integer",
default = 1,
minimum = 0
}
}
},
-- When the upstream configuration of the plugin is missing,
-- the upstream of `route` is used by default.
default = {
{
weight = 1
}
},
minItems = 1,
maxItems = 20
}
local schema = {
type = "object",
properties = {
rules = {
type = "array",
items = {
type = "object",
properties = {
match = match_schema,
weighted_upstreams = upstreams_schema
},
additionalProperties = false
}
}
},
additionalProperties = false
}
local plugin_name = "traffic-split"
local _M = {
version = 0.1,
priority = 966,
name = plugin_name,
schema = schema
}
function _M.check_schema(conf)
local ok, err = core.schema.check(schema, conf)
if not ok then
return false, err
end
if conf.rules then
for _, rule in ipairs(conf.rules) do
if rule.match then
for _, m in ipairs(rule.match) do
local ok, err = expr.new(m.vars)
if not ok then
return false, "failed to validate the 'vars' expression: " .. err
end
end
end
end
end
return true
end
local function parse_domain_for_node(node)
if not ipmatcher.parse_ipv4(node)
and not ipmatcher.parse_ipv6(node)
then
local ip, err = init.parse_domain(node)
if ip then
return ip
end
if err then
return nil, err
end
end
return node
end
local function set_pass_host(ctx, upstream_info, host)
-- Currently only supports a single upstream of the domain name.
-- When the upstream is `IP`, do not do any `pass_host` operation.
if not core.utils.parse_ipv4(host)
and not core.utils.parse_ipv6(host)
then
local pass_host = upstream_info.pass_host or "pass"
if pass_host == "pass" then
ctx.var.upstream_host = ctx.var.host
return
end
if pass_host == "rewrite" then
ctx.var.upstream_host = upstream_info.upstream_host
return
end
ctx.var.upstream_host = host
return
end
return
end
local function set_upstream(upstream_info, ctx)
local nodes = upstream_info.nodes
local new_nodes = {}
if core.table.isarray(nodes) then
for _, node in ipairs(nodes) do
set_pass_host(ctx, upstream_info, node.host)
node.host = parse_domain_for_node(node.host)
node.port = node.port
node.weight = node.weight
table_insert(new_nodes, node)
end
else
for addr, weight in pairs(nodes) do
local node = {}
local ip, port, host
host, port = core.utils.parse_addr(addr)
set_pass_host(ctx, upstream_info, host)
ip = parse_domain_for_node(host)
node.host = ip
node.port = port
node.weight = weight
table_insert(new_nodes, node)
end
end
core.log.info("upstream_host: ", ctx.var.upstream_host)
local up_conf = {
name = upstream_info.name,
type = upstream_info.type,
nodes = new_nodes,
timeout = {
send = upstream_info.timeout and upstream_info.timeout.send or 15,
read = upstream_info.timeout and upstream_info.timeout.read or 15,
connect = upstream_info.timeout and upstream_info.timeout.connect or 15
}
}
local ok, err = upstream.check_schema(up_conf)
if not ok then
core.log.error("failed to validate generated upstream: ", err)
return 500, err
end
local matched_route = ctx.matched_route
up_conf.parent = matched_route
local upstream_key = up_conf.type .. "#route_" ..
matched_route.value.id .. "_" ..upstream_info.vid
core.log.info("upstream_key: ", upstream_key)
upstream.set(ctx, upstream_key, ctx.conf_version, up_conf)
return
end
local function new_rr_obj(weighted_upstreams)
local server_list = {}
for i, upstream_obj in ipairs(weighted_upstreams) do
if upstream_obj.upstream_id then
server_list[upstream_obj.upstream_id] = upstream_obj.weight
elseif upstream_obj.upstream then
-- Add a virtual id field to uniquely identify the upstream key.
upstream_obj.upstream.vid = i
server_list[upstream_obj.upstream] = upstream_obj.weight
else
-- If the upstream object has only the weight value, it means
-- that the upstream weight value on the default route has been reached.
-- Mark empty upstream services in the plugin.
upstream_obj.upstream = "plugin#upstream#is#empty"
server_list[upstream_obj.upstream] = upstream_obj.weight
end
end
return roundrobin:new(server_list)
end
function _M.access(conf, ctx)
if not conf or not conf.rules then
return
end
local weighted_upstreams, match_flag
for _, rule in ipairs(conf.rules) do
match_flag = true
for _, single_match in ipairs(rule.match) do
local expr, err = expr.new(single_match.vars)
if err then
core.log.error("vars expression does not match: ", err)
return 500, err
end
match_flag = expr:eval(ctx.var)
if match_flag then
break
end
end
if match_flag then
weighted_upstreams = rule.weighted_upstreams
break
end
end
core.log.info("match_flag: ", match_flag)
if not match_flag then
return
end
local rr_up, err = core.lrucache.plugin_ctx(lrucache, ctx, nil, new_rr_obj,
weighted_upstreams)
if not rr_up then
core.log.error("lrucache roundrobin failed: ", err)
return 500
end
local upstream = rr_up:find()
if upstream and type(upstream) == "table" then
core.log.info("upstream: ", core.json.encode(upstream))
return set_upstream(upstream, ctx)
elseif upstream and upstream ~= "plugin#upstream#is#empty" then
ctx.upstream_id = upstream
core.log.info("upstream_id: ", upstream)
return
end
ctx.upstream_id = nil
core.log.info("route_up: ", upstream)
return
end
return _M
|
-- transforms unit (by number) into another creature, choice given to user. Syntax is: unitID tickamount maxsize namefilter. A size of 0 is ignored. A length of 0 is also ignored. If no filter, all units will be sorted. A filter of ALL will also work with all units.
local script = require('gui.script')
function transform(target,race,caste,length)
if target==nil then
qerror("Not a valid target")
end
local defaultRace = target.enemy.normal_race
local defaultCaste = target.enemy.normal_caste
target.enemy.normal_race = race
target.enemy.normal_caste = caste
if length>0 then dfhack.timeout(length,'ticks',function() target.enemy.normal_race = defaultRace target.enemy.normal_caste = defaultCaste end) end
end
function compareTableWithString(tbl,str)
if type(tbl)~=tbl then return tbl==str end
for k,v in ipairs(tbl) do
if v==str then return true end
end
end
function getBodySize(caste)
return caste.body_size_1[#caste.body_size_1-1]
end
function selectCreature(unitID,length,size,filter) --taken straight from here, but edited so I can understand it better: https://gist.github.com/warmist/4061959/... again. Also edited for syndromeTrigger, but in a completely different way.
size = size or 0
filter = filter or "all"
length = length or 2400
local creatures=df.global.world.raws.creatures.all
local tbl={}
local tunit=df.unit.find(unitID) or dfhack.gui.getSelectedUnit(true) or qerror('shapechange could not find unit.')
for cr_k,creature in ipairs(creatures) do
for ca_k,caste in ipairs(creature.caste) do
local name=caste.caste_name[0]
if name=="" then name="?" end
if (not filter or compareTableWithString(filter,creature.creature_id) or string.lower(filter)=="all") and (not size or size>getBodySize(caste) or size<1 and not creature.flags.DOES_NOT_EXIST) then table.insert(tbl,{name,nil,cr_k,ca_k}) end
end
end
table.sort(tbl,function(a,b) return a[1]<b[1] end)
script.start(function()
local ok,idx,selection=script.showListPrompt("Creature Selection","Choose creature:",COLOR_WHITE,tbl,f)
transform(tunit,selection[3],selection[4],length)
end)
end
local args = {...}
selectCreature(tonumber(args[1]),tonumber(args[2]),tonumber(args[3]))
|
--RasPegacy v0.1
--Graph Display Child
gl.setup(720, 446)
util.resource_loader{
"boost.png",
"opress.png",
"gothic.ttf",
}
local lines = {}
local last = 0
function splitme(str)
local splitted = {}
last = 0
for par in string.gmatch(str, "[^\n]") do
splitted[#splitted + 1] = par
last = last + 1
end
last = last - 1
return splitted
end
util.file_watch("boost.txt", function(content)
lines = splitme(content)
end)
function node.render()
gl.clear(0.01,0,0.1,0.3)
gothic:write(88, 10, "BOOST", 10, 1, 1, 1)
gothic:write(268, 10,"OIL PRESSURE", 10, 1, 1, 1)
boost:draw(10, 21, 200, 168)
opress:draw(203, 21, 403, 168)
gothic:write(10, 220, "Booost:", 10, 1, 1, 1)
for i, line in ipairs(lines) do
--print(tostring(line))
if i == last then
gothic:write(60, 220, line, 10, 1, 1, 1)
end
end
end
|
local type_map = {}
local original_type = type
local function register_type(obj, name)
-- make sure that this name has not been used before
for k, v in pairs(type_map) do
assert(v ~= name)
end
type_map[obj] = name
return true
end
-- Luacheck complains: "setting read-only global variable type"
-- However, we have to let this pass since we are re-defining
-- the function type to be this function shown below
type = function(obj)
local m_table = getmetatable(obj)
if m_table ~= nil then
local d_type = type_map[m_table]
if d_type ~= nil then
return d_type
end
end
return original_type(obj)
end
return register_type
|
data:extend(
{
{
type = "font",
name = "trainTaxi-small",
from = "default",
size = 13
},
{
type ="font",
name = "trainTaxi-small-bold",
from = "default-bold",
size = 13
}
})
data.raw["gui-style"].default["trainTaxi_frame"] =
{
type = "frame_style",
parent="frame_style",
top_padding = 2,
bottom_padding = 2,
font = "trainTaxi-small-bold",
flow_style =
{
max_on_row = 1,
resize_row_to_width = false
}
}
data.raw["gui-style"].default["trainTaxi_button"] =
{
type = "button_style",
parent = "default",
font = "trainTaxi-small-bold"
}
|
Config = {}
Config.DrawDistance = 100.0
Config.MarkerType = 1
Config.MarkerSize = { x = 1.5, y = 1.5, z = 1.0 }
Config.MarkerColor = { r = 50, g = 50, b = 204 }
Config.EnablePlayerManagement = true
Config.EnableArmoryManagement = false
Config.EnableESXIdentity = true -- only turn this on if you are using esx_identity
Config.EnableNonFreemodePeds = false -- turn this on if you want custom peds
Config.EnableSocietyOwnedVehicles = false
Config.EnableLicenses = true
Config.MaxInService = -1
Config.Locale = 'fr'
Config.StateStations = {
State = {
Blip = {
Pos = { x = 140.067, y = -768.393, z = 45.0 },
Sprite = 419,
Display = 4,
Scale = 1.2,
-- Colour = 29,
},
-- https://wiki.fivem.net/wiki/Weapons
AuthorizedWeapons = {
{ name = 'WEAPON_NIGHTSTICK', price = 200 },
{ name = 'WEAPON_COMBATPISTOL', price = 300 },
{ name = 'WEAPON_ASSAULTSMG', price = 1250 },
{ name = 'WEAPON_CARBINERIFLE', price = 1500 },
{ name = 'WEAPON_PUMPSHOTGUN', price = 600 },
{ name = 'WEAPON_STUNGUN', price = 500 },
{ name = 'WEAPON_FLASHLIGHT', price = 80 },
{ name = 'WEAPON_FLAREGUN', price = 60 },
{ name = 'GADGET_PARACHUTE', price = 300 },
},
Cloakrooms = {
{ x = 147.188, y = -738.033, z = 241.0 }
},
Armories = {
{ x = 151.858, y = -736.181, z = 241.0 }
},
Vehicles = {
{
Spawner = { x = 156.115, y = -681.325, z = 32.0 },
SpawnPoint = { x = 162.236, y = -690.283, z = 32.5 },
Heading = 245.0,
}
},
Helicopters = {
{
Spawner = { x = 140.847, y = -735.739, z = 262.0 },
SpawnPoint = { x = 122.824, y = -744.070, z = 262.0 },
Heading = 160.0,
}
},
VehicleDeleters = {
{ x = 144.150, y = -698.661, z = 32.0 },
},
BossActions = {
{ x = 149.341, y = -759.047, z = 241.0 },
},
},
}
-- https://wiki.fivem.net/wiki/Vehicles
Config.AuthorizedVehicles = {
Shared = {
},
recrue = {
},
garde = {
},
vicepresident = {
},
boss = {
}
}
-- CHECK SKINCHANGER CLIENT MAIN.LUA for matching elements
Config.Uniforms = {
cadet_wear = {
male = {
['tshirt_1'] = 22, ['tshirt_2'] = 4,
['torso_1'] = 21, ['torso_2'] = 0,
['decals_1'] = 0, ['decals_2'] = 0,
['arms'] = 1,
['pants_1'] = 25, ['pants_2'] = 5,
['shoes_1'] = 10, ['shoes_2'] = 0,
['helmet_1'] = -1, ['helmet_2'] = 0,
['chain_1'] = 0, ['chain_2'] = 0,
['ears_1'] = 0, ['ears_2'] = 0,
['ears_1'] = 0, ['ears_2'] = 0
},
female = {
['tshirt_1'] = 36, ['tshirt_2'] = 1,
['torso_1'] = 48, ['torso_2'] = 0,
['decals_1'] = 0, ['decals_2'] = 0,
['arms'] = 44,
['pants_1'] = 34, ['pants_2'] = 0,
['shoes_1'] = 27, ['shoes_2'] = 0,
['helmet_1'] = 45, ['helmet_2'] = 0,
['chain_1'] = 0, ['chain_2'] = 0,
['ears_1'] = 2, ['ears_2'] = 0
}
},
sergeant_wear = {
male = {
['tshirt_1'] = 21, ['tshirt_2'] = 0,
['torso_1'] = 29, ['torso_2'] = 0,
['decals_1'] = 0, ['decals_2'] = 0,
['arms'] = 1,
['pants_1'] = 35, ['pants_2'] = 0,
['shoes_1'] = 10, ['shoes_2'] = 0,
['helmet_1'] = -1, ['helmet_2'] = 0,
['chain_1'] = 0, ['chain_2'] = 0,
['ears_1'] = 0, ['ears_2'] = 0
},
female = {
['tshirt_1'] = 35, ['tshirt_2'] = 0,
['torso_1'] = 48, ['torso_2'] = 0,
['decals_1'] = 7, ['decals_2'] = 1,
['arms'] = 44,
['pants_1'] = 34, ['pants_2'] = 0,
['shoes_1'] = 27, ['shoes_2'] = 0,
['helmet_1'] = -1, ['helmet_2'] = 0,
['chain_1'] = 0, ['chain_2'] = 0,
['ears_1'] = 2, ['ears_2'] = 0
}
},
lieutenant_wear = {
male = {
['tshirt_1'] = 33, ['tshirt_2'] = 1,
['torso_1'] = 29, ['torso_2'] = 1,
['decals_1'] = 0, ['decals_2'] = 0,
['arms'] = 1,
['pants_1'] = 35, ['pants_2'] = 0,
['shoes_1'] = 10, ['shoes_2'] = 0,
['helmet_1'] = -1, ['helmet_2'] = 0,
['chain_1'] = 29, ['chain_2'] = 13,
['ears_1'] = 0, ['ears_2'] = 0
},
female = {
['tshirt_1'] = 35, ['tshirt_2'] = 0,
['torso_1'] = 48, ['torso_2'] = 0,
['decals_1'] = 7, ['decals_2'] = 2,
['arms'] = 44,
['pants_1'] = 34, ['pants_2'] = 0,
['shoes_1'] = 27, ['shoes_2'] = 0,
['helmet_1'] = -1, ['helmet_2'] = 0,
['chain_1'] = 0, ['chain_2'] = 0,
['ears_1'] = 2, ['ears_2'] = 0
}
},
commandant_wear = {
male = {
['tshirt_1'] = 33, ['tshirt_2'] = 2,
['torso_1'] = 29, ['torso_2'] = 2,
['decals_1'] = 0, ['decals_2'] = 0,
['arms'] = 1,
['pants_1'] = 35, ['pants_2'] = 0,
['shoes_1'] = 10, ['shoes_2'] = 0,
['helmet_1'] = -1, ['helmet_2'] = 0,
['chain_1'] = 29, ['chain_2'] = 4,
['ears_1'] = 0, ['ears_2'] = 0
},
female = {
['tshirt_1'] = 35, ['tshirt_2'] = 0,
['torso_1'] = 48, ['torso_2'] = 0,
['decals_1'] = 7, ['decals_2'] = 3,
['arms'] = 44,
['pants_1'] = 34, ['pants_2'] = 0,
['shoes_1'] = 27, ['shoes_2'] = 0,
['helmet_1'] = -1, ['helmet_2'] = 0,
['chain_1'] = 0, ['chain_2'] = 0,
['ears_1'] = 2, ['ears_2'] = 0
}
},
bullet_wear = {
male = {
['bproof_1'] = 11, ['bproof_2'] = 1
},
female = {
['bproof_1'] = 13, ['bproof_2'] = 1
}
},
gilet_wear = {
male = {
['tshirt_1'] = 59, ['tshirt_2'] = 1
},
female = {
['tshirt_1'] = 36, ['tshirt_2'] = 1
}
}
}
Config.PublicZones = {
EnterBuilding = {
Pos = { x = 140.067, y = -768.393, z = 44.8 },
Size = { x = 2.0, y = 2.0, z = 1.0 },
Color = { r = 64, g = 0, b = 74 },
Marker = 25,
Blip = true,
Name = "Le Maclerait Libéré",
Type = "teleport",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour entrer dans l'immeuble.",
Teleport = { x = 135.5, y = -766.783, z = 241.0 }
},
ExitBuilding = {
Pos = { x = 135.5, y = -763.368, z = 241.2 },
Size = { x = 2.0, y = 2.0, z = 1.0 },
Color = { r = 64, g = 0, b = 74 },
Marker = 25,
Blip = true,
Name = "Le Maclerait Libéré",
Type = "teleport",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour aller à l'entrée de l'immeuble.",
Teleport = { x = 140.067, y = -768.393, z = 45.0 },
},
EnterRoof = {
Pos = { x = 138.371, y = -764.507, z = 241.2 },
Size = { x = 2.0, y = 2.0, z = 1.0 },
Color = { r = 64, g = 0, b = 74 },
Marker = 25,
Blip = true,
Name = "Le Maclerait Libéré",
Type = "teleport",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour sortir sur le toit.",
Teleport = { x = 157.445, y = -764.785, z = 257.2 }
},
ExitRoof = {
Pos = { x = 157.445, y = -764.785, z = 257.2 },
Size = { x = 2.0, y = 2.0, z = 1.0 },
Color = { r = 64, g = 0, b = 74 },
Marker = 25,
Blip = true,
Name = "Le Maclerait Libéré",
Type = "teleport",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour entrer dans l'immeuble.",
Teleport = { x = 135.5, y = -766.783, z = 241.0 },
},
EnterGarage = {
Pos = { x = 131.191, y = -762.076, z = 44.8 },
Size = { x = 2.0, y = 2.0, z = 1.0 },
Color = { r = 64, g = 0, b = 74 },
Marker = 25,
Blip = true,
Name = "Le Maclerait Libéré",
Type = "teleport",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour entrer dans le garage.",
Teleport = { x = 147.81, y = -687.7223, z = 32.0 },
},
ExitGarage = {
Pos = { x = 144.975, y = -689.155, z = 32.2 },
Size = { x = 2.0, y = 2.0, z = 1.0 },
Color = { r = 64, g = 0, b = 74 },
Marker = 25,
Blip = true,
Name = "Le Maclerait Libéré",
Type = "teleport",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour sortir du garage.",
Teleport = { x = 129.371, y = -764.312, z = 45.0 },
},
}
|
----------------------------------------------------------------------------------------------------
-- Handle add-on configuration
--
--get the engine & Add-on
local Engine = select(2,...);
local AddOn = Engine.AddOn;
--load libraries
local AceConfig = LibStub("AceConfig-3.0");
local AceConfigDialog = LibStub("AceConfigDialog-3.0");
local AceDB = LibStub("AceDB-3.0");
local AceDBOptions = LibStub("AceDBOptions-3.0");
local LibDualSpec = LibStub('LibDualSpec-1.0');
--get locale
local L = Engine.Locale;
--defaults
Engine.DB = {};
Engine.DB.profile={};
Engine.Profile = Engine.DB.profile;
--return two slash commands from a add-on name, for example Cecile_ExampleAddon will return cea & cecile_ea
function AddOn.GetSlashFromName(name)
local slash1 = "";
local slash2 = "";
local c;
local picknext = true;
local pickedfirstspace = false;
for i = 1, string.len(name) do
c = string.sub(name,i,i);
if (picknext) then
slash1 = slash1 .. string.lower(c);
if pickedfirstspace then
slash2 = slash2 .. string.lower(c);
end
picknext = false;
else
if (c=="_") or (c==" ") then
picknext = true;
pickedfirstspace = true;
slash2 = slash2..string.lower(string.sub(name,1,i-1)).."_";
elseif (c==string.upper(c)) then
slash1 = slash1 .. string.lower(c);
if pickedfirstspace then
slash2 = slash2 .. string.lower(c);
end
end
end
end
if not pickedfirstspace then
slash2 = slash2 .. string.lower(name);
end
return slash1,slash2;
end
function AddOn:SetupDefaults(object,parent)
--goes trough all the modules
for name,module in pairs(object.modules) do
--if this module has defaults
if(module.Defaults) then
--get all defaults tables of the module andd add then to the global defaults
for databaseName,databaseTable in pairs(module.Defaults) do
if parent then
Engine.Defaults[databaseName][parent][name] = databaseTable;
else
Engine.Defaults[databaseName][name] = databaseTable;
end
end
end
if not parent then
self:SetupDefaults(module,name);
end
end
end
--setup options
function AddOn:SetupOptions()
--setup modules default
self:SetupDefaults(self);
--create database
Engine.DB = AceDB:New(Engine.Name.."DB", Engine.Defaults, true);
Engine.GLOBAL = _G[Engine.Name.."DB"];
--set profile
Engine.Profile = Engine.DB.profile;
Engine.Global = Engine.DB.global;
--get the slash commands
Engine.slash1,Engine.slash2 = self.GetSlashFromName(Engine.Name);
-- Create slash commands
_G["SLASH_"..Engine.Name.."1"] = "/"..Engine.slash1;
_G["SLASH_"..Engine.Name.."2"] = "/"..Engine.slash2;
_G.SlashCmdList[Engine.Name] = self.HandleCommands;
end
--create options for blizzard ui
function AddOn:RegisterBlizzardOptions()
--local vars
local sorted = {};
--get version
local Version = self:GetModule("version");
--register the table and add it to blizzar config ui
AceConfig:RegisterOptionsTable(Engine.Name,Engine.Options);
AceConfigDialog:AddToBlizOptions(Engine.Name,Version.Title);
--goes trough all the modules
for _ , module in pairs(self.modules) do
if module.Options then
table.insert(sorted,module.Options);
end
end
--sort by order
table.sort(sorted, function(a,b) return a.order < b.order end);
--go trouh the table
for k,v in pairs(sorted) do
--register the table and add it to blizzar config ui
AceConfig:RegisterOptionsTable(Engine.Name..k, v);
AceConfigDialog:AddToBlizOptions(Engine.Name..k,v.name,Version.Title);
end
--register profile changes callbacks
Engine.DB.RegisterCallback(self, "OnProfileChanged", "OnProfileChanged");
Engine.DB.RegisterCallback(self, "OnProfileCopied", "OnProfileChanged");
Engine.DB.RegisterCallback(self, "OnProfileReset", "OnProfileChanged");
--create profile options
local profileOptions = AceDBOptions:GetOptionsTable(Engine.DB);
profileOptions.name = L["PROFILES"];
--setup lib dual spec
LibDualSpec:EnhanceDatabase(Engine.DB, Engine.Name);
LibDualSpec:EnhanceOptions(profileOptions, Engine.DB);
--register the table and add it to blizzar config ui
AceConfig:RegisterOptionsTable(Engine.Name.."Profile", profileOptions);
AceConfigDialog:AddToBlizOptions(Engine.Name.."Profile",L["PROFILES"],Version.Title);
end
function AddOn:OpenBlizzardConfig()
--get version
local Version = self:GetModule("version");
--open config twice (yes, if not does not work always)
_G.InterfaceOptionsFrame_OpenToCategory(Version.Title);
_G.InterfaceOptionsFrame_OpenToCategory(Version.Title);
end
-- Handle commands
function AddOn.HandleCommands(args)
--if not parameters show configuration
if args == nil then
AddOn:OpenBlizzardConfig()
else
--to check if any module has handle this command
local handleByModule = false;
--goes trough the modules
for _ , module in pairs(AddOn.modules) do
--if any module has a HandleCommands
if module.handleCommand and type(module.handleCommand)=="function" then
--call it and mark that a module has handle it
handleByModule = handleByModule or module.handleCommand(args);
end
end
--if not module has handle it, open configuration
if not handleByModule then
AddOn:OpenBlizzardConfig();
end
end
end
-- Called after profile changed
function AddOn:OnProfileChanged(event, database)
--set new profile
Engine.Profile = database.profile;
--if any module has a OnProfileChange trigger it
for _ , module in pairs(self.modules) do
if module.OnProfileChanged and type(module.OnProfileChanged)=="function" then
module.OnProfileChanged(event);
end
end
end
function AddOn:NotifyChange(object)
--if any module has a OnProfileChange trigger it
for _ ,module in pairs(object.modules) do
if module.LoadProfileSettings and type(module.LoadProfileSettings)=="function" then
module:LoadProfileSettings();
end
self:NotifyChange(module);
end
end
function AddOn:OnCfgChange()
self:NotifyChange(self);
end
|
--[[
Cloud Manager API
This API allows access to Cloud Manager programs, pipelines, and environments by an authorized technical account created through the Adobe I/O Console. The base url for this API is https://cloudmanager.adobe.io, e.g. to get the list of programs for an organization, you would make a GET request to https://cloudmanager.adobe.io/api/programs (with the correct set of headers as described below). This swagger file can be downloaded from https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.yaml.
The version of the OpenAPI document: 1.0.0
Contact: opensource@shinesolutions.com
Generated by: https://openapi-generator.tech
]]
-- program__links class
local program__links = {}
local program__links_mt = {
__name = "program__links";
__index = program__links;
}
local function cast_program__links(t)
return setmetatable(t, program__links_mt)
end
local function new_program__links(http__ns_adobe_com_adobecloud_rel_pipelines, http__ns_adobe_com_adobecloud_rel_environments, http__ns_adobe_com_adobecloud_rel_repositories, self)
return cast_program__links({
["http://ns.adobe.com/adobecloud/rel/pipelines"] = http__ns_adobe_com_adobecloud_rel_pipelines;
["http://ns.adobe.com/adobecloud/rel/environments"] = http__ns_adobe_com_adobecloud_rel_environments;
["http://ns.adobe.com/adobecloud/rel/repositories"] = http__ns_adobe_com_adobecloud_rel_repositories;
["self"] = self;
})
end
return {
cast = cast_program__links;
new = new_program__links;
}
|
local util = require"harmonize.util"
local help = util.help
local config = require"harmonize.storage.config"
local commands = {}
local function setConfig(key, value)
config.load()
local p = util.split(key, "\\.")
local currObj = config.config
for k = 1, (#p - 1) do
if type(currObj[p[k]]) ~= "table" then
currObj[p[k]] = {}
end
currObj = currObj[p[k]]
end
currObj[p[#p]] = value
config.save()
end
local function serializeTable(t, indent)
local result = ""
for k,v in util.pairsSorted(t) do
if type(v) == "table" then
result = result .. string.rep("\t", indent) .. k .. "\n" .. serializeTable(v, indent + 1) .. "\n"
else
result = result .. string.rep("\t", indent) .. k .. "\t" .. tostring(v) .. "\n"
end
end
return result
end
commands.show = help("Display all configuration parameters.")(function(arg)
config.load()
print(serializeTable(config.config, 0))
end)
commands.set = {}
commands.set.__help = "Set config values."
commands.set.string = help("Set the provided key to the value\n\nUsage: config set dot.separated.key \"string_value\"")(function(arg)
if #arg < 2 then return 2 end
setConfig(arg[1], arg[2])
end)
commands.set.number = help("Set the provided key to the value\n\nUsage: config set dot.separated.key 100")(function(arg)
if #arg < 2 then return 2 end
setConfig(arg[1], tonumber(arg[1]))
end)
return commands
|
local factory = nnst.ApproximationNormalizatorFactory
local tests = torch.TestSuite()
function tests.ApproximationNormalizatorFactory_NoneNormalize()
local n = factory:none()
tester:eq(n:normalize(2), 2)
end
function tests.ApproximationNormalizatorFactory_MultiplicativeInverseNormalize()
local n = factory:multiplicativeInverse()
tester:eq(n:normalize(2), 0.5)
end
function tests.ApproximationNormalizatorFactory_MultiplicativeInverseNormalizeMinus()
local n = factory:multiplicativeInverse()
tester:eq(n:normalize(-2), -0.5)
end
function tests.ApproximationNormalizatorFactory_MultiplicativeInverseNormalizeLowerValueError()
local function test()
local n = factory:multiplicativeInverse()
n:normalize(-1)
end
tester:assertError(test)
end
function tests.ApproximationNormalizatorFactory_MultiplicativeInverseNormalizeUpperValueError()
local function test()
local n = factory:multiplicativeInverse()
n.normalize(1)
end
tester:assertError(test)
end
function tests.ApproximationNormalizatorFactory_MultiplicativeInverseNormalizeZeroValueError()
local function test()
local n = factory:multiplicativeInverse()
n:normalize(0)
end
tester:assertError(test)
end
return tests
|
--
local screenW, screenH = guiGetScreenSize()
customTitleW = guiCreateWindow(0.23, 0.21, 0.54, 0.58, "AuroraRPG ~ Custom Titles", true)
guiWindowSetSizable(customTitleW, false)
guiSetAlpha(customTitleW, 0.00)
guiSetVisible(customTitleW, false)
--[[customTitleGridlist = guiCreateGridList(0.01, 0.05, 0.97, 0.55, true, customTitleW)
guiGridListAddColumn(customTitleGridlist, "Custom Title", 0.5)
guiGridListAddColumn(customTitleGridlist, "Color", 0.4)
useCustomTitle = guiCreateButton(0.01, 0.63, 0.97, 0.06, "Disable", true, customTitleW)
buyCustomTitle = guiCreateButton(0.01, 0.71, 0.97, 0.06, "Buy a custom title", true, customTitleW)
closeBtn = guiCreateButton(0.01, 0.89, 0.97, 0.06, "Close", true, customTitleW)
--]]
--
useCustomTitle = guiCreateButton(0.29, 0.63, 0.41, 0.03, "Use", true)
buyCustomTitle = guiCreateButton(0.30, 0.68, 0.41, 0.03, "Buy", true)
closeBtn = guiCreateButton(0.30, 0.72, 0.41, 0.03, "color", true)
guiSetAlpha(closeBtn, 0.0)
guiSetAlpha(useCustomTitle, 0.0)
guiSetAlpha(buyCustomTitle, 0.0)
customTitleGridlist = guiCreateGridList(0.30, 0.28, 0.41, 0.33, true)
guiGridListAddColumn(customTitleGridlist, "Custom Title", 0.5)
guiGridListAddColumn(customTitleGridlist, "Color", 0.5)
guiSetAlpha(customTitleGridlist, 0.86)
guiSetVisible(useCustomTitle, false)
guiSetVisible(buyCustomTitle, false)
guiSetVisible(closeBtn, false)
guiSetVisible(customTitleGridlist, false)
function dxCustomTitle()
dxDrawRectangle(screenW * 0.2906, screenH * 0.2333, screenW * 0.4188, screenH * 0.5347, tocolor(0, 0, 0, 179), false)
dxDrawRectangle(screenW * 0.2906, screenH * 0.2347, screenW * 0.4188, screenH * 0.0361, tocolor(0, 0, 0, 179), false)
dxDrawText("AuroraRPG ~ Customtitles", screenW * 0.2883, screenH * 0.2319, screenW * 0.7094, screenH * 0.2708, tocolor(255, 255, 255, 255), 1.40, "default-bold", "center", "center", false, false, false, false, false)
if (guiGetEnabled(useCustomTitle)) then
dxDrawRectangle(screenW * 0.2961, screenH * 0.6278, screenW * 0.4055, screenH * 0.0278, tocolor(0, 0, 0, 179), false)
dxDrawText(guiGetText(useCustomTitle), screenW * 0.2953, screenH * 0.6292, screenW * 0.7016, screenH * 0.6556, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
end
dxDrawRectangle(screenW * 0.2961, screenH * 0.6750, screenW * 0.4055, screenH * 0.0278, tocolor(0, 0, 0, 179), false)
dxDrawRectangle(screenW * 0.2953, screenH * 0.7167, screenW * 0.4055, screenH * 0.0278, tocolor(0, 0, 0, 179), false)
dxDrawText("Buy a custom title", screenW * 0.2953, screenH * 0.6750, screenW * 0.7016, screenH * 0.7014, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
dxDrawText("Close", screenW * 0.2953, screenH * 0.7181, screenW * 0.7016, screenH * 0.7444, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
guiBringToFront(customTitleGridlist)
guiBringToFront(useCustomTitle)
guiBringToFront(closeBtn)
guiBringToFront(buyCustomTitle)
end
local checkbox = {}
buyCustomTitleW = guiCreateWindow(0.34, 0.22, 0.33, 0.55, "Buy custom title", true)
guiWindowSetSizable(buyCustomTitleW, false)
guiSetAlpha(buyCustomTitleW, 0.00)
guiSetVisible(buyCustomTitleW, false)
--backToMainW = guiCreateButton(0.02, 0.89, 0.95, 0.08, "Back", true, buyCustomTitleW)
--finalizeCustomTitle = guiCreateButton(0.02, 0.79, 0.95, 0.08, "Buy", true, buyCustomTitleW)
--openPicker = guiCreateButton(0.02, 0.51, 0.95, 0.06, "Open colorpicker", true, buyCustomTitleW)
--checkbox[1] = guiCreateCheckBox(0.02, 0.12, 0.95, 0.04, "Personal custom title ($5,000,000)", false, true, buyCustomTitleW)
--checkbox[2] = guiCreateCheckBox(0.02, 0.18, 0.95, 0.04, "Group custom title ($10,000,000)", false, true, buyCustomTitleW)
--labelType = guiCreateLabel(0.02, 0.06, 0.95, 0.05, "Choose the type of custom title you will buy:", true, buyCustomTitleW)
--labelTitle = guiCreateLabel(0.02, 0.26, 0.95, 0.05, "Choose the title name (hexes are allowed):", true, buyCustomTitleW)
--labelColor = guiCreateLabel(0.02, 0.44, 0.95, 0.05, "Choose the color:", true, buyCustomTitleW)
--titleBox = guiCreateEdit(0.02, 0.33, 0.94, 0.06, "Choose your title", true, buyCustomTitleW)
--redBox = guiCreateEdit(0.02, 0.58, 0.22, 0.06, "R", true, buyCustomTitleW)
--greenBox = guiCreateEdit(0.27, 0.58, 0.22, 0.06, "G", true, buyCustomTitleW)
--blueBox = guiCreateEdit(0.53, 0.58, 0.22, 0.06, "B", true, buyCustomTitleW)
openPicker = guiCreateButton(0.39, 0.57, 0.29, 0.02, "color picker", true)
guiSetAlpha(openPicker, 0.00)
finalizeCustomTitle = guiCreateButton(0.38, 0.74, 0.31, 0.02, "buy", true)
guiSetAlpha(finalizeCustomTitle, 0.00)
backToMainW = guiCreateButton(0.38, 0.78, 0.31, 0.02, "back", true)
guiSetAlpha(backToMainW, 0.00)
checkbox[1] = guiCreateCheckBox(0.39, 0.38, 0.28, 0.02, "Personal custom title ($5,000,000)", false, true)
checkbox[2] = guiCreateCheckBox(0.39, 0.41, 0.28, 0.02, "Group custom title ($10,000,000)", false, true)
titleBox = guiCreateEdit(0.39, 0.49, 0.28, 0.03, "Choose your title", true)
redBox = guiCreateEdit(0.39, 0.60, 0.03, 0.04, "R", true)
greenBox = guiCreateEdit(0.42, 0.60, 0.03, 0.04, "G", true)
blueBox = guiCreateEdit(0.45, 0.60, 0.03, 0.04, "B", true)
elementsGUITwo = {openPicker, finalizeCustomTitle, backToMainW, checkbox[1], checkbox[2], titleBox, redBox, greenBox, blueBox}
for i, v in ipairs(elementsGUITwo) do
guiSetVisible(v, false)
end
function dxWindowsecond()
dxDrawRectangle(screenW * 0.3820, screenH * 0.2819, screenW * 0.3039, screenH * 0.5542, tocolor(0, 0, 0, 179), false)
dxDrawRectangle(screenW * 0.3820, screenH * 0.2819, screenW * 0.3039, screenH * 0.0472, tocolor(0, 0, 0, 179), false)
dxDrawText("Buy custom title", screenW * 0.3812, screenH * 0.2847, screenW * 0.6859, screenH * 0.3292, tocolor(255, 255, 255, 255), 1.40, "default-bold", "center", "center", false, false, false, false, false)
dxDrawText("Choose the type of custom title you will buy:", screenW * 0.3891, screenH * 0.3431, screenW * 0.6703, screenH * 0.3722, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
dxDrawText("Choose the title name (hexes are allowed):", screenW * 0.3883, screenH * 0.4528, screenW * 0.6695, screenH * 0.4819, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
dxDrawText("Choose the color:", screenW * 0.3898, screenH * 0.5403, screenW * 0.6711, screenH * 0.5694, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
dxDrawRectangle(screenW * 0.3883, screenH * 0.5750, screenW * 0.2828, screenH * 0.0208, tocolor(0, 0, 0, 179), false)
dxDrawText("Open color picker", screenW * 0.3891, screenH * 0.5750, screenW * 0.6711, screenH * 0.5958, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
dxDrawRectangle(screenW * 0.3836, screenH * 0.7792, screenW * 0.3023, screenH * 0.0222, tocolor(0, 0, 0, 179), false)
if (guiGetEnabled(finalizeCustomTitle)) then
dxDrawRectangle(screenW * 0.3836, screenH * 0.7431, screenW * 0.3023, screenH * 0.0222, tocolor(0, 0, 0, 179), false)
dxDrawText("Buy", screenW * 0.3820, screenH * 0.7417, screenW * 0.6859, screenH * 0.7653, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
end
dxDrawText("Back", screenW * 0.3820, screenH * 0.7792, screenW * 0.6859, screenH * 0.8028, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
end
addEventHandler("onClientGUIClick", buyCustomTitleW,
function()
guiMoveToBack(source)
end
)
_guiSetVisible = guiSetVisible
function guiSetVisible(window, b)
if (window == customTitleW) then
if (b) then
addEventHandler("onClientRender", root, dxCustomTitle)
else
removeEventHandler("onClientRender", root, dxCustomTitle)
end
guiSetVisible(useCustomTitle, b)
guiSetVisible(buyCustomTitle, b)
guiSetVisible(closeBtn, b)
guiSetVisible(customTitleGridlist, b)
elseif (window == buyCustomTitleW) then
if (b) then
addEventHandler("onClientRender", root, dxWindowsecond)
else
removeEventHandler("onClientRender", root, dxWindowsecond)
end
for i,v in ipairs(elementsGUITwo) do
guiSetVisible(v, b)
end
end
return _guiSetVisible(window, b)
end
--
local filterWords = {
['saur']="****",
['cit']="***",
['c*t']="***",
['saes']="****",
['fuck']="love",
['cunt']="****",
['asshole']="*******",
['aura']="****",
['nsc']="***",
['dick']="papa",
['porn']="banana",
['bitch']="spicy potato",
['xxx']="***",
['mute']="pepsi",
['jail']="coke",
['ban']="luf",
['cocksuckers']="i love you papa",
['amk']="love",
['kos']="apple",
['sharmota']="pear",
['miboun']="pepes",
}
function filter_text(text)
--for i, v in pairs(filterWords) do
-- if (string.match(text:lower(), i)) then
-- text = string.gsub(text:lower(), i, v)
-- end
-- end
return text
end
function number_mode_function(elementChanged)
local newText = guiGetText(elementChanged)
if (newText == getElementData(source, "place_holder")) then
return false
end
if (not tonumber(newText)) then
guiSetText(elementChanged, "")
return false
end
if (tonumber(newText) > 255) then
guiSetText(elementChanged, "255")
return true
elseif (tonumber(newText) < 0) then
guiSetText(elementChanged, "0")
return true
end
guiSetText(elementChanged, newText)
return true
end
function set_number_mode(guiElement, text)
addEventHandler("onClientGUIChanged", guiElement, number_mode_function)
end
function placeholder_function()
if (eventName == "onClientGUIFocus") then
local newText = guiGetText(source)
if (newText == getElementData(source, "place_holder")) then
guiSetText(source, "")
end
else
if (guiGetText(source) == "") then
guiSetText(source, getElementData(source, "place_holder"))
end
end
end
function set_placeholder(guiElement)
addEventHandler("onClientGUIFocus", guiElement, placeholder_function, true)
addEventHandler("onClientGUIBlur", guiElement, placeholder_function, true)
setElementData(guiElement, "place_holder", guiGetText(guiElement))
end
function misc_checkbox(guiElement)
for i, v in ipairs(checkbox) do
if (v == guiElement) then
return i
end
end
end
function checkbox_function()
if (misc_checkbox(source)) then
local number = misc_checkbox(source)
if (number == 1) then
guiCheckBoxSetSelected(checkbox[2], false)
guiCheckBoxSetSelected(checkbox[1], true)
else
guiCheckBoxSetSelected(checkbox[1], false)
guiCheckBoxSetSelected(checkbox[2], true)
end
end
end
addEventHandler("onClientGUIClick", checkbox[1], checkbox_function, false)
addEventHandler("onClientGUIClick", checkbox[2], checkbox_function, false)
--
set_placeholder(redBox)
set_placeholder(greenBox)
set_placeholder(titleBox)
set_placeholder(blueBox)
set_number_mode(redBox)
set_number_mode(greenBox)
set_number_mode(blueBox)
--
function main_window_toggle(data, data2, data3, money)
local visibility = not guiGetVisible(customTitleW)
showCursor(visibility)
guiSetVisible(customTitleW, visibility)
if (data) then
guiGridListClear(customTitleGridlist)
local row = guiGridListAddRow(customTitleGridlist)
guiGridListSetItemText(customTitleGridlist, row, 1, "Personal Custom Titles", true, true)
for i, v in ipairs(data) do
if (v.cTType == "personal") then
local row = guiGridListAddRow(customTitleGridlist)
guiGridListSetItemText(customTitleGridlist, row, 1, v.cTName, false, true)
guiGridListSetItemText(customTitleGridlist, row, 2, v.cTr..","..v.cTg..","..v.cTb, false, true)
guiGridListSetItemColor(customTitleGridlist, row, 2, v.cTr, v.cTg, v.cTb)
end
end
local row = guiGridListAddRow(customTitleGridlist)
guiGridListSetItemText(customTitleGridlist, row, 1, "Group Custom Titles", true, true)
for i, v in ipairs(data2) do
if (v.cTType == "group") then
local row = guiGridListAddRow(customTitleGridlist)
guiGridListSetItemText(customTitleGridlist, row, 1, v.cTName, false, true)
guiGridListSetItemText(customTitleGridlist, row, 2, v.cTr..","..v.cTg..","..v.cTb, false, true)
guiGridListSetItemColor(customTitleGridlist, row, 2, v.cTr, v.cTg, v.cTb)
end
end
local row = guiGridListAddRow(customTitleGridlist)
guiGridListSetItemText(customTitleGridlist, row, 1, "Job Custom Titles", true, true)
for i, v in ipairs(data3) do
local row = guiGridListAddRow(customTitleGridlist)
guiGridListSetItemText(customTitleGridlist, row, 1, v.cTName, false, true)
guiGridListSetItemText(customTitleGridlist, row, 2, v.cTr..","..v.cTg..","..v.cTb, false, true)
guiGridListSetItemColor(customTitleGridlist, row, 2, v.cTr, v.cTg, v.cTb)
end
end
if (tonumber(money)) then
guiSetText(titleBox, "Choose your title")
guiSetText(redBox, "R")
guiSetText(greenBox, "G")
guiSetText(blueBox, "B")
guiSetEnabled(finalizeCustomTitle, true)
guiSetEnabled(checkbox[1], true)
guiSetEnabled(checkbox[2], true)
if (money < 5000000) then
guiSetEnabled(checkbox[1], false)
guiSetEnabled(checkbox[2], false)
guiSetEnabled(finalizeCustomTitle, false)
end
if (money < 10000000) then
guiSetEnabled(checkbox[2], false)
end
end
if (getElementData(localPlayer, "ctData")) then
guiSetText(useCustomTitle, "Disable")
guiSetEnabled(useCustomTitle, true)
else
guiSetText(useCustomTitle, "Use")
guiSetEnabled(useCustomTitle, false)
end
end
addEvent("AURnewCustomTitle.gui", true)
addEventHandler("AURnewCustomTitle.gui", root, main_window_toggle)
function secondary_window_toggle()
main_window_toggle()
local visibility = not guiGetVisible(buyCustomTitleW)
showCursor(visibility)
guiSetVisible(buyCustomTitleW, visibility)
if (visibility) then
guiSetInputMode("no_binds_when_editing")
else
guiSetInputMode("allow_binds")
end
end
function secondary_window_toggle2()
local visibility = not guiGetVisible(buyCustomTitleW)
showCursor(visibility)
guiSetVisible(buyCustomTitleW, visibility)
if (visibility) then
guiSetInputMode("no_binds_when_editing")
else
guiSetInputMode("allow_binds")
end
end
addEvent("AURnewCustomTitle.gui2", true)
addEventHandler("AURnewCustomTitle.gui2", root, secondary_window_toggle2)
function checkbox_selected()
local personal = guiCheckBoxGetSelected(checkbox[1])
local group = guiCheckBoxGetSelected(checkbox[2])
if (personal) then
return "personal"
end
if (group) then
return "group"
end
return false
end
function handle_buttons(button)
if (button ~= "left") then
return false
end
if (source == closeBtn) then
main_window_toggle()
return true
end
if (source == buyCustomTitle) then
secondary_window_toggle()
return true
end
if (source == backToMainW) then
secondary_window_toggle()
guiSetVisible(customTitleW, true)
showCursor(true)
return true
end
if (source == openPicker) then
exports.cpicker:openPicker(source, "#FF0000", "Choose a color for you custom title!")
return true
end
if (source == finalizeCustomTitle) then
local r, g, b = guiGetText(redBox), guiGetText(greenBox), guiGetText(blueBox)
local title = guiGetText(titleBox)
local choice = checkbox_selected()
if (not choice) then
outputChatBox("You must select a box!", 255, 25, 25)
return false
end
if (title:gsub("%s+", "") == "") then
outputChatBox("You cannot leave title box empty!", 255, 25, 25)
return false
end
if (string.len(title) > 45) then
outputChatBox("You can't buy a custom title with more than 45 chars.", 255, 0, 0)
return false
end
if (not tonumber(r) or not tonumber(g) or not tonumber(b)) then
outputChatBox("You cannot leave title R/G/B box empty!", 255, 25, 25)
return false
end
if (antiSpam and getTickCount() - antiSpam <= 1000) then return false end
triggerServerEvent("AURnewCustomTitle.recieveCT", resourceRoot, title, r, g, b, choice)
antiSpam = getTickCount()
return true
end
if (source == customTitleGridlist) then
local row = guiGridListGetSelectedItem(customTitleGridlist)
if (row == -1) then
if (getElementData(localPlayer, "ctData")) then
guiSetText(useCustomTitle, "Disable")
guiSetEnabled(useCustomTitle, true)
else
guiSetText(useCustomTitle, "Use")
guiSetEnabled(useCustomTitle, false)
end
else
guiSetText(useCustomTitle, "Use")
guiSetEnabled(useCustomTitle, true)
end
end
if (source == useCustomTitle) then
if (guiGetText(source) == "Disable") then
setElementData(localPlayer, "ctData", false)
main_window_toggle()
end
local row = guiGridListGetSelectedItem(customTitleGridlist)
if (row == -1) then
if (getElementData(localPlayer, "ctData")) then
guiSetText(useCustomTitle, "Disable")
guiSetEnabled(useCustomTitle, true)
else
guiSetText(useCustomTitle, "Use")
guiSetEnabled(useCustomTitle, false)
end
else
if (guiGetText(source) == "Use") then
local text = guiGridListGetItemText(customTitleGridlist, row, 1)
local rgb = split(guiGridListGetItemText(customTitleGridlist, row, 2), ",")
setElementData(localPlayer, "ctData", {filter_text(text), rgb})
main_window_toggle()
end
end
end
end
addEventHandler("onClientGUIClick", guiRoot, handle_buttons)
addEventHandler("onColorPickerOK", root,
function(element, hex, r, g, b)
if (element ~= openPicker) then
return false
end
guiSetText(redBox, r)
guiSetText(greenBox, g)
guiSetText(blueBox, b)
end
)
function render_custom_titles()
for i, v in ipairs(getElementsByType("player")) do
if (getElementData(v, "ctData")) then
local textToDisplay = getElementData(v, "ctData")[1]
local r, g, b = getElementData(v, "ctData")[2][1], getElementData(v, "ctData")[2][2], getElementData(v, "ctData")[2][3]
local pX, pY, pZ = getElementPosition(localPlayer)
local x, y, z = getPedBonePosition(v, 6)
local sX, sY = getScreenFromWorldPosition(x, y, z + 0.3)
local dist = getDistanceBetweenPoints3D(x, y, z, pX, pY, pZ)
if (sX and dist < 50) then
if (isLineOfSightClear(pX, pY, pZ, x, y, z, true, false, false, false, false)) then
local sX = sX - 1
local scale = (((50 - dist) / 50) * 1) + 0.8
dxDrawText(textToDisplay:gsub("#%x%x%x%x%x%x", ""), sX-(dxGetTextWidth(textToDisplay, scale, "default-bold") / 2)-1, sY-1, sX-1, sY-1, tocolor(0,0,0,255), scale, "default-bold", "left", "top", false, false, false, false)
dxDrawText(textToDisplay:gsub("#%x%x%x%x%x%x", ""), sX-(dxGetTextWidth(textToDisplay, scale, "default-bold") / 2)+1, sY-1, sX+1, sY-1, tocolor(0,0,0,255), scale, "default-bold", "left", "top", false, false, false, false)
dxDrawText(textToDisplay:gsub("#%x%x%x%x%x%x", ""), sX-(dxGetTextWidth(textToDisplay, scale, "default-bold") / 2)-1, sY+1, sX-1, sY+1, tocolor(0,0,0,255), scale, "default-bold", "left", "top", false, false, false, false)
dxDrawText(textToDisplay:gsub("#%x%x%x%x%x%x", ""), sX-(dxGetTextWidth(textToDisplay, scale, "default-bold") / 2)+1, sY+1, sX+1, sY+1, tocolor(0,0,0,255), scale, "default-bold", "left", "top", false, false, false, false)
dxDrawText(textToDisplay:gsub("#%x%x%x%x%x%x", ""), sX-(dxGetTextWidth(textToDisplay, scale, "default-bold") / 2)-1, sY, sX-1, sY, tocolor(0,0,0,255), scale, "default-bold", "left", "top", false, false, false, false)
dxDrawText(textToDisplay:gsub("#%x%x%x%x%x%x", ""), sX-(dxGetTextWidth(textToDisplay, scale, "default-bold") / 2)+1, sY, sX+1, sY, tocolor(0,0,0,255), scale, "default-bold", "left", "top", false, false, false, false)
dxDrawText(textToDisplay:gsub("#%x%x%x%x%x%x", ""), sX-(dxGetTextWidth(textToDisplay, scale, "default-bold") / 2), sY-1, sX, sY-1, tocolor(0,0,0,255), scale, "default-bold", "left", "top", false, false, false, false)
dxDrawText(textToDisplay:gsub("#%x%x%x%x%x%x", ""), sX-(dxGetTextWidth(textToDisplay, scale, "default-bold") / 2), sY+1, sX, sY+1, tocolor(0,0,0,255), scale, "default-bold", "left", "top", false, false, false, false)
dxDrawText(textToDisplay, sX-(dxGetTextWidth(textToDisplay, scale, "default-bold") / 2), sY, sX, sY, tocolor(r,g,b,255), scale, "default-bold", "left", "top", false, false, false, true)
end
end
end
end
end
addEventHandler("onClientRender", root, render_custom_titles)
|
-- http://www.esp8266.com/viewtopic.php?f=19&t=771
-- Scan for I2C devices
id=0
sda, scl = 2, 1
-- initialize i2c, set pin1 as sda, set pin0 as scl
i2c.setup(id,sda,scl,i2c.SLOW)
for x=0,5 do
for i=0,127 do
i2c.start(id)
resCode = i2c.address(id, i, i2c.TRANSMITTER)
i2c.stop(id)
if resCode == true then print("We have a device on address 0x" .. string.format("%02x", i) .. " (" .. i ..")") end
end
tmr.delay(300 * 1000)
end
|
-- Copyright (c) 2015-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
-- An action is only performed if the clause is true
-- is_valid and update_knowledge will be called regardless though and should
-- keep the truth value into account
local class = require 'class'
local Set = require 'pl.Set'
local List = require 'pl.List'
local tablex = require 'pl.tablex'
local DIRECTIONS = Set{'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'u', 'd'}
local NUMERIC_RELATIONS = {'size', 'x', 'y', 'z'}
local OPPOSITE_DIRECTIONS = {n='s', ne='sw', e='w', se='nw', s='n',
sw='ne', w='e', nw='se', u='d', d='u'}
local Action = class('Action')
function Action:__tostring()
return class.type(self)
end
local Get = class('Get', 'Action')
local Drop = class('Drop', 'Action')
local Create = class('Create', 'Action')
local SetProperty = class('SetProperty', 'Action')
local SetDir = class('SetDir', 'Action')
local SetPos = class('SetPos', 'Action')
local Teleport = class('Teleport', 'Action')
local Give = class('Give', 'Action')
function Create:is_valid(world, a0, a1)
if not (a0 and a0.is_god) or world.entities[a1] then
return false
else
return true
end
end
function Create:perform(world, a0, a1)
world:create_entity(a1)
end
function SetProperty:is_valid(world, actor, a0, rel, a1)
if not (actor and actor.is_god and a0 and rel) then
return false
elseif NUMERIC_RELATIONS[rel] and not tonumber(a1) then
return false
else
return true
end
end
function SetProperty:perform(world, actor, a0, rel, a1)
a1 = a1 or true
a1 = tonumber(a1) or a1
if rel == 'is_in' then
if a0.is_in then
a0.is_in.carry = a0.is_in.carry - a0.size
end
a1.carry = a1.carry + a0.size
end
a0[rel] = a1
end
function SetProperty:update_knowledge(world, knowledge, clause,
actor, a0, rel, a1)
knowledge[a0]:set(rel, a1, clause.truth_value, Set{clause})
end
function Teleport:is_valid(world, a0, a1)
if not (a0 and a0.is_actor and a0.is_god) then
return false
elseif not (a1 and a1.is_thing) or a0.is_in == a1 then
return false
else
return true
end
end
function Teleport:perform(world, a0, a1)
if a0.is_in then
a0.is_in.carry = a0.is_in.carry - a0.size
end
a0.is_in = a1
a1.carry = a1.carry + a0.size
end
function Teleport:update_knowledge(world, knowledge, clause, a0, a1)
if clause.truth_value then
if clause.args[2] == "when" then
knowledge[a0]:set('is_in_'..string.gsub(clause.args[3],' ','-'), a1, true, Set{clause})
else
knowledge[a0]:set('is_in', a1, true, Set{clause})
end
end
end
function Get:is_valid(world, a0, a1, a2, a3)
-- We must have an actor getting something
if not (a0 and a0.is_actor and a1 and a1.is_thing) then
return false
elseif not (a1.is_gettable and a0:can_hold(a1)) then
return false
end
if a2 then
-- Get something from an object in current location.
if (a2 == 'from' and a3 and a3.is_thing) then
if a0.is_in ~= a3.is_in or a3.is_in == a0 then
return false
elseif not a1.is_in == a3 then
return false
end
elseif not (a2 == 'count' and tonumber(a3)) then
return false
end
else
-- Get something from current location.
if a0.is_in ~= a1.is_in then
return false
end
end
return true
end
function Get:perform(world, a0, a1, a2, a3)
a1.is_in = a0
a0.carry = a0.carry + a1.size
if a2 == 'from' then
a3.carry = a3.carry - a1.size
end
end
function Get:update_knowledge(world, knowledge, clause, a0, a1)
if clause.truth_value then
-- We now know the a0 is holding this a1.
knowledge[a1]:set('is_in', a0, true, Set{clause})
end
end
function Drop:is_valid(world, a0, a1)
if not (a1 and a0.is_actor and a1 and a1.is_thing) then
return false
elseif a1.is_in ~= a0 then
return false
end
return true
end
function Drop:perform(world, a0, a1)
a1.is_in = a0.is_in
a0.carry = a0.carry - a1.size
end
-- TODO What about: "John did not drop the milk." If we allow this when John is
-- actually not holding the milk, "John did not drop the milk" adds no
-- information. If we only allow negations of possible actions, this tells us
-- that John is holding the milk.
function Drop:update_knowledge(world, knowledge, clause, a0, a1)
if clause.truth_value then
if knowledge[a0] and knowledge[a0]['is_in'] then
-- The object is in the same place where the dropper is
knowledge[a1]:rawset('is_in', knowledge[a0]['is_in'], Set{clause})
else
-- We just don't know where the object is
knowledge[a1]:rawset('is_in', List())
end
end
end
function SetDir:is_valid(world, actor, a0, dir, a1)
if not (actor and actor.is_god) then
return false
elseif not (a0 and a0.is_thing and a1 and a1.is_thing) then
return false
elseif not DIRECTIONS[dir] then
return false
elseif not (a0.x and a1.x and a0.y and a1.y and a0.z and a1.z) then
return false
end
local dx = a1.x - a0.x
local dy = a1.y - a0.y
local dz = a1.z - a0.z
local good = true
for i = 1, dir:len() do
local p = dir:sub(i, i)
if p == 'n' then good = dy > 0; end
if p == 's' then good = dy < 0; end
if p == 'e' then good = dx > 0; end
if p == 'w' then good = dx < 0; end
if p == 'u' then good = dz > 0; end
if p == 'd' then good = dz < 0; end
end
return good
end
function SetDir:perform(world, actor, a0, dir, a1)
local opposite_dir = OPPOSITE_DIRECTIONS[dir]
a0[dir] = a1
a1[opposite_dir] = a0
end
function SetDir:update_knowledge(world, knowledge, clause, actor, a0, dir, a1)
if clause.truth_value then
knowledge[a0]:add(dir, a1, true, Set{clause})
knowledge[a1]:add(dir, a0, true, Set{clause})
end
end
function SetPos:is_valid(world, actor, a0, x, y, z)
if not (actor and actor.is_god and a0 and x and y) then
return false
end
return true
end
function SetPos:perform(world, actor, a0, x, y, z)
a0.x = x
a0.y = y
a0.z = z or 0
end
function SetPos:update_knowledge(world, knowledge, clause, actor, a0, x, y, z)
knowledge[a0]:set('x', x, true, Set{clause})
knowledge[a0]:set('y', y, true, Set{clause})
knowledge[a0]:set('z', z or 0, true, Set{clause})
end
function Give:is_valid(world, actor, object, recipient)
if actor.is_in ~= recipient.is_in or actor == recipient then
return false
elseif object.is_in ~= actor then
return false
else
return true
end
end
function Give:perform(world, actor, object, recipient)
object.is_in = recipient
end
function Give:update_knowledge(world, knowledge, clause,
actor, object, recipient)
knowledge[object]:set('is_in', recipient, true, Set{clause})
local current_knowledge = {}
for _, entity in ipairs{actor, recipient, object} do
if knowledge[entity]['is_in'] then
current_knowledge[entity] =
tablex.deepcopy(knowledge[entity]['is_in'])
else
current_knowledge[entity] = List()
end
end
knowledge[actor]:merge('is_in', current_knowledge[recipient], Set{clause})
knowledge[recipient]:merge('is_in', current_knowledge[actor], Set{clause})
end
return {get=Get, drop=Drop, give=Give, teleport=Teleport,
create=Create, set=SetProperty, set_dir=SetDir, set_pos=SetPos}
|
-----------------------------------
-- Area: Valkurm Dunes
-- NPC: Beastmen_s_Banner
-- !pos -116.204 4.000 -113.608 104
-----------------------------------
local ID = require("scripts/zones/Valkurm_Dunes/IDs");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
player:messageSpecial(ID.text.BEASTMEN_BANNER);
end;
function onEventUpdate(player,csid,option)
-- printf("OPTION: %u",option);
end;
function onEventFinish(player,csid,option)
-- printf("OPTION: %u",option);
end;
|
local const = require("lib.constants")
local player_settings = require("globals.player-settings")
local common = require("lib.common")
local player_data_default = {
hud_collapsed = false,
hud_size = {width = 250, height = 300},
hud_location = {x = 0, y = 0},
search_text = "",
elements = {},
settings = player_settings.default_player_settings(),
hud_combinators = {}
}
local player_data = {}
-- Returns the global object for the player with this index
-- Will create a global object if the "player_index" is not yet created
-- @param player_index The index of the player
function player_data.get_player_global(player_index)
if not player_index then
return
end
local global_player = global.players[player_index]
if not global_player then
player_data.add_player_global(player_index)
end
return global.players[player_index]
end
--#region Get Player Properties
function player_data.get_hud_collapsed(player_index)
return player_data.get_player_global(player_index).hud_collapsed
end
function player_data.get_hud_location(player_index)
return player_data.get_player_global(player_index).hud_location
end
function player_data.get_hud_size(player_index)
return player_data.get_player_global(player_index).hud_size
end
function player_data.get_hud_search_text(player_index)
return player_data.get_player_global(player_index).search_text
end
--#endregion
--#region Get HUD Helpers
function player_data.get_is_hud_top(player_index)
return player_settings.get_hud_position_setting(player_index) == const.HUD_POSITION.top
end
function player_data.get_is_hud_left(player_index)
return player_settings.get_hud_position_setting(player_index) == const.HUD_POSITION.left
end
function player_data.get_is_hud_goal(player_index)
return player_settings.get_hud_position_setting(player_index) == const.HUD_POSITION.goal
end
function player_data.get_is_hud_draggable(player_index)
return player_settings.get_hud_position_setting(player_index) == const.HUD_POSITION.draggable
end
function player_data.get_is_hud_bottom_right(player_index)
return player_settings.get_hud_position_setting(player_index) == const.HUD_POSITION.bottom_right
end
--#endregion
--#region Set Player Properties
function player_data.set_hud_location(player_index, location)
player_data.get_player_global(player_index).hud_location = location
end
function player_data.set_hud_size(player_index, size)
player_data.get_player_global(player_index).hud_size = size
end
function player_data.set_hud_collapsed(player_index, state)
player_data.get_player_global(player_index).hud_collapsed = state
end
function player_data.set_hud_search_text(player_index, text)
player_data.get_player_global(player_index).search_text = text
end
function player_data.set_hud_element_ref(player_index, key, gui_element)
player_data.get_player_global(player_index).elements[key] = gui_element
end
--#endregion
--#region
local function get_hud_combinator_data(player_index, unit_number)
local hud_combinators = player_data.get_player_global(player_index)["hud_combinators"]
local hud_combinator = hud_combinators[unit_number]
if not hud_combinator then
hud_combinators[unit_number] = {visible = true}
end
return hud_combinators[unit_number]
end
function player_data.set_hud_combinator_visibilty(player_index, unit_number, state)
get_hud_combinator_data(player_index, unit_number).visible = state
end
function player_data.get_hud_combinator_visibilty(player_index, unit_number)
return get_hud_combinator_data(player_index, unit_number).visible
end
--#endregion
--#region Add Properties
function player_data.add_player_global(player_index)
local player = common.get_player(player_index)
global.players[player_index] = player_data_default
common.debug_log(player_index, "initialize global for player" .. player.name)
end
--#endregion
--#region Remove Properties
function player_data.remove_player_global(player_index)
global.players[player_index] = nil
end
function player_data.destroy_hud_ref(player_index, key)
local player = player_data.get_player_global(player_index)
if player.elements[key] then
player.elements[key].destroy()
player.elements[key] = nil
end
end
--#endregion
--#region Get HUD References
function player_data.get_hud_ref(player_index, key)
return player_data.get_player_global(player_index).elements[key]
end
--#endregion
--#region Get HUD References
function player_data.destroy_hud(player_index)
local elements = player_data.get_player_global(player_index).elements
for key, value in pairs(elements) do
if value.valid then
value.destroy()
end
elements[key] = nil
end
local player = common.get_player(player_index)
-- Ensure we delete any remnants of stray HUD's we created
local locations = {
const.HUD_POSITION.top,
const.HUD_POSITION.left,
const.HUD_POSITION.center,
const.HUD_POSITION.goal,
const.HUD_POSITION.screen,
const.HUD_POSITION.relative
}
for _, location in pairs(locations) do
for _, child in pairs(player.gui[location].children) do
if child.name == const.HUD_NAMES.hud_root_frame then
child.destroy()
end
end
end
-- Clear all elements for the player
global.players[player_index].elements = {}
end
return player_data
|
-- モジュールとして読み込む場合は最初に空のテーブルを作成して、最後にこれをreturnする。
local stage = {}
-- framesに指定されたフレーム数だけ待つ。
local function Wait(frames)
for i = 1, frames do
coroutine.yield()
end
end
-- フレーム数frames毎にenemyオブジェクトから自機狙い弾を生成する。
local function ShootPer(id, frames, enemy)
local MaxFrames = 120
for i = 0, MaxFrames do
if i % frames == 0 then
GenerateBullet(id, enemy, 4,
math.pi / 2 - math.atan(GetPlayer().PosX - enemy.PosX, GetPlayer().PosY - enemy.PosY))
end
coroutine.yield()
end
end
-- 始めは真っ直ぐに進み、途中で横に曲がる敵。途中で自機狙い弾を発射。
-- id: 敵のID; initPosX: 初期位置; speed: 速さ; radius: 曲がる際に描く円の半径; dir: 曲がる方向(正負); delay: ショットの間隔.
local function Curve(id, initPosX, speed, radius, dir, delay)
dir = dir / math.abs(dir)
local angle = math.pi / 2
local enemy = GenerateEnemy(id, initPosX, 0, speed, angle, 8)
coroutine.yield()
if id == EnemyID.SmallRed then
StartCoroutine(ShootPer, BulletID.TinyRed, delay, enemy)
elseif id == EnemyID.SmallBlue then
StartCoroutine(ShootPer, BulletID.TinyBlue, delay, enemy)
end
Wait(120)
-- 1フレームで進む長さ=speed。これと円の半径を二辺とする二等辺三角形に対して、余弦定理を適用する。
local diffAngle = math.acos(1.0 - 0.5 * speed ^ 2 / radius ^ 2)
angle = angle - dir * diffAngle / 2 -- 曲がり始めはキャラの初期角度も考慮する。
repeat
enemy.Angle = angle
angle = angle - dir * diffAngle -- 曲がっている途中は正確にこの値だけずれてゆく。
coroutine.yield()
until (dir >= 0) and (angle < 0.0) or (angle > math.pi) -- 三項演算子
end
-- 真っ直ぐ降りてきて、全方位弾を発射してから引き返す敵。
-- initPosX: 初期位置; ways: 弾数.
local function AllDirection(initPosX, ways)
local enemyColor = (ways % 2 == 0) and EnemyID.SmallBlue or EnemyID.SmallRed -- 偶数弾なら青、奇数弾なら赤。
local bulletColor = (ways % 2 == 0) and BulletID.SmallBlue or BulletID.SmallRed
local enemy = GenerateEnemy(enemyColor, initPosX, 0, 1.5, math.pi / 2, 24)
Wait(100)
enemy.Speed = 0
Wait(5)
local diffAngle = 2 * math.pi / ways
local startingAngle = 0
if ways % 2 == 0 then
-- 自機の方向から diffAngle / 2 だけずれた方向。
startingAngle = math.pi / 2 - math.atan(GetPlayer().PosX - enemy.PosX, GetPlayer().PosY - enemy.PosY) - diffAngle / 2
else
-- 自機の方向
startingAngle = math.pi / 2 - math.atan(GetPlayer().PosX - enemy.PosX, GetPlayer().PosY - enemy.PosY)
end
for i = 0, ways - 1 do
GenerateBullet(bulletColor, enemy, 1, startingAngle + i * diffAngle)
end
Wait(15)
local dir = (initPosX < ScreenWidth / 2) and 1 or -1 -- 初期位置が左寄りなら右向きに、右寄りなら左向きに進む。
enemy.Speed = 3
for i = 0, 5 do
enemy.Angle = math.pi / 2 - dir * i * math.pi / 6
Wait(3)
end
end
-- 『東方紅魔郷』1面前半道中の大雑把な再現。ただし、4番目の編隊はランダムなので、原作とは異なる。
function stage:Start()
Wait(120)
for i = 1, 5 do -- 5体生成する。
StartCoroutine(Curve, EnemyID.SmallBlue, ScreenWidth / 4, 2, 30, 1, 30)
Wait(15)
end
Wait(120)
for i = 1, 5 do
StartCoroutine(Curve, EnemyID.SmallRed, ScreenWidth * 3 / 4, 2, 30, -1, 30)
Wait(15)
end
Wait(120)
for i = 1, 9 do
StartCoroutine(Curve, EnemyID.SmallBlue, ScreenWidth / 2 - 20 * (10 - i) , 2, 30, -1, 120)
StartCoroutine(Curve, EnemyID.SmallBlue, ScreenWidth / 2 + 20 * (10 - i) , 2, 30, 1, 120)
Wait(15)
end
Wait(120)
for i = 1, 15 do
StartCoroutine(AllDirection, math.random(ScreenWidth / 5, ScreenWidth * 4 / 5), (i % 2 == 0) and (20) or (19))
Wait(90)
end
Wait(10)
for i = 1, 5 do
local id = (i % 2 == 1) and EnemyID.SmallBlue or EnemyID.SmallRed
StartCoroutine(Curve, id, ScreenWidth * 3 / 4 - 15, 2, 30, -1, 60)
StartCoroutine(Curve, id, ScreenWidth * 3 / 4 + 15, 2, 60, -1, 60)
Wait(15)
end
Wait(120)
for i = 1, 5 do
local id = (i % 2 == 1) and EnemyID.SmallRed or EnemyID.SmallBlue
StartCoroutine(Curve, id, ScreenWidth / 4 - 15, 2, 60, 1, 60)
StartCoroutine(Curve, id, ScreenWidth / 4 + 15, 2, 30, 1, 60)
Wait(15)
end
Wait(370)
end
return stage
|
data.raw.character["character"].inventory_size = 100
data.raw.character["character"].light = {{minimum_darkness = 0.3, intensity = 0.9, size = 40}}
|
---------------------------------------------------------------------------------
--
-- Prat - A framework for World of Warcraft chat mods
--
-- Copyright (C) 2006-2018 Prat Development Team
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; either version 2
-- of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to:
--
-- Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor,
-- Boston, MA 02110-1301, USA.
--
--
-------------------------------------------------------------------------------
Prat:AddModuleToLoad(function()
local Prat = Prat
local PRAT_MODULE = Prat:RequestModuleName("Frames")
if PRAT_MODULE == nil then
return
end
local mod = Prat:NewModule(PRAT_MODULE, "AceHook-3.0")
local PL = mod.PL
--[===[@debug@
PL:AddLocale(PRAT_MODULE, "enUS", {
["Frames"] = true,
["Chat window frame parameter options"] = true,
["removeclamp_name"] = "Zero Clamp Size",
["removeclamp_desc"] = "Allow the chatframe to be moved flush with the edge of the screen",
["minchatwidth_name"] = "Set Minimum Width",
["minchatwidth_desc"] = "Sets the minimum width for all chat windows.",
["maxchatwidth_name"] = "Set Maximum Width",
["maxchatwidth_desc"] = "Sets the maximum width for all chat windows.",
["minchatheight_name"] = "Set Minimum Height",
["minchatheight_desc"] = "Sets the minimum height for all chat windows.",
["maxchatheight_name"] = "Set Maximum Height",
["maxchatheight_desc"] = "Sets the maximum height for all chat windows.",
["mainchatonload_name"] = "Force Main Chat Frame On Load",
["mainchatonload_desc"] = "Automatically select the first chat frame and make it active on load.",
["framealpha_name"] = "Set Chatframe Alpha",
["framealpha_desc"] = "Conrols the transparency of the chatframe when you hover over it with your mouse.",
["rememberframepositions_name"] = "Remember Positions",
["rememberframepositions_desc"] = "Remember the chatframe positions, and restore them on load"
} )
--@end-debug@]===]
-- These Localizations are auto-generated. To help with localization
-- please go to http://www.wowace.com/projects/prat-3-0/localization/
--@non-debug@
do
local L
L=
{
["Frames"] = {
["Chat window frame parameter options"] = true,
["framealpha_desc"] = "Conrols the transparency of the chatframe when you hover over it with your mouse.",
["framealpha_name"] = "Set Chatframe Alpha",
["Frames"] = true,
["mainchatonload_desc"] = "Automatically select the first chat frame and make it active on load.",
["mainchatonload_name"] = "Force Main Chat Frame On Load",
["maxchatheight_desc"] = "Sets the maximum height for all chat windows.",
["maxchatheight_name"] = "Set Maximum Height",
["maxchatwidth_desc"] = "Sets the maximum width for all chat windows.",
["maxchatwidth_name"] = "Set Maximum Width",
["minchatheight_desc"] = "Sets the minimum height for all chat windows.",
["minchatheight_name"] = "Set Minimum Height",
["minchatwidth_desc"] = "Sets the minimum width for all chat windows.",
["minchatwidth_name"] = "Set Minimum Width",
["rememberframepositions_desc"] = "Remember the chatframe positions, and restore them on load",
["rememberframepositions_name"] = "Remember Positions",
["removeclamp_desc"] = "Allow the chatframe to be moved flush with the edge of the screen",
["removeclamp_name"] = "Zero Clamp Size",
}
}
PL:AddLocale(PRAT_MODULE, "enUS", L)
L=
{
["Frames"] = {
--[[Translation missing --]]
--[[ ["Chat window frame parameter options"] = "",--]]
--[[Translation missing --]]
--[[ ["framealpha_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["framealpha_name"] = "",--]]
--[[Translation missing --]]
--[[ ["Frames"] = "",--]]
--[[Translation missing --]]
--[[ ["mainchatonload_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["mainchatonload_name"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatheight_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatheight_name"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatwidth_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatwidth_name"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatheight_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatheight_name"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatwidth_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatwidth_name"] = "",--]]
--[[Translation missing --]]
--[[ ["rememberframepositions_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["rememberframepositions_name"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_name"] = "",--]]
}
}
PL:AddLocale(PRAT_MODULE, "itIT", L)
L=
{
["Frames"] = {
--[[Translation missing --]]
--[[ ["Chat window frame parameter options"] = "",--]]
--[[Translation missing --]]
--[[ ["framealpha_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["framealpha_name"] = "",--]]
--[[Translation missing --]]
--[[ ["Frames"] = "",--]]
--[[Translation missing --]]
--[[ ["mainchatonload_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["mainchatonload_name"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatheight_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatheight_name"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatwidth_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatwidth_name"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatheight_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatheight_name"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatwidth_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatwidth_name"] = "",--]]
--[[Translation missing --]]
--[[ ["rememberframepositions_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["rememberframepositions_name"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_name"] = "",--]]
}
}
PL:AddLocale(PRAT_MODULE, "ptBR", L)
L=
{
["Frames"] = {
["Chat window frame parameter options"] = "Options de la fenêtre de discussion",
["framealpha_desc"] = "Définit la transparence de la fenêtre de discussion quand la souris passe par dessus.",
["framealpha_name"] = "Transparence",
["Frames"] = "Fenêtre",
["mainchatonload_desc"] = "Sélectionne automatiquement la première fenêtre de discussion et la rend active lors du chargement.",
--[[Translation missing --]]
--[[ ["mainchatonload_name"] = "",--]]
["maxchatheight_desc"] = "Définit la hauteur maximale pour toutes les fenêtres de discussion.",
["maxchatheight_name"] = "Hauteur maximale",
["maxchatwidth_desc"] = "Définit la largeur maximale pour toutes les fenêtres de discussion.",
["maxchatwidth_name"] = "Largeur maximale",
["minchatheight_desc"] = "Définit la hauteur minimum pour toutes les fenêtres de discussion.",
["minchatheight_name"] = "Hauteur minimum",
["minchatwidth_desc"] = "Définit la largeur minimum pour toutes les fenêtres de discussion.",
["minchatwidth_name"] = "Largeur minimum",
--[[Translation missing --]]
--[[ ["rememberframepositions_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["rememberframepositions_name"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_name"] = "",--]]
}
}
PL:AddLocale(PRAT_MODULE, "frFR", L)
L=
{
["Frames"] = {
["Chat window frame parameter options"] = "Optionen für Parameter des Chatfenster-Rahmens",
["framealpha_desc"] = "Steuert die Transparenz des Chatfensters, wenn du die Maus darüberlegst.",
["framealpha_name"] = "Transparenz für Chatfenster einstellen",
["Frames"] = "Fenster",
["mainchatonload_desc"] = "Automatisch das erste Chatfenster auswählen und beim Laden aktivieren.",
["mainchatonload_name"] = "Haupt-Chatfenster beim Laden erzwingen",
["maxchatheight_desc"] = "Die maximale Höhe für alle alle Chatfenster einstellen.",
["maxchatheight_name"] = "Maximale Höhe einstellen",
["maxchatwidth_desc"] = "Die maximale Breite für alle Chatfenster einstellen.",
["maxchatwidth_name"] = "Maximale Breite einstellen.",
["minchatheight_desc"] = "Die minimale Höhe für alle Chatfenster einstellen.",
["minchatheight_name"] = "Minimale Höhe einstellen",
["minchatwidth_desc"] = "Die minimale Breite für alle Chatfenster einstellen.",
["minchatwidth_name"] = "Minimale Breite einstellen.",
["rememberframepositions_desc"] = "Die Positionen des Chatfensters merken und diese beim Laden wiederherstellen",
["rememberframepositions_name"] = "Positionen merken",
["removeclamp_desc"] = "Das Verschieben des Chatfensters bündig zur Bildschirmkante zulassen",
["removeclamp_name"] = "Klammergröße Null",
}
}
PL:AddLocale(PRAT_MODULE, "deDE", L)
L=
{
["Frames"] = {
["Chat window frame parameter options"] = "대화창 프레임 한도 옵션",
["framealpha_desc"] = "마우스를 올렸을 때 대화창의 투명도를 조절합니다.",
["framealpha_name"] = "대화창 투명도 설정",
["Frames"] = "대화창",
["mainchatonload_desc"] = "첫번째 대화창을 자동으로 선택하고 로드 시에 활성화 시킵니다.",
["mainchatonload_name"] = "로드 시 주 대화창 강제 설정",
["maxchatheight_desc"] = "모든 대화창의 최대 높이를 설정합니다.",
["maxchatheight_name"] = "최대 높이 설정",
["maxchatwidth_desc"] = "모든 대화창의 최대 너비를 설정합니다.",
["maxchatwidth_name"] = "최대 너비 설정",
["minchatheight_desc"] = "모든 대화창의 최소 높이를 설정합니다.",
["minchatheight_name"] = "최소 높이 설정",
["minchatwidth_desc"] = "모든 대화창의 최소 너비를 설정합니다.",
["minchatwidth_name"] = "최소 너비 설정",
["rememberframepositions_desc"] = "대화창 위치를 기억하고 로드 시마다 불러옵니다",
["rememberframepositions_name"] = "위치 기억",
["removeclamp_desc"] = "대화창이 화면 밖으로 나가지 않도록 방지합니다.",
["removeclamp_name"] = "Zero 고정 크기",
}
}
PL:AddLocale(PRAT_MODULE, "koKR", L)
L=
{
["Frames"] = {
--[[Translation missing --]]
--[[ ["Chat window frame parameter options"] = "",--]]
--[[Translation missing --]]
--[[ ["framealpha_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["framealpha_name"] = "",--]]
--[[Translation missing --]]
--[[ ["Frames"] = "",--]]
--[[Translation missing --]]
--[[ ["mainchatonload_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["mainchatonload_name"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatheight_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatheight_name"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatwidth_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatwidth_name"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatheight_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatheight_name"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatwidth_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatwidth_name"] = "",--]]
--[[Translation missing --]]
--[[ ["rememberframepositions_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["rememberframepositions_name"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_name"] = "",--]]
}
}
PL:AddLocale(PRAT_MODULE, "esMX", L)
L=
{
["Frames"] = {
["Chat window frame parameter options"] = "Параметры окна чата",
["framealpha_desc"] = "Настройка прозрачности окна чата при наведении на него курсора мыши.",
["framealpha_name"] = "Прозрачность окна чата",
["Frames"] = "Фреймы",
["mainchatonload_desc"] = "Автоматически выбирает первое окно чата, и делает его активным при загрузке.",
["mainchatonload_name"] = "Задействовать главное окно чата при загрузке",
["maxchatheight_desc"] = "Устанавливает максимальную высоту для всех окон чата.",
["maxchatheight_name"] = "Максимальная высоты",
["maxchatwidth_desc"] = "Устанавливает максимальную ширину для всех окон чата.",
["maxchatwidth_name"] = "Максимальная ширина",
["minchatheight_desc"] = "Устанавливает минимальную высоту для всех окон чата.",
["minchatheight_name"] = "Минимальная высоты",
["minchatwidth_desc"] = "Устанавливает минимальную ширину для всех окон чата.",
["minchatwidth_name"] = "Минимальная ширина",
["rememberframepositions_desc"] = "Запомнить положение окна чата и восстановить при загрузке",
["rememberframepositions_name"] = "Запомнить положение",
["removeclamp_desc"] = "Позволить окну чата прижиматься вплотную к краю экрана",
["removeclamp_name"] = "Вплотную к краю экрана",
}
}
PL:AddLocale(PRAT_MODULE, "ruRU", L)
L=
{
["Frames"] = {
["Chat window frame parameter options"] = "聊天窗口参数选项",
["framealpha_desc"] = "控制鼠标移过时聊天框架的透明度.",
["framealpha_name"] = "设定聊天框架透明度",
["Frames"] = "框架",
["mainchatonload_desc"] = "加载时自动选择并激活第1个聊天框架.",
["mainchatonload_name"] = "加载时焦点于主聊天框架.",
["maxchatheight_desc"] = "设定所有聊天窗口的最大高度.",
["maxchatheight_name"] = "设定最大高度",
["maxchatwidth_desc"] = "设定所有聊天窗口的最大宽度.",
["maxchatwidth_name"] = "设定最大宽度",
["minchatheight_desc"] = "设定所有聊天窗口的最小高度.",
["minchatheight_name"] = "设定最小高度.",
["minchatwidth_desc"] = "设定所有聊天窗口的最小宽度.",
["minchatwidth_name"] = "设定最小宽度.",
["rememberframepositions_desc"] = "记住聊天框的位置,在加载时恢复.",
["rememberframepositions_name"] = "记住位置",
["removeclamp_desc"] = "允许聊天框架移动至屏幕边缘齐平",
--[[Translation missing --]]
--[[ ["removeclamp_name"] = "",--]]
}
}
PL:AddLocale(PRAT_MODULE, "zhCN", L)
L=
{
["Frames"] = {
--[[Translation missing --]]
--[[ ["Chat window frame parameter options"] = "",--]]
--[[Translation missing --]]
--[[ ["framealpha_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["framealpha_name"] = "",--]]
--[[Translation missing --]]
--[[ ["Frames"] = "",--]]
--[[Translation missing --]]
--[[ ["mainchatonload_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["mainchatonload_name"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatheight_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatheight_name"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatwidth_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["maxchatwidth_name"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatheight_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatheight_name"] = "",--]]
--[[Translation missing --]]
--[[ ["minchatwidth_desc"] = "",--]]
["minchatwidth_name"] = "Establecer ancho mínimo",
--[[Translation missing --]]
--[[ ["rememberframepositions_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["rememberframepositions_name"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_name"] = "",--]]
}
}
PL:AddLocale(PRAT_MODULE, "esES", L)
L=
{
["Frames"] = {
["Chat window frame parameter options"] = "聊天視窗框架參數選項",
--[[Translation missing --]]
--[[ ["framealpha_desc"] = "",--]]
["framealpha_name"] = "設定聊天欄透明度",
["Frames"] = "框架",
--[[Translation missing --]]
--[[ ["mainchatonload_desc"] = "",--]]
["mainchatonload_name"] = "強制主聊天框在載入",
["maxchatheight_desc"] = "設定最大高度全部聊天視窗。",
["maxchatheight_name"] = "設定最大高度",
["maxchatwidth_desc"] = "設定最大寬度全部聊天視窗。",
["maxchatwidth_name"] = "設定最大寬度",
["minchatheight_desc"] = "設定對話視窗最小高度",
["minchatheight_name"] = "設定最小高度",
["minchatwidth_desc"] = "設定對話視窗最小寬度",
["minchatwidth_name"] = "設定最小寬度",
--[[Translation missing --]]
--[[ ["rememberframepositions_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["rememberframepositions_name"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_desc"] = "",--]]
--[[Translation missing --]]
--[[ ["removeclamp_name"] = "",--]]
}
}
PL:AddLocale(PRAT_MODULE, "zhTW", L)
end
--@end-non-debug@
-- We have to set the insets here before blizzard has a chance to move them
for i = 1, NUM_CHAT_WINDOWS do
local f = _G["ChatFrame" .. i]
f:SetClampRectInsets(0, 0, 0, 0)
end
Prat:SetModuleDefaults(mod.name, {
profile = {
on = true,
minchatwidth = 160,
minchatwidthdefault = 160,
maxchatwidth = 800,
maxchatwidthdefault = 800,
minchatheight = 120,
minchatheightdefault = 120,
maxchatheight = 600,
maxchatheightdefault = 600,
mainchatonload = true,
framealpha = DEFAULT_CHATFRAME_ALPHA,
removeclamp = true,
rememberframepositions = false,
framemetrics = {
['*'] = {
width = 430,
height = 120,
}
}
}
})
do
local frameoption = {
name = function(info) return PL[info[#info].."_name"] end,
desc = function(info) return PL[info[#info].."_desc"] end,
type="range", min=25, max=1024, step=1
}
Prat:SetModuleOptions(mod.name, {
name = PL["Frames"],
desc = PL["Chat window frame parameter options"],
type = "group",
args = {
minchatwidth = frameoption,
maxchatwidth = frameoption,
minchatheight = frameoption,
maxchatheight = frameoption,
removeclamp = {
type = "toggle",
order = 110,
name = PL["removeclamp_name"],
desc = PL["removeclamp_desc"],
},
framealpha = {
order = 115,
name = PL["framealpha_name"],
desc = PL["framealpha_desc"],
type="range", min=0.0, max=1.0, step=.01, order=190,
},
rememberframepositions = {
type = "toggle",
order = 120,
name = PL.rememberframepositions_name,
desc = PL.rememberframepositions_desc,
}
}
}
)
end
--[[------------------------------------------------
Module Event Functions
------------------------------------------------]]--
Prat:SetModuleInit(mod, function(self) mod:GetDefaults() end)
function mod:OnModuleEnable()
CHAT_FRAME_BUTTON_FRAME_MIN_ALPHA = 0
self:ConfigureAllChatFrames(true)
self:RawHook("FCF_DockFrame", true)
if (self.db.profile.rememberframepositions) then
self:RawHook('SetChatWindowSavedPosition', true)
self:RawHook('GetChatWindowSavedPosition', true)
self:RawHook('SetChatWindowSavedDimensions', true)
self:RawHook('GetChatWindowSavedDimensions', true)
self:UpdateFrameMetrics()
end
end
function mod:OnModuleDisable()
CHAT_FRAME_BUTTON_FRAME_MIN_ALPHA = 0.2
self:ConfigureAllChatFrames(false)
if (self.db.profile.rememberframepositions) then
self:Unhook('SetChatWindowSavedPosition')
self:Unhook('GetChatWindowSavedPosition')
self:Unhook('SetChatWindowSavedDimensions')
self:Unhook('GetChatWindowSavedDimensions')
self:UpdateFrameMetrics()
end
end
function mod:GetDescription()
return PL["Chat window frame parameter options"]
end
function mod:FCF_DockFrame(frame, ...)
if self.db.profile.removeclamp then
frame:SetClampRectInsets(0,0,0,0)
end
Prat.Frames[frame:GetName()] = frame
local m = Prat.Addon:GetModule("Font", true)
if m then m:ConfigureAllChatFrames() end
return self.hooks["FCF_DockFrame"](frame, ...)
end
--[[------------------------------------------------
Core Functions
------------------------------------------------]]--
-- make ChatFrame1 the selected chat frame
function mod:AceEvent_FullyInitialized()
if self.db.profile.mainchatonload then
FCF_SelectDockFrame(ChatFrame1)
end
end
-- set parameters for each chatframe
function mod:ConfigureAllChatFrames(enabled)
for _,v in pairs(Prat.Frames) do
self:SetParameters(v, enabled)
end
DEFAULT_CHATFRAME_ALPHA = self.db.profile.framealpha
end
-- get the defaults for chat frame1 max/min width/height for use when disabling the module
function mod:GetDefaults()
local cf = _G["ChatFrame1"]
local prof = self.db.profile
local minwidthdefault, minheightdefault = cf:GetMinResize()
local maxwidthdefault, maxheightdefault = cf:GetMaxResize()
prof.minchatwidthdefault = minwidthdefault
prof.maxchatwidthdefault = maxwidthdefault
prof.minchatheightdefault = minheightdefault
prof.maxchatheightdefault = maxheightdefault
prof.initialized = true
end
-- set the max/min width/height for a chatframe
function mod:SetParameters(cf, enabled)
local prof = self.db.profile
if enabled then
cf:SetMinResize(prof.minchatwidth, prof.minchatheight)
cf:SetMaxResize(prof.maxchatwidth, prof.maxchatheight)
if prof.removeclamp then
cf:SetClampRectInsets(0,0,0,0)
end
else
cf:SetMinResize(prof.minchatwidthdefault, prof.minchatheightdefault)
cf:SetMaxResize(prof.maxchatwidthdefault, prof.maxchatheightdefault)
end
end
function mod:OnValueChanged()
self:ConfigureAllChatFrames(true)
if (self.db.profile.rememberframepositions) then
self:RawHook('SetChatWindowSavedPosition', true)
self:RawHook('GetChatWindowSavedPosition', true)
self:RawHook('SetChatWindowSavedDimensions', true)
self:RawHook('GetChatWindowSavedDimensions', true)
self:UpdateFrameMetrics()
else
self:Unhook('SetChatWindowSavedPosition')
self:Unhook('GetChatWindowSavedPosition')
self:Unhook('SetChatWindowSavedDimensions')
self:Unhook('GetChatWindowSavedDimensions')
self:UpdateFrameMetrics()
end
end
-- Frame position saving feature credit to Chatter
function mod:SetChatWindowSavedPosition(id, point, xOffset, yOffset)
local data = self.db.profile.framemetrics[id]
data.point, data.xOffset, data.yOffset = point, xOffset, yOffset
end
function mod:GetChatWindowSavedPosition(id)
local data = self.db.profile.framemetrics[id]
if not data.point then
data.point, data.xOffset, data.yOffset = self.hooks.GetChatWindowSavedPosition(id)
end
return data.point, data.xOffset, data.yOffset
end
function mod:SetChatWindowSavedDimensions(id, width, height)
local data = self.db.profile.framemetrics[id]
data.width, data.height = width, height
end
function mod:GetChatWindowSavedDimensions(id)
local data = self.db.profile.framemetrics[id]
if not data.width then
data.width, data.height = self.hooks.GetChatWindowSavedDimensions(id)
end
return data.width, data.height
end
function mod:UpdateFrameMetrics()
for i = 1,NUM_CHAT_WINDOWS do
local frame = _G["ChatFrame"..i]
if frame and type(frame.GetID) == "function" then
FloatingChatFrame_Update(frame:GetID())
end
end
end
return
end ) -- Prat:AddModuleToLoad
|
ITEM.name = "Семена помидора"
ITEM.model = "models/items/jewels/purses/big_purse.mdl"
ITEM.width = 1
ITEM.height = 1
ITEM.desc = "Небольшой мешочек с семенами помидора."
ITEM.PlantModel = "models/aoc_trees/aoc_lowveg19.mdl"
ITEM.BadGathering = {"seed_tomato"}
ITEM.CommonGathering = {"seed_tomato","tomato"}
ITEM.MasterGathering = {"seed_tomato","seed_tomato","tomato"}
|
-- ==================
-- LunarVim built-in
-- ==================
--
-- Dasboard
require("plugins.dashboard").config()
-- Lualine
require("plugins.lualine").config()
-- Nvim-tree
require("plugins.nvim-tree").config()
-- Debug (DAP)
require("plugins.dap").config()
-- Treesitter
require("plugins.treesitter").config()
-- Barbar
require("plugins.barbar").config()
--
-- ==================
-- Additional plugins
-- ==================
--
lvim.plugins = {
--
-- Debug
--
{
"puremourning/vimspector",
config = function()
require("plugins.vimspector").config()
end,
},
--
-- Diagnostics
--
{
"folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("plugins.trouble").config()
end,
event = "BufWinEnter",
},
{
"ray-x/lsp_signature.nvim",
config = function()
require("lsp_signature").setup()
end,
event = "InsertEnter",
},
--
-- Git
--
{
"ruifm/gitlinker.nvim",
event = "BufRead",
config = function()
require("plugins.gitlinker").config()
end,
requires = "nvim-lua/plenary.nvim",
},
--
-- Movement
--
{
"phaazon/hop.nvim",
config = function()
require("plugins.hop").config()
end,
event = "BufRead",
},
{
"ThePrimeagen/harpoon",
config = function()
require("plugins.harpoon").config()
end,
event = "BufWinEnter",
requires = { "nvim-lua/plenary.nvim", "nvim-lua/popup.nvim" },
},
--
-- Productivity
--
{
"folke/zen-mode.nvim",
config = function()
require("plugins.zen-mode").config()
end,
event = "BufRead",
},
{
"folke/twilight.nvim",
config = function()
require("plugins.twilight").config()
end,
event = "BufRead",
},
--
-- Telescope
--
{
"nvim-telescope/telescope-fzy-native.nvim",
},
{
"nvim-telescope/telescope-dap.nvim",
config = function()
if not lvim.builtin.dap.active then
return
end
require("telescope").load_extension "dap"
end,
event = "BufWinEnter",
after = "telescope.nvim",
},
--
-- Themes
--
{
"andersevenrud/nordic.nvim",
config = function()
require("themes.nordic").config()
end,
},
--[[
{
"shaunsingh/nord.nvim",
config = function()
require("themes.nord").config()
end,
},
{
"folke/tokyonight.nvim",
config = function()
require("themes.tokyonight").config()
end,
},
{
"rafamadriz/neon",
config = function()
require("themes.neon").config()
end,
},
{
"sainnhe/sonokai",
config = function()
require("themes.sonokai").config()
end,
},
{
"rmehri01/onenord.nvim",
config = function()
require("themes.onenord").config()
end,
},
--]]
--
-- Treesitter
--
{
"windwp/nvim-ts-autotag",
event = "InsertEnter",
},
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
},
{
"PasiBergman/cmp-nuget",
event = "BufWinEnter",
config = function()
local is_ok, cmp_nuget = pcall(require, "cmp-nuget")
if not is_ok then
vim.notify "cmp-nuget could not be loaded"
else
cmp_nuget.setup()
table.insert(lvim.builtin.cmp.sources, { name = "nuget" })
end
end,
},
}
|
local StaticObjectsProperties = require("app.properties.StaticObjectsProperties")
local StaticObject = require("app.map.StaticObject")
local MapConstants = require("app.map.MapConstants")
local EditorConstants = require("editor.EditorConstants")
local ToolBase = require("editor.ToolBase")
local ObjectTool = class("ObjectTool", ToolBase)
ObjectTool.TOOLBOX_PADDING = 98
ObjectTool.TOOLBOX_ICON_SIZE = 96
ObjectTool.TOOLBOX_MAX_COLUMNS = 8
ObjectTool.TOOLBOX_ZORDER = 20000
ObjectTool.BREAK_BINDING_DIST = 20
function ObjectTool:ctor(toolbar, map)
ObjectTool.super.ctor(self, "ObjectTool", toolbar, map)
self.currentObject_ = nil
self.currentObjectBindingPathId_ = nil
self.drag_ = nil
self.bindLabel_ = nil
self.buttons = {
{
name = "CreateObject",
image = "#CreateObjectButton.png",
imageSelected = "#CreateObjectButtonSelected.png",
},
{
name = "SelectObject",
image = "#SelectObjectButton.png",
imageSelected = "#SelectObjectButtonSelected.png",
},
{
name = "RemoveObject",
image = "#RemoveObjectButton.png",
imageSelected = "#RemoveObjectButtonSelected.png",
},
{
name = "BindObjectToPath",
image = "#BindObjectToPathButton.png",
imageSelected = "#BindObjectToPathButtonSelected.png",
imageDisabled = "#BindObjectToPathButtonDisabled.png",
},
}
self.toolbar_:addEventListener("UPDATE_OBJECT", function(event)
self:setMoreButtonsEnabled(true)
end)
end
function ObjectTool:selected(selectedButtonName)
ObjectTool.super.selected(self, selectedButtonName)
if selectedButtonName == "BindObjectToPath" then
self.currentObject_:updateView()
self:createObjectBindingLabel("选择要绑定的路径点", "static")
else
self:removeObjectBindingLabel()
if selectedButtonName == "CreateObject" or selectedButtonName == "RemoveObject" then
self:setCurrentObject()
end
end
self:removeToolbox()
end
function ObjectTool:unselected()
self:setCurrentObject()
self:removeToolbox()
end
function ObjectTool:setMoreButtonsEnabled(isEnabled)
if isEnabled and self.currentObject_ and self.currentObject_:hasBehavior("MovableBehavior") then
self.buttons[4].sprite:setButtonEnabled(true)
else
self.buttons[4].sprite:setButtonEnabled(false)
end
end
function ObjectTool:removeToolbox()
if self.toolbox_ then
self.toolbox_:removeSelf()
self.toolbox_ = nil
end
end
function ObjectTool:setCurrentObject(object)
if self.currentObject_ and self.currentObject_ ~= object then
self.currentObject_:setSelected(false)
self.currentObject_:updateView()
self.toolbar_:dispatchEvent({name = "UNSELECT_OBJECT"})
end
self.currentObject_ = object
self.currentObjectResize_ = nil
if object then
object:setSelected(true)
object:updateView()
self:setMoreButtonsEnabled(true)
self.toolbar_:dispatchEvent({name = "SELECT_OBJECT", object = object})
else
self:setMoreButtonsEnabled(false)
end
end
function ObjectTool:createObjectBindingLabel(text, isStaticLabel)
self:removeObjectBindingLabel()
local x, y = self.currentObject_:getPosition()
local label = cc.ui.UILabel.new({
text = text,
size = 20,
align = cc.ui.TEXT_ALIGN_CENTER,
color = cc.c3b(255, 100, 100),
x = labelX,
y = labelY,
}):align(display.CENTER)
label:enableOutline(cc.c4b(255, 255, 255, 255), 2)
label:setPosition(x, y + 100)
self.map_:getDebugLayer():addChild(label, EditorConstants.BINDING_LABEL_ZORDER)
if not isStaticLabel then
transition.moveBy(label, {y = 10, time = 0.5})
transition.fadeOut(label, {time = 0.5, delay = 1.7, onComplete = function()
label:removeSelf()
end})
else
self.bindLabel_ = label
end
end
function ObjectTool:removeObjectBindingLabel()
if self.bindLabel_ then
self.bindLabel_:removeSelf()
self.bindLabel_ = nil
end
end
function ObjectTool:onTouchCreateObject(event, x, y)
if event == "began" then
if not self.toolbox_ then
self:removeToolbox()
self:showToolbox(x, y)
return false
else
local object = self.toolbox_:checkPoint(x, y)
if object then
self:setCurrentObject(object)
self:removeToolbox()
self.toolbar_:selectButton("ObjectTool", 2)
return false
end
return ObjectTool.TOUCH_IGNORED
end
end
end
function ObjectTool:onTouchSelectObject(event, x, y)
if event == "began" then
for id, object in pairs(self.map_:getAllObjects()) do
local classId = object:getClassId()
if (classId == "static" or classId == "entity") and object:checkPointIn(x, y) then
local isDragBegin = self.currentObject_ == object
self:setCurrentObject(object)
self.currentObjectBindingPathId_ = nil
if object:hasBehavior("MovableBehavior") then
self.currentObjectBindingPathId_ = object:getBindingPathId()
end
local objectX, objectY = object:getPosition()
self.drag_ = {
startX = objectX,
startY = objectY,
offsetX = objectX - x,
offsetY = objectY - y
}
self.map_:setAllObjectsZOrder()
return isDragBegin
end
end
return ObjectTool.TOUCH_IGNORED
elseif event == "moved" then
local nx, ny = x + self.drag_.offsetX, y + self.drag_.offsetY
if self.currentObject_:hasBehavior("MovableBehavior") and self.currentObjectBindingPathId_ then
local path = self.map_:getObject(self.currentObjectBindingPathId_)
local pointIndex = path:checkPointAtPoint(nx, ny, ObjectTool.BREAK_BINDING_DIST)
if pointIndex then
self.currentObject_:bindPath(path, pointIndex)
else
self.currentObject_:unbindPath()
self.currentObject_:setPosition(nx, ny)
end
else
self.currentObject_:setPosition(nx, ny)
end
self.currentObject_:updateView()
self.map_:setAllObjectsZOrder()
else
self.toolbar_:dispatchEvent({name = "UPDATE_OBJECT", object = self.currentObject_})
if self.currentObjectBindingPathId_ and not self.currentObject_:isBinding() then
self:createObjectBindingLabel("对象已经解除绑定")
end
self.currentObjectBindingPathId_ = nil
end
end
function ObjectTool:onTouchRemoveObject(event, x, y)
if event == "began" then
for id, object in pairs(self.map_:getAllObjects()) do
local classId = object:getClassId()
if (classId == "static" or classId == "entity") and object:checkPointIn(x, y) then
self:setCurrentObject()
self.map_:removeObject(object)
return false
end
end
return ObjectTool.TOUCH_IGNORED
end
end
function ObjectTool:onTouchBindObjectToPath(event, x, y)
if event == "began" then
for id, path in pairs(self.map_:getObjectsByClassId("path")) do
local index = path:checkPointAtPoint(x, y, EditorConstants.CHECK_POINT_DIST)
if index then
-- 连接对象到指定路径
self.currentObject_:bindPath(path, index)
self:setCurrentObject(self.currentObject_)
self.toolbar_:selectButton("ObjectTool", 2)
self:createObjectBindingLabel("对象已经绑定到路径")
return false
end
end
return ObjectTool.TOUCH_IGNORED
end
end
function ObjectTool:onTouch(event, x, y)
local x, y = self.map_:getCamera():convertToMapPosition(x, y)
if self.selectedButtonName_ == "CreateObject" then
return self:onTouchCreateObject(event, x, y)
elseif self.selectedButtonName_ == "SelectObject" then
return self:onTouchSelectObject(event, x, y)
elseif self.selectedButtonName_ == "RemoveObject" then
return self:onTouchRemoveObject(event, x, y)
elseif self.selectedButtonName_ == "BindObjectToPath" then
return self:onTouchBindObjectToPath(event, x, y)
end
end
function ObjectTool:showToolbox(mapX, mapY)
assert(self.toolbox_ == nil)
local layer = display.newNode()
layer:setPosition(mapX, mapY)
local allIds = StaticObjectsProperties.getAllIds()
local count = #allIds
local maxColumns = math.ceil(math.sqrt(count))
if maxColumns > ObjectTool.TOOLBOX_MAX_COLUMNS then
maxColumns = ObjectTool.TOOLBOX_MAX_COLUMNS
end
local rows = math.ceil(count / maxColumns)
local columns = maxColumns
if count < maxColumns then columns = count end
local x = -(columns / 2) * ObjectTool.TOOLBOX_PADDING + ObjectTool.TOOLBOX_PADDING / 2
local y = (rows / 2) * ObjectTool.TOOLBOX_PADDING - ObjectTool.TOOLBOX_PADDING / 2
local width, height = self.map_:getSize()
local minX = ObjectTool.TOOLBOX_PADDING / 2
if mapX + x < minX then x = minX - mapX end
local maxX = width - (columns - 0.5) * ObjectTool.TOOLBOX_PADDING
if mapX + x > maxX then x = maxX - mapX end
local minY = (rows - 0.5) * ObjectTool.TOOLBOX_PADDING
if mapY + y < minY then y = minY - mapY end
local maxY = height - ObjectTool.TOOLBOX_PADDING / 2
if mapY + y > maxY then y = maxY - mapY end
local left = mapX + x - ObjectTool.TOOLBOX_PADDING / 2
local top = mapY + y + ObjectTool.TOOLBOX_PADDING / 2
local bgWidth = columns * ObjectTool.TOOLBOX_PADDING + 4
local bgHeight = rows * ObjectTool.TOOLBOX_PADDING + 4
local rect = utils.drawRect(
cc.rect(x - ObjectTool.TOOLBOX_PADDING / 2 - 2,
y - bgHeight + ObjectTool.TOOLBOX_PADDING / 2 + 2,
bgWidth,
bgHeight),
{fillColor = cc.c4f(1,1,1,80/255),
borderColor = cc.c4f(0.5,0.5,0.5,80/255)})
-- rect:setFill(true)
-- rect:setLineColor(cc.c4fFromc4b(cc.c4b(120, 120, 120, 80)))
-- rect:setOpacity(80)
-- rect:setPosition(x + bgWidth / 2 - ObjectTool.TOOLBOX_PADDING / 2 - 2,
-- y - bgHeight / 2 + ObjectTool.TOOLBOX_PADDING / 2 + 2)
layer:addChild(rect)
local col = 0
for i, id in ipairs(allIds) do
local define = StaticObjectsProperties.get(id)
local sprite
if define.framesName then
sprite = display.newSprite("#" .. string.format(define.framesName, define.framesBegin))
else
local imageName = define.imageName
if type(imageName) == "table" then
imageName = imageName[1]
end
sprite = display.newSprite(imageName)
end
local size = sprite:getContentSize()
local scale = 1
if size.width > ObjectTool.TOOLBOX_ICON_SIZE then
scale = ObjectTool.TOOLBOX_ICON_SIZE / size.width
end
if size.height * scale > ObjectTool.TOOLBOX_ICON_SIZE then
scale = ObjectTool.TOOLBOX_ICON_SIZE / size.height
end
sprite:setScale(scale)
local rect = utils.drawRect(
cc.rect(x - ObjectTool.TOOLBOX_ICON_SIZE/2,
y - ObjectTool.TOOLBOX_ICON_SIZE/2,
ObjectTool.TOOLBOX_ICON_SIZE,
ObjectTool.TOOLBOX_ICON_SIZE),
{fillColor = cc.c4f(1,1,1,70/255),
borderColor = cc.c4f(32/255, 32/255, 32/255, 120/255)})
-- rect:setFill(true)
-- rect:setLineColor(cc.c4fFromc4b(cc.c4b(32, 32, 32, 120)))
-- rect:setOpacity(70)
-- rect:setPosition(x, y)
layer:addChild(rect)
layer:addChild(sprite)
sprite:setPosition(x, y)
col = col + 1
if col >= columns then
x = x - ObjectTool.TOOLBOX_PADDING * (columns - 1)
y = y - ObjectTool.TOOLBOX_PADDING
col = 0
else
x = x + ObjectTool.TOOLBOX_PADDING
end
end
local map = self.map_
function layer:checkPoint(x, y)
local col = math.floor((x - left) / ObjectTool.TOOLBOX_PADDING) + 1
local row = math.floor((top - y) / ObjectTool.TOOLBOX_PADDING) + 1
if col < 1 or col > columns or row < 1 or row > rows then
return
end
local index = (row - 1) * columns + col
if not allIds[index] then return end
local defineId = allIds[index]
local define = StaticObjectsProperties.get(defineId)
local state = {x = mapX, y = mapY, defineId = defineId}
local object = map:newObject(define.classId, state)
map:setAllObjectsZOrder()
return object
end
self.toolbox_ = layer
self.map_:getMarksLayer():addChild(self.toolbox_, ObjectTool.TOOLBOX_ZORDER)
end
return ObjectTool
|
preferredtoolarchitecture "x86_64"
filter { "action:vs2017" }
if _OPTIONS["win10"] then
systemversion "10.0.16299.0"
end
filter {}
filter { "platforms:x86" }
system "Windows"
architecture "x86"
filter { "platforms:x86_64" }
system "Windows"
architecture "x86_64"
filter { "platforms:arm" }
system "Windows"
architecture "ARM"
filter { "platforms:arm64" }
system "Windows"
architecture "ARM64"
filter {}
|
--[[
The MIT License (MIT)
Copyright (c) 2014 David Mentler
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.
]]--
if SERVER then
return
end
png = png or {}
png.cModel = png.cModel or ClientsideModel( "models/props_borealis/bluebarrel001.mdl", RENDERGROUP_TRANSLUCENT )
png.cPanel = png.cPanel or vgui.Create( "ModelImage" )
png.queue = png.queue or CircularQueue( 128 )
local rTable = {
ent = png.cModel,
cam_pos = Vector(),
cam_ang = Angle(),
cam_fov = 90
}
-- Init cModel, cPanel
local model = png.cModel
model:SetNoDraw( true )
local panel = png.cPanel
panel:SetVisible( false )
panel:SetMouseInputEnabled( false )
panel:SetKeyboardInputEnabled( false )
panel:SetSize( 32, 32 )
-- Internal functions
local function Render( name, wide, tall, func )
-- Apply RenderOverride
model.RenderOverride = func
-- Make the icon render to the png file ( You MUST set the fake model LAST! )
panel:SetSize( wide, tall )
panel:SetModel( "png/" .. name )
panel:RebuildSpawnIconEx( rTable )
return png.GetPath( name, wide, tall )
end
local function ProcessQueue()
local queue = png.queue
if ( queue:IsEmpty() ) then return end
local top = queue:Peek()
-- Pop finished
local path = top.path
if ( path ) then
if ( top.cback ) then
pcall( top.cback, path )
end
queue:Pop()
top = queue:Peek()
if ( !top ) then
return
end
end
-- Process next
if ( top.PreRender ) then
local ok, err = pcall( top.PreRender, top )
if ( !ok ) then
print( "PreRender failed: " .. err )
end
-- Delay rendering
if ( err == false ) then
return
end
end
path = Render( top.name, top.w, top.h, top.func )
if ( isfunction( top.cback ) ) then
top.path = path -- Callback on next frame
else
queue:Pop() -- Pop
end
end
hook.Add( "HUDPaint", "RenderToPNG", ProcessQueue )
-- API
function png.GetPath( name, wide, tall )
local path = "spawnicons/png/" .. name:lower()
local tall = tall or wide
if ( wide == tall ) then
if ( wide != 64 ) then
path = path .. "_" .. wide
end
else
path = path .. wide .. "x" .. tall
end
return path .. ".png"
end
function png.Render( name, wide, tall, func, cback )
local entry = {
name = name,
w = wide,
h = tall,
func = func,
cback = cback,
}
if ( !png.queue ) then
png.queue = { entry }
return entry
end
png.queue:Add( entry )
return entry
end
function png.GetOrRender( name, wide, tall, func, cback )
local path = png.GetPath( name, wide, tall )
if ( !file.Exists( "materials/" .. path, "MOD" ) ) then
png.Render( name, wide, tall, func, cback )
else
if ( isfunction( cback ) ) then
cback( path )
end
end
end
|
slot0 = require("protobuf")
module("p70_pb")
SC_70000 = slot0.Descriptor()
slot2 = slot0.FieldDescriptor()
CS_70001 = slot0.Descriptor()
slot3 = slot0.FieldDescriptor()
slot4 = slot0.FieldDescriptor()
SC_70002 = slot0.Descriptor()
slot5 = slot0.FieldDescriptor()
CS_70003 = slot0.Descriptor()
slot6 = slot0.FieldDescriptor()
SC_70004 = slot0.Descriptor()
slot7 = slot0.FieldDescriptor()
CS_70005 = slot0.Descriptor()
slot8 = slot0.FieldDescriptor()
SC_70006 = slot0.Descriptor()
slot9 = slot0.FieldDescriptor()
slot10 = slot0.FieldDescriptor()
slot2.name = "meta_char_list"
slot2.full_name = ".p70.sc_70000.meta_char_list"
slot2.number = 1
slot2.index = 0
slot2.label = 3
slot2.has_default_value = false
slot2.default_value = {}
slot2.message_type = require("common_pb").METACHARINFO
slot2.type = 11
slot2.cpp_type = 10
SC_70000.name = "sc_70000"
SC_70000.full_name = ".p70.sc_70000"
SC_70000.nested_types = {}
SC_70000.enum_types = {}
SC_70000.fields = {
slot2
}
SC_70000.is_extendable = false
SC_70000.extensions = {}
slot3.name = "id"
slot3.full_name = ".p70.cs_70001.id"
slot3.number = 1
slot3.index = 0
slot3.label = 2
slot3.has_default_value = false
slot3.default_value = 0
slot3.type = 13
slot3.cpp_type = 3
slot4.name = "attr_list"
slot4.full_name = ".p70.cs_70001.attr_list"
slot4.number = 2
slot4.index = 1
slot4.label = 3
slot4.has_default_value = false
slot4.default_value = {}
slot4.type = 13
slot4.cpp_type = 3
CS_70001.name = "cs_70001"
CS_70001.full_name = ".p70.cs_70001"
CS_70001.nested_types = {}
CS_70001.enum_types = {}
CS_70001.fields = {
slot3,
slot4
}
CS_70001.is_extendable = false
CS_70001.extensions = {}
slot5.name = "result"
slot5.full_name = ".p70.sc_70002.result"
slot5.number = 1
slot5.index = 0
slot5.label = 2
slot5.has_default_value = false
slot5.default_value = 0
slot5.type = 13
slot5.cpp_type = 3
SC_70002.name = "sc_70002"
SC_70002.full_name = ".p70.sc_70002"
SC_70002.nested_types = {}
SC_70002.enum_types = {}
SC_70002.fields = {
slot5
}
SC_70002.is_extendable = false
SC_70002.extensions = {}
slot6.name = "id"
slot6.full_name = ".p70.cs_70003.id"
slot6.number = 1
slot6.index = 0
slot6.label = 2
slot6.has_default_value = false
slot6.default_value = 0
slot6.type = 13
slot6.cpp_type = 3
CS_70003.name = "cs_70003"
CS_70003.full_name = ".p70.cs_70003"
CS_70003.nested_types = {}
CS_70003.enum_types = {}
CS_70003.fields = {
slot6
}
CS_70003.is_extendable = false
CS_70003.extensions = {}
slot7.name = "result"
slot7.full_name = ".p70.sc_70004.result"
slot7.number = 1
slot7.index = 0
slot7.label = 2
slot7.has_default_value = false
slot7.default_value = 0
slot7.type = 13
slot7.cpp_type = 3
SC_70004.name = "sc_70004"
SC_70004.full_name = ".p70.sc_70004"
SC_70004.nested_types = {}
SC_70004.enum_types = {}
SC_70004.fields = {
slot7
}
SC_70004.is_extendable = false
SC_70004.extensions = {}
slot8.name = "id"
slot8.full_name = ".p70.cs_70005.id"
slot8.number = 1
slot8.index = 0
slot8.label = 2
slot8.has_default_value = false
slot8.default_value = 0
slot8.type = 13
slot8.cpp_type = 3
CS_70005.name = "cs_70005"
CS_70005.full_name = ".p70.cs_70005"
CS_70005.nested_types = {}
CS_70005.enum_types = {}
CS_70005.fields = {
slot8
}
CS_70005.is_extendable = false
CS_70005.extensions = {}
slot9.name = "result"
slot9.full_name = ".p70.sc_70006.result"
slot9.number = 1
slot9.index = 0
slot9.label = 2
slot9.has_default_value = false
slot9.default_value = 0
slot9.type = 13
slot9.cpp_type = 3
slot10.name = "ship"
slot10.full_name = ".p70.sc_70006.ship"
slot10.number = 2
slot10.index = 1
slot10.label = 1
slot10.has_default_value = false
slot10.default_value = nil
slot10.message_type = require("common_pb").SHIPINFO
slot10.type = 11
slot10.cpp_type = 10
SC_70006.name = "sc_70006"
SC_70006.full_name = ".p70.sc_70006"
SC_70006.nested_types = {}
SC_70006.enum_types = {}
SC_70006.fields = {
slot9,
slot10
}
SC_70006.is_extendable = false
SC_70006.extensions = {}
cs_70001 = slot0.Message(CS_70001)
cs_70003 = slot0.Message(CS_70003)
cs_70005 = slot0.Message(CS_70005)
sc_70000 = slot0.Message(SC_70000)
sc_70002 = slot0.Message(SC_70002)
sc_70004 = slot0.Message(SC_70004)
sc_70006 = slot0.Message(SC_70006)
return
|
---@class AttachedLocations : zombie.characters.AttachedItems.AttachedLocations
---@field protected groups ArrayList|Unknown
AttachedLocations = {}
---@public
---@return void
function AttachedLocations:Reset() end
---@public
---@param arg0 String
---@return AttachedLocationGroup
function AttachedLocations:getGroup(arg0) end
|
local bzCore = require("bz_core");
local misc = require("misc");
local OOP = require("oop");
local bzObjects = require("bz_objects");
local Class = OOP.Class;
local Decorate = OOP.Decorate;
local Meta = OOP.Meta;
local getClassRef = OOP.getClassRef;
local getClass = OOP.getClass;
local copyTable = OOP.copyTable;
local assignObject = OOP.assignObject;
local isIn = OOP.isIn;
local SetLabel = SetLabel;
local Implements = OOP.Implements;
local Interface = OOP.Interface;
local odfFile = misc.odfFile;
local Serializable = misc.Serializable;
local Updateable = misc.Updateable;
local ObjectListener = misc.ObjectListener;
local PlayerListener = misc.PlayerListener;
local CommandListener = misc.CommandListener;
local NetworkListener = misc.NetworkListener;
local StartListener = misc.StartListener;
local KeyListener = misc.KeyListener;
local BzInit = misc.BzInit;
local BzDestroy = misc.BzDestroy;
local BzRemove = misc.BzRemove;
local MpSyncable = misc.MpSyncable;
local BzAlive = misc.BzAlive;
local DefaultRuntimeModule = misc.DefaultRuntimeModule;
local BzModule = misc.BzModule
local AiInterface = Interface("AiInterface",{--[["onReset","onNextCommand","onNextWho","onNextTarget","onMessage"]]});
--TODO: make MP safe
local AiDecorator = function(data)
return function(class)
Meta(class,{
AI = assignObject({
name = "NONE",
aiNames = {}, --WEEK
cName = {}, --WEEK
classLabels = {}, --WEEK
factions = {}, --STRONG: AI will only be active for given faction
--interface = {}, --List of methods that can be called by the AI planner
playerTeam = false --STRONG --Player will not have AI activated by default
},data)
});
Decorate(Implements(AiInterface,BzInit,Updateable,Serializable),class);
end
end
local AiManager = Decorate(
BzModule("AiManagerModule"),
Class("AiManagerModule",{
constructor = function()
self.all = {};
self.byClass = {};
self.classes = {};
end,
methods = {
update = function(...)
for i,v in pairs(self.all) do
for i2, v2 in pairs(v) do
v2:update(...);
end
end
end,
onStart = function(...)
end,
save = function()
local objdata = {};
local cdata = {};
for i, v in pairs(self.classes) do
if(v.save) then
cdata[v:getName()] = table.pack(v:save());
end
end
for i, v in pairs(self.all) do
objdata[i] = {};
for i2, v2 in pairs(v) do
objdata[i][getClassRef(v2)] = table.pack(v2:save());
end
end
return {objects = objdata,cdata=cdata};
end,
load = function(saveData)
local objdata = saveData.objects;
local cdata = saveData.cdata;
for i, v in pairs(cdata) do
for i2, v2 in pairs(self.classes) do
if(v2.load) then
if(v2:getName() == i) then
v2:load(unpack(v or {}));
end
end
end
end
--Use register handle?
for h, v in pairs(objdata) do
local objs = self:checkHandle(h);
for i2, v2 in pairs(v) do
if(objs[i2]) then
objs[i2]:load(unpack(v2));
end
end
end
for h in AllObjects() do
self:checkHandle(h);
end
end,
getUnitsByClass = function(cls)
return self.byClass[cls:getName()];
end,
afterSave = function()
end,
afterLoad = function()
end,
onGameKey = function(...)
end,
onCommand = function(...)
end,
onAddPlayer = function(...)
end,
onDeletePlayer = function(...)
end,
onCreatePlayer = function(...)
end,
onCreateObject = function(handle,...)
if(not IsRemote(handle)) then
self:checkHandle(handle);
end
for i, v in pairs(self.all) do
for i2, v2 in pairs(v) do
--if((not Meta(v2).suspended) and v2.onCreateObject) then
v2:onCreateObject(handle)
--end
end
end
end,
onAddObject = function(handle,...)
self:checkHandle(handle);
for i, v in pairs(self.all) do
for i2, v2 in pairs(v) do
--if((not Meta(v2).suspended) and v2.onAddObject) then
v2:onAddObject(handle)
--end
end
end
end,
onDeleteObject = function(handle,...)
if(self.all[handle]) then
for i,v in pairs(self.all[handle]) do
v:onReset();
end
end
self.all[handle] = nil;
for i, v in pairs(self.all) do
for i2, v2 in pairs(v) do
--if((not Meta(v2).suspended) and v2.onDeleteObject) then
v2:onDeleteObject(handle)
--end
end
end
end,
onReceive = function(...)
end,
checkHandle = function(handle)
local t = GetTeamNum(handle);
local pt = GetTeamNum(GetPlayerHandle());
local objs = {};
if(self.all[handle]) then
for i, v in pairs(self.all[handle]) do
if(Meta(v).suspended and (pt ~= t) ) then
Meta(v,{
suspended = false
});
v:onInit();
elseif((not Meta(v).suspended) and (pt == t)) then
if(not Meta(v).playerTeam) then
Meta(v,{
suspended = true
});
v:onReset();
end
end
end
else
local h = bzObjects.Handle(handle);
local odf = h:getOdf();
local classLabel = h:getClassLabel(handle);
local faction = h:getNation(handle);
local ais = h:getProperty("GameObjectClass","aiName");
for i, v in pairs(self.classes) do
local objectMeta = Meta(v).AI;
local m = isIn(classLabel, objectMeta.classLabels or {})
or isIn(faction, objectMeta.factions or {})
or isIn(ais, objectMeta.aiNames or {});
if (m) then
local aiC = v:new(handle);
self.all[handle] = self.all[handle] or {};
self.byClass[v:getName()][handle] = aiC;
table.insert(self.all[handle],aiC);
local s = not (objectMeta.playerTeam or t~=pt);
Meta(aiC,{
suspended = s,
playerTeam = objectMeta.playerTeam
});
if(not s) then
aiC:onInit();
end
objs[getClassRef(aiC)] = aiC;
end
end
return objs;
end
end,
declearClass = function(obj)
table.insert(self.classes, obj);
self.byClass[obj:getName()] = setmetatable({},{__mode="v"});
end
}
})
);
local aiManager = bzCore:addModule(AiManager);
return {
aiManager = aiManager,
AiDecorator = AiDecorator
};
|
set_languages("cxx20")
set_policy("check.auto_ignore_flags", false)
target("ejdb")
set_kind("shared")
add_defines("_XOPEN_SOURCE=500","_GNU_SOURCE")
add_files("src/*.c")
--add_includedirs("/usr/local/include/luajit-2.1/")
add_links("ejdb2-2","iowow-1","facilio-1","pthread","m","c")
|
local vicsek = {}
vicsek.name = "Vicsek Flake"
local wd,ht
local limit = 5
local size = 200
local saltireSet = {}
local crossSet = {}
local function genSaltire(step,px,py)
if not saltireSet[step] then saltireSet[step] = {} end
table.insert(saltireSet[step],{px,py})
table.insert(saltireSet[step],{px + 2*size/(3^step),py})
table.insert(saltireSet[step],{px + size/(3^step),py + size/(3^step)})
table.insert(saltireSet[step],{px,py + 2*size/(3^step)})
table.insert(saltireSet[step],{px + 2*size/(3^step),py + 2*size/(3^step)})
if step < limit then
genSaltire(step+1,px,py)
genSaltire(step+1,px+2*size/(3^step),py)
genSaltire(step+1,px+size/(3^step),py+size/(3^step))
genSaltire(step+1,px,py+2*size/(3^step))
genSaltire(step+1,px+2*size/(3^step),py+2*size/(3^step))
end
end
local function genCross(step,px,py)
if not crossSet[step] then crossSet[step] = {} end
table.insert(crossSet[step],{px + size/(3^step),py})
table.insert(crossSet[step],{px,py + size/(3^step)})
table.insert(crossSet[step],{px + size/(3^step),py + size/(3^step)})
table.insert(crossSet[step],{px + 2*size/(3^step),py + size/(3^step)})
table.insert(crossSet[step],{px + size/(3^step),py + 2*size/(3^step)})
if step < limit then
genCross(step+1,px+size/(3^step),py)
genCross(step+1,px,py+size/(3^step))
genCross(step+1,px+size/(3^step),py+size/(3^step))
genCross(step+1,px+2*size/(3^step),py+size/(3^step))
genCross(step+1,px+size/(3^step),py+2*size/(3^step))
end
end
function vicsek.init()
love.graphics.setColor(255,255,255)
love.graphics.setLineWidth(1)
wd,ht = love.graphics.getDimensions()
vicsek.reset()
end
function vicsek.reset()
saltireSet = {}
saltireSet[0] = {{wd/4-size/2,ht/2-size/2}}
genSaltire(1,wd/4-size/2,ht/2-size/2)
crossSet = {}
crossSet[0] = {{wd*3/4-size/2,ht/2-size/2}}
genCross(1,wd*3/4-size/2,ht/2-size/2)
end
function vicsek.draw()
love.graphics.setFont(fonts.text)
love.graphics.setColor(255,255,255)
love.graphics.printf("Press 'Q' to decrease and 'W' to\n increase the number of steps.\n\nPress 'A' to decrease and 'S' to\n increase the size of the initial squares.",0,10,wd-10,'right')
love.graphics.setFont(fonts.title2)
love.graphics.printf("Saltire Form",0,ht-fonts.title2:getHeight()-3,wd/2,'center')
love.graphics.printf("Cross Form",wd/2,ht-fonts.title2:getHeight()-3,wd/2,'center')
for i,sq in pairs(saltireSet[limit]) do
love.graphics.rectangle('fill',sq[1],sq[2],size/(3^limit),size/(3^limit))
end
for i,sq in pairs(crossSet[limit]) do
love.graphics.rectangle('fill',sq[1],sq[2],size/(3^limit),size/(3^limit))
end
end
function vicsek.keypressed(key)
if key=='q' and limit > 0 then
limit = limit - 1
elseif key=='w' then
limit = limit + 1
elseif key=='a' then
size = size - 10
elseif key=='s' then
size = size + 10
end
vicsek.reset()
end
function vicsek.resize(w,h)
vicsek.init()
end
function vicsek.exit()
saltireSet = {}
crossSet = {}
collectgarbage()
end
return vicsek
|
--[[
Copyright (c) 2019 igor725, scaledteam
released under The MIT license http://opensource.org/licenses/MIT
]]
local ec = {}
EC_SKY = 0
EC_CLOUD = 1
EC_FOG = 2
EC_AMBIENT = 3
EC_DIFFUSE = 4
time_presets = {
night = {
[EC_DIFFUSE] = newColor(0x80, 0x90, 0xA0),
[EC_AMBIENT] = newColor(0x68, 0x68, 0x70),
[EC_FOG] = newColor(0x10, 0x10, 0x20),
[EC_CLOUD] = newColor(0x40, 0x40, 0x40),
[EC_SKY] = newColor(0x0A, 0x0A, 0x18)
},
dawn = {
[EC_DIFFUSE] = newColor(0xC0, 0xC0, 0xC0),
[EC_AMBIENT] = newColor(0x80, 0x70, 0x70),
[EC_FOG] = newColor(0xFF, 0x92, 0x00),
[EC_CLOUD] = newColor(0xC0, 0x90, 0x90),
[EC_SKY] = newColor(0x10, 0x10, 0x80)
},
day = {
[EC_DIFFUSE] = newColor(0xFF, 0xFF, 0xFF),
[EC_AMBIENT] = newColor(0x9B, 0x9B, 0x9B),
[EC_FOG] = newColor(0xB9, 0xEC, 0xFF),
[EC_CLOUD] = newColor(0xFF, 0xFF, 0xFF),
[EC_SKY] = newColor(0x99, 0xCC, 0xFF)
}
}
local function updateEnvColorsFor(player, typ, r, g, b)
if player:isSupported('EnvColors')then
player:sendPacket(false, 0x19, typ, r or -1, g or -1, b or -1)
end
end
local function getClrs(world)
world = getWorld(world)
local clr = world:getData('colors')
if not clr then
clr = {}
world:setData('colors', clr)
end
return clr
end
function ec:load()
registerSvPacket(0x19,'>bbhhh')
getPlayerMT().setEnvColor = function(player, typ, r, g, b)
updateEnvColorsFor(player, typ, r, g, b)
end
getWorldMT().setEnvColor = function(world, typ, r, g, b)
local colors = getClrs(world)
local clr = colors[typ]
if clr then
clr.r, clr.g, clr.b = r, g, b
else
colors[typ] = newColor(r, g, b)
end
playersForEach(function(player)
if player:isInWorld(world)then
updateEnvColorsFor(player, typ, r, g, b)
end
end)
return true
end
getWorldMT().setTime = function(self, preset)
local preset = time_presets[preset]
if preset then
for i = 0, 4 do
local c = preset[i]
self:setEnvColor(i, c.r, c.g, c.b)
end
return true
end
return false
end
getWorldMT().getEnvColor = function(world, typ)
local c = world.data.colors[typ]
if c then
return c.r, c.g, c.b
else
return -1, -1, -1
end
end
end
function ec:prePlayerSpawn(player)
local colors = getClrs(player.worldName)
for i = 0, 4 do
local c = colors[i]
if c then
updateEnvColorsFor(player, i, c.r, c.g, c.b)
else
updateEnvColorsFor(player, i)
end
end
end
return ec
|
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "Grenade Launcher"
SWEP.Author = "TFA, Servius"
SWEP.ViewModelFOV = 50
SWEP.Slot = 2
SWEP.SlotPos = 3
end
SWEP.HoldType = "ar2"
SWEP.Base = "tfa_swsft_base_servius"
SWEP.Category = "TFA Star Wars"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModelFOV = 56
SWEP.ViewModelFlip = false
SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl"
SWEP.WorldModel = "models/weapons/w_irifle.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = false
SWEP.UseHands = true
SWEP.ViewModelBoneMods = {
["v_weapon.awm_parent"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(-3, 0, 0), angle = Angle(0, 0, 0) },
["ValveBiped.Bip01_L_Clavicle"] = { scale = Vector(1, 1, 1), pos = Vector(-1, 2, 0.18), angle = Angle(0, 0, 0) },
["ValveBiped.Bip01_L_Finger0"] = { scale = Vector(1, 1, 1), pos = Vector(-1, -1, 1), angle = Angle(0, 1.447, 0) }
}
SWEP.Primary.Sound = Sound ("NPC_Combine.GrenadeLaunch");
SWEP.Primary.ReloadSound = Sound ("weapons/DC15A_reload.wav");
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Recoil = 10
SWEP.Primary.Damage = 200
SWEP.Primary.NumShots = 1
SWEP.Primary.Spread = 0.05
SWEP.Primary.ClipSize = 3
SWEP.Primary.RPM = 60/1
SWEP.Primary.DefaultClip = 3
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "rpg_round"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.ProjectileEntity = "ent_baby_explosive2" --Entity to shoot
SWEP.ProjectileVelocity = 750 --Entity to shoot's velocity
SWEP.Scoped = false
SWEP.Secondary.UseGreenDuplex = false
SWEP.Secondary.IronFOV = 70
SWEP.IronSightsPos = Vector(-7.401, -10, 0)
SWEP.IronSightsAng = Vector(-1.89, 0.282, 0)
SWEP.VElements = {
["element_name"] = { type = "Model", model = "models/props/starwars/weapons/grenade_launcher.mdl", bone = "v_weapon.awm_parent", rel = "", pos = Vector(0, 3, -10), angle = Angle(-90, 90, 0), size = Vector(0.95, 0.95, 0.95), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["element_name2"] = { type = "Model", model = "models/props/starwars/weapons/grenade_launcher.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(10, 0.584, 2), angle = Angle(180, -180, 0), size = Vector(0.884, 0.884, 0.884), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.BlowbackVector = Vector(0,-3,0.025)
SWEP.Blowback_Only_Iron = false
SWEP.DoProceduralReload = true
SWEP.ProceduralReloadTime = 2.5
|
Entity = Object:extend()
function Entity:new()
self.x = 10
self.y = 10
self.speed = 100
self.radius = 50;
end
function Entity:load()
end
function Entity:update(dt)
end
function Entity:draw()
love.graphics.circle("line", self.x, self.y, self.radius, 8)
end
|
local strict = {}
strict.defined = {}
-- used to define a global variable
function global(t)
for k, v in pairs(t) do
strict.defined[k] = true
rawset(_G, k, v)
end
end
function strict.__newindex(t, k, v)
error("cannot set undefined variable: " .. k, 2)
end
function strict.__index(t, k)
if not strict.defined[k] then
error("cannot get undefined variable: " .. k, 2)
end
end
setmetatable(_G, strict)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.