content
stringlengths
5
1.05M
local log = require("log") local Api = require("coreApi") local json = require("json") local http = require("http") --local sqlite3 = require ("luasql.sqlite3") local function contains(table, val) for i = 1, #table do if table[i] == val then return true end end return false end function ReceiveFriendMsg(CurrentQQ, data) return 1 end function ReceiveGroupMsg(CurrentQQ, data) return 1 end function ReceiveEvents(CurrentQQ, data, extData) --QQ登陆成功事件 if data.MsgType == "ON_EVENT_QQ_LOGIN_SUCC" then str = string.format(" QQ 登陆成功%s \n", extData.QQUser) log.info("%s", str) end --QQ离线事件 可能的原因(TX 踢号/异地登陆/冻结/被举报等 导致等Session失效) if data.MsgType == "ON_EVENT_QQ_OFFLINE" then str = string.format(" QQ 离线事件 %s Data %s \n", extData.QQUser, extData.Data) log.info("%s", str) end --网络变化事件 网络波动引起当前链接 释放 随机8-15s会自动重连登陆 被t下线的QQ 不会在重连 if data.MsgType == "ON_EVENT_QQ_NETWORK_CHANGE" then str = string.format(" QQ 网络变化事件 %s Data %s \n", extData.QQUser, extData.Data) log.info("%s", str) end --添加好友的状态事件 被同意添加好友/被拒绝添加好友 if data.MsgType == "ON_EVENT_FRIEND_ADD_STATUS" then str = string.format( "事件类型 %d 事件状态 %s 成员 UserID %d 昵称 %s \n", extData.Type, extData.TypeStatus, extData.UserID, extData.NickName ) log.info("%s", str) end if data.MsgType == "ON_EVENT_NOTIFY_PUSHADDFRD" then str = string.format("(添加好友成功后的反馈?)成为了好友 UserID %d NickName%s", extData.UserID, extData.NickName) log.notice("%s", str) end --{"CurrentPacket":{"WebConnId":"fi4LFS7_uy8ORrKDQN5Z","Data":{"EventData":{"UserID":103259869,"FromType":2004,"Field_9":1571036852000000,"Content":"收到好友请求 内容我是QQ大冰来源来自QQ群","FromGroupId":757360354,"FromGroupName":"IOTQQ交流群","Action":2},"EventMsg":{"FromUin":103259869,"ToUin":534706350,"MsgType":"ON_EVENT_FRIEND_ADDED","Content":"收到好友请求 内容我是QQ大冰来源来自QQ群","RedBaginfo":null},"EventName":"ON_EVENT_FRIEND_ADD"}},"CurrentQQ":534706350} if data.MsgType == "ON_EVENT_FRIEND_ADDED" then --Action1忽略2同意3拒绝 str = string.format( "收到好友请求事件 Uid %s UserNick %s FromType %d Action %d Content %s FromGroupId %d FromGroupName %s", extData.UserID, extData.UserNick, extData.FromType, extData.Action, extData.Content, extData.FromGroupId, extData.FromGroupName ) log.notice("%s", str) extData.Action = 2 apiRet = Api.Api_DealFriend(CurrentQQ, extData) str = string.format("From Lua AddFriendMsg Ret-->%d Msg-->%s", apiRet.Ret, apiRet.Msg) log.notice("%s", str) end --{"CurrentPacket":{"WebConnId":"fi4LFS7_uy8ORrKDQN5Z","Data":{"EventData":{"GroupID":960839480},"EventMsg":{"FromUin":0,"ToUin":0,"MsgType":"ON_EVENT_GROUP_EXIT_SUCC","Content":"主动退群成功事件","RedBaginfo":null},"EventName":"ON_EVENT_GROUP_EXIT_SUCC"}},"CurrentQQ":534706350} if data.MsgType == "ON_EVENT_GROUP_EXIT_SUCC" then str = string.format("QQ机器人主动退出群聊成功 GroupID %s \n", extData.GroupID) log.info("%s", str) end --{"CurrentPacket":{"WebConnId":"I5VW2Hq3YFe18AzvYJFY","Data":{"EventData":{"MsgSeq":3503,"UserID":1700487478},"EventMsg":{"FromUin":0,"ToUin":0,"MsgType":"ON_EVENT_FRIEND_REVOKE","MsgSeq":0,"Content":"好友撤回消息事件","RedBaginfo":null},"EventName":"ON_EVENT_FRIEND_REVOKE"}},"CurrentQQ":534706350} if data.MsgType == "ON_EVENT_FRIEND_REVOKE" then str = string.format("好友UserID %s 消息Seq %s \n", extData.UserID, extData.MsgSeq) log.info("%s", str) end --{"CurrentPacket":{"WebConnId":"dD8NTg57VpyyXTJDT7iU","Data":{"EventData":{"GroupID":757360354,"ShutTime":4294967295,"UserID":0},"EventMsg":{"FromUin":757360354,"ToUin":0,"MsgType":"ON_EVENT_GROUP_SHUT","MsgSeq":0,"Content":"群禁言事件","RedBaginfo":null},"EventName":"ON_EVENT_GROUP_SHUT"}},"CurrentQQ":534706350} --UserID = 0 ShutTime=4294967295 触发了开启全员禁言事件 --UserID = 0 ShutTime=0 触发了关闭全员禁言事件 --UserID = 123456789 ShutTime=123456789 触发了禁言用户123456789 禁言世间123456789 事件 --UserID = 123456789 ShutTime=0 触发了解除用户123456789 禁言事件 if data.MsgType == "ON_EVENT_GROUP_SHUT" then str = string.format("群GroupID %s UserID %d 禁言时间 %s\n", extData.GroupID, extData.UserID, extData.ShutTime) log.info("%s", str) end --{"CurrentPacket":{"WebConnId":"fi4LFS7_uy8ORrKDQN5Z","Data":{"EventData":{"UserID":103259869},"EventMsg":{"FromUin":0,"ToUin":0,"MsgType":"ON_EVENT_FRIEND_DELETE","Content":"被删除好友事件","RedBaginfo":null},"EventName":"ON_EVENT_FRIEND_DELETE"}},"CurrentQQ":534706350} if data.MsgType == "ON_EVENT_FRIEND_DELETE" then str = string.format(" UserID %s 删除了好友", extData.UserID) log.info("%s", str) end --{"CurrentPacket":{"WebConnId":"x7CHA79ZUNyBjoujRRC8","Data":{"EventData":{"GroupID":960839480,"MsgSeq":1452818440,"UserID":1700487478},"EventMsg":{"FromUin":960839480,"ToUin":0,"MsgType":"ON_EVENT_GROUP_REVOKE","MsgSeq":1452818440,"Content":"群成员撤回消息事件","RedBaginfo":null},"EventName":"ON_EVENT_GROUP_REVOKE"}},"CurrentQQ":534706350} if data.MsgType == "ON_EVENT_GROUP_REVOKE" then str = string.format("群成 %d 成员 UserID %s 撤回了消息Seq %s \n", extData.GroupID, extData.UserID, extData.MsgSeq) log.info("%s", str) end --{"CurrentPacket":{"WebConnId":"I1bqf1TxoDvDH8GtGTr-","Data":{"EventData":{"Content":"恭喜Kar98k获得群主授予的test头衔","GroupID":757360354,"UserID":1700487478},"EventMsg":{"FromUin":757360354,"ToUin":0,"MsgType":"ON_EVENT_GROUP_UNIQUETITTLE_CHANGED","MsgSeq":0,"Content":"群头衔变更事件","RedBaginfo":null},"EventName":"ON_EVENT_GROUP_UNIQUETITTLE_CHANGED"}},"CurrentQQ":534706350} if data.MsgType == "ON_EVENT_GROUP_UNIQUETITTLE_CHANGED" then str = string.format("群成 %d 成员 UserID %s 头衔变更了 %s \n", extData.GroupID, extData.UserID, extData.Content) log.info("%s", str) end --{"CurrentPacket":{"WebConnId":"ivNXn033LwcjePqSjFDH","Data":{"EventData":{"InviteUin":103259869,"UserID":1700487478,"UserName":"Kar98k"},"EventMsg":{"FromUin":901924844,"ToUin":534706350,"MsgType":"ON_EVENT_GROUP_JOIN","Content":"","RedBaginfo":null},"EventName":"ON_EVENT_GROUP_JOIN"}},"CurrentQQ":534706350} if data.MsgType == "ON_EVENT_GROUP_JOIN" then str = string.format( "GroupJoinEvent\n JoinGroup Id %d \n JoinUin %d \n JoinUserName \n%s InviteUin \n%s", data.FromUin, extData.UserID, extData.UserName, extData.InviteUin --非管理员权限此值是0 ) log.info("%s", str) end --{"CurrentPacket":{"WebConnId":"ivNXn033LwcjePqSjFDH","Data":{"EventData":{"Flag":1,"GroupID":901924844,"UserID":534706350},"EventMsg":{"FromUin":901924844,"ToUin":534706350,"MsgType":"ON_EVENT_GROUP_ADMIN","Content":"管理员变更事件","RedBaginfo":null},"EventName":"ON_EVENT_GROUP_ADMIN"}},"CurrentQQ":534706350} --机器人是不是管理员都能收到此群管变更事件 if data.MsgType == "ON_EVENT_GROUP_ADMIN" then str = string.format("群管变更事件 GroupID %d UserID %d Flag %d", extData.GroupID, extData.UserID, extData.Flag) -- Flag 1升管理0将管理 log.notice("%s", str) end --{"CurrentPacket":{"WebConnId":"ivNXn033LwcjePqSjFDH","Data":{"EventData":{"UserID":1700487478},"EventMsg":{"FromUin":901924844,"ToUin":534706350,"MsgType":"ON_EVENT_GROUP_EXIT","Content":"群成员退出群聊事件","RedBaginfo":null},"EventName":"ON_EVENT_GROUP_EXIT"}},"CurrentQQ":534706350} --无论机器人是不是管理员 群里任意成员 都能收到 此退群事件 if data.MsgType == "ON_EVENT_GROUP_EXIT" then str = string.format("GroupExitEvent\n ExitGroup Id %s \n ExitUin %d", data.FromUin, extData.UserID) log.info("%s", str) end --{"CurrentPacket":{"WebConnId":"f5LOv77dnotUK7aygso1","Data":{"EventData":{"GroupName":"debug","GroupOwner":69734488,"OwnerName":"Mac"},"EventMsg":{"FromUin":960839480,"ToUin":534706350,"MsgType":"ON_EVENT_GROUP_JOIN_SUCC","Content":"主动进群成功事件","RedBaginfo":null},"EventName":"ON_EVENT_GROUP_JOINED"}},"CurrentQQ":534706350} if data.MsgType == "ON_EVENT_GROUP_JOIN_SUCC" then str = string.format( "ON_EVENT_GROUP_JOIN_SUCC \n GroupJoinSuccess Id %d \n 处理人ID %d 处理人昵称 %s GroupName %s", data.FromUin, extData.GroupOwner, extData.OwnerName, extData.GroupName ) log.info("%s", str) luaRes = Api.Api_SendMsg( CurrentQQ, { toUser = data.FromUin, sendToType = 2, sendMsgType = "PicMsg", content = "感谢🙏@" .. extData.OwnerName .. "收留", atUser = 0, voiceUrl = "", voiceBase64Buf = "", picUrl = "http://gchat.qpic.cn/gchatpic_new/1700487478/960839480-2534335053-67CFBAE7F2E0CE681819D5A96134BE00/0?vuin=1700487478&term=255&pictype=0", picBase64Buf = "", fileMd5 = "" } ) log.info("From Lua SendMsg Ret\n%d", luaRes.Ret) end --{"CurrentPacket":{"WebConnId":"3x1VZ6DlCiNQP1khIB43","Data":{"EventData":{"Seq":1570980892762275,"Type":1,"MsgTypeStr":"邀请加群","Who":534706350,"WhoName":"QQ棒棒冰","MsgStatusStr":"","Flag_7":8192,"Flag_8":512,"GroupId":570065685,"GroupName":"Rust编程语言社区3群","InviteUin":1700487478,"InviteName":"Kar98k","Action":0},"EventMsg":{"FromUin":570065685,"ToUin":534706350,"MsgType":"ON_EVENT_GROUP_INVITED","Content":"邀请加群","RedBaginfo":null},"EventName":"ON_EVENT_GROUP_INVITED"}},"CurrentQQ":534706350} --QQ群系统消息通知 if data.MsgType == "ON_EVENT_GROUP_ADMINSYSNOTIFY" then str = string.format( "FromUin %d\n ToUin %d\n事件类型 %d 消息类型:%s 消息类型状态:%s 触发消息的对象:%d 触发消息的对象昵称:%s 来自群:%s 群名:%s 邀请人(处理人):%s 邀请人(处理人)昵称:%s 邀请人(处理人)群名片:%s (加群)理由:%s Action:%d", data.FromUin, data.ToUin, extData.Type, extData.MsgTypeStr, extData.MsgStatusStr, extData.Who, extData.WhoName, extData.GroupId, extData.GroupName, extData.ActionUin, extData.ActionName, extData.ActionGroupCard, extData.Content, extData.Action --11 agree 14 忽略 12/21 disagree ) log.notice("%s", str) if extData.Type == 1 then local test=io.open("BlackList.txt","r") local readjson=test:read("*a") local result = json.decode(readjson) if contains(result,extData.GroupId) then exData.Action=14 apiRet = Api.Api_AnswerInviteGroup(CurrentQQ, extData) end extData.Action = 11 --extData.RefuseContent = "小号" --拒绝理由 apiRet = Api.Api_AnswerInviteGroup(CurrentQQ, extData) str = string.format("From Lua AnswerInviteGroup Ret-->%d Msg-->%s", apiRet.Ret, apiRet.Msg) log.notice("%s", str) end end return 1 end
-- Author : Ahmed A. Khfagy -- made in CS50 into to Game Development -- this class represents the score state ScoreState = Class{__includes = BasicState} function ScoreState:enter(params) self.score = params end function ScoreState:update(dt) if love.keyboard.wasPressed('enter') or love.keyboard.wasPressed('return') then gStateMachine:change('title') end end function ScoreState:render() love.graphics.setFont(flappyFont) love.graphics.printf('huh, not again!', 0, 64, VIRTUAL_WIDTH, 'center') love.graphics.setFont(mediumFont) love.graphics.printf('Score: ' .. tostring(self.score), 0, 100, VIRTUAL_WIDTH, 'center') love.graphics.printf('Press enter to go to the title menu..', 0, 160, VIRTUAL_WIDTH, 'center') end function ScoreState:exit() end
if ( SERVER ) then AddCSLuaFile( "shared.lua" ) end SWEP.BulletLength = 12.7 SWEP.CaseLength = 32.6 SWEP.MuzVel = 261.154 SWEP.Attachments = { [1] = {"reflex"}, [2] = {"laser"}} SWEP.InternalParts = { [1] = {{key = "ergonomichandle"}}, [2] = {{key = "burstconvert"}}} if ( CLIENT ) then SWEP.PrintName = "Desert Eagle .50AE" SWEP.Author = "Counter-Strike" SWEP.Slot = 1 SWEP.SlotPos = 0 // = 1 SWEP.IconLetter = "f" SWEP.Muzzle = "cstm_muzzle_br" SWEP.SparkEffect = "cstm_child_sparks_large" SWEP.SmokeEffect = "cstm_child_smoke_large" killicon.AddFont( "cstm_pistol_deagle", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) SWEP.VElements = { ["reflex"] = { type = "Model", model = "models/wystan/attachments/2octorrds.mdl", bone = "v_weapon.Deagle_Slide", pos = Vector(-0.239, 0.574, 0.924), angle = Angle(0, 0, 90), size = Vector(1, 1, 1), color = Color(255, 255, 255, 0), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["laser"] = { type = "Model", model = "models/props_c17/FurnitureBoiler001a.mdl", bone = "v_weapon.Deagle_Parent", rel = "", pos = Vector(0, 1.962, 4.138), angle = Angle(0, 0, 180), size = Vector(0.029, 0.029, 0.029), color = Color(255, 255, 255, 0), surpresslightning = false, material = "models/bunneh/silencer", skin = 0, bodygroup = {} } } SWEP.WElements = { ["reflex"] = { type = "Model", model = "models/wystan/attachments/2octorrds.mdl", pos = Vector(2.599, 0.99, -2), angle = Angle(180, 85, 0), size = Vector(1.401, 1.401, 1.401), color = Color(255, 255, 255, 0), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } SWEP.SafeXMoveMod = 2 end SWEP.Category = "Customizable Weaponry" SWEP.Base = "cstm_base_pistol" SWEP.FireModes = {"semi"} SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.HoldType = "pistol" SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = true SWEP.ViewModel = "models/weapons/v_pist_deagle.mdl" SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" SWEP.ShowViewModel = true SWEP.ShowWorldModel = true SWEP.ViewModelBonescales = {} SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Primary.Sound = Sound("Weapon_DEagle.Single") SWEP.Primary.Recoil = 3 SWEP.Primary.Damage = 43 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.02 SWEP.Primary.ClipSize = 7 SWEP.Primary.Delay = 0.25 SWEP.Primary.DefaultClip = 7 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = ".50AE" SWEP.InitialHoldtype = "pistol" SWEP.InHoldtype = "pistol" SWEP.NoAuto = true SWEP.ACOGStatus = 0 SWEP.NoScopes = true SWEP.CantSilence = true SWEP.NoBoltAnim = true -- Animation speed/custom reload function related SWEP.IsReloading = false SWEP.AnimPrefix = "" SWEP.ReloadSpeed = 1 SWEP.ShouldBolt = false SWEP.ReloadDelay = 0 SWEP.IncAmmoPerc = 0.72 -- Amount of frames required to pass (in percentage) of the reload animation for the weapon to have it's amount of ammo increased SWEP.FOVZoom = 85 -- Dynamic accuracy related SWEP.ShotsAmount = 0 SWEP.ConeDecAff = 0 SWEP.DefRecoil = 3 SWEP.CurCone = 0.04 SWEP.DecreaseRecoilTime = 0 SWEP.ConeAff1 = 0 -- Crouching/standing SWEP.ConeAff2 = 0 -- Using ironsights SWEP.UnConeTime = 0 -- Amount of time after firing the last shot that needs to pass until accuracy increases SWEP.FinalCone = 0 -- Self explanatory SWEP.VelocitySensivity = 1 -- Percentage of how much the cone increases depending on the player's velocity (moving speed). Rifles - 100%; SMGs - 80%; Pistols - 60%; Shotguns - 20% SWEP.HeadbobMul = 1 SWEP.IsSilenced = false SWEP.IronsightsCone = 0.013 SWEP.HipCone = 0.044 SWEP.ConeInaccuracyAff1 = 0.5 SWEP.PlayFireAnim = true SWEP.DryFireAnim = true SWEP.SprintAndShoot = true SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.IsUsingIronsights = false SWEP.TargetMul = 0 SWEP.SetAndForget = false SWEP.IronSightsPos = Vector(6.0749, -5.5216, 2.3984) SWEP.IronSightsAng = Vector(2.5174, -0.0099, 0) SWEP.AimPos = Vector(5.139, -3.116, 2.678) SWEP.AimAng = Vector(0.224, 0, 0) SWEP.ChargePos = Vector (5.4056, -10.3522, -4.0017) SWEP.ChargeAng = Vector (-1.7505, -55.5187, 68.8356) SWEP.ReflexPos = Vector(5.125, -3.089, 2.361) SWEP.ReflexAng = Vector(0, 0, 0) SWEP.MeleePos = Vector(4.487, -1.497, -5.277) SWEP.MeleeAng = Vector(25.629, -30.039, 26.18) SWEP.SafePos = Vector(0.388, -10.157, -6.064) SWEP.SafeAng = Vector(70, 0, 0)
#!/usr/bin/lua -- Tool for reading elekctro phase meter values combinates with HDO signal from -- I2C device, and sending these values throw MQTT. local signal = require("posix.signal") local unistd = require("posix.unistd") local systime = require("posix.sys.time") local time = require("posix.time") local syslog = require("posix.syslog") local getopt = require("posix.getopt") local fcntl = require("posix.fcntl") local stdio = require("posix.stdio") local logging = require("logging") local console = require("logging.console") local i2c = require("i2c") local mqtt = require("mosquitto") local DEFAULTS = { daemon = { pidfile = "/var/run/phase2mqtt.pid" }, logging = { handler = "syslog", file = "/var/log/phase2mqtt.log", level = "WARN" }, mqtt = { hostname = "localhost", port = 1883, topic = "/phase2mqtt/{timestamp}/{phase}", period = 60, qos = 1, retain = true }, i2c = { bus = 1, addr = 0x08 } } local SYSLOG_LEVELS = {} SYSLOG_LEVELS[logging.DEBUG] = syslog.LOG_DEBUG SYSLOG_LEVELS[logging.INFO] = syslog.LOG_INFO SYSLOG_LEVELS[logging.WARN] = syslog.LOG_WARNING SYSLOG_LEVELS[logging.ERROR] = syslog.LOG_CRIT SYSLOG_LEVELS[logging.FATAL] = syslog.LOG_EMERG local MQTT_LEVELS = {} MQTT_LEVELS[mqtt.LOG_NONE] = logging.DEBUG MQTT_LEVELS[mqtt.LOG_INFO] = logging.INFO MQTT_LEVELS[mqtt.LOG_NOTICE] = logging.INFO MQTT_LEVELS[mqtt.LOG_WARNING] = logging.WARN MQTT_LEVELS[mqtt.LOG_ERROR] = logging.ERROR MQTT_LEVELS[mqtt.LOG_DEBUG] = logging.DEBUG MQTT_LEVELS[mqtt.LOG_ALL] = logging.FATAL local function syslog_start(ident) syslog.openlog(ident, syslog.LOG_PID or syslog.LOG_CONS, syslog.LOG_DAEMON) end local function syslog_log(self, level, message) local priority = SYSLOG_LEVELS[level] or syslog.WARNING return syslog.syslog(priority, level..": "..message) end local function log_tb(msg) local info = debug.getinfo(5) return string.format("%s {%s() at %s:%d}", msg, info.name or info.namewhat, info.source, info.currentline) end local PidFile = { LOCK = { l_type = fcntl.F_WRLCK, -- Exclusive lock l_whence = fcntl.SEEK_SET, -- Relative to beginning of file l_start = 0, -- from 0 position l_len = 0 } } local __PidFile = { __call = function(this, path) local self = {} setmetatable(self, { __index = PidFile }) self:__init(path) return self end } setmetatable(PidFile, __PidFile) function PidFile:__init(path) assert(io.open(path, "a+")) self.file = assert(io.open(path, "r+")) self.file:setvbuf("no") end --- Lock the file and return the state function PidFile:lock() return fcntl.fcntl(stdio.fileno(self.file), fcntl.F_SETLK, PidFile.LOCK) == nil end function PidFile:write_pid() -- new on 34 version -- unistd.ftruncate(stdio.fileno(self.file), 0) local size = self.file:seek("end") self.file:seek("set") self.file:write(string.rep(' ', size)) -- fill with spaces self.file:seek("set") self.file:write(tostring(unistd.getpid())) end function PidFile:read_pid() self.file:seek("set") return self.file:read("*n") end local Config = {} -- Config call local __Config = { __call = function(this, opts) local self = {} setmetatable(self, {__index=Config}) self:__init(opts) return self end } setmetatable(Config, __Config) function Config:__init(opts) self.foreground = opts.foreground self:load(opts.config) self:set_logging() self:set_daemon() self:set_mqtt() self:set_i2c() end function Config:load(path) local fce, err = loadfile(path, "bt") if fce == nil then print(err) os.exit(1) end local scope = setmetatable({}, {__index = _G}) setfenv(fce, scope) local ok, err = pcall(fce) setmetatable(scope, nil) if not ok then print(err) os.exit(1) end if scope.daemon == nil then scope.daemon = DEFAULTS.daemon else setmetatable(scope.daemon, {__index = DEFAULTS.daemon}) end if scope.logging == nil then scope.logging = DEFAULTS.logging else setmetatable(scope.logging, {__index = DEFAULTS.logging}) end if scope.mqtt == nil then scope.mqtt = DEFAULTS.mqtt else setmetatable(scope.mqtt, {__index = DEFAULTS.mqtt}) end if scope.i2c == nil then scope.i2c = DEFAULTS.i2c else setmetatable(scope.i2c, {__index = DEFAULTS.i2c}) end self.conf = scope end function Config:set_logging() local level = self.conf.logging.level if level == "DEBUG" then level = logging.DEBUG elseif level == "INFO" then level = logging.INFO elseif level == "ERROR" then level = logging.ERROR elseif level == "FATAL" then level = logging.FATAL else -- defaut level = logging.WARN end local handler = self.conf.logging.handler if handler == "console" or self.foreground then self.log = console("%date %level: %message\n") elseif handler == "file" then self.log = logging.file(self.conf.logging.file, nil, "%date %level: %message\n") else -- defaut syslog_start("phase2mqtt") self.log = logging.new(syslog_log) end self.log:setLevel(level) -- logger methods use log_tb to return some debug info self.log.debug = function(this, msg) return self.log:log(logging.DEBUG, log_tb, msg) end self.log.info = function(this, msg) return this:log(logging.INFO, log_tb, msg) end self.log.warn = function(this, msg) return this:log(logging.WARN, log_tb, msg) end self.log.error = function(this, msg) return this:log(logging.ERROR, log_tb, msg) end self.log.fatal = function(this, msg) return this:log(logging.FATAL, log_tb, msg) end end function Config:set_daemon() if not self.foreground then self.pidfile = PidFile(self.conf.daemon.pidfile) end -- TODO: change uuid guid end function Config:set_mqtt() self.mqtt = self.conf.mqtt end function Config:set_i2c() self.i2c = self.conf.i2c end local Daemon = {} -- Daemon call local __Daemon = { __call = function(this, config) local self = {} setmetatable(self, {__index=Daemon}) self:__init(config) return self end } setmetatable(Daemon, __Daemon) function Daemon:__init(config) self.config = config self.log = config.log self.stop = false signal.signal(signal.SIGTERM, function() self.log:info("Recieved SIGTERM") self.stop = true end) end function Daemon:run() self.log:info("run...") local connected = false self.client = mqtt.new() self.client.ON_CONNECT = function() self.log:info("Connected to MQTT broker.") connected = true end self.client.ON_DISCONNECT = function() self.log:info("Disconnected from MQTT broker.") connected = false end self.client.ON_LOG = function(level, msg) self.log:log(MQTT_LEVELS[level], log_tb, msg) end while not self.stop do if connected then self:read_and_send() elseif connected == false then self.log:info("Connecting to MQTT broker...") connected = nil self.client:connect(self.config.mqtt.hostname, self.config.mqtt.port) end -- TODO: mesure read_and_send function and set right timeout self.client:loop(900) -- wait 900 ms for response local time_val = { tv_sec=0, -- shift to second tv_nsec = (1000000-math.fmod(systime.gettimeofday().tv_usec, 1000000))*1000} time.nanosleep(time_val) end self.log:info("Exiting") if connected then self.client:disconnect() end end function Daemon:read_and_send() local now = systime.gettimeofday().tv_sec local topic = string.gsub(self.config.mqtt.topic, "{timestamp}", tostring(now)) local result, data = i2c.read(self.config.i2c.bus, self.config.i2c.addr, 12) if result ~= 0 then self.log:error("cannot read from I2C"..i2c.error(result)) return end local values = { -- AVR use little endian -> 0x0200 = 2 nt1=data:byte(1)+data:byte(2)*256, nt2=data:byte(3)+data:byte(4)*256, nt3=data:byte(5)+data:byte(6)*256, vt1=data:byte(7)+data:byte(8)*256, vt2=data:byte(9)+data:byte(10)*256, vt3=data:byte(11)+data:byte(12)*256 } for k, v in pairs(values) do local p_topic = string.gsub(topic, "{phase}", k) self.client:publish(p_topic, v, self.config.mqtt.qos, self.config.mqtt.retain) self.log:debug(p_topic": "..tostring(v)) end end function Daemon:kill() -- try to lock if not self.config.pidfile:lock() then print("Process not running.") else print("Killing process ...") signal.kill(self.config.pidfile:read_pid(), signal.SIGTERM) end end function Daemon:start() print("Starting process ...") local childpid = unistd.fork() if childpid == -1 then self.log:error("Fork failed!") elseif childpid == 0 then if self.config.pidfile:lock() then print("Proccess still running...") os.exit(1) end self.config.pidfile:write_pid() self:run() end end function Daemon:status() -- try to lock if not self.config.pidfile:lock() then print("Process not running.") else print("Process running ... ", self.config.pidfile:read_pid()) end end local function help(prog) local text = [[ usage ]]..prog..[[ [options] command Read data from I2C, and send it to MQTT. positional arguments: command Daemon action (start|stop|restart|status) optional arguments: -h show this help message and exit -c <file> Path to config file. -f Run as script on foreground]] print(text) end local function main(arg) local opts = { foreground = false, config = "/etc/phase2mqtt.conf" } local last = 1 for opt, opterr, i in getopt.getopt(arg, "hfc:") do if opt == 'h' then help(arg[0]) return 0 elseif opt == 'f' then opts.foreground = true elseif opt == 'c' then opts.config = opterr end last = i end local config = Config(opts) if opts.foreground then local daemon = Daemon(config) daemon:run() else local command = arg[last] if not command then io.stderr:write("Error: Command not set!\n") help(arg[0]) return 1 end local daemon = Daemon(config) if command == "start" then daemon:start() elseif command == "stop" then daemon:kill() elseif command == "restart" then daemon:kill() daemon:start() elseif command == "status" then daemon:status() else io.stderr:write("Error: Unknwon command `"..command.."'!\n") help(arg[0]) return 1 end end if config.conf.logging.handler == "syslog" then syslog.closelog() end end return main(arg)
local shell = {} shell.language = "glsl" shell.category = "default" shell.name = "default" shell.vertex = [[ attribute vec2 a_Position; attribute vec3 a_TexCoord; attribute vec4 a_ColorScale; attribute vec4 a_UserData; uniform P_DEFAULT float u_TotalTime; uniform P_DEFAULT float u_DeltaTime; uniform P_UV vec4 u_TexelSize; uniform P_POSITION vec2 u_ContentScale; uniform P_POSITION mat4 u_ViewProjectionMatrix; #define CoronaVertexUserData a_UserData #define CoronaTexCoord a_TexCoord.xy #define CoronaTotalTime u_TotalTime #define CoronaDeltaTime u_DeltaTime #define CoronaTexelSize u_TexelSize #define CoronaContentScale u_ContentScale #if MASK_COUNT > 0 uniform P_POSITION mat3 u_MaskMatrix0; #endif #if MASK_COUNT > 1 uniform P_POSITION mat3 u_MaskMatrix1; #endif #if MASK_COUNT > 2 uniform P_POSITION mat3 u_MaskMatrix2; #endif varying P_POSITION vec2 v_Position; varying P_UV vec2 v_TexCoord; #ifdef TEX_COORD_Z varying P_UV float v_TexCoordZ; #endif varying P_COLOR vec4 v_ColorScale; varying P_DEFAULT vec4 v_UserData; #if MASK_COUNT > 0 varying P_UV vec2 v_MaskUV0; #endif #if MASK_COUNT > 1 varying P_UV vec2 v_MaskUV1; #endif #if MASK_COUNT > 2 varying P_UV vec2 v_MaskUV2; #endif #ifdef Rtt_WEBGL_ENV %s #else P_POSITION vec2 VertexKernel( P_POSITION vec2 position ); #endif void main() { // "varying" are only meant as OUTPUT variables. ie: Write-only variables // meant to provide to a fragment shader, values computed in a vertex // shader. // // Certain devices, like the "Samsung Galaxy Tab 2", DON'T allow you to // use "varying" variable like any other local variables. v_TexCoord = a_TexCoord.xy; #ifdef TEX_COORD_Z v_TexCoordZ = a_TexCoord.z; #endif v_ColorScale = a_ColorScale; v_UserData = a_UserData; P_POSITION vec2 position = VertexKernel( a_Position ); #if MASK_COUNT > 0 v_MaskUV0 = ( u_MaskMatrix0 * vec3( position, 1.0 ) ).xy; #endif #if MASK_COUNT > 1 v_MaskUV1 = ( u_MaskMatrix1 * vec3( position, 1.0 ) ).xy; #endif #if MASK_COUNT > 2 v_MaskUV2 = ( u_MaskMatrix2 * vec3( position, 1.0 ) ).xy; #endif gl_Position = u_ViewProjectionMatrix * vec4( position, 0.0, 1.0 ); } ]] shell.fragment = [[ uniform sampler2D u_FillSampler0; uniform sampler2D u_FillSampler1; uniform P_DEFAULT float u_TotalTime; uniform P_DEFAULT float u_DeltaTime; uniform P_UV vec4 u_TexelSize; uniform P_POSITION vec2 u_ContentScale; varying P_POSITION vec2 v_Position; varying P_UV vec2 v_TexCoord; #ifdef TEX_COORD_Z varying P_UV float v_TexCoordZ; #endif varying P_COLOR vec4 v_ColorScale; varying P_DEFAULT vec4 v_UserData; #define CoronaColorScale( color ) (v_ColorScale*(color)) #define CoronaVertexUserData v_UserData #define CoronaTotalTime u_TotalTime #define CoronaDeltaTime u_DeltaTime #define CoronaTexelSize u_TexelSize #define CoronaContentScale u_ContentScale #define CoronaSampler0 u_FillSampler0 #define CoronaSampler1 u_FillSampler1 #if MASK_COUNT > 0 uniform sampler2D u_MaskSampler0; varying P_UV vec2 v_MaskUV0; #endif #if MASK_COUNT > 1 uniform sampler2D u_MaskSampler1; varying P_UV vec2 v_MaskUV1; #endif #if MASK_COUNT > 2 uniform sampler2D u_MaskSampler2; varying P_UV vec2 v_MaskUV2; #endif #ifdef Rtt_WEBGL_ENV %s #else P_COLOR vec4 FragmentKernel( P_UV vec2 texCoord ); #endif void main() { #ifdef TEX_COORD_Z P_COLOR vec4 result = FragmentKernel( v_TexCoord.xy / v_TexCoordZ ); #else P_COLOR vec4 result = FragmentKernel( v_TexCoord ); #endif #if MASK_COUNT > 0 result *= texture2D( u_MaskSampler0, v_MaskUV0 ).r; #endif #if MASK_COUNT > 1 result *= texture2D( u_MaskSampler1, v_MaskUV1 ).r; #endif #if MASK_COUNT > 2 result *= texture2D( u_MaskSampler2, v_MaskUV2 ).r; #endif gl_FragColor = result; } ]] return shell
--[[ Copyright (c) 2011-2014 chukong-inc.com 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 ngx and ngx.log then -- 如果运行在 print = function(...) local arg = {...} for k,v in pairs(arg) do arg[k] = tostring(v) end ngx.log(ngx.ERR, table.concat(arg, "\t")) end end --[[-- 定义一个作废的接口 ]] function DEPRECATED(newfunction, oldname, newname) return function(...) PRINT_DEPRECATED(string.format("%s() is deprecated, please use %s()", oldname, newname)) return newfunction(...) end end --[[-- 显示作废信息 ]] function PRINT_DEPRECATED(msg) if not DISABLE_DEPRECATED_WARNING then printf("[DEPRECATED] %s", msg) end end --[[-- 打印调试信息 ### 用法示例 ~~~ lua printLog("WARN", "Network connection lost at %d", os.time()) ~~~ @param string tag 调试信息的 tag @param string fmt 调试信息格式 @param [mixed ...] 更多参数 ]] function printLog(tag, fmt, ...) local t = { "[", string.upper(tostring(tag)), "] ", string.format(tostring(fmt), ...) } print(table.concat(t)) end --[[-- 输出 tag 为 ERR 的调试信息 @param string fmt 调试信息格式 @param [mixed ...] 更多参数 ]] function printError(fmt, ...) printLog("ERR", fmt, ...) print(debug.traceback("", 2)) end --[[-- 输出 tag 为 INFO 的调试信息 @param string fmt 调试信息格式 @param [mixed ...] 更多参数 ]] function printInfo(fmt, ...) printLog("INFO", fmt, ...) end --[[-- 输出值的内容 ### 用法示例 ~~~ lua local t = {comp = "chukong", engine = "quick"} dump(t) ~~~ @param mixed value 要输出的值 @param [string desciption] 输出内容前的文字描述 @parma [integer nesting] 输出时的嵌套层级,默认为 3 ]] function dump(value, desciption, nesting) if type(nesting) ~= "number" then nesting = 3 end local lookupTable = {} local result = {} local function _v(v) if type(v) == "string" then v = "\"" .. v .. "\"" end return tostring(v) end local traceback = string.split(debug.traceback("", 2), "\n") print("dump from: " .. string.trim(traceback[3])) local function _dump(value, desciption, indent, nest, keylen) desciption = desciption or "<var>" spc = "" if type(keylen) == "number" then spc = string.rep(" ", keylen - string.len(_v(desciption))) end if type(value) ~= "table" then result[#result +1 ] = string.format("%s%s%s = %s", indent, _v(desciption), spc, _v(value)) elseif lookupTable[value] then result[#result +1 ] = string.format("%s%s%s = *REF*", indent, desciption, spc) else lookupTable[value] = true if nest > nesting then result[#result +1 ] = string.format("%s%s = *MAX NESTING*", indent, desciption) else result[#result +1 ] = string.format("%s%s = {", indent, _v(desciption)) local indent2 = indent.." " local keys = {} local keylen = 0 local values = {} for k, v in pairs(value) do keys[#keys + 1] = k local vk = _v(k) local vkl = string.len(vk) if vkl > keylen then keylen = vkl end values[k] = v end table.sort(keys, function(a, b) if type(a) == "number" and type(b) == "number" then return a < b else return tostring(a) < tostring(b) end end) for i, k in ipairs(keys) do _dump(values[k], k, indent2, nest + 1, keylen) end result[#result +1] = string.format("%s}", indent) end end end _dump(value, desciption, "- ", 1) for i, line in ipairs(result) do print(line) end end
--display and composer settings H = display.contentHeight W = display.contentWidth local composer = require( "composer" ) -- Hide status bar display.setStatusBar( display.HiddenStatusBar ) -- Seed the random number generator math.randomseed( os.time() ) require ("ssk2.loadSSK") _G.ssk.init() display.setDefault("magTextureFilter", "nearest" ) physics.start() physics.setGravity( 0, 0 ) physics.setAverageCollisionPositions(true) physics.setVelocityIterations(8) physics.setPositionIterations(8) display.setDefault("magTextureFilter", "nearest" ) -- Go to the menu screen composer.gotoScene( "scenes.menu" ) physics.setContinuous( false )
local zones = {} function CreateZone(minx, miny, maxx, maxy, z, enter_event, leave_event) local x_diff = maxx - minx local y_diff = maxy - miny local obj = CreateObject(335, minx + (x_diff) / 2, miny + (y_diff) / 2, z + 50, 0, 0, 0, x_diff / 100, y_diff / 100, 3) AddObjectInDimension(obj, GetDimensionByName("base")) SetObjectPropertyValue(obj, "_Zone", true, true) local zone = { minx = minx, miny = miny, maxx = maxx, maxy = maxy, enter_event = enter_event, leave_event = leave_event, obj = obj, } local last = table_last_count(zones) zones[last + 1] = zone return last + 1 end function DestroyZone(zoneid) if zones[zoneid] then local obj = zones[zoneid].obj DestroyObject(obj) zones[zoneid] = nil end end local function CheckZones() for i, v in ipairs(GetAllPlayers()) do if PlayerData[v] then if GetPlayerDimension(v) == GetDimensionByName("base") then local x, y, z = GetPlayerLocation(v) local property = GetPlayerPropertyValue(v, "InZone") for i2, v2 in pairs(zones) do if (x > v2.minx and y > v2.miny and x < v2.maxx and y < v2.maxy) then if not property then --print("Entered in zone") SetPlayerPropertyValue(v, "InZone", i2, false) CallEvent(v2.enter_event, v, i2) end elseif property == i2 then --print("Leaved zone") SetPlayerPropertyValue(v, "InZone", nil, false) CallEvent(v2.leave_event, v, i2) end end end end end end AddEvent("OnPackageStart", function() CreateTimer(CheckZones, 500) end)
local RunService = game:GetService("RunService") local Package = game:GetService("ReplicatedStorage").Fusion local Observer = require(Package.State.Observer) local Value = require(Package.State.Value) return function() it("should fire connections on change", function() local state = Value(false) local observer = Observer(state) local changed = false observer:onChange(function() changed = true end) state:set(true) -- Wait twice in case it gets deferred RunService.RenderStepped:Wait() RunService.RenderStepped:Wait() expect(changed).to.equal(true) end) it("should fire connections only after the value changes", function() local state = Value(false) local observer = Observer(state) local changedValue local completed = false observer:onChange(function(value) changedValue = state:get() completed = true end) state:set(true) -- Wait twice in case it gets deferred RunService.RenderStepped:Wait() RunService.RenderStepped:Wait() expect(changedValue).to.equal(true) end) it("should fire connections only once after the value changes", function() local state = Value(false) local observer = Observer(state) local timesFired = 0 local completed = false observer:onChange(function(value) timesFired += 1 completed = true end) state:set(true) -- Wait twice in case it gets deferred RunService.RenderStepped:Wait() RunService.RenderStepped:Wait() expect(timesFired).to.equal(1) end) end
----------------------------------- -- Area: Batallia Downs -- NPC: qm2 (???) -- Pop for the quest "Chasing Quotas" ----------------------------------- local ID = require("scripts/zones/Batallia_Downs/IDs"); require("scripts/globals/keyitems"); function onTrigger(player,npc) local sturmtigerKilled = player:getCharVar("SturmtigerKilled"); if (player:getCharVar("ChasingQuotas_Progress") == 5 and sturmtigerKilled == 0) then SpawnMob(ID.mob.STURMTIGER,300):updateClaim(player); elseif (sturmtigerKilled == 1) then player:addKeyItem(tpz.ki.RANCHURIOMES_LEGACY); player:messageSpecial(ID.text.KEYITEM_OBTAINED,tpz.ki.RANCHURIOMES_LEGACY); player:setCharVar("ChasingQuotas_Progress",6); player:setCharVar("SturmtigerKilled",0); else player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY); end end; function onTrade(player,npc,trade) end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) end;
local skynet = require "skynet" local string = string local table = table local unpack = unpack local assert = assert local redis_manager local batch = false local redis = {} local command = {} setmetatable(command, { __index = function(t,k) local cmd = string.upper(k) local f = function(self, ...) if batch then skynet.send( self.__handle, "lua", cmd , ...) else local err, result = skynet.call( self.__handle, "lua", cmd, ...) assert(err, result) return result end end t[k] = f return f end}) function command:exists(key) assert(not batch, "exists can't used in batch mode") local result , exists = skynet.call( self.__handle, "lua" , "EXISTS", key) assert(result, exists) exists = exists ~= 0 return exists end function command:batch(mode) if mode == "end" then assert(batch, "Open batch mode first") batch = false local err, result = skynet.unpack(skynet.rawcall( self.__handle, "text", mode)) assert(err, result) return result else assert(mode == "read" or mode == "write") batch = mode skynet.send( self.__handle, "text", mode) end end local meta = { __index = command } function redis.connect(dbname) local handle = skynet.call(redis_manager, "lua", dbname) assert(handle ~= nil) return setmetatable({ __handle = handle } , meta) end skynet.init(function() redis_manager = skynet.uniqueservice("redis-mgr") end, "redis") return redis
bt.register_action("FindNodeInRange", { tick = function(node, data) if data.region == nil or node.regionEmpty == true then print("could not find node in active range") return "failed" end return "success" end, reset = function(node, data) local r = data.region; if r == nil then -- game restarts cause this return end local list = minetest.find_nodes_in_area(r.min, r.max, node.sel) --[[ print("searching for node in region "..node.sel[1].."\n") print("search range: y="..r.min.y.." @ ".. "["..r.min.x..", "..r.min.y..", "..r.min.z.."], ".. "["..r.max.x..", "..r.max.y..", "..r.max.z.."]\n") print("found "..#list.." nodes\n") ]] if list ~= nil and #list > 0 then node.regionEmpty = false local n = list[1] local node = minetest.get_node(n) -- debug -- print("name: " .. node.name .. "\n") -- debug -- print("targeting node ["..n.x..", "..n.y..", "..n.z.."]\n") data.targetPos = n else node.regionEmpty = true end end, ctor = function(sel) return { sel = sel, regionEmpty = false, } end, }) bt.register_action("WalkAllNodesInRange", { tick = function(node, data) if data.region == nil or node.regionEmpty == true then print("could not find node in active range") return "failed" end if not node.initialized then node.cur_pos = vcopy(data.region.min) data.targetPos = vcopy(node.cur_pos) node.done = false node.initialized = true return "success" end if node.done then node.initialized = false return "failed" end data.targetPos = vcopy(node.cur_pos) node.cur_pos.x = node.cur_pos.x + 1 if node.cur_pos.x > data.region.max.x then node.cur_pos.x = data.region.min.x node.cur_pos.z = node.cur_pos.z + 1 if node.cur_pos.z > data.region.max.z then node.cur_pos.z = data.region.min.z node.cur_pos.y = node.cur_pos.y + 1 if node.cur_pos.y > data.region.max.y then node.done = true end end -- else -- print("normal walk " .. node.cur_pos.x .. ","..node.cur_pos.y..","..node.cur_pos.z) end return "success" end, ctor = function(sel) return { sel = sel, regionEmpty = false, cur_pos = {x=0, y=0, z=0}, done = false, initialized = false, } end, }) bt.register_action("WalkNonEmptyNodesInRange", { tick = function(node, data) if data.region == nil or node.regionEmpty == true then print("could not find node in active range") return "failed" end if not node.initialized then node.cur_pos = vcopy(data.region.min) node.done = false node.initialized = true end if node.done then node.initialized = false return "failed" end local found = false while not node.done and not found do local n = minetest.get_node(node.cur_pos) if n and n.name ~= "air" and n.name ~= "ignore" then found = true break end node.cur_pos.x = node.cur_pos.x + 1 if node.cur_pos.x > data.region.max.x then node.cur_pos.x = data.region.min.x node.cur_pos.z = node.cur_pos.z + 1 if node.cur_pos.z > data.region.max.z then node.cur_pos.z = data.region.min.z node.cur_pos.y = node.cur_pos.y + 1 if node.cur_pos.y > data.region.max.y then node.done = true end end -- else -- print("normal walk " .. node.cur_pos.x .. ","..node.cur_pos.y..","..node.cur_pos.z) end end if not found then return "failed" end data.targetPos = vcopy(node.cur_pos) return "success" end, reset = function(node, data) local r = data.region; if r == nil then -- game restarts cause this return end end, ctor = function(sel) return { sel = sel, regionEmpty = false, cur_pos = {x=0, y=0, z=0}, done = false, initialized = false, } end, }) bt.register_action("FindPerimeterNodeInRegion", { tick = function(node, data) if data.region == nil or node.regionEmpty == true then -- debug -- print("could not find edge node in active region") return "failed" end return "success" end, reset = function(node, data) local r = data.region; if r == nil then -- game restarts cause this return end node.regionEmpty = false local list -- first try the x+ edge list = minetest.find_nodes_in_area({ x= r.max.x, y= r.min.y, z= r.min.z, }, { x= r.max.x, y= r.max.y, z= r.max.z, }, node.sel) if list ~= nil and #list > 0 then local n = list[1] local node = minetest.get_node(n) -- debug -- print("name: " .. node.name .. "\n") -- debug -- print("targeting node ["..n.x..", "..n.y..", "..n.z.."]\n") data.targetPos = n return end -- next try the z+ edge list = minetest.find_nodes_in_area({ x= r.min.x, y= r.min.y, z= r.max.z, }, { x= r.max.x, y= r.max.y, z= r.max.z, }, node.sel) if list ~= nil and #list > 0 then local n = list[1] local node = minetest.get_node(n) -- debug -- print("name: " .. node.name .. "\n") -- debug -- print("targeting node ["..n.x..", "..n.y..", "..n.z.."]\n") data.targetPos = n return end -- next try the x- edge list = minetest.find_nodes_in_area({ x= r.min.x, y= r.min.y, z= r.min.z, }, { x= r.min.x, y= r.max.y, z= r.max.z, }, node.sel) if list ~= nil and #list > 0 then local n = list[1] local node = minetest.get_node(n) -- debug -- print("name: " .. node.name .. "\n") -- debug -- print("targeting node ["..n.x..", "..n.y..", "..n.z.."]\n") data.targetPos = n return end -- lastly try the z- edge list = minetest.find_nodes_in_area({ x= r.min.x, y= r.min.y, z= r.min.z, }, { x= r.max.x, y= r.max.y, z= r.min.z, }, node.sel) if list ~= nil and #list > 0 then local n = list[1] local node = minetest.get_node(n) -- debug -- print("name: " .. node.name .. "\n") -- debug -- print("targeting node ["..n.x..", "..n.y..", "..n.z.."]\n") data.targetPos = n return end -- no nodes left node.regionEmpty = true end, ctor = function(sel) return { sel = sel, regionEmpty = false, } end, }) bt.register_action("ScaleRegion", { tick = function(node, data) if data.region == nil then -- debug -- print("no active region") return "failed" end return "success" end, reset = function(node, data) local r = data.region; if r == nil then -- game restarts cause this return end data.region = { min={x = r.min.x - node.scale.x, y = r.min.y - node.scale.y, z = r.min.z - node.scale.z}, max={x = r.max.x + node.scale.x, y = r.max.y + node.scale.y, z = r.max.z + node.scale.z}, } r = data.region --[[ print("region scaled to: y="..r.min.y.." @ ".. "["..r.min.x..", "..r.min.y..", "..r.min.z.."], ".. "["..r.max.x..", "..r.max.y..", "..r.max.z.."]\n") ]] end, ctor = function(scale) return { scale = scale, } end, }) bt.register_action("MoveRegion", { tick = function(node, data) if data.region == nil then -- debug -- print("no active region") return "failed" end return "success" end, reset = function(node, data) local r = data.region; if r == nil then -- game restarts cause this return end data.region = { min={x = r.min.x + node.scale.x, y = r.min.y + node.scale.y, z = r.min.z + node.scale.z}, max={x = r.max.x + node.scale.x, y = r.max.y + node.scale.y, z = r.max.z + node.scale.z}, } r = data.region --[[ print("region moved to: y="..r.min.y.." @ ".. "["..r.min.x..", "..r.min.y..", "..r.min.z.."], ".. "["..r.max.x..", "..r.max.y..", "..r.max.z.."]\n") ]] end, ctor = function(scale) return { scale = scale, } end, }) bt.register_action("FindRegionAround", { tick = function(node, data) if data.targetPos == nil then -- debug -- print("could not find spot on ground") return "failed" end return "success" end, reset = function(node, data) -- really shitty quick hack if data.targetPos ~= nil then local tp = data.targetPos tp.y = tp.y - 1 data.region = { min= {x=tp.x - node.radius, y=tp.y, z=tp.z - node.radius}, max= {x=tp.x + node.radius, y=tp.y, z=tp.z + node.radius}, } --[[ print("range set to y="..tp.y.." @ ".. "["..data.region.min.x..", "..data.region.min.z.."], ".. "["..data.region.max.x..", "..data.region.max.z.."]\n") ]] end end, ctor = function(radius) return { radius = radius, } end, })
--[[-- h1. four.V4 4D float vectors Given a vector @v@ we denote by @vi@ its one-based @i@th component. --]]-- local lub = require 'lub' local four = require 'four' local lib = lub.class 'four.V4' -- h2. Constructor and accessors --[[-- @V4(x, y, z, w)@ is a vector with the corresponding components. @V4(o)@ is a vector converted from the object @o@. Supported types for @o@: @bt.Vector4@. --]]-- function lib.new(x, y, z, w) local v = {} if y then v = { x, y, z, w } else if x.type == "bt.Vector4" then v = { x:getX(), x:getY(), x:getZ(), x:getW()} else assert(false, string.format("Cannot convert %s to %s", x.type, lib.type)) end end setmetatable(v, lib) return v end local V4 = lib.new -- @x(v)@ is the @x@ component of @v@. function lib.x(v) return v[1] end -- @y(v)@ is the @y@ component of @v@. function lib.y(v) return v[2] end -- @z(v)@ is the @z@ component of @v@. function lib.z(v) return v[3] end -- @w(v)@ is the @w@ component of @v@. function lib.z(v) return v[4] end -- @comp(i, v)@ is the @i@th component of @v@. function lib.comp(i, v) return v[i] end -- h2. Converters -- @ofV2(v, z, w)@ is @V4(V2.x(v), V2.y(v), z, w)@. function lib.ofV2(v, z, w) return V4(v[1], v[2], z, w) end -- @ofV3(v, w)@ is @V4(V3.x(v), V3.y(v), V3.z(v), w)@. function lib.ofV3(v, w) return V4(v[1], v[2], v[3], w) end -- @tuple(v)@ is @x, y, z, w@, the components of @v@. function lib.tuple(v) return v[1], v[2], v[3], v[4] end -- @tostring(v)@ is a textual representation of @v@. function lib.tostring(v) return string.format("(%g %g %g %g)", v[1], v[2], v[3], v[4]) end -- h2. Constants -- @zero()@ is a vector @(0, 0, 0, 0)@. function lib.zero() return V4(0, 0, 0, 0) end -- @ox()@ is a unit vector @(1, 0, 0, 0)@. function lib.ox() return V4(1, 0, 0, 0) end -- @oy()@ is a unit vector @(0, 1, 0, 0)@. function lib.oy() return V4(0, 1, 0, 0) end -- @oz()@ is a unit vector @(0, 0, 1, 0)@. function lib.oz() return V4(0, 0, 1, 0) end -- @ow()@ is a unit vector @(0, 0, 0, 1)@. function lib.ow() return V4(0, 0, 0, 1) end -- @huge()@ is a vector whose components are @math.huge@. function lib.huge() return V4(math.huge, math.huge, math.huge, math.huge) end -- @neg_huge()@ is a vector whose components are @-math.huge@. function lib.neg_huge () return V4(-math.huge, -math.huge, -math.huge, -math.huge) end -- h2. Functions -- @neg(v)@ is the inverse vector @-v@. function lib.neg(v) return V4(-v[1], -v[2], -v[3], -v[4]) end -- @add(u, v)@ is the vector addition @u + v@. function lib.add(u, v) return V4(u[1] + v[1], u[2] + v[2], u[3] + v[3], u[4] + v[4]) end -- @sub(u, v)@ is the vector subtraction @u - v@. function lib.sub(u, v) return V4(u[1] - v[1], u[2] - v[2], u[3] - v[3], u[4] - v[4]) end -- @mul(u, v)@ is the component wise mutiplication @u * v@. function lib.mul(u, v) return V4(u[1] * v[1], u[2] * v[2], u[3] * v[3], u[4] * v[4]) end -- @div(u, v)@ is the component wise division @u / v@. function lib.div(u, v) return V4(u[1] / v[1], u[2] / v[2], u[3] / v[3], u[4] / v[4]) end -- @smul(s, v)@ is the scalar mutiplication @sv@. function lib.smul(s, v) return V4(s * v[1], s * v[2], s * v[3], s * v[4]) end -- @half(v)@ is the half vector @smul(0.5, v)@. function lib.half(v) return V4(0.5 * v[1], 0.5 * v[2], 0.5 * v[3], 0.5 * v[4]) end -- @dot(u, v)@ is the dot product @u.v@. function lib.dot(u, v) return u[1] * v[1] + u[2] * v[2] + u[3] * v[3] + u[4] * v[4] end -- @norm(v)@ is the norm @|v|@. function lib.norm(v) return math.sqrt (v[1] * v[1] + v[2] * v[2] + v[3] * v[3] + v[4] * v[4]) end -- @norm2(v)@ is the squared norm @|v|^2@. function lib.norm2(v) return v[1] * v[1] + v[2] * v[2] + v[3] * v[3] + v[4] * v[4] end -- @unit(v)@ is the unit vector @v/|v|@. function lib.unit(v) return lib.smul(1 / lib.norm(v), v) end -- @homogene(v)@ is the vector @v/V4.w(v)@. function lib.homogene(v) return V4(v[1] / v[4], v[2] / v[4], v[3] / v[4], 1.0) end -- @mix(u, v, t)@ is the linear interpolation @u + t * (v - u)@. function lib.mix(u, v, t) return V4 (u[1] + t * (v[1] - u[1]), u[2] + t * (v[2] - u[2]), u[3] + t * (v[3] - u[3]), u[4] + t * (v[4] - u[4])) end -- @trVec(m, v)@ is the *vector* @v@ transformed by the @M4@ matrix @m@. function lib.trVec(m, v) return V4 (m[1] * v[1] + m[5] * v[2] + m[ 9] * v[3] + m[13] * v[4], m[2] * v[1] + m[6] * v[2] + m[10] * v[3] + m[14] * v[4], m[3] * v[1] + m[7] * v[2] + m[11] * v[3] + m[15] * v[4], m[4] * v[1] + m[8] * v[2] + m[12] * v[3] + m[16] * v[4]) end -- h2. Taversal -- @map(f, v)@ is @V3(f(v1), f(v2), f(v3), f(v4))@. function lib.map(f, v) return V4(f(v[1]), f(v[2]), f(v[3]), f(v[4])) end -- @mapi(f, v)@ is @V3(f(1, v1), f(2, v2), f(3, v3), f(4, v4))@. function lib.mapi(f, v) return V4(f(1, v[1]), f(2, v[2]), f(3, v[3]), f(4, v[4])) end -- @fold(f, acc, v)@ is @f(f(f(f(acc, v1), v2), v3), v4)@. function lib.fold(f, acc, v) return f(f(f(f(acc, v[1]), v[2]), v[3]), v[4]) end -- @foldi(f, acc, v)@ is @f(f(f(f(acc, 1, v1), 2, v2), 3, v3), 4, v4)@. function lib.foldi(f, acc, v) return f(f(f(f(acc, 1, v[1]), 2, v[2]), 3, v[3]), 4, v[4]) end -- @iter(f, v)@ is @f(v1) f(v2) f(v3) f(v4)@. function lib.iter(f, v) f(v[1]); f(v[2]); f(v[3]); f(v[4]) end -- @iteri(f, v)@ is @f(1, v1) f(2, v2) f(3, v3) f(4, v4)@. function lib.iteri(f, v) f(1, v[1]); f(2, v[2]); f(3, v[3]); f(4, v[4]) end -- h2. Predicates -- @forAll(p, v)@ is @p(v1) and p(v2) and p(v3) and p(v4)@. function lib.forAll(p, v) return p(v[1]) and p(v[2]) and p(v[3]) and p(v[4]) end -- @exists(p, v)@ is @p(v1) or p(v2) or p(v3)@ or p(v4)@. function lib.exists(p, v) return p(v[1]) or p(v[2]) or p(v[3]) or p(v[4]) end --[[-- @eq(u, v [,eq])@ is @true@ if @u@ is equal to @v@ component wise. If [eq] is provided it used as the equality function. --]]-- function lib.eq(u, v, eq) if eq then return eq(u[1],v[1]) and eq(u[2],v[2]) and eq(u[3],v[3]) and eq(u[4],v[4]) else return u[1] == v[1] and u[2] == v[2] and u[3] == v[3] and u[4] == v[4] end end --[[-- @lt(u, v [,lt])@ is @true@ if @u@ is lower than @v@ component wise. If [lt] is provided it used as the comparison function. --]]-- function lib.lt(u, v, lt) if lt then return lt(u[1],v[1]) and lt(u[2],v[2]) and lt(u[3],v[3]) and lt(u[4],v[4]) else return u[1] < v[1] and u[2] < v[2] and u[3] < v[3] and u[4] < v[4] end end --[[-- @le(u, v [,le])@ is @true@ if @u@ is lower or equal than @v@ component wise. If [le] is provided it used as the comparison function. --]]-- function lib.le(u, v, le) if le then return le(u[1],v[1]) and le(u[2],v[2]) and le(u[3],v[3]) and le(u[4],v[4]) else return u[1] <= v[1] and u[2] <= v[2] and u[3] <= v[3] and u[4] <= v[4] end end --[[-- @compare(u, v [, cmp])@ is: * @-1@ if @u@ is smaller than @v@ * @0@ if @u@ is equal to @v@ * @1@ if @u@ is greater than @v@ where the order is the lexicographic order defined by using @cmp@ on the components (@cmp@ defaults to the standard order on floats). --]]-- function lib.compare(u, v, cmp) local cmp = cmp or function (a, b) if a < b then return -1 elseif a > b then return 1 else return 0 end end local c c = cmp(u[1], v[1]) if c ~= 0 then return c end c = cmp(u[2], v[2]) if c ~= 0 then return c end c = cmp(u[3], v[3]) if c ~= 0 then return c end c = cmp(u[4], v[4]) return c end -- h2. Operators lib.__unm = lib.neg lib.__add = lib.add lib.__sub = lib.sub lib.__mul = lib.smul lib.__tostring = lib.tostring return lib
-- Given a parsed .SVD file (in Lua table form), print out some registers -- Generic version. Useful for Pico and GD32? -- Strip any trailing spaces or tabs, then append a newline. function out(format, ...) local s = string.format(format, ...) s = s:gsub("[ ]+$", "") io.write(s .. "\n") end -- Function to visit each branch and leaf of a tree. -- -- Gets passed two functions: a function for branches and a function for -- leaves. Returns a function that takes a tree and any number of -- arguments, which are passed along as accumulators or whatever. visit() -- doesn't know or care about them. -- -- Also note that visit() does *not* recurse into branches! That's -- fn_branch's job, if that's what it wants to do. visit() will, by -- default, only visit the "top-level" nodes of tree. function visit(fn_branch, fn_leaf) return function(tree, ...) for _, node in ipairs(tree) do local k, v = next(node) if type(v) == "table" then -- process branch node fn_branch(k, v, ...) else -- process leaf node fn_leaf(k, v, ...) end end return ... end end function hex(s) return tonumber(s, 16) end function muhex(num) return string.format("%04x_%04x", num >> 16, num % (2^16)) end -- Convert parens to square brackets so muforth comments don't barf function unparen(s) return (s:gsub("%(", "[") :gsub("%)", "]")) end -- RP2040 descriptions have embedded "\n" and can be quite long. Cut at -- first "\n". Also cut at first ".". function fix_descr(d) if not d then return "" end d = d:gsub("\\n", " ") :gsub("&amp;", "and") :gsub("&lt;", "<") :gsub("&gt;", ">") return "| " .. d end function nicer_chip_name(fname) local c = fname:match "^%w+" -- strip extension c = c:gsub("x", "@") :upper() :gsub("@", "x") return c end function print_header(c, name, srcpath) out "( Automagically generated. DO NOT EDIT!" out " Generated by https://github.com/nimblemachines/kinetis-chip-equates/" out(" from CMSIS-SVD source file %s)\n", srcpath) out("loading %s equates\n", name) out [[ sealed .equates. ( chip equates and other constants for target) ( First, a few defining words, which we'll use to load the "equates".) : equ ( offset) current preserve .equates. definitions constant ; : vector ( offset) equ ; : | \ -- ; ( | ignores the bit-fields that follow each register name) : aka .equates. chain' execute ; ( for making synonyms) hex]] end function max_name_length(t) local max = 0 for _, e in ipairs(t) do max = math.max(e.name:len(), max) end return max end --[[ function print_vectors(c) local print_vector = function(vecfmt, name, vector, description) if not name:match "[Ii][Rr][Qq]" then name = name .. "_irq" end if not description then description = string.format("IRQ %2d", vector) else description = string.format("IRQ %2d: %s", vector, description) end out(vecfmt, (vector + 16) * 4, name, description) end out "\n( Vectors)" table.sort(c.interrupts, function(x, y) return x.vector < y.vector end) local longest = max_name_length(c.interrupts) local vecfmt = string.format("%%04x vector %%-%ds | %%s", longest + 3) for _, irq in ipairs(c.interrupts) do print_vector(vecfmt, irq.name, irq.vector, irq.description) end print_vector( vecfmt, "LAST", c.interrupts[#c.interrupts].vector + 1, "dummy LAST vector to mark end of vector table") end --]] function print_periphs(c) out "\n( Register addresses)" table.sort(c.periphs, function(x, y) return x.base_address < y.base_address end) for _, periph in ipairs(c.periphs) do out("\n( %s)", periph.name) table.sort(periph.regs, function(x, y) return x.address_offset < y.address_offset end) local max_regname_len = 0 for _, reg in ipairs(periph.regs) do max_regname_len = math.max(reg.name:len(), max_regname_len) end local regfmt = string.format("%%s equ %%-%ds %%s", max_regname_len + periph.name:len() + 3) for _, reg in ipairs(periph.regs) do out(regfmt, muhex(reg.address_offset + periph.base_address), periph.name .. "_" .. reg.name, fix_descr(reg.description)) end end end function process_chip(chip) local append = table.insert local as_equates as_equates = visit( function(k, v, path, ctx) path = path.."/"..k if path == "/peripherals" then -- reset context ctx.periphs = {} ctx.interrupts = {} elseif path == "/peripherals/peripheral" then -- reset context ctx.periph = {} elseif path == "/peripherals/peripheral/interrupt" then -- reset context ctx.interrupt = {} elseif path == "/peripherals/peripheral/registers" then -- reset context ctx.regs = {} elseif path == "/peripherals/peripheral/registers/register" then -- reset context ctx.reg = {} elseif path == "/peripherals/peripheral/registers/register/fields" then -- reset context ctx.fields = {} elseif path == "/peripherals/peripheral/registers/register/fields/field" then -- reset context ctx.field = {} end -- Recurse into subtable as_equates(v, path, ctx) if path == "/peripherals/peripheral/registers/register/fields/field" then append(ctx.fields, ctx.field) elseif path == "/peripherals/peripheral/registers/register" then append(ctx.regs, ctx.reg) elseif path == "/peripherals/peripheral/interrupt" then local vector = tonumber(ctx.interrupt.value) append(ctx.interrupts, { name = ctx.interrupt.name, vector = vector }) elseif path == "/peripherals/peripheral" then ctx.periph.regs = ctx.regs append(ctx.periphs, ctx.periph) elseif path == "/peripherals" then -- Nothing end end, function(k, v, path, ctx) if path == "" then ctx.chip[k] = v elseif path == "/peripherals/peripheral" then ctx.periph[k] = v elseif path == "/peripherals/peripheral/interrupt" then ctx.interrupt[k] = v elseif path == "/peripherals/peripheral/registers/register" then ctx.reg[k] = v elseif path == "/peripherals/peripheral/registers/register/fields/field" then ctx.field[k] = v end end) local path, ctx = as_equates(chip, "", { chip = {} }) return ctx end -- arg 1 is lua file to process -- arg 2 is href or path to SVD file function doit() local ctx = process_chip(dofile(arg[1])) print_header(ctx, nicer_chip_name(arg[1]), arg[2]) -- print_vectors(ctx) print_periphs(ctx) end doit()
include("names") include("set_names") imenilac1 = math.random(7) + 1; imenilac2 = math.random(5) + 1; factor = math.random(10); cinilac =(imenilac1*imenilac2 - imenilac1 - imenilac2 + 1) ostalo = cinilac * factor ukupno = imenilac1 * imenilac2 * factor
--Electric Train local neockys_trains_1 = table.deepcopy(data.raw['item-with-entity-data']['locomotive']) neockys_trains_1.name = "nt-train-electric" neockys_trains_1.icon = "__Neockys-Trains__/graphics/loc.png" neockys_trains_1.order = "a[train-system]-fz[diesel-locomotive]" neockys_trains_1.place_result = "nt-train-electric" neockys_trains_1.subgroup = "transport" --Fusion Train local nt_train_2 = table.deepcopy(data.raw['item-with-entity-data']['locomotive']) nt_train_2.name = "nt-train-fusion" nt_train_2.icon = "__Neockys-Trains__/graphics/loc.png" nt_train_2.order = "a[train-system]-fz[diesel-locomotive]-te[nt-train-electric]-tf[nt-train-fusion]" nt_train_2.place_result = "nt-train-fusion" nt_train_2.subgroup = "transport" --Nuclear Train local nt_train_3 = table.deepcopy(data.raw['item-with-entity-data']['locomotive']) nt_train_3.name = "nt-train-nuclear" nt_train_3.icon = "__Neockys-Trains__/graphics/loc.png" nt_train_3.order = "a[train-system]-fz[diesel-locomotive]-te[nt-train-electric]" nt_train_3.place_result = "nt-train-nuclear" nt_train_3.subgroup = "transport" data:extend({ { --Charged battery type = "item", name = "nt-charged-battery", icon = "__Neockys-Trains__/graphics/nt-charged-battery.png", icon_size = 32, order = "p[rocket-fuel]-bt[nt-battery]", subgroup = "intermediate-product", fuel_category = "nt-battery", fuel_acceleration_multiplier = 2.0, fuel_glow_color = {r=58, g=51, b=255, a=0.5}, fuel_top_speed_multiplier = 1.0, fuel_value = "100MJ", stack_size = 50 } }) data:extend({neockys_trains_1, nt_train_2, nt_train_3, nt_charged_battery})
object_tangible_collection_gem_square_hueable_01 = object_tangible_collection_shared_gem_square_hueable_01:new { gameObjectType = 8211,} ObjectTemplates:addTemplate(object_tangible_collection_gem_square_hueable_01, "object/tangible/collection/gem_square_hueable_01.iff")
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ========== PlaceObj('StoryBit', { ActivationEffects = {}, Delay = 6300000, Effects = {}, Enables = { "ChildrenOfTomorrow_TheAdvent2_Repeatable", }, Prerequisites = {}, ScriptDone = true, Text = T(404362775314, --[[StoryBit ChildrenOfTomorrow_TheAdvent2 Text]] "The newly-fledged youths show remarkable new qualities, inspiring even the older Martianborn to follow into their steps and reshaping the Martian culture. You encouraged the children to pursue their imagination, the resulting new culture on Mars producing daring, artistic and creative people.\n\n<effect>Martianborn will periodically gain <morale_up> Morale for <sols(morale_up_sols)> Sols."), TextReadyForValidation = true, TextsDone = true, Title = T(837105083158, --[[StoryBit ChildrenOfTomorrow_TheAdvent2 Title]] "Children of Tomorrow: The Advent"), VoicedText = T(217640954079, --[[voice:narrator]] "The Martianborn children we observed have already stepped through into the difficult and exciting period of young adulthood, making their first uneasy steps among the Martian society."), group = "Breakthroughs", id = "ChildrenOfTomorrow_TheAdvent2", PlaceObj('StoryBitParamNumber', { 'Name', "morale_up", 'Value', 10, }), PlaceObj('StoryBitParamSols', { 'Name', "morale_up_sols", 'Value', 3600000, }), })
local dreamBlock = {} dreamBlock.name = "dreamBlock" dreamBlock.fillColor = {0.0, 0.0, 0.0} dreamBlock.borderColor = {1.0, 1.0, 1.0} dreamBlock.nodeLineRenderType = "line" dreamBlock.nodeLimits = {0, 1} dreamBlock.placements = { name = "dream_block", data = { fastMoving = false, below = false, width = 8, height = 8 } } function dreamBlock.depth(room, entity) return entity.below and 5000 or -11000 end return dreamBlock
local delta = 0 local size = 0 local cw = nil local clump_inner = Material("arccw/hud/clump_inner.png", "mips smooth") local clump_outer = Material("arccw/hud/clump_outer.png", "mips smooth") local aimtr_result = {} local aimtr = {} function SWEP:ShouldDrawCrosshair() if GetConVar("arccw_override_crosshair_off"):GetBool() then return false end if !GetConVar("arccw_crosshair"):GetBool() then return false end if self:GetReloading() then return false end if self:BarrelHitWall() > 0 then return false end local asight = self:GetActiveSights() if !self:GetOwner():ShouldDrawLocalPlayer() and self:GetState() == ArcCW.STATE_SIGHTS and !asight.CrosshairInSights then return false end if self:GetState() == ArcCW.STATE_SPRINT and !(self:GetBuff_Override("Override_ShootWhileSprint") or self.ShootWhileSprint) then return false end if self:GetCurrentFiremode().Mode == 0 then return false end if self:GetBuff_Hook("Hook_ShouldNotFire") then return false end if self:GetState() == ArcCW.STATE_CUSTOMIZE then return false end return true end function SWEP:DoDrawCrosshair(x, y) local ply = LocalPlayer() local pos = ply:EyePos() local ang = ply:EyeAngles() - self:GetOurViewPunchAngles() local dot = true local prong_top = true local prong_left = true local prong_right = true local prong_down = true local prong_len = GetConVar("arccw_crosshair_length"):GetFloat() local prong_wid = GetConVar("arccw_crosshair_thickness"):GetFloat() local prong_out = GetConVar("arccw_crosshair_outline"):GetInt() local clr = Color(GetConVar("arccw_crosshair_clr_r"):GetInt(), GetConVar("arccw_crosshair_clr_g"):GetInt(), GetConVar("arccw_crosshair_clr_b"):GetInt()) if GetConVar("arccw_ttt_rolecrosshair") and GetConVar("arccw_ttt_rolecrosshair"):GetBool() then if GetRoundState() == ROUND_PREP or GetRoundState() == ROUND_POST then clr = Color(255, 255, 255) elseif ply.GetRoleColor and ply:GetRoleColor() then clr = ply:GetRoleColor() -- TTT2 feature elseif ply:IsActiveTraitor() then clr = Color(255, 50, 50) elseif ply:IsActiveDetective() then clr = Color(50, 50, 255) else clr = Color(50, 255, 50) end end clr.a = GetConVar("arccw_crosshair_clr_a"):GetInt() local outlineClr = Color(GetConVar("arccw_crosshair_outline_r"):GetInt(), GetConVar("arccw_crosshair_outline_g"):GetInt(), GetConVar("arccw_crosshair_outline_b"):GetInt(), GetConVar("arccw_crosshair_outline_a"):GetInt()) local gap = ScreenScale(24) * (GetConVar("arccw_crosshair_static"):GetBool() and 0.25 or math.Clamp(self:GetDispersion() / 1000, 0.1, 100)) * GetConVar("arccw_crosshair_gap"):GetFloat() gap = gap + ScreenScale(8) * math.Clamp(self.RecoilAmount, 0, 1) local prong = ScreenScale(prong_len) local p_w = ScreenScale(prong_wid) local p_w2 = p_w + prong_out cw = cw or self local sp if self:GetOwner():ShouldDrawLocalPlayer() then local tr = util.GetPlayerTrace(self:GetOwner()) local trace = util.TraceLine( tr ) cam.Start3D() local coords = trace.HitPos:ToScreen() cam.End3D() sp = { visible = true, x = coords.x, y = coords.y } end cam.Start3D() sp = (pos + (ang:Forward() * 3200)):ToScreen() cam.End3D() if GetConVar("arccw_crosshair_trueaim"):GetBool() then aimtr.start = self:GetShootSrc() else aimtr.start = pos end aimtr.endpos = aimtr.start + (ply:GetAimVector() * 100000) aimtr.filter = {ply} aimtr.output = aimtr_result table.Add(aimtr.filter, ArcCW:GetVehicleFilter(ply) or {}) util.TraceLine(aimtr) cam.Start3D() local w2s = aimtr_result.HitPos:ToScreen() cam.End3D() sp.x = w2s.x sp.y = w2s.y x, y = sp.x, sp.y local st = self:GetSightTime() / 2 if self:ShouldDrawCrosshair() then delta = math.Approach(delta, 1, FrameTime() * 1 / st) else delta = math.Approach(delta, 0, FrameTime() * 1 / st) end if GetConVar("arccw_crosshair_equip"):GetBool() and self:GetBuff("ShootEntity", true) then gap = gap * 1.5 prong = ScreenScale(prong_wid) p_w = ScreenScale(prong_wid) p_w2 = p_w + prong_out end if GetConVar("arccw_crosshair_equip"):GetBool() and self.PrimaryBash then dot = false gap = gap * 2 prong = ScreenScale(prong_wid) p_w = ScreenScale(prong_wid) p_w2 = p_w + prong_out end if GetConVar("arccw_crosshair_dot"):GetBool() and dot then surface.SetDrawColor(outlineClr.r, outlineClr.g, outlineClr.b, outlineClr.a * delta) surface.DrawRect(x - p_w2 / 2, y - p_w2 / 2, p_w2, p_w2) surface.SetDrawColor(clr.r, clr.g, clr.b, clr.a * delta) surface.DrawRect(x - p_w / 2, y - p_w / 2, p_w, p_w) end local num = (self:GetBuff_Override("Override_Num") or self.Num) + self:GetBuff_Add("Add_Num") size = math.Approach(size, gap, FrameTime() * 32 * gap) if cw != self then delta = 0 size = gap end cw = self gap = size gap = gap * delta if GetConVar("arccw_crosshair_shotgun"):GetBool() and num > 1 then dot = false gap = gap * 2.5 prong = ScreenScale(prong_wid) p_w = ScreenScale(prong_len) p_w2 = p_w + prong_out end local prong2 = prong + prong_out surface.SetDrawColor(outlineClr.r, outlineClr.g, outlineClr.b, outlineClr.a * delta) if prong_left then surface.DrawRect(x - gap - prong2 + prong_out / 2, y - p_w2 / 2, prong2, p_w2) end if prong_right then surface.DrawRect(x + gap - prong_out / 2, y - p_w2 / 2, prong2, p_w2) end if prong_top then surface.DrawRect(x - p_w2 / 2, y - gap - prong2 + prong_out / 2, p_w2, prong2) end if prong_down then surface.DrawRect(x - p_w2 / 2, y + gap - prong_out / 2, p_w2, prong2) end surface.SetDrawColor(clr.r, clr.g, clr.b, clr.a * delta) if prong_left then surface.DrawRect(x - gap - prong, y - p_w / 2, prong, p_w) end if prong_right then surface.DrawRect(x + gap, y - p_w / 2, prong, p_w) end if prong_top then surface.DrawRect(x - p_w / 2, y - gap - prong, p_w, prong) end if prong_down then surface.DrawRect(x - p_w / 2, y + gap, p_w, prong) end if GetConVar("arccw_crosshair_clump"):GetBool() and (GetConVar("arccw_crosshair_clump_always"):GetBool() or num > 1) then local spread = ArcCW.MOAToAcc * self:GetBuff("AccuracyMOA") local clumpSize = math.Clamp(2048 * spread, 8, 1024) if GetConVar("arccw_crosshair_clump_outline"):GetBool() then surface.SetDrawColor(outlineClr.r, outlineClr.g, outlineClr.b, outlineClr.a * delta) surface.SetMaterial(clump_outer) surface.DrawTexturedRect(x - clumpSize / 2, y - clumpSize / 2, clumpSize, clumpSize) end surface.SetDrawColor(clr.r, clr.g, clr.b, clr.a * delta) surface.SetMaterial(clump_inner) surface.DrawTexturedRect(x - clumpSize / 2, y - clumpSize / 2, clumpSize, clumpSize) end return true end
-- Copyright 2016-2019, Firaxis Games -- =========================================================================== -- CityPanel v3 -- =========================================================================== include("AdjacencyBonusSupport") -- GetAdjacentYieldBonusString() include("CitySupport") include("Civ6Common") -- GetYieldString() include("Colors") include("InstanceManager") include("SupportFunctions") -- Round(), Clamp() include("PortraitSupport") include("ToolTipHelper") include("GameCapabilities") include("MapUtilities") include("cui_data") -- CUI include("cui_settings") -- CUI -- =========================================================================== -- DEBUG -- Toggle these for temporary debugging help. -- =========================================================================== local m_debugAllowMultiPanel = false -- (false default) Let's multiple sub-panels show at one time. -- =========================================================================== -- GLOBALS -- Accessible in overriden files. -- =========================================================================== g_pCity = nil g_growthPlotId = -1 g_growthHexTextWidth = -1 -- =========================================================================== -- CONSTANTS -- =========================================================================== local ANIM_OFFSET_OPEN = -73 local ANIM_OFFSET_OPEN_WITH_PRODUCTION_LIST = -250 local SIZE_SMALL_RELIGION_ICON = 22 local SIZE_LEADER_ICON = 32 local SIZE_PRODUCTION_ICON = 32 -- TODO: Switch this to 38 when the icons go in. local SIZE_MAIN_ROW_LEFT_WIDE = 270 local SIZE_MAIN_ROW_LEFT_COLLAPSED = 157 local TXT_NO_PRODUCTION = Locale.Lookup("LOC_HUD_CITY_PRODUCTION_NOTHING_PRODUCED") local MAX_BEFORE_TRUNC_TURN_LABELS = 160 local MAX_BEFORE_TRUNC_STATIC_LABELS = 112 local HEX_GROWTH_TEXT_PADDING = 10 local UV_CITIZEN_GROWTH_STATUS = {} UV_CITIZEN_GROWTH_STATUS[0] = {u = 0, v = 0} -- revolt UV_CITIZEN_GROWTH_STATUS[1] = {u = 0, v = 0} -- unrest UV_CITIZEN_GROWTH_STATUS[2] = {u = 0, v = 0} -- unhappy UV_CITIZEN_GROWTH_STATUS[3] = {u = 0, v = 50} -- displeased UV_CITIZEN_GROWTH_STATUS[4] = {u = 0, v = 100} -- content (normal) UV_CITIZEN_GROWTH_STATUS[5] = {u = 0, v = 150} -- happy UV_CITIZEN_GROWTH_STATUS[6] = {u = 0, v = 200} -- ecstatic local UV_HOUSING_GROWTH_STATUS = {} UV_HOUSING_GROWTH_STATUS[0] = {u = 0, v = 0} -- slowed UV_HOUSING_GROWTH_STATUS[1] = {u = 0, v = 100} -- normal local UV_CITIZEN_STARVING_STATUS = {} UV_CITIZEN_STARVING_STATUS[0] = {u = 0, v = 0} -- starving UV_CITIZEN_STARVING_STATUS[1] = {u = 0, v = 100} -- normal local PANEL_INFOLINE_LOCATIONS = {} PANEL_INFOLINE_LOCATIONS[0] = 20 PANEL_INFOLINE_LOCATIONS[1] = 45 PANEL_INFOLINE_LOCATIONS[2] = 71 PANEL_INFOLINE_LOCATIONS[3] = 94 local PANEL_BUTTON_LOCATIONS = {} PANEL_BUTTON_LOCATIONS[0] = {x = 85, y = 18} PANEL_BUTTON_LOCATIONS[1] = {x = 99, y = 42} PANEL_BUTTON_LOCATIONS[2] = {x = 95, y = 69} PANEL_BUTTON_LOCATIONS[3] = {x = 79, y = 90} local HOUSING_LABEL_OFFSET = 66 -- Mirrored in ProductionPanel local LISTMODE = {PRODUCTION = 1, PURCHASE_GOLD = 2, PURCHASE_FAITH = 3, PROD_QUEUE = 4} m_PurchasePlot = UILens.CreateLensLayerHash("Purchase_Plot") local m_CitizenManagement = UILens.CreateLensLayerHash("Citizen_Management") -- =========================================================================== -- MEMBERS -- =========================================================================== local m_kData = nil local m_isInitializing = false local m_isShowingPanels = false local m_pPlayer = nil local m_primaryColor = UI.GetColorValueFromHexLiteral(0xcafef00d) local m_secondaryColor = UI.GetColorValueFromHexLiteral(0xf00d1ace) local m_kTutorialDisabledControls = nil local m_CurrentPanelLine = 0 local m_PrevInterfaceMode = InterfaceModeTypes.SELECTION -- =========================================================================== -- -- =========================================================================== function Close() ContextPtr:SetHide(true) end -- =========================================================================== -- Helper, display the 3-way state of a yield based on the enum. -- yieldData, A YIELD_STATE -- yieldName, The name tied used in the check and ignore controls. -- =========================================================================== function RealizeYield3WayCheck(yieldData, yieldType, yieldToolTip) local yieldInfo = GameInfo.Yields[yieldType] if (yieldInfo) then local controlLookup = { YIELD_FOOD = "Food", YIELD_PRODUCTION = "Production", YIELD_GOLD = "Gold", YIELD_SCIENCE = "Science", YIELD_CULTURE = "Culture", YIELD_FAITH = "Faith" } local yieldName = controlLookup[yieldInfo.YieldType] if (yieldName) then local checkControl = Controls[yieldName .. "Check"] local ignoreControl = Controls[yieldName .. "Ignore"] local gridControl = Controls[yieldName .. "Grid"] if (checkControl and ignoreControl and gridControl) then local toolTip = "" if yieldData == YIELD_STATE.FAVORED then checkControl:SetCheck(true) -- Just visual, no callback! checkControl:SetDisabled(false) ignoreControl:SetHide(true) toolTip = Locale.Lookup("LOC_HUD_CITY_YIELD_FOCUSING", yieldInfo.Name) .. "[NEWLINE][NEWLINE]" elseif yieldData == YIELD_STATE.IGNORED then checkControl:SetCheck(false) -- Just visual, no callback! checkControl:SetDisabled(true) ignoreControl:SetHide(false) toolTip = Locale.Lookup("LOC_HUD_CITY_YIELD_IGNORING", yieldInfo.Name) .. "[NEWLINE][NEWLINE]" else checkControl:SetCheck(false) checkControl:SetDisabled(false) ignoreControl:SetHide(true) toolTip = Locale.Lookup("LOC_HUD_CITY_YIELD_CITIZENS", yieldInfo.Name) .. "[NEWLINE][NEWLINE]" end if (#yieldToolTip > 0) then toolTip = toolTip .. yieldToolTip else toolTip = toolTip .. Locale.Lookup("LOC_HUD_CITY_YIELD_NOTHING") end gridControl:SetToolTipString(toolTip) end end end end -- =========================================================================== -- Set the health meter -- =========================================================================== function RealizeHealthMeter(control, percent) if (percent > 0.7) then control:SetColor(COLORS.METER_HP_GOOD) elseif (percent > 0.4) then control:SetColor(COLORS.METER_HP_OK) else control:SetColor(COLORS.METER_HP_BAD) end -- Meter control is half circle, so add enough to start at half point and condense % into the half area percent = (percent * 0.5) + 0.5 control:SetPercent(percent) end -- =========================================================================== -- Main city panel -- =========================================================================== function ViewMain(data) m_primaryColor, m_secondaryColor = UI.GetPlayerColors(m_pPlayer:GetID()) if (m_primaryColor == nil or m_secondaryColor == nil or m_primaryColor == 0 or m_secondaryColor == 0) then UI.DataError("Couldn't find player colors for player - " .. (m_pPlayer and tostring(m_pPlayer:GetID()) or "nil")) end local darkerBackColor = UI.DarkenLightenColor(m_primaryColor, -85, 100) local brighterBackColor = UI.DarkenLightenColor(m_primaryColor, 90, 255) m_CurrentPanelLine = 0 -- Name data Controls.CityName:SetText((data.IsCapital and "[ICON_Capital]" or "") .. Locale.ToUpper(Locale.Lookup(data.CityName))) Controls.CityName:SetToolTipString(data.IsCapital and Locale.Lookup("LOC_HUD_CITY_IS_CAPITAL") or nil) -- Banner and icon colors Controls.Banner:SetColor(m_primaryColor) Controls.BannerLighter:SetColor(brighterBackColor) Controls.BannerDarker:SetColor(darkerBackColor) Controls.CircleBacking:SetColor(m_primaryColor) Controls.CircleLighter:SetColor(brighterBackColor) Controls.CircleDarker:SetColor(darkerBackColor) Controls.CityName:SetColor(m_secondaryColor) Controls.CivIcon:SetColor(m_secondaryColor) -- Set Population -- Controls.PopulationNumber:SetText(data.Population) -- Damage meters --- RealizeHealthMeter(Controls.CityHealthMeter, data.HitpointPercent) if (data.CityWallTotalHP > 0) then Controls.CityWallHealthMeters:SetHide(false) -- RealizeHealthMeter( Controls.WallHealthMeter, data.CityWallHPPercent ); local percent = (data.CityWallHPPercent * 0.5) + 0.5 Controls.WallHealthMeter:SetPercent(percent) else Controls.CityWallHealthMeters:SetHide(true) end -- Update city health tooltip local tooltip = Locale.Lookup("LOC_HUD_UNIT_PANEL_HEALTH_TOOLTIP", data.HitpointsCurrent, data.HitpointsTotal) if (data.CityWallTotalHP > 0) then tooltip = tooltip .. "[NEWLINE]" .. Locale.Lookup("LOC_HUD_UNIT_PANEL_WALL_HEALTH_TOOLTIP", data.CityWallCurrentHP, data.CityWallTotalHP) end Controls.CityHealthMeters:SetToolTipString(tooltip) local civType = PlayerConfigurations[data.Owner]:GetCivilizationTypeName() if civType ~= nil then Controls.CivIcon:SetIcon("ICON_" .. civType) else UI.DataError("Invalid type name returned by GetCivilizationTypeName") end -- Set icons and values for the yield checkboxes Controls.FoodCheck:GetTextButton():SetText("[ICON_Food]" .. toPlusMinusString(CuiGetFoodPerTurn(data))) -- CUI Controls.ProductionCheck:GetTextButton():SetText("[ICON_Production]" .. toPlusMinusString(data.ProductionPerTurn)) Controls.GoldCheck:GetTextButton():SetText("[ICON_Gold]" .. toPlusMinusString(data.GoldPerTurn)) Controls.ScienceCheck:GetTextButton():SetText("[ICON_Science]" .. toPlusMinusString(data.SciencePerTurn)) Controls.CultureCheck:GetTextButton():SetText("[ICON_Culture]" .. toPlusMinusString(data.CulturePerTurn)) Controls.FaithCheck:GetTextButton():SetText("[ICON_Faith]" .. toPlusMinusString(data.FaithPerTurn)) -- Set the Yield checkboxes based on the game state RealizeYield3WayCheck(data.YieldFilters[YieldTypes.FOOD], YieldTypes.FOOD, CuiGetFoodToolTip(data)) -- CUI RealizeYield3WayCheck(data.YieldFilters[YieldTypes.PRODUCTION], YieldTypes.PRODUCTION, data.ProductionPerTurnToolTip) RealizeYield3WayCheck(data.YieldFilters[YieldTypes.GOLD], YieldTypes.GOLD, data.GoldPerTurnToolTip) RealizeYield3WayCheck(data.YieldFilters[YieldTypes.SCIENCE], YieldTypes.SCIENCE, data.SciencePerTurnToolTip) RealizeYield3WayCheck(data.YieldFilters[YieldTypes.CULTURE], YieldTypes.CULTURE, data.CulturePerTurnToolTip) RealizeYield3WayCheck(data.YieldFilters[YieldTypes.FAITH], YieldTypes.FAITH, data.FaithPerTurnToolTip) if m_isShowingPanels then Controls.LabelButtonRows:SetSizeX(SIZE_MAIN_ROW_LEFT_COLLAPSED) else Controls.LabelButtonRows:SetSizeX(SIZE_MAIN_ROW_LEFT_WIDE) end -- Custom religion icon: if data.Religions[DATA_DOMINANT_RELIGION] ~= nil then local kReligion = GameInfo.Religions[data.Religions[DATA_DOMINANT_RELIGION].ReligionType] if (kReligion ~= nil) then local iconName = "ICON_" .. kReligion.ReligionType Controls.ReligionIcon:SetIcon(iconName) end end -- CUI: show districts numbers Controls.BreakdownNum:SetText(data.DistrictsNum .. "/" .. data.DistrictsPossibleNum) Controls.BreakdownLabel:SetText(Locale.ToUpper(Locale.Lookup("LOC_HUD_DISTRICTS"))) Controls.BreakdownNum:SetOffsetX(19) Controls.BreakdownGrid:SetOffsetY(PANEL_INFOLINE_LOCATIONS[m_CurrentPanelLine]) Controls.BreakdownButton:SetOffsetX(PANEL_BUTTON_LOCATIONS[m_CurrentPanelLine].x) Controls.BreakdownButton:SetOffsetY(PANEL_BUTTON_LOCATIONS[m_CurrentPanelLine].y) m_CurrentPanelLine = m_CurrentPanelLine + 1 -- Hide Religion / Faith UI in some scenarios if not GameCapabilities.HasCapability("CAPABILITY_CITY_HUD_RELIGION_TAB") then Controls.ReligionGrid:SetHide(true) Controls.ReligionIcon:SetHide(true) Controls.ReligionButton:SetHide(true) else Controls.ReligionGrid:SetOffsetY(PANEL_INFOLINE_LOCATIONS[m_CurrentPanelLine]) Controls.ReligionButton:SetOffsetX(PANEL_BUTTON_LOCATIONS[m_CurrentPanelLine].x) Controls.ReligionButton:SetOffsetY(PANEL_BUTTON_LOCATIONS[m_CurrentPanelLine].y) m_CurrentPanelLine = m_CurrentPanelLine + 1 end if not GameCapabilities.HasCapability("CAPABILITY_FAITH") then Controls.ProduceWithFaithCheck:SetHide(true) Controls.FaithGrid:SetHide(true) end local amenitiesNumText = data.AmenitiesNetAmount if (data.AmenitiesNetAmount > 0) then amenitiesNumText = "+" .. amenitiesNumText end Controls.AmenitiesNum:SetText(amenitiesNumText) local colorName = GetHappinessColor(data.Happiness) Controls.AmenitiesNum:SetColorByName(colorName) Controls.AmenitiesGrid:SetOffsetY(PANEL_INFOLINE_LOCATIONS[m_CurrentPanelLine]) Controls.AmenitiesButton:SetOffsetX(PANEL_BUTTON_LOCATIONS[m_CurrentPanelLine].x) Controls.AmenitiesButton:SetOffsetY(PANEL_BUTTON_LOCATIONS[m_CurrentPanelLine].y) m_CurrentPanelLine = m_CurrentPanelLine + 1 Controls.ReligionNum:SetText(data.ReligionFollowers) Controls.HousingNum:SetText(data.Population) colorName = GetPercentGrowthColor(data.HousingMultiplier) Controls.HousingNum:SetColorByName(colorName) Controls.HousingMax:SetText(data.Housing) Controls.HousingLabels:SetOffsetX(PANEL_BUTTON_LOCATIONS[m_CurrentPanelLine].x - HOUSING_LABEL_OFFSET) Controls.HousingGrid:SetOffsetY(PANEL_INFOLINE_LOCATIONS[m_CurrentPanelLine]) Controls.HousingButton:SetOffsetX(PANEL_BUTTON_LOCATIONS[m_CurrentPanelLine].x) Controls.HousingButton:SetOffsetY(PANEL_BUTTON_LOCATIONS[m_CurrentPanelLine].y) Controls.BreakdownLabel:SetHide(m_isShowingPanels) Controls.ReligionLabel:SetHide(m_isShowingPanels) Controls.AmenitiesLabel:SetHide(m_isShowingPanels) Controls.HousingLabel:SetHide(m_isShowingPanels) Controls.PanelStackShadow:SetHide(not m_isShowingPanels) Controls.ProductionNowLabel:SetHide(m_isShowingPanels) -- Determine size of progress bars at the bottom, as well as sub-panel offset. local OFF_BOTTOM_Y = 9 local OFF_ROOM_FOR_PROGRESS_Y = 36 local OFF_GROWTH_BAR_PUSH_RIGHT_X = 2 local OFF_GROWTH_BAR_DEFAULT_RIGHT_X = 32 local widthNumLabel = 0 -- Growth Controls.GrowthTurnsSmall:SetHide(not m_isShowingPanels) Controls.GrowthTurns:SetHide(m_isShowingPanels) Controls.GrowthTurnsBar:SetPercent(data.CurrentFoodPercent) Controls.GrowthTurnsBar:SetShadowPercent(data.FoodPercentNextTurn) Controls.GrowthTurnsBarSmall:SetPercent(data.CurrentFoodPercent) Controls.GrowthTurnsBarSmall:SetShadowPercent(data.FoodPercentNextTurn) Controls.GrowthNum:SetText(math.abs(data.TurnsUntilGrowth)) Controls.GrowthNumSmall:SetText(math.abs(data.TurnsUntilGrowth) .. "[Icon_Turn]") if data.Occupied then Controls.GrowthLabel:SetColorByName("StatBadCS") Controls.GrowthLabel:SetText(Locale.ToUpper(Locale.Lookup("LOC_HUD_CITY_GROWTH_OCCUPIED"))) elseif data.TurnsUntilGrowth >= 0 then Controls.GrowthLabel:SetColorByName("StatGoodCS") Controls.GrowthLabel:SetText(Locale.ToUpper(Locale.Lookup("LOC_HUD_CITY_TURNS_UNTIL_GROWTH", data.TurnsUntilGrowth))) else Controls.GrowthLabel:SetColorByName("StatBadCS") Controls.GrowthLabel:SetText(Locale.ToUpper(Locale.Lookup("LOC_HUD_CITY_TURNS_UNTIL_LOSS", math.abs(data.TurnsUntilGrowth)))) end widthNumLabel = Controls.GrowthNum:GetSizeX() TruncateStringWithTooltip(Controls.GrowthLabel, MAX_BEFORE_TRUNC_TURN_LABELS - widthNumLabel, Controls.GrowthLabel:GetText()) -- Production Controls.ProductionTurns:SetHide(m_isShowingPanels) Controls.ProductionTurnsBar:SetPercent(Clamp(data.CurrentProdPercent, 0.0, 1.0)) Controls.ProductionTurnsBar:SetShadowPercent(Clamp(data.ProdPercentNextTurn, 0.0, 1.0)) Controls.ProductionNum:SetText(data.CurrentTurnsLeft) Controls.ProductionNowLabel:SetText(data.CurrentProductionName) Controls.ProductionDescriptionString:SetText(data.CurrentProductionDescription) -- Controls.ProductionDescription:SetText( "There was a young lady from Venus, who's body was shaped like a, THAT'S ENOUGH DATA." ); if (data.CurrentProductionStats ~= "") then Controls.ProductionStatString:SetText(data.CurrentProductionStats) end Controls.ProductionDataStack:CalculateSize() Controls.ProductionDataScroll:CalculateSize() local isIconSet = false if data.CurrentProductionIcons then for _, iconName in ipairs(data.CurrentProductionIcons) do if iconName ~= nil and Controls.ProductionIcon:TrySetIcon(iconName) then isIconSet = true break end end end Controls.ProductionIcon:SetHide(not isIconSet) Controls.ProductionNum:SetHide(data.CurrentTurnsLeft < 0) if data.CurrentTurnsLeft < 0 then Controls.ProductionLabel:SetText(Locale.ToUpper(Locale.Lookup("LOC_HUD_CITY_NOTHING_PRODUCED"))) widthNumLabel = 0 else Controls.ProductionLabel:SetText(Locale.ToUpper(Locale.Lookup("LOC_HUD_CITY_TURNS_UNTIL_COMPLETED", data.CurrentTurnsLeft))) widthNumLabel = Controls.ProductionNum:GetSizeX() end TruncateStringWithTooltip(Controls.ProductionLabel, MAX_BEFORE_TRUNC_TURN_LABELS - widthNumLabel, Controls.ProductionLabel:GetText()) -- Tutorial lockdown if m_kTutorialDisabledControls ~= nil then for _, name in ipairs(m_kTutorialDisabledControls) do if Controls[name] ~= nil then Controls[name]:SetDisabled(true) end end end end -- =========================================================================== -- Return ColorSet name -- =========================================================================== function GetHappinessColor(eHappiness) local happinessInfo = GameInfo.Happinesses[eHappiness] if (happinessInfo ~= nil) then if (happinessInfo.GrowthModifier < 0) then return "StatBadCS" end if (happinessInfo.GrowthModifier > 0) then return "StatGoodCS" end end return "StatNormalCS" end -- =========================================================================== -- Return ColorSet name -- =========================================================================== function GetTurnsUntilGrowthColor(turns) if turns < 1 then return "StatBadCS" end return "StatGoodCS" end function GetPercentGrowthColor(percent) if percent == 0 then return "Error" end if percent <= 0.25 then return "WarningMajor" end if percent <= 0.5 then return "WarningMinor" end return "StatNormalCS" end -- =========================================================================== -- Changes the yield focus. -- =========================================================================== function SetYieldFocus(yieldType) local pCitizens = g_pCity:GetCitizens() local tParameters = {} tParameters[CityCommandTypes.PARAM_FLAGS] = 0 -- Set Favored tParameters[CityCommandTypes.PARAM_YIELD_TYPE] = yieldType -- Yield type if pCitizens:IsFavoredYield(yieldType) then tParameters[CityCommandTypes.PARAM_DATA0] = 0 -- boolean (1=true, 0=false) else if pCitizens:IsDisfavoredYield(yieldType) then SetYieldIgnore(yieldType) end tParameters[CityCommandTypes.PARAM_DATA0] = 1 -- boolean (1=true, 0=false) end CityManager.RequestCommand(g_pCity, CityCommandTypes.SET_FOCUS, tParameters) end -- =========================================================================== -- Changes what yield type(s) should be ignored by citizens -- =========================================================================== function SetYieldIgnore(yieldType) local pCitizens = g_pCity:GetCitizens() local tParameters = {} tParameters[CityCommandTypes.PARAM_FLAGS] = 1 -- Set Ignored tParameters[CityCommandTypes.PARAM_YIELD_TYPE] = yieldType -- Yield type if pCitizens:IsDisfavoredYield(yieldType) then tParameters[CityCommandTypes.PARAM_DATA0] = 0 -- boolean (1=true, 0=false) else if (pCitizens:IsFavoredYield(yieldType)) then SetYieldFocus(yieldType) end tParameters[CityCommandTypes.PARAM_DATA0] = 1 -- boolean (1=true, 0=false) end CityManager.RequestCommand(g_pCity, CityCommandTypes.SET_FOCUS, tParameters) end -- =========================================================================== -- Update both the data & view for the selected city. -- =========================================================================== function Refresh() local eLocalPlayer = Game.GetLocalPlayer() m_pPlayer = Players[eLocalPlayer] g_pCity = UI.GetHeadSelectedCity() if m_pPlayer ~= nil and g_pCity ~= nil then m_kData = GetCityData(g_pCity) if m_kData == nil then return end ViewMain(m_kData) -- Tell others (e.g., CityPanelOverview) that the selected city data has changed. -- Passing this large table across contexts via LuaEvent is *much* -- more effecient than recomputing the entire set of yields a second time, -- despite the large size. LuaEvents.CityPanel_LiveCityDataChanged(m_kData, true) end end -- =========================================================================== function RefreshIfMatch(ownerPlayerID, cityID) if g_pCity ~= nil and ownerPlayerID == g_pCity:GetOwner() and cityID == g_pCity:GetID() then Refresh() end end -- =========================================================================== -- GAME Event -- =========================================================================== function OnCityAddedToMap(ownerPlayerID, cityID) if Game.GetLocalPlayer() ~= nil then if ownerPlayerID == Game.GetLocalPlayer() then local pSelectedCity = UI.GetHeadSelectedCity() if pSelectedCity ~= nil then Refresh() else UI.DeselectAllCities() end end end end function OnCityNameChanged(playerID, cityID) local city = UI.GetHeadSelectedCity() if (city and city:GetOwner() == playerID and city:GetID() == cityID) then local name = city:IsCapital() and "[ICON_Capital]" or "" name = name .. Locale.ToUpper(Locale.Lookup(city:GetName())) Controls.CityName:SetText(name) end end -- =========================================================================== -- GAME Event -- Yield changes -- =========================================================================== function OnCityFocusChange(ownerPlayerID, cityID) RefreshIfMatch(ownerPlayerID, cityID) end -- =========================================================================== -- GAME Event -- =========================================================================== function OnCityWorkerChanged(ownerPlayerID, cityID) RefreshIfMatch(ownerPlayerID, cityID) end -- =========================================================================== -- GAME Event -- =========================================================================== function OnCityProductionChanged(ownerPlayerID, cityID) -- CUI if Controls.ChangeProductionCheck:IsChecked() then Controls.ChangeProductionCheck:SetCheck(false) end -- RefreshIfMatch(ownerPlayerID, cityID) end -- =========================================================================== -- GAME Event -- =========================================================================== function OnCityProductionCompleted(ownerPlayerID, cityID) RefreshIfMatch(ownerPlayerID, cityID) end -- =========================================================================== -- GAME Event -- =========================================================================== function OnCityProductionUpdated(ownerPlayerID, cityID, eProductionType, eProductionObject) RefreshIfMatch(ownerPlayerID, cityID) end -- =========================================================================== -- GAME Event -- =========================================================================== function OnPlayerResourceChanged(ownerPlayerID, resourceTypeID) if (Game.GetLocalPlayer() ~= nil and ownerPlayerID == Game.GetLocalPlayer()) then Refresh() end end -- =========================================================================== -- GAME Event -- =========================================================================== function OnToggleOverviewPanel() if Controls.ToggleOverviewPanel:IsChecked() then LuaEvents.CityPanel_ShowOverviewPanel(true) else LuaEvents.CityPanel_ShowOverviewPanel(false) end end -- =========================================================================== function OnCitySelectionChanged(ownerPlayerID, cityID, i, j, k, isSelected, isEditable) if ownerPlayerID == Game.GetLocalPlayer() then if (isSelected) then -- Determine if we should switch to the SELECTION interface mode local shouldSwitchToSelection = UI.GetInterfaceMode() ~= InterfaceModeTypes.CITY_SELECTION if UI.GetInterfaceMode() == InterfaceModeTypes.CITY_MANAGEMENT then HideGrowthTile() shouldSwitchToSelection = false end if UI.GetInterfaceMode() == InterfaceModeTypes.ICBM_STRIKE then -- During ICBM_STRIKE only switch to SELECTION if we're selecting a city -- which doesn't own the active missile silo local siloPlotX = UI.GetInterfaceModeParameter(CityCommandTypes.PARAM_X0) local siloPlotY = UI.GetInterfaceModeParameter(CityCommandTypes.PARAM_Y0) local siloPlot = Map.GetPlot(siloPlotX, siloPlotY) if siloPlot then local owningCity = Cities.GetPlotPurchaseCity(siloPlot) if owningCity:GetID() == cityID then shouldSwitchToSelection = false end end end if UI.GetInterfaceMode() == InterfaceModeTypes.CITY_RANGE_ATTACK then -- During CITY_RANGE_ATTACK only switch to SELECTION if we're selecting a city -- which can't currently perform a ranged attack if CityManager.CanStartCommand(CityManager.GetCity(owningPlayerID, cityID), CityCommandTypes.RANGE_ATTACK) then shouldSwitchToSelection = false -- we switch to selection mode briefly so that we can go back into CITY_RANGE_ATTACK with the correct settings UI.SetInterfaceMode(InterfaceModeTypes.SELECTION) UI.SetInterfaceMode(InterfaceModeTypes.CITY_RANGE_ATTACK) end end if shouldSwitchToSelection then UI.SetInterfaceMode(InterfaceModeTypes.SELECTION) end OnToggleOverviewPanel() ContextPtr:SetHide(false) -- Handle case where production panel is opened from clicking a city banener directly. local isProductionOpen = false local uiProductionPanel = ContextPtr:LookUpControl("/InGame/ProductionPanel") if uiProductionPanel and uiProductionPanel:IsHidden() == false then isProductionOpen = true end if isProductionOpen then AnimateToWithProductionQueue() else AnimateFromCloseToOpen() end Refresh() if UI.GetInterfaceMode() == InterfaceModeTypes.CITY_MANAGEMENT then DisplayGrowthTile() end else Close() -- Tell the CityPanelOverview a city was deselected LuaEvents.CityPanel_LiveCityDataChanged(nil, false) end end end -- =========================================================================== function AnimateFromCloseToOpen() Controls.CityPanelAlpha:SetToBeginning() Controls.CityPanelAlpha:Play() Controls.CityPanelSlide:SetBeginVal(0, 0) Controls.CityPanelSlide:SetEndVal(ANIM_OFFSET_OPEN, 0) Controls.CityPanelSlide:SetToBeginning() Controls.CityPanelSlide:Play() end -- =========================================================================== function AnimateToWithProductionQueue() if IsRoomToPushOutPanel() then Controls.CityPanelSlide:SetEndVal(ANIM_OFFSET_OPEN_WITH_PRODUCTION_LIST, 0) Controls.CityPanelSlide:RegisterEndCallback(function() Controls.CityPanelSlide:SetBeginVal(ANIM_OFFSET_OPEN_WITH_PRODUCTION_LIST, 0) end) Controls.CityPanelSlide:SetToBeginning() Controls.CityPanelSlide:Play() end end -- =========================================================================== function AnimateToOpenFromWithProductionQueue() if IsRoomToPushOutPanel() then Controls.CityPanelSlide:SetEndVal(ANIM_OFFSET_OPEN, 0) Controls.CityPanelSlide:RegisterEndCallback(function() Controls.CityPanelSlide:SetBeginVal(ANIM_OFFSET_OPEN, 0) end) Controls.CityPanelSlide:SetToBeginning() Controls.CityPanelSlide:Play() end end -- =========================================================================== -- Is there enough room to push out the CityPanel, rather than just have -- the production list overlap it? -- =========================================================================== function IsRoomToPushOutPanel() local width, height = UIManager:GetScreenSizeVal() -- Minimap showing; subtract how much space it takes up local uiMinimap = ContextPtr:LookUpControl("/InGame/MinimapPanel/MinimapContainer") if uiMinimap then local minimapWidth, minimapHeight = uiMinimap:GetSizeVal() width = width - minimapWidth end return (width > 850) -- Does remaining width have enough space for both? end -- =========================================================================== -- GAME Event -- =========================================================================== function OnUnitSelectionChanged(playerID, unitID, hexI, hexJ, hexK, isSelected, isEditable) if playerID == Game.GetLocalPlayer() then if ContextPtr:IsHidden() == false then Close() Controls.ToggleOverviewPanel:SetAndCall(false) end end end -- =========================================================================== function LateInitialize() -- Override in DLC, Expansion, and MODs for special initialization. end -- =========================================================================== -- UI Event -- =========================================================================== function OnInit(isHotload) LateInitialize() if isHotload then LuaEvents.GameDebug_GetValues("CityPanel") end m_isInitializing = false Refresh() end -- =========================================================================== -- UI EVENT -- =========================================================================== function OnShutdown() -- Cache values for hotloading... LuaEvents.GameDebug_AddValue("CityPanel", "isHidden", ContextPtr:IsHidden()) -- Game Core Events Events.CityAddedToMap.Remove(OnCityAddedToMap) Events.CityNameChanged.Remove(OnCityNameChanged) Events.CitySelectionChanged.Remove(OnCitySelectionChanged) Events.CityFocusChanged.Remove(OnCityFocusChange) Events.CityProductionCompleted.Remove(OnCityProductionCompleted) Events.CityProductionUpdated.Remove(OnCityProductionUpdated) Events.CityProductionChanged.Remove(OnCityProductionChanged) Events.CityWorkerChanged.Remove(OnCityWorkerChanged) Events.DistrictDamageChanged.Remove(OnCityProductionChanged) Events.LocalPlayerTurnBegin.Remove(OnLocalPlayerTurnBegin) Events.ImprovementChanged.Remove(OnCityProductionChanged) Events.InterfaceModeChanged.Remove(OnInterfaceModeChanged) Events.LocalPlayerChanged.Remove(OnLocalPlayerChanged) Events.PlayerResourceChanged.Remove(OnPlayerResourceChanged) Events.UnitSelectionChanged.Remove(OnUnitSelectionChanged) -- LUA Events LuaEvents.CityPanelOverview_CloseButton.Remove(OnCloseOverviewPanel) LuaEvents.CityPanel_SetOverViewState.Remove(OnCityPanelSetOverViewState) LuaEvents.CityPanel_ToggleManageCitizens.Remove(OnCityPanelToggleManageCitizens) LuaEvents.GameDebug_Return.Remove(OnGameDebugReturn) LuaEvents.ProductionPanel_Close.Remove(OnProductionPanelClose) LuaEvents.ProductionPanel_ListModeChanged.Remove(OnProductionPanelListModeChanged) LuaEvents.ProductionPanel_Open.Remove(OnProductionPanelOpen) LuaEvents.Tutorial_CityPanelOpen.Remove(OnTutorialOpen) LuaEvents.Tutorial_ContextDisableItems.Remove(OnTutorial_ContextDisableItems) end -- =========================================================================== -- LUA Event -- Set cached values back after a hotload. -- =========================================================================== function OnGameDebugReturn(context, contextTable) function RunWithNoError() if context ~= "CityPanel" or contextTable == nil then return end local isHidden = contextTable["isHidden"] ContextPtr:SetHide(isHidden) end pcall(RunWithNoError) end -- =========================================================================== -- LUA Event -- =========================================================================== function OnProductionPanelClose() -- If no longer checked, make sure the side Production Panel closes. -- Clear the checks, even if hidden, the Production Pane can close after the City Panel has already been closed. Controls.ChangeProductionCheck:SetCheck(false) Controls.ProduceWithFaithCheck:SetCheck(false) Controls.ProduceWithGoldCheck:SetCheck(false) AnimateToOpenFromWithProductionQueue() end -- =========================================================================== -- LUA Event -- =========================================================================== function OnProductionPanelOpen() AnimateToWithProductionQueue() end -- =========================================================================== -- LUA Event -- =========================================================================== function OnTutorialOpen() ContextPtr:SetHide(false) Refresh() end -- =========================================================================== function OnBreakdown() LuaEvents.CityPanel_ShowBreakdownTab() end -- =========================================================================== function OnReligion() LuaEvents.CityPanel_ShowReligionTab() end -- =========================================================================== function OnAmenities() LuaEvents.CityPanel_ShowAmenitiesTab() end -- =========================================================================== function OnHousing() LuaEvents.CityPanel_ShowHousingTab() end -- =========================================================================== -- function OnCheckQueue() -- if m_isInitializing then return; end -- if not m_debugAllowMultiPanel then -- UILens.ToggleLayerOff("Adjacency_Bonus_Districts"); -- UILens.ToggleLayerOff("Districts"); -- end -- Refresh(); -- end -- =========================================================================== function OnCitizensGrowth() LuaEvents.CityPanel_ShowCitizensTab() end -- =========================================================================== -- Set a yield to one of 3 check states. -- yieldType Enum from game engine on the yield -- yieldName Name of the yield used in the UI controls -- =========================================================================== function OnCheckYield(yieldType, yieldName) if Controls.YieldsArea:IsDisabled() then return end -- Via tutorial event if Controls[yieldName .. "Check"]:IsChecked() then SetYieldFocus(yieldType) else SetYieldIgnore(yieldType) Controls[yieldName .. "Ignore"]:SetHide(false) Controls[yieldName .. "Check"]:SetDisabled(true) end end -- =========================================================================== -- Reset a yield to not be favored nor ignored -- yieldType Enum from game engine on the yield -- yieldName Name of the yield used in the UI controls -- =========================================================================== function OnResetYieldToNormal(yieldType, yieldName) if Controls.YieldsArea:IsDisabled() then return end -- Via tutorial event Controls[yieldName .. "Ignore"]:SetHide(true) Controls[yieldName .. "Check"]:SetDisabled(false) SetYieldIgnore(yieldType) -- One more ignore to flip it off end -- =========================================================================== -- Cycle to the next city -- =========================================================================== function OnNextCity() local kCity = UI.GetHeadSelectedCity() UI.SelectNextCity(kCity) UI.PlaySound("UI_Click_Sweetener_Metal_Button_Small") end -- =========================================================================== -- Cycle to the previous city -- =========================================================================== function OnPreviousCity() local kCity = UI.GetHeadSelectedCity() UI.SelectPrevCity(kCity) UI.PlaySound("UI_Click_Sweetener_Metal_Button_Small") end -- =========================================================================== -- Recenter camera on city -- =========================================================================== function RecenterCameraOnCity() local kCity = UI.GetHeadSelectedCity() UI.LookAtPlot(kCity:GetX(), kCity:GetY()) end -- CUI ======================================================================= -- combine purchase tile and manage cityzens function CuiOnToggleManageTile() if Controls.ManageTileCheck:IsChecked() then UI.SetInterfaceMode(InterfaceModeTypes.CITY_MANAGEMENT) CuiForceHideCityBanner() RecenterCameraOnCity() UILens.ToggleLayerOn(m_CitizenManagement) if GameCapabilities.HasCapability("CAPABILITY_GOLD") then UILens.ToggleLayerOn(m_PurchasePlot) end else UI.SetInterfaceMode(InterfaceModeTypes.SELECTION) CuiForceShowCityBanner() UILens.ToggleLayerOff(m_CitizenManagement) UILens.ToggleLayerOff(m_PurchasePlot) end end -- =========================================================================== -- Turn on/off layers and switch the interface mode based on what is checked. -- Interface mode is changed first as the Lens system may inquire as to the -- current state in deciding what is populate in a lens layer. -- =========================================================================== function OnTogglePurchaseTile() if Controls.PurchaseTileCheck:IsChecked() then if not Controls.ManageCitizensCheck:IsChecked() then m_PrevInterfaceMode = UI.GetInterfaceMode() UI.SetInterfaceMode(InterfaceModeTypes.CITY_MANAGEMENT) -- Enter mode end RecenterCameraOnCity() UILens.ToggleLayerOn(m_PurchasePlot) else if not Controls.ManageCitizensCheck:IsChecked() and UI.GetInterfaceMode() == InterfaceModeTypes.CITY_MANAGEMENT then UI.SetInterfaceMode(m_PrevInterfaceMode) -- Exit mode m_PrevInterfaceMode = InterfaceModeTypes.SELECTION end UILens.ToggleLayerOff(m_PurchasePlot) end end -- =========================================================================== function OnToggleProduction() if Controls.ChangeProductionCheck:IsChecked() then RecenterCameraOnCity() LuaEvents.CityPanel_ProductionOpen() -- CUI Controls.ProduceWithFaithCheck:SetCheck(false) Controls.ProduceWithGoldCheck:SetCheck(false) -- else LuaEvents.CityPanel_ProductionClose() end end -- =========================================================================== function OnTogglePurchaseWithGold() if Controls.ProduceWithGoldCheck:IsChecked() then RecenterCameraOnCity() LuaEvents.CityPanel_PurchaseGoldOpen() -- CUI Controls.ChangeProductionCheck:SetCheck(false) Controls.ProduceWithFaithCheck:SetCheck(false) -- else LuaEvents.CityPanel_ProductionClose() end end -- =========================================================================== function OnTogglePurchaseWithFaith() if Controls.ProduceWithFaithCheck:IsChecked() then RecenterCameraOnCity() LuaEvents.CityPanel_PurchaseFaithOpen() -- CUI Controls.ChangeProductionCheck:SetCheck(false) Controls.ProduceWithGoldCheck:SetCheck(false) -- else LuaEvents.CityPanel_ProductionClose() end end -- =========================================================================== function OnCloseOverviewPanel() Controls.ToggleOverviewPanel:SetCheck(false) end -- =========================================================================== -- Turn on/off layers and switch the interface mode based on what is checked. -- Interface mode is changed first as the Lens system may inquire as to the -- current state in deciding what is populate in a lens layer. -- =========================================================================== function OnToggleManageCitizens() if Controls.ManageCitizensCheck:IsChecked() then if not Controls.PurchaseTileCheck:IsChecked() then m_PrevInterfaceMode = UI.GetInterfaceMode() UI.SetInterfaceMode(InterfaceModeTypes.CITY_MANAGEMENT) -- Enter mode end RecenterCameraOnCity() UILens.ToggleLayerOn(m_CitizenManagement) else if not Controls.PurchaseTileCheck:IsChecked() and UI.GetInterfaceMode() == InterfaceModeTypes.CITY_MANAGEMENT then UI.SetInterfaceMode(m_PrevInterfaceMode) -- Exit mode m_PrevInterfaceMode = InterfaceModeTypes.SELECTION end UILens.ToggleLayerOff(m_CitizenManagement) end end -- =========================================================================== function OnLocalPlayerTurnBegin() Refresh() end -- =========================================================================== -- Enable a control unless it's in the tutorial lock down list. -- =========================================================================== function EnableIfNotTutorialBlocked(controlName) local isDisabled = false if m_kTutorialDisabledControls ~= nil then for _, name in ipairs(m_kTutorialDisabledControls) do if name == controlName then isDisabled = true break end end end Controls[controlName]:SetDisabled(isDisabled) end function OnCameraUpdate(vFocusX, vFocusY, fZoomLevel) if g_growthPlotId ~= -1 then if fZoomLevel and fZoomLevel > 0.5 then local delta = (fZoomLevel - 0.3) local alpha = delta / 0.7 Controls.GrowthHexAlpha:SetProgress(alpha) else Controls.GrowthHexAlpha:SetProgress(0) end local plotX, plotY = Map.GetPlotLocation(g_growthPlotId) local worldX, worldY, worldZ = UI.GridToWorld(plotX, plotY) Controls.GrowthHexAnchor:SetWorldPositionVal(worldX, worldY + HEX_GROWTH_TEXT_PADDING, worldZ) end end function DisplayGrowthTile() if g_pCity ~= nil and HasCapability("CAPABILITY_CULTURE") then local cityCulture = g_pCity:GetCulture() if cityCulture ~= nil then local newGrowthPlot = cityCulture:GetNextPlot() if (newGrowthPlot ~= -1 and newGrowthPlot ~= g_growthPlotId) then g_growthPlotId = newGrowthPlot local cost = cityCulture:GetNextPlotCultureCost() local currentCulture = cityCulture:GetCurrentCulture() local currentYield = cityCulture:GetCultureYield() local currentGrowth = math.max(math.min(currentCulture / cost, 1.0), 0) local nextTurnGrowth = math.max(math.min((currentCulture + currentYield) / cost, 1.0), 0) UILens.SetLayerGrowthHex(m_PurchasePlot, Game.GetLocalPlayer(), g_growthPlotId, 1, "GrowthHexBG") UILens.SetLayerGrowthHex(m_PurchasePlot, Game.GetLocalPlayer(), g_growthPlotId, nextTurnGrowth, "GrowthHexNext") UILens.SetLayerGrowthHex(m_PurchasePlot, Game.GetLocalPlayer(), g_growthPlotId, currentGrowth, "GrowthHexCurrent") local turnsRemaining = cityCulture:GetTurnsUntilExpansion() Controls.TurnsLeftDescription:SetText(Locale.ToUpper( Locale.Lookup("LOC_HUD_CITY_TURNS_UNTIL_BORDER_GROWTH", turnsRemaining))) Controls.TurnsLeftLabel:SetText(turnsRemaining) Controls.GrowthHexStack:CalculateSize() g_growthHexTextWidth = Controls.GrowthHexStack:GetSizeX() Events.Camera_Updated.Add(OnCameraUpdate) Events.CityMadePurchase.Add(OnCityMadePurchase) Controls.GrowthHexAnchor:SetHide(false) OnCameraUpdate() end end end end function HideGrowthTile() if g_growthPlotId ~= -1 then Controls.GrowthHexAnchor:SetHide(true) Events.Camera_Updated.Remove(OnCameraUpdate) Events.CityMadePurchase.Remove(OnCityMadePurchase) UILens.ClearHex(m_PurchasePlot, g_growthPlotId) g_growthPlotId = -1 end end function OnCityMadePurchase(owner, cityID, plotX, plotY, purchaseType, objectType) if g_growthPlotId ~= -1 then local growthPlotX, growthPlotY = Map.GetPlotLocation(g_growthPlotId) if (growthPlotX == plotX and growthPlotY == plotY) then HideGrowthTile() DisplayGrowthTile() end end end -- =========================================================================== function OnProductionPanelListModeChanged(listMode) Controls.ChangeProductionCheck:SetCheck(listMode == LISTMODE.PRODUCTION or listMode == LISTMODE.PROD_QUEUE) Controls.ProduceWithGoldCheck:SetCheck(listMode == LISTMODE.PURCHASE_GOLD) Controls.ProduceWithFaithCheck:SetCheck(listMode == LISTMODE.PURCHASE_FAITH) end -- =========================================================================== function OnCityPanelSetOverViewState(isOpened) Controls.ToggleOverviewPanel:SetCheck(isOpened) end -- =========================================================================== function OnCityPanelToggleManageCitizens() Controls.ManageCitizensCheck:SetAndCall(not Controls.ManageCitizensCheck:IsChecked()) end -- =========================================================================== -- GAME Event -- eOldMode, mode the engine was formally in -- eNewMode, new mode the engine has just changed to -- =========================================================================== function OnInterfaceModeChanged(eOldMode, eNewMode) if eOldMode == InterfaceModeTypes.CITY_MANAGEMENT then -- CUI: combine buttons. if Controls.ManageTileCheck:IsChecked() then Controls.ManageTileCheck:SetAndCall(false) end -- if Controls.PurchaseTileCheck:IsChecked() then Controls.PurchaseTileCheck:SetAndCall( false ); end -- if Controls.ManageCitizensCheck:IsChecked() then Controls.ManageCitizensCheck:SetAndCall( false ); end -- UI.SetFixedTiltMode(false) HideGrowthTile() elseif eOldMode == InterfaceModeTypes.DISTRICT_PLACEMENT or eOldMode == InterfaceModeTypes.BUILDING_PLACEMENT then HideGrowthTile() end if eNewMode == InterfaceModeTypes.CITY_MANAGEMENT then DisplayGrowthTile() end if eNewMode == InterfaceModeTypes.CITY_RANGE_ATTACK or eNewMode == InterfaceModeTypes.DISTRICT_RANGE_ATTACK then if ContextPtr:IsHidden() == false then Close() end elseif eOldMode == InterfaceModeTypes.CITY_RANGE_ATTACK or eOldMode == InterfaceModeTypes.DISTRICT_RANGE_ATTACK then -- If we leave CITY_RANGE_ATTACK with a city selected then show the city panel again if UI.GetHeadSelectedCity() then ContextPtr:SetHide(false) end end if eNewMode == InterfaceModeTypes.SELECTION or eNewMode == InterfaceModeTypes.CITY_MANAGEMENT then -- CUI: combine buttons. EnableIfNotTutorialBlocked("ManageTileCheck") -- EnableIfNotTutorialBlocked("PurchaseTileCheck"); -- EnableIfNotTutorialBlocked("ManageCitizensCheck"); -- EnableIfNotTutorialBlocked("ProduceWithFaithCheck") EnableIfNotTutorialBlocked("ProduceWithGoldCheck") EnableIfNotTutorialBlocked("ChangeProductionCheck") elseif eNewMode == InterfaceModeTypes.DISTRICT_PLACEMENT then -- CUI: combine buttons. Controls.ManageTileCheck:SetDisabled(true) -- Controls.PurchaseTileCheck:SetDisabled( true ); -- Controls.ManageCitizensCheck:SetDisabled( true ); -- Controls.ChangeProductionCheck:SetDisabled(true) Controls.ProduceWithFaithCheck:SetDisabled(true) Controls.ProduceWithGoldCheck:SetDisabled(true) local newGrowthPlot = g_pCity:GetCulture():GetNextPlot() -- show the growth tile if the district can be placed there if (newGrowthPlot ~= -1) then local districtHash = UI.GetInterfaceModeParameter(CityOperationTypes.PARAM_DISTRICT_TYPE) local district = GameInfo.Districts[districtHash] local kPlot = Map.GetPlotByIndex(newGrowthPlot) if kPlot:CanHaveDistrict(district.Index, g_pCity:GetOwner(), g_pCity:GetID()) then DisplayGrowthTile() end end elseif eNewMode == InterfaceModeTypes.BUILDING_PLACEMENT then local newGrowthPlot = g_pCity:GetCulture():GetNextPlot() if (newGrowthPlot ~= -1) then local buildingHash = UI.GetInterfaceModeParameter(CityOperationTypes.PARAM_BUILDING_TYPE) local building = GameInfo.Buildings[buildingHash] local kPlot = Map.GetPlotByIndex(newGrowthPlot) if kPlot:CanHaveWonder(building.Index, g_pCity:GetOwner(), g_pCity:GetID()) then DisplayGrowthTile() end end end if not ContextPtr:IsHidden() then ViewMain(m_kData) end end -- =========================================================================== -- Engine EVENT -- Local player changed; likely a hotseat game -- =========================================================================== function OnLocalPlayerChanged(eLocalPlayer, ePrevLocalPlayer) if eLocalPlayer == -1 then m_pPlayer = nil return end m_pPlayer = Players[eLocalPlayer] if ContextPtr:IsHidden() == false then Close() end end -- =========================================================================== -- Show/hide an area based on the status of a checkbox control -- checkBoxControl A checkbox control that when selected is open -- buttonControl (optional) button control that toggles the state -- areaControl The area to be shown/hidden -- kParentControls DEPRECATED, not needed -- =========================================================================== function SetupCollapsibleToggle(pCheckBoxControl, pButtonControl, pAreaControl, kParentControls) pCheckBoxControl:RegisterCheckHandler(function() pAreaControl:SetHide(pCheckBoxControl:IsChecked()) end) if pButtonControl ~= nil then pButtonControl:RegisterCallback(Mouse.eLClick, function() pCheckBoxControl:SetAndCall(not pCheckBoxControl:IsChecked()) end) end end -- =========================================================================== -- LUA Event -- Tutorial requests controls that should always be locked down. -- Send nil to clear. -- =========================================================================== function OnTutorial_ContextDisableItems(contextName, kIdsToDisable) if contextName ~= "CityPanel" then return end -- Enable any existing controls that are disabled if m_kTutorialDisabledControls ~= nil then for _, name in ipairs(m_kTutorialDisabledControls) do if Controls[name] ~= nil then Controls[name]:SetDisabled(false) end end end m_kTutorialDisabledControls = kIdsToDisable -- Immediate set disabled if m_kTutorialDisabledControls ~= nil then for _, name in ipairs(m_kTutorialDisabledControls) do if Controls[name] ~= nil then Controls[name]:SetDisabled(true) else UI.DataError("Tutorial requested the control '" .. name .. "' be disabled in the city panel, but no such control exists in that context.") end end end end -- CUI ======================================================================= function CuiGetFoodToolTip(data) local foodToolTip = -- vanila tooltip data.FoodPerTurnToolTip .. "[NEWLINE][NEWLINE]" .. -- food consumption toPlusMinusString(-(data.FoodPerTurn - data.FoodSurplus)) .. " " .. Locale.Lookup("LOC_HUD_CITY_FOOD_CONSUMPTION") .. "[NEWLINE]------------------[NEWLINE]" .. -- happiness GetColorPercentString(1 + data.HappinessGrowthModifier / 100, 2) .. " " .. Locale.Lookup("LOC_HUD_CITY_HAPPINESS_GROWTH_BONUS") .. "[NEWLINE]" .. -- other GetColorPercentString(1 + Round(data.OtherGrowthModifiers, 2), 2) .. " " .. Locale.Lookup("LOC_HUD_CITY_OTHER_GROWTH_BONUSES") .. "[NEWLINE]" .. -- housing GetColorPercentString(data.HousingMultiplier, 2) .. " " .. Locale.Lookup("LOC_HUD_CITY_HOUSING_CAPACITY") if data.Occupied then foodToolTip = foodToolTip .. "[NEWLINE]" .. "x" .. data.OccupationMultiplier .. Locale.Lookup("LOC_HUD_CITY_OCCUPATION_MULTIPLIER") end return foodToolTip end -- CUI ======================================================================= function CuiForceHideCityBanner() CuiSettings:SetBoolean(CuiSettings.SHOW_CITYS, false) ContextPtr:LookUpControl("/InGame/CityBannerManager"):SetHide(true) LuaEvents.MinimapPanel_RefreshMinimapOptions() end -- CUI ======================================================================= function CuiForceShowCityBanner() CuiSettings:SetBoolean(CuiSettings.SHOW_CITYS, true) ContextPtr:LookUpControl("/InGame/CityBannerManager"):SetHide(false) LuaEvents.MinimapPanel_RefreshMinimapOptions() end -- =========================================================================== -- CTOR -- =========================================================================== function Initialize() LuaEvents.CityPanel_OpenOverview() m_isInitializing = true -- Context Events ContextPtr:SetInitHandler(OnInit) ContextPtr:SetShutdown(OnShutdown) -- Control Events Controls.BreakdownButton:RegisterCallback(Mouse.eLClick, OnBreakdown) Controls.ReligionButton:RegisterCallback(Mouse.eLClick, OnReligion) Controls.AmenitiesButton:RegisterCallback(Mouse.eLClick, OnAmenities) Controls.HousingButton:RegisterCallback(Mouse.eLClick, OnHousing) Controls.CitizensGrowthButton:RegisterCallback(Mouse.eLClick, OnCitizensGrowth) Controls.CultureCheck:RegisterCheckHandler(function() OnCheckYield(YieldTypes.CULTURE, "Culture") end) Controls.FaithCheck:RegisterCheckHandler(function() OnCheckYield(YieldTypes.FAITH, "Faith") end) Controls.FoodCheck:RegisterCheckHandler(function() OnCheckYield(YieldTypes.FOOD, "Food") end) Controls.GoldCheck:RegisterCheckHandler(function() OnCheckYield(YieldTypes.GOLD, "Gold") end) Controls.ProductionCheck:RegisterCheckHandler(function() OnCheckYield(YieldTypes.PRODUCTION, "Production") end) Controls.ScienceCheck:RegisterCheckHandler(function() OnCheckYield(YieldTypes.SCIENCE, "Science") end) Controls.CultureIgnore:RegisterCallback(Mouse.eLClick, function() OnResetYieldToNormal(YieldTypes.CULTURE, "Culture") end) Controls.FaithIgnore:RegisterCallback(Mouse.eLClick, function() OnResetYieldToNormal(YieldTypes.FAITH, "Faith") end) Controls.FoodIgnore:RegisterCallback(Mouse.eLClick, function() OnResetYieldToNormal(YieldTypes.FOOD, "Food") end) Controls.GoldIgnore:RegisterCallback(Mouse.eLClick, function() OnResetYieldToNormal(YieldTypes.GOLD, "Gold") end) Controls.ProductionIgnore:RegisterCallback(Mouse.eLClick, function() OnResetYieldToNormal(YieldTypes.PRODUCTION, "Production") end) Controls.ScienceIgnore:RegisterCallback(Mouse.eLClick, function() OnResetYieldToNormal(YieldTypes.SCIENCE, "Science") end) Controls.NextCityButton:RegisterCallback(Mouse.eLClick, OnNextCity) Controls.PrevCityButton:RegisterCallback(Mouse.eLClick, OnPreviousCity) if GameCapabilities.HasCapability("CAPABILITY_GOLD") then -- CUI: combine buttons. -- Controls.PurchaseTileCheck:RegisterCheckHandler(OnTogglePurchaseTile ); -- Controls.PurchaseTileCheck:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end); -- Controls.ProduceWithGoldCheck:RegisterCheckHandler(OnTogglePurchaseWithGold) Controls.ProduceWithGoldCheck:RegisterCallback(Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over") end) else -- Controls.PurchaseTileCheck:SetHide(true); Controls.ProduceWithGoldCheck:SetHide(true) end -- CUI: combine buttons. Controls.ManageTileCheck:RegisterCheckHandler(CuiOnToggleManageTile) Controls.ManageTileCheck:RegisterCallback(Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over") end) -- Controls.ManageCitizensCheck:RegisterCheckHandler( OnToggleManageCitizens ); -- Controls.ManageCitizensCheck:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end); -- Controls.ChangeProductionCheck:RegisterCheckHandler(OnToggleProduction) Controls.ChangeProductionCheck:RegisterCallback(Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over") end) Controls.ProduceWithFaithCheck:RegisterCheckHandler(OnTogglePurchaseWithFaith) Controls.ProduceWithFaithCheck:RegisterCallback(Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over") end) Controls.ToggleOverviewPanel:RegisterCheckHandler(OnToggleOverviewPanel) Controls.ToggleOverviewPanel:RegisterCallback(Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over") end) -- Game Core Events Events.CityAddedToMap.Add(OnCityAddedToMap) Events.CityNameChanged.Add(OnCityNameChanged) Events.CitySelectionChanged.Add(OnCitySelectionChanged) Events.CityFocusChanged.Add(OnCityFocusChange) Events.CityProductionCompleted.Add(OnCityProductionCompleted) Events.CityProductionUpdated.Add(OnCityProductionUpdated) Events.CityProductionChanged.Add(OnCityProductionChanged) Events.CityWorkerChanged.Add(OnCityWorkerChanged) Events.DistrictDamageChanged.Add(OnCityProductionChanged) Events.LocalPlayerTurnBegin.Add(OnLocalPlayerTurnBegin) Events.ImprovementChanged.Add(OnCityProductionChanged) Events.InterfaceModeChanged.Add(OnInterfaceModeChanged) Events.LocalPlayerChanged.Add(OnLocalPlayerChanged) Events.PlayerResourceChanged.Add(OnPlayerResourceChanged) Events.UnitSelectionChanged.Add(OnUnitSelectionChanged) -- LUA Events LuaEvents.CityPanelOverview_CloseButton.Add(OnCloseOverviewPanel) LuaEvents.CityPanel_SetOverViewState.Add(OnCityPanelSetOverViewState) LuaEvents.CityPanel_ToggleManageCitizens.Add(function() -- CUI: combine buttons. -- Controls.ManageCitizensCheck:SetAndCall(not Controls.ManageCitizensCheck:IsChecked()); Controls.ManageTileCheck:SetAndCall(not Controls.ManageTileCheck:IsChecked()) end) LuaEvents.GameDebug_Return.Add(OnGameDebugReturn) LuaEvents.ProductionPanel_Close.Add(OnProductionPanelClose) LuaEvents.ProductionPanel_ListModeChanged.Add(OnProductionPanelListModeChanged) LuaEvents.ProductionPanel_Open.Add(OnProductionPanelOpen) LuaEvents.Tutorial_CityPanelOpen.Add(OnTutorialOpen) LuaEvents.Tutorial_ContextDisableItems.Add(OnTutorial_ContextDisableItems) -- Truncate possible static text overflows TruncateStringWithTooltip(Controls.BreakdownLabel, MAX_BEFORE_TRUNC_STATIC_LABELS, Controls.BreakdownLabel:GetText()) TruncateStringWithTooltip(Controls.ReligionLabel, MAX_BEFORE_TRUNC_STATIC_LABELS, Controls.ReligionLabel:GetText()) TruncateStringWithTooltip(Controls.AmenitiesLabel, MAX_BEFORE_TRUNC_STATIC_LABELS, Controls.AmenitiesLabel:GetText()) TruncateStringWithTooltip(Controls.HousingLabel, MAX_BEFORE_TRUNC_STATIC_LABELS, Controls.HousingLabel:GetText()) end Initialize()
function Binomial( n, k ) if k > n then return nil end if k > n/2 then k = n - k end -- (n k) = (n n-k) numer, denom = 1, 1 for i = 1, k do numer = numer * ( n - i + 1 ) denom = denom * i end return numer / denom end
getglobal game getfield -1 Players getfield -1 LocalPlayer getfield -1 Character getfield -1 HumanoidRootPart getglobal CFrame getfield -1 new pushnumber 323 pushnumber 41 pushnumber 1930 pcall 3 1 0 setfield -3 CFrame
local trump = {} local mattata = require('mattata') function trump:init(configuration) trump.arguments = 'trump <target>' trump.commands = mattata.commands(self.info.username, configuration.commandPrefix):c('trump').table trump.help = configuration.commandPrefix .. 'trump <target> - Trump somebody (or something). If no target is given then, well, you ARE the target!' end local trumps = { 'VICTIM is a clown!', 'VICTIM is a dummy!', 'VICTIM is one of the dumbest of all pundits', 'VICTIM has no sense of the real world!', 'VICTIM is closing in on being the dumbest of them all', 'VICTIM doesn\'t have a clue', 'VICTIM is a disaster', 'VICTIM is a dope!', 'VICTIM knows nothing', 'VICTIM is dumb!', 'VICTIM is trying to extort $1,000,000.00 from me', 'VICTIM is so disgraceful!', 'VICTIM tried to extort $1,000,000 from me', 'VICTIM is a total loser!', 'VICTIM tried to shake me down for one million dollars', 'VICTIM is a great big phony', 'VICTIM represents conservative values terribly & are bad for America', 'VICTIM asked me for $1 million. I said no & they went negative. Extortion!', 'VICTIM went hostile w/ a series of incorrect & ill-informed ads', 'VICTIM is a total fraud', 'VICTIM is so unbelieveably crooked', 'VICTIM is falsely advertising', 'VICTIM is so little respected', 'VICTIM is a total hypocrites!', 'VICTIM is a great big phony', 'VICTIM is a big fat mistake', 'VICTIM is a failed \'Bushy\' & PA Governor', 'VICTIM shouldn\'t be allowed to do bias commentary', 'VICTIM has a faulty thought process', 'VICTIM is a failed Jeb Bushy', 'VICTIM never says anything good & never will', 'VICTIM shouldn\'t even be on the air!', 'VICTIM should be fired!', 'VICTIM is so biased', 'VICTIM is totally unfair', 'VICTIM still thinks Romney won', 'VICTIM is a dummy', 'VICTIM has no credibility', 'VICTIM is a loser', 'VICTIM is pushing Republicans down the same old path of defeat', 'VICTIM is dopey', 'VICTIM is an establishment flunky', 'VICTIM should get a life', 'VICTIM just totally bombed', 'VICTIM has ZERO credibility', 'VICTIM is an establishment dope', 'VICTIM has made so many mistakes', 'VICTIM is part of the Republican Establishment problem', 'VICTIM is an all talk, no action dummy!', 'VICTIM is a total fool', 'VICTIM purposely mischaracterised my statement', 'VICTIM is a big fat moron', 'VICTIM is a biased dope', 'VICTIM is easy to beat!', 'VICTIM spent $430 million and lost ALL races', 'VICTIM wasted $400 million', 'VICTIM didn\'t win one race', 'VICTIM is a total loser', 'VICTIM is a clown with zero credibility', 'VICTIM is an irrelevant clown, sweats and shakes nervously', 'VICTIM has no credibility', 'VICTIM is a Bush plant who called all races wrong', 'VICTIM is a dopey political pundit', 'VICTIM is one of the dumber people on television', 'VICTIM is a fraud', 'VICTIM is just pathetic', 'VICTIM is paid for by the politicians bosses', 'VICTIM is a total #Mediafraud', 'VICTIM is a joke!', 'VICTIM is in pocket of Wall Street', 'VICTIM is owned by the banks', 'VICTIM took hundreds of thousands of dollars in gifts', 'VICTIM is bought and paid for by special interests!', 'VICTIM is a terrible representative of Evangelicals', 'VICTIM is a nasty guy with no heart!', 'VICTIM is a total clown', 'VICTIM is a low-class slob', 'VICTIM knows nothing about me or my religion', 'VICTIM came to my office looking for work', 'VICTIM is a total disaster for Republicans & America', 'VICTIM is a total disaster', 'VICTIM is failing so badly that it will soon be taken off thr air', 'VICTIM is close to death', 'VICTIM is a dead T.V.', 'VICTIM should be put to sleep', 'VICTIM is a total loser', 'VICTIM is sloppy', 'VICTIM is grubby', 'VICTIM is a total mess-big crime', 'VICTIM is going through massive attacks to its people by the migrants allowed to enter the country', 'VICTIM is a total phony and con man', 'VICTIM is a total phony', 'VICTIM is just a dishonest guy', 'VICTIM asked me for expensive hotel rooms', 'VICTIM is a bad guy!', 'VICTIM is a total scam on our system and country', 'VICTIM is a total waste of money', 'VICTIM has too much staff being paid way too much money', 'VICTIM is a toy by comparison', 'VICTIM is a V.P.candidate who failed badly', 'VICTIM has a dead campaign', 'VICTIM is terrible at business', 'VICTIM did such a horrible job', 'VICTIM is a waste', 'VICTIM is all talk, no action', 'VICTIM is a very stupid, highly incompetent person running our country into the ground', 'VICTIM is just plain incompetent', 'VICTIM is in total disarray', 'VICTIM is a dishonest journlist', 'VICTIM is part of the dishonest media', 'VICTIM is losing too much money. Great news!', 'VICTIM is going out of business', 'VICTIM has no money, no cred!', 'VICTIM is a very untalented reporter', 'VICTIM is considered by many in the world of politics to be the dumbest and most slanted of the political sites', 'VICTIM is a scam!', 'VICTIM is dishonest', 'VICTIM is pure scum', 'VICTIM is so dishonest!', 'VICTIM has no power', 'VICTIM is a clown', 'VICTIM is a serious hater', 'VICTIM is really dishonest', 'VICTIM is losing lots of money', 'VICTIM is not read or respected by many', 'VICTIM goes out of their way to distort truth!', 'VICTIM covers me more inaccurately than any other media source', 'VICTIM is an incompetent judge!', 'VICTIM has embarrassed all by making very dumb political statements about me', 'VICTIM has a mind that is shot', 'VICTIM should resign!', 'VICTIM is totally ineffective & has been for years', 'VICTIM questioned me in such a nasty fashion', 'VICTIM is bad at math, nobody cares what they say in their editorials anymore, especially me!', 'VICTIM reported \'Cruz momentum\' but nothing about the fact that I easily won!', 'VICTIM is so dishonest', 'VICTIM so totally wrong', 'VICTIM loves to write badly about me', 'VICTIM looks like a tabloid', 'VICTIM is ever-dwindling', 'VICTIM hAS BAD JUDGEMENT', 'VICTIM is really dumb', 'VICTIM should never have been written', 'VICTIM is back to doing very sleazy and dishonest \'pushpolls\' on me', 'VICTIM is begging for money like a dog', 'VICTIM is biased', 'VICTIM is a @FoxNews flunky', 'VICTIM is a Iraq war monger', 'VICTIM is highly overrated', 'VICTIM should be fired', 'VICTIM a dope', 'VICTIM is bought and paid for by lobbyists!', 'VICTIM will never MAKE AMERICA GREAT AGAIN!', 'VICTIM has the worst voting record in the U.S. Senate in many years', 'VICTIM is a total lightweight', 'VICTIM is scamming Florida', 'VICTIM is a dishonest lightweight', 'VICTIM is a fraud lightweight', 'VICTIM is a big loser', 'VICTIM puts out ad that my pilot was a drug dealer- not true, not my pilot!', 'VICTIM has the worst record', 'VICTIM never even shows up to vote', 'VICTIM treated America\'s ICE officers \'like absolute trash\' in order to pass Obama\'s amnesty', 'VICTIM gave amnesty to criminal aliens guilty of \'sex offenses.\' DISGRACE!', 'VICTIM is just another Washington D.C. politician', 'VICTIM has poor work ethic!', 'VICTIM is set to be the \'puppet\' of the special interest Koch brothers', 'VICTIM is the lightweight no show Senator from Florida', 'VICTIM is not as smart as Cruz, and may be an even bigger liar', 'VICTIM doesn\'t even show up for votes!', 'VICTIM is a choker, and once a choker, always a choker!', 'VICTIM not presidential material', 'VICTIM looks like a little boy on stage', 'VICTIM is very weak on illegal immigration', 'VICTIM is a lightweight choker', 'VICTIM couldn\'t even respond properly to President Obama\'s State of the Union Speech without pouring sweat & chugging water', 'VICTIM is a highly overrated politician', 'VICTIM cannot be President', 'VICTIM only won the debate in the minds of desperate people', 'VICTIM is very disloyal to Jeb', 'VICTIM is weak on illegal immigration', 'VICTIM is VERY weak on illegal immigration', 'VICTIM is perfect little puppet', 'VICTIM is very disloyal', 'VICTIM never made ten cents', 'VICTIM is totally controlled', 'VICTIM is lazy', 'VICTIM has worst voting record in Senate', 'VICTIM is very weak on stopping illegal immigration', 'VICTIM knows nothing about finance', 'VICTIM is VERY weak on immigration', 'VICTIM is incapable of making great trade deals', 'VICTIM is rarely there to vote on a bill', 'VICTIM has one of the worst attendance record in Senate', 'VICTIM will allow anyone into the country', 'VICTIM truly doesn\'t have a clue!', 'VICTIM is broken, like so much else in our country', 'VICTIM came out with another one of their phony polls', 'VICTIM should be totally discredited', 'VICTIM cannot report the news truthfully', 'VICTIM choked like a dog', 'VICTIM is a mixed up man who doesn\'t have a clue. No wonder he lost!', 'VICTIM is a total joke, and everyone knows it!', 'VICTIM is a disaster candidate who had no guts and choked', 'VICTIM begged me for my endorsement four years ago', 'VICTIM doesn\'t know how to win', 'VICTIM didn\'t show his tax return until SEPTEMBER 21, 2012, and then only after being humiliated by Harry R', 'VICTIM is one of the dumbest and worst candidates in the history of Republican politics', 'VICTIM is so awkward and goofy', 'VICTIM blew an election that should have never been lost', 'VICTIM had a terrible \'choke\' loss to Obama', 'VICTIM lost an election that should have easily been won', 'VICTIM should not be allowed on TV', 'VICTIM is truly one of the dumbest of the talking heads', 'VICTIM consistently fumbles & misrepresents poll results', 'VICTIM has been so wrong & hates it!', 'VICTIM is in a total meltdown', 'VICTIM has a weakness that is the greatest recruiting tool of ISIS!!!', 'VICTIM continues to report fictious poll numbers', 'VICTIM is pushing the GOP around', 'VICTIM wants ridiculous debate terms', 'VICTIM is a crime and killing machine', 'VICTIM is so unbelievably crooked', 'VICTIM wants to flood our country with Syrian immigrants that we know little or nothing about', 'VICTIM is a liar!', 'VICTIM betrayed Bernie voters', 'VICTIM is not at all loyal', 'VICTIM killed jobs!', 'VICTIM is against steelworkers and miners', 'VICTIM destroyed jobs and manufacturing', 'VICTIM led Obama into bad decisions!', 'VICTIM will sell our country down the tubes!', 'VICTIM is bought and paid for by Wall Street, lobbyists and special interests', 'VICTIM is a DISASTER on foreign policy', 'VICTIM is Sad!!', 'VICTIM is not qualified', 'VICTIM has WEAK leadership', 'VICTIM is sooooo guilty', 'VICTIM lied to the FBI and to the people of our country', 'VICTIM has very bad judgement', 'VICTIM is not fit to lead!', 'VICTIM is unfit to serve as President', 'VICTIM hAS BAD JUDGEMENT!', 'VICTIM is a total disgrace!', 'VICTIM is the founder of ISIS', 'VICTIM is guilty as hell', 'VICTIM will NEVER be able to handle the complexities and danger of ISIS', 'VICTIM is sellng out America', 'VICTIM has such bad judgement', 'VICTIM has no sense of markets', 'VICTIM may be the most corrupt person ever to seek the presidency', 'VICTIM will be a disaster for jobs and the economy!', 'VICTIM defrauded America', 'VICTIM has a judgement that killed thousands, unleashed ISIS and wrecked the economy.', 'VICTIM has really bad judgement and a temperament', 'VICTIM is totally unfit to be our president', 'VICTIM is unable to answer tough questions!', 'VICTIM has a very bad and destructive track record', 'VICTIM is not honest!', 'VICTIM doesn\'t even look presidential!', 'VICTIM is reading poorly from the telepromter!', 'VICTIM no longer has credibility', 'VICTIM has zero natural talent', 'VICTIM has a very stupid use of e-mails', 'VICTIM suffers from plain old bad judgement!', 'VICTIM is reckless and dangerous', 'VICTIM has zero imagination and even less stamina', 'VICTIM can\'t close the deal with Bernie Sanders', 'VICTIM can\'t close the deal on Crazy Bernie', 'VICTIM has bad judgment!', 'VICTIM is pushing the false narrative that I want to raise taxes', 'VICTIM has ZERO leadership ability', 'VICTIM is constantly playing the women\'s card - it is sad!', 'VICTIM is dealing with men who get off the reservation.', 'VICTIM is perhaps the most dishonest person to have ever run for the presidency', 'VICTIM is one of the all time great enablers!', 'VICTIM is unqualified to be president', 'VICTIM has been involved in corruption for most of her professional life!', 'VICTIM is a major national security risk', 'VICTIM lied last week', 'VICTIM doesn\'t have the strength or stamina to be president', 'VICTIM is a totally flawed candidate', 'VICTIM lIED at the debate last night', 'VICTIM does not have the STRENGTH or STAMINA to be President', 'VICTIM will be soundly defeated', 'VICTIM won\'t call out radical Islam', 'VICTIM is afraid of Obama & the emails', 'VICTIM is totally incompetent as a manager and leader', 'VICTIM looked lost', 'VICTIM is 100% CONTROLLED', 'VICTIM did a terrible job', 'VICTIM did an absolutely horrible job of securing the border', 'VICTIM should be ashamed', 'VICTIM failed on the border', 'VICTIM should be forced to take an IQ test', 'VICTIM doesn\'t understand what the word demagoguery means', 'VICTIM failed at the border', 'VICTIM needs a new pair of glasses', 'VICTIM just wants to shut down and go home to bed!', 'VICTIM totally sold out', 'VICTIM has done such a complete fold', 'VICTIM has totally given up on his fight for the people', 'VICTIM has lost his energy and his strength', 'VICTIM flamed out', 'VICTIM has no energy left!', 'VICTIM is exhausted', 'VICTIM just can\'t go on any longer', 'VICTIM is ending really weak', 'VICTIM has abandoned his supporters', 'VICTIM is selling out!', 'VICTIM is lying when he says his disruptors aren\'t told to go to my events.', 'VICTIM would be so easy to beat!', 'VICTIM can\'t even defend his own microphone', 'VICTIM did really poorly on television', 'VICTIM could not stop Obama (twice)', 'VICTIM out of self preservation, is concerned w/ my high poll #s', 'VICTIM loses a fortune', 'VICTIM doesn\'t have a clue', 'VICTIM is trying to destroy Israel with all his bad moves', 'VICTIM is living in a world of the make believe!', 'VICTIM is the worst president in U.S. history!', 'VICTIM looks and sounds so ridiculous', 'VICTIM spends so much time speaking of the so-called Carbon footprint, and yet he flies all the way to Hawaii on a massive old 747', 'VICTIM has a horrible attitude', 'VICTIM is just so bad!', 'VICTIM is hollowing out our military', 'VICTIM is doing a terrible job', 'VICTIM is doing many bad things behind our backs', 'VICTIM is controlled by Mexican government?', 'VICTIM has guests are stacked for Crooked Hillary!', 'VICTIM is getting more and more biased', 'VICTIM is so negative, getting even worse', 'VICTIM is working hard to make me look as bad as possible', 'VICTIM paid a fortune for an Iowa Poll, which shows me in first place over Cruz by 13%, 33% to 20% - then doesn\'t use it', 'VICTIM is totally one-sided and biased against me that it is becoming boring', 'VICTIM does not cover me accurately', 'VICTIM has a major inferiority complex', 'VICTIM is a dopey clown', 'VICTIM has knowingly committed fraud', 'VICTIM wants to control our U.S. politicians with daddy\'s money', 'VICTIM is a really stupid talking head', 'VICTIM is an embarrassed loser', 'VICTIM lost all credibility', 'VICTIM couldn\'t get elected dog catcher', 'VICTIM forgot to mention my phenomenal biz success rate', 'VICTIM didn\'t get the right gene.', 'VICTIM reminds me of a spoiled brat without a properly functioning brain', 'VICTIM is a third rate talent', 'VICTIM is a total loser!', 'VICTIM has no power in iowa', 'VICTIM is so totally dishonest!', 'VICTIM is unfair and biased', 'VICTIM will always take a good story about me and make it bad', 'VICTIM is a disgusting fraud', 'VICTIM is laughing at the @nytimes for the lame hit piece they did on me and women', 'VICTIM wrote yet another hit piece on me', 'VICTIM is always trying to belittle', 'VICTIM has lost its way!', 'VICTIM never even calls to fact check', 'VICTIM knowingly writes lies', 'VICTIM allows dishonest writers to totally fabricate stories', 'VICTIM should focus on fair and balanced reporting', 'VICTIM made all bad decisions over the last decade', 'VICTIM is falling apart', 'VICTIM is always looking for a hit to bring them back into relevancy2014ain\'t working', 'VICTIM is now irrelevant', 'VICTIM is one of the dumbest people in politics', 'VICTIM has no talent, no TV persona', 'VICTIM is one of the least talented people on television', 'VICTIM is a totally biased loser who doesn\'t have a clue', 'VICTIM will be gone soon', 'VICTIM is really hard to watch, has zero talent', 'VICTIM, you have no idea what my strategy on ISIS is', 'VICTIM is so average in so many ways!', 'VICTIM is always complaining about Trump', 'VICTIM is so average in every way', 'VICTIM is very bad at math', 'VICTIM should take another eleven day \'unscheduled\' vacation', 'VICTIM is not very good or professional', 'VICTIM really bombed tonight', 'VICTIM is getting ready to treat me unfairly', 'VICTIM is a total low life', 'VICTIM will fade fast', 'VICTIM is a major sleaze and buffoon', 'VICTIM got thrown off of TV by NBC', 'VICTIM has done nothing', 'VICTIM is incapable of doing anything.', 'VICTIM has failed miserably', 'VICTIM is doing a lousy job in taking care of our Vets', 'VICTIM let us down', 'VICTIM graduated last in their class', 'VICTIM should be defeated in the primaries', 'VICTIM has gone really hostile ever since I said I won\'t do or watch the show anymore', 'VICTIM doesn\'t have much power or insight!', 'VICTIM has gone wild with hate', 'VICTIM has the absolutely worst anti-Trump talking heads on his show', 'VICTIM is a hater & racist', 'VICTIM has to stop working to be so politically correct', 'VICTIM asked if he could have pictures taken with me. I said fine. He then trashes on air!', 'VICTIM is highly neurotic', 'VICTIM was the WORST abuser of woman in U.S. political history', 'VICTIM a gigantic hypocrite', 'VICTIM was called a racist', 'VICTIM dEMONSTRATED A PENCHANT FOR SEXISM', 'VICTIM is so inappropriate', 'VICTIM won\'t survive', 'VICTIM has lost all credibility', 'VICTIM endorsed a candidate who can\'t win', 'VICTIM is desperate', 'VICTIM begged me for ads', 'VICTIM has been run into the ground', 'VICTIM will be dead in 2 years', 'VICTIM is so biased it is disgusting', 'VICTIM treats me so badly', 'VICTIM is incapable of understanding foreign policy', 'VICTIM should know that the pyramids built for grain storage - don\'t people get it?', 'VICTIM has never created a job in his life', 'VICTIM isn\'t smart enough to know what\'s going on at the border', 'VICTIM is not looking tough!', 'VICTIM is not looking smart', 'VICTIM is not looking good', 'VICTIM totally lost control of illegal immigration, even with criminals', 'VICTIM looks more and more like a paper tiger', 'VICTIM is letting criminals knowingly stay in our country', 'VICTIM is just a 3rd rate \'gotcha\' guy!', 'VICTIM is kooky', 'VICTIM is totally ineffective', 'VICTIM is a low-level degenerate', 'VICTIM should drop out of the race-stop wasting time & money', 'VICTIM really went wacko today', 'VICTIM can\'t function under pressure', 'VICTIM is not very presidential', 'VICTIM has NO path to victory', 'VICTIM can never beat Hilary Clinton', 'VICTIM is mathematically dead and totally desperate', 'VICTIM hates New York', 'VICTIM can\'t win with the voters so he has to sell himself to the bosses', 'VICTIM can\'t get votes (I am millions ahead of him)', 'VICTIM has to get his delegates from the Republican bosses', 'VICTIM attacked New Yorkers and New York values- we don\'t forget!', 'VICTIM has accomplished absolutely nothing', 'VICTIM does not have the right \'temperment\' to be President', 'VICTIM is the biggest liar in politics!', 'VICTIM is acomplete & total liar', 'VICTIM holds the Bible high and then lies and misrepresents the facts!', 'VICTIM lies so much and is so dishonest', 'VICTIM should be immediately disqualified in Iowa', 'VICTIM told thousands of caucusgoers (voters) that Trump was strongly in favor of ObamaCare and \'choice\' - a total lie!', 'VICTIM sent out a VOTER VIOLATION certificate to thousands of voters', 'VICTIM didn\'t win Iowa, he illegally stole it', 'VICTIM can\'t even get a Senator like @BenSasse, who is easy, to endorse him', 'VICTIM will do anything to stay at the trough', 'VICTIM is dropping like a rock', 'VICTIM is in bed w/ Wall St.', 'VICTIM is spending $millions on ads paid for by his N.Y. bosses', 'VICTIM says one thing for money, does another for votes', 'VICTIM is the ultimate hypocrite', 'VICTIM did not list on his personal disclosure form personally guaranteed loans from banks. They own him!', 'VICTIM is not much of a reformer', 'VICTIM would speak behind my back, get caught, and then deny it', 'VICTIM should not make statements behind closed doors to his bosses', 'VICTIM made many bad calls', 'VICTIM is one of the most overrated political pundits', 'VICTIM is wrong almost all of the time', 'VICTIM should be thrown off Fox News', 'VICTIM is boring and totally biased', 'VICTIM is a major lightweight with no credibility', 'VICTIM has no honor!', 'VICTIM was ran out of the race like a little boy', 'VICTIM should respect me', 'VICTIM is a dumb mouthpiece', 'VICTIM got zero against me- no cred!', 'VICTIM had zero in his presidential run before dropping out in disgrace', 'VICTIM embarrasses himself with endorsement of Bush', 'VICTIM embarrassed himself with his failed run for President', 'VICTIM is so easy to beat!', 'VICTIM is low energy', 'VICTIM wants to look cool, but it\'s far too late', 'VICTIM has no clue', 'VICTIM is spending a fortune of special interest against me in SC', 'VICTIM is desperate and SAD!', 'VICTIM gave up and enlisted Mommy and his brother', 'VICTIM is by far the weakest of the lot', 'VICTIM has gone nasty with lies', 'VICTIM is a pathetic figure!', 'VICTIM spent a fortune of special interest money on a Super Bowl ad', 'VICTIM has zero communication skills', 'VICTIM had to bring in mommy to take a slap at me', 'VICTIM should go home and relax!', 'VICTIM is a total embarrassment to himself and his family', 'VICTIM is a basket case', 'VICTIM has been confused for forty years', 'VICTIM is bad on women\'s health issues', 'VICTIM is miserable', 'VICTIM just doesn\'t get it', 'VICTIM will never secure the border', 'VICTIM will NEVER Make America Great Again', 'VICTIM has gone off the deep end', 'VICTIM misrepresents my positions!', 'VICTIM is rapidly fading', 'VICTIM is so off the rails', 'VICTIM is a waste of time', 'VICTIM just doesn\'t know about winning', 'VICTIM is now in total freefall', 'VICTIM is one of the dumber bloggers', 'VICTIM is really boring, slow, lethargic', 'VICTIM wouldn\'t know the truth if it hit him in the face', 'VICTIM has paid ZERO respect to the great police and law enforcement professionals', 'VICTIM is a sleazebag', 'VICTIM is not only breaking the spirit of the law but the law itself', 'VICTIM is spending more time doing a forensic analysis of Melania\'s speech than the FBI spent on Hillary\'s emails', 'VICTIM is trying their absolute best to depict a star in a tweet as the Star of David rather than a Sheriff\'s Star, or plain star!', 'VICTIM is so totally biased', 'VICTIM is on a new phony kick about my management style', 'VICTIM has not covered my long-shot great finish in Iowa fairly', 'VICTIM will not report the highly respected new national poll that just came out', 'VICTIM is rambling and overly flamboyant', 'VICTIM begged my people for a job', 'VICTIM is virtually incompetent', 'VICTIM allowed Crooked Hillary to get away with \'murder\'', 'VICTIM is totally rigged and corrupt!', 'VICTIM bombed last night!', 'VICTIM is very racist!', 'VICTIM has a nasty mouth', 'VICTIM is one of the least productive U.S. Senators', 'VICTIM gets nothing done', 'VICTIM does nothing to help!', 'VICTIM didn\'t have the guts to run for POTUS', 'VICTIM has a career that is totally based on a lie', 'VICTIM wrote letter to me begging for forgiveness', 'VICTIM selfishly opposed to me!', 'VICTIM should resign', 'VICTIM is totally biased against me', 'VICTIM was going off the air until I came along', 'VICTIM knows so little about politics', 'VICTIM will be fired like a dog', 'VICTIM doesn\'t have a natural instinct for politics', 'VICTIM registers ZERO in the polls', 'VICTIM couldn\'t be elected dog catcher if he ran again', 'VICTIM spent $1,000 to register in New Hampshire & dropped out the next day. Such a waste!', 'VICTIM registered at less than 1 percent in the polls', 'VICTIM is such a mess', 'VICTIM knows nothing about me', 'VICTIM did a terrible job against me', 'VICTIM will lead to at least partial world destruction', 'VICTIM is a catastrophe', 'VICTIM made one of the dumbest & most dangerous misjudgments ever', 'VICTIM poses a direct national security threat', 'VICTIM wants $120,000 to make a boring speech', 'VICTIM covers me very inaccurately', 'VICTIM did a 1 hour hit job on me today', 'VICTIM is totally out of control', 'VICTIM treats me very badly', 'VICTIM is trying hard to disguise their massive Muslim problem', 'VICTIM will drop like a rock in the polls', 'VICTIM is good for Mexico!', 'VICTIM doesn\'t have what it takes', 'VICTIM can\'t debate', 'VICTIM fell right into President Obama\'s trap on ObamaCare', 'VICTIM came in dead last', 'VICTIM is so irrelevant to the race', 'VICTIM is uncomfortable looking', 'VICTIM sucks and is are bad for U.S.A.', 'VICTIM wants to continue our bad trade deals', 'VICTIM wasted a lot of time and money', 'VICTIM is weak and totally conflicted', 'VICTIM is dumb as a rock', 'VICTIM did a terrible job of ticket distrbution', 'VICTIM won\'t even call it what it is - RADICAL ISLAM!', 'VICTIM has zero credibility', 'VICTIM is very dumb and failing', 'VICTIM is a mental basketcase', 'VICTIM always seems to be crying' } function trump:onMessage(message) local input = mattata.input(message.text) local victim if not input then victim = message.from.first_name else if message.reply_to_message then victim = message.reply_to_message.from.first_name else victim = input end end mattata.sendMessage(message.chat.id, trumps[math.random(#trumps)]:gsub('VICTIM', victim) .. ' - Donald J. Trump', nil, true, false, message.message_id) end return trump
local S = minetest.get_translator("bobcraft_blocks") local function chest_formspec(chest_pos) local pos = chest_pos.x .. "," .. chest_pos.y .. "," .. chest_pos.z local formspec = "size[9,9]" .. "list[nodemeta:" .. pos .. ";main;0,0.3;9,4;]" .. "list[current_player;main;0,4.5;9,3;9]" .. "list[current_player;main;0,7.85;9,1;]" .. "listring[nodemeta:" .. pos .. ";main]" .. "listring[current_player;main]" return formspec end minetest.register_node("bobcraft_blocks:chest", { description = S("Chest"), tiles = { "chest_top.png", "chest_top.png", "chest_side.png", "chest_side.png", "chest_side.png", "chest_front.png", }, paramtype2 = "facedir", groups = {pickaxe=1}, sounds = bobcraft_sounds.node_sound_wood(), is_ground_content = false, hardness = 2.5, on_construct = function(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() inv:set_size('main', 9*4) end, on_rightclick = function(pos, node, player) minetest.sound_play({name="door_open", pos=pos}) minetest.show_formspec(player:get_player_name(), "bobcraft_blocks:chest", chest_formspec(pos)) end, after_dig_node = function(pos, oldnode, oldmeta, digger) -- we drop our inventory when broken for _, item in ipairs(oldmeta.inventory.main) do local item_drop = ItemStack(item) local item_count = item_drop:get_count() item_drop:set_count(1) for j=1, item_count do local dropped_item = minetest.add_item(table.copy(pos), item_drop) if dropped_item then dropped_item:get_luaentity().magnettime = break_flyto_time end end end end, })
local clamp,floor = math.Clamp,math.floor local min = math.min -- Local variables local function IsColdWorld() local mapEnt = StormFox.MAP.Entities()[1] if not mapEnt.coldworld then return false end return mapEnt.coldworld > 0 end local function lerpAnyValue( amount, currentValue, targetValue ) if not currentValue then return targetValue end -- NOTE: If you find that the values are going instantly to the target check here first if not targetValue then return currentValue end amount = math.Clamp( amount, 0, 1 ) if type( currentValue ) ~= type( targetValue ) then ErrorNoHalt("ERROR: lerpAnyValue called with values of two different types. Returning original value") debug.Trace() return currentValue end if type( currentValue ) == "number" then -- Standard number Lerp return Lerp( amount, currentValue, targetValue ) elseif type( currentValue ) == "table" and currentValue.a and currentValue.r and currentValue.g and currentValue.b then -- Color lerp local r = Lerp( amount, currentValue.r, targetValue.r ) local g = Lerp( amount, currentValue.g, targetValue.g ) local b = Lerp( amount, currentValue.b, targetValue.b ) local a = Lerp( amount, currentValue.a, targetValue.a ) return Color( r, g, b, a ) end ErrorNoHalt("ERROR: Unsupported lerp value type. Returning original value") return currentValue end -- functions function StormFox.CalculateMapLight( flTime , nMin, nMax ) if not nMin then nMin = 0 end if not nMax then nMax = 100 end flTime = flTime or StormFox.GetTime() -- Just a function to calc daylight amount based on time. See here https://www.desmos.com/calculator/842tvu0nvq local flMapLight = -0.00058 * math.pow( flTime - 750, 2 ) + nMax return clamp( flMapLight, nMin, nMax ) end local currentMapMaterialFunc,currentMapMaterial,currentLvl,currentMapMaterialid = nil,nil,0,"" if SERVER then local startTemp = math.random(StormFox.GetMapSetting("mintemp",-10),StormFox.GetMapSetting("maxtemp",20)) if IsColdWorld() then startTemp = math.min(startTemp,-3) end StormFox.SetNetworkData( "Temperature", startTemp ) StormFox.SetNetworkData( "Thunder",false) StormFox.SetNetworkData( "Wind", 0 ) StormFox.SetNetworkData( "WindAngle", math.random(360) ) --cl if StormFox.GetNetworkData( "Temperature",0) < -4 then if StormFox.WeatherTypes[ "rain" ] then local str,mType,lvl,snd = StormFox.WeatherTypes[ "rain" ].DataCalculationFunctions.MapMaterial(1,StormFox.GetNetworkData( "Temperature",0)) currentMapMaterialFunc = StormFox.WeatherTypes[ "rain" ].DataCalculationFunctions.MapMaterial StormFox.TexHandler.ApplyMaterial(str,mType,lvl,snd) end end function StormFox.SetWeather( sWeatherId, flMagnitude, tTime ) if not StormFox.GetWeatherType( sWeatherId ) then print( "[StormFox] Weather not found:", sWeatherId ) print(debug.traceback()) return end local old_w = StormFox.GetNetworkData("Weather","clear") StormFox.SetNetworkData( "Weather",sWeatherId) StormFox.SetNetworkData( "WeatherMagnitude", flMagnitude, tTime) if flMagnitude <= 0 then hook.Call("StormFox - NewWeather",nil,"clear",old_w) else hook.Call("StormFox - NewWeather",nil,sWeatherId,old_w) end end StormFox.SetWeather("clear",0) end local skyUpdate = 0 hook.Add("StormFox - NetDataChange","StormFox - WeatherLogic",function(var,weather) if var ~= "Weather" and var ~= "WeatherMagnitude" then return end local sWeatherID = StormFox.GetNetworkData( "Weather", "clear" ) local flMagnitude = StormFox.GetNetworkData( "WeatherMagnitude") or 0 if not StormFox.GetWeatherType( sWeatherID ) then print( "[StormFox] Weather not found:", sWeatherId ) return end StormFox.Weather = StormFox.GetWeatherType( sWeatherID ) skyUpdate = 0 -- update now end) -- timeChange local function timeToEnumeratedValue( flTime ) if flTime <= StormFox.Weather.TIME_SUNRISE - 60 then return "TIME_NIGHT" elseif flTime < StormFox.Weather.TIME_SUNRISE then return "TIME_SUNRISE" elseif flTime < StormFox.Weather.TIME_SUNSET then return "TIME_NOON" elseif flTime < StormFox.Weather.TIME_SUNSET + 60 then return "TIME_SUNSET" else return "TIME_NIGHT" end end -- update varables local instantSet = false hook.Add("StormFox.Time.Set","StormFox - instasetfix",function() instantSet = true skyUpdate = 0 end) local UPDATE_INTERVAL = 5 local oldTime,oldAmount,oldWeather local cacheAmount,cacheflMagnitude = {},-1 -- ground material controller if SERVER then timer.Create("StormFox - MapMaterialController",4,0,function() if not StormFox.GetMapSetting("material_replacment") then if currentMapMaterialFunc then -- Remove old material StormFox.TexHandler.ApplyMaterial() currentMapMaterial = nil end return end if not currentMapMaterialFunc then return end -- No ground function -- Load/generate data local sWeatherID = StormFox.GetNetworkData( "Weather", "clear" ) local mat,mType,lvl,snd = currentMapMaterialFunc(StormFox.GetNetworkData( "WeatherMagnitude" , 0),StormFox.GetNetworkData("Temperature",20),sWeatherID) lvl = clamp(floor(lvl or 0),0,3) -- Remove old weather-functions if nil material if not mat then -- Remove material and function currentLvl = 0 if currentMapMaterial then -- Remove old material StormFox.TexHandler.ApplyMaterial() currentMapMaterial = nil end if sWeatherID ~= currentMapMaterialid then -- Remove function if its set by old weather currentMapMaterialFunc = nil currentMapMaterialid = nil end return end -- Lvl 0 is no material change if lvl <= 0 then return end local checkMat = mat if type(mat) == "table" then checkMat = mat[1] end -- Only material if new or if material-lvl is grown if (currentMapMaterial or "") == checkMat and (lvl or 0) <= currentLvl then return end currentLvl = lvl currentMapMaterial = checkMat -- Update StormFox.TexHandler.ApplyMaterial(mat,mType,lvl,snd) end) end local function weatherThink() if skyUpdate > CurTime() then return end local flTimeSpeed = StormFox.GetTimeSpeed() if flTimeSpeed <= 0.2 then flTimeSpeed = 5 end skyUpdate = CurTime() + UPDATE_INTERVAL / flTimeSpeed -- Load data local sWeatherID = StormFox.GetNetworkData( "Weather", "clear" ) local flMagnitude = StormFox.GetNetworkData( "WeatherMagnitude" , 0) if flMagnitude <= 0 then StormFox.SetNetworkData( "Weather", "clear" ) sWeatherID = "clear" end if sWeatherID == "clear" then flMagnitude = 1 end local flTime = StormFox.GetTime() -- The UPDATE_INTERVAL seconds in the furture (Unless you speed up flTime) flTime = flTime + UPDATE_INTERVAL / flTimeSpeed local currentTimeType = timeToEnumeratedValue(flTime) local dataUpdate = min(5,UPDATE_INTERVAL / flTimeSpeed) * 10 local newWeather = oldWeather ~= StormFox.Weather.id local newTime = oldTime ~= currentTimeType local newMagnitude = oldAmount ~= flMagnitude if newMagnitude then dataUpdate = dataUpdate / 4 end if instantSet then newWeather = true instantSet = false dataUpdate = nil end -- Calc weather and day data if not newWeather and not newTime and not newMagnitude then return end oldTime = currentTimeType oldAmount = flMagnitude oldWeather = StormFox.Weather.id -- Update Static data if newWeather then dataUpdate = 5 for key,_ in pairs(StormFox.Weather.StaticData) do StormFox.SetData(key,(StormFox.Weather:GetData(key)), dataUpdate) end end -- Update timevars for key,_ in pairs(StormFox.Weather.TimeDependentData) do if flMagnitude >= 1 then StormFox.SetData(key,(StormFox.Weather:GetData(key,flTime)), dataUpdate) elseif flMagnitude > 0 then local base = StormFox.GetWeatherType("clear"):GetData(key,flTime) local aim = StormFox.Weather:GetData(key,flTime) if not aim then StormFox.SetData(key,base, dataUpdate) else local var = lerpAnyValue(flMagnitude,base,aim) StormFox.SetData(key,var, dataUpdate) end end end -- Update weather/magnitude if newMagnitude or newWeather then for key,_ in pairs(StormFox.Weather.CalculatedData) do if flMagnitude >= 1 then StormFox.SetData(key,(StormFox.Weather:GetData(key,flTime)), dataUpdate) elseif flMagnitude >= 0 then local base = StormFox.GetWeatherType("clear"):GetData(key,flTime) local aim = StormFox.Weather:GetData(key,flTime) if not aim then StormFox.SetData(key,base, dataUpdate) else local var = lerpAnyValue(flMagnitude,base,aim) StormFox.SetData(key,var, dataUpdate) end end end for key,func in pairs(StormFox.Weather.DataCalculationFunctions) do if type(func) ~= "function" then ErrorNoHalt("[StormFox]: DataCalculationFunctions with an unknown value.") elseif key == "MapMaterial" then currentMapMaterialFunc = func currentMapMaterialid = sWeatherID else StormFox.SetData(key,func(flMagnitude,currentTimeType), dataUpdate) end end end end hook.Add( "Think", "StormFox - WeatherThink", weatherThink ) timer.Create("StormFox - MapLight",5,0,function() -- Generate maplight local mapLight = StormFox.CalculateMapLight(StormFox.GetTime(),StormFox.GetData("MapNightLight",0),StormFox.GetData("MapDayLight",100)) -- mapLight is from 0 to 100 -- Add the map-settings local minlight,maxlight = StormFox.GetMapSetting("minlight",4),StormFox.GetMapSetting("maxlight",80) local delta = (maxlight - minlight ) / 100 local light = minlight + mapLight * delta --print("Calculated light: " .. mapLight) --print("Min",minlight,"Max",maxlight) --print("Delta",delta) --print("Light calc",light) StormFox.SetData("DayLightAmount",mapLight) StormFox.SetData("MapLight",light) if SERVER then -- StormFox.CalculateMapLight(flTime, 0, 1) StormFox.SetMapLight(light) end end) if SERVER then timer.Create("StormFox - BloomControl",5,0,function() StormFox.SetMapBloom(StormFox.GetData("MapBloom") or 0.2) StormFox.SetMapBloomAutoExposureMin(StormFox.GetData("MapBloomMin") or 0.7) StormFox.SetMapBloomAutoExposureMax(StormFox.GetData("MapBloomMax") or 1) end) end local function ET(pos,pos2,mask,filter) if not pos or not pos2 then return {} end local t = util.TraceLine( { start = pos, endpos = pos + pos2, mask = mask, filter = filter } ) if not t then return {} end -- Sometimes it returns nil?? if not t.HitPos then t.HitPos = pos + pos2 end return t end local max = math.max if SERVER then timer.Create("StormFox - WeatherEvent",1,0,function() if type(StormFox.Weather.InRain) ~= "function" then return end local Gauge = StormFox.GetData("Gauge",0) local wind = StormFox.GetNetworkData("Wind",0) local windangle = StormFox.GetNetworkData("WindAngle",0) local flMagnitude = StormFox.GetNetworkData( "WeatherMagnitude" , 0) local downspeed = -max(1.56 * Gauge + 1.22,10) -- Base on realworld stuff .. and some tweaking (Was too slow) downfallNorm = Angle(0,windangle,0):Forward() * wind downfallNorm.z = downspeed for _,ply in ipairs(player.GetAll()) do local tr = ET(ply:GetShootPos(),downfallNorm * -16384,MASK_SHOT,ply) if tr.HitSky then StormFox.Weather:InRain(ply,flMagnitude) end end end) else timer.Create("StormFox - WeatherEvent",1,0,function() if type(StormFox.Weather.InRain) ~= "function" then return end if not StormFox.Env.IsInRain() then return end StormFox.Weather:InRain(LocalPlayer(),flMagnitude) end) end
SettingsSliderItem = setmetatable({}, SettingsSliderItem) SettingsSliderItem.__index = SettingsSliderItem SettingsSliderItem.__call = function() return "SettingsItem", "SettingsItem" end function SettingsSliderItem.New(label, max, startIndex, barColor) local data = { Base = BasicTabItem.New(label or ""), ItemType = SettingsItemType.SliderBar, Label = label or "", MaxValue = max, _value = startIndex, _coloredBarColor = barColor or Colours.HUD_COLOUR_FREEMODE, Parent = nil, _enabled = true, _hovered = false, _selected = false, OnBarChanged = function(item, value) end, OnSliderSelected = function(item, value) end } return setmetatable(data, SettingsSliderItem) end function SettingsSliderItem:Enabled(enabled) if enabled ~= nil then self._enabled = enabled if self.Parent ~= nil and self.Parent.Parent ~= nil and self.Parent.Parent.Base.Parent ~= nil and self.Parent.Parent.Base.Parent:Visible() then if self.Parent:Selected() then local tab = IndexOf(self.Parent.Parent.Base.Parent.Tabs, self.Parent.Parent) - 1 local leftItem = IndexOf(self.Parent.Parent.LeftItemList, self.Parent) - 1 local rightIndex = IndexOf(self.Parent.ItemList, self) - 1 ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("ENABLE_RIGHT_ITEM", false, tab, leftItem, rightIndex, self._enabled) end end else return self._enabled end end function SettingsSliderItem:Hovered(hover) if hover ~= nil then self._hovered = hover else return self._hovered end end function SettingsSliderItem:Selected(selected) if selected ~= nil then self._selected = selected else return self._selected end end function SettingsSliderItem:Value(value) if value ~= nil then self._value = value local tab = IndexOf(self.Parent.Parent.Base.Parent.Tabs, self.Parent.Parent) - 1 local leftItem = IndexOf(self.Parent.Parent.LeftItemList, self.Parent) - 1 local rightIndex = IndexOf(self.Parent.ItemList, self) - 1 ScaleformUI.Scaleforms._pauseMenu:SetRightSettingsItemValue(tab, leftItem, rightIndex, value) self.OnBarChanged(self, value) else return self._value end end function SettingsSliderItem:ColoredBarColor(color) if color ~= nil then self._coloredBarColor = color local tab = IndexOf(self.Parent.Parent.Base.Parent.Tabs, self.Parent.Parent) - 1 local leftItem = IndexOf(self.Parent.Parent.LeftItemList, self.Parent) - 1 local rightIndex = IndexOf(self.Parent.ItemList, self) - 1 ScaleformUI.Scaleforms._pauseMenu:UpdateItemColoredBar(tab, leftItem, rightIndex, color) else return self._coloredBarColor end end
-- load standard vis module, providing parts of the Lua API require('vis') lisp_file_types ={"clj", "cljs" , "lisp", "cljx", "cljc", "edn"} function paredit_remove_filetype (x) for k,v in pairs(lisp_file_types)do if v == x then lisp_file_types[k]=nil end end end function paredit_add_filetype (x) if type(x) == "string" then table.insert(lisp_file_types, x) end end local lexers = vis.lexers local l = require('lexer') local match = lpeg.match local P, R, S = lpeg.P, lpeg.R, lpeg.S local char_sexp_literals = P{"\\" * S('(){}[]"') } local char_literals = P{"\\" * (l.graph - S("n\"\\"))} local str_pattern = ('"' * ( ( P("\\\"") + (1 - S('"'))))^0 * '"') local strings_and_chars = str_pattern + char_sexp_literals local lisp_word = (((l.graph - S("(){}[]\"\\")) + char_literals))^1 function find_first (p) local I = lpeg.Cp () return lpeg.P{ I * p * I + 1 * lpeg.V(1) } end function is_lisp_file () local ex = vis.win.file.name if ex~=nil then local matcher = lpeg.P(lisp_file_types[1]) * P(-1) for i = 2, #lisp_file_types do matcher = matcher + lpeg.P(lisp_file_types[i] ) * P(-1) end return match(find_first (matcher), ex) else return nil end end local simple_sexp = P{("(" * ((1 - S("(){}[]\"")) + strings_and_chars + lpeg.V(1))^0 * ")") + ("[" * ((1 - S("(){}[]\"")) + strings_and_chars + lpeg.V(1))^0 * "]") + ("{" * ((1 - S("(){}[]\"")) + strings_and_chars + lpeg.V(1))^0 * "}")} local complete_balanced_sexp = P{("(" * ((1 - S("(){}[]\"")) + strings_and_chars + lpeg.V(1))^0 * ")") + ("[" * ((1 - S("(){}[]\"")) + strings_and_chars + lpeg.V(1))^0 * "]") + ("{" * ((1 - S("(){}[]\"")) + strings_and_chars + lpeg.V(1))^0 * "}") + (((l.graph - S("(){}[]\"\\")) + char_literals))^1+ str_pattern^1 } local empty_sexp = P{( "(" * S(" \n")^0 * ")") + ( "[" * S(" \n")^0 * "]") + ( "{" * S(" \n")^0 * "}")} local match_sexp = {["("] = ")", [")"] = "(", ["["] = "]", ["]"] = "[", ["{"] = "}", ["}"] = "{", ["\""]="\"" } function print_two (a,b) print (" " .. tostring (a) .. "--" .. tostring(b)) end function prinf (a,b,c) vis:info(" " .. tostring(a) .. " " .. tostring (b) .. " " .. tostring (c) ) end function prinmsg (a,b,c) vis:message(" " .. tostring(a) .. " " .. tostring (b) .. " " .. tostring (c) ) end function trim_space_around (pos) local file = vis.win.file local text = file:content(0, vis.win.file.size) if match ( S('\r\n\f\t ')^1, file:content(pos, 1)) and pos > 0 then local _ , start_pos = match (last_occurance(l.graph),vis.win.file:content(0, pos ) ) local end_pos, _ = match(next_occurance(l.graph),file:content(pos + 1, file.size -pos -1 ) ) file:delete(start_pos, end_pos + pos - start_pos ) vis.win.selection.pos = start_pos -1 end return pos end function is_sexp (start, finish) local text = vis.win.file:content(start , finish - start) return match(complete_balanced_sexp , text) end function is_sexp_empty () end function match_next_sexp (pos) local Range = {} local I = lpeg.Cp() local text = vis.win.file:content(pos + 1,vis.win.file.size) local start, finish = match(S(" \n")^0 * I * complete_balanced_sexp * I, text ) if start ~= nil then Range.start , Range.finish = pos + start, pos + finish end return Range end function match_next_simple_sexp (pos) local Range = {} local I = lpeg.Cp() local text = vis.win.file:content(pos + 1,vis.win.file.size) local start, finish = match(S(" \n")^0 * I * simple_sexp * I, text ) if start ~= nil then Range.start , Range.finish = pos + start, pos + finish end return Range end function last_occurance (p) local I = lpeg.Cp () return lpeg.P{(I * p * I * lpeg.S(" \n")^0 * lpeg.P(-1)) + 1 * lpeg.V(1)} end function next_occurance (p) local I = lpeg.Cp () return lpeg.P{(I * p * I + 1 * lpeg.V(1))} end function match_previus_sexp (pos) local text_trimmed = vis.win.file:content(0,pos) return match(last_occurance(complete_balanced_sexp), text_trimmed) end function match_previus_lisp_word (pos) local text_trimmed = vis.win.file:content(0,pos) return match(last_occurance(lisp_word), text_trimmed) end function blink_error() end function move_sexp (current_pos, target_pos) local file, cursor_char = vis.win.file, vis.win.file:content(current_pos,1) if target_pos == nil then blink_error() elseif match_sexp[cursor_char] == nil then blink_error(lexers.STYLE_INFO) elseif match_sexp[cursor_char] ~= nil then if current_pos > target_pos then file:delete(current_pos, 1) vis.win.selection.pos = current_pos file:insert(target_pos, cursor_char) vis.win.selection.pos = target_pos elseif current_pos < target_pos then file:delete(current_pos, 1) vis.win.selection.pos =current_pos file:insert(target_pos - 1, cursor_char) vis.win.selection.pos = target_pos - 1 -- vis.win.selection.pos = target_pos - 1 end end end function balance_sexp (key) if key == '(' then return function (_) vis:insert('()') return 0 end elseif key == '[' then return function (_) vis:insert('[]') return 0 end elseif key == '{' then return function (_) vis:insert('{}') return 0 end elseif key == '"' then return function (_) vis:insert('""') return 0 end end end function search_top_sexp (start_pos, pos, text) local start, finish = match (lpeg.P{ lpeg.Cp() * simple_sexp * lpeg.Cp() + 1 * lpeg.V(1) } , text, start_pos + 1) if finish ~= nil then if finish >= pos and start <= pos then return start - 1, finish else return search_top_sexp (finish, pos , text) end else return -1 end end function lowest_level_sexp (pos) local text = vis.win.file:content(0, vis.win.file.size) local enclosing_sexp_start , enclosing_sexp_end = 0, vis.win.file.size function travers_sexp (start_pos, pos, text) local start, finish = match (lpeg.P{ lpeg.Cp() * simple_sexp * lpeg.Cp() + 1 * lpeg.V(1) } , text, start_pos + 1) if finish ~= nil then if start > pos and finish > pos then return -1 elseif start <= pos and finish > pos then enclosing_sexp_start, enclosing_sexp_end = start , finish travers_sexp (start + 1 , pos , text) elseif finish < pos then travers_sexp (start + 1 , pos , text) end else return -1 end end travers_sexp(0,pos, text) return enclosing_sexp_start - 1, enclosing_sexp_end -1 end function slurp_sexp_forward () local file, pos = vis.win.file, vis.win.selection.pos local start, finish = lowest_level_sexp(pos) local cursor_char = vis.win.file:content(pos,1) if match( S(')]}'), cursor_char)~= nil then local sexp_pos = match_next_sexp(pos) move_sexp(pos, sexp_pos.finish) else if match(empty_sexp, file:content(start , finish - start )) ~= nil then vis.win.selection.pos = finish - 1 slurp_sexp_forward () end end end function slurp_sexp_backwards () local file, pos = vis.win.file, vis.win.selection.pos local start_2, finish_2 = lowest_level_sexp(pos) local cursor_char = vis.win.file:content(pos,1) if match( S('([{'), cursor_char)~= nil then local start, finish = match_previus_sexp(pos) if start == nil then move_sexp(pos,nil) else move_sexp(pos,start - 1) end else if start_2 > -1 and match(empty_sexp, file:content(start_2, finish_2- start_2)) ~= nil then prinf(3) vis.win.selection.pos = start_2 slurp_sexp_backwards () end end end --function slurp_sexp_forward () -- local file, pos = vis.win.file, vis.win.selection.pos -- local start, finish = lowest_level_sexp(pos) -- local this_sexp = file:content(start , finish - start ) -- local cursor_char = vis.win.file:content(pos,1) -- if match_sexp[cursor_char] == "(" then -- local sexp_pos = match_next_sexp(pos) -- move_sexp(pos, sexp_pos.finish) -- else -- if match(empty_sexp, this_sexp) ~= nil then -- vis.win.selection.pos = finish - 1 -- slurp_sexp_forward () -- end -- end --end function test_me () local pos = vis.win.selection.pos local a,b = lowest_level_sexp(pos) print("----" .. vis.win.file:content(a, b - a).. "....") end function top_sexp_at_cursor () local pos = vis.win.selection.pos local text = vis.win.file:content(0, vis.win.file.size) return search_top_sexp (0, pos, text) end function slice_sexp ( ) local pos = vis.win.selection.pos local file = vis.win.file local text = vis.win.file:content(0, vis.win.file.size) left , right = lowest_level_sexp (pos + 1 ) if left ~= nil then file:delete(left, 1) file:insert(left, " ") file:delete(right - 1, 1) file:insert(right - 1, " ") vis.win.selection.pos = pos end end function make_sexp_wraper (x) function wrap_sexp () local pos = vis.win.selection.pos local file = vis.win.file local text = vis.win.file:content(0, vis.win.file.size) left , right = lowest_level_sexp (pos + 1 ) if left ~= nil then file:insert(left, x ) file:insert(right - 1, match_sexp[x]) vis.win.selection.pos = pos end end return wrap_sexp end function split_sexp ( ) local pos = vis.win.selection.pos local file = vis.win.file local pos = vis.win.selection.pos file:insert(pos , " ") file:delete(pos, 1 ) vis.win.selection.pos = pos trim_space_around (vis.win.selection.pos) pos = vis.win.selection.pos local text = file:content(0, vis.win.file.size) local left , right = lowest_level_sexp (pos + 1 ) local cursor_char = vis.win.file:content(pos, 1) local split_pos = match_previus_lisp_word(pos + 1) if left ~= -1 then local s_type = vis.win.file:content(left , 1) if match(S('\r\n\f\t ')^1, cursor_char) then file:insert(pos , match_sexp[s_type] ) file:insert(pos + 2 , s_type ) vis.win.selection.pos = pos+2 elseif left == pos then file:insert(pos, s_type ) file:insert(pos , match_sexp[s_type] ) vis.win.selection.pos = pos +2 -- prinf ("1") elseif right == pos + 1 then vis.win.selection.pos = pos file:insert(pos , match_sexp[s_type] ) vis.win.selection.pos = pos file:insert(pos + 1, s_type ) vis.win.selection.pos = pos + 1 -- prinf ("3") else local _ , new_pos = match (last_occurance(l.graph),vis.win.file:content(0, split_pos - 1) ) file:insert(new_pos - 1 , match_sexp[s_type] ) file:insert(split_pos, s_type ) vis.win.selection.pos = 1 + trim_space_around (new_pos ) -- prinf ("4") end end end vis.events.subscribe(vis.events.WIN_OPEN, function() vis:map(vis.modes.INSERT, "(", balance_sexp("(") ) vis:map(vis.modes.INSERT, "[", balance_sexp("[") ) vis:map(vis.modes.INSERT, "{", balance_sexp("{") ) vis:map(vis.modes.INSERT, '"', balance_sexp('"') ) if is_lisp_file() ~= nil then vis:map(vis.modes.NORMAL, '<Space>l', slurp_sexp_forward) vis:map(vis.modes.NORMAL, '<Space>h', slurp_sexp_backwards ) vis:map(vis.modes.NORMAL, '<Space>b', slice_sexp) vis:map(vis.modes.NORMAL, '<Space>(', make_sexp_wraper("(")) vis:map(vis.modes.NORMAL, '<Space>o', split_sexp) end end)
local mt = getmetatable(_G) if mt == nil then mt = {} setmetatable(_G, mt) end function mt.__newindex(t, k, v) return rawset(t, k, v) end
-- *********************************************************************************************************************** -- THIS IS THE MAIN CODE FOR THE GAME -- *********************************************************************************************************************** -- needed helper files require("game_info") require("countdown") require("player") require("enemy") require("goals") require("collision") require("game_time") -- initialize best score best_score = {} best_score.value = 0 -- *********************************************************************************************************************** function love.load() -- fonts fonts = {} fonts.info = love.graphics.newFont(25) fonts.score = love.graphics.newFont(18) fonts.start_counter = love.graphics.newFont(50) fonts.game_end = love.graphics.newFont(25) -- background image background_image = {} background_image.file = love.graphics.newImage("assets/img/PLCnext_Logo_cut.png") background_image.width = background_image.file:getWidth() background_image.height = background_image.file:getHeight() background_image.x = love.graphics.getWidth() - background_image.width background_image.y = love.graphics.getHeight() - background_image.height -- initialize game_info_shown = false collision_start = 0 -- call load functions game_info:load() goals:load() player:load() enemy:load() countdown:load() game_time:load() end -- *********************************************************************************************************************** function love.update(dt) -- call of function for game information if game_info_shown == false then game_info:update(dt) -- when game information are known else -- show countdown countdown:update(dt) -- when the playing time started ... if time_until_start < 0 then -- call functions for game time game_time:update(dt) -- call player function player:update(dt) -- call enemy function enemy:update(dt) enemy_collision = false -- call goals function goals:update(dt) -- react to collision with goal of type 1 collision_handling( player.x, -- player x position player.y, -- player y position player.width, -- player image width player.height, -- player image height goals.type1, -- collision object 1, -- number of points 1 -- collision type 1: collision between player and goal ) -- react to collision with goal of type 2 collision_handling( player.x, -- player x position player.y, -- player y position player.width, -- player image width player.height, -- player image height goals.type2, -- collision object 2, -- number of points 1 -- collision type 1: collision between player and goal ) -- react to collision with enemy collision_handling( player.x, -- player x position player.y, -- player y position player.width, -- player image width player.height, -- player image height enemy, -- collision object 1, -- number of points 2 -- collision type 2: collision between player and enemy ) -- react to collision between enemy and goal of type 1 collision_handling( enemy.x, -- player x position enemy.y, -- player y position enemy.width, -- player image width enemy.height, -- player image height goals.type1, -- collision object 1, -- number of points 3 -- collision type 3: collision between enemy and goal ) -- react to collision between enemy and goal of type 2 collision_handling( enemy.x, -- player x position enemy.y, -- player y position enemy.width, -- player image width enemy.height, -- player image height goals.type2, -- collision object 2, -- number of points 3 -- collision type 3: collision between enemy and goal ) -- find out if best score has been exceeded if remaining_time == 0.0 and score > best_score.value then best_score.value = score end -- retry after game end if remaining_time <= 0 and love.keyboard.isDown("return") then goals:load() player:load() enemy:load() countdown:load() game_time:load() end end end end -- *********************************************************************************************************************** function love.draw() -- background definition love.graphics.setBackgroundColor(0/255, 0/255, 0/255) -- black -- background image love.graphics.draw(background_image.file, background_image.x, background_image.y) -- call of function for game information game_info:draw() -- when information are known, show countdown if game_info_shown == true then -- show countdown countdown:draw() -- when the playing time started ... if time_until_start < 0 then -- call player function player:draw() -- call enemy function enemy:draw() -- call goals function goals:draw() -- call of funtion for game time game_time:draw() -- print current score love.graphics.setFont(fonts.score) love.graphics.setColor(255/255, 255/255, 255/255) -- white love.graphics.print("SCORE : " .. score, 10, 10) -- print best score love.graphics.setColor(0/255, 153/255, 161/255) -- blue green love.graphics.printf("BEST SCORE : " .. best_score.value, 820 , 10, 160, 'right') -- set color to white love.graphics.setColor(255/255, 255/255, 255/255, 255/255) end end end
local Time = {} local Config = require 'Config' local _LogT, _LogD, _LogI, _LogW, _LogE = require('unity.Debug').GetLogFuncs('[TIME]') local timestamp = csharp.timestamp; local Unity = require 'unity.Unity' local UnityTime = Unity.Time -- realtime since startup, for measuare execution time function Time.RS() return UnityTime.realtimeSinceStartup end local _M = {} -- timestamp, used for sync between server and client function _M:TS() return timestamp() + (self.delta or 0) + self.extraDelta end function _M:StartSyncTime() if self.syncing then return end _LogD(self.name .. ' StartSyncTime') assert(self.mode ~= 'fixed', 'fixed timer cannot be sync') self.timeSamples = {} self.syncing = true end function _M:RecvDelta(localTime, serverTime) _LogT(self.name .. ' RecvDelta ' .. localTime .. ', ' .. serverTime) assert(self.mode ~= 'fixed', 'fixed timer cannot be sync') local d = (serverTime - localTime) / 2 if not self.delta then self.delta = d end table.insert(self.timeSamples, d) end function _M:EndTimeSync() assert(self.mode ~= 'fixed', 'fixed timer cannot be sync') local n = #self.timeSamples assert(n > 2) table.sort(self.timeSamples) local median = self.timeSamples[math.floor(n / 2)] local median15 = 1.5 * median local sum = 0 local count = 0 for _, d in ipairs(self.timeSamples) do if d - median < median15 then sum = sum + d count = count + 1 end end local old = self.delta self.delta = sum / count _LogD(self.name .. ' EndTimeSync: ' .. old .. ' -> ' .. self.delta) self.timeSamples = false self.syncing = false end local _NewTime = function(name, mode, arg0) local inst = { name = name, delta = false, extraDelta = mode == 'extra_delta' and arg0 or 0, timeSamples = {}, mode = mode, syncing = false, } setmetatable(inst, { __index = _M} ) return inst end local cachedTime = {} function Time.New(name, mode, arg0) if not name then return _NewTime(name, mode, arg0) end local t = cachedTime[name] if not t then t = _NewTime(name, mode, arg0) cachedTime[name] = t end return t end return Time
#!/usr/bin/env lua local bench = require"bench" local aux = require"bench-aux" local lib = ... or aux.optenv("BENCH_L", "bench-wheel.so") local limit = tonumber(aux.optenv("BENCH_N", 1000000)) local step = tonumber(aux.optenv("BENCH_S", limit / 100)) -- expire 1/1000 * #timeouts per clock update local exp_step = tonumber(aux.optenv("BENCH_E", 0.0001)) local verbose = aux.toboolean(os.getenv("BENCH_V", false)) local B = require"bench".new(lib, count) for i=0,limit,step do -- add i timeouts local fill_elapsed, fill_count, fill_last = aux.time(B.fill, B, i) -- expire timeouts by iteratively updating clock. exp_step is the -- approximate number of timeouts (as a fraction of the total number -- of timeouts) that will expire per update. local exp_elapsed, exp_count = aux.time(B.expire, B, fill_count, math.floor(fill_last * exp_step)) assert(exp_count == i) assert(B:empty()) local exp_rate = i > 0 and i / exp_elapsed or 0 local fmt = verbose and "%d\t%f\t(%d/s)\t(fill:%f)" or "%d\t%f" aux.say(fmt, i, exp_elapsed, exp_rate, fill_elapsed) end
local coroutine_running = coroutine.running local coroutine_resume = coroutine.resume local mm = require "mm" local log = require "prailude.log" local xpcall_with_args; do local ver = ({Q="Lua 5.1",R="Lua 5.2",S="Lua 5.3"})[("").dump(function() end):sub(5,5)] or "LuaJIT" xpcall_with_args = ver ~= "Lua 5.1" end local function running() --always behave like lua5.1's coroutine.running local coro, main = coroutine_running() if not main then return coro else return nil end end local coroutine_util = {} for k,v in pairs(coroutine) do --eh, this is a little faster than a metatable coroutine_util[k]=v end local function resume_handler(coro, ok, err, ...) if not ok then log:error((debug.traceback(coro, err, 1) .. "\n")) end return ok, err, ... end local function resume(coro, ...) return resume_handler(coro, coroutine_resume(coro, ...)) end coroutine_util.resume = resume coroutine_util.running = running function coroutine_util.late_wrap() local coro = running() if not coro then error("no coroutine to create coroutine.resume() callback") end return function(...) return resume(coro, ...) end end local Condition = function(name, check) if type(name) == "function" and not check then name, check = "", name end local waiting = {} return setmetatable({ wait = function() if not check() then local coro = running() table.insert(waiting, coro) return coroutine.yield() end end, check = function() local waiting_num = #waiting if waiting_num > 0 and check() then local now_waiting = waiting waiting = {} for _, coro in ipairs(now_waiting) do resume(coro) end return waiting_num end return 0 end, }, {__tostring = function() return ("condition %s [%s] (waiting: %i)"):format(name, check() and "true" or "false", #waiting) end}) end local safe_call; do if xpcall_with_args and type(debug) == "table" and type(debug.traceback) == "function" then local traceback = debug.traceback safe_call = function(func, ...) return xpcall(func, traceback, ...) end else safe_call = function(func, ...) return pcall(func, ...) end end end local workpool_defaults = {__index = { max_workers = 5, retry = 0, progress_inverval = 1000 }} local Workpool = function(opt) local Timer = require "prailude.util.timer" local parent_coro = running() assert(parent_coro, "workpool must be called from a coroutine") local work = { todo = {}, done = {}, fail = {}, fail_reason = {} } opt = setmetatable(opt or {}, workpool_defaults) assert(type(opt.worker) == "function") local nextjob, havejob --jobs iterator local retryjob if type(opt.retry) == "number" then local fails = {} retryjob = function(job) local failcount = rawget(fails, job) or 0 failcount = failcount + 1 rawset(fails, job, failcount) return failcount < opt.retry end elseif type(opt.retry) == "function" then retryjob = opt.retry else error("retry option must be nil, a number or afunction, was instead " .. type(opt.retry)) end local check = nil if opt.check then check = opt.check end local active_workers = 0 local moreworkers if type(opt.max_workers) == "function" then moreworkers = function() return opt.max_workers(active_workers, opt) end elseif type(opt.max_workers) == "number" then moreworkers = function() return active_workers < opt.max_workers end else error("'max_workers' option must be a number or function") end if type(opt.work) == "table" then work.todo = opt.work nextjob = function() return function() return table.remove(work.todo) end end havejob = function() return #work.todo > 0 end elseif type(opt.work) == "function" then work.todo = {} nextjob = function() return function() local job = table.remove(work.todo) if job == nil then job = opt.work() end return job end end havejob = function() if #work.todo > 0 then return true else local job = opt.work() if job ~= nil then table.insert(work.todo, job) end return #work.todo > 0 end end else error("work generators and other fancy stuff aren't supported yet") end local shiftmanager = Condition("shiftmanager", function() if havejob() and not moreworkers(active_workers) then return false elseif not havejob() and active_workers > 0 then return false else return true end end) local foreman = Condition("foreman", function() if not havejob() and active_workers == 0 then return true end end) local worker = function(job) active_workers = active_workers + 1 local ok, res, err = safe_call(opt.worker, job) if not ok then log:error("workpool: %s", res) res, err = nil, res end if check then local check_ok, check_err = pcall(check, job, res, err) if not check_ok then log:error("workpool: %s", check_err) end end if res == nil then if retryjob(job) then table.insert(work.todo, job) else table.insert(work.fail, job) table.insert(work.fail_reason, err or "?") end else table.insert(work.done, res) end active_workers = active_workers - 1 shiftmanager:check() foreman:check() end local company = coroutine.wrap(function() for job in nextjob() do --print("run the worker ", workwrap ,"for job " ..current_job) coroutine.wrap(worker)(job) shiftmanager:wait() end end) company() local inspector if opt.progress then inspector = Timer.interval(opt.progress_inverval, function() opt.progress(active_workers, work.done, work.todo, work.fail, work.fail_reason) end) end foreman:wait() if inspector then inspector:stop() end return work.done, work.fail, work.fail_reason end coroutine_util.workpool = Workpool coroutine_util.condition = Condition return coroutine_util
local Terminal = require('opus.terminal') local trace = require('opus.trace') local Util = require('opus.util') local colors = _G.colors local os = _G.os local peripheral = _G.peripheral local printError = _G.printError local shell = _ENV.shell local term = _G.term local window = _G.window local function syntax() error('Syntax:\nmwm [--config=filename] [monitor]') end local args = Util.parse(...) local UID = 0 local multishell = { } local processes = { } local parentTerm = term.current() local sessionFile = args.config or 'usr/config/mwm' local monName = args[1] local running local parentMon _ENV.multishell = multishell if monName then parentMon = peripheral.wrap(monName) or syntax() else parentMon = peripheral.find('monitor') or syntax() end parentMon.setTextScale(.5) local monDim, termDim = { }, { } monDim.width, monDim.height = parentMon.getSize() termDim.width, termDim.height = parentTerm.getSize() -- even though the monitor window is set to visible -- the canvas is not (possibly change default in terminal.lua) -- canvas is not visible so that redraws -- are done once in the event loop local monitor = Terminal.window(parentMon, 1, 1, monDim.width, monDim.height, true) monitor.setBackgroundColor(colors.gray) monitor.clear() local function nextUID() UID = UID + 1 return UID end local function xprun(env, path, ...) setmetatable(env, { __index = _G }) local fn, m = loadfile(path, env) if fn then return trace(fn, ...) end return fn, m end local function write(win, x, y, text) win.setCursorPos(x, y) win.write(text) end local function redraw() --monitor.clear() monitor.canvas:dirty() --monitor.setBackgroundColor(colors.gray) monitor.canvas:clear(colors.gray) for k, process in ipairs(processes) do process.container.canvas:dirty() process:focus(k == #processes) end end local function getProcessAt(x, y) for k = #processes, 1, -1 do local process = processes[k] if x >= process.x and y >= process.y and x <= process.x + process.width - 1 and y <= process.y + process.height - 1 then return k, process end end end --[[ A runnable process ]]-- local Process = { } function Process:new(env, args) args.env = shell.makeEnv(env) args.width = args.width or termDim.width args.height = args.height or termDim.height -- TODO: randomize start position local self = setmetatable({ uid = nextUID(), x = args.x or 1, y = args.y or 1, width = args.width, height = args.height + 1, path = args.path, args = args.args or { }, title = args.title or 'shell', }, { __index = Process }) self:adjustDimensions() if not args.x then self.x = math.random(1, monDim.width - self.width + 1) self.y = math.random(1, monDim.height - self.height + 1) end self.container = Terminal.window(monitor, self.x, self.y, self.width, self.height, true) self.window = window.create(self.container, 1, 2, args.width, args.height, true) self.terminal = self.window self.container.setBackgroundColor(colors.black) self.container.clear() self.container.canvas.parent = monitor.canvas if not monitor.canvas.children then monitor.canvas.children = { } end table.insert(monitor.canvas.children, 1, self.container.canvas) self.container.canvas:setVisible(true) --self.container.getSize = self.window.getSize self.co = coroutine.create(function() local result, err if args.fn then result, err = Util.runFunction(args.env, args.fn, table.unpack(self.args)) elseif args.path then result, err = xprun(args.env, args.path, table.unpack(self.args)) end if not result and err and err ~= 'Terminated' then printError('\n' .. tostring(err)) os.pullEventRaw('terminate') end multishell.removeProcess(self) end) self:focus(false) return self end function Process:drawTitle(focused) if self.showSizers and focused then local sizers = '\25 \26 \24 \27' self.container.setBackgroundColor(colors.yellow) self.container.setTextColor(colors.black) write(self.container, 1, 1, string.rep(' ', self.width)) write(self.container, 2, 1, sizers) local str = string.format('%d x %d', self.width, self.height - 1) write(self.container, 10, 1, str) else if focused then self.container.setBackgroundColor(colors.yellow) else self.container.setBackgroundColor(colors.lightGray) end self.container.setTextColor(colors.black) write(self.container, 1, 1, string.rep(' ', self.width)) write(self.container, 2, 1, self.title) end write(self.container, self.width - 1, 1, '*') end function Process:focus(focused) self:drawTitle(focused) if focused then self.window.restoreCursor() end end function Process:adjustDimensions() self.width = math.min(self.width, monDim.width) self.height = math.min(self.height, monDim.height) self.x = math.max(1, self.x) self.y = math.max(1, self.y) self.x = math.min(self.x, monDim.width - self.width + 1) self.y = math.min(self.y, monDim.height - self.height + 1) end function Process:reposition() self:adjustDimensions() self.container.reposition(self.x, self.y, self.width, self.height) self.container.setBackgroundColor(colors.black) self.container.clear() self.window.reposition(1, 2, self.width, self.height - 1) if self.window ~= self.terminal then self.terminal.reposition(1, 1, self.width, self.height - 1) end redraw() end function Process:click(x, y) if y == 1 then -- title bar if x == self.width - 1 then self:resume('terminate') elseif not self.showSizers then self.showSizers = not self.showSizers self:drawTitle(true) else self:resizeClick(x, y) end elseif x > 1 and x < self.width then if self.showSizers then self.showSizers = false self:drawTitle(true) end self:resume('mouse_click', 1, x, y - 1) self:resume('mouse_up', 1, x, y - 1) end end function Process:resizeClick(x) if x == 2 then self.height = self.height + 1 elseif x == 6 then self.height = self.height - 1 elseif x == 4 then self.width = self.width + 1 elseif x == 8 then self.width = self.width - 1 else return end self:reposition() self:resume('term_resize') self:drawTitle(true) multishell.saveSession(sessionFile) end function Process:resume(event, ...) if coroutine.status(self.co) == 'dead' then return end if not self.filter or self.filter == event or event == "terminate" then --term.redirect(self.terminal) local previousTerm = term.redirect(self.terminal) local previous = running running = self -- stupid shell set title local ok, result = coroutine.resume(self.co, event, ...) running = previous self.terminal = term.current() term.redirect(previousTerm) if ok then self.filter = result else printError(result) end return ok, result end end --[[ Install a multishell manager for the monitor ]]-- function multishell.getFocus() return processes[#processes].uid end function multishell.setFocus(uid) local process = Util.find(processes, 'uid', uid) if process then local lastFocused = processes[#processes] if lastFocused ~= process then if lastFocused then lastFocused:focus(false) end Util.removeByValue(processes, process) table.insert(processes, process) process.container.canvas:raise() process:focus(true) process.container.canvas:dirty() end return true end return false end function multishell.getTitle(uid) local process = Util.find(processes, 'uid', uid) if process then return process.title end end function multishell.setTitle(uid, title) local process = Util.find(processes, 'uid', uid) if process then process.title = title or '' process:focus(process == processes[#processes]) end end function multishell.getCurrent() if running then return running.uid end end function multishell.getCount() return #processes end function multishell.getTabs() return processes end function multishell.launch(env, file, ...) return multishell.openTab(env, { path = file, env = env, title = 'shell', args = { ... }, }) end function multishell.openTab(env, tabInfo) local process = Process:new(env, tabInfo) table.insert(processes, 1, process) --local previousTerm = term.current() process:resume() --term.redirect(previousTerm) multishell.saveSession(sessionFile) return process.uid end function multishell.removeProcess(process) Util.removeByValue(processes, process) process.container.canvas:removeLayer() multishell.saveSession(sessionFile) redraw() end function multishell.saveSession(filename) local t = { } for _,process in ipairs(processes) do if process.path and not process.isShell then table.insert(t, { x = process.x, y = process.y, width = process.width, height = process.height - 1, path = process.path, args = process.args, }) end end Util.writeTable(filename, t) end function multishell.loadSession(filename) local config = Util.readTable(filename) if config then for k = #config, 1, -1 do multishell.openTab(_ENV, config[k]) end end end function multishell.stop() multishell._stop = true end function multishell.start() while not multishell._stop do local event = { os.pullEventRaw() } if event[1] == 'terminate' then local focused = processes[#processes] if focused.isShell then focused:resume('terminate') else break end elseif event[1] == 'monitor_touch' then local x, y = event[3], event[4] local key, process = getProcessAt(x, y) if process then if key ~= #processes then multishell.setFocus(process.uid) multishell.saveSession(sessionFile) end process:click(x - process.x + 1, y - process.y + 1) else process = processes[#processes] if process and process.showSizers then process.x = math.floor(x - (process.width) / 2) process.y = y process:reposition() process:drawTitle(true) multishell.saveSession(sessionFile) end end elseif event[1] == 'mouse_click' or event[1] == 'mouse_up' then local focused = processes[#processes] if not focused.isShell then multishell.setFocus(1) -- shell is always 1 else focused:resume(table.unpack(event)) end elseif event[1] == 'char' or event[1] == 'key' or event[1] == 'key_up' or event[1] == 'paste' then local focused = processes[#processes] if focused then focused:resume(table.unpack(event)) end else for _,process in pairs(Util.shallowCopy(processes)) do process:resume(table.unpack(event)) end end monitor.canvas:render(parentMon) local focused = processes[#processes] if focused then focused.window.restoreCursor() end end end --[[ Special shell process for launching programs ]]-- local function addShell() local process = setmetatable({ x = monDim.width, y = monDim.height, width = 1, height = 1, isShell = true, uid = nextUID(), title = 'Terminal', }, { __index = Process }) function process:focus(focused) self.window.setVisible(focused) if focused then self.window.restoreCursor() else parentTerm.clear() parentTerm.setCursorBlink(false) local str = 'Click screen for shell' write(parentTerm, math.floor((termDim.width - #str) / 2), math.floor(termDim.height / 2), str) end end function process:click() end process.container = Terminal.window(monitor, process.x, process.y+1, process.width, process.height, true) process.window = window.create(parentTerm, 1, 1, termDim.width, termDim.height, true) process.terminal = process.window process.co = coroutine.create(function() print('To run a program on the monitor, type "fg <program>"') print('To quit, type "exit"') os.run(shell.makeEnv(_ENV), shell.resolveProgram('shell')) multishell.stop() end) table.insert(processes, process) process:focus(true) local previousTerm = term.current() process:resume() term.redirect(previousTerm) end addShell() multishell.loadSession(sessionFile) multishell.start() term.redirect(parentTerm) parentTerm.clear() parentTerm.setCursorPos(1, 1)
pg = pg or {} pg.enemy_data_statistics_392 = { [242211] = { cannon = 23, reload = 150, speed_growth = 0, cannon_growth = 1848, pilot_ai_template_id = 10001, air = 0, base = 213, dodge = 14, durability_growth = 84700, speed = 18, luck = 0, reload_growth = 0, dodge_growth = 100, battle_unit_type = 55, antiaircraft_growth = 2280, hit = 13, antisub_growth = 0, air_growth = 0, luck_growth = 0, torpedo = 25, durability = 212, armor_growth = 0, torpedo_growth = 2016, antiaircraft = 29, hit_growth = 189, armor = 0, id = 242211, antisub = 0, world_enhancement = { 2, 3, 2, 0.4, 1, 1, 0.9 }, equipment_list = { 1100023, 1100528, 1100103, 1100468 }, random_equipment_list = { { 2024212, 2024213 } }, random_nub = { 1 } }, [242212] = { cannon = 28, reload = 150, speed_growth = 0, cannon_growth = 2220, pilot_ai_template_id = 10001, air = 0, base = 214, dodge = 14, durability_growth = 69300, speed = 18, luck = 0, reload_growth = 0, dodge_growth = 100, battle_unit_type = 55, antiaircraft_growth = 2280, hit = 13, antisub_growth = 0, air_growth = 0, luck_growth = 0, torpedo = 25, durability = 173, armor_growth = 0, torpedo_growth = 2016, antiaircraft = 29, hit_growth = 189, armor = 0, id = 242212, antisub = 0, world_enhancement = { 2, 3, 2, 0.4, 1, 1, 0.9 }, equipment_list = { 1100023, 1100673, 1100348, 1100498 }, random_equipment_list = { { 2024212, 2024213 } }, random_nub = { 1 } }, [242213] = { cannon = 23, reload = 150, speed_growth = 0, cannon_growth = 1848, base = 215, air = 0, durability_growth = 77000, dodge = 14, speed = 18, luck = 0, battle_unit_type = 55, reload_growth = 0, dodge_growth = 100, antisub = 0, antiaircraft_growth = 2280, hit = 13, antisub_growth = 0, air_growth = 0, luck_growth = 0, torpedo = 25, durability = 193, armor_growth = 0, torpedo_growth = 2016, antiaircraft = 29, hit_growth = 189, armor = 0, id = 242213, world_enhancement = { 2, 3, 2, 0.4, 1, 1, 0.9 }, appear_fx = {}, equipment_list = { 1100023, 1100673, 1100348, 1100498 }, random_equipment_list = { { 2024212, 2024213 } }, random_nub = { 1 } }, [242214] = { cannon = 30, reload = 150, speed_growth = 0, cannon_growth = 2376, pilot_ai_template_id = 10001, air = 0, base = 223, dodge = 20, durability_growth = 110000, speed = 14, luck = 0, reload_growth = 0, dodge_growth = 50, battle_unit_type = 65, antiaircraft_growth = 2964, hit = 7, antisub_growth = 0, air_growth = 0, luck_growth = 0, torpedo = 0, durability = 275, armor_growth = 0, torpedo_growth = 0, antiaircraft = 37, hit_growth = 105, armor = 0, id = 242214, antisub = 0, world_enhancement = { 2, 0.7, 2, 0.8, 1, 2.3, 2.6 }, equipment_list = { 1100028, 1100528, 1100468, 1100733 }, random_equipment_list = { { 2024412, 2024413 } }, random_nub = { 1 } }, [242215] = { cannon = 30, reload = 150, speed_growth = 0, cannon_growth = 2376, pilot_ai_template_id = 10001, air = 0, base = 224, dodge = 20, durability_growth = 110000, speed = 14, luck = 0, reload_growth = 0, dodge_growth = 50, battle_unit_type = 65, antiaircraft_growth = 2964, hit = 7, antisub_growth = 0, air_growth = 0, luck_growth = 0, torpedo = 0, durability = 275, armor_growth = 0, torpedo_growth = 0, antiaircraft = 37, hit_growth = 105, armor = 0, id = 242215, antisub = 0, world_enhancement = { 2, 0.7, 2, 0.8, 1, 2.3, 2.6 }, equipment_list = { 1100028, 1100528, 1100468, 1100733 }, random_equipment_list = { { 2024412, 2024413 } }, random_nub = { 1 } }, [242216] = { cannon = 40, reload = 150, speed_growth = 0, cannon_growth = 3168, pilot_ai_template_id = 10001, air = 0, base = 232, dodge = 12, durability_growth = 121000, speed = 14, luck = 0, reload_growth = 0, dodge_growth = 30, battle_unit_type = 65, antiaircraft_growth = 2280, hit = 7, antisub_growth = 0, air_growth = 0, luck_growth = 0, torpedo = 0, durability = 303, armor_growth = 0, torpedo_growth = 0, antiaircraft = 29, hit_growth = 105, armor = 0, id = 242216, antisub = 0, world_enhancement = { 2, 0.8, 2, 0.8, 1, 2.3, 2.6 }, equipment_list = { 1100028, 1100528, 1100498, 1100723 }, random_equipment_list = { { 2024412, 2024413 } }, random_nub = { 1 } }, [242217] = { cannon = 40, reload = 150, speed_growth = 0, cannon_growth = 3168, pilot_ai_template_id = 10001, air = 0, base = 233, dodge = 12, durability_growth = 121000, speed = 14, luck = 0, reload_growth = 0, dodge_growth = 30, battle_unit_type = 65, antiaircraft_growth = 2280, hit = 7, antisub_growth = 0, air_growth = 0, luck_growth = 0, torpedo = 0, durability = 303, armor_growth = 0, torpedo_growth = 0, antiaircraft = 29, hit_growth = 105, armor = 0, id = 242217, antisub = 0, world_enhancement = { 2, 0.8, 2, 0.8, 1, 2.3, 2.6 }, equipment_list = { 1100028, 1100528, 1100498, 1100723 }, random_equipment_list = { { 2024412, 2024413 } }, random_nub = { 1 } }, [242218] = { cannon = 0, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 42, base = 245, dodge = 6, durability_growth = 99000, antiaircraft = 37, speed = 18, reload_growth = 0, dodge_growth = 70, luck = 0, battle_unit_type = 60, hit = 7, antisub_growth = 0, air_growth = 3360, antiaircraft_growth = 2964, torpedo = 0, durability = 248, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 105, armor = 0, id = 242218, antisub = 0, world_enhancement = { 2, 2.2, 2, 0.8, 0.2, 2.3, 0.1 }, equipment_list = { 1100308, 2200813, 2200818, 2200823 } }, [243001] = { cannon = 7, reload = 150, speed_growth = 0, cannon_growth = 528, base = 177, air = 0, durability_growth = 44000, dodge = 22, antiaircraft = 20, speed = 36, luck = 10, reload_growth = 0, dodge_growth = 270, battle_unit_type = 50, antisub = 0, hit = 13, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1596, torpedo = 50, durability = 110, armor_growth = 0, torpedo_growth = 4032, luck_growth = 0, hit_growth = 189, armor = 0, id = 243001, world_enhancement = { 9.3, 5.4, 1.2, 0.6, 0.9, 0.9, 0 }, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 1100059, 1100169, 1100499 } }, [243002] = { cannon = 6, reload = 150, speed_growth = 0, cannon_growth = 516, pilot_ai_template_id = 10001, air = 0, base = 178, dodge = 22, durability_growth = 42680, antiaircraft = 19, speed = 36, reload_growth = 0, dodge_growth = 270, luck = 10, battle_unit_type = 50, hit = 13, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1548, torpedo = 49, durability = 107, armor_growth = 0, torpedo_growth = 3912, luck_growth = 0, hit_growth = 189, armor = 0, id = 243002, antisub = 0, world_enhancement = { 9.3, 5.4, 1.2, 0.6, 0.9, 0.9, 0 }, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 1100059, 1100169, 1100499 } }, [243003] = { cannon = 6, reload = 150, speed_growth = 0, cannon_growth = 516, pilot_ai_template_id = 10001, air = 0, base = 179, dodge = 22, durability_growth = 42680, antiaircraft = 19, speed = 36, reload_growth = 0, dodge_growth = 270, luck = 10, battle_unit_type = 50, hit = 13, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1548, torpedo = 49, durability = 107, armor_growth = 0, torpedo_growth = 3912, luck_growth = 0, hit_growth = 189, armor = 0, id = 243003, antisub = 0, world_enhancement = { 9.3, 5.4, 1.2, 0.6, 0.9, 0.9, 0 }, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 1100059, 1100169, 1100499 } }, [243004] = { cannon = 6, reload = 150, speed_growth = 0, cannon_growth = 516, pilot_ai_template_id = 10001, air = 0, base = 180, dodge = 22, durability_growth = 42680, antiaircraft = 19, speed = 36, reload_growth = 0, dodge_growth = 270, luck = 10, battle_unit_type = 50, hit = 13, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1548, torpedo = 49, durability = 107, armor_growth = 0, torpedo_growth = 3912, luck_growth = 0, hit_growth = 189, armor = 0, id = 243004, antisub = 0, world_enhancement = { 9.3, 5.4, 1.2, 0.6, 0.9, 0.9, 0 }, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 1100059, 1100169, 1100499 } }, [243005] = { cannon = 7, reload = 150, speed_growth = 0, cannon_growth = 540, pilot_ai_template_id = 10001, air = 0, base = 181, dodge = 22, durability_growth = 45320, antiaircraft = 21, speed = 36, reload_growth = 0, dodge_growth = 270, luck = 10, battle_unit_type = 50, hit = 13, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1644, torpedo = 52, durability = 113, armor_growth = 0, torpedo_growth = 4152, luck_growth = 0, hit_growth = 189, armor = 0, id = 243005, antisub = 0, world_enhancement = { 9.3, 5.4, 1.2, 0.6, 0.9, 0.9, 0 }, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 1100059, 1100169, 1100499 } }, [243006] = { cannon = 13, reload = 150, speed_growth = 0, cannon_growth = 1032, base = 192, air = 0, durability_growth = 53900, dodge = 16, antiaircraft = 45, speed = 24, luck = 10, reload_growth = 0, dodge_growth = 200, battle_unit_type = 55, antisub = 0, hit = 13, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 3576, torpedo = 37, durability = 135, armor_growth = 0, torpedo_growth = 2964, luck_growth = 0, hit_growth = 189, armor = 0, id = 243006, world_enhancement = { 9.3, 4.6, 1.1, 0, 0.9, 0.9, 0 }, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 1100019, 1100394, 1100469 } }, [243007] = { cannon = 13, reload = 150, speed_growth = 0, cannon_growth = 1032, base = 193, air = 0, durability_growth = 53900, dodge = 16, antiaircraft = 45, speed = 24, luck = 10, reload_growth = 0, dodge_growth = 200, battle_unit_type = 55, antisub = 0, hit = 13, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 3576, torpedo = 37, durability = 135, armor_growth = 0, torpedo_growth = 2964, luck_growth = 0, hit_growth = 189, armor = 0, id = 243007, world_enhancement = { 9.3, 4.6, 1.1, 0, 0.9, 0.9, 0 }, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 1100019, 1100394, 1100469 } }, [243008] = { cannon = 13, reload = 150, speed_growth = 0, cannon_growth = 1032, base = 194, air = 0, durability_growth = 53900, dodge = 16, antiaircraft = 45, speed = 24, luck = 10, reload_growth = 0, dodge_growth = 200, battle_unit_type = 55, antisub = 0, hit = 13, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 3576, torpedo = 37, durability = 135, armor_growth = 0, torpedo_growth = 2964, luck_growth = 0, hit_growth = 189, armor = 0, id = 243008, world_enhancement = { 9.3, 4.6, 1.1, 0, 0.9, 0.9, 0 }, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 1100019, 1100394, 1100469 } } } return
-- this file is loaded after all modules are loaded and initialized -- you can place any custom user code here print 'Greed started.'
local utils = {} local socket = require("lunasdl.socket") utils.now = socket.gettime utils.since = function(ts) return utils.now() - ts end function utils.assertf(level, condition, ...) -- Alternative to assert(). -- Returns condition if it is true, otherwise raises an error() -- level = same as in error() -- ... = error messsage to be formatted (string.format() style) -- error message is optional, and is formatted only if needed if condition then return condition end local errmsg = next({...}) and string.format(...) or "assertf failed" error(errmsg,level+1) end function utils.copytable(t) -- Returns a copy of table t (note that this is NOT a deep copy) local tt = {} for k,v in pairs(t) do tt[k] = t[k] end return tt end local function deeptostring(t, islast, indent, tt) local tt = tt or {} -- if tt[t] then error("table has loops") end local s = "" -- destination string local indent0 = indent or "" if islast then indent = indent0 .. " " else indent = indent0 .. "│  " end if not t then return string.format("%s <... empty ...>\n",indent0) end if tt[t] then return string.format("%s...\n",indent0) end tt[t] = true local last for i,v in pairs(t) do --print(i,v) last = i end --do return end local prefix = indent0 .. "├── " for i,v in pairs(t) do -- if i == "__index" or i == t then goto continue end -- skip it if i == last then prefix = indent0 .. "└── " end s = s .. string.format("%s%s: %s\n",prefix,i,v) if type(v)=="table" then s = s .. deeptostring(v, i == last, indent, tt) end ::continue:: end return s end function utils.deeptostring(t, islast, indent, s) return deeptostring(t) end function utils.dumpdata(data, filename, mode) -- Dumps data in a file to be used with gnuplot -- (eg. gnuplot> plot "data.log" using 1:2 with lines) -- 'data' = sequence of numbers (array without gaps starting from index=1) -- 'filename'= name of file where to dump the data local file = assert(io.open(filename, mode or "w")) for i,v in ipairs(data) do file:write(string.format("%u %.9f\n",i,v)) end file:close() end function utils.stats(data) -- Computes mean, variax, minimum and maximum over -- the sequence of numbers contained in data local max,min = 0, math.huge local mean, delta, m2, var = 0, 0, 0, 0 for i=1,#data do local d = data[i] if d < min then min = d end if d > max then max = d end delta = d - mean mean = mean + delta/i m2 = m2 + delta*(d-mean) end if #data > 1 then var = m2 / (#data-1) end return mean, var, min, max end function utils.errmsgstrip(msg) return string.gsub(msg, ".+%:%d+%:% ", function () return "" end) end function utils.format(level, formatstring, ...) -- string.format() wrapper that when an error occurs, raises an -- error() pointing at the specified level -- (to be used in functions that accept (formatstring,...) to point the finger -- to the caller if the arguments are malformed) if not formatstring then return "" end --if not next({...}) then return formatstring end local ok, msg = pcall(function(fmt,...) return assert(string.format(fmt,...)) end, formatstring, ...) if not ok then -- strip the pointer to this function: msg = string.gsub(msg, ".+%:%d+%:% ", function () return "" end) error(msg,level+1) end return msg end function utils.concat(t,sep) local s = {} for k,v in ipairs(t) do if v == nil then s[k]="nil" --elseif v == true then s[k] = "true" --elseif v == false then s[k] = "false" else s[k] = tostring(v) end end return table.concat(s,sep) end function utils.loadscript(scriptname) -- same as loadfile(scriptname), but it returns a loader which -- accepts the environment as parameter (see PIL3/14.5) local f, errmsg = io.open(scriptname,"r") if not f then return nil, errmsg end local ld = "local _ENV=... " .. f:read("*a") f:close() local loader, errmsg = load(ld,string.format("@%s",scriptname)) if not loader then return nil, errmsg end return loader end return utils
newoption { trigger = "renderer", value = "API", description = "Choose a renderer", allowed = { { "opengl", "OpenGL (macOS, linux, Windows)" }, --{ "dx11", "DirectX 11 (Windows only)" }, --{ "metal", "Metal (macOS, iOS only)" }, --{ "vulkan", "Vulkan (Windows, linux, iOS, macOS)" } } } newoption { trigger = "arch", value = "arch", description = "Choose architecture", allowed = { {"x86", "x86" }, {"x64", "x64" }, {"arm", "arm" }, {"arm64", "arm64"} } } newoption { trigger = "teamid", value = "id", description = "development team id for apple developers" } newoption { trigger = "tvOS", value = "target", description = "Target tvOS" } newaction { trigger = "clean", description = "clean the software", execute = function () print("clean the build...") os.rmdir("./bin") print("done.") end }
--------------------------------------------- -- Hundred Fists -- Meant for Ix'Aern (MNK) --------------------------------------------- require("scripts/globals/monstertpmoves") require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/msg") --------------------------------------------- function onMobSkillCheck(target,mob,skill) if (mob:getPool() == 4661 and mob:getHPP() <= 50 and mob:getLocalVar("BracerMode") == 1) then return 0 else return 1 end end function onMobWeaponSkill(target, mob, skill) local typeEffect = tpz.effect.HUNDRED_FISTS MobBuffMove(mob, typeEffect, 1, 0, 45) mob:setLocalVar("BracerMode", 2) skill:setMsg(tpz.msg.basic.USES) return typeEffect end
local playsession = { {"remarkablysilly", {3903}}, {"Ed9210", {1447431}}, {"tykak", {1867124}}, {"Trashbull", {303944}}, {"Genocide_General", {145476}}, {"terradus", {1210117}}, {"drill95", {9405}}, {"cahesar", {1452826}}, {"Menander", {2096176}}, {"Atoms", {1314782}}, {"MikeTheMike2014", {103100}}, {"Evilhero189", {98711}}, {"Rabotyaga", {1913}}, {"Zenada", {23618}}, {"Gerkiz", {885984}}, {"beranabus", {993615}}, {"marklinCZ", {86487}}, {"KIRkomMAX", {428492}}, {"Farglon", {774482}}, {"Arkeops", {53437}}, {"FireLeaf", {699647}}, {"Piewdennis", {1099936}}, {"CmonMate497", {3411}}, {"Order", {208073}}, {"TXL_PLAYZ", {620808}}, {"snoetje", {641816}}, {"Zealz", {17113}}, {"roner55", {10540}}, {"dimonchek", {821769}}, {"night_fox1", {7259}}, {"vesorakia", {1550}}, {"EPO666", {506045}}, {"ksb4145", {141120}}, {"seeyorise", {66703}}, {"fomorenom", {130910}}, {"FAChyba", {394762}}, {"Scuideie-Guy", {54609}}, {"happyjumper5", {246910}}, {"rileythelol", {439889}}, {"Delqvs", {394336}}, {"trnila", {266722}}, {"Idefix88", {8041}}, {"IamTzu", {1153723}}, {"Norbac", {1235751}}, {"gearmach1ne", {651532}}, {"battus", {137701}}, {"HKHKQOO", {10382}}, {"萌初", {24499}}, {"DerZigeuner", {47815}}, {"raskl", {85231}}, {"r1val", {50573}}, {"belbo", {1188286}}, {"die_ott", {470657}}, {"TheSparrow", {494091}}, {"JerkTurk", {18499}}, {"changaryyy", {291401}}, {"Nate66873", {1111679}}, {"kenx00x", {3474}}, {"Progman", {22920}}, {"s0p", {3707}}, {"0icke0", {933}}, {"Cryotix", {1314}}, {"cawsey21", {94842}}, {"Harryaars", {6023}}, {"AtaletMomenti", {32173}}, {"banakeg", {1216}}, {"Lysander92", {13997}}, {"Orange386", {224}}, {"Dmitriy10000", {18536}}, {"Fire3231", {383649}}, {"SOG_BORST", {3458}}, {"chych", {4529}}, {"ElricCG", {214584}}, {"Demonides", {33733}}, {"Vidaper", {25261}}, {"Collider", {155608}}, {"CallMeTaste", {526683}}, {"Hitman451", {272834}}, {"KillaGurke", {15942}}, {"Didier-Sebastien", {8059}}, {"redlabel", {115146}}, {"iceskaarj", {111900}}, {"ColonelWill", {71078}}, {"ruetama", {470968}}, {"kaimix", {408918}}, {"Terasaki", {43068}}, {"pilatos2003", {1923}}, {"Yoloyer", {26957}}, {"boksiora", {12199}}, {"BlueThunder09", {148241}}, {"clonker50", {15000}}, {"PogomanD", {4349}}, {"DKarma", {5892}}, {"GeneralDroid", {1655}} } return playsession
{"1":{"1":"[13519.7041 8958.2109 1010.6108]","2":"[13489.5928 8861.2695 1010.6136]","3":"[13308.9775 8378.4873 1010.6621]","4":"[13115.1406 7900.6929 1010.6783]","5":"[12941.6631 7417.5024 1010.6921]","6":"[12815.3154 6916.0967 1010.6605]","7":"[12746.4346 6405.4492 1010.5943]","8":"[12717.0625 5891.3296 1010.6243]","9":"[12685.0508 5377.3066 1010.4487]","10":"[12626.7969 4865.873 1011.0557]","11":"[12572.8818 4350.0586 1011.5493]","12":"[12547.249 3838.3726 1012.0383]","13":"[12541.0322 3321.5164 1012.5375]","14":"[12540.8076 2808.4805 1012.6805]","15":"[12540.6465 2289.262 1012.6698]","16":"[12541.542 1776.4479 1012.5953]","17":"[12541.207 1259.517 1012.4852]","18":"[12540.9404 740.1895 1012.541]","19":"[12540.8838 226.8728 1012.6128]","20":"[12541.4043 -290.8668 1012.6035]","21":"[12541.377 -805.7431 1012.7653]","22":"[12541.8613 -1325.6497 1012.4765]","23":"[12540.8125 -1847.9272 1012.6453]","24":"[12541.8398 -2370.3313 1012.576]","25":"[12540.6992 -2890.9624 1012.5013]","26":"[12541.958 -3408.0063 1012.5463]","27":"[12540.7119 -3931.3086 1012.6748]","28":"[12541.7305 -4457.1064 1012.6116]","29":"[12541.3613 -4982.4976 1012.5427]","30":"[12541.4346 -5507.4458 1012.7008]","31":"[12541.6143 -6032.0005 1012.6334]","32":"[12541.2559 -6556.0977 1012.5992]","33":"[12540.3213 -7079.7744 1012.4429]","34":"[12528.2754 -7602.686 1012.1017]","35":"[12499.0537 -8124.3223 1012.3321]","36":"[12449.4697 -8643.8057 1012.0891]","37":"[12377.2148 -9159.4834 1012.5337]","38":"[12281.2207 -9670.0166 1012.1508]","39":"[12158.0645 -10173.6924 1012.1953]","40":"[12006.5488 -10668.6309 1012.1747]","41":"[11823.2168 -11151.6504 1011.9979]","42":"[11607.0732 -11619.499 1012.2983]","43":"[11357.2441 -12068.4102 1012.058]","44":"[11072.1152 -12494.0713 1012.099]","45":"[10743.875 -12904.29 1012.1636]","46":"[10380.7314 -13282.4014 1012.0758]","47":"[9986.208 -13625.9531 1012.1187]","48":"[9563.5889 -13932.6318 1012.3369]","49":"[9117.8525 -14202.4434 1012.2416]","50":"[8652.6494 -14435.2588 1012.0674]","51":"[8172.6196 -14633.3916 1012.1249]","52":"[7681.1948 -14798.1719 1012.3981]","53":"[7181.4077 -14932.8262 1012.2574]","54":"[6675.6875 -15039.3848 1012.1838]","55":"[6166.1099 -15121.082 1012.262]","56":"[5653.8452 -15179.6221 1012.4853]","57":"[5140.3521 -15217.2266 1012.2562]","58":"[4626.4312 -15236.0967 1012.628]","59":"[4113.564 -15240.7803 1012.6922]","60":"[3588.3281 -15241.0742 1012.7005]","61":"[3063.7441 -15240.9258 1012.6732]","62":"[2539.5872 -15241.0977 1012.2015]","63":"[2027.1445 -15241.1348 995.0332]","64":"[1507.7341 -15240.9736 957.5716]","65":"[988.6481 -15240.7588 903.9622]","66":"[467.0417 -15241.1045 844.2825]","67":"[-41.4122 -15240.9082 784.0493]","68":"[-550.2209 -15241.5156 722.0129]","69":"[-1058.4111 -15241.2588 659.5743]","70":"[-1581.7961 -15241.3594 595.1873]","71":"[-2102.5898 -15242.1436 531.5289]","72":"[-2619.0588 -15241.1689 468.6218]","73":"[-3128.5762 -15241.5098 408.2298]","74":"[-3652.6433 -15241.8359 348.9482]","75":"[-4168.0093 -15241.2773 297.1356]","76":"[-4688.7861 -15241.5156 263.7786]","77":"[-5209.1577 -15241.4111 250.818]","78":"[-5723.481 -15241.3682 250.5288]","79":"[-6241.2104 -15234.2139 250.705]","80":"[-6756.894 -15212.3672 250.1335]","81":"[-7277.6362 -15169.8887 250.0536]","82":"[-7793.6016 -15106.627 250.211]","83":"[-8304.1152 -15019.6328 250.1694]","84":"[-8805.0215 -14908.8262 250.1632]","85":"[-9298.166 -14769.9121 250.0612]","86":"[-9791.9082 -14597.8447 250.1163]","87":"[-10271.4639 -14392.0508 250.3199]","88":"[-10733.3408 -14152.0381 250.0987]","89":"[-11173.2471 -13876.0127 249.9881]","90":"[-11587.7305 -13565.1084 250.0863]","91":"[-11972.0996 -13219.4355 250.0518]","92":"[-12323.6465 -12842.0693 249.9604]","93":"[-12640.3984 -12436.377 250.1752]","94":"[-12920.9854 -12006.083 250.1939]","95":"[-13166.4023 -11554.6035 250.1735]","96":"[-13377.8076 -11084.2578 250.2198]","97":"[-13556.5439 -10598.5518 250.3001]","98":"[-13704.7637 -10100.3857 249.9391]","99":"[-13824.6172 -9592.25 250.2439]","100":"[-13915.7295 -9087.6982 250.2401]","101":"[-13983.8633 -8579.6289 250.1762]","102":"[-14030.1416 -8069.6953 250.3437]","103":"[-14057.7891 -7547.4243 250.2878]","104":"[-14067.541 -7025.8115 250.3219]","105":"[-14069.5488 -6506.0635 250.4274]","106":"[-14068.5684 -5987.6396 250.6819]","107":"[-14069.3672 -5469.8115 250.5971]","108":"[-14069.1689 -4952.3223 250.6645]","109":"[-14068.7393 -4435.1812 250.6255]","110":"[-14069.5303 -3918.4009 250.5575]","111":"[-14068.7793 -3401.9573 250.4946]","112":"[-14069.416 -2885.863 250.5201]","113":"[-14068.7334 -2370.1038 250.6743]","114":"[-14069.458 -1854.7114 250.5457]","115":"[-14068.8037 -1339.6626 250.6371]","116":"[-14065.2393 -826.3026 250.9904]","117":"[-14036.8174 -305.3338 250.8761]","118":"[-13968.7705 208.6006 251.2007]","119":"[-13852.4941 711.0356 250.9323]","120":"[-13676.4668 1192.8566 251.0521]","121":"[-13430.749 1651.0698 250.7931]","122":"[-13115.7656 2060.5974 250.8774]","123":"[-12736.3604 2406.9434 251.1378]","124":"[-12296.918 2688.6594 250.738]","125":"[-11820.2588 2898.0391 250.8197]","126":"[-11321.1719 3043.05 250.8958]","127":"[-10810.21 3133.0601 251.0127]","128":"[-10294.1855 3177.4585 250.9744]","129":"[-9773.542 3190.2219 236.3055]","130":"[-9262.209 3190.937 203.4707]","131":"[-8751.4355 3191.3064 152.0362]","132":"[-8237.4023 3190.6853 94.0201]","133":"[-7721.4067 3191.3042 33.1507]","134":"[-7207.502 3191.3792 -28.5855]","135":"[-6698.749 3191.5811 -89.3069]","136":"[-6183.7061 3191.3728 -148.4093]","137":"[-5664.7847 3191.5344 -202.8982]","138":"[-5146.2529 3191.144 -242.3391]","139":"[-4619.9751 3190.9585 -259.8633]","140":"[-4105.3545 3191.2336 -261.0396]","141":"[-3590.9517 3190.8955 -261.0295]","142":"[-3077.4121 3191.6575 -260.6863]","143":"[-2553.2095 3190.5112 -244.2752]","144":"[-2038.5962 3191.3298 -207.5986]","145":"[-1524.2058 3190.7417 -154.4061]","146":"[-1014.5494 3191.2327 -96.2161]","147":"[-499.0002 3191.2012 -35.0652]","148":"[18.1119 3191.0088 27.8322]","149":"[532.7639 3191.1638 90.8734]","150":"[1051.8645 3191.0339 154.5959]","151":"[1568.8352 3191.3037 218.1479]","152":"[2078.9358 3191.4126 279.9985]","153":"[2595.6487 3191.3721 341.4323]","154":"[3108.4644 3191.3608 399.4412]","155":"[3622.6299 3191.3538 451.3274]","156":"[4137.502 3191.7136 486.2715]","157":"[4653.2393 3191.5696 500.2916]","158":"[5171.0898 3205.0898 500.9331]","159":"[5689.0303 3246.0618 500.94]","160":"[6194.75 3335.0684 501.3255]","161":"[6694.3862 3475.9646 500.9875]","162":"[7174.8071 3684.9553 500.8839]","163":"[7615.5664 3963.7571 500.9892]","164":"[8000.4897 4312.2329 500.7807]","165":"[8317.1211 4720.9341 500.9459]","166":"[8562.7637 5174.187 501.0161]","167":"[8739.915 5657.3828 501.056]","168":"[8858.25 6157.5005 500.8757]","169":"[8926.8867 6666.2534 501.0868]","170":"[8955.7891 7178.4043 500.9653]","171":"[8961.4453 7691.1455 500.8301]","172":"[8959.7393 8203.5498 500.9828]","173":"[8941.9932 8727.1133 500.9173]","174":"[8890.084 9247.2793 500.9916]","175":"[8789.7041 9757.3506 500.9844]","176":"[8633.8955 10250.5967 500.9221]","177":"[8414.2637 10716.3301 500.869]","178":"[8125.5679 11139.5859 501.1699]","179":"[7762.2944 11513.9854 500.8319]","180":"[7340.9302 11818.2969 500.8631]","181":"[6877.019 12049.8428 500.8846]","182":"[6386.6104 12215.2588 500.9364]","183":"[5880.8975 12322.5459 501.0672]","184":"[5367.9399 12381.2939 501.041]","185":"[4852.397 12403.0117 500.766]","186":"[4336.7163 12406.6787 500.9497]","187":"[3821.3721 12405.4668 500.8029]","188":"[3306.3789 12406.1094 500.905]","189":"[2791.7256 12405.9443 500.7597]","190":"[2277.4287 12406.1104 500.8369]","191":"[1763.4557 12406.252 500.805]","192":"[1240.2058 12405.7139 500.9157]","193":"[722.4012 12406.4482 500.8591]","194":"[207.3647 12405.4766 500.8155]","195":"[-309.0729 12406.0342 500.7144]","196":"[-824.8139 12404.4727 500.8525]","197":"[-1338.962 12379.5166 500.8799]","198":"[-1849.1053 12307.3662 500.7966]","199":"[-2344.3999 12170.8193 500.4696]","200":"[-2810.6926 11953.1436 500.1019]","201":"[-3130.5471 11728.5127 500.1127]","202":"[-3419.3052 11438.6865 499.956]","203":"[-3650.7212 11106.123 500.1912]","204":"[-3852.4666 10670.1299 500.3101]","205":"[-3990.5173 10176.1504 500.7839]","206":"[-4064.2739 9665.7246 501.1979]","207":"[-4089.3657 9153.4375 501.136]","208":"[-4092.3677 8638.9785 501.2417]","209":"[-4092.1726 8121.3452 501.1299]","210":"[-4092.4241 7607.2524 501.3311]","211":"[-4092.5981 7089.8423 501.5157]","212":"[-4092.8337 6576.5854 501.4685]","213":"[-4092.301 6060.209 501.6345]","214":"[-4091.5212 5546.1475 501.548]","215":"[-4092.697 5033.9761 501.6759]","216":"[-4092.4019 4517.4248 501.5636]","217":"[-4092.5515 4002.7507 501.6337]","218":"[-4092.9709 3489.9717 501.57]","219":"[-4092.9204 2972.9805 501.7228]","220":"[-4092.408 2457.9976 501.5255]","221":"[-4092.8379 1945.0526 501.5731]","222":"[-4093.0161 1428.0737 501.4994]","223":"[-4092.8474 913.3145 501.6638]","224":"[-4077.4785 396.0356 501.6651]","225":"[-4024.8613 -114.5749 501.7957]","226":"[-3908.6621 -615.2733 501.4627]","227":"[-3713.2839 -1089.3422 501.3966]","228":"[-3507.3125 -1413.9058 501.3316]","229":"[-3222.6885 -1725.1218 501.5131]","230":"[-2926.1531 -1952.7782 501.5956]","231":"[-2515.0872 -2166.3433 501.496]","232":"[-2024.1331 -2321.7085 501.6985]","233":"[-1514.2231 -2405.0361 501.6642]","234":"[-999.0103 -2435.1646 501.7427]","235":"[-486.2469 -2439.0776 501.7362]","236":"[27.1488 -2440.5051 501.7692]","237":"[540.0073 -2440.6897 501.5897]","238":"[1058.3048 -2439.4932 501.6432]","239":"[1573.554 -2439.8394 501.6323]","240":"[2092.0527 -2439.7957 501.5378]","241":"[2605.1619 -2440.0159 501.5661]","242":"[3119.7214 -2439.5857 501.6063]","243":"[3635.0933 -2439.571 501.637]","244":"[4150.6387 -2440.0916 501.5813]","245":"[4665.7749 -2439.5425 501.5885]","246":"[5179.9619 -2439.7485 501.5434]","247":"[5692.6704 -2440.1511 501.5693]","248":"[6211.4565 -2439.7983 501.558]","249":"[6731.582 -2439.604 501.5677]","250":"[7251.104 -2440.3035 501.6573]","251":"[7770.0459 -2439.627 501.5911]","252":"[8288.4131 -2440.1792 501.5866]","253":"[8806.2041 -2440.0056 501.5869]","254":"[9323.4316 -2439.8586 501.5757]","255":"[9840.0615 -2439.8804 501.5873]","256":"[10355.6074 -2439.7402 501.7833]","257":"[10870.2002 -2438.8667 501.8095]","258":"[11384.6494 -2449.1948 499.3271]","259":"[11896.8477 -2492.3745 495.438]","260":"[12397.4922 -2600.1919 491.0166]","261":"[12869.3184 -2792.8333 487.6299]","262":"[13140.2012 -2963.8818 486.3735]","263":"[13430.5176 -3228.6423 486.2353]","264":"[13617.8223 -3472.2305 486.735]","265":"[13826.7979 -3874.2788 489.0049]","266":"[13958.8027 -4294.4648 492.3929]","267":"[14041.2783 -4803.2954 497.3607]","268":"[14068.498 -5319.9604 500.3365]","269":"[14072.4238 -5833.6938 501.5411]","270":"[14073.084 -6346.0923 501.547]","271":"[14071.9932 -6865.479 501.5554]","272":"[14072.083 -7384.001 501.5893]","273":"[14072.9063 -7901.7046 501.5284]","274":"[14072.1904 -8418.5664 501.5786]","275":"[14071.9111 -8934.5537 501.5471]","276":"[14072.6406 -9449.6631 501.5538]","277":"[14072.6621 -9963.8936 501.5881]","278":"[14072.9375 -10477.2656 501.5844]","279":"[14072.2041 -10989.7705 501.5902]","280":"[14063.1875 -11501.8291 499.317]","281":"[14020.2588 -12019.5771 495.5218]","282":"[13910.8623 -12526.5293 490.8891]","283":"[13718.7646 -12996.5781 487.5054]","284":"[13547.5166 -13267.4395 486.3413]","285":"[13282.915 -13557.8623 485.874]","286":"[13045.5947 -13741.04 486.7486]","287":"[12638.4082 -13953.7705 488.8061]","288":"[12219.3076 -14086.0791 492.3576]","289":"[11713.7461 -14168.4668 497.2368]","290":"[11200.1602 -14196.3682 491.6954]","291":"[10684.1484 -14199.7305 464.8056]","292":"[10170.6406 -14199.9873 416.3383]","293":"[9656.1611 -14200.208 359.2911]","294":"[9142.5234 -14200.4717 299.1188]","295":"[8629.8223 -14200.8135 237.4911]","296":"[8120.3169 -14200.6592 176.5001]","297":"[7608.9141 -14200.3477 116.97]","298":"[7099.6138 -14200.875 62.0806]","299":"[6581.1187 -14200.959 16.9987]","300":"[6061.835 -14200.0059 -5.9197]","301":"[5545.5869 -14199.9795 -10.495]","302":"[5030.3931 -14200.4414 -10.4575]","303":"[4515.7583 -14200.3838 -10.4342]","304":"[4001.6101 -14200.2188 -10.3165]","305":"[3487.9495 -14200.0996 -10.3945]","306":"[2974.8018 -14200.5303 -10.4498]","307":"[2462.1868 -14200.3975 -10.4277]","308":"[1950.0881 -14200.0068 -10.3229]","309":"[1429.5305 -14200.6768 -10.4083]","310":"[909.5067 -14200.0186 -10.343]","311":"[389.995 -14200.2764 -10.42]","312":"[-122.9451 -14200.3154 -21.6167]","313":"[-638.0699 -14200.1016 -51.6823]","314":"[-1148.656 -14200.4131 -101.3809]","315":"[-1660.0336 -14200.3545 -158.4596]","316":"[-2175.9507 -14200.1211 -219.402]","317":"[-2686.9819 -14200.5771 -280.8463]","318":"[-3202.5654 -14200.9727 -342.3912]","319":"[-3721.2849 -14200.5811 -402.4456]","320":"[-4240.6025 -14200.9512 -457.6774]","321":"[-4760.3535 -14200.8594 -499.8965]","322":"[-5274.9409 -14200.3887 -519.5205]","323":"[-5787.6802 -14200.0439 -522.4797]","324":"[-6304.3706 -14200.8535 -522.3938]","325":"[-6819.1172 -14200.458 -522.3522]","326":"[-7332.6626 -14200.4092 -522.3727]","327":"[-7844.9946 -14200.1553 -522.3685]","328":"[-8363.1641 -14200.3984 -522.4336]","329":"[-8880.0762 -14200.0752 -522.3876]","330":"[-9395.7441 -14200.3125 -522.4501]","331":"[-9910.1045 -14200.6484 -522.373]","332":"[-10423.1729 -14201.2549 -522.4004]","333":"[-10941.8418 -14200.0645 -522.4006]","334":"[-11460.2549 -14186.5449 -525.0286]","335":"[-11975.7227 -14134.458 -529.5316]","336":"[-12474.0088 -14014.4834 -533.8006]","337":"[-12909.4746 -13824.2061 -536.7311]","338":"[-13176.7754 -13646.2793 -537.8258]","339":"[-13459.9844 -13375.4639 -537.9695]","340":"[-13645.5752 -13122.0801 -537.2382]","341":"[-13846.1895 -12714.1162 -534.4987]","342":"[-13974.2783 -12272.4238 -531.1353]","343":"[-14046.9688 -11763.0957 -526.1567]","344":"[-14070.5918 -11251.5449 -523.3973]","345":"[-14072.3828 -10738.3867 -522.4432]","346":"[-14072.7402 -10224.5107 -522.348]","347":"[-14073.4912 -9711.1074 -522.4013]","348":"[-14073.3418 -9194.6514 -522.4669]","349":"[-14071.8809 -8677.8135 -522.3953]","350":"[-14071.9629 -8159.2417 -522.2788]","351":"[-14072.5244 -7647.0645 -522.3243]","352":"[-14072.6787 -7130.5244 -522.3964]","353":"[-14072.5234 -6611.8833 -522.316]","354":"[-14072.6973 -6095.1084 -522.1926]","355":"[-14072.4912 -5572.1772 -522.3535]","356":"[-14072.6152 -5058.6304 -522.1808]","357":"[-14072.2373 -4537.0288 -522.2476]","358":"[-14072.959 -4016.9531 -522.2012]","359":"[-14072.1973 -3493.04 -522.2304]","360":"[-14072.5 -2969.4541 -522.2885]","361":"[-14072.7949 -2446.2209 -522.332]","362":"[-14071.9307 -1923.3572 -522.2949]","363":"[-14072.9717 -1400.8643 -522.2882]","364":"[-14064.5723 -879.0057 -522.3022]","365":"[-14039.2939 -359.2127 -522.3961]","366":"[-13986.0615 157.2454 -522.2965]","367":"[-13905.9492 669.4927 -522.2472]","368":"[-13794.791 1174.8517 -522.5016]","369":"[-13653.1348 1671.5032 -522.2663]","370":"[-13485.9131 2158.6436 -522.0203]","371":"[-13326.9268 2646.1758 -522.578]","372":"[-13189.6279 3151.8525 -522.3093]","373":"[-13088.0781 3665.2407 -522.4439]","374":"[-13013.8125 4182.5981 -522.4203]","375":"[-12969.124 4702.8057 -522.335]","376":"[-12948.7783 5223.0933 -522.2795]","377":"[-12943.1777 5743.0591 -522.4384]","378":"[-12935.9629 6261.6841 -522.2463]","379":"[-12912.1592 6779.1753 -522.453]","380":"[-12869.127 7294.499 -522.3069]","381":"[-12804.7451 7806.2891 -522.3603]","382":"[-12717.4102 8313.8398 -522.3568]","383":"[-12604.2256 8815.0664 -522.2916]","384":"[-12463.6504 9307.9443 -522.4122]","385":"[-12292.8389 9791.6504 -522.2174]","386":"[-12088.876 10265.459 -522.465]","387":"[-11847.916 10725.2598 -522.5396]","388":"[-11569.8955 11167.9736 -522.2914]","389":"[-11259.0273 11578.1826 -522.5443]","390":"[-10915.6992 11959.6709 -522.311]","391":"[-10539.3896 12308.8955 -522.5217]","392":"[-10124.4082 12631.7051 -522.2174]","393":"[-9685.1113 12915.627 -522.3385]","394":"[-9228.0059 13161.3438 -522.3632]","395":"[-8758.5508 13369.8447 -522.1659]","396":"[-8267.959 13548.2656 -522.2515]","397":"[-7773.7183 13692.7207 -522.5286]","398":"[-7264.8701 13811.1768 -522.2604]","399":"[-6758.7085 13900.9443 -522.3778]","400":"[-6242.4043 13968.1904 -522.3218]","401":"[-5717.3472 14014.2227 -522.3551]","402":"[-5200.8877 14039.2959 -522.3448]","403":"[-4678.1812 14047.8564 -522.3649]","404":"[-4150.0444 14048.2178 -522.4567]","405":"[-3635.2036 14048.7568 -522.4612]","406":"[-3119.4863 14048.1475 -522.4653]","407":"[-2604.2649 14048.3223 -522.4469]","408":"[-2089.5571 14048.6523 -522.4537]","409":"[-1575.3546 14048.3076 -522.5054]","410":"[-1061.6375 14048.4775 -522.3889]","411":"[-548.3989 14048.2969 -522.4579]","412":"[-35.6296 14048.7705 -522.3526]","413":"[476.6543 14048.25 -522.4954]","414":"[1004.9284 14048.1963 -522.4741]","415":"[1532.6997 14048.8418 -522.362]","416":"[2059.9126 14047.9707 -522.4614]","417":"[2586.6306 14048.791 -522.4047]","418":"[3112.843 14048.4805 -522.4421]","419":"[3638.5276 14048.2959 -522.4752]","420":"[4163.6777 14048.791 -522.4551]","421":"[4687.9365 14044.2061 -522.3538]","422":"[5211.1631 14027.7109 -522.0482]","423":"[5731.6807 13990.0654 -522.2577]","424":"[6249.3252 13932.9199 -522.5661]","425":"[6763.0352 13852.6709 -522.3879]","426":"[7271.0474 13746.5469 -522.2213]","427":"[7771.6992 13613.9609 -522.3607]","428":"[8262.1934 13450.542 -522.3881]","429":"[8740.1963 13256.0322 -522.3411]","430":"[9201.7383 13027.5156 -522.3356]","431":"[9643.1025 12764.1943 -522.3773]","432":"[10060.6631 12466.5322 -522.3294]","433":"[10461.3994 12123.2061 -522.3691]","434":"[10829.1201 11746.3428 -522.2366]","435":"[11160.8799 11338.8242 -522.5002]","436":"[11455.0693 10904.5518 -522.4008]","437":"[11711.8076 10448.1924 -522.3512]","438":"[11932.3623 9974.1787 -522.3607]","439":"[12118.0977 9486.3203 -522.1716]","440":"[12271.5889 8988.5723 -522.3376]","441":"[12394.7393 8483.1846 -522.3716]","442":"[12492.0313 7972.7783 -522.2482]","443":"[12563.6152 7458.7363 -522.2285]","444":"[12613.2393 6942.665 -522.1929]","445":"[12643.1699 6425.5933 -522.3723]","446":"[12654.8086 5908.2598 -522.2938]","447":"[12656.6133 5391.1763 -522.377]","448":"[12655.9404 4874.502 -522.2893]","449":"[12656.6563 4358.2739 -522.3682]","450":"[12656.2451 3842.5427 -522.2554]","451":"[12656.542 3327.2512 -522.4576]","452":"[12656.3379 2812.416 -522.3412]","453":"[12656.3965 2298.0552 -522.4299]","454":"[12656.667 1784.162 -522.3783]","455":"[12656.1621 1270.8263 -522.0604]","456":"[12655.9932 758.3624 -522.3683]","457":"[12656.4609 230.8724 -522.4637]","458":"[12655.7725 -296.1404 -522.3278]","459":"[12656.5 -822.6995 -522.3555]","460":"[12655.8477 -1348.7728 -522.3592]","461":"[12656.3232 -1873.9224 -522.2131]","462":"[12655.9893 -2396.1387 -522.3448]","463":"[12656.1162 -2909.0583 -522.0422]","464":"[12656.6836 -3422.7917 -522.3944]","465":"[12655.9355 -3942.792 -522.3614]","466":"[12656.4521 -4460.6807 -522.4261]","467":"[12655.7236 -4983.6294 -522.2452]","468":"[12656.2656 -5506.1914 -524.3086]","469":"[12655.9658 -6020.7915 -539.2028]","470":"[12656.252 -6533.2202 -573.9517]","471":"[12656.0957 -7053.8608 -615.0451]","472":"[12655.8506 -7571.8872 -642.1234]","473":"[12633.5332 -8089.5444 -651.2117]","474":"[12566.373 -8603.2051 -651.0812]","475":"[12428.5674 -9101.8975 -651.1945]","476":"[12208.2959 -9564.2109 -651.3639]","477":"[11996.0264 -9861.3877 -651.3284]","478":"[11690.6455 -10160.7656 -651.4176]","479":"[11393.9004 -10363.9482 -651.3464]","480":"[10927.6787 -10576.3535 -651.3414]","481":"[10425.708 -10707.5059 -651.3922]","482":"[9912.5186 -10771.4404 -650.6482]","483":"[9400.8213 -10790.0703 -650.7537]","484":"[8888.3564 -10790.8223 -650.2488]","485":"[8371.9414 -10792.3232 -650.4514]","486":"[7856.9355 -10792.6396 -650.3989]","487":"[7344.7451 -10792.6133 -664.4765]","488":"[6826.6475 -10791.876 -698.1093]","489":"[6312.3818 -10791.5732 -749.5457]","490":"[5801.666 -10792.2578 -807.2184]","491":"[5291.6353 -10791.9326 -867.6615]","492":"[4778.4331 -10792.6572 -929.947]","493":"[4268.3208 -10792.3486 -992.5781]","494":"[3754.2478 -10792.4092 -1055.5032]","495":"[3240.114 -10792.5908 -1118.744]","496":"[2729.8254 -10792.3291 -1180.6729]","497":"[2212.4954 -10792.3066 -1242.3535]","498":"[1690.3702 -10792.4053 -1302.3051]","499":"[1166.0608 -10792.5342 -1356.8461]","500":"[643.9037 -10792.4512 -1395.3246]","501":"[130.5565 -10792.5166 -1411.3773]","502":"[-385.792 -10792.5313 -1412.2311]","503":"[-901.8034 -10792.2988 -1412.288]","504":"[-1417.3481 -10792.3193 -1412.3867]","505":"[-1932.4393 -10792.5088 -1412.3728]","506":"[-2447.071 -10792.0215 -1412.3308]","507":"[-2961.2539 -10792.7676 -1412.1843]","508":"[-3474.9641 -10792.5684 -1412.3042]","509":"[-3988.0559 -10787.1797 -1412.3807]","510":"[-4500.0703 -10769.5186 -1412.2104]","511":"[-5026.106 -10730.3857 -1412.4135]","512":"[-5549.1025 -10670.3027 -1412.3966]","513":"[-6068.0005 -10586.6533 -1412.3459]","514":"[-6581.166 -10476.6143 -1412.3104]","515":"[-7086.6665 -10338.5908 -1412.2794]","516":"[-7581.6025 -10169.2275 -1412.1715]","517":"[-8062.98 -9967.7275 -1412.3584]","518":"[-8526.8047 -9730.8555 -1412.3062]","519":"[-8969.6768 -9458.9482 -1412.4205]","520":"[-9386.8281 -9150.9395 -1412.3528]","521":"[-9774.9121 -8808.8135 -1412.3984]","522":"[-10130.0908 -8434.1064 -1412.459]","523":"[-10450.7803 -8030.7617 -1412.3785]","524":"[-10735.2207 -7602.1934 -1412.338]","525":"[-10983.7334 -7152.8042 -1412.3787]","526":"[-11197.54 -6686.7729 -1412.2268]","527":"[-11382.3701 -6192.7153 -1412.3342]","528":"[-11535.5645 -5688.6772 -1412.4243]","529":"[-11657.4326 -5176.8252 -1412.2219]","530":"[-11752.7256 -4660.1699 -1412.1357]","531":"[-11822.7119 -4140.3447 -1412.3109]","532":"[-11870.3262 -3618.5 -1412.3174]","533":"[-11897.5156 -3095.9463 -1412.5164]","534":"[-11906.125 -2573.438 -1412.399]","535":"[-11895.7793 -2051.4939 -1412.3773]","536":"[-11866.4746 -1531.2574 -1412.2319]","537":"[-11817.2227 -1013.5092 -1412.1552]","538":"[-11745.8447 -499.0813 -1412.1312]","539":"[-11650.2148 10.4775 -1412.1123]","540":"[-11528.0156 512.7554 -1412.434]","541":"[-11377.7412 1006.361 -1412.2935]","542":"[-11195.6338 1488.2328 -1412.4171]","543":"[-10981.5977 1955.3887 -1412.1371]","544":"[-10732.7549 2403.4331 -1412.381]","545":"[-10441.0078 2841.6179 -1412.3064]","546":"[-10112.874 3251.5034 -1412.408]","547":"[-9750.2432 3629.7305 -1412.4482]","548":"[-9356.0059 3973.2485 -1412.2993]","549":"[-8933.8711 4280.2197 -1412.3035]","550":"[-8488.374 4550.0942 -1412.3534]","551":"[-8023.3853 4782.6938 -1412.3409]","552":"[-7543.6899 4981.2974 -1412.3521]","553":"[-7052.1064 5146.1558 -1412.4451]","554":"[-6552.2827 5281.311 -1412.0513]","555":"[-6046.7158 5387.876 -1412.2328]","556":"[-5537.2744 5469.6318 -1412.3547]","557":"[-5025.1553 5528.1445 -1412.4126]","558":"[-4511.5918 5566.2964 -1412.2805]","559":"[-3997.4014 5585.1323 -1412.4773]","560":"[-3483.219 5590.271 -1412.3567]","561":"[-2969.6902 5590.7856 -1412.2167]","562":"[-2456.7991 5590.2285 -1412.5327]","563":"[-1944.6884 5590.3096 -1412.2587]","564":"[-1418.8049 5590.4141 -1412.1809]","565":"[-894.1017 5589.9932 -1412.3768]","566":"[-369.2563 5590.0303 -1412.4467]","567":"[147.47 5590.2393 -1412.3733]","568":"[661.7734 5590.248 -1412.4015]","569":"[1175.0205 5590.1992 -1412.3988]","570":"[1689.5765 5589.5322 -1412.3911]","571":"[2209.2036 5590.1108 -1412.4393]","572":"[2728.2937 5589.9233 -1412.4667]","573":"[3246.9697 5590.2637 -1412.4089]","574":"[3763.0859 5589.6338 -1412.3977]","575":"[4283.7212 5589.9302 -1412.3934]","576":"[4799.834 5589.8257 -1412.3354]","577":"[5316.0591 5589.7163 -1412.2852]","578":"[5835.3584 5590.543 -1412.3578]","579":"[6353.6763 5590.1582 -1412.3934]","580":"[6867.3179 5587.3838 -1411.6819]","581":"[7384.8911 5560.9097 -1411.1719]","582":"[7893.4688 5485.5156 -1411.6444]","583":"[8388.4561 5344.125 -1412.1411]","584":"[8850.8545 5122.313 -1412.2581]","585":"[9153.416 4905.354 -1412.2765]","586":"[9452.0361 4599.9282 -1412.2521]","587":"[9673.1816 4275.6245 -1412.2716]","588":"[9880.3193 3816.3203 -1411.7538]","589":"[10012.8398 3318.7034 -1411.6575]","590":"[10081.0508 2806.9309 -1411.8773]","591":"[10103.833 2294.7266 -1411.8479]","592":"[10104.5439 1778.5665 -1412.3778]","593":"[10104.833 1264.3126 -1412.4751]","594":"[10105.0967 751.914 -1412.3887]","595":"[10104.4971 235.1346 -1412.5044]","596":"[10104.7852 -279.7182 -1412.4309]","597":"[10105.1836 -792.6125 -1412.4489]","598":"[10105.5156 -1309.6777 -1412.4197]","599":"[10105.8203 -1824.6919 -1412.3969]","600":"[10104.9307 -2337.4209 -1412.4546]","601":"[10084.1211 -2851.0405 -1412.28]","602":"[10019.874 -3364.252 -1412.6356]","603":"[9893.0537 -3861.572 -1412.9087]","604":"[9686.7832 -4332.6426 -1413.2797]","605":"[9466.2529 -4663.397 -1413.4017]","606":"[9176.6289 -4966.457 -1413.4728]","607":"[8868.8506 -5192.0908 -1413.2228]","608":"[8420.8311 -5412.7397 -1412.4773]","609":"[7927.3398 -5559.269 -1411.7534]","610":"[7420.3853 -5638.4653 -1411.3452]","611":"[6906.7446 -5667.667 -1410.8778]","612":"[6392.6523 -5672.2881 -1410.4348]","613":"[5879.8174 -5673.1953 -1410.4408]","614":"[5363.6636 -5672.6953 -1410.4154]","615":"[4849.9111 -5672 -1410.3424]","616":"[4334.8022 -5671.8936 -1410.4025]","617":"[3822.0315 -5672.5332 -1410.308]","618":"[3306.1528 -5672.7266 -1410.4312]","619":"[2792.439 -5672.9229 -1410.4418]","620":"[2275.4509 -5672.5776 -1410.4122]","621":"[1763.0964 -5672.2925 -1422.9502]","622":"[1250.3313 -5672.3589 -1454.131]","623":"[735.1708 -5672.2534 -1504.6869]","624":"[223.2562 -5672.2959 -1562.1456]","625":"[-292.5779 -5672.2578 -1623.1239]","626":"[-801.6489 -5672.6875 -1684.329]","627":"[-1316.2179 -5673.3252 -1745.7249]","628":"[-1832.5599 -5672.7144 -1805.4309]","629":"[-2349.2446 -5672.6626 -1859.879]","630":"[-2861.7219 -5672.9399 -1900.7892]","631":"[-3377.2583 -5672.6045 -1919.7477]","632":"[-3892.1272 -5672.2651 -1922.5117]","633":"[-4404.5332 -5673.1606 -1922.3539]","634":"[-4919.3662 -5672.1675 -1921.7052]","635":"[-5436.3149 -5690.0728 -1921.9032]","636":"[-5947.1167 -5746.1084 -1921.5692]","637":"[-6446.3677 -5863.5313 -1921.9009]","638":"[-6925.0254 -6059.0776 -1922.1256]","639":"[-7272.9517 -6278.9819 -1922.3988]","640":"[-7579.105 -6558.1738 -1922.5187]","641":"[-7819.8496 -6871.2554 -1922.3337]","642":"[-8034.8379 -7283.7168 -1922.1506]","643":"[-8192.7568 -7775.7578 -1921.7515]","644":"[-8280.9658 -8282.042 -1921.4114]","645":"[-8304.0127 -8798.3418 -1921.4225]","646":"[-8267.3984 -9312.2998 -1921.5089]","647":"[-8165.7383 -9815.4346 -1921.8452]","648":"[-7991.9961 -10298.7871 -1922.0907]","649":"[-7762.9502 -10698.3311 -1922.3973]","650":"[-7528.1855 -10979.7959 -1922.4757]","651":"[-7181.7388 -11271.6768 -1922.3186]","652":"[-6863.459 -11455.8779 -1922.2755]","653":"[-6381.8218 -11640.2783 -1921.8663]","654":"[-5879.2051 -11749.7666 -1921.5848]","655":"[-5365.9653 -11799.8389 -1921.8245]","656":"[-4851.0132 -11813.7881 -1922.1215]","657":"[-4336.6426 -11813.708 -1922.4093]","658":"[-3820.751 -11813.5537 -1922.3221]","659":"[-3306.261 -11813.8203 -1922.3835]","660":"[-2789.6543 -11814.0039 -1922.3726]","661":"[-2276.7375 -11813.7627 -1922.4176]","662":"[-1760.1951 -11814.0469 -1922.3459]","663":"[-1246.1155 -11814.6982 -1922.3993]","664":"[-732.5637 -11814.5625 -1922.4119]","665":"[-215.7592 -11813.9453 -1922.4489]","666":"[302.2823 -11813.3223 -1922.4551]","667":"[819.7524 -11814.2588 -1922.4147]","668":"[1335.0233 -11814.4727 -1922.4486]","669":"[1854.2269 -11813.8496 -1922.4532]","670":"[2368.7739 -11813.4443 -1922.4597]","671":"[2885.3379 -11814.0938 -1922.4758]","672":"[3403.1812 -11814.5615 -1922.3009]","673":"[3921.6594 -11813.5547 -1922.4481]","674":"[4440.1748 -11814.0342 -1922.4581]","675":"[4958.0503 -11814.8613 -1922.437]","676":"[5472.7246 -11813.5088 -1922.4825]","677":"[5987.2983 -11813.4277 -1922.447]","678":"[6501.1938 -11814.2539 -1922.468]","679":"[7014.4312 -11814.1914 -1922.4443]","680":"[7527.019 -11813.7432 -1922.4231]","681":"[8046.9243 -11805.6436 -1922.7838]","682":"[8563.3975 -11768.5488 -1923.4681]","683":"[9069.5156 -11674.6621 -1923.7179]","684":"[9560.5293 -11508.6748 -1923.999]","685":"[9987.875 -11274.167 -1924.4561]","686":"[10281.9336 -11037.4463 -1924.297]","687":"[10547.9775 -10732.5342 -1924.2792]","688":"[10774.7734 -10355.7764 -1924.0184]","689":"[10958.7393 -9876.4434 -1923.7067]","690":"[11068.5986 -9369.9551 -1923.413]","691":"[11116.6084 -8859.3838 -1923.9424]","692":"[11131.5537 -8340.8926 -1924.3615]","693":"[11130.3047 -7825.0796 -1920.1118]","694":"[11128.6035 -7313.3525 -1897.8042]","695":"[11128.9219 -6802.9761 -1854.2668]","696":"[11129.167 -6293.1499 -1799.4063]","697":"[11129.6523 -5779.8735 -1739.6193]","698":"[11128.541 -5265.605 -1678.1442]","699":"[11129.3135 -4750.7012 -1616.3723]","700":"[11128.6387 -4236.4336 -1555.8695]","701":"[11128.8223 -3716.6252 -1498.2457]","702":"[11128.917 -3203.8818 -1449.5997]","703":"[11129.4082 -2683.4814 -1422.0178]","704":"[11129.1592 -2165.4604 -1411.8804]","705":"[11129.1318 -1650.5692 -1412.5028]","706":"[11128.5146 -1136.8879 -1412.3547]","707":"[11129.6279 -623.6518 -1412.4858]","708":"[11128.7334 -110.329 -1412.3383]","709":"[11128.8623 409.7418 -1412.4344]","710":"[11128.8916 929.08 -1412.3528]","711":"[11128.5195 1447.6659 -1412.4551]","712":"[11129.3916 1965.4944 -1412.3977]","713":"[11129.1719 2482.584 -1412.4315]","714":"[11128.3896 2998.9038 -1412.4769]","715":"[11120.9883 3513.9971 -1412.175]","716":"[11085.083 4025.7065 -1412.3574]","717":"[10991.0918 4534.8369 -1412.6427]","718":"[10824.332 5026.9907 -1413.0956]","719":"[10588.7695 5455.3867 -1413.4397]","720":"[10353.0186 5747.5806 -1413.5345]","721":"[10039.4453 6020.7432 -1413.274]","722":"[9686.9414 6232.8213 -1413.005]","723":"[9203.3027 6420.853 -1412.8401]","724":"[8701.9346 6531.6626 -1412.4161]","725":"[8185.8447 6583.5137 -1412.3943]","726":"[7666.9219 6598.5728 -1412.4238]","727":"[7154.2964 6597.248 -1412.4512]","728":"[6642.1001 6597.0146 -1412.4213]","729":"[6123.314 6597.9023 -1412.4274]","730":"[5606.9414 6597.6704 -1412.3903]","731":"[5088.3887 6597.4536 -1412.9924]","732":"[4571.6226 6597.6431 -1413.2838]","733":"[4049.5156 6598.0835 -1413.4752]","734":"[3536.8677 6597.4214 -1413.3989]","735":"[3015.9736 6598.3979 -1413.1592]","736":"[2503.8088 6597.5376 -1413.3011]","737":"[1980.9624 6598.4141 -1413.2867]","738":"[1463.4869 6596.646 -1411.8026]","739":"[951.2886 6598.085 -1412.3527]","740":"[427.6695 6597.2568 -1412.0833]","741":"[-92.3186 6597.6836 -1412.2854]","742":"[-607.2303 6597.9858 -1412.3994]","743":"[-1130.6852 6597.2139 -1412.6411]","744":"[-1646.8623 6598.6655 -1412.2233]","745":"[-2170.4329 6597.7085 -1412.4176]","746":"[-2685.6438 6597.7505 -1412.3356]","747":"[-3207.4963 6598.6577 -1412.3867]","748":"[-3719.7195 6597.3384 -1412.4243]","749":"[-4237.7632 6598.1885 -1412.3945]","750":"[-4761.3813 6598.3325 -1412.3475]","751":"[-5288.5923 6592.4941 -1412.3024]","752":"[-5816.4673 6573.0454 -1412.3181]","753":"[-6342.2749 6532.8091 -1412.209]","754":"[-6865.2891 6470.978 -1412.3276]","755":"[-7384.3052 6385.9321 -1412.4448]","756":"[-7897.2275 6273.6533 -1411.9799]","757":"[-8402.0537 6133.7495 -1412.4531]","758":"[-8896.1719 5962.4194 -1412.3219]","759":"[-9376.5977 5758.1831 -1412.2886]","760":"[-9839.5244 5519.1299 -1412.4381]","761":"[-10280.7539 5244.1543 -1412.2771]","762":"[-10696.3096 4933.6816 -1412.3594]","763":"[-11082.4043 4588.9956 -1412.3904]","764":"[-11435.3604 4211.9146 -1412.2992]","765":"[-11753.4883 3806.2629 -1412.2953]","766":"[-12035.5752 3375.9565 -1412.415]","767":"[-12281.4336 2924.9243 -1412.2775]","768":"[-12492.6738 2457.551 -1412.4673]","769":"[-12670.5889 1977.2894 -1412.3376]","770":"[-12822.0146 1472.0817 -1412.3776]","771":"[-12943.1797 959.4788 -1412.2856]","772":"[-13036.9561 441.7957 -1412.3069]","773":"[-13106.2998 -79.0975 -1412.3339]","774":"[-13152.7207 -601.9465 -1412.2336]","775":"[-13179.3848 -1125.6326 -1412.2484]","776":"[-13188.209 -1648.1021 -1412.5703]","777":"[-13189.3857 -2169.1101 -1412.4138]","778":"[-13188.6738 -2689.0845 -1412.5088]","779":"[-13189.0615 -3208.5906 -1412.3706]","780":"[-13187.8896 -3727.6335 -1412.3774]","781":"[-13177.0352 -4246.0322 -1412.2159]","782":"[-13148.749 -4763.1978 -1412.2747]","783":"[-13100.4238 -5277.8823 -1411.964]","784":"[-13031.0234 -5789.0454 -1412.3762]","785":"[-12937.1768 -6295.6885 -1412.4863]","786":"[-12817.5137 -6796.0913 -1412.3835]","787":"[-12669.0996 -7287.5947 -1412.5629]","788":"[-12491.1641 -7768.1045 -1412.3657]","789":"[-12273.0215 -8247.7725 -1412.3114]","790":"[-12019.4805 -8708.0332 -1412.2272]","791":"[-11729.8984 -9145.1211 -1412.5093]","792":"[-11403.377 -9553.9346 -1412.4609]","793":"[-11043.7305 -9932.335 -1412.4054]","794":"[-10651.4629 -10275.209 -1412.5154]","795":"[-10232.166 -10582.7549 -1412.4596]","796":"[-9788.8584 -10852.6309 -1412.5112]","797":"[-9326.5439 -11086.6855 -1412.4897]","798":"[-8848.9697 -11285.749 -1412.3584]","799":"[-8359.7207 -11451.9707 -1412.4313]","800":"[-7861.9878 -11588.1357 -1412.3387]","801":"[-7357.897 -11695.8555 -1412.3184]","802":"[-6849.8062 -11779.1523 -1412.3179]","803":"[-6328.439 -11839.4639 -1412.3285]","804":"[-5816.2622 -11878.4561 -1412.1847]","805":"[-5291.561 -11898.165 -1412.0715]","806":"[-4778.9819 -11903.6377 -1412.0625]","807":"[-4259.0625 -11903.8408 -1412.2662]","808":"[-3740.4175 -11904.0576 -1412.3918]","809":"[-3222.1372 -11903.875 -1412.3494]","810":"[-2704.1609 -11904.1201 -1412.4003]","811":"[-2186.5786 -11903.9736 -1412.3855]","812":"[-1669.3129 -11903.7871 -1412.4285]","813":"[-1152.4093 -11903.9922 -1412.2823]","814":"[-635.8467 -11904.1025 -1412.3652]","815":"[-120.4 -11903.626 -1409.1151]","816":"[397.1913 -11904.8887 -1388.5531]","817":"[917.5368 -11903.1895 -1345.3003]","818":"[1426.8815 -11904.6143 -1290.8337]","819":"[1943.0448 -11904.3418 -1230.7573]","820":"[2454.3064 -11903.0742 -1169.498]","821":"[2969.5674 -11903.791 -1106.756]","822":"[3482.3904 -11904.4365 -1043.8035]","823":"[3991.2385 -11904.4238 -981.3604]","824":"[4504.2192 -11904.3086 -918.5693]","825":"[5015.3086 -11903.4111 -856.6817]","826":"[5525.9326 -11903.5322 -796.4963]","827":"[6035.3193 -11902.832 -739.6905]","828":"[6546.9888 -11903.626 -690.4325]","829":"[7060.3252 -11903.6064 -661.2051]","830":"[7573.0034 -11903.8623 -650.2033]","831":"[8087.7231 -11904.5342 -650.4005]","832":"[8601.4785 -11903.3633 -650.352]","833":"[9118.5342 -11904.0508 -650.4188]","834":"[9636.1113 -11903.6113 -650.3824]","835":"[10151.2119 -11904.3398 -650.4595]","836":"[10671.3896 -11903.6191 -650.4047]","837":"[11189.4873 -11901.9043 -650.8768]","838":"[11702.1123 -11875.2217 -651.362]","839":"[12216.2236 -11798.543 -651.4437]","840":"[12711.3525 -11651.6006 -651.3546]","841":"[13144.5674 -11434.957 -651.493]","842":"[13442.7695 -11212.9873 -651.3887]","843":"[13732.5322 -10904.7793 -651.4053]","844":"[13938.4258 -10589.9189 -651.2872]","845":"[14141.748 -10114.2139 -651.4517]","846":"[14263.293 -9612.6611 -651.2958]","847":"[14319.9727 -9100.8525 -650.6448]","848":"[14335.8262 -8581.4873 -650.8107]","849":"[14335.0078 -8068.6084 -649.9698]","850":"[14336.2852 -7554.4038 -637.6611]","851":"[14335.8691 -7041.374 -606.4056]","852":"[14336.2998 -6523.6616 -565.5383]","853":"[14335.9297 -6010.8838 -534.9664]","854":"[14335.3135 -5494.5986 -523.3204]","855":"[14334.9414 -4976.623 -522.4777]","856":"[14335.5107 -4455.9224 -522.5034]","857":"[14335.8008 -3941.7178 -522.3826]","858":"[14335.7529 -3428.395 -522.4824]","859":"[14336.0928 -2908.4226 -522.0721]","860":"[14336.0127 -2394.5835 -522.3712]","861":"[14335.9688 -1879.2683 -522.5074]","862":"[14335.8359 -1356.0472 -522.278]","863":"[14335.6709 -841.915 -522.5237]","864":"[14336.1758 -326.8743 -522.3181]","865":"[14336.4346 186.8038 -522.507]","866":"[14335.9785 711.8893 -522.0993]","867":"[14335.9805 1233.257 -522.3788]","868":"[14335.958 1749.4707 -522.277]","869":"[14335.8926 2274.4836 -522.427]","870":"[14336.1689 2792.5374 -522.2849]","871":"[14335.4629 3318.178 -522.3449]","872":"[14336.2285 3835.3113 -522.3356]","873":"[14335.8018 4359.0742 -522.3516]","874":"[14335.6641 4873.0278 -522.4127]","875":"[14336.3467 5392.314 -522.3395]","876":"[14335.6182 5914.6328 -522.3823]","877":"[14336.2275 6437.3267 -522.3953]","878":"[14335.7676 6959.5195 -522.4233]","879":"[14335.0146 7481.1846 -522.2115]","880":"[14327.1953 8002.2188 -522.2909]","881":"[14301.2139 8522.0098 -522.3275]","882":"[14256.5615 9039.9199 -522.356]","883":"[14189.2461 9554.1348 -522.7792]","884":"[14099.4199 10063.8848 -522.3914]","885":"[13982.5938 10567.3398 -522.3784]","886":"[13837.7451 11062.6387 -522.2728]","887":"[13662.7227 11547.1152 -522.2994]","888":"[13454.5137 12017.3066 -522.5663]","889":"[13213.4014 12470.3447 -522.3871]","890":"[12936.5322 12901.2256 -522.1577]","891":"[12615.6426 13319.3379 -522.3768]","892":"[12258.7031 13705.5166 -522.2861]","893":"[11869.8018 14057.9072 -522.2833]","894":"[11451.6738 14373.2646 -522.3524]","895":"[11009.2051 14651.6621 -522.4109]","896":"[10546.3975 14892.8271 -522.3363]","897":"[10067.7041 15098.6074 -522.474]","898":"[9576.6787 15270.6475 -522.3793]","899":"[9076.4736 15411.46 -522.2704]","900":"[8569.7578 15523.8564 -522.3333]","901":"[8058.6035 15610.3506 -522.3254]","902":"[7544.5801 15673.3174 -522.3866]","903":"[7028.9746 15714.6719 -522.3563]","904":"[6512.7129 15737.0127 -522.2454]","905":"[5996.4888 15743.7412 -522.3916]","906":"[5480.6611 15743.8174 -522.4947]","907":"[4965.2646 15744.1367 -522.3945]","908":"[4450.3384 15743.8916 -522.4288]","909":"[3935.8335 15743.877 -522.362]","910":"[3421.7998 15744.126 -522.5148]","911":"[2908.1973 15743.7783 -522.2795]","912":"[2395.0437 15743.9355 -522.3677]","913":"[1882.323 15743.9512 -522.5068]","914":"[1370.0668 15743.7783 -522.4609]","915":"[842.7263 15744.2031 -522.3554]","916":"[315.8764 15743.4277 -522.4637]","917":"[-210.512 15744.3701 -522.373]","918":"[-736.3779 15743.8457 -522.3715]","919":"[-1261.7697 15743.7461 -522.3717]","920":"[-1786.6919 15744.3018 -522.4665]","921":"[-2311.1316 15743.4922 -522.3596]","922":"[-2835.1399 15744.5029 -522.3846]","923":"[-3358.6494 15743.7002 -522.353]","924":"[-3881.7156 15744.4102 -522.3239]","925":"[-4404.3262 15743.957 -522.3757]","926":"[-4926.4585 15743.6191 -522.242]","927":"[-5448.1685 15744.5947 -522.4105]","928":"[-5969.3931 15743.2822 -522.3088]","929":"[-6490.082 15737.8311 -522.2449]","930":"[-7009.7656 15715.7529 -522.2366]","931":"[-7527.4629 15674.5889 -522.4161]","932":"[-8042.2852 15612.8174 -522.3201]","933":"[-8552.9639 15526.8467 -522.2947]","934":"[-9058.2178 15416.3535 -522.2892]","935":"[-9555.4023 15276.6729 -522.3318]","936":"[-10042.7607 15108.2666 -522.4191]","937":"[-10516.3574 14906.7402 -522.4984]","938":"[-10973.2012 14671.832 -522.3428]","939":"[-11409.2139 14402.1543 -522.2436]","940":"[-11831.9971 14088.1631 -522.3355]","941":"[-12224.3896 13738.707 -522.4481]","942":"[-12582.958 13356.2148 -522.3016]","943":"[-12905.5078 12944.2656 -522.3644]","944":"[-13190.8936 12506.8945 -522.3174]","945":"[-13438.9268 12048.3066 -522.3683]","946":"[-13651.7363 11573.2207 -522.4839]","947":"[-13829.9111 11084.835 -522.3752]","948":"[-13976.6943 10586.793 -522.4251]","949":"[-14094.9238 10081.8066 -522.3234]","950":"[-14186.2656 9571.8682 -522.3012]","951":"[-14253.5771 9058.749 -522.2214]","952":"[-14299.6328 8543.7969 -522.3195]","953":"[-14325.7236 8027.979 -522.3177]","954":"[-14334.9316 7511.9707 -522.3887]","955":"[-14336.2627 6996.3237 -522.4136]","956":"[-14335.6152 6481.064 -522.4672]","957":"[-14336.3027 5966.2119 -522.4598]","958":"[-14335.8496 5451.7754 -522.3842]","959":"[-14335.9395 4937.7236 -522.4276]","960":"[-14336.2617 4424.1294 -522.3332]","961":"[-14335.6025 3910.9172 -522.4517]","962":"[-14336.2266 3398.1343 -522.4475]","963":"[-14335.7822 2885.7349 -522.4937]","964":"[-14335.8066 2359.1194 -522.3465]","965":"[-14336.0039 1832.8838 -522.3503]","966":"[-14335.7324 1307.1085 -522.4022]","967":"[-14336.2051 781.7194 -522.3374]","968":"[-14335.9844 256.8076 -522.4062]","969":"[-14335.8193 -267.6867 -522.4841]","970":"[-14336.0059 -788.2758 -522.4199]","971":"[-14336.0615 -1307.8706 -522.2161]","972":"[-14335.9434 -1831.1448 -522.2486]","973":"[-14335.9033 -2346.8193 -522.2307]","974":"[-14335.2041 -2869.0872 -522.2404]","975":"[-14335.3213 -3382.5193 -522.2265]","976":"[-14335.5234 -3895.634 -522.3121]","977":"[-14335.2246 -4408.4243 -522.2094]","978":"[-14335.5371 -4920.9028 -522.2883]","979":"[-14335.5479 -5433.0508 -522.3034]","980":"[-14335.5742 -5955.9717 -522.2176]","981":"[-14335.8184 -6478.5493 -522.288]","982":"[-14335.9092 -7000.7593 -522.3266]","983":"[-14336.4297 -7522.6016 -522.3768]","984":"[-14335.2959 -8044.0391 -522.2443]","985":"[-14336.4707 -8556.2549 -522.3795]","986":"[-14335.6826 -9075.0879 -522.4587]","987":"[-14335.9307 -9590.5576 -522.3856]","988":"[-14335.9678 -10104.5645 -522.3331]","989":"[-14335.7656 -10617.7041 -522.5083]","990":"[-14335.3994 -11129.8877 -522.3839]","991":"[-14319.207 -11647.5254 -522.366]","992":"[-14264.9258 -12159.248 -522.3066]","993":"[-14144.8535 -12663.6357 -522.4472]","994":"[-13944.8975 -13136.3281 -522.3102]","995":"[-13739.8711 -13452.8965 -522.4071]","996":"[-13446.4932 -13767.5811 -522.3657]","997":"[-13156.6416 -13985.457 -522.3492]","998":"[-12722.585 -14205.4238 -522.6055]","999":"[-12232.7559 -14353.6953 -522.285]","1000":"[-11722.3115 -14432.5283 -522.2742]","1001":"[-11208.1426 -14459.8232 -522.3367]","1002":"[-10691.9121 -14463.8193 -522.4291]","1003":"[-10175.3906 -14463.9111 -522.3412]","1004":"[-9656.9082 -14463.5146 -522.423]","1005":"[-9140.8477 -14463.4902 -522.4466]","1006":"[-8622.8438 -14463.832 -522.3961]","1007":"[-8105.2026 -14464.4736 -522.2991]","1008":"[-7586.8765 -14463.7764 -522.4786]","1009":"[-7068.6069 -14463.6133 -522.4166]","1010":"[-6551.7476 -14464.3311 -522.4207]","1011":"[-6039.3652 -14463.6826 -522.3309]","1012":"[-5524.3057 -14464.2109 -522.4734]","1013":"[-5009.8901 -14464.2383 -511.3916]","1014":"[-4495.605 -14464.0811 -481.1309]","1015":"[-3984.3606 -14464.4941 -431.3776]","1016":"[-3471.5645 -14463.9902 -373.9812]","1017":"[-2959.5676 -14464.1514 -313.5496]","1018":"[-2448.4285 -14463.9873 -252.1914]","1019":"[-1937.1306 -14463.6123 -191.0729]","1020":"[-1421.3768 -14463.9141 -131.516]","1021":"[-906.8381 -14463.9893 -76.6735]","1022":"[-394.937 -14463.7539 -34.4004]","1023":"[117.305 -14463.6709 -13.7178]","1024":"[639.2327 -14464.2529 -10.5009]","1025":"[1160.0571 -14463.543 -10.3969]","1026":"[1680.527 -14463.8555 -10.4526]","1027":"[2200.6243 -14463.8164 -10.4086]","1028":"[2720.3555 -14463.7295 -10.4127]","1029":"[3239.7224 -14463.9004 -10.4189]","1030":"[3758.7388 -14463.9482 -10.3903]","1031":"[4277.4014 -14463.4697 -10.4711]","1032":"[4795.6641 -14463.8877 -10.2472]","1033":"[5313.1079 -14463.9717 -10.4381]","1034":"[5830.1177 -14463.8398 -10.2078]","1035":"[6345.3511 -14464.5967 4.3161]","1036":"[6859.4751 -14464.4834 39.0027]","1037":"[7378.2686 -14464.2168 91.2978]","1038":"[7894.8179 -14464.249 149.9642]","1039":"[8405.5254 -14464.1074 210.5957]","1040":"[8917.4209 -14463.958 272.2094]","1041":"[9428.3652 -14463.5918 332.9053]","1042":"[9937.9707 -14463.7109 391.2664]","1043":"[10448.4053 -14464.0039 444.1446]","1044":"[10959.0107 -14463.9473 482.4366]","1045":"[11475.9463 -14449.9346 499.4275]","1046":"[11987.9668 -14400.5977 501.7019]","1047":"[12494.168 -14286.5391 501.7956]","1048":"[12970.2813 -14093.625 501.6592]","1049":"[13301.8301 -13885.9482 501.5927]","1050":"[13612.1758 -13605.7207 501.6507]","1051":"[13838.6455 -13314.6348 501.5851]","1052":"[14056.1172 -12903.2461 501.7101]","1053":"[14214.2969 -12412.1797 501.5355]","1054":"[14299.6074 -11905.2471 501.7028]","1055":"[14329.7119 -11393.2988 501.6339]","1056":"[14334.9189 -10874.0488 501.5074]","1057":"[14336.8389 -10356.1533 501.605]","1058":"[14336.0693 -9839.373 501.5977]","1059":"[14334.873 -9323.6582 501.6085]","1060":"[14334.9209 -8808.9785 501.5315]","1061":"[14335.7969 -8295.3516 501.5655]","1062":"[14335.4727 -7782.7466 501.5753]","1063":"[14335.8486 -7263.7212 501.7012]","1064":"[14335.3291 -6745.7324 501.573]","1065":"[14335.7842 -6228.7749 501.6172]","1066":"[14335.4893 -5712.8682 501.565]","1067":"[14329.75 -5198.4717 501.6376]","1068":"[14294.5313 -4681.561 501.972]","1069":"[14202.7598 -4177.4272 501.6473]","1070":"[14036.2959 -3690.2734 501.6795]","1071":"[13817.3828 -3294.3228 501.6349]","1072":"[13579.8105 -3000.8433 501.5295]","1073":"[13266.2891 -2728.8196 501.6093]","1074":"[12924.8799 -2524.2605 501.6145]","1075":"[12441.2178 -2339.0305 501.7611]","1076":"[11937.1309 -2232.5303 501.6868]","1077":"[11426.0088 -2187.553 501.5886]","1078":"[10907.8643 -2175.5967 501.6394]","1079":"[10391.1455 -2176.0286 501.5793]","1080":"[9875.9092 -2176.5198 501.6527]","1081":"[9362.1191 -2176.6938 501.5992]","1082":"[8849.7852 -2176.0959 501.5881]","1083":"[8332.3037 -2176.533 501.5579]","1084":"[7816.3604 -2176.2551 501.5806]","1085":"[7301.9429 -2175.7759 501.5992]","1086":"[6789.0742 -2176.9104 501.5793]","1087":"[6271.2354 -2176.4324 501.5723]","1088":"[5755.0146 -2176.0781 501.5582]","1089":"[5240.3838 -2176.491 501.5707]","1090":"[4727.3745 -2177.1365 501.5484]","1091":"[4209.564 -2175.8093 501.5772]","1092":"[3693.4463 -2176.0664 501.5791]","1093":"[3179.009 -2176.3826 501.6081]","1094":"[2666.2229 -2176.0945 501.585]","1095":"[2149.0835 -2176.7532 501.502]","1096":"[1634.0087 -2177.1628 501.6515]","1097":"[1120.7258 -2176.0164 501.6022]","1098":"[602.9089 -2176.2976 501.5815]","1099":"[86.9373 -2176.51 501.5282]","1100":"[-427.2294 -2175.9595 501.8027]","1101":"[-940.0366 -2173.5344 500.4988]","1102":"[-1451.4042 -2146.542 497.0563]","1103":"[-1957.2572 -2066.5715 492.1952]","1104":"[-2450.0347 -1906.8735 488.5822]","1105":"[-2778.7268 -1732.1737 486.6975]","1106":"[-3073.2048 -1501.7708 485.9782]","1107":"[-3291.6099 -1258.7651 486.3305]","1108":"[-3499.5278 -925.0197 487.7989]","1109":"[-3656.7551 -534.1373 490.3979]","1110":"[-3770.2002 -32.3398 494.821]","1111":"[-3817.4351 481.2138 499.1454]","1112":"[-3829.5305 995.7014 501.5331]","1113":"[-3829.6523 1509.3895 501.5521]","1114":"[-3829.4219 2024.7604 501.5835]","1115":"[-3829.8538 2541.5562 501.5502]","1116":"[-3829.7327 3054.9666 501.5728]","1117":"[-3829.52 3570.1306 501.5261]","1118":"[-3829.1396 4086.936 501.6308]","1119":"[-3829.1169 4602.1367 501.5349]","1120":"[-3828.8132 5115.98 501.6453]","1121":"[-3828.6868 5631.894 501.5716]","1122":"[-3828.7776 6146.2075 501.5404]","1123":"[-3829.1948 6661.8315 501.3484]","1124":"[-3829.6538 7173.8745 501.3417]","1125":"[-3829.5918 7691.082 501.1678]","1126":"[-3829.6875 8203.3164 501.1857]","1127":"[-3825.3892 8722.3154 501.045]","1128":"[-3794.3667 9237.6143 501.0537]","1129":"[-3710.2385 9748.6689 500.8312]","1130":"[-3558.1326 10241.9805 500.5438]","1131":"[-3324.7495 10698.0723 500.2072]","1132":"[-3108.928 10983.1748 500.1083]","1133":"[-2785.3601 11283.5703 500.1357]","1134":"[-2476.071 11483.1777 500.1799]","1135":"[-2002.9216 11686.5293 500.586]","1136":"[-1504.2771 11811.4609 500.9445]","1137":"[-994.5361 11874.0996 500.9456]","1138":"[-480.4507 11893.0898 500.934]","1139":"[32.1979 11893.4297 500.7241]","1140":"[550.5731 11895.3545 500.813]","1141":"[1065.3918 11894.2305 500.8522]","1142":"[1579.7405 11894.4961 500.9453]","1143":"[2101.2642 11894.7324 500.8171]","1144":"[2617.1855 11894.3428 500.9897]","1145":"[3130.0083 11894.5742 500.7534]","1146":"[3648.1538 11894.0117 501.0847]","1147":"[4166.0127 11894.5527 501.0511]","1148":"[4682.1763 11880.8076 500.9568]","1149":"[5194.6968 11838.2412 501.1843]","1150":"[5698.957 11749.1201 501.9924]","1151":"[6199.7437 11606.1865 500.7176]","1152":"[6674.5532 11398.4355 500.8849]","1153":"[7109.7271 11123.5596 500.9565]","1154":"[7490.1724 10780.5186 500.8648]","1155":"[7810.9976 10369.2617 500.729]","1156":"[8059.1338 9912.3809 500.9264]","1157":"[8237.6182 9425.0557 500.9024]","1158":"[8356.8877 8920.6826 500.9608]","1159":"[8425.1416 8407.4287 500.9582]","1160":"[8452.2705 7891.2417 500.8486]","1161":"[8439.2168 7376.3076 501.1949]","1162":"[8387.6699 6866.7261 500.9573]","1163":"[8288.4629 6355.165 500.9867]","1164":"[8132.4663 5861.1392 500.9729]","1165":"[7912.8838 5394.4985 501.3063]","1166":"[7624.7441 4970.9614 501.0301]","1167":"[7262.6616 4596.9531 500.8098]","1168":"[6843.0132 4292.6973 501.142]","1169":"[6381.0386 4060.9885 500.9748]","1170":"[5892.9727 3894.9314 500.9702]","1171":"[5389.7012 3787.6003 500.9731]","1172":"[4879.3486 3727.2783 500.8933]","1173":"[4365.3198 3705.9119 494.5912]","1174":"[3842.7371 3701.2649 468.2714]","1175":"[3326.3496 3702.5449 421.679]","1176":"[2810.5037 3702.0002 365.207]","1177":"[2295.2419 3702.072 304.9619]","1178":"[1782.9108 3701.4604 242.9788]","1179":"[1262.1589 3701.8796 179.3327]","1180":"[749.4659 3701.0317 116.3315]","1181":"[232.689 3701.8994 52.9964]","1182":"[-286.442 3701.4517 -10.3658]","1183":"[-806.243 3701.6978 -72.936]","1184":"[-1324.8746 3701.5007 -133.2786]","1185":"[-1840.3418 3701.7598 -189.021]","1186":"[-2367.4736 3701.6863 -235.021]","1187":"[-2883.5671 3701.2671 -256.8793]","1188":"[-3403.6472 3701.8667 -261.0556]","1189":"[-3923.7852 3701.5469 -261.1246]","1190":"[-4443.3315 3701.3286 -261.1708]","1191":"[-4959.666 3702.5781 -250.0451]","1192":"[-5486.249 3701.7148 -218.304]","1193":"[-6002.0225 3701.9465 -167.4863]","1194":"[-6520.5317 3702.3301 -109.0305]","1195":"[-7039.5459 3701.8069 -47.6184]","1196":"[-7557.228 3702.0049 14.5468]","1197":"[-8072.1377 3701.2793 75.5195]","1198":"[-8583.1709 3701.8179 134.6101]","1199":"[-9104.1396 3701.3372 189.3516]","1200":"[-9620.5195 3701.7327 230.1561]","1201":"[-10142.2432 3702.7822 248.7685]","1202":"[-10664.6074 3697.5308 250.813]","1203":"[-11181.3408 3668.7397 250.6166]","1204":"[-11698.1504 3598.9768 250.8094]","1205":"[-12201.9814 3479.3474 250.6263]","1206":"[-12685.0752 3299.4858 250.5359]","1207":"[-13135.9092 3055.0532 250.5633]","1208":"[-13545.5801 2734.5132 250.464]","1209":"[-13891.4238 2349.8599 250.5379]","1210":"[-14166.7012 1914.1865 250.58]","1211":"[-14371.6572 1442.818 250.5285]","1212":"[-14513.4434 949.8439 250.5785]","1213":"[-14603.8164 435.5397 250.6628]","1214":"[-14647.5283 -84.1804 250.7065]","1215":"[-14660.1338 -604.6801 250.6339]","1216":"[-14661.0508 -1124.6267 250.6778]","1217":"[-14661.1523 -1643.9825 250.6988]","1218":"[-14660.1309 -2162.9202 250.7189]","1219":"[-14661.3457 -2681.4199 250.6083]","1220":"[-14660.9014 -3199.4873 250.5698]","1221":"[-14660.6455 -3717.1479 250.5822]","1222":"[-14661.1104 -4234.4351 250.5656]","1223":"[-14661.3945 -4751.3125 250.5428]","1224":"[-14661.0615 -5267.8091 250.7437]","1225":"[-14660.8477 -5783.9521 250.5394]","1226":"[-14660.5176 -6299.6978 250.6644]","1227":"[-14661.3281 -6814.6475 250.6076]","1228":"[-14660.248 -7328.709 250.5034]","1229":"[-14654.7471 -7841.8188 250.4578]","1230":"[-14636.3047 -8353.9805 250.1984]","1231":"[-14597.0977 -8874.499 250.1758]","1232":"[-14537.666 -9392.4375 250.1132]","1233":"[-14454.6152 -9906.4883 250.1075]","1234":"[-14346.0928 -10415.0332 250.187]","1235":"[-14209.7266 -10916.0479 250.1581]","1236":"[-14043.0361 -11407.0449 250.0726]","1237":"[-13843.6045 -11884.7998 250.0183]","1238":"[-13610.4756 -12347.3896 250.0895]","1239":"[-13339.5449 -12791.5117 250.0533]","1240":"[-13037.207 -13205.415 250.1541]","1241":"[-12697.7744 -13594.8418 250.0385]","1242":"[-12327.1455 -13950.4248 250.1293]","1243":"[-11920.2949 -14277.1211 250.1088]","1244":"[-11487.4824 -14567.5117 250.1653]","1245":"[-11033.7021 -14820.4043 250.1061]","1246":"[-10566.8525 -15035.54 250.1109]","1247":"[-10085.2793 -15218.2598 250.2909]","1248":"[-9585.5762 -15371.0703 250.1645]","1249":"[-9086.9805 -15492.9658 250.24]","1250":"[-8581.8018 -15588.1602 250.2735]","1251":"[-8073.9365 -15659.7373 250.2379]","1252":"[-7551.9941 -15709.6436 250.2341]","1253":"[-7032.3301 -15739.8496 250.2956]","1254":"[-6518.0698 -15751.165 250.3343]","1255":"[-5996.0625 -15753.3467 251.4039]","1256":"[-5482.2388 -15752.5879 250.8906]","1257":"[-4960.603 -15753.0342 251]","1258":"[-4448.4136 -15753.2148 256.891]","1259":"[-3936.2271 -15752.5635 281.0031]","1260":"[-3412.8286 -15753.2969 328.5889]","1261":"[-2898.365 -15752.9346 384.8469]","1262":"[-2379.5222 -15753.043 445.7702]","1263":"[-1857.4386 -15752.7813 508.5948]","1264":"[-1346.9644 -15753.3311 570.9678]","1265":"[-833.8832 -15752.6611 633.7816]","1266":"[-318.5703 -15753.209 697.1481]","1267":"[198.7273 -15752.502 760.1219]","1268":"[717.8127 -15752.7021 822.9189]","1269":"[1227.0706 -15752.4688 882.4]","1270":"[1741.7949 -15752.6387 938.0862]","1271":"[2253.3901 -15752.7695 983.8088]","1272":"[2770.2368 -15752.2383 1006.8499]","1273":"[3285.7131 -15752.8857 1012.5284]","1274":"[3803.1775 -15752.4854 1012.5037]","1275":"[4320.9297 -15752.3496 1013.2337]","1276":"[4836.7339 -15752.5801 1012.6315]","1277":"[5349.4961 -15752.5059 1012.5508]","1278":"[5872.3486 -15746.3809 1012.4393]","1279":"[6389.4448 -15726.0107 1012.2513]","1280":"[6913.9688 -15684.7656 1012.165]","1281":"[7428.8916 -15623.2363 1012.285]","1282":"[7947.5195 -15536.8057 1012.3391]","1283":"[8452.4727 -15425.7666 1012.2479]","1284":"[8956.4248 -15285.0645 1012.4562]","1285":"[9440.8184 -15116.9854 1012.3141]","1286":"[9917.7168 -14914.4521 1012.1881]","1287":"[10382.6035 -14674.4063 1012.0843]","1288":"[10830.9727 -14395.4619 1012.2568]","1289":"[11243.9365 -14086.0381 1012.1369]","1290":"[11631.707 -13739.1855 1012.1107]","1291":"[11989.5713 -13355.9092 1012.2024]","1292":"[12314.1484 -12938.9063 1012.3676]","1293":"[12594.7764 -12506.8184 1012.2561]","1294":"[12840.8994 -12049.8994 1012.3796]","1295":"[13053.9014 -11572.5586 1012.1548]","1296":"[13233.1934 -11078.2129 1012.2977]","1297":"[13381.332 -10571.7969 1012.3817]","1298":"[13499.6709 -10057.8799 1012.3506]","1299":"[13590.5068 -9539.0889 1012.3292]","1300":"[13657.1748 -9017.3477 1012.2387]","1301":"[13701.0791 -8493.8799 1012.3372]","1302":"[13725.4443 -7969.77 1012.274]","1303":"[13732.7783 -7446.8247 1012.0003]","1304":"[13733.2666 -6925.3037 1012.3991]","1305":"[13732.335 -6405.5669 1012.5377]","1306":"[13732.7725 -5892.4302 1012.5893]","1307":"[13733.6006 -5377.3906 1012.54]","1308":"[13732.4512 -4857.6479 1012.6023]","1309":"[13733.0498 -4337.0913 1012.5542]","1310":"[13733.0342 -3821.1426 1012.7678]","1311":"[13733.124 -3301.6934 1012.692]","1312":"[13732.9434 -2787.5381 1012.6953]","1313":"[13732.8789 -2266.9641 1012.6581]","1314":"[13732.6016 -1746.6324 1012.5664]","1315":"[13733.0576 -1234.1687 1012.5721]","1316":"[13732.8047 -716.8124 1012.6761]","1317":"[13732.7686 -198.4596 1012.5635]","1318":"[13733.3291 318.9022 1012.61]","1319":"[13733.2471 835.2667 1012.5659]","1320":"[13732.5215 1350.5867 1012.6074]","1321":"[13732.5498 1864.8611 1012.5302]","1322":"[13733.0107 2378.1196 1012.5981]","1323":"[13733.3105 2890.3806 1012.59]","1324":"[13733.1484 3409.0735 1012.6484]","1325":"[13732.3379 3926.9246 1011.5032]","1326":"[13732.3262 4443.7837 1010.4139]","1327":"[13733.1865 4959.8628 1010.4117]","1328":"[13733.1904 5474.8882 1010.4697]","1329":"[13732.7568 5988.875 1010.519]","1330":"[13732.7764 6501.7822 1010.6706]","1331":"[13733 7020.7046 1010.562]","1332":"[13732.3271 7538.5449 1010.6269]","1333":"[13732.4941 8055.3232 1010.5616]","1334":"[13732.1348 8571.0254 1010.5596]","1335":"[13732.5098 9085.625 1010.5571]","1336":"[13732.709 9599.0918 1010.7277]","1337":"[13732.9502 10117.8594 1010.7484]","1338":"[13733.1133 10635.0029 1010.6431]","1339":"[13724.9561 11150.2793 1010.5887]","1340":"[13693.251 11661.8154 1010.6329]","1341":"[13619.5625 12173.7236 1010.5408]","1342":"[13495.4619 12672.4395 1010.4966]","1343":"[13310.8711 13154.6865 1010.5136]","1344":"[13056.8516 13606.6641 1010.4901]","1345":"[12735.4043 14006.5107 1010.4443]","1346":"[12348.5264 14345.8838 1010.3106]","1347":"[11908.1074 14616.3877 1010.4719]","1348":"[11435.6221 14815.9707 1010.5541]","1349":"[10938.415 14954.4453 1010.6465]","1350":"[10432.5586 15039.3467 1010.6714]","1351":"[9917.1553 15080.5615 1010.6107]","1352":"[9402.1016 15093.4404 1010.4736]","1353":"[8888.6895 15093.3643 1010.3711]","1354":"[8397.6777 15093.5635 1010.5296]"},"2":{"1":"[3032.1099 6751.3213 -1413.3153]","2":"[3535.3462 6853.4077 -1413.5331]","3":"[4043.4517 6923.0435 -1413.4432]","4":"[4556.9155 6957.0117 -1413.2078]","5":"[5070.4951 6967.5073 -1412.9406]","6":"[5589.0791 6969.4932 -1412.3175]","7":"[6105.6836 6969.7373 -1412.4252]","8":"[6623.0781 6969.7529 -1412.423]","9":"[7139.002 6982.7646 -1412.5496]","10":"[7650.5137 7029.6382 -1412.3007]","11":"[8157.8701 7138.4395 -1412.7233]","12":"[8638.127 7320.5918 -1413.0255]","13":"[9023.6436 7550.5732 -1413.2523]","14":"[9315.3613 7803.0273 -1413.3857]","15":"[9576.3457 8124.6885 -1413.3668]","16":"[9787.1631 8504.3418 -1412.9797]","17":"[9958.5439 8993.6826 -1412.6079]","18":"[10056.4189 9499.3086 -1412.5255]","19":"[10089.959 10017.291 -1412.1543]","20":"[10064.5791 10532.5742 -1412.4535]","21":"[9972.3584 11036.3906 -1412.7439]","22":"[9809.9482 11524.6367 -1413.0929]","23":"[9575.5732 11957.4053 -1413.2406]","24":"[9343.3945 12249.6328 -1413.4404]","25":"[9029.1484 12527.8779 -1413.3326]","26":"[8687.6768 12737.2324 -1413.0262]","27":"[8206.292 12929.1055 -1412.8929]","28":"[7705.3965 13043.623 -1412.5691]","29":"[7190.7881 13097.7012 -1412.3236]","30":"[6675.3506 13114.4443 -1412.2723]","31":"[6161.6177 13113.7432 -1412.3053]","32":"[5649.248 13112.6074 -1412.3148]","33":"[5132.0967 13112.4385 -1412.4348]","34":"[4616.4175 13112.7227 -1412.4329]","35":"[4102.0313 13112.9063 -1412.3512]","36":"[3589.1738 13112.9648 -1412.22]","37":"[3075.6064 13113.1387 -1412.5245]","38":"[2561.146 13113.4619 -1412.376]","39":"[2048.4683 13113.5645 -1412.4058]","40":"[1819.4072 13113.2969 -1412.3523]"},"3":{"1":"[-85.0783 6465.5283 -1412.3893]","2":"[-182.965 6441.3594 -1412.3925]","3":"[-671.8106 6287.0254 -1412.4019]","4":"[-1147.3582 6096.541 -1412.4371]","5":"[-1624.019 5907.9893 -1412.3979]","6":"[-2113.5056 5751.0381 -1412.5195]","7":"[-2243.3643 5718.4219 -1412.4749]"},"4":{"1":"[-5622.1836 -6570.5107 2183.7131]","2":"[-5723.3027 -6570.8179 2183.8843]","3":"[-6236.5376 -6557.9272 2183.5591]","4":"[-6747.8652 -6513.3335 2183.4204]","5":"[-7250.2441 -6409.5405 2182.9175]","6":"[-7732.4155 -6233.7598 2182.5427]","7":"[-8112.1846 -6014.1147 2182.4031]","8":"[-8439.2422 -5739.1523 2182.2817]","9":"[-8657.6113 -5478.3198 2182.29]","10":"[-8915.7725 -5035.3032 2182.491]","11":"[-9044.8359 -4685.0332 2182.8003]","12":"[-9163.0898 -4184.2231 2183.229]","13":"[-9219.3848 -3674.1021 2183.5273]","14":"[-9236.6172 -3160.1611 2183.5066]","15":"[-9236.7021 -2646.0737 2183.5837]","16":"[-9236.9297 -2133.7739 2183.5649]","17":"[-9237.291 -1621.5714 2183.6021]","18":"[-9236.6279 -1103.3083 2183.6887]","19":"[-9236.3809 -586.3654 2183.5381]","20":"[-9236.8379 -70.9441 2183.5857]","21":"[-9236.8311 442.9189 2183.5876]","22":"[-9237.5313 955.192 2183.6267]","23":"[-9237.5117 1470.6456 2184.0171]","24":"[-9237.6211 1988.3188 2184.2947]","25":"[-9237.4619 2502.6794 2183.5977]","26":"[-9237.251 3020.6443 2183.0647]","27":"[-9236.502 3536.1165 2183.1462]","28":"[-9228.1553 4049.0671 2182.8933]","29":"[-9205.2988 4565.6245 2181.9063]","30":"[-9162.6768 5079.6274 2181.0439]","31":"[-9099.3516 5589.8301 2179.9111]","32":"[-9012.0605 6095.2368 2179.0632]","33":"[-8898.5557 6599.894 2178.1921]","34":"[-8756.5234 7095.9937 2177.4148]","35":"[-8583.916 7580.2578 2176.6907]","36":"[-8378.8281 8049.7544 2176.0857]","37":"[-8137.4897 8505.5273 2175.696]","38":"[-7861.1494 8937.6387 2175.3616]","39":"[-7546.6768 9346.709 2175.2229]","40":"[-7199.1514 9723.2891 2175.0662]","41":"[-6817.9961 10068.6602 2175.1785]","42":"[-6405.9634 10379.4844 2175.4309]","43":"[-5967.7832 10654.8252 2175.8843]","44":"[-5512.6772 10891.5186 2176.2043]","45":"[-5039.8901 11093.6885 2176.866]","46":"[-4553.4175 11263.1836 2177.605]","47":"[-4056.5044 11402.3203 2178.2778]","48":"[-3552.1536 11512.7734 2179.2104]","49":"[-3042.7593 11597.4121 2179.9778]","50":"[-2529.9646 11658.9531 2180.8511]","51":"[-2015.1373 11698.4766 2181.8853]","52":"[-1500.1017 11719.7402 2183.0291]","53":"[-985.2346 11719.5742 2183.448]","54":"[-470.4996 11696.6357 2183.5466]","55":"[43.6386 11647.9785 2183.5212]","56":"[550.4302 11572.8359 2183.6726]","57":"[1052.8263 11469.0088 2183.6084]","58":"[1547.9784 11333.8633 2183.5674]","59":"[2035.4386 11172.7822 2183.6926]","60":"[2522.5188 11010.7588 2183.6052]","61":"[3016.2571 10871.4482 2183.7192]","62":"[3517.4363 10763.1719 2183.5747]","63":"[4023.6621 10684.5186 2183.6309]","64":"[4537.52 10632.8877 2183.6631]","65":"[5052.542 10607.543 2183.6379]","66":"[5567.4814 10599.4297 2183.5935]","67":"[6081.874 10598.7041 2183.6267]","68":"[6595.5952 10598.4854 2183.572]","69":"[7108.6025 10598.4834 2183.5681]","70":"[7620.71 10598.8018 2183.6077]","71":"[8135.8799 10597.71 2183.9919]","72":"[8648.8271 10582.9521 2187.6147]","73":"[9161.4609 10531.8291 2193.5017]","74":"[9665.2617 10424.2939 2198.8354]","75":"[10147.9678 10247.6807 2202.8494]","76":"[10593.1436 9994.2471 2205.4094]","77":"[10928.0996 9716.3984 2206.1265]","78":"[11238.0459 9351.2197 2205.4324]","79":"[11474.0898 8947.3115 2203.2981]","80":"[11658.4922 8468.4629 2199.2959]","81":"[11772.998 7968.3652 2194.0444]","82":"[11829.3574 7458.5215 2187.9988]","83":"[11846.582 6944.0908 2184.4666]","84":"[11848.4297 6430.1445 2183.4929]","85":"[11848.3672 5916.542 2183.6177]","86":"[11847.8809 5399.8955 2183.616]","87":"[11847.8047 4883.9209 2183.5789]","88":"[11847.7598 4367.9668 2183.5774]","89":"[11847.1914 3852.2195 2183.5493]","90":"[11847.2227 3336.8687 2183.5398]","91":"[11847.2236 2822.1174 2183.5574]","92":"[11847.7344 2308.1221 2183.5615]","93":"[11847.8828 1795.5859 2183.613]","94":"[11847.8223 1280.4515 2183.6108]","95":"[11848.6348 763.8422 2184.7883]","96":"[11848.3809 251.7247 2183.5439]","97":"[11848.5137 -260.5886 2183.6128]","98":"[11848.2949 -773.0652 2183.6101]","99":"[11848.1533 -1285.5183 2183.5762]","100":"[11848.3799 -1797.8962 2183.5593]","101":"[11848.2676 -2309.968 2183.5903]","102":"[11848.1758 -2824.8342 2183.5955]","103":"[11848.1777 -3338.6089 2183.5908]","104":"[11847.9814 -3851.1079 2183.4946]","105":"[11848.498 -4366.417 2183.46]","106":"[11847.958 -4879.6206 2183.3655]","107":"[11847.4102 -5394.1265 2183.4875]","108":"[11847.6787 -5909.3438 2184.0012]","109":"[11832.1494 -6422.9282 2187.4155]","110":"[11780.3467 -6933.771 2193.4224]","111":"[11670.543 -7437.1836 2198.6851]","112":"[11491.7275 -7920.0068 2202.6714]","113":"[11235 -8365.5791 2205.1982]","114":"[10951.7764 -8703.5908 2205.8848]","115":"[10605.2861 -8994.7158 2205.1096]","116":"[10161.2539 -9251.585 2202.6926]","117":"[9679.8887 -9429.6592 2198.8091]","118":"[9179.4736 -9538.9795 2193.4082]","119":"[8668.832 -9591.8779 2187.3342]","120":"[8156.8423 -9607.4395 2183.9829]","121":"[7643.3481 -9608.7393 2183.363]","122":"[7131.0723 -9608.7734 2183.3865]","123":"[6617.1401 -9608.1777 2183.3989]","124":"[6103.6855 -9609.2988 2183.3706]","125":"[5591.0444 -9608.7275 2183.3486]","126":"[5079.0059 -9609.4844 2183.3784]","127":"[4565.6221 -9609.0195 2183.3909]","128":"[4051.0591 -9609.2129 2183.3708]","129":"[3536.7214 -9608.6768 2183.3892]","130":"[3023.5017 -9609.7314 2183.363]","131":"[2510.438 -9609.0293 2182.2627]","132":"[1998.6528 -9609.5303 2166.5256]","133":"[1487.1345 -9608.8779 2130.324]","134":"[977.1974 -9609.2168 2078.4348]","135":"[461.6569 -9609.5596 2019.8533]","136":"[-54.4254 -9609.1963 1958.4547]","137":"[-567.7338 -9608.6104 1893.6305]","138":"[-1083.7848 -9609.9482 1826.3782]","139":"[-1597.8562 -9608.3545 1758.5125]","140":"[-2109.1279 -9609.7383 1691.313]","141":"[-2620.1865 -9608.3965 1623.9426]","142":"[-3137.2896 -9610.1582 1555.934]","143":"[-3656.0867 -9608.3379 1487.6254]","144":"[-4172.5142 -9609.8477 1419.6699]","145":"[-4682.6704 -9608.3965 1352.4744]","146":"[-5198.3745 -9609.8662 1284.6366]","147":"[-5717.8096 -9609.042 1216.2461]","148":"[-6239.2612 -9608.7578 1147.6107]","149":"[-6760.9863 -9609.6758 1078.7896]","150":"[-7281.3896 -9608.6582 1010.2283]","151":"[-7798.8984 -9609.2773 942.0769]","152":"[-8311.6963 -9609.4746 876.2144]","153":"[-8836.6631 -9609.293 810.6605]","154":"[-9354.3857 -9610.0166 749.4896]","155":"[-9882.9268 -9609.4482 690.0725]","156":"[-10401.4111 -9609.5225 639.9102]","157":"[-10914.9219 -9603.3115 611.764]","158":"[-11425.75 -9569.8604 601.4255]","159":"[-11933.2441 -9485.25 601.1806]","160":"[-12423.0215 -9333.6318 600.7265]","161":"[-12876.0576 -9100.6152 600.4836]","162":"[-13138.8164 -8901.0283 600.3032]","163":"[-13478.9316 -8533.1621 600.4291]","164":"[-13633.0605 -8293.3594 600.4625]","165":"[-13845.1465 -7825.1738 600.8605]","166":"[-13976.5811 -7329.1694 601.3646]","167":"[-14044.1016 -6821.5215 601.4464]","168":"[-14066.8496 -6309.5229 601.632]","169":"[-14068.7334 -5797.0952 601.6524]","170":"[-14069.0576 -5284.2993 601.5949]","171":"[-14068.3633 -4771.6909 601.5802]","172":"[-14068.8574 -4254.8945 601.452]","173":"[-14068.5117 -3742.3003 601.6402]","174":"[-14068.6299 -3222.6919 601.5264]","175":"[-14068.9609 -2703.9402 601.6282]","176":"[-14069.0039 -2186.0239 601.5381]","177":"[-14069.0781 -1668.9462 601.7004]","178":"[-14079.2012 -1153.0383 601.5154]","179":"[-14123.125 -641.5033 601.4742]","180":"[-14202.4697 -128.2441 601.7414]","181":"[-14299.9736 378.9602 601.6461]","182":"[-14366.5752 893.8428 601.7255]","183":"[-14392.8779 1408.5868 601.9664]","184":"[-14396.8848 1920.8099 602.4749]","185":"[-14396.9648 2435.1023 602.2721]","186":"[-14397.5098 2947.3303 602.1258]","187":"[-14397.2383 3465.4607 602.1396]","188":"[-14396.959 3982.437 602.0383]","189":"[-14396.5273 4498.3843 602.054]","190":"[-14396.5645 5013.2593 602.0964]","191":"[-14397.1484 5527.0737 602.0737]","192":"[-14396.8926 6039.832 602.0735]","193":"[-14396.4863 6558.7065 602.1123]","194":"[-14396.4082 7076.4312 602.0939]","195":"[-14397.1113 7593.0596 602.0641]","196":"[-14397.252 8108.6143 602.0392]","197":"[-14396.6309 8373.1377 602.1128]"},"5":{"1":"[-14625.8848 1865.5366 602.1097]","2":"[-14635.9268 1765.5909 601.9612]","3":"[-14660.167 1253.0879 601.7961]","4":"[-14660.8125 740.3508 601.7195]","5":"[-14660.5645 228.1014 601.7281]","6":"[-14660.6885 -287.7766 601.71]","7":"[-14660.6182 -800.0684 601.641]","8":"[-14661.1563 -1313.3335 601.5435]","9":"[-14661.3037 -1830.8643 601.554]","10":"[-14661.2627 -2347.0422 601.5886]","11":"[-14660.666 -2861.8318 601.5728]","12":"[-14660.6719 -3375.2678 601.5628]","13":"[-14660.4893 -3887.3645 601.6083]","14":"[-14660.5771 -4404.8799 601.5836]","15":"[-14661.0957 -4920.959 601.5769]","16":"[-14661.5342 -5435.5791 601.5778]","17":"[-14660.7998 -5948.7563 601.579]","18":"[-14660.6768 -6466.96 601.751]","19":"[-14642.9316 -6980.7925 601.5986]","20":"[-14586.4697 -7493.5566 601.3467]","21":"[-14468.2793 -7997.2144 601.0026]","22":"[-14273.29 -8474.6084 600.6961]","23":"[-14057.1094 -8817.5859 600.442]","24":"[-13773.208 -9129.6523 600.3568]","25":"[-13464.4551 -9367.7627 600.5098]","26":"[-13050.9688 -9583.7715 600.9323]","27":"[-12558.3359 -9742.4463 601.2108]","28":"[-12049.6563 -9831.2197 601.4603]","29":"[-11536.1084 -9865.7607 601.6046]","30":"[-11022.9189 -9874.9277 607.5931]","31":"[-10504.4102 -9872.8525 632.8416]","32":"[-9993.5723 -9873.3047 678.6151]","33":"[-9475.5635 -9873.6182 735.4446]","34":"[-8957.8779 -9873.0967 796.0153]","35":"[-8445.9453 -9872.8418 858.9866]","36":"[-7930.416 -9873.1436 924.8109]","37":"[-7413.667 -9872.5947 992.8159]","38":"[-6902.4946 -9873.1748 1060.23]","39":"[-6389.9497 -9872.1191 1127.5869]","40":"[-5880.1753 -9873.2646 1194.7665]","41":"[-5366.1279 -9872.4434 1262.4351]","42":"[-4854.73 -9872.8916 1329.7689]","43":"[-4343.8672 -9873.043 1397.1196]","44":"[-3835.709 -9872.6426 1463.8972]","45":"[-3322.6794 -9873.3867 1531.4825]","46":"[-2813.5928 -9873.2441 1598.4814]","47":"[-2303.1672 -9872.6982 1665.6969]","48":"[-1792.5513 -9872.6465 1732.8837]","49":"[-1282.3636 -9872.6455 1800.16]","50":"[-774.3333 -9872.2041 1866.9567]","51":"[-263.5478 -9872.5059 1932.0626]","52":"[246.334 -9872.7129 1994.5103]","53":"[756.8356 -9872.6689 2053.8496]","54":"[1271.5979 -9873.1006 2109.6726]","55":"[1784.7029 -9873.2158 2154.4902]","56":"[2296.2859 -9872.9238 2177.9285]","57":"[2808.9216 -9872.7803 2183.2993]","58":"[3321.5542 -9873.1182 2183.353]","59":"[3838.031 -9873.5107 2183.3259]","60":"[4352.314 -9872.6855 2183.314]","61":"[4864.4268 -9872.3701 2183.3843]","62":"[5380.2246 -9872.4336 2183.3564]","63":"[5893.6943 -9872.8613 2183.3469]","64":"[6410.5381 -9872.624 2183.4365]","65":"[6924.2412 -9872.9746 2183.271]","66":"[7440.8101 -9872.5928 2183.366]","67":"[7954.8901 -9872.6328 2183.3784]","68":"[8467.6826 -9866.3164 2187.7969]","69":"[8978.7441 -9833.6016 2195.7505]","70":"[9488.1416 -9752.1377 2205.354]","71":"[9984.0723 -9611.7236 2212.9507]","72":"[10454.0801 -9402.4043 2218.4038]","73":"[10883.4141 -9120.9395 2221.3767]","74":"[11261.4082 -8764.6846 2221.8943]","75":"[11555.2764 -8369.2188 2219.9358]","76":"[11791.4883 -7905.1523 2215.0388]","77":"[11953.6211 -7417.4019 2208.3618]","78":"[12053.7236 -6908.3418 2199.4089]","79":"[12100.2881 -6394.4282 2189.5806]","80":"[12113.0879 -5874.6187 2184.1038]","81":"[12110.8994 -5362.6128 2183.5198]","82":"[12112.8545 -4841.6851 2183.4558]","83":"[12111.748 -4321.3311 2183.6318]","84":"[12111.6025 -3801.4866 2183.6311]","85":"[12112.2617 -3283.0676 2183.5608]","86":"[12111.833 -2765.1682 2183.6858]","87":"[12111.9277 -2247.717 2183.6536]","88":"[12111.9307 -1730.7247 2183.634]","89":"[12112.0313 -1214.2097 2183.5984]","90":"[12111.6123 -698.1717 2183.623]","91":"[12112.04 -183.3381 2183.7104]","92":"[12111.9766 330.6751 2183.6694]","93":"[12112.4609 844.2044 2183.5935]","94":"[12111.6025 1357.2639 2183.5994]","95":"[12112.0254 1869.847 2183.6406]","96":"[12112.2139 2381.9409 2183.5776]","97":"[12112.0088 2902.8425 2183.5967]","98":"[12111.9424 3423.2954 2183.6025]","99":"[12112.083 3937.0869 2183.6082]","100":"[12111.7686 4451.6694 2183.623]","101":"[12112.2334 4964.4351 2183.5908]","102":"[12111.6299 5476.4932 2183.5913]","103":"[12111.624 5991.8677 2183.5842]","104":"[12111.9541 6505.3809 2183.5977]","105":"[12111.2559 7017.3901 2185.8113]","106":"[12090.7051 7530.4834 2191.821]","107":"[12030.3662 8040.2275 2202.0732]","108":"[11914.5723 8541.498 2210.4153]","109":"[11733.1768 9023.3164 2216.6797]","110":"[11480.292 9471.5635 2220.8577]","111":"[11158.708 9862.7148 2222.0847]","112":"[10769.3574 10196.2041 2220.8665]","113":"[10325.1924 10458.4463 2217.2261]","114":"[9847.5205 10647.1826 2211.2478]","115":"[9349.2725 10770.3975 2203.1511]","116":"[8838.2695 10836.6309 2193.2402]","117":"[8325.876 10859.9561 2186.5708]","118":"[7811.3594 10862.8066 2183.5347]","119":"[7297.3281 10863.0342 2183.5608]","120":"[6780.8882 10863.4453 2183.5364]","121":"[6264.4634 10862.8418 2183.6648]","122":"[5749.2129 10862.2988 2183.522]","123":"[5235.0576 10866.0469 2183.6997]","124":"[4722.6826 10884.2295 2183.5422]","125":"[4205.8013 10926.6768 2183.604]","126":"[3693.7527 10995.8916 2183.5542]","127":"[3187.8765 11093.749 2183.7153]","128":"[2691.3267 11222.3369 2183.6157]","129":"[2198.7527 11381.6709 2183.6455]","130":"[1710.2566 11546.4688 2183.6611]","131":"[1218.6759 11691.9346 2183.8391]","132":"[714.8912 11806.8672 2183.5667]","133":"[207.0916 11890.9873 2183.7271]","134":"[-303.0045 11947.1123 2183.4851]","135":"[-818.7102 11978.6338 2183.6179]","136":"[-1332.1735 11986.3115 2184.1082]","137":"[-1853.3492 11972.5303 2184.7625]","138":"[-2371.7317 11938.627 2185.7795]","139":"[-2887.1387 11885.2813 2186.5952]","140":"[-3398.0029 11809.6328 2187.3813]","141":"[-3903.3323 11709.9736 2188.1147]","142":"[-4401.5381 11584.3936 2188.8127]","143":"[-4889.9775 11430.627 2189.571]","144":"[-5375.4453 11243.2119 2190.0232]","145":"[-5845.1084 11022.6035 2190.3774]","146":"[-6295.5815 10768.1338 2190.8357]","147":"[-6722.1553 10479.7803 2191.0659]","148":"[-7121.478 10158.2637 2191.3228]","149":"[-7497.1841 9797.5176 2191.3433]","150":"[-7839.5352 9406.8896 2191.1775]","151":"[-8146.6846 8989.541 2190.9968]","152":"[-8417.5264 8549.0771 2190.7202]","153":"[-8652.6279 8089.5034 2190.1592]","154":"[-8854.1982 7615.0479 2189.5649]","155":"[-9023.7119 7128.7451 2189.2612]","156":"[-9162.9873 6633.2944 2188.4802]","157":"[-9274.915 6131.1382 2187.8987]","158":"[-9361.582 5624.1201 2187.1069]","159":"[-9424.998 5113.7422 2186.2278]","160":"[-9467.7432 4601.1729 2185.2764]","161":"[-9491.3584 4087.3271 2184.408]","162":"[-9487.9824 3574.0071 2183.5764]","163":"[-9450.7285 3135.2935 2183.3557]"},"6":{"1":"[-14661.2529 1289.0551 601.3632]","2":"[-14661.3242 1390.6449 601.4358]","3":"[-14660.6533 1902.9561 601.982]","4":"[-14660.4951 2418.0994 602.0345]","5":"[-14660.7178 2930.928 602.0794]","6":"[-14660.7803 3443.1968 602.1069]","7":"[-14660.7139 3962.2549 601.7297]","8":"[-14660.3799 4475.8369 602.0261]","9":"[-14661.4189 4989.2061 601.7789]","10":"[-14660.3721 5501.8174 601.8192]","11":"[-14661.126 6016.9404 601.8113]","12":"[-14661.1318 6531.5688 601.7836]","13":"[-14660.4521 7046.8975 601.7117]","14":"[-14660.2842 7560.9629 601.8936]","15":"[-14660.8613 8073.6313 601.892]","16":"[-14660.2383 8585.7725 601.8958]","17":"[-14660.0459 8888.7656 601.6724]"},"7":{"1":"[-14397.0029 8369.708 602.3682]","2":"[-14396.7764 8470.1875 602.0106]","3":"[-14396.1611 8883.6572 601.7681]"},"8":{"1":"[-3828.9419 6520.7744 501.4102]","2":"[-3829.5112 6622.6582 501.5031]","3":"[-3836.3372 7139.6172 501.9857]","4":"[-3909.6292 7647.9932 501.5268]","5":"[-4038.0544 8146.0938 501.6841]","6":"[-4104.582 8655.3359 501.3004]","7":"[-4102.0825 9069.0986 500.8465]"}, "9":{"1":"[-4092.3381 6740.5806 501.7426]","2":"[-4092.2859 6842.4619 501.4358]","3":"[-4064.3494 7357.6377 501.3824]","4":"[-3959.241 7863.0039 501.6151]","5":"[-3844.3557 8362.9775 501.3433]"}}
require("Foundation") require("Crypto") -- MD5 function Crypto_Sample_md5() local result = Encoding:hexEncode(Crypto:md5("Hello LuaScriptCore!")); print(result); end -- SHA1 function Crypto_Sample_sha1() local result = Encoding:hexEncode(Crypto:sha1("Hello LuaScriptCore!")); print(result); end -- HMAc-MD5 function Crypto_Sample_hmacMD5() local result = Encoding:hexEncode(Crypto:hmacMD5("Hello LuaScriptCore!", "vim")); print(result); end -- HMAc-SHA1 function Crypto_Sample_hmacSHA1() local result = Encoding:hexEncode(Crypto:hmacSHA1("Hello LuaScriptCore!", "vim")); print(result); end
solution "Protocol" includedirs { "src", "external", "tools", "." } platforms { "x64" } configurations { "Release", "Debug" } flags { "Symbols", "ExtraWarnings", "EnableSSE2" } rtti "Off" configuration "Release" flags { "OptimizeSpeed" } defines { "NDEBUG" } project "Core" language "C++" kind "StaticLib" files { "src/Core/*.h", "src/Core/*.cpp" } targetdir "lib" project "Network" language "C++" kind "StaticLib" files { "src/network/*.h", "src/network/*.cpp" } links { "Core" } targetdir "lib" project "Protocol" language "C++" kind "StaticLib" files { "src/protocol/*.h", "src/protocol/*.cpp" } links { "Core", "Network" } targetdir "lib" project "ClientServer" language "C++" kind "StaticLib" files { "src/ClientServer/*.h", "src/ClientServer/*.cpp" } links { "Core", "Network", "Protocol" } targetdir "lib" project "VirtualGo" language "C++" kind "StaticLib" files { "src/VirtualGo/*.h", "src/VirtualGo/*.cpp" } links { "Core" } targetdir "lib" project "Cubes" language "C++" kind "StaticLib" files { "src/Cubes/*.h", "src/Cubes/*.cpp" } links { "Core" } targetdir "lib" --[[ project "nvImage" language "C++" kind "StaticLib" files { "external/nvImage/*.h", "external/nvImage/*.cpp" } targetdir "lib" --]] project "tinycthread" language "C" kind "StaticLib" files { "external/tinycthread/*.h", "external/tinycthread/*.c" } targetdir "lib" project "TestCore" language "C++" kind "ConsoleApp" files { "tests/Core/*.cpp" } links { "Core" } targetdir "bin" project "TestNetwork" language "C++" kind "ConsoleApp" files { "tests/Network/Test*.cpp" } links { "Core", "Network", "Protocol", "ClientServer" } targetdir "bin" project "TestProtocol" language "C++" kind "ConsoleApp" files { "tests/Protocol/Test*.cpp" } links { "Core", "Network", "Protocol", "ClientServer" } targetdir "bin" project "TestClientServer" language "C++" kind "ConsoleApp" files { "tests/ClientServer/Test*.cpp" } links { "Core", "Network", "Protocol", "ClientServer" } targetdir "bin" project "TestCubes" language "C++" kind "ConsoleApp" files { "tests/Cubes/*.cpp" } links { "Core", "Cubes", "ode" } configuration "Debug" links { "ode-debug" } configuration "Release" links { "ode" } targetdir "bin" project "TestVirtualGo" language "C++" kind "ConsoleApp" files { "tests/VirtualGo/*.cpp" } links { "Core", "VirtualGo" } configuration "Debug" links { "ode-debug" } configuration "Release" links { "ode" } targetdir "bin" project "SoakProtocol" language "C++" kind "ConsoleApp" files { "tests/Protocol/SoakProtocol.cpp" } links { "Core", "Network", "Protocol", "ClientServer" } targetdir "bin" project "SoakClientServer" language "C++" kind "ConsoleApp" files { "tests/ClientServer/SoakClientServer.cpp" } links { "Core", "Network", "Protocol", "ClientServer" } targetdir "bin" project "ProfileProtocol" language "C++" kind "ConsoleApp" files { "tests/Protocol/ProfileProtocol.cpp" } links { "Core", "Network", "Protocol", "ClientServer" } targetdir "bin" project "ProfileClientServer" language "C++" kind "ConsoleApp" files { "tests/ClientServer/ProfileClientServer.cpp" } links { "Core", "Network", "Protocol", "ClientServer" } targetdir "bin" --[[project "FontTool" language "C++" kind "ConsoleApp" files { "tools/Font/*.cpp" } links { "Core", "Freetype", "Jansson" } targetdir "bin" --]] --[[ project "StoneTool" language "C++" kind "ConsoleApp" files { "tools/Stone/*.cpp" } links { "Core", "VirtualGo", "Jansson" } targetdir "bin" --]] --[[ project "Client" language "C++" kind "ConsoleApp" files { "src/game/*.cpp" } links { "Core", "Network", "Protocol", "ClientServer", "VirtualGo", "Cubes", "nvImage", "tinycthread", "ode", "glew", "glfw3", "GLUT.framework", "OpenGL.framework", "Cocoa.framework", "CoreVideo.framework", "IOKit.framework" } targetdir "bin" defines { "CLIENT" } --]] project "Server" language "C++" kind "ConsoleApp" files { "src/game/*.cpp" } links { "Core", "Network", "Protocol", "ClientServer", "Cubes" } configuration "Debug" links { "ode-debug" } configuration "Release" links { "ode" } targetdir "bin" if _ACTION == "clean" then os.rmdir "bin" os.rmdir "lib" os.rmdir "obj" if not os.is "windows" then os.execute "rm -rf bin" os.execute "rm -rf obj" os.execute "rm -f Makefile" os.execute "rm -f *.zip" os.execute "rm -f *.make" os.execute "rm -f replay.bin" os.execute "rm -rf output" os.execute "find . -name .DS_Store -delete" os.execute "cd external/ode; make clean > /dev/null 2>&1" else os.rmdir "ipch" os.rmdir "bin" os.rmdir ".vs" os.rmdir "Debug" os.rmdir "Release" os.execute "del /F /Q Makefile" os.execute "del /F /Q *.make" os.execute "del /F /Q *.zip" os.execute "del /F /Q *.db" os.execute "del /F /Q *.opendb" os.execute "del /F /Q *.vcproj" os.execute "del /F /Q *.vcxproj" os.execute "del /F /Q *.vcxproj.user" os.execute "del /F /Q *.sln" end end if not os.is "windows" then newaction { trigger = "loc", description = "Count lines of code", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () os.execute "find . -name *.h -o -name *.cpp | xargs wc -l" end } newaction { trigger = "zip", description = "Zip up archive of this project", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () _ACTION = "clean" premake.action.call( "clean" ) os.execute "zip -9r Protocol.zip *" end } newaction { trigger = "core", description = "Build core library", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () os.execute "make -j4 Core" end } newaction { trigger = "network", description = "Build network library", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () os.execute "make -j4 Network" end } newaction { trigger = "protocol", description = "Build protocol library", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () os.execute "make -j4 Protocol" end } newaction { trigger = "client_server", description = "Build client/server library", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () os.execute "make -j4 ClientServer" end } newaction { trigger = "virtualgo", description = "Build virtualgo library", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () os.execute "make -j4 VirtualGo" end } newaction { trigger = "test", description = "Build and run all unit tests", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 TestCore; make -j4 TestNetwork; make -j4 TestProtocol; make -j4 TestClientServer; make -j4 TestCubes; make -j4 TestVirtualGo" == 0 then os.execute "./bin/TestCore; ./bin/TestNetwork; ./bin/TestProtocol; ./bin/TestClientServer; ./bin/TestCubes; ./bin/TestVirtualGo" end end } newaction { trigger = "test_core", description = "Build and run core unit tests", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 TestCore" == 0 then os.execute "./bin/TestCore" end end } newaction { trigger = "test_network", description = "Build and run network unit tests", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 TestNetwork" == 0 then os.execute "./bin/TestNetwork" end end } newaction { trigger = "test_protocol", description = "Build and run protocol unit tests", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 TestProtocol" == 0 then os.execute "./bin/TestProtocol" end end } newaction { trigger = "test_client_server", description = "Build and run client/server unit tests", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 TestClientServer" == 0 then os.execute "./bin/TestClientServer" end end } newaction { trigger = "test_cubes", description = "Build and run cubes unit tests", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 TestCubes" == 0 then os.execute "./bin/TestCubes" end end } newaction { trigger = "test_virtualgo", description = "Build and run virtualgo unit tests", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 TestVirtualGo" == 0 then os.execute "./bin/TestVirtualGo" end end } --[[ newaction { trigger = "fonts", description = "Build fonts", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 FontTool" == 0 then if os.execute "bin/FontTool assets/fonts/Fonts.json" ~= 0 then os.exit(1) end end end } --]] newaction { trigger = "stones", description = "Build stones", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 StoneTool" == 0 then if os.execute "rm -rf data/stones; mkdir -p data/stones; bin/StoneTool" ~= 0 then os.exit(1) end end end } newaction { trigger = "client", description = "Build and run game client", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 Client" ~= 0 then os.exit(1) end os.execute "bin/Client" end } newaction { trigger = "server", description = "Build and run game server", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 Server" ~= 0 then os.exit(1) end os.execute "bin/Server" end } newaction { trigger = "stone", description = "Build and run stone demo", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 Client" ~= 0 then os.exit(1) end os.execute "bin/Client +load stone" end } newaction { trigger = "cubes", description = "Build and run cubes demo", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "rm -rf output; mkdir -p output" ~= 0 then os.exit(1) end if os.execute "make -j4 Client" ~= 0 then os.exit(1) end os.execute "bin/Client +load cubes" end } newaction { trigger = "lockstep", description = "Build and run lockstep demo", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "rm -rf output; mkdir -p output" ~= 0 then os.exit(1) end if os.execute "make -j4 Client" ~= 0 then os.exit(1) end os.execute "bin/Client +load lockstep" end } newaction { trigger = "snapshot", description = "Build and run snapshot demo", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "rm -rf output; mkdir -p output" ~= 0 then os.exit(1) end if os.execute "make -j4 Client" ~= 0 then os.exit(1) end os.execute "bin/Client +load snapshot" end } newaction { trigger = "compression", description = "Build and run compression demo", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "rm -rf output; mkdir -p output" ~= 0 then os.exit(1) end if os.execute "make -j4 Client" ~= 0 then os.exit(1) end os.execute "bin/Client +load compression" end } newaction { trigger = "delta", description = "Build and run delta demo", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "rm -rf output; mkdir -p output" ~= 0 then os.exit(1) end if os.execute "make -j4 Client" ~= 0 then os.exit(1) end os.execute "bin/Client +load delta" end } newaction { trigger = "sync", description = "Build and run state sync demo", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "rm -rf output; mkdir -p output" ~= 0 then os.exit(1) end if os.execute "make -j4 Client" ~= 0 then os.exit(1) end os.execute "bin/Client +load sync" end } newaction { trigger = "playback", description = "Playback replay recording", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "rm -rf output; mkdir -p output" ~= 0 then os.exit(1) end if os.execute "make -j4 Client" ~= 0 then os.exit(1) end os.execute "bin/Client +playback" end } newaction { trigger = "server", description = "Build and run game server", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 Server" == 0 then os.execute "bin/Server" end end } newaction { trigger = "soak_protocol", description = "Build and run protocol soak test", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 SoakProtocol" == 0 then os.execute "bin/SoakProtocol" end end } newaction { trigger = "soak_client_server", description = "Build and run client/server soak test", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 SoakClientServer" == 0 then os.execute "bin/SoakClientServer" end end } newaction { trigger = "profile_protocol", description = "Build and run protocol profile", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 ProfileProtocol" == 0 then os.execute "bin/ProfileProtocol" end end } newaction { trigger = "profile_client_server", description = "Build and run client server profile", valid_kinds = premake.action.get("gmake").valid_kinds, valid_languages = premake.action.get("gmake").valid_languages, valid_tools = premake.action.get("gmake").valid_tools, execute = function () if os.execute "make -j4 ProfileClientServer" == 0 then os.execute "bin/ProfileClientServer" end end } end
local Plugin = script.Parent.Parent.Parent.Parent local Libs = Plugin.Libs local Roact = require(Libs.Roact) local Utility = require(Plugin.Core.Util.Utility) local Constants = require(Plugin.Core.Util.Constants) local ContextGetter = require(Plugin.Core.Util.ContextGetter) local ContextHelper = require(Plugin.Core.Util.ContextHelper) local withTheme = ContextHelper.withTheme local withModal = ContextHelper.withModal local getModal = ContextGetter.getModal local Components = Plugin.Core.Components local Foundation = Components.Foundation local RoundedBorderedFrame = require(Foundation.RoundedBorderedFrame) local DraggerButton do DraggerButton = Roact.PureComponent:extend("DraggerButton") function DraggerButton:init() self:setState( { isHovered = false, isPressed = false } ) self.onMouseButton1Down = function(rbx, x, y) local dragBegan = self.props.dragBegan local modal = getModal(self) if dragBegan then dragBegan(x, y) end self:setState( { isPressed = true } ) modal.onButtonPressed(self) end self.onInputEnded = function(rbx, inputObject) local modal = getModal(self) if self.state.isPressed and inputObject.UserInputType == Enum.UserInputType.MouseButton1 then -- I can't do this after onClick for some reason... self:setState( { isPressed = false } ) local disabled = self.props.disabled local dragEnded = self.props.dragEnded if (not disabled and not (modal.isShowingModal(self.props.modalIndex)) or (modal.isAnyButtonPressed() and not modal.isButtonPressed(self))) then if dragEnded then dragEnded(inputObject.Position.X, inputObject.Position.Y) end end modal.onButtonReleased() end end self.onMouseEnterDragButton = function() if not self.state.isHovered then self:setState( { isHovered = true } ) end end self.onMouseLeaveDragButton = function() if self.state.isHovered then self:setState( { isHovered = false } ) end end self.onMouseButton1DownDragButton = function(rbx, x, y) local modal = getModal(self) if not self.state.isPressed and not (modal.isShowingModal(self.props.modalIndex) or (modal.isAnyButtonPressed() and not modal.isButtonPressed(self))) then local dragBegan = self.props.dragBegan if dragBegan then dragBegan(x, y) end self:setState( { isPressed = true } ) modal.onButtonPressed(self) end end self.onInputEndedDragButton = function(rbx, inputObject) local modal = getModal(self) if self.state.isPressed and inputObject.UserInputType == Enum.UserInputType.MouseButton1 then -- I can't do this after onClick for some reason... self:setState( { isPressed = false } ) local disabled = self.props.disabled local dragEnded = self.props.dragEnded if (not disabled and not (modal.isShowingModal(self.props.modalIndex)) or (modal.isAnyButtonPressed() and not modal.isButtonPressed(self))) then if dragEnded then dragEnded(inputObject.Position.X, inputObject.Position.Y) end end modal.onButtonReleased() end end self.onMouseMovedPortalDetector = function(rbx, x, y) local dragMoved = self.props.dragMoved if dragMoved then dragMoved(x, y) end end end DraggerButton.defaultProps = { Position = UDim2.new(0, 0, 0, 0), Size = UDim2.new(0, 100, 0, 100), Font = Constants.FONT, checked = false, modalIndex = 0 } function DraggerButton:render() local props = self.props local Position = props.Position local isHovered = self.state.isHovered local isPressed = self.state.isPressed local AnchorPoint = props.AnchorPoint local Size = props.Size local disabled = props.disabled local ZIndex = props.ZIndex local percent = props.percent return withTheme( function(theme) local buttonTheme = theme.button return Roact.createElement( "TextButton", { Text = "", ZIndex = ZIndex, BackgroundTransparency = 1, Size = Size, Position = Position, AnchorPoint = AnchorPoint, [Roact.Event.MouseButton1Down] = self.onMouseButton1Down, [Roact.Event.InputEnded] = self.onInputEnded }, { Button = (function() if isHovered then return withModal( function() local modal = getModal(self) local boxState if disabled then boxState = "Disabled" elseif modal.isShowingModal(props.modalIndex) or (modal.isAnyButtonPressed() and not modal.isButtonPressed(self)) then boxState = "Default" elseif isPressed then boxState = "PressedInside" elseif isHovered then boxState = "Hovered" else boxState = "Default" end local borderColor = buttonTheme.box.borderColor.Default[boxState] local backgroundColor = buttonTheme.box.backgroundColor.Default[boxState] return Roact.createElement( "ImageLabel", { Size = UDim2.new(0, 16, 0, 16), BackgroundTransparency = 1, ImageColor3 = backgroundColor, Position = UDim2.new(percent, 0, 0.5, 0), AnchorPoint = Vector2.new(0.5, 0.5), Image = "rbxassetid://3646176187" }, { Roact.createElement( "ImageLabel", { Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, ImageColor3 = borderColor, Image = "rbxassetid://3646176300" } ) } ) end ) else local boxState if disabled then boxState = "Disabled" elseif isPressed then boxState = "PressedInside" elseif isHovered then boxState = "Hovered" else boxState = "Default" end local borderColor = buttonTheme.box.borderColor.Default[boxState] local backgroundColor = buttonTheme.box.backgroundColor.Default[boxState] return Roact.createElement( "ImageLabel", { Size = UDim2.new(0, 16, 0, 16), BackgroundTransparency = 1, ImageColor3 = backgroundColor, Position = UDim2.new(percent, 0, 0.5, 0), AnchorPoint = Vector2.new(0.5, 0.5), Image = "rbxassetid://3646176187" }, { Roact.createElement( "ImageLabel", { Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, ImageColor3 = borderColor, Image = "rbxassetid://3646176300" } ) } ) end end)(), DragButton = Roact.createElement( "TextButton", { Text = "", Size = UDim2.new(0, Constants.SLIDER_BUTTON_WIDTH, 0, Constants.SLIDER_BUTTON_HEIGHT), Position = UDim2.new(percent, 0, 0.5, 0), BackgroundTransparency = 1, AnchorPoint = Vector2.new(0.5, 0.5), [Roact.Event.MouseEnter] = self.onMouseEnterDragButton, [Roact.Event.MouseLeave] = self.onMouseLeaveDragButton, [Roact.Event.MouseButton1Down] = self.onMouseButton1DownDragButton, [Roact.Event.InputEnded] = self.onInputEndedDragButton } ), Portal = isPressed and withModal( function(modalTarget) return Roact.createElement( Roact.Portal, { target = modalTarget }, { Detector = Roact.createElement( "TextButton", { Text = "", Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, ZIndex = 10, [Roact.Event.MouseMoved] = self.onMouseMovedPortalDetector } ) } ) end ) } ) end ) end function DraggerButton:willUnmount() if self.state.isPressed then local modal = getModal(self) modal.onButtonReleased() end end end local ThemedNumericalSlider = Roact.PureComponent:extend("ThemedNumericalSlider") function ThemedNumericalSlider:init() self:setState( { dragPos = Vector2.new(0, 0), isFocused = false } ) self.sliderRef = Roact.createRef() self.lastValidText = tostring(self.props.value) or "" self.formatValue = function(value) local valueIsIntegral = self.props.valueIsIntegral local trucateTrailingZeroes = self.props.trucateTrailingZeroes local decimalPlacesToShow = self.props.decimalPlacesToShow if valueIsIntegral then return string.format("%d", value) else if not trucateTrailingZeroes then return string.format(string.format("%%.%df", decimalPlacesToShow), value) else if value % 1 == 0 then return string.format("%d", value) else local s = string.format(string.format("%%.%df", decimalPlacesToShow), value) return string.match(s, "(-?%d+%.%d*[1-9]+)0*") end end end end local modal = getModal(self) self.onFocused = function(rbx) local isFocused = self.state.isFocused if (modal.isShowingModal(self.props.modalIndex) or modal.isAnyButtonPressed()) then self.focusDebounce = true rbx:ReleaseFocus(false) self.focusDebounce = false return end local value = self.props.value if not isFocused then rbx.Text = self.formatValue(value) self:setState( { isFocused = true } ) end end self.onFocusLost = function(rbx, enterPressed, input) local isFocused = self.state.isFocused local minValue = self.props.minValue local maxValue = self.props.maxValue local valueRound = self.props.valueRound local value = self.props.value local onValueChanged = self.props.onValueChanged if isFocused and not self.focusDebounce then self:setState( { isFocused = false } ) local num = tonumber(rbx.Text) local text if num then num = Utility.Round(math.clamp(num, minValue, maxValue), valueRound) text = tostring(num) else text = nil end if text ~= nil then self.changeDebounce = true rbx.Text = self.formatValue(text) local inputValue = tonumber(text) if value ~= inputValue and onValueChanged then onValueChanged(inputValue) end self.changeDebounce = false else self.changeDebounce = true rbx.Text = self.formatValue(value) self.changeDebounce = false end end end self.onMouseEnter = function() local isHovered = self.state.isHovered if not isHovered then self:setState( { isHovered = true } ) end end self.onMouseLeave = function() local isHovered = self.state.isHovered if isHovered then self:setState( { isHovered = false } ) end end local function validateTextChange(text) local maxCharacters = self.props.maxCharacters local valueIsIntegral = self.props.valueIsIntegral if string.len(text) > maxCharacters then return false end if valueIsIntegral then return text:match("^[-%d]*$") ~= nil else return text:match("^[-%d.]*$") ~= nil end end self.onTextChanged = function(rbx) if self.changeDebounce then return end if not self.state.isFocused then return end local newText = rbx.Text if not validateTextChange(newText) then self.changeDebounce = true rbx.Text = self.lastValidText self.changeDebounce = false else self.lastValidText = newText end end self.dragMoved = function(x, y) local props = self.props local minValue = props.minValue local maxValue = props.maxValue local valueSnap = props.valueSnap local value = props.value local onValueChanged = props.onValueChanged local slider = self.sliderRef.current local pos, size = slider.AbsolutePosition.X, slider.AbsoluteSize.X local left, right = pos, pos + size local percent = math.clamp((x - left) / (right - left), 0, 1) local dragValue = Utility.Lerp(minValue, maxValue, percent) dragValue = Utility.Round(dragValue, valueSnap) dragValue = math.clamp(dragValue, minValue, maxValue) if value ~= dragValue and onValueChanged then onValueChanged(dragValue) end end self.dragBegan = function(x, y) local props = self.props local minValue = props.minValue local maxValue = props.maxValue local valueSnap = props.valueSnap local value = props.value local onValueChanged = props.onValueChanged local slider = self.sliderRef.current local pos, size = slider.AbsolutePosition.X, slider.AbsoluteSize.X local left, right = pos, pos + size local percent = math.clamp((x - left) / (right - left), 0, 1) local dragValue = Utility.Lerp(minValue, maxValue, percent) dragValue = Utility.Round(dragValue, valueSnap) dragValue = math.clamp(dragValue, minValue, maxValue) if value ~= dragValue and onValueChanged then onValueChanged(dragValue) end end self.dragEnded = function(x, y) local props = self.props local minValue = props.minValue local maxValue = props.maxValue local valueSnap = props.valueSnap local value = props.value local onValueChanged = props.onValueChanged local slider = self.sliderRef.current local pos, size = slider.AbsolutePosition.X, slider.AbsoluteSize.X local left, right = pos, pos + size local percent = math.clamp((x - left) / (right - left), 0, 1) local dragValue = Utility.Lerp(minValue, maxValue, percent) dragValue = Utility.Round(dragValue, valueSnap) dragValue = math.clamp(dragValue, minValue, maxValue) if value ~= dragValue and onValueChanged then onValueChanged(dragValue) end end end ThemedNumericalSlider.defaultProps = { Size = UDim2.new(1, 0, 0, Constants.INPUT_FIELD_BOX_HEIGHT), Position = UDim2.new(0, 0, 0, 0), TextSize = Constants.FONT_SIZE_MEDIUM, textboxWidthPixel = 60, valueIsIntegral = false, decimalPlacesToShow = 2, maxCharacters = 6, trucateTrailingZeroes = true, textboxIsEditable = true, modalIndex = 0 } function ThemedNumericalSlider:willUpdate(nextProps, _) self.lastValidText = tostring(self.props.value) or "" end function ThemedNumericalSlider:render() local props = self.props local Size = props.Size local Position = props.Position local TextSize = props.TextSize local AnchorPoint = props.AnchorPoint local textboxWidthPixel = props.textboxWidthPixel local minValue = props.minValue local maxValue = props.maxValue local valueIsIntegral = props.valueIsIntegral local valueRound = props.valueRound local valueSnap = props.valueSnap local value = props.value if valueIsIntegral then assert( valueRound % 1 == 0 and valueSnap % 1 == 0, "valueIsIntegral is set to true. valueRound, valueSnap, must also be integral." ) end return withTheme( function(theme) return withModal( function() local modal = getModal(self) local sliderTheme = theme.numericalSliderField local fieldTheme = theme.textField local textPadding = Constants.INPUT_FIELD_TEXT_PADDING local font = Constants.FONT local inputColor = fieldTheme.box.textColor local isHovered = self.state.isHovered local isFocused = self.state.isFocused local boxState if isFocused then boxState = "Focused" elseif isHovered and not (modal.isShowingModal(self.props.modalIndex) or modal.isAnyButtonPressed()) then boxState = "Hovered" else boxState = "Default" end local borderColor if boxState == "Focused" then borderColor = fieldTheme.box.borderColor.Selected elseif boxState == "Hovered" then borderColor = fieldTheme.box.borderColor.Hover else borderColor = fieldTheme.box.borderColor.Default end local backgroundColor if boxState == "Focused" then backgroundColor = fieldTheme.box.backgroundColor.Selected elseif boxState == "Hovered" then backgroundColor = fieldTheme.box.backgroundColor.Hover else backgroundColor = fieldTheme.box.backgroundColor.Default end local placeholderColor = fieldTheme.box.placeholderColor local children = {} if props[Roact.Children] then for key, child in next, props[Roact.Children] do children[key] = child end end children.Input = Roact.createElement( "TextBox", { BackgroundTransparency = 1, Size = UDim2.new(1, -textPadding * 2, 1, 0), Position = UDim2.new(0, textPadding, 0, 0), Font = font, TextSize = TextSize, TextColor3 = inputColor, TextXAlignment = Enum.TextXAlignment.Center, ClearTextOnFocus = false, Text = self.formatValue(value), -- TextTruncate = Enum.TextTruncate.AtEnd, PlaceholderColor3 = placeholderColor, [Roact.Event.Focused] = self.onFocused, [Roact.Event.FocusLost] = self.onFocusLost, [Roact.Event.MouseEnter] = self.onMouseEnter, [Roact.Event.MouseLeave] = self.onMouseLeave, [Roact.Change.Text] = self.onTextChanged } ) local textbox = Roact.createElement( RoundedBorderedFrame, { Size = UDim2.new(0, textboxWidthPixel, 1, 0), Position = UDim2.new(0, 0, 0, 0), AnchorPoint = Vector2.new(0, 0), BackgroundColor3 = backgroundColor, BorderColor3 = borderColor }, children ) local fillPercent = math.clamp((value - minValue) / (maxValue - minValue), 0, 1) local barBackgroundColor = sliderTheme.barBackgroundColor local barFillColor = sliderTheme.barFillColor local spacingBetweenBarAndTextBox = 4 local slider = Roact.createElement( "Frame", { Size = UDim2.new(1, -textboxWidthPixel - Constants.SLIDER_BUTTON_WIDTH - spacingBetweenBarAndTextBox, 0, 0), Position = UDim2.new(0, textboxWidthPixel + spacingBetweenBarAndTextBox + Constants.SLIDER_BUTTON_WIDTH / 2, 0.5, 0), AnchorPoint = Vector2.new(0, 0.5), BackgroundTransparency = 1, [Roact.Ref] = self.sliderRef }, { BarBack = Roact.createElement( "Frame", { BorderSizePixel = 0, Size = UDim2.new(1, 0, 0, 6), Position = UDim2.new(0, 0, 0.5, 0), AnchorPoint = Vector2.new(0, 0.5), BackgroundColor3 = barBackgroundColor } ), BarFill = Roact.createElement( "Frame", { BorderSizePixel = 0, Size = UDim2.new(fillPercent, 0, 0, 6), Position = UDim2.new(0, 0, 0.5, 0), AnchorPoint = Vector2.new(0, 0.5), BackgroundColor3 = barFillColor, ZIndex = 2 } ), Dragger = Roact.createElement( DraggerButton, { Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 0.5, 0), AnchorPoint = Vector2.new(0, 0.5), ZIndex = 3, percent = fillPercent, dragMoved = self.dragMoved, dragBegan = self.dragBegan, dragEnded = self.dragEnded, modalIndex = props.modalIndex } ) } ) return Roact.createElement( "Frame", { BackgroundTransparency = 1, Size = Size, Position = Position, AnchorPoint = AnchorPoint }, { Textbox = textbox, Slider = slider } ) end ) end ) end return ThemedNumericalSlider
ITEM.name = "Армированный брезентоывй лист" ITEM.desc = "Толстый плотный лист текстильной ткани, армированный кевларом. Достаточно большой лист, можно залатать несколько поврежденных участков. \n\nХАРАКТЕРИСТИКИ: \n-военное изделие \n-высококачественное издение \n-используется в крафте" ITEM.price = 11520 ITEM.exRender = false ITEM.weight = 0.47 ITEM.model = "models/kek1ch/textile_patch_e.mdl" ITEM.width = 1 ITEM.height = 1 ITEM.iconCam = { pos = Vector(0, 0, 200), ang = Angle(90, 0, 4.5859870910645), fov = 6.3057324840764 }
local PLUGIN = PLUGIN local function openItemBank(invID) local itemBankInventory = ix.item.inventories[invID] itemBank = vgui.Create("ixInventory", inventoryframe) ownPanel = vgui.Create("ixInventory", inventoryframe) ownPanel:SetInventory(LocalPlayer():GetCharacter():GetInventory()) ownPanel:CenterHorizontal(0.8) ownPanel:CenterVertical() ownPanel:ShowCloseButton(false) ownPanel:MakePopup() function ownPanel:Think() if (not IsValid(StartingFrame)) then ownPanel:MoveToFront() end end itemBank:SetInventory(itemBankInventory) itemBank:SetTitle("Item Bank") itemBank:ShowCloseButton(true) itemBank:CenterHorizontal(0.25) itemBank:ShowCloseButton(false) itemBank:CenterVertical() itemBank:MakePopup() function itemBank:Think() if (not IsValid(StartingFrame)) then itemBank:MoveToFront() end end function itemBank:OnRemove() ownPanel:Remove() end timer.Simple(2, function() function ownPanel:OnKeyCodePressed(key) if (key == KEY_TAB) then inventoryframe:Remove() end end end) end netstream.Hook("OpenItemBank", openItemBank)
local Factory = require("support.factory") Factory.define("dota_unit", function(attributes) return CDOTA_BaseNPC(attributes) end)
--[[ - SKYNET SIMPLE ( https://github.com/viticm/skynet-simple ) - $Id client.lua - @link https://github.com/viticm/skynet-simple for the canonical source repository - @copyright Copyright (c) 2020 viticm( viticm.ti@gmail.com ) - @license - @user viticm( viticm.ti@gmail.com ) - @date 2020/08/11 16:25 - @uses The robot client class. --]] local skynet = require 'skynet' local socket = require 'skynet.socket' local sprotoloader = require 'sprotoloader' local log = require 'log' local util = require 'util' -- Other. local require = require local string = string local assert = assert local coroutine = coroutine local print = print local pcall = pcall -- Data. ------------------------------------------------------------------------------- local _M = {} package.loaded[...] = _M if setfenv and 'function' == type(setfenv) then setfenv(1, _M) -- Lua 5.1 else _ENV = _M -- Lua 5.2+ end handler = {} -- Msg handler. local host local sender local threads= {} local ret_msg = {} local ret_err = {} -- Local functions. ------------------------------------------------------------------------------- -- Handle message. local function handle_msg(self, type, name, response, f, args) local _ <close> = self.ref_guard and self:ref_guard() local ok, r = pcall(f, self, args) if ok then if response then socket.write(self.fd, string.pack('>s2', response(r))) end else log:error('raise error: %s', r) end end -- Read message from socket. local function read_msg(self) local fd = self.fd local s = socket.read(fd, 2) local msg, sz = nil, 0 if s then sz = string.unpack('>H', s) msg = assert(socket.read(fd, sz), 'invalid fd ' .. fd) end return msg, sz end -- Package message. local function pack_msg(t, data, session) local msg = sender(t, data, session) return string.pack('>s2', msg) --return msg:pack('>s2') end -- Reference inc. local function ref_inc(self) if self.ref then self.ref = self.ref + 1 end end -- Reference dec. local function ref_dec(self) if self.ref then self.ref = self.ref - 1 end end -- API. ------------------------------------------------------------------------------- -- Dispatch socket message. -- @param table self The socket table. function dispatch(self) repeat local msg, sz = read_msg(self) if sz > 0 then local type, name, args, response = host:dispatch(msg, sz) if 'REQUEST' == type then local f = handler[name] if f then skynet.fork(handle_msg, self, type, name, response, f, args) end else local session, r, ud = name, args, response local co = threads[session] if not co then log:error('Invalid session: %s', session) else ret_msg[session] = r ret_err[session] = nil threads[session] = nil skynet.wakeup(co) end end else log('client close fd: %d', self.fd) self.fd = nil return self end until false end -- Close socket. -- @param table self The socket table. function close(self) socket.close(self.fd) end -- Push message. -- @param table self The socket table. -- @param string name The package name. -- @param table data The message data. function push(self, name, data) if not self.fd then return end assert(socket.write(self.fd, pack_msg(name, data), 'closed ' .. self.fd)) end -- Push fds. function push_fds(fds, name, data) error('can\' call push_fds') end -- Request a message with a result. -- @param table self The socket table. -- @param number timeout Request timeout time. -- @param string name Package name. -- @param string name Package data. -- @return table function request(self, timeout, name, data) local _ <close> = self.ref_guard and self:ref_guard() if not self.fd or socket.invalid(self.fd) then return { e = -1 } end local session = skynet.genid() assert( socket.write(self.fd, pack_msg(name, data, session), 'closed ' .. self.fd)) local co = coroutine.running() threads[session] = co ref_inc(self) skynet.timeout(timeout, function() ref_dec(self) local co = threads[session] if not co then return end ret_msg[session] = string.format('timeout %d, %s', self.fd or 0, name) ret_err[session] = true threads[session] = nil skynet.wakeup(co) end) skynet.wait() local err = ret_err[session] local r = ret_msg[session] ret_err[session], ret_msg[session] = nil, nil if err then return { e = -1 } end return r end -- Init. function _M.init(s, c) local sprotoloader = require 'sprotoloader' local proto_loader = skynet.uniqueservice 'proto_loader' local slot_s = skynet.call(proto_loader, 'lua', 'index', s) host = sprotoloader.load(slot_s):host 'package' local slot_c = skynet.call(proto_loader, 'lua', 'index', c) sender = host:attach(sprotoloader.load(slot_c)) end
require "vectors" require "pp" local playerPosition local playerVelocity local currentFallRate local currentWorldOffset local currentPowerLevel local elapsedTime local nextFoodSpawnTime local extraFoodSpawnTime local BASE_FALL_RATE = 60 local FALL_RATE_ACCELERATION = 2 local JUMP_SPEED = 600 local PLAYER_DRAG = 1 local FOOD_Y_SPEED_VARIATION = 0.5 -- multiplier on current fall rate local SIDE_FOOD_BASE_X_SPEED = 60 local FOOD_X_SPEED_VARIATION = 0.3 local TOP_FOOD_X_SPEED_MAX = 40 local MAX_POWER = 21 local STARTING_POWER = MAX_POWER local POWER_PER_JUMP = 3 local POWER_PER_FOOD = 5 local POWER_DECAY = 1.2 local BASE_FOOD_SPAWN_INTERVAL = 0.75 local FOOD_SPAWN_VARIATION = 0.2 local FOOD_SPAWN_INTERVAL_GROWTH = 0 local UI_EDGE_INSET = 15 local POWER_BAR_WIDTH = 200 local POWER_BAR_HEIGHT = 20 local PLAYER_SIZE = 90 local FOOD_SIZE = 60 local foods = {} local screenWidth, screenHeight, pixelScale local youShader local quadMesh local foodColorSchemes = { { { 0.94, 0.05, 0.65 }, { 0.85, 0.15, 0.35 }, { 0.4, 0.15, 0.95 } }, -- pink { { 0.2, 0.05, 0.95 }, { 0.4, 0.05, 0.9 }, { 0.25, 0.6, 0.93 } }, -- blue { { 0.6, 0.05, 0.93 }, { 0.4, 0.03, 0.95 }, { 0.1, 0.4, 0.9 } }, -- purple { { 0.05, 0.4, 0.95 }, { 0.3, 0.8, 0.6 }, { 0.05, 0.1, 0.9 } } } -- cyan local canvases = {} local thresholdShader, blurShaderX, blurShaderY, backgroundShader, barShader, scoreShader local BASE_PLAYER_SPIN = 0.6 -- radians per second local playerRotation, currentPlayerSpin local JUMP_SPIN = 11 local foodExplosions local foodTemplateEmitter local particleImages = {} -- indices 1…4 have polygons with 4…7 sides local EXPLOSION_PARTICLES_PER_COLOR = 6 local FOOD_GLOW_FADE_DURATION = 2 local lastFoodTime = -2 * FOOD_GLOW_FADE_DURATION local isPlaying, isGameOver local backgroundMusic local logoImage, instructionImage, completeImage, scoreImage, bestScoreImage local scoreFont, bestScoreFont, bigScoreFont local beganPlayingTime, gameOverTime, resetTime local SCORE_PER_SECOND = 6 local TITLE_MOVE_DURATION_OUT = 0.5 local TITLE_MOVE_DURATION_IN = 2 local bestScore function love.load() math.randomseed(os.time()) screenWidth, screenHeight = love.window.getMode() pixelScale = love.window.getPixelScale() youShader = love.graphics.newShader("creature.fsh") thresholdShader = love.graphics.newShader("threshold.fsh") blurShaderX = makeBlurShader(45, screenWidth, 1, 0) blurShaderY = makeBlurShader(25, screenHeight, 0, 1) backgroundShader = love.graphics.newShader("grid.fsh") backgroundShader:send("screenDimensions", {screenWidth, screenHeight}) barShader = love.graphics.newShader("bar.fsh") scoreShader = love.graphics.newShader("score.fsh") local quadVertices = {{-0.5, -0.5, 0, 0}, {0.5, -0.5, 1, 0}, {-0.5, 0.5, 0, 1}, {0.5, 0.5, 1, 1}} quadMesh = love.graphics.newMesh(quadVertices, "strip", "static") for i = 1, 3 do local scaleMultiplier = (i == 1) and 1 or 0.5 local canvas = love.graphics.newCanvas(screenWidth * pixelScale * scaleMultiplier, screenHeight * pixelScale * scaleMultiplier) canvas:setWrap("clampzero", "clampzero") canvases[i] = canvas end local particleCanvasSize = FOOD_SIZE * 0.5 * pixelScale particleCanvas = love.graphics.newCanvas(particleCanvasSize, particleCanvasSize) love.graphics.setCanvas(particleCanvas) for i = 1, 4 do love.graphics.clear(0,0,0,255) love.graphics.setColor(255, 255, 255, 255) love.graphics.circle("fill", particleCanvasSize / 2, particleCanvasSize / 2, particleCanvasSize / 2, i + 3) love.graphics.setColor(0, 0, 0, 255) love.graphics.circle("fill", particleCanvasSize / 2, particleCanvasSize / 2, particleCanvasSize / 4, i + 3) particleImages[i] = love.graphics.newImage(particleCanvas:newImageData()) end love.graphics.setCanvas() foodTemplateEmitter = love.graphics.newParticleSystem(particleImages[1], EXPLOSION_PARTICLES_PER_COLOR) local sMul = 0.5 / pixelScale foodTemplateEmitter:setSizes(0.2 * sMul, 4.0 * sMul, 0.6 * sMul, 1.3 * sMul, 0.8 * sMul, 1.0 * sMul, 0.6 * sMul, 0) foodTemplateEmitter:setSpread(math.pi * 2) foodTemplateEmitter:setSpeed(40, 60) foodTemplateEmitter:setParticleLifetime(0.6, 1.2) foodTemplateEmitter:setSizeVariation(0) foodTemplateEmitter:setLinearAcceleration(0, 40) backgroundMusic = love.audio.newSource("music.ogg") backgroundMusic:setLooping(true) backgroundMusic:play() logoImage = loadImage("logo") instructionImage = loadImage("instructions") completeImage = loadImage("complete") scoreImage = loadImage("score") bestScoreImage = loadImage("best") local scoreFontName = "Air Americana.ttf" scoreFont = love.graphics.newFont(scoreFontName, 40) bestScoreFont = love.graphics.newFont(scoreFontName, 20) bigScoreFont = love.graphics.newFont(scoreFontName, 80) elapsedTime = 0 resetTime = -5 bestScore = 0 setup() end function loadImage(name) return love.graphics.newImage(name .. ((pixelScale > 1) and "@2x" or "") .. ".png") end function setup() isPlaying = false isGameOver = false beganPlayingTime = -2 * TITLE_MOVE_DURATION_OUT --don’t want any animations going off unexpectedly gameOverTime = -2 * TITLE_MOVE_DURATION_IN -- ditto playerPosition = v(0,0) playerVelocity = v(0,0) currentWorldOffset = 0 currentFallRate = BASE_FALL_RATE updateWorldOffset(0) playerRotation = 0 currentPlayerSpin = (math.random() > 0.5 and 1 or -1) * BASE_PLAYER_SPIN currentPowerLevel = STARTING_POWER nextFoodSpawnTime = elapsedTime extraFoodSpawnTime = 0 foods = {} foodExplosions = {} for i = 1, 4 do makeFood() end end function love.update(dt) elapsedTime = elapsedTime + dt playerPosition = vAdd(playerPosition, vMul(playerVelocity, dt)) local halfWidth = screenWidth * 0.42 if playerPosition.x < -halfWidth then playerPosition.x = -halfWidth + 1 playerVelocity.x = math.abs(playerVelocity.x) elseif playerPosition.x > halfWidth then playerPosition.x = halfWidth - 1 playerVelocity.x = -math.abs(playerVelocity.x) end playerRotation = playerRotation + currentPlayerSpin * dt local targetSpin = ((currentPlayerSpin > 0) and 1 or -1) * BASE_PLAYER_SPIN currentPlayerSpin = targetSpin + (currentPlayerSpin - targetSpin) * (1 - 2 * dt) for i = 1, #foods do local food = foods[i] if isPlaying or isGameOver then foods[i].position = vAdd(food.position, vMul(food.velocity, dt)) end -- for both of the below, it’s possible for us to miss events if they happen in the same frame -- they’ll get caught in the next one, though, so that doesn’t matter -- the accounting to keep track of multiple indices is not hard, I just don’t feel like doing it if vDist(playerPosition, foods[i].position) < (PLAYER_SIZE + FOOD_SIZE) / 3 then handleGotFood(i) break end if math.abs(food.position.x) > screenWidth * 0.7 then table.remove(foods, i) break end end local explosionIndicesToRemove = {} for i = 1, #foodExplosions do local allEmittersDead = true for j = 1, 3 do local emitter = foodExplosions[i].emitters[j] local x, y = emitter:getPosition() emitter:setPosition(x + foodExplosions[i].velocity.x * dt, y + foodExplosions[i].velocity.y * dt) emitter:update(dt) if emitter:getCount() > 0 then allEmittersDead = false end end if allEmittersDead then explosionIndicesToRemove[#explosionIndicesToRemove + 1] = i end end local alreadyRemovedExplosionCount = 0 for i = 1, #explosionIndicesToRemove do table.remove(foodExplosions, explosionIndicesToRemove[i] - alreadyRemovedExplosionCount) alreadyRemovedExplosionCount = alreadyRemovedExplosionCount + 1 end playerVelocity = vMul(playerVelocity, 1 - PLAYER_DRAG * dt) if isPlaying or isGameOver then updateWorldOffset(dt) currentFallRate = currentFallRate + FALL_RATE_ACCELERATION * dt end if isPlaying then currentPowerLevel = currentPowerLevel - POWER_DECAY * dt if currentPowerLevel < 0 then currentPowerLevel = 0 endGame() end extraFoodSpawnTime = extraFoodSpawnTime + FOOD_SPAWN_INTERVAL_GROWTH * dt end if isPlaying and elapsedTime > nextFoodSpawnTime and currentPowerLevel > POWER_PER_JUMP then local delay = BASE_FOOD_SPAWN_INTERVAL + extraFoodSpawnTime nextFoodSpawnTime = elapsedTime + delay * (1 + frand() * FOOD_SPAWN_VARIATION) makeFood() end if isGameOver and resetTime > 0 and elapsedTime > resetTime + TITLE_MOVE_DURATION_OUT then setup() end end function love.draw() -- post-processing path, so I don’t lose track: -- everything drawn to canvas 1 -- canvas 1 drawn with threshold to canvas 2 -- canvas 2 drawn with X blur to canvas 3 -- canvas 3 drawn with Y blur to screen -- canvas 1 drawn to screen love.graphics.clear(0, 0, 0, 255) love.graphics.setColor(255, 255, 255, 255) local feedProgress = ((elapsedTime - lastFoodTime) / FOOD_GLOW_FADE_DURATION) local beatValue = guessedBeatValue() setCanvasAndClear(canvases[1]) love.graphics.scale(pixelScale) love.graphics.push() -- grid love.graphics.push() love.graphics.setShader(backgroundShader) backgroundShader:send("worldYOffset", currentWorldOffset) love.graphics.scale(screenWidth, screenHeight) love.graphics.draw(quadMesh, 0.5, 0.5) love.graphics.pop() love.graphics.translate(screenWidth / 2, screenHeight / 2 + currentWorldOffset) love.graphics.setBlendMode("add") -- everything glowy should be additive, duh -- player love.graphics.setColor(255, 255, 255, 255) love.graphics.push() love.graphics.translate(playerPosition.x, playerPosition.y) love.graphics.scale(PLAYER_SIZE * (1.0 + 0.2 * math.sin(feedProgress * math.pi * 6) * math.exp(-4 * feedProgress) + 0.2 * beatValue)) love.graphics.rotate(playerRotation) love.graphics.setShader(youShader) youShader:send("iGlobalTime", elapsedTime) youShader:send("color1", {0.05, 0.94, 0.58}) youShader:send("color2", {0.03, 0.47, 0.93}) youShader:send("color3", {0.4, 0.15, 0.95}) youShader:send("sides", 3) love.graphics.draw(quadMesh) love.graphics.setShader() love.graphics.pop() -- foods love.graphics.setShader(youShader) for i = 1, #foods do local food = foods[i] love.graphics.push() love.graphics.translate(food.position.x, food.position.y) love.graphics.scale(FOOD_SIZE * (1.0 + 0.1 * beatValue)) love.graphics.rotate(elapsedTime * 0.53) youShader:send("sides", food.sideCount) local scheme = foodColorSchemes[food.colorSchemeIndex] youShader:send("iGlobalTime", elapsedTime + food.timeOffset) youShader:send("color1", scheme[1]) youShader:send("color2", scheme[2]) youShader:send("color3", scheme[3]) love.graphics.draw(quadMesh) love.graphics.pop() end love.graphics.setShader() for i = 1, #foodExplosions do for j = 1, 3 do love.graphics.draw(foodExplosions[i].emitters[j]) end end love.graphics.pop() -- bar love.graphics.push() love.graphics.translate(UI_EDGE_INSET + POWER_BAR_WIDTH / 2, UI_EDGE_INSET + POWER_BAR_HEIGHT / 2) love.graphics.scale(POWER_BAR_WIDTH, POWER_BAR_HEIGHT) love.graphics.setShader(barShader) barShader:send("iGlobalTime", elapsedTime) barShader:send("fill", math.max(0, math.min(1, currentPowerLevel / MAX_POWER))) love.graphics.draw(quadMesh) love.graphics.setShader() love.graphics.pop() love.graphics.setColor(160, 230 + 25 * math.sin(elapsedTime * 1.53), 220 + 35 * math.sin(elapsedTime * 1.4 + 1), 255) drawScoreTexts(isGameOver, false) love.graphics.setBlendMode("alpha", "premultiplied") setCanvasAndClear(canvases[2]) love.graphics.setShader(thresholdShader) drawCanvas(canvases[1], 0.5) setCanvasAndClear(canvases[3]) love.graphics.setColor(200, 220, 255, 255) love.graphics.setShader(blurShaderX) drawCanvas(canvases[2], 1) setCanvasAndClear(canvases[2]) love.graphics.setColor(255, 255, 255, 255) love.graphics.setShader(blurShaderY) drawCanvas(canvases[3], 1) love.graphics.setShader() love.graphics.setCanvas() love.graphics.setBlendMode("add") drawCanvas(canvases[2], 2) local extraGlowValue = 0 if elapsedTime < lastFoodTime + FOOD_GLOW_FADE_DURATION then extraGlowValue = 1 - feedProgress end if isGameOver then extraGlowValue = beatValue * 0.3 end if extraGlowValue > 0 then love.graphics.setColor(255 * extraGlowValue, 255 * extraGlowValue, 255 * extraGlowValue, 255 * extraGlowValue) drawCanvas(canvases[2], 2) end local mainMultiplier = math.min(1, math.pow(math.max(0, currentPowerLevel) / (2 * POWER_PER_JUMP), 2)) love.graphics.setColor(255 * mainMultiplier, 255 * mainMultiplier, 255 * mainMultiplier, 255) drawCanvas(canvases[1]) -- original unblurred one love.graphics.setBlendMode("alpha") -- UI if isGameOver then love.graphics.setColor(255, 255, 255, 255) else love.graphics.setColor(255, 255, 255, 255 * mainMultiplier) end drawScoreTexts(isGameOver, true) local shouldDrawTitles = (not isPlaying) or (elapsedTime < beganPlayingTime + TITLE_MOVE_DURATION_OUT) if shouldDrawTitles then local areTitlesEntering = isGameOver or (resetTime > 0 and elapsedTime > resetTime + TITLE_MOVE_DURATION_OUT and elapsedTime < resetTime + TITLE_MOVE_DURATION_OUT + TITLE_MOVE_DURATION_IN) local titleMovementCurvePower = areTitlesEntering and 9 or 3 -- make sure these stay odd so stuff isn’t always offset in positive X local mainLogoY = screenHeight * 0.3 local mainLogoXOffsetAmount = 0 if elapsedTime < beganPlayingTime + TITLE_MOVE_DURATION_OUT then mainLogoXOffsetAmount = (elapsedTime - beganPlayingTime) / TITLE_MOVE_DURATION_OUT elseif elapsedTime < gameOverTime + TITLE_MOVE_DURATION_IN then mainLogoXOffsetAmount = -1 + (elapsedTime - gameOverTime) / TITLE_MOVE_DURATION_IN elseif elapsedTime < resetTime + TITLE_MOVE_DURATION_OUT then mainLogoXOffsetAmount = (elapsedTime - resetTime) / TITLE_MOVE_DURATION_OUT elseif elapsedTime < resetTime + TITLE_MOVE_DURATION_OUT + TITLE_MOVE_DURATION_IN then mainLogoXOffsetAmount = -1 + (elapsedTime - (resetTime + TITLE_MOVE_DURATION_OUT)) / TITLE_MOVE_DURATION_IN end mainLogoXOffsetAmount = math.pow(mainLogoXOffsetAmount, titleMovementCurvePower) local completeY = screenHeight * 0.45 local completeXOffsetAmount = 0 if elapsedTime < gameOverTime + TITLE_MOVE_DURATION_IN then completeXOffsetAmount = 1 - (elapsedTime - gameOverTime) / TITLE_MOVE_DURATION_IN elseif elapsedTime < resetTime + TITLE_MOVE_DURATION_OUT then completeXOffsetAmount = (elapsedTime - resetTime) / TITLE_MOVE_DURATION_OUT end completeXOffsetAmount = math.pow(completeXOffsetAmount, titleMovementCurvePower) local instanceCount = isGameOver and 0 or 3 for i = instanceCount, 0, -1 do love.graphics.setColor(255, 255, 255, 255 * (1 - 0.3 * i)) drawCenteredImage(logoImage, screenWidth * (0.5 + mainLogoXOffsetAmount * (1 - 0.1 * i)), mainLogoY + i * 20, (1 - 0.15 * i) / pixelScale) end if isGameOver then -- second part of logo text (“complete”) drawCenteredImage(completeImage, screenWidth * (0.5 + completeXOffsetAmount), completeY, 1 / pixelScale) elseif not isPlaying then -- instructions drawCenteredImage(instructionImage, screenWidth / 2, screenHeight * 0.6, 1 / pixelScale) end -- extra main-logo pass love.graphics.setBlendMode("add") love.graphics.setColor(255 * beatValue, 255 * beatValue, 255 * beatValue, 255) drawCenteredImage(logoImage, screenWidth * (0.5 + mainLogoXOffsetAmount), mainLogoY, 1 / pixelScale) if isGameOver then drawCenteredImage(completeImage, screenWidth * (0.5 + completeXOffsetAmount), completeY, 1 / pixelScale) end end end function updateWorldOffset(dt) local screenPositionTarget = 0.4 - 0.2 * ((currentFallRate - BASE_FALL_RATE) / 100) -- later in the game the world’s moving fast enough that you end up scrabbling at the bottom of the screen; compensate for that currentWorldOffset = math.max(-playerPosition.y + screenHeight * screenPositionTarget, currentWorldOffset + currentFallRate * dt) end function drawScoreTexts(final, includeLabels) local score = tostring(getScore()) love.graphics.setShader(scoreShader) scoreShader:send("iGlobalTime", elapsedTime) if not final then local scoreRightEdge = screenWidth - UI_EDGE_INSET + 5 local scoreWidth = drawText(score, scoreFont, scoreRightEdge, UI_EDGE_INSET, true) if includeLabels then local scoreLabelWidth = scoreImage:getWidth() / pixelScale local labelX = scoreRightEdge - 9 * string.len(score) - 26 - scoreLabelWidth love.graphics.setShader() love.graphics.draw(scoreImage, labelX, UI_EDGE_INSET + 20, 0, 1 / pixelScale) end if bestScore > 0 then local bestScoreText = tostring(math.max(score, bestScore)) love.graphics.setShader(scoreShader) local bestScoreWidth = drawText(bestScoreText, bestScoreFont, scoreRightEdge, UI_EDGE_INSET + 45, true) love.graphics.setShader() if includeLabels then local bestScoreLabelWidth = bestScoreImage:getWidth() / pixelScale local labelX = scoreRightEdge - 6 * string.len(bestScoreText) - 18 - bestScoreLabelWidth love.graphics.draw(bestScoreImage, labelX, UI_EDGE_INSET + 48, 0, 1 / pixelScale) end end else drawText(score, bigScoreFont, screenWidth / 2, screenHeight * 0.7) love.graphics.setShader() drawCenteredImage(scoreImage, screenWidth / 2 + 3, screenHeight * 0.7 - 23, 1 / pixelScale) end end function drawCanvas(canvas, scaleMultiplier) scaleMultiplier = scaleMultiplier or 1 love.graphics.draw(canvas, 0, 0, 0, scaleMultiplier / pixelScale, scaleMultiplier / pixelScale) end function setCanvasAndClear(canvas, shouldClear) love.graphics.setCanvas(canvas) if shouldClear ~= false then love.graphics.clear(0, 0, 0, 255) end end function love.keypressed(key) if key == "escape" then love.event.quit() elseif key == "space" then if isPlaying then doJump() elseif isGameOver then if elapsedTime > gameOverTime + TITLE_MOVE_DURATION_IN then resetTime = elapsedTime end else beginGame() end end end function love.mousepressed() love.keypressed("space") end function beginGame() isPlaying = true beganPlayingTime = elapsedTime doJump(true) resetTime = -5 end function endGame() isPlaying = false isGameOver = true gameOverTime = elapsedTime local score = getScore() if score > bestScore then bestScore = score end end function doJump(first) if currentPowerLevel > POWER_PER_JUMP then if first then playerVelocity = v(0, -JUMP_SPEED) else playerVelocity = currentJumpVelocity() currentPowerLevel = currentPowerLevel - POWER_PER_JUMP end currentPlayerSpin = JUMP_SPIN * ((playerVelocity.x > 0) and 1 or -1) end end function currentJumpVelocity() local mousePosition = mouseScreenPosition() return vNorm(vSub(mousePosition, playerPosition), JUMP_SPEED) end function handleGotFood(foodIndex) if isPlaying then local food = foods[foodIndex] table.remove(foods, foodIndex) currentPowerLevel = math.min(MAX_POWER, currentPowerLevel + POWER_PER_FOOD) lastFoodTime = elapsedTime makeFoodExplosion(food) end end -- Utility stuff function getScore() local time if isGameOver then time = gameOverTime - beganPlayingTime elseif not isPlaying then time = 0 else time = elapsedTime - beganPlayingTime end return math.floor(time * SCORE_PER_SECOND) end function drawText(text, font, x, y, rightAlign) -- if not right-aligned, centered love.graphics.setFont(font) local textWidth = font:getWidth(text) local textXOrigin = rightAlign and textWidth or textWidth / 2 love.graphics.print(text, x, y, 0, 1, 1, textXOrigin) return textWidth end function guessedBeatValue(phase) local secondsPerBeat = 60 / 100 -- 100 bpm local thisBeatValue = math.fmod(elapsedTime / secondsPerBeat + 0.15, 1) return math.pow(1 - thisBeatValue, 2) end function makeFoodExplosion(food) local exp = {} exp.velocity = food.velocity local emitters = {} for i = 1, 3 do local em = foodTemplateEmitter:clone() em:setPosition(food.position.x, food.position.y) local scheme = foodColorSchemes[food.colorSchemeIndex][i] em:setTexture(particleImages[food.sideCount - 3]) local fullColors = { scheme[1] * 255, scheme[2] * 255, scheme[3] * 255} em:setColors(fullColors, { 255, 255, 255 }, fullColors, fullColors, fullColors) em:setRotation(elapsedTime * 0.53 + math.pi * 0.25) em:emit(EXPLOSION_PARTICLES_PER_COLOR) emitters[i] = em end exp.emitters = emitters foodExplosions[#foodExplosions + 1] = exp end function makeFood() local food = {} local direction = math.random(3) if direction == 1 then -- top of screen local y = -screenHeight * 0.55 - currentWorldOffset local x = frand() * screenWidth / 2 food.position = v(x, y) food.velocity = v(frand() * TOP_FOOD_X_SPEED_MAX, currentFallRate * frand() * FOOD_Y_SPEED_VARIATION) else local leftSide = (direction == 2) and true or false food.velocity = v(SIDE_FOOD_BASE_X_SPEED * (1 + frand() * FOOD_X_SPEED_VARIATION) * (leftSide and 1 or -1), currentFallRate * (frand() - 1) * FOOD_Y_SPEED_VARIATION) local y = playerPosition.y - (1 - math.pow(math.random(), 2)) * screenHeight food.position = v((leftSide and -1 or 1) * screenWidth * 0.55, y) end local leftSide = (frand() > 0) and true or false food.colorSchemeIndex = math.random(#foodColorSchemes) food.sideCount = math.random(4, 7) food.timeOffset = math.random() * 10 foods[#foods + 1] = food end function drawCenteredImage(image, x, y, scale, angle) local w, h = image:getWidth(), image:getHeight() scale = scale or 1 angle = angle or 0 love.graphics.draw(image, x, y, angle * math.pi * 2, scale, scale, w / 2, h / 2) end function mouseScreenPosition() local mouseX, mouseY = love.mouse.getPosition() mouseX = (mouseX / pixelScale - screenWidth / 2) mouseY = (mouseY / pixelScale - (screenHeight / 2 + currentWorldOffset)) return v(mouseX, mouseY) end function frand() return math.random() * 2 - 1 end
local Modules = require ('map.modules') return function (state) local modules, message = Modules.load ( state.settings.script.input, state.settings.script.package.path) if not modules then return nil, message end state.modules = modules return true end
local PowerGrid = Class('PowerGrid') function PowerGrid:initialize(game, x, y, roomHash) self.game = game self.x = x self.y = y self.screenX = 0 self.screenY = 0 self.hitboxX = 0 self.hitboxY = 32 self.hitboxWidth = 64 self.hitboxHeight = 48 self.animationName = 'offline' self.image = PowerGrid.images.offline self.animation = PowerGrid.animations.offline:clone() self.glowImage = love.graphics.newImage('assets/images/Glow.png') self.roomHash = roomHash or 0 self.activated = false self.powered = false self.flashTimer = 0 self.timer = Timer.new() self.charge = 0 self.chargePerClick = TWEAK.powergrid_charge_per_click self.maxCharge = TWEAK.powergrid_charge_required self.beingHeld = false self.chargeSignalAmount = TWEAK.powergrid_charge_per_click self.chargeSignalDecumulator = 0 end function PowerGrid:activate() local game = self.game if not self.activated then self.activated = true game.power = game.power * (1 - TWEAK.powergrid_cost_to_activate) self.animationName = 'online' self.image = PowerGrid.images.online self.animation = PowerGrid.animations.online:clone() Signal.emit('powerGridActivate') end end function PowerGrid:addCharge(rawAmount) local game = self.game if not self.activated then return end if game.eventManager.firstEnemyDeath then return end local amount = rawAmount * self.chargePerClick self.charge = self.charge + amount if self.charge >= self.maxCharge then self.charge = self.maxCharge if not self.powered then self.powered = true Signal.emit('powerGridPowered') end else self.chargeSignalDecumulator = self.chargeSignalDecumulator - amount if self.chargeSignalDecumulator <= 0 then self.chargeSignalDecumulator = self.chargeSignalAmount Signal.emit('powerGridCharge') end end end function PowerGrid:update(dt) if self.beingHeld then self:addCharge(dt) end self.animation:update(dt) self.timer:update(dt) self.flashTimer = self.flashTimer + dt end function PowerGrid:draw(isHovered) local game = self.game local x, y = game:gridToScreen(self.x, self.y) local offset = PowerGrid.animationOffsets[self.animationName] x = x + offset.x y = y - self.image:getHeight() + offset.y self.screenX, self.screenY = x, y local colorIncrease = 0 if not self.activated then colorIncrease = colorIncrease + (math.sin(self.flashTimer/2)+1)/2 * 100 if isHovered then colorIncrease = colorIncrease + 100 end else if isHovered then colorIncrease = 200 end end love.graphics.setColor(255+colorIncrease, 255+colorIncrease, 255+colorIncrease) self.animation:draw(self.image, x, y) if self.activated and not self.powered then local charge = Lume.round((self.charge / self.maxCharge) * 100, 1) local font = Fonts.pixel[16] local text = 'CHARGE: '..charge..'%' local tx, ty = x, y tx = tx + self.image:getWidth()/2 - font:getWidth(text)/2 tx = Lume.round(tx) ty = Lume.round(ty) love.graphics.setFont(font) love.graphics.setColor(0, 0, 0) love.graphics.print(text, tx+1, ty+1) love.graphics.setColor(255, 255, 255) love.graphics.print(text, tx, ty) end if not self.activated then local scale = (math.sin(self.flashTimer)+1)/2 + 1 love.graphics.setColor(255, 0, 0) love.graphics.draw(self.glowImage, x + self.image:getWidth()/2, y + self.image:getHeight() - 32, math.rad(45), scale, scale, self.glowImage:getWidth()/2, self.glowImage:getHeight()/2) end end return PowerGrid
package.path = '../lib/?;../lib/?.lua;'..package.path require 'utils.DataHandler' require 'utils.ConfHandler' require 'Runtime.Coredp' if #arg <= 0 then print("<main> missing arguments") os.exit() end -- compile configurations (from parts or composite confs) local configs = ConfHandler.GetFullConfs(arg) -- run Core over each tablex.map(Coredp.run,configs)
-- This is used to make the actual houses db = exports.UCDsql:getConnection() function makeHouses() -- owner, interiorID, x, y, z, houseName, currentPrice, boughtForPrice, initialPrice, sale, open if (type(houseName) ~= "string") then return false end if (type(x) ~= "number") or (type(y) ~= "number") or (type(z) ~= "number") or (type(currentPrice) ~= "number") or (type(boughtForPrice) ~= "number") or (type(initialPrice) ~= "number") or (type(interiorID) ~= "number") then return false end dbExec(db, "INSERT INTO `housing` VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", "UCDhousing", interiorID, x, y, z, houseName, currentPrice, boughtForPrice, initialPrice, 1, 1) end addEvent("UCDhousing.makeHouse", true) addEventHandler("UCDhousing.makeHouse", root, makeHouses)
--This was programmed by vissequ#1301 (Discord). You may use this any way you wish, but please do not remove this credit. local plr = game:GetService("Players").LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local h = char:WaitForChild("Humanoid") local root = char:WaitForChild("HumanoidRootPart") local fallSound = script:WaitForChild("Fallsound") local anim = h:LoadAnimation(script:WaitForChild("FreeFallOnBack")) local p1,p2,dis,direction local fallCount = 0 local falling = false wait(20) print"enabling fall animation script" while wait(.1) do p1 = root.Position.Y wait(.1) p2 = root.Position.Y if p2 > p1 then --print("Moving up") direction = "Up" elseif p2 < p1 then --print("Moving down") direction = "Down" end dis = p1 - p2 if dis < 0 then dis = dis * -1 end if dis > 1 and h.PlatformStand == false and h.Sit == false then --print("Player moved "..direction) if direction == "Down" and dis > 5 then --print("Player is falling") fallCount = fallCount + 1 if fallCount > 2 then if falling == false then falling = true anim.Looped = true print("Play fall animation") anim:Play() fallSound:Play() wait(2.2) anim:Stop() falling = false fallCount = 0 end end end else fallCount = 0 end end
--[[ Controller Class Author: zipang github.com/zipang The Controller is responsible for unifying all INPUTS (keyboard, gamepads) into a single object. Actions can be registered on specific keys or buttons evants ]] Class = require("lib.hump.class") local unpack = unpack or table.unpack local isKeyDown = love.keyboard.isDown local PLAYER1, PLAYER2 = unpack(love.joystick.getJoysticks()) -- Load some custom Gamepad mappings love.joystick.loadGamepadMappings( "0500000049190000020400001b010000,GamepadPlus,a:b0,b:b1,x:b3,y:b4,back:b10,start:b11,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,platform:Linux," ) love.joystick.loadGamepadMappings( "030000003512000011ab000010010000,8BitDo FC30,a:b2,b:b1,x:b3,y:b0,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,dpup:a1,dpleft:a0,dpdown:a2,dpright:a3,platform:Linux," ) love.joystick.loadGamepadMappings( "0500000038426974646f204643333000,8Bitdo FC30 Bluetooth,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,dpleft:h0.8,dpright:h0.2,dpup:h0.1,platform:Linux," ) Controller = Class({}) function Controller:init(player1_definitions, player2_definitions) if PLAYER1 then print("DETECTED GAMEPAD #1 : '" .. PLAYER1:getName() .. "' [" .. PLAYER1:getGUID() .. "]") end if PLAYER2 then print("DETECTED GAMEPAD #2 : '" .. PLAYER2:getName() .. "' [" .. PLAYER2:getGUID() .. "]") end player1_definitions = player1_definitions or {} player2_definitions = player2_definitions or {} self.actions_definitions = { keyboard = { player1_definitions.keyboard or {}, player2_definitions.keyboard or {}, }, gamepad = { player1_definitions.gamepad or {}, player2_definitions.gamepad or {}, }, } self.playerActions = { {}, {} } -- player1 table, player 2 table -- Auto-register function love.gamepadpressed(joystick, button) self:onGamepadpressed(joystick, button) end -- function love.gamepadreleased(joystick, button) -- self:onGamepadpressed(joystick, button) -- end end function Controller:reset() -- for i = 1, 2 do -- local actions = self.playerActions[i] -- for j = 1, #actions do -- actions[j] = nil -- end -- end self.playerActions = { {}, {} } -- player1 table, player 2 table end function Controller:action(playerIndex, action) return self.playerActions[playerIndex][action] or false end function Controller:hasGamepad(playerIndex) if playerIndex == 1 then return PLAYER1 ~= nil elseif playerIndex == 2 then return PLAYER2 ~= nil else return false end end -- Call this inside love.keypressed function Controller:onKeypressed(key) local def1, def2 = unpack(self.actions_definitions.keyboard) -- Check for key mappings existing on player 1 if def1[key] then table.insert(self.playerActions[1], def1[key]) elseif def2[key] then -- and on player 2.. table.insert(self.playerActions[2], def2[key]) end end -- Call this inside love.gamepadpressed function Controller:onGamepadpressed(joystick, button) local def1, def2 = unpack(self.actions_definitions.gamepad) local buttonPressed = "_" .. button -- This action is true as long as the button is pressed -- Check for gamepad mappings on player 1 if joystick == PLAYER1 then if def1[button] then print("DOWN #1", button, "mapped to", def1[button]) table.insert(self.playerActions[1], def1[button]) elseif def1[buttonPressed] then print("DOWN #1", button, "mapped to", def1[buttonPressed]) self.playerActions[1][def1[buttonPressed]] = true end end -- Check for gamepad mappings on player 2 if joystick == PLAYER2 and def2[button] then if def2[button] then print("DOWN #2", button, "mapped to", def2[button]) table.insert(self.playerActions[2], def2[button]) elseif def2[buttonPressed] then print("DOWN #1", button, "mapped to", def1[buttonPressed]) self.playerActions[2][def2[buttonPressed]] = true end end end function Controller:onGamepadreleased(joystick, button) local def1, def2 = unpack(self.actions_definitions.gamepad) local buttonPressed = "_" .. button if joystick == PLAYER1 and def1[buttonPressed] then self.playerActions[1][def1[buttonPressed]] = false elseif joystick == PLAYER2 and def2[buttonPressed] then self.playerActions[2][def2[buttonPressed]] = false end end function Controller:update(dt) local actions_player1, actions_player2 = unpack(self.playerActions) -- Arrow keys are allways mapped to the player 1 if isKeyDown("right") then actions_player1.right = true elseif isKeyDown("left") then actions_player1.left = true end if isKeyDown("up") then actions_player1.up = true elseif isKeyDown("down") then actions_player1.down = true end -- Map Gamepad 1 directions if PLAYER1 then local leftx = PLAYER1:getGamepadAxis("leftx") if leftx < 0 then actions_player1.left = true elseif leftx > 0 then actions_player1.right = true end local lefty = PLAYER1:getGamepadAxis("lefty") if lefty > 0 then actions_player1.down = true elseif lefty < 0 then actions_player1.up = true end end -- Map Gamepad 2 directions if PLAYER2 then local leftx = PLAYER2:getGamepadAxis("leftx") if leftx < 0 then actions_player2.left = true elseif leftx > 0 then actions_player2.right = true end local lefty = PLAYER2:getGamepadAxis("lefty") if lefty > 0 then actions_player2.down = true elseif lefty < 0 then actions_player2.up = true end end return { actions_player1, actions_player2 } end return Controller
-- Generated by CSharp.lua Compiler local System = System local SlipeExports local SlipeMtaDefinitions local SlipeSharedElements local SystemXml System.import(function (out) SlipeExports = Slipe.Exports SlipeMtaDefinitions = Slipe.MtaDefinitions SlipeSharedElements = Slipe.Shared.Elements SystemXml = System.Xml end) System.namespace("Slipe.Shared.Resources", function (namespace) -- <summary> -- Represents an MTA resource -- </summary> namespace.class("SharedResource", function (namespace) local getName, getDynamicRoot, getRoot, getState, getExportedFunctions, Config, Invoke getName = function (this) return SlipeMtaDefinitions.MtaShared.GetResourceName(this.MtaResource) end getDynamicRoot = function (this) return SlipeSharedElements.ElementManager.getInstance():GetElement1(SlipeMtaDefinitions.MtaShared.GetResourceDynamicElementRoot(this.MtaResource)) end getRoot = function (this) return SlipeSharedElements.ElementManager.getInstance():GetElement1(SlipeMtaDefinitions.MtaShared.GetResourceRootElement(this.MtaResource)) end getState = function (this) return SlipeMtaDefinitions.MtaShared.GetResourceState(this.MtaResource) end getExportedFunctions = function (this) return SlipeMtaDefinitions.MtaShared.GetArrayFromTable(SlipeMtaDefinitions.MtaShared.GetResourceExportedFunctions(this.MtaResource), "System.String", T) end -- <summary> -- This function is used to return the root node of a configuration file. -- </summary> Config = function (this, filePath) local mtaNode = SlipeMtaDefinitions.MtaShared.GetResourceConfig(filePath) local document = SystemXml.XmlDocument() local xmlNode = document:CreateElement(SlipeMtaDefinitions.MtaShared.XmlNodeGetName(mtaNode)) xmlNode:index(mtaNode) return xmlNode end Invoke = function (this, functionName, parameters) do local export = exports[this:getName()] return export[functionName](export, unpack(parameters)) end return SlipeExports.Export.Invoke(getName(this), functionName, parameters) end return { getName = getName, getDynamicRoot = getDynamicRoot, getRoot = getRoot, getState = getState, getExportedFunctions = getExportedFunctions, Config = Config, Invoke = Invoke, __metadata__ = function (out) return { properties = { { "DynamicRoot", 0x206, out.Slipe.Shared.Elements.Element, getDynamicRoot }, { "ExportedFunctions", 0x206, System.Array(System.String), getExportedFunctions }, { "MtaResource", 0x3, out.Slipe.MtaDefinitions.MtaResource }, { "Name", 0x206, System.String, getName }, { "Root", 0x206, out.Slipe.Shared.Elements.Element, getRoot }, { "State", 0x206, System.String, getState } }, methods = { { "Config", 0x186, Config, System.String, System.Xml.XmlNode }, { "Invoke", 0x286, Invoke, System.String, System.Array(System.Object), System.Object } }, class = { 0x6 } } end } end) end)
--_swap tool____________ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) pos.y = pos.y local name = minetest.get_node(pos).name if name ~= "default:sand" and name ~= "default:silver_sand" and name ~= "default:desert_sand" then return end pos.y = pos.y if puncher:get_wielded_item():get_name() == "summer:rake" then minetest.remove_node(pos) node.name = "summer:sabbia_mare" minetest.set_node(pos, node) minetest.sound_play("summer_n_swap", { to_player = "", gain = 2.0,}) end end ) --SABBIA minetest.register_node("summer:sabbia_mare", { description = "Sabbiamare", tiles = {"sabbia_mare_2.png"}, --groups = {crumbly = 2, falling_node = 1}, --groups = {cracky = 3, stone = 1}, drop = 'summer:sabbia_mare', --legacy_mineral = true, groups = {crumbly = 3, falling_node = 1, sand = 1}, sounds = default.node_sound_sand_defaults(), --sounds = default.node_sound_stone_defaults(), }) minetest.register_tool("summer:rake", { description = "rake", inventory_image = "rake.png", [[on_place = function(itemstack, user, pointed_thing) minetest.sound_play("summer_n_swap_2", { to_player = user:get_player_name() , gain = 2.0 })]] })
-- https://github.com/nvim-treesitter/nvim-treesitter local wo = vim.wo -- Folding wo.foldmethod = "expr" wo.foldexpr = "nvim_treesitter#foldexpr()" require("nvim-treesitter.configs").setup( { ensure_installed = "maintained", -- https://github.com/nvim-treesitter/nvim-treesitter#highlight highlight = { enable = true, use_languagetree = true }, -- https://github.com/nvim-treesitter/nvim-treesitter#incremental-selection incremental_selection = { enable = true, keymaps = { init_selection = "gnn", node_innremental = "grn", scope_incremental = "grc", node_decremental = "grm", }, }, -- https://github.com/nvim-treesitter/nvim-treesitter#indentation indent = { enable = true }, -- https://github.com/andymass/vim-matchup matchup = { enable = true }, -- https://github.com/nvim-treesitter/nvim-treesitter-refactor refactor = { smart_rename = { enable = true, keymaps = { smart_rename = "grr" } }, highlight_definitions = { enable = true }, highlight_current_scope = { enable = true }, navigation = { enable = true, test = {} }, }, -- https://github.com/nvim-treesitter/nvim-treesitter-textobjects textobjects = { -- https://github.com/nvim-treesitter/nvim-treesitter-textobjects#text-objects-select select = { enable = true, keymaps = { ["af"] = "@function.outer", ["if"] = "@function.inner", ["aC"] = "@class.outer", ["iC"] = "@class.inner", ["ac"] = "@conditional.outer", ["ic"] = "@conditional.inner", ["ae"] = "@block.outer", ["ie"] = "@block.inner", ["al"] = "@loop.outer", ["il"] = "@loop.inner", ["is"] = "@statement.inner", ["as"] = "@statement.outer", ["ad"] = "@comment.outer", ["am"] = "@call.outer", ["im"] = "@call.inner", -- or you use the queries from supported languages with textobjects.scm --[[ ["iF"] = { python = "(function_definition) @function", cpp = "(function_definition) @function", c = "(function_definition) @function", java = "(method_declaration) @function", }, ]] }, }, -- https://github.com/nvim-treesitter/nvim-treesitter-textobjects#text-objects-swap swap = { enable = true, swap_next = { ["<leader>a"] = "@parameter.inner" }, swap_previous = { ["<leader>A"] = "@parameter.inner" }, }, -- https://github.com/nvim-treesitter/nvim-treesitter-textobjects#text-objects-move move = { enable = true, set_jumps = true, goto_next_start = { ["]m"] = "@function.outer", ["]]"] = "@class.outer", }, goto_next_end = { ["]M"] = "@function.outer", ["]["] = "@class.outer", }, goto_previous_start = { ["[m"] = "@function.outer", ["[["] = "@class.outer", }, goto_previous_end = { ["[M"] = "@function.outer", ["[]"] = "@class.outer", }, }, -- https://github.com/nvim-treesitter/nvim-treesitter-textobjects#textobjects-lsp-interop lsp_interop = { enable = true, peek_definition_code = { ["df"] = "@function.outer", ["dF"] = "@class.outer", }, }, }, -- https://github.com/nvim-treesitter/playground playground = { enable = true, updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code persist_queries = false, -- Whether the query persists across vim sessions keybindings = { toggle_query_editor = "o", toggle_hl_groups = "i", toggle_injected_languages = "t", toggle_anonymous_nodes = "a", toggle_language_display = "I", focus_language = "f", unfocus_language = "F", update = "R", goto_node = "<cr>", show_help = "?", }, }, -- https://github.com/nvim-treesitter/playground#query-linter query_linter = { enable = true, use_virtual_text = true, lint_events = { "BufWrite", "CursorHold" }, }, -- https://github.com/p00f/nvim-ts-rainbow rainbow = { enable = true, iextended_mode = true, -- Highlight also non-parentheses delimiters max_file_lines = 1000, }, -- https://github.com/JoosepAlviste/nvim-ts-context-commentstring context_commentstring = { enable = true, enable_autocmd = true, config = { dotenv = "# %s" }, }, } )
local helpers = {} local auto_space = require("nvim-autospace") auto_space.setup({ rule = { ['$']= { before = {prev = "[a-zA-Z0-9'\"%]%)]", next = "."}, after = {prev = ".", next = "[a-zA-Z0-9'\"%(]"} }, } }) local eq = assert.are.same function helpers.feed(text, feed_opts) feed_opts = feed_opts or 'n' local to_feed = vim.api.nvim_replace_termcodes(text, true, false, true) vim.api.nvim_feedkeys(to_feed, feed_opts, true) end function helpers.insert(text) helpers.feed('i' .. text, 'x') end local data = { { name = "normal space" , filetype = "lua", before = [[local a=a+b]], after = [[local a = a + b]] }, { name = "lua ~ char" , filetype = "lua", before = [[if a~=a+b then]], after = [[if a ~= a + b then]] }, { name = "lua .. char" , filetype = "lua", before = [["aa".."bb"]], after = [["aa" .. "bb"]] }, { name = "javascript char !" , filetype = "javascript", before = [[if(a!=a+b) then]], after = [[if(a != a + b) then]] }, { name = "char + before char ] " , filetype = "javascript", before = [[ a[2]+a[4] ]], after = [[ a[2] + a[4] ]] }, { name = "char $ custom setup " , filetype = "javascript", before = [[ a[2]$a[4] ]], after = [[ a[2] $ a[4] ]] }, { name = "char >" , filetype = "javascript", before = [[local a>=b]], after = [[local a >= b]] }, { name = "char + quote " , filetype = "javascript", before = [['name' : '+replace']], after = [['name' : '+replace']] }, { name = "char - with number " , filetype = "javascript", before = [[charIndex -(next_char[2]-prev_char[2]) -2;(-2+2-2)]], after = [[charIndex - (next_char[2] - prev_char[2]) -2;(-2 + 2 -2)]] }, { name = "char > empty char with single quote with quote", filetype = "vim", before = [[noremap <silent> <c-t>j V:m '>+1<CR>gv=gv]], after = [[noremap <silent> <c-t>j V:m '>+1<CR>gv=gv]] }, { name = "remove empty char on word" , filetype = "javascript", before = [[ aaa aaaa]], after = [[ aaa aaaa]] }, { name = "remove empty char on word not inside quote", filetype = "javascript", before = [[ aaa aaaa "aa \"aaa" aaa bbbb]], after = [[ aaa aaaa "aa \"aaa" aaa bbbb]] }, { name = "remove empty char with single quote" , filetype = "javascript", before = [[(dsada , sadas ,)]], after = [[(dsada, sadas,)]] }, { name = "remove empty char with single quote with quote" , filetype = "javascript", before = [[(dsada , sadas ,"aaa , a")]], after = [[(dsada, sadas, "aaa , a")]] }, } local run_data = {} for _, value in pairs(data) do if value.only == true then table.insert(run_data, value) break end end if #run_data == 0 then run_data = data end describe('autospace ', function() for _, value in pairs(run_data) do it("test "..value.name, function() local before = string.gsub(value.before , '%|' , "") local after = string.gsub(value.after , '%|' , "") local line = 1 if value.filetype ~= nil then vim.bo.filetype = value.filetype else vim.bo.filetype = "text" end vim.fn.setline(line , before) vim.fn.setpos('.' ,{0, line, 0, 0}) auto_space.format(0) local result = vim.fn.getline(line) eq(after, result , "\n\n text error: " .. value.name .. "\n") end) end if #run_data > 1 then it("test skip filetype", function() vim.bo.filetype = "text" vim.fn.setline(1 , "a=a+b" ) auto_space.format() local result = vim.fn.getline(1) eq("a = a + b", result , "file text error") end) end end)
---@classmod Faction Faction = Class{} ---Initiate a faction from its definition. You shouldn't use this function, the game uses it at loadtime to instantiate the factions. --@param data Table. The table of faction data. --@return self Faction. The faction itself. function Faction:init(fid) local data = possibleFactions[fid] self.id = fid for key, val in pairs(data) do if type(val) ~= "function" then self[key] = data[key] end end self.baseType = "faction" self.inventory = {} self.offers_services = self.offers_services or {} self.teaches_spells = self.teaches_spells or {} self:generate_items() if data.generateName then self.name = data.generateName(self) elseif self.nameType then self.name = namegen:generate_name(self.nameType,self) end self.event_countdown = self.event_cooldown or gamesettings.default_event_cooldown return self end ---Determine if a creature is an enemy of the faction. --@param creature Creature. The creature to test for enmity. --@return Boolean. Whether the creature is an enemy or not. function Faction:is_enemy(creature) --First things first, never consider fellow faction members an enemy (unless you're an infighting faction) if not self.attack_own_faction and creature:is_faction_member(self.id) then return false end --Secondly, if you just attack everyone who's not a friend, we can just assume you're an enemy if self.attack_all_neutral == true and not self:is_friend(creature) then return true end --Next, if the creature is a player ally and the faction is always hostile to the player regardless of favor and membership, we can just assume they're an enemy if creature.playerAlly == true and self.always_attack_player == true then return true end --Next, account for enemy factions: if self.enemy_factions then for _,fac in pairs(self.enemy_factions) do if creature:is_faction_member(fac) then return true end --end is_type if end --end faction for end --Next, account for enemy creature types: if self.enemy_types then for _,ctype in pairs(self.enemy_types) do if creature:is_type(ctype) then return true end --end is_type if end --end ctype for end --end if self.enemy_types --Next, look if the creature's favor with your faction is low enough to be considered an enemy if self.hostile_threshold and creature.favor and (creature.favor[self.id] or 0) < self.hostile_threshold then return true end --Next, if the creature is a player or a friend of the player, we'll look at some player-specific stuff if creature.playerAlly then --By default, everyone finds the player an enemy if they're not explicitly a friend if not self.attack_enemy_player_only and not self:is_friend(player) then return true end --We don't need to look into if the player's otherwise an enemy, because that'll be handled by the above sections end --end playerally if --Finally, if none of the above was true, they're not your enemy return false end ---Determine if the faction considers a creature a friend or not. --@param creature Creature. The creature to test for friendship. --@return Boolean. Whether the creature is a friend or not. function Faction:is_friend(creature) --First things first, always consider fellow faction members a friend (unless you're an infighting faction) if not self.attack_own_faction and creature:is_faction_member(self.id) then return true end --Next, look at factions: if self.friendly_factions then for _,fac in pairs(self.friendly_factions) do if creature:is_faction_member(fac) then return true end --end is_type if end --end faction for end --end if self.friendly_factions --Next, account for friendly creature types: if self.friendly_types then for _,ctype in pairs(self.friendly_types) do if creature:is_type(ctype) then return true end --end is_type if end --end ctype for end --end if self.friendly_types --Finally, look if the creature's favor with your faction is high enough to be considered an friend if self.hostile_threshold and creature.favor and (creature.favor[self.id] or 0) > self.friendly_threshold then return true end return false end ---Have a creature become a member of the faction. --@param creature Creature. The creature that's joining. (optional, defaults to the player) function Faction:join(creature) creature = creature or player if not creature:is_faction_member(self.id) then creature.factions[#creature.factions+1] = self.id end end ---Have a creature leave as a member of the faction. --@param creature Creature. The creature that's leaving. (optional, defaults to the player) function Faction:leave(creature) creature = creature or player if creature:is_faction_member(self.id) then local k = in_table(self.id,creature.factions) table.remove(creature.factions,k) end end ---Test if a creature can become a member of the faction. --@param creature Creature. The creature that's a potential applicant. (optional, defaults to the player) --@return Boolean. Whether the creature can join or not. --@return String. Details on why the creature can't join. (nil if they can join) function Faction:can_join(creature) creature = creature or player local canJoin = true local reasons = nil if self.never_join then return false,"This faction does not accept new members." end if (creature.favor[self.id] or 0) < self.join_threshold then reasons = (reasons and reasons .. " " or "") .. "You need more than " .. self.join_threshold .. " favor to join." canJoin = false end if self.enemy_factions then for _,enemy in ipairs(self.enemy_factions) do if player:is_faction_member(enemy) then reasons = (reasons and reasons .. " " or "") .. "You're a member of the enemy faction " .. currWorld.factions[enemy].name .. "." canJoin = false end end end if self.enemy_types then for _,ctype in pairs(self.enemy_types) do if creature:is_type(ctype) then reasons = (reasons and reasons .. " " or "") .. "Your kind is not welcome here." canJoin = false end --end is_type if end --end ctype for end --end if self.enemy_types if self.join_requirements then local bool,rejectionText = self:join_requirements(creature) if bool == false then canJoin = false if rejectionText then reasons = (reasons and reasons .. " " or "") .. rejectionText end end end --end join_requirements if return canJoin,reasons end ---Have a creature learn a spell from a faction. --@param spellID String. The ID of the spell they're trying to learn. --@param creature Creature. The creature learning the spell. (optional, defaults to the player) --@return Boolean. Whether learning the spell was successful or not. function Faction:teach_spell(spellID,creature) creature = creature or player if creature:has_spell(spellID) then return false end --Get the spell info: local spellInfo = nil for _,s in ipairs(self.teaches_spells) do if s.spell == spellID then spellInfo = s break end end if not spellInfo then return false end --Pay the price: if spellInfo.moneyCost then creature.money = creature.money - (spellInfo.moneyCost+round(spellInfo.moneyCost*(self:get_cost_modifier(player)/100))) end if spellInfo.favorCost then creature.favor[self.id] = creature.favor[self.id] - spellInfo.favorCost end --Teach it, finally: creature:learn_spell(spellID) end ---Generates the faction's inventory function Faction:generate_items() --Do custom stocking code: if possibleFactions[self.id].generate_items then if possibleFactions[self.id].generate_items(self) == false then return end end --Generate items from list: local tags = self.passedTags if not self.sells_items then return end for _,info in pairs(self.sells_items) do local itemID = info.item local item = Item(itemID,(info.passed_info or (possibleItems[itemID].acceptTags and tags) or nil),(info.amount or -1)) if info.artifact then mapgen:make_artifact(item,tags) elseif info.enchantments then for _,eid in ipairs(info.enchantments) do item:apply_enchantment(eid,-1) end end self:add_item(item,info) end --Generate dynamic inventory: if self.random_item_amount then local possibles = self:get_possible_random_items() if count(possibles) > 0 then for i=1,self.random_item_amount,1 do self:generate_random_item(possibles) end --end random_item_amount for end --end possibles count if end --end random items if end ---Restocks the faction's inventory. Default behavior: Restock all defined items up to their original amount, unless restock_amount or restock_to is set. function Faction:restock() --Delete items marked to delete on restock: for id,info in pairs(self.inventory) do if info.delete_on_restock then table.remove(self.inventory,id) end end --Do custom restocking code: if possibleFactions[self.id].restock then if possibleFactions[self.id].restock(self) == false then return end end --Do defined items if self.sells_items then local tags = self.passedTags for _,info in pairs(self.sells_items) do if info.amount and info.amount ~= -1 then --don't restock infinite-stock items local itemID = info.item local item = Item(itemID,(info.passed_info or (possibleItems[itemID].acceptTags and tags) or nil),(info.amount or -1)) local index = self:get_inventory_index(item) local currAmt = self:get_count(item) or 0 local restock_amt = info.restock_amount or 0 local restock_to = (info.restock_to or (restock_amt >= 0 and info.amount or 0)) if (restock_amt >= 0 and currAmt < restock_to) or (restock_amt < 0 and currAmt > restock_to) then local final_restock = (restock_amt >= 0 and math.min((restock_amt > 0 and restock_amt or restock_to),restock_to-currAmt) or (restock_amt < 0 and math.max(restock_amt or restock_to,restock_to-currAmt))) if final_restock < 0 then self.inventory[index].item.amount = self.inventory[index].item.amount+final_restock if self.inventory[index].item.amount <= 0 then table.remove(self.inventory,index) end else self:add_item(item,info) end end --end currAmt < restock to amount end --end if amount end --end sells_items for end --end if self.sells_items --Restock randomly generated items: if self.random_item_amount then local random_inv = 0 local restock_to = (self.random_item_restock_to or self.random_item_amount) for _,inv in ipairs(self.inventory) do if inv.randomly_generated then random_inv = random_inv + (inv.item.amount or 1) end end --end random for local final_restock = math.min(self.random_item_restock_amount or restock_to,restock_to-random_inv) if final_restock > 0 then local possibles = self:get_possible_random_items() if count(possibles) > 0 then for i=1,final_restock,1 do self:generate_random_item(possibles) end --end random_item_amount for end --end possibles count if end end --end if random_item_amount end ---Adds an item to the faction store. If the store already has this item, increase the amount --@param item Item. The item to add --@param info Table. The information to pass function Faction:add_item(item,info) local makeNew = true info = info or {} info.cost = info.cost or item:get_value()*(self.markup or 1) local index = self:get_inventory_index(item) if index then self.inventory[index].item.amount = self.inventory[index].item.amount+item.amount makeNew = false end if makeNew == true then local id = #self.inventory+1 self.inventory[id] = {item=item,id=id} if info then for i,k in pairs(info) do self.inventory[id][i] = self.inventory[id][i] or k end end end --end if makenew end ---Gets a list of the items the faction is selling --@return Table. The list of items the faction has in stock function Faction:get_inventory() return self.inventory end ---Gets the numbers of items this faction has in its current inventory that matches a passed item --@param item Item. The item to count. --@return Number. The number of items function Faction:get_count(item) local iCount = 0 for id,info in ipairs(self:get_inventory()) do if item:matches(info.item) then if info.amount == -1 then return -1 end iCount = iCount + (info.item.amount or 1) end end return iCount end ---Gets a list of the items that a creature can sell to a faction --@param creat Creature. The creature selling. Optional, defaults to the player --@return Table. The list of items the player can sell, each of which is another table in the format {item=Item,cost=Number} function Faction:get_buy_list(creat) creat = creat or player local buying = {} for id,item in ipairs(creat.inventory) do if self.buys_items and self.buys_items[item.id] then buying[#buying+1]={item=item,moneyCost=self.buys_items[item.id].moneyCost,favorCost=self.buys_items[item.id].favorCost} elseif self.buys_tags and item.value then for _,tag in ipairs(self.buys_tags) do if item:has_tag(tag) or item.itemType == tag then buying[#buying+1]={item=item,favorCost=math.floor(item:get_value()/(self.money_per_favor or 10)),moneyCost=(not self.only_pays_favor and item:get_value() or nil)} end end end end return buying end ---Sell an item to the faction --@param item Item. The item being sold --@param moneyCost Number. The amount of money the faction will pay per item. --@param favorCost Number. The amount of favor the faction will pay per item. --@param amt Number. The amount of the item being sold. Optional, defaults to 1 --@param creat Creature. The creature selling. Optional, defaults to the player function Faction:creature_sells_item(item,moneyCost,favorCost,amt,creature) creature = creature or player moneyCost = moneyCost or 0 favorCost = favorCost or 0 local totalAmt = item.amount or 1 if amt > totalAmt then amt = totalAmt end local totalCost = moneyCost*amt local totalFavor = favorCost*amt local givenItem = item if item.amount > amt then item.owner = nil --This is done because item.owner is the creature who owns the item, and Item:clone() does a deep copy of all tables, which means it will create a copy of the owner, which owns a copy of the item, which is owned by another copy of the owner which owns another copy of the item etc etc leading to a crash givenItem = item:clone() givenItem.amount = amt item.owner = creature end self:add_item(givenItem) creature:delete_item(item,amt) creature.favor[self.id] = (creature.favor[self.id] or 0) + totalFavor if self.currency_item then local creatureItem = creature:has_item(self.currency_item) if not creatureItem then creatureItem = Item(self.currency_item) creature:give_item(creatureItem) creatureItem.amount = totalCost else creatureItem.amount = creatureItem.amount+totalCost end else creature.money = creature.money+totalCost end end ---Buy an item from the faction --@param item Item. The item being sold --@param moneyCost Number. The amount of money the faction is charging per item. --@param favorCost Number. The amount of favor the faction is charging per item. --@param amt Number. The amount of the item being sold. Optional, defaults to 1. --@param creat Creature. The creature selling. Optional, defaults to the player. --@return Boolean, Text/nil. True and nil if the buying was successful, False and a string if there's a reason the buying didn't go through. function Faction:creature_buys_item(item,moneyCost,favorCost,amt,creature) creature = creature or player moneyCost = moneyCost or 0 favorCost = favorCost or 0 local totalAmt = item.amount or 1 if totalAmt == -1 then totalAmt = 9999999 end if amt > totalAmt then amt = totalAmt end local totalCost = moneyCost*amt local totalFavorCost = favorCost*amt local canBuy = false local creatureItem = nil if self.currency_item then creatureItem = creature:has_item(self.currency_item) canBuy = (creatureItem.amount >= totalCost) else canBuy = (creature.money >= totalCost) end --end currency checks if canBuy and creature.favor[self.id] >= totalFavorCost then if amt == totalAmt then if item.stacks or totalAmt == 1 then creature:give_item(item) elseif not item.stacks then for i=1,amt,1 do local newItem = item:clone() newItem.amount = nil creature:give_item(newItem) end end local id = self:get_inventory_index(item) table.remove(self.inventory,id) creature.favor[self.id] = (creature.favor[self.id] or 0) - totalFavorCost if self.currency_item then creatureItem.amount = creatureItem.amount-totalCost else creature.money = creature.money-totalCost end elseif item.stacks then local newItem = item:clone() if item.amount ~= -1 then item.amount = item.amount - amt end newItem.amount = amt creature:give_item(newItem) creature.favor[self.id] = (creature.favor[self.id] or 0) - totalFavorCost if self.currency_item then creatureItem.amount = creatureItem.amount-totalCost else creature.money = creature.money-totalCost end else --if buying a nonstackable item for i=1,amt,1 do local newItem = item:clone() newItem.amount = 1 creature:give_item(newItem) end if item.amount ~= -1 then item.amount = item.amount - amt end creature.favor[self.id] = (creature.favor[self.id] or 0) - totalFavorCost if self.currency_item then creatureItem.amount = creatureItem.amount-totalCost else creature.money = creature.money-totalCost end end return true end return false,"You don't have enough money or favor to buy " .. item:get_name(true,amt) .. " ." end ---Gets the index within the faction's inventory of the item in question --@param item Item. The item to seach for. --@return Number. The index ID of the item. function Faction:get_inventory_index(item) for id,info in ipairs(self:get_inventory()) do if item:matches(info.item) then return id end end end ---Get all possible random items the faction can stock --@return Table. A list of the item IDs function Faction:get_possible_random_items() local possibles = {} for id,item in pairs(possibleItems) do local done = false for _,tag in ipairs(self.sells_tags) do if item.value and not item.neverSpawn and (in_table(tag,item) or item.itemType == tag) then possibles[#possibles+1] = id done = true break end end end return possibles end ---Generate a random item from the faction's possible random items list --@param list Table. A list of item IDs to pull from. Optional, defaults to the list from get_possible_random_items() function Faction:generate_random_item(list) local possibles = list or self:get_possible_random_items() local itemID = possibles[random(#possibles)] local tags = self.passedTags local item = Item(itemID,(possibleItems[itemID].acceptTags and tags or nil)) if random(1,100) <= (self.artifact_chance or gamesettings.artifact_chance) then mapgen:make_artifact(item,tags) elseif random(1,100) <= gamesettings.enchantment_chance then local possibles = item:get_possible_enchantments(true) if count(possibles) > 0 then local eid = get_random_element(possibles) item:apply_enchantment(eid,-1) end end if not item.amount then item.amount = 1 end --This is here because non-stackable items don't generate with amounts self:add_item(item,{randomly_generated=true,delete_on_restock=self.delete_random_items_on_restock}) end ---Gets the modifier for items sold in the faction store function Faction:get_cost_modifier(creature) creature = creature or player local finalMod = 0 if self.faction_cost_modifiers then for faction,mod in pairs(self.faction_cost_modifiers) do if creature:is_faction_member(faction) then if math.abs(mod) > math.abs(finalMod) then finalMod = mod end end end --end faction for end --end if faction cost modifiers if self.favor_cost_modifiers then local creatFavor = creature.favor[self.id] or 0 local highest = nil local tempMod = 0 for favor,mod in pairs(self.favor_cost_modifiers) do if creatFavor >= favor and (not highest or favor > highest) then highest = favor tempMod = mod end end --end favor for finalMod = finalMod + tempMod end --end if favor cost modifiers return finalMod+creature:get_bonus('cost_modifier') end
local PluginRoot = script.Parent.Parent.Parent.Parent local Roact = require(PluginRoot.Libs.Roact) local Utilities = require(PluginRoot.Core.Modules.Utilities) local RunService = game:GetService("RunService") local CircleMarquee = Roact.PureComponent:extend("CircleMarquee") function CircleMarquee:init() self.state = { currentRadius = self.props.radius, desiredRadius = self.props.radius, } end function CircleMarquee:didMount() self.hConn = RunService.Heartbeat:Connect(function(dt) local currentRadius = self.state.currentRadius local desiredRadius = self.state.desiredRadius if currentRadius ~= desiredRadius then -- Decided not to use dt for this. -- The frame the selector exits turbo mode, the dt will be huge. -- That ruins the easing effect. local newRadius = Utilities.lerp(currentRadius, desiredRadius, 0.5) if math.abs(newRadius - desiredRadius) < 1 then newRadius = desiredRadius end self:setState({ currentRadius = newRadius }) end end) end function CircleMarquee:willUnmount() self.hConn:Disconnect() end function CircleMarquee.getDerivedStateFromProps(nextProps, lastState) return { desiredRadius = nextProps.radius } end function CircleMarquee:render() local props = self.props local position = props.position local radius = self.state.currentRadius return Roact.createElement("ImageLabel", { Size = UDim2.fromOffset(radius*2-2, radius*2-2), Image = "rbxassetid://5048041217", BackgroundTransparency = 1, ImageTransparency = 0.8, ImageColor3 = Color3.new(0, 0, 0), AnchorPoint = Vector2.new(0.5, 0.5), Position = position, }, (function() local segments = {} local segmentCount = math.max(8, math.floor(2*math.pi*radius / 10)) local segmentLength = 2 * radius * math.sin(math.pi/segmentCount) local inradius = radius * math.cos(math.pi/segmentCount) local color = Color3.new(1, 1, 1) for i = 1, segmentCount do local angle = i/segmentCount * math.pi * 2 local x = math.cos(angle) * inradius local y = math.sin(angle) * inradius table.insert(segments, Roact.createElement("Frame", { BackgroundColor3 = color, BorderSizePixel = 0, Size = UDim2.fromOffset(segmentLength*0.5, 1), AnchorPoint = Vector2.new(0.5, 0.5), Rotation = math.deg(angle + math.pi/2), Position = UDim2.fromOffset(x+radius, y+radius) })) end return segments end)() ) end return CircleMarquee
--!A cross-platform build utility based on Lua -- -- 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. -- -- Copyright (C) 2015 - 2018, TBOOX Open Source Group. -- -- @author ruki -- @file list.lua -- -- imports import("core.project.project") import("core.base.task") import("package") import("repository") import("environment") -- from local/global/system/remote? function _from(instance) local fetchinfo, fetchfrom = instance:fetch() if fetchinfo then return ", ${green}" .. fetchfrom .. "${clear}" elseif #instance:urls() > 0 then return ", ${yellow}remote${clear}" elseif instance:from("system") then return ", ${red}missing${clear}" else return "" end end -- list packages function main() -- list all requires print("The package dependencies:") -- get requires local requires, requires_extra = project.requires() if not requires or #requires == 0 then return end -- enter environment environment.enter() -- pull all repositories first if not exists if not repository.pulled() then task.run("repo", {update = true}) end -- list all packages for _, instance in ipairs(package.load_packages(requires, requires_extra)) do local requireinfo = instance:requireinfo() or {} local packageopt = project.option(instance:alias() or instance:fullname()) if packageopt then cprint(" ${magenta}require${clear}(%s): %s%s%s", requireinfo.originstr, ifelse(instance:version_str(), instance:version_str(), "no version"), _from(instance), ifelse(requireinfo.optional, ", ${yellow}optional${clear}", "")) for _, dep in ipairs(instance:orderdeps()) do requireinfo = dep:requireinfo() or {} cprint(" -> ${magenta}dep${clear}(%s): %s%s%s", requireinfo.originstr, ifelse(dep:version_str(), dep:version_str(), "no version"), _from(dep), ifelse(requireinfo.optional, ", ${yellow}optional${clear}", "")) end end end -- leave environment environment.leave() end
Talk(0, "又有一群大蜘蛛,我得小心点,免得当了蜘蛛的点心.", "talkname0", 1); if TryBattle(64) == true then goto label0 end; Dead(); do return end; ::label0:: ModifyEvent(-2, 32, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2);--by fanyu|战斗结束,移除蜘蛛。场景10-编号32-35,42 ModifyEvent(-2, 33, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2); ModifyEvent(-2, 34, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2); ModifyEvent(-2, 35, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2); ModifyEvent(-2, 42, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2); jyx2_ReplaceSceneObject("","NPC/zhizhu32",""); jyx2_ReplaceSceneObject("","NPC/zhizhu33",""); jyx2_ReplaceSceneObject("","NPC/zhizhu34",""); jyx2_ReplaceSceneObject("","NPC/zhizhu35",""); LightScence(); AddRepute(1); do return end;
local _ENV = TEST_CASE "test.hex" local misc_binary_data = { "", "x\0y", "\0\15\240\255", } function test_trivial_obj () local obj = Filter:new("hex_lower") is("", obj:result()) obj = Filter:new("hex_upper") is("", obj:result()) end function test_misc_lowercase () for num, input in ipairs(misc_binary_data) do local expected = bytes_to_hex(input) is(expected, Filter.hex_lower(input), "lowercase hex for binary test datum " .. num) end end function test_misc_uppercase () for num, input in ipairs(misc_binary_data) do local expected = bytes_to_hex(input):upper() is(expected, Filter.hex_upper(input), "uppercase hex for binary test datum " .. num) end end function test_single_byte_lowercase () for code = 0, 255 do local input = string.char(code) local expected = bytes_to_hex(input) is(expected, Filter.hex_lower(input), "lowercase hex for single byte " .. code) end end function test_single_byte_uppercase () for code = 0, 255 do local input = string.char(code) local expected = bytes_to_hex(input):upper() is(expected, Filter.hex_upper(input), "uppercase hex for single byte " .. code) end end function test_hex_big () local input = "" for code = 0, 255 do input = input .. string.char(code) end local reps = 35 -- big enough to blow the input and output buffers input = input:rep(reps) local expected = bytes_to_hex(input) local got = Filter.hex_lower(input) is(reps * 256 * 2, got:len(), "lowercase hex of large amount of input") is(expected, got, "lowercase hex of large amount of input") expected = expected:upper() got = Filter.hex_upper(input) is(reps * 256 * 2, got:len(), "uppercase hex of large amount of input") is(expected, got, "uppercase hex of large amount of input") end function test_decode_hex () -- Create some test input and expected binary data that matches. local input = " \t\n\r " local expected = "" for code = 0, 255 do input = input .. string.format("%02x%02X", code, code) expected = expected .. string.char(code, code) end input = input .. "\n" for _, data in ipairs(misc_binary_data) do input = input .. Filter.hex_lower(data) .. Filter.hex_upper(data) .. "\n" expected = expected .. data .. data end -- Enough repetitions to make it big enough to deal with in chunks. input = input:rep(100) expected = expected:rep(100) is(expected, Filter.hex_decode(input)) -- Test for digits of the same byte separated by whitespace. is("xyz", Filter.hex_decode("7 87 9\n7\na\n")) -- Check empty input. is("", Filter.hex_decode("")) is("", Filter.hex_decode(" \n\t \r ")) end function test_decode_hex_bad () assert_error("bad character instead of first digit", function () Filter.hex_decode("01 *3 78") end) assert_error("bad character instead of second digit", function () Filter.hex_decode("01 2* 78") end) assert_error("odd number of digits", function () Filter.hex_decode("01 23 7 ") end) end
function HandleSetSpawnCommand(Split, Player) local Response local World = Player:GetWorld() local PlayerX = Player:GetPosX() local PlayerY = Player:GetPosY() local PlayerZ = Player:GetPosZ() if World:SetSpawn(PlayerX, PlayerY, PlayerZ) then Response = SendMessageSuccess(Player, string.format("Successfully changed spawn position to [X:%i Y:%i Z:%i]", PlayerX, PlayerY, PlayerZ)) else Response = SendMessageFailure(Player, "Failed to change spawn position") end return true, Response end
-- Function Availability FileWriteLineFast("test/output.txt", "Function Availability", FM_WRITE); local fa = dofile("test/common/function_availability.lua"); fa.FunctionSupported(TtfInit, "MTR_TtfInit", TtfFunctionSupported); fa.FunctionSupported(TtfQuit, "MTR_TtfQuit", TtfFunctionSupported); fa.FunctionSupported(TtfLoad, "MTR_TtfLoad", TtfFunctionSupported); fa.FunctionSupported(TtfFree, "MTR_TtfFree", TtfFunctionSupported); fa.FunctionSupported(TtfGetWidth, "MTR_TtfGetWidth", TtfFunctionSupported); fa.FunctionSupported(TtfGetHeight, "MTR_TtfGetHeight", TtfFunctionSupported); fa.FunctionSupported(TtfGetSizes, "MTR_TtfGetSizes", TtfFunctionSupported); fa.FunctionSupported(TtfSetSizes, "MTR_TtfSetSizes", TtfFunctionSupported); fa.FunctionSupported(TtfGetStyle, "MTR_TtfGetStyle", TtfFunctionSupported); fa.FunctionSupported(TtfGetOutline, "MTR_TtfGetOutline", TtfFunctionSupported); fa.FunctionSupported(TtfSetStyle, "MTR_TtfSetStyle", TtfFunctionSupported); fa.FunctionSupported(TtfSetOutline, "MTR_TtfSetOutline", TtfFunctionSupported); fa.FunctionSupported(TtfGetGlyphSizes, "MTR_TtfGetGlyphSizes", TtfFunctionSupported); fa.FunctionSupported(TtfGetGlyphWidth, "MTR_TtfGetGlyphWidth", TtfFunctionSupported); fa.FunctionSupported(TtfGetGlyphHeight, "MTR_TtfGetGlyphHeight", TtfFunctionSupported); fa.FunctionSupported(TtfRenderGlyph, "MTR_TtfRenderGlyph", TtfFunctionSupported);
local M = {} local calc_functions = require "core.calc_functions" local relations = require "core.relations" local offers = require "core.offers" local event_system = require "core.event_system" local scenarios_modifiers = { consequences = require "scripts.scenarios_modifiers.consequences" } local is_player local difficulty_list local game_end_callback local update_land_data local accept_offer_callback function M.set_difficulty_list(list) difficulty_list = list end function M.set_is_player_function(callback) is_player = callback end function M.set_game_end_callback(callback) game_end_callback = callback end function M.set_update_land_data_callback(callback) update_land_data = callback end function M.set_accept_offer_callback(callback) accept_offer_callback = callback end function M.get_accept_offer_callback() return accept_offer_callback end local function year_increase() if game_data.year < 1400 then return 3 elseif game_data.year < 1600 then return 2 elseif game_data.year < 1800 then return 1/2 elseif game_data.year < 2000 then return 1/4 elseif game_data.year < 2100 then return 1/6 elseif game_data.year < 2200 then return 1/12 else return 1/64 end end function M.next() -- game_data.previous_moves = deepcopy(game_data.current_moves) game_data.current_moves = {} game_data.previous_shell = deepcopy(game_data.current_shell) game_data.current_shell = {} game_data.previous_tank = deepcopy(game_data.current_tank) game_data.current_tank = {} game_data.previous_chemical = deepcopy(game_data.current_chemical) game_data.current_chemical = {} game_data.previous_explosions = deepcopy(game_data.current_explosions) game_data.current_explosions = {} game_data.previous_planes = deepcopy(game_data.current_planes) game_data.current_planes = {} game_data.used_shell = {} game_data.used_tank = {} game_data.used_chemical = {} game_data.used_explosions = {} game_data.used_planes = {} army_functions.validate_army() offers.handle() calc_functions.calc_lands(game_end_callback, is_player, difficulty_list) army_functions.validate_army() game_data.year = game_data.year + year_increase() game_data.step = game_data.step + 1 for k, v in pairs(game_data.consequence_data) do game_data.consequence_data[k] = game_data.consequence_data[k] - 1 if game_data.consequence_data[k] <= 0 then game_data.consequence_data[k] = nil end end for k, v in pairs(game_data.lands) do if k ~= "Undeveloped_land" and v.num_of_provinces == 0 and not v.defeated then event_system.dispatch("ruined_civilization", k, v.last_attacked) if game_data.lands[k].money > 0 then game_data.lands[v.last_attacked].money = game_data.lands[v.last_attacked].money + game_data.lands[k].money end for key, val in pairs(game_data.lands[k].resources) do if val > 0 then game_data.lands[v.last_attacked].resources[key] = game_data.lands[v.last_attacked].resources[key] + val end end clear_data_about(k) v.defeated = true game_end_callback(k) end end -- local winners = {} for k, v in pairs(game_data.lands) do if k ~= "Undeveloped_land" and not v.defeated then local win = true for key, val in pairs(game_data.lands) do if key ~= k and key ~= "Undeveloped_land" and not val.defeated then if not relations.check_alliance(k, key) and not relations.check_vassal(k, key) and not relations.check_vassal(key, k) then win = false end end end if win then game_end_callback(k, true) break -- table.insert(winners, k) end end end -- calc_functions.write_history() end function M.recruit(land,province, count) game_data.provinces[province].l_a = game_data.provinces[province].l_a + count game_data.provinces[province].p = game_data.provinces[province].p - count game_data.lands[land].money = game_data.lands[land].money - count/army_functions.army_recruit_cost(land) game_data.lands[land].movement_points = game_data.lands[land].movement_points - 1 end function M.move(land,from,to,amount) --print("move",from,to,amount) table.insert(game_data.queue, { land, "move", from,to,amount}) army_functions.set_army(from, army_functions.get_army(from, land) - amount, land) game_data.lands[land].movement_points = game_data.lands[land].movement_points - 1 end function M.dissolve(land, province, percent) local count = math.floor(army_functions.get_army(province, land) * percent) game_data.provinces[province].p = (game_data.provinces[province].p + count) if lume.match(game_data.lands[land].bonuses, function(x) return x[1] == "refund" end) then game_data.dissolved_army_for_gold[land] = game_data.dissolved_army_for_gold[land] or 0 + count * game_values.refund_value end army_functions.set_army(province,math.floor(army_functions.get_army(province, land) - count), land) game_data.lands[land].movement_points = game_data.lands[land].movement_points - 1 end function M.shell(land, from, to, count) game_data.lands[land].resources.weapons = math.floor(game_data.lands[land].resources.weapons - count/game_values.shell_cost) table.insert(game_data.used_shell, {land, from, to}) table.insert(game_data.queue, { land, "shell", from,to,count}) game_data.lands[land].movement_points = game_data.lands[land].movement_points - 1 end function M.open_skill(land, skill) game_data.lands[land].skills = game_data.lands[land].skills - skills_data[skill].cost table.insert(game_data.lands[land].opened_skills, skill) for k, v in pairs(skills_data[skill].bonuses) do if not v[2] then v[2] = 0 end v[3] = "skills" table.insert(game_data.lands[land].bonuses, v) end end function M.set_tax(land, tax) game_data.lands[land].tax = tax end function M.set_ideology(land, ideology) game_data.lands[land].ideology = ideology game_data.lands[land].changed_ideology = game_data.step end function M.build(land, province, building_id) game_data.lands[land].money = game_data.lands[land].money - get_building_cost(land, building_id, game_data.provinces[province].b[building_id]) game_data.provinces[province].b[building_id] = game_data.provinces[province].b[building_id] and game_data.provinces[province].b[building_id] + 1 or 1 local lvl = game_data.provinces[province].b[building_id] local resource_cost = get_building_data(building_id).lvl[lvl].resource_cost if resource_cost then for k, v in pairs(resource_cost) do game_data.lands[land].resources[k] = game_data.lands[land].resources[k] - v end end if scenarios_modifiers[game_data.id] then scenarios_modifiers[game_data.id].build(land, province, building_id) end end function M.destroy(land, province, building_id) game_data.lands[land].money = game_data.lands[land].money + math.floor(get_building_cost(land, building_id, game_data.provinces[province].b[building_id] - 1) * game_values.destroy_building_refund) local lvl = game_data.provinces[province].b[building_id] local resource_cost = get_building_data(building_id).lvl[lvl].resource_cost if resource_cost then for k, v in pairs(resource_cost) do game_data.lands[land].resources[k] = game_data.lands[land].resources[k] + math.floor(v * game_values.destroy_building_refund) end end game_data.provinces[province].b[building_id] = nil if scenarios_modifiers[game_data.id] then scenarios_modifiers[game_data.id].destroy(land, province, building_id) end end function M.peace(from, to, reason) if relations.is_vassal(to) then to = game_data.lands[to].vassal end if not relations.is_vassal(from) then offers.register("peace", from, to, reason) end end function M.pact(from, to, reason) if relations.is_vassal(to) then to = game_data.lands[to].vassal end if not relations.is_vassal(from) then print("Register pact offer:", from, to) offers.register("pact", from, to, reason) end end function M.war(from, to, reason) if relations.is_vassal(to) then to = game_data.lands[to].vassal end if not relations.is_vassal(from) then log(from.." declared war on "..to) offers.register("war", from, to, reason) end end function M.alliance(from, to, reason) if relations.is_vassal(to) then to = game_data.lands[to].vassal end if not relations.is_vassal(from) then offers.register("alliance", from, to, reason) end end function M.break_alliance(from, to, reason) if relations.is_vassal(to) then to = game_data.lands[to].vassal end if not relations.is_vassal(from) then log(from.." declared break_alliance on "..to) offers.register("break_alliance", from, to, reason) end end function M.air_attack(land, from, to) table.insert(game_data.used_planes, {land, from}) table.insert(game_data.queue, { land, "air_attack", from, to, game_data.provinces[from].b.aerodrome}) game_data.lands[land].movement_points = game_data.lands[land].movement_points - 1 end function M.tank(land, from, to) game_data.lands[land].resources.tank = game_data.lands[land].resources.tank - 1 table.insert(game_data.used_tank, {land, to}) table.insert(game_data.queue, { land, "tank", from, to}) game_data.lands[land].movement_points = game_data.lands[land].movement_points - 1 end function M.chemical_weapon(land, from, to) local from_province = from local province = to game_data.lands[land].resources.chemical_weapon = game_data.lands[land].resources.chemical_weapon - 1 table.insert(game_data.used_chemical, {land, province}) table.insert(game_data.queue, { land, "chemical", from_province, province}) game_data.lands[land].movement_points = game_data.lands[land].movement_points - 1 end function M.nuclear_weapon(land, province) game_data.lands[land].resources.uranium = game_data.lands[land].resources.uranium - game_values.nuclear_weapon_cost_uranium table.insert(game_data.used_explosions, {land, province}) table.insert(game_data.queue, { land, "nuclear", province}) game_data.lands[land].movement_points = game_data.lands[land].movement_points - 1 -- pprint("Nuclear queue:", game_data.queue) end function M.vassal(land1, land2, reason) if not relations.is_vassal(land1) and not relations.is_vassal(land2) then log(land1.." send vassal offer to "..land2) offers.register("vassal", land1, land2, reason) end end function M.revolt(owner, vassal, reason) offers.register("revolt", vassal, owner, reason) end function M.independence(owner, vassal) relations.independence(vassal) end function M.trade(from, to, from_list, to_list) offers.register("trade", from, to, { player_trade_list = from_list, civilization_trade_list = to_list, }) end function M.urge_allies(land, enemy) if relations.is_vassal(enemy) then enemy = relations.is_vassal(enemy) end for k, v in pairs(game_data.lands[land].allies) do if not game_data.lands[v].defeated then if relations.available_war(v, enemy) then offers.register("war", v, enemy) end end end end function M.support_revolt(from, to, value) game_data.lands[from].money = game_data.lands[from].money - value table.insert(game_data.lands[to].rebellion_support, { from, value, game_data.step }) end function M.accept_offer(offer_id) local offer = offers.get_offer_by_id(offer_id) if not offer then print("Error! No offer!") return end -- log("Accepted offer:", offer[1], offer[2], offer[3], offer[4]) if (offer[3] ~= "system" and game_data.lands[offer[3]].defeated) or game_data.lands[offer[4]].defeated then -- log("One civilization does not exists. Return") return end if offer[2] == "peace" then if relations.available_peace(offer[3], offer[4]) then relations.register_peace(offer[3], offer[4]) accept_offer_callback(offer) -- log("Register peace") else -- log("Peace unavailable. Ignore") end elseif offer[2] == "pact" then if relations.available_pact(offer[3], offer[4]) then relations.register_pact(offer[3], offer[4]) accept_offer_callback(offer) -- log("Register pact") else -- log("Pact unavailable. Ignore") end elseif offer[2] == "alliance" then if relations.available_alliance(offer[3], offer[4]) then relations.register_alliance(offer[3], offer[4]) accept_offer_callback(offer) -- log("Register alliance") else -- log("Alliance unavailable. Ignore") end elseif offer[2] == "trade" then if relations.available_trade(offer[3], offer[4]) then -- pprint("Confirmed trade. Trade data is:", offer[5].player_trade_list) for i = 2, #offer[5].player_trade_list do -- ??? I think there is a mistake here. I will have to check when I add trading to the game local it = offer[5].player_trade_list[i].item local val = offer[5].player_trade_list[i].value if it == "peace" and relations.available_peace(offer[3], offer[4]) then relations.register_peace(offer[3], offer[4]) accept_offer_callback({ offer[1], "peace", offer[3], offer[4] }) elseif it == "pact" and relations.available_pact(offer[3], offer[4]) then relations.register_pact(offer[3], offer[4]) accept_offer_callback({ offer[1], "pact", offer[3], offer[4] }) elseif it == "alliance" and relations.available_alliance(offer[3], offer[4]) then relations.register_alliance(offer[3], offer[4]) accept_offer_callback({ offer[1], "alliance", offer[3], offer[4] }) elseif it == "declare_war" and relations.available_war(offer[3], val) and not game_data.lands[offer[3]].vassal then if relations.is_vassal(val) then val = game_data.lands[val].vassal end offers.register("war", offer[3], val) elseif it == "gold" and game_data.lands[offer[3]].money >= val then game_data.lands[offer[3]].money = game_data.lands[offer[3]].money - val game_data.lands[offer[4]].money = game_data.lands[offer[4]].money + val elseif it == "per_turn" and game_data.lands[offer[3]].economy.balance >= val then table.insert(game_data.trade, { "per_turn", offer[3], offer[4], val, game_values.trade_gold_per_turn_duration }) elseif it == "resource" then local resource = string.gsub(val, "%d", "") resource = string.gsub(resource, ":", "") local count = val:gsub("%D+", "") count = tonumber(count) if game_data.lands[offer[3]].resources[resource] >= count then game_data.lands[offer[3]].resources[resource] = game_data.lands[offer[3]].resources[resource] - count game_data.lands[offer[4]].resources[resource] = game_data.lands[offer[4]].resources[resource] + count end elseif it == "province" and game_data.provinces[val].o == offer[3] then local r_a = game_data.provinces[val].a[offer[3]] or 0 game_data.provinces[val].o = offer[4] game_data.provinces[val].a = {} game_data.provinces[val].a[offer[4]] = r_a end end for i = 2, #offer[5].civilization_trade_list do local it = offer[5].civilization_trade_list[i].item local val = offer[5].civilization_trade_list[i].value if it == "declare_war" and relations.available_war(offer[4], val) and not game_data.lands[offer[4]].vassal then if relations.is_vassal(val) then val = game_data.lands[val].vassal end offers.register("war", offer[4], val) elseif it == "gold" and game_data.lands[offer[4]].money >= val then game_data.lands[offer[4]].money = game_data.lands[offer[4]].money - val game_data.lands[offer[3]].money = game_data.lands[offer[3]].money + val elseif it == "per_turn" and game_data.lands[offer[4]].economy.balance >= val then table.insert(game_data.trade, { "per_turn", offer[4], offer[3], val, game_values.trade_gold_per_turn_duration }) elseif it == "resource" then local resource = string.gsub(val, "%d", "") resource = string.gsub(resource, ":", "") local count = val:gsub("%D+", "") count = tonumber(count) if game_data.lands[offer[4]].resources[resource] >= count then game_data.lands[offer[4]].resources[resource] = game_data.lands[offer[4]].resources[resource] - count game_data.lands[offer[3]].resources[resource] = game_data.lands[offer[3]].resources[resource] + count end elseif it == "province" and game_data.provinces[val].o == offer[4] then local r_a = game_data.provinces[val].a[offer[4]] or 0 game_data.provinces[val].o = offer[3] game_data.provinces[val].a = {} game_data.provinces[val].a[offer[3]] = r_a end end update_land_data(offer[3]) update_land_data(offer[4]) log("Trade finished") else log("Trade unavailable. Ignore") end elseif offer[2] == "vassal" then if relations.available_vassal(offer[3], offer[4]) then relations.register_vassal(offer[3], offer[4]) accept_offer_callback(offer) log("Register vassalage") else log("vassalage unavailable. Ignore") end elseif offer[2] == "discontent_pay_off" then -- print("Pay off: ", offer[5]) game_data.lands[offer[4]].money = game_data.lands[offer[4]].money - offer[5] table.insert(game_data.lands[offer[4]].actions_taken, {"pay_off", game_data.step}) update_land_data(offer[4]) elseif offer[2] == "discontent_disperse" then for k, v in pairs(game_data.provinces) do if v.o == offer[4] then v.p = v.p * 0.88 end end game_data.lands[offer[4]].money = game_data.lands[offer[4]].money - offer[5] table.insert(game_data.lands[offer[4]].actions_taken, {"disperse", game_data.step}) update_land_data(offer[4]) elseif offer[2] == "discontent_independence" then offers.register("war", offer[4], offer[3]) end end return M
--[[----------------------------------------------------------------------------- * Infected Wars, an open source Garry's Mod game-mode. * * Infected Wars is the work of multiple authors, * a full list can be found in CONTRIBUTORS.md. * For more information, visit https://github.com/JarnoVgr/InfectedWars * * Infected Wars is free software: you can redistribute it and/or modify * it under the terms of the MIT License. * * A full copy of the MIT License can be found in LICENSE.txt. -----------------------------------------------------------------------------]] SWEP.Author = "" -- ClavusElite SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "Swing at enemies. Disorients (read: fucks up screen) them on hit." SWEP.ViewModel = "models/weapons/v_crowbar.mdl" SWEP.WorldModel = "models/weapons/w_crowbar.mdl" SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = true SWEP.Primary.Damage = 30 SWEP.Primary.Ammo = "none" SWEP.Primary.Delay = 1 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" function SWEP:Reload() return false end function SWEP:Initialize() self:SetWeaponHoldType("melee") end function SWEP:Precache() util.PrecacheSound("weapons/iceaxe/iceaxe_swing1.wav") util.PrecacheSound("physics/flesh/flesh_impact_bullet1.wav") util.PrecacheSound("physics/flesh/flesh_impact_bullet2.wav") util.PrecacheSound("physics/flesh/flesh_impact_bullet3.wav") util.PrecacheSound("physics/flesh/flesh_impact_bullet4.wav") util.PrecacheSound("physics/flesh/flesh_impact_bullet5.wav") util.PrecacheSound("weapons/crowbar/crowbar_impact1.wav") util.PrecacheSound("weapons/crowbar/crowbar_impact2.wav") util.PrecacheSound("physics/concrete/concrete_impact_bullet1.wav") util.PrecacheSound("physics/concrete/concrete_impact_bullet2.wav") util.PrecacheSound("physics/concrete/concrete_impact_bullet3.wav") util.PrecacheSound("physics/concrete/concrete_impact_bullet4.wav") util.PrecacheSound("physics/cardboard/cardboard_box_impact_bullet1.wav") util.PrecacheSound("physics/cardboard/cardboard_box_impact_bullet2.wav") util.PrecacheSound("physics/cardboard/cardboard_box_impact_bullet3.wav") util.PrecacheSound("physics/cardboard/cardboard_box_impact_bullet4.wav") util.PrecacheSound("physics/cardboard/cardboard_box_impact_bullet5.wav") util.PrecacheSound("npc/antlion/shell_impact1.wav") util.PrecacheSound("npc/antlion/shell_impact2.wav") util.PrecacheSound("npc/antlion/shell_impact3.wav") util.PrecacheSound("npc/antlion/shell_impact4.wav") util.PrecacheSound("physics/flesh/flesh_squishy_impact_hard1.wav") util.PrecacheSound("physics/flesh/flesh_squishy_impact_hard2.wav") util.PrecacheSound("physics/flesh/flesh_squishy_impact_hard3.wav") util.PrecacheSound("physics/flesh/flesh_squishy_impact_hard4.wav") util.PrecacheSound("physics/wood/wood_solid_impact_bullet1.wav") util.PrecacheSound("physics/wood/wood_solid_impact_bullet2.wav") util.PrecacheSound("physics/wood/wood_solid_impact_bullet3.wav") util.PrecacheSound("physics/wood/wood_solid_impact_bullet4.wav") util.PrecacheSound("physics/wood/wood_solid_impact_bullet5.wav") util.PrecacheSound("physics/concrete/concrete_impact_bullet1.wav") util.PrecacheSound("physics/concrete/concrete_impact_bullet2.wav") util.PrecacheSound("physics/concrete/concrete_impact_bullet3.wav") util.PrecacheSound("physics/concrete/concrete_impact_bullet4.wav") util.PrecacheSound("physics/metal/metal_solid_impact_bullet1.wav") util.PrecacheSound("physics/metal/metal_solid_impact_bullet2.wav") util.PrecacheSound("physics/metal/metal_solid_impact_bullet3.wav") util.PrecacheSound("physics/metal/metal_solid_impact_bullet4.wav") util.PrecacheSound("physics/surfaces/sand_impact_bullet1.wav") util.PrecacheSound("physics/surfaces/sand_impact_bullet2.wav") util.PrecacheSound("physics/surfaces/sand_impact_bullet3.wav") util.PrecacheSound("physics/surfaces/sand_impact_bullet4.wav") util.PrecacheSound("physics/surfaces/tile_impact_bullet1.wav") util.PrecacheSound("physics/surfaces/tile_impact_bullet2.wav") util.PrecacheSound("physics/surfaces/tile_impact_bullet3.wav") util.PrecacheSound("physics/surfaces/tile_impact_bullet4.wav") util.PrecacheSound("physics/metal/metal_box_impact_bullet1.wav") util.PrecacheSound("physics/metal/metal_box_impact_bullet2.wav") util.PrecacheSound("physics/metal/metal_box_impact_bullet3.wav") util.PrecacheSound("physics/metal/metal_computer_impact_bullet1.wav") util.PrecacheSound("physics/metal/metal_computer_impact_bullet2.wav") util.PrecacheSound("physics/metal/metal_computer_impact_bullet3.wav") util.PrecacheSound("physics/glass/glass_impact_bullet1.wav") util.PrecacheSound("physics/glass/glass_impact_bullet2.wav") util.PrecacheSound("physics/glass/glass_impact_bullet3.wav") util.PrecacheSound("physics/glass/glass_impact_bullet4.wav") util.PrecacheSound("physics/plastic/plastic_box_impact_bullet1.wav") util.PrecacheSound("physics/plastic/plastic_box_impact_bullet2.wav") util.PrecacheSound("physics/plastic/plastic_box_impact_bullet3.wav") util.PrecacheSound("physics/plastic/plastic_box_impact_bullet4.wav") util.PrecacheSound("physics/plastic/plastic_box_impact_bullet5.wav") end function SWEP:SetFleshMaterial( apply ) local vm = self.Owner:GetViewModel() if vm and vm:IsValid() then vm:SetColor(255, 255, 255, 255) if apply then vm:SetMaterial("models/flesh") else vm:SetMaterial("") end end end function SWEP:Deploy() if SERVER then self.Owner:DrawWorldModel(true) end self:SetFleshMaterial(true) self:SetColor(255, 255, 255, 255) self.Owner:SetColor(255, 255, 255, 255) end
return {'osama','osamas'}
-- ** -- * Basic object handling Object={ def=function(t,e) local this={} if e then this=e end for k,v in pairs(t) do if type(v)=="function" and k~="new" then this[k]=v end end return this end } -- ** -- * Generic device with file interface to get/set attributes Device={ new=function(class,rootDir) local this=Object.def(class) this._rootDir=rootDir return this; end, _getAttr=function(this, name) local p=this._rootDir.."/"..name local f=io.open(p,'r') local v=f:read() f:close() return v end, _getNAttr=function(this,name) return tonumber(this:_getAttr(name)) end, _setAttr=function(this, name, value) local p=this._rootDir.."/"..name f=io.open(p,'w') local v=f:write(""..value) f:close() end } -- ** -- * LED Device LED={ new=function(class,rootDir) local this=Device:new(rootDir) Object.def(class,this) this._maxBrightness=this:_getNAttr("max_brightness") return this end, getBrightness=function(this) return this:_getNAttr("brightness")/this._maxBrightness end } -- ** -- * Tacho motor device TachoMotor={ new=function(class,rootDir) local this=Device:new(rootDir) Object.def(class,this) this._maxSpeed=this:_getNAttr("max_speed") this:_setAttr("stop_action","coast") return this end, -- ** -- * return current speed. Returned value is negative -- * when polarity is inversed -- * speed is [-1;1] float value where 1 means max speed. getSpeed=function(this) local s=this:_getNAttr("speed")/this._maxSpeed if this:_getAttr("polarity")=="normal" then return s else return -s end end, -- ** -- * Run forever a given speed -- * @param speed [-1;1] value. 1 means max speed, negative -- * value means inversed polarity run=function(this,speed) if speed>=0 then this:_setAttr("polarity","normal") this:_setAttr("speed_sp",math.floor(speed*this._maxSpeed)) else this:_setAttr("polarity","inversed") this:_setAttr("speed_sp",math.floor(-speed*this._maxSpeed)) end this:_setAttr("command","run-forever") end, -- ** -- * Stop motor stop=function(this) this:_setAttr("command","stop") end, -- ** -- * Reset motor (make it stop and reset all motor parameters to -- * default value) reset=function(this) this:_setAttr("command","reset") end } -- ** -- * Lego Sensor LegoSensor={ new=function(class,rootDir) local this=Device:new(rootDir) Object.def(class,this) this._nbValues=this:_getNAttr("num_values") return this end, getMode=function(this) return this:_getAttr("mode") end, setMode=function(this,mode) this:_setAttr("mode",mode) this._nbValues=this:_getNAttr("num_values") end, getValues=function(this) local v={} for i=0,this._nbValues-1 do v[i+1]=this:_getNAttr("value"..i) end return v end, reset=function(this) end } local ev3={ motor={}, sensor={}, reset=function(this) for k, v in pairs(this.motor) do v:reset() end end, setupDevices=function(this,rootDir,table,prefix,class,name) for dir in io.popen("ls "..rootDir):lines() do if string.sub(dir,1,#prefix)==prefix then local d=class:new(rootDir..dir) table[#table+1]=d local addr=d:_getAttr("address") local port=string.sub(addr,#addr,#addr) print("Found "..name.." plugged on port "..port) this[prefix..port]=d end end end, init=function(this) this:setupDevices("/sys/class/tacho-motor/",this.motor,"motor",TachoMotor,"tacho motor") this:setupDevices("/sys/class/lego-sensor/",this.sensor,"sensor",LegoSensor,"lego sensor") end, reset=function(this) for k,v in pairs(this.motor) do v:reset(); end for k,v in pairs(this.sensor) do v:reset(); end end } ev3:init() return ev3
-- small utility functions for lua-gd if not gd then gd = require("gd") end -- return if an image is a truecolor one gd.isTrueColor = function(im) if im == nil then return nil end local gdStr = im:gdStr() if gdStr == nil then return nil end return (gdStr:byte(2) == 254) end -- create a blank truecolor image gd.createTrueColorBlank = function(x, y) local im = gd.createTrueColor(x, y) if im == nil then return nil end local trans = im:colorAllocateAlpha(255, 255, 255, 127) im:alphaBlending(false) im:filledRectangle(0, 0, im:sizeX() - 1, im:sizeY() - 1, trans) im:alphaBlending(true) im:saveAlpha(true) return im end -- return a converted image (source image won't be changed) gd.convertToTrueColor = function(imsrc) if imsrc == nil then return nil end if gd.isTrueColor(imsrc) then return imsrc end local im = gd.createTrueColor(imsrc:sizeX(), imsrc:sizeY()) if im == nil then return nil end im:alphaBlending(false) local trans = im:colorAllocateAlpha(255, 255, 255, 127) im:filledRectangle(0, 0, im:sizeX() - 1, im:sizeY() - 1, trans) im:copy(imsrc, 0, 0, 0, 0, im:sizeX(), im:sizeY()) im:alphaBlending(true) im:saveAlpha(true) return im end -- flip an image about the vertical axis gd.flipVertical = function(im) if im == nil then return nil end im:alphaBlending(false) for x = 0, im:sizeX() do for y = 0, math.floor(im:sizeY()/2) - 1 do local c1, c2 = im:getPixel(x, y), im:getPixel(x, im:sizeY()-1-y) im:setPixel(x, y, c2) im:setPixel(im:sizeX()-1-x, y, c1) end end im:alphaBlending(true) -- TODO: restore the mode return im end -- flip an image about the horizontal axis gd.flipHorizontal = function(im) if im == nil then return nil end im:alphaBlending(false) for y = 0, im:sizeY() do for x = 0, math.floor(im:sizeX()/2) - 1 do local c1, c2 = im:getPixel(x, y), im:getPixel(im:sizeX()-1-x, y) im:setPixel(x, y, c2) im:setPixel(im:sizeX()-1-x, y, c1) end end im:alphaBlending(true) -- TODO: restore the mode return im end -- applies vertical and horizontal flip gd.flipBoth = function(im) gd.flipVertical(im) gd.flipHorizontal(im) return im end -- compare two images and extract only different pixels between two images -- return value is a truecolor gd image with alpha channel gd.createDiff = function(imFG, imBG, ...) local arg = { ... } local xOffsetFG, yOffsetFG = 0, 0 local xOffsetBG, yOffsetBG = 0, 0 local width, height = math.min(imFG:sizeX(), imBG:sizeX()), math.min(imFG:sizeY(), imBG:sizeY()) -- parse argument array if #arg == 4 then -- xOffset, yOffset, width, height xOffsetFG, yOffsetFG = arg[1], arg[2] xOffsetBG, yOffsetBG = xOffsetFG, yOffsetFG width, height = arg[3], arg[4] elseif #arg == 6 then -- xOffsetFG, yOffsetFG, xOffsetBG, yOffsetBG, width, height xOffsetFG, yOffsetFG = arg[1], arg[2] xOffsetBG, yOffsetBG = arg[3], arg[4] width, height = arg[5], arg[6] elseif #arg > 0 then error("too few/much arguments") end -- range check if (xOffsetFG + width > imFG:sizeX()) or (yOffsetFG + height > imFG:sizeY()) then error("foreground image (argument #1) is too small, or illegal offset. " .. width .. "x" .. height .. " from (" .. xOffsetFG .. "," .. yOffsetFG .. ")") end if (xOffsetBG + width > imBG:sizeX()) or (yOffsetBG + height > imBG:sizeY()) then error("background image (argument #2) is too small, or illegal offset. " .. width .. "x" .. height .. " from (" .. xOffsetBG .. "," .. yOffsetBG .. ")") end -- create new gd image local imDiff = gd.createTrueColorBlank(width, height) imDiff:alphaBlending(false) imDiff:copy(imFG, 0, 0, xOffsetFG, yOffsetFG, width, height) -- pixel-by-pixel processing local colTrans = imDiff:colorAllocateAlpha(255, 255, 255, 127) for y = 0, height - 1 do for x = 0, width - 1 do local colFG = imFG:getPixel(x + xOffsetFG, y + yOffsetFG) local colBG = imBG:getPixel(x + xOffsetBG, y + yOffsetBG) if imFG:red(colFG) == imBG:red(colBG) and imFG:green(colFG) == imBG:green(colBG) and imFG:blue(colFG) == imBG:blue(colBG) then imDiff:setPixel(x, y, colTrans) end end end imDiff:alphaBlending(true) imDiff:saveAlpha(true) return imDiff end
-- handler file for both the pre-function and post-function plugin return function(plugin_name, priority) local loadstring = loadstring local insert = table.insert local ipairs = ipairs local config_cache = setmetatable({}, { __mode = "k" }) local ServerlessFunction = { PRIORITY = priority, VERSION = "0.3.1", } function ServerlessFunction:access(config) local functions = config_cache[config] if not functions then -- first call, go compile the functions functions = {} for _, fn_str in ipairs(config.functions) do local func1 = loadstring(fn_str) -- load it local _, func2 = pcall(func1) -- run it if type(func2) ~= "function" then -- old style (0.1.0), without upvalues insert(functions, func1) else -- this is a new function (0.2.0+), with upvalues insert(functions, func2) -- the first call to func1 above only initialized it, so run again func2() end end config_cache[config] = functions return -- must return since we allready executed them end for _, fn in ipairs(functions) do fn() end end return ServerlessFunction end
object_tangible_loot_loot_schematic_planning_table_keren_imp_schematic = object_tangible_loot_loot_schematic_shared_planning_table_keren_imp_schematic:new { } ObjectTemplates:addTemplate(object_tangible_loot_loot_schematic_planning_table_keren_imp_schematic, "object/tangible/loot/loot/schematic/planning_table_keren_imp_schematic.iff")
AddCSLuaFile() local Status = {} Status.Success = 1 Status.Failure = 2 -- Action: execute provided tick function. -- The tick function should return Status.Success or Status.Failure local ActionMeta = { Tick = function(self) return self.tickFunc() end } ActionMeta.__index = ActionMeta local function CreateAction(tickFunc) local instance = {} instance.tickFunc = tickFunc setmetatable(instance, ActionMeta) return instance end -- Condtion returns Status.Success if the provided condition func returns true -- returns Status.Failure otherwise -- This is basically an alias for: -- CreateAction(function() return cond and Status.Success or Status.Failure end) local ConditionMeta = { Tick = function(self) if self.conditionFunc() then return Status.Success else return Status.Failure end end } ConditionMeta.__index = ConditionMeta local function CreateCondition(conditionFunc) local instance = {} instance.conditionFunc = conditionFunc setmetatable(instance, ConditionMeta) return instance end -- Executes all children until one children returns success. -- If all children have been iterated without one succeeding failure will be returned local SelectorMeta = { AddChild = function(self, child) table.insert(self.children, child) end, Tick = function(self) while true do local currentChild = self.children[self.currentChildID] local status = currentChild:Tick() if status == Status.Success then self.currentChildID = 1 return status elseif status == Status.Running then return status end self.currentChildID = self.currentChildID + 1 if self.currentChildID == (#self.children + 1) then self.currentChildID = 1 return Status.Failure end end end } SelectorMeta.__index = SelectorMeta local function CreateSelector() local instance = {} instance.currentChildID = 1 instance.children = {} setmetatable(instance, SelectorMeta) return instance end -- Executes all children until a failure is encountered. local SequenceMeta = { AddChild = function(self, child) table.insert(self.children, child) end, Tick = function(self) while true do local currentChild = self.children[self.currentChildID] local status = currentChild:Tick() if status == Status.Failure then self.currentChildID = 1 return status elseif status == Status.Running then return status end self.currentChildID = self.currentChildID + 1 if self.currentChildID == (#self.children + 1) then self.currentChildID = 1 return Status.Success end end end } SequenceMeta.__index = SequenceMeta local function CreateSequence() local instance = {} instance.currentChildID = 1 instance.children = {} setmetatable(instance, SequenceMeta) return instance end -- Parallel ticks all children in "parallel" -- Strictly speaking they will still executed one after the other. -- But unlike Sequence wont stop iteration on Status.Failure or Status.Success -- unless requiredToFail and/or requiredToSucceed is provided. local ParallelMeta = { AddChild = function(self, child) table.insert(self.children, child) end, Tick = function(self) local successCounter = 0 local failCounter = 0 for _, child in pairs(self.children) do local result = child:Tick() if result == Status.Failure then failCounter = failCounter + 1 if failCounter == self.requiredToFail then return Status.Failure end end if result == Status.Success then successCounter = successCounter + 1 if failCounter == self.requiredToSucceed then return Status.Success end end end if (self.requiredToFail == (-1)) and (failCounter == (#self.children)) then return Status.Failure end if (self.requiredToSucceed == (-1)) and (successCounter == (#self.children)) then return Status.Success end return Status.Running end } ParallelMeta.__index = ParallelMeta local function CreateParallel(requiredToFail, requiredToSucceed) local instance = {} if requiredToFail == nil then requiredToFail = -1 end instance.requiredToFail = requiredToFail if requiredToSucceed == nil then requiredToSucceed = -1 end instance.requiredToSucceed = requiredToSucceed instance.children = {} setmetatable(instance, ParallelMeta) return instance end -- Tree that ticks its root node. -- Use in combination with other nodes! local TreeMeta = { SetRoot = function(self, newRoot) self.root = newRoot end, Tick = function(self) if self.root then return self.root:Tick() else print("WARNING! TICKING EMPTY BEHAVIOR TREE!") return Status.Failure end end } TreeMeta.__index = TreeMeta local function CreateTree(root) local instance = {} instance.root = root setmetatable(instance, TreeMeta) return instance end -- Fluent API for creating a behavoir tree local TreeBuilderMeta = { Action = function(self, func) assert(not self:ParentStackEmpty(), "Can\'t create this node without a parent (sequence/selector)") self:PeekParent():AddChild(CreateAction(func)) return self end, Condition = function(self, func) assert(not self:ParentStackEmpty(), "Can\'t create this node without a parent (sequence/selector)") self:PeekParent():AddChild(CreateCondition(func)) return self end, Sequence = function(self) self:PushParent(CreateSequence()) return self end, Selector = function(self) self:PushParent(CreateSelector()) return self end, -- Completes current composite Finish = function(self) self:PopParent() return self end, Build = function(self) return self.result end, PushParent = function(self, parent) if self:ParentStackEmpty() then self.result:SetRoot(parent) end self.parentStack[(#self.parentStack) + 1] = parent end, PopParent = function(self) local old = self:PeekParent() self.parentStack[((#self.parentStack) - 1) + 1] = nil return old end, PeekParent = function(self) return self.parentStack[((#self.parentStack) - 1) + 1] end, ParentStackEmpty = function(self) return (#self.parentStack) == 0 end } TreeBuilderMeta.__index = TreeBuilderMeta local function TreeBuilder() local instance = {} instance.parentStack = {} instance.result = CreateTree() setmetatable(instance, TreeBuilderMeta) return instance end return { Status = Status, CreateAction = CreateAction, CreateCondition = CreateCondition, CreateSelector = CreateSelector, CreateSequence = CreateSequence, CreateParallel = CreateParallel, CreateTree = CreateTree, TreeBuilder = TreeBuilder }
local g = vim.g local cmd = vim.cmd g.tokyonight_style = 'night' g.tokyonight_colors = { bg = '#121212', bg_dark = '#101010', bg_sidebar = '#101010' } cmd[[colorscheme tokyonight]] -- Highlight yanked regions cmd([[ augroup HighlightYank autocmd! au TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=700} augroup END ]])
-- helper frame local f = CreateFrame('frame') f:SetScript('OnEvent', function() this[event](this, arg1) end) -- the almighty _G :] setglobal('_G', getfenv(0)) -- some not yet available Lua functions _G['select'] = function(num, ...) -- return number of arguments if num == '#' then return getn(arg) end -- return arguments from a certain point on num = tonumber(num) if num then if num == 0 then error('index out of range', 2) elseif num < 0 then if abs(num) > getn(arg) then error('index out of range', 2) end num = num + getn(arg) else num = num - 1 end if num > 0 then local i for i = 1, num do table.remove(arg, 1) end end return unpack(arg) else error('bad argument, number expected', 2) end end -- print _G['print'] = function(str) DEFAULT_CHAT_FRAME:AddMessage(str) end -- string functions _G['string'].match = function(str, pattern) local r = { string.find(str, pattern) } -- no match if getn(r) == 0 then return nil end local s, e = table.remove(r, 1), table.remove(r, 1) -- match without captures, return the whole match if getn(r) == 0 then return string.sub(str, s, e) -- more than two return values, return only the captures else return unpack(r) end end -- non-standard _G['string'].join = function(sep, ...) return table.concat(arg, sep) end -- non-standard _G['string'].trim = function(str) return string.gsub(str, '^%s*(.-)%s*$', '%1') end -- math functions _G['math'].modf = function(number) local fractional = math.mod(number, 1) local integral = number - fractional return integral, fractional end -- non-standard _G['math'].round = function(number, place) if not number or not place then error('bad argument(s)', 2) end return math.floor(number / place + 0.5) * place end -- future WoW API functions local loggedIn = false _G['IsLoggedIn'] = function() return loggedIn and 1 or nil end f:RegisterEvent('PLAYER_LOGIN') function f.PLAYER_LOGIN(self) loggedIn = true end _G['IsModifierKeyDown'] = function() return IsShiftKeyDown() or IsAltKeyDown() or IsControlKeyDown() end -- non-standard WoW API additions local function get_function_id(func) assert(type(func) == 'function') return string.sub(string.match(tostring(func), ': .+$'), 3) end -- acts like hooksecurefunc would _G['post_hook'] = function(...) -- hook global function if type(arg[1]) == 'string' then local functionName = arg[1] local hookFunction = arg[2] local func = _G[functionName] if not func then return false end local functionId = get_function_id(func) _G[functionId .. functionName] = func _G[functionName] = function(...) _G[functionId .. functionName](unpack(arg)) hookFunction(unpack(arg)) end -- hook member function else local tbl = arg[1] local functionName = arg[2] local hookFunction = arg[3] if not tbl or not tbl[functionName] then return false end local functionId = get_function_id(tbl[functionName]) tbl[functionId .. functionName] = tbl[functionName] tbl[functionName] = function(...) tbl[functionId .. functionName](unpack(arg)) hookFunction(unpack(arg)) end return true end end -- like post_hook, but executes the hook function before the original _G['pre_hook'] = function(...) -- hook global function if type(arg[1]) == 'string' then local functionName = arg[1] local hookFunction = arg[2] local func = _G[functionName] if not func then return false end local functionId = get_function_id(func) _G[functionId .. functionName] = func _G[functionName] = function(...) hookFunction(unpack(arg)) _G[functionId .. functionName](unpack(arg)) end -- hook member function else local tbl = arg[1] local functionName = arg[2] local hookFunction = arg[3] if not tbl or not tbl[functionName] then return false end local functionId = get_function_id(tbl[functionName]) tbl[functionId .. functionName] = tbl[functionName] tbl[functionName] = function(...) hookFunction(unpack(arg)) tbl[functionId .. functionName](unpack(arg)) end return true end end -- replace a function, but pass the original as the first argument _G['replace_hook'] = function(...) -- hook global function if type(arg[1]) == 'string' then local functionName = arg[1] local hookFunction = arg[2] local func = _G[functionName] if not func then return false end local functionId = get_function_id(func) _G[functionId .. functionName] = func _G[functionName] = function(...) hookFunction(_G[functionId .. functionName], unpack(arg)) end -- hook member function else local tbl = arg[1] local functionName = arg[2] local hookFunction = arg[3] if not tbl or not tbl[functionName] then return false end local functionId = get_function_id(tbl[functionName]) tbl[functionId .. functionName] = tbl[functionName] tbl[functionName] = function(...) hookFunction(tbl[functionId .. functionName], unpack(arg)) end return true end end _G['GetContainerItemByName'] = function(findName) if not findName then return end local totalCount = 0 local link, name local bag, slot, texture, count for i = 0, NUM_BAG_FRAMES do for k = 1, GetContainerNumSlots(i) do link = GetContainerItemLink(i, k) name = link and string.match(link, '%[([^%]]+)%]') or nil if name and string.lower(name) == string.lower(findName) then bag, slot = i, k texture, count = GetContainerItemInfo(i, k) totalCount = totalCount + count end end end return bag, slot, totalCount, texture end _G['UseItemByName'] = function(name) local bag, slot = GetContainerItemByName(name) if bag and slot then UseContainerItem(bag, slot) else UIErrorsFrame:AddMessage(ERR_ITEM_NOT_FOUND, 1, 0.1, 0.1) end end
local class = require("heart.class") local heartTable = require("heart.table") local M = class.newClass() function M:init(game, config) self.game = assert(game) self.spriteEntities = assert(self.game.componentEntitySets.sprite) self.spriteComponents = assert(self.game.componentManagers.sprite) self.color = config.color or {1, 0, 0, 0.25} end function M:handleEvent(viewportId) local r, g, b, a = love.graphics.getColor() love.graphics.setColor(self.color) local transforms = self.spriteComponents.transforms local images = self.spriteComponents.images for id in pairs(self.spriteEntities) do local width, height = images[id]:getDimensions() local x1, y1 = transforms[id]:transformPoint(0, 0) local x2, y2 = transforms[id]:transformPoint(width, 0) local x3, y3 = transforms[id]:transformPoint(width, height) local x4, y4 = transforms[id]:transformPoint(0, height) love.graphics.polygon("fill", x1, y1, x2, y2, x3, y3, x4, y4) end love.graphics.setColor(r, g, b, a) end return M
function to_eval_string(data) if type(data) == "string" then return string.format( [["%s"]], data ) elseif type(data) == "number" then return string.format( [[%f]], data ) elseif type(data) == "boolean" and data == true then return "true" elseif type(data) == "boolean" and data == false then return "false" elseif type(data) == "table" then local kvp = {} for k, v in pairs( data ) do if type(k) == "number" then kvp[#kvp+1] = to_eval_string( v ) elseif type(k) == "string" then kvp[#kvp+1] = string.format( [[ ["%s"] = %s ]], k, to_eval_string( v ) ) else error( "encountered non string key" ) end end return "{ " .. table.concat( kvp, ", " ) .. " }" else error( "encountered unsupported type: " .. type(data) ) end end function atom(name) return { t = 'data' ; k = 'atom' ; name = name } end function fun(name, params) return { t = 'data' ; k = 'fun' ; name = name ; params = params } end function data_string(value) return { t = 'data' ; k = 'string' ; value = value } end function lex(str) -- rules : [ { pattern, constructor } ] local match = string.match local sub = string.sub local rules = { { pattern = "[\n\r\t ]+" , constructor = function(m) return atom('nothing') end } ; { pattern = "=>" , constructor = function(m) return atom('rarrow') end } ; { pattern = "!" , constructor = function(m) return atom('nothing') end } ; { pattern = ";" , constructor = function(m) return atom('semicolon') end } ; { pattern = "," , constructor = function(m) return atom('comma') end } ; { pattern = ":" , constructor = function(m) return atom('colon') end } ; { pattern = "|" , constructor = function(m) return atom('or') end } ; { pattern = "_" , constructor = function(m) return atom('wild') end } ; { pattern = "{" , constructor = function(m) return atom('lcurl') end } ; { pattern = "}" , constructor = function(m) return atom('rcurl') end } ; { pattern = "%(" , constructor = function(m) return atom('lparen') end } ; { pattern = "%)" , constructor = function(m) return atom('rparen') end } ; { pattern = "%l[%w_]*" , constructor = function(m) return fun('symbol', { data_string(m) }) end } ; { pattern = "%u[%w_]*" , constructor = function(m) return fun('variable', { data_string(m) }) end } ; { pattern = "%$%l[%w_]*" , constructor = function(m) return fun('rule_reference', { data_string(m) }) end } ; { pattern = "%%%d+" , constructor = function(m) return fun('capture_reference', { data_string(m) }) end } ; { pattern = '".-"' , constructor = function(m) return fun('string', { data_string(m) }) end } ; { pattern = "'.-'" , constructor = function(m) return fun('string', { data_string(m) }) end } } local output = {} local index = 1 while index <= #str do for _, rule in ipairs( rules ) do local m = match( sub(str, index), "^" .. rule.pattern ) if m then local o = rule.constructor(m) o.start_index = index index = index + #m o.end_index = index output[#output+1] = o goto ok end end do return { success = false , tokens = output , unknown_token = sub(str, index, index) , index = index } end ::ok:: end return {success = true, tokens = output} end function merge_env(e1, e2) local e3 = {} for k, v in pairs(e1) do e3[k] = v end for k, v in pairs(e2) do assert(not e3[k], 're-introducing variables not currently supported: ' .. k) e3[k] = v end return e3 end function pattern_match(pattern, tokens, index, rules) local pi = 1 local captures = {} local env = {} while index <= #tokens and pi <= #pattern do assert(pattern[pi]) assert(pattern[pi].t == 'pattern') assert(tokens[index]) assert(tokens[index].t == 'data') if pattern[pi].k == 'atom' then if tokens[index].k ~= 'atom' then return false end captures[#captures+1] = tokens[index] pi = pi + 1 index = index + 1 elseif pattern[pi].k == 'fun' then if tokens[index].k ~= 'fun' then return false end if tokens[index].name ~= pattern[pi].name then return false end local success, _, new_env, _ = pattern_match(pattern[pi].params, tokens[index].params, 1, rules) if not success then return false end captures[#captures+1] = tokens[index] env = merge_env(env, new_env) pi = pi + 1 index = index + 1 elseif pattern[pi].k == 'wild' then captures[#captures+1] = tokens[index] pi = pi + 1 index = index + 1 elseif pattern[pi].k == 'var' then assert(not env[pattern[pi].name], 're-introducing variables not currently supported: ' .. pattern[pi].name) env[pattern[pi].name] = tokens[index] captures[#captures+1] = tokens[index] pi = pi + 1 index = index + 1 elseif pattern[pi].k == 'rule' then local o, next_index = parse_rule(tokens, index, rules, pattern[pi].name) if not o then return false end captures[#captures+1] = o pi = pi + 1 index = next_index else error('Encountered unknown pattern type: ' .. pattern[pi].k) end end if pi > #pattern then return true, captures, env, index else return false end end function parse_rule(tokens, index, rules, rule) local r = rules[rule] assert(r, 'Attempted to select rule: ' .. rule .. ' but found nothing' ) for _, option in ipairs( r ) do local success, captures, env, next_index = pattern_match(option.pattern, tokens, index, rules) if success then local o = option.constructor(captures, env) o.start_index = captures[1].start_index o.end_index = captures[#captures].end_index return o, next_index end end return false, index end function parse(tokens) -- rules : dict<rule : string, [{ pattern, constructor}]> -- constructor : ([data], var_env) -> data local rules = { main = { { pattern = { { t = 'pattern' , k = 'fun' , name = 'symbol' , params = { { t = 'pattern', k = 'var', name = 'A' } } } ; { t = 'pattern' , k = 'atom' , name = 'space' } ; { t = 'pattern' , k = 'fun' , name = 'number' , params = { { t = 'pattern', k = 'var', name = 'B' } } } } , constructor = function(caps, env) return { t = 'data' , k = 'string' , value = env['A'].value .. ' ' .. env['B'].value } end } ; { pattern = { { t = 'pattern' , k = 'fun' , name = 'number' , params = { { t = 'pattern', k = 'var', name = 'A' } } } ; { t = 'pattern' , k = 'atom' , name = 'space' } ; { t = 'pattern' , k = 'fun' , name = 'number' , params = { { t = 'pattern', k = 'var', name = 'B' } } } } , constructor = function(caps, env) return { t = 'data' , k = 'string' , value = 'N'.. env['A'].value .. ' ' .. env['B'].value } end } } } local output, index = parse_rule(tokens, 1, rules, 'main') if not output then return false, index end return output end --[[ data { t = 'data' ; k = 'atom' | 'fun' | 'string' ; name = string if atom or fun ; params = [data] if fun ; value = string if string ; start_index = number ; end_index = number } pattern { t = 'pattern' ; k = 'atom' | 'fun' | 'wild' | 'var' | 'rule' ; name = string if rule or var or atom or fun ; params = [pattern] if fun } lex blah { "regex_string" => Data(_); ... } parse blah { rule: atom fun(_) fun(B, Var) $rule fun2(Other, Var, atom2, fun3(A)) => Blah(%1, atom, fun(atom), Var, A) // %1 would refer to whatever is in position 1) | blah => Blah(); } --]] f = io.open("jerboa.j", 'r') i = f:read("*a") l = lex(i) print(to_eval_string(l))
-- defines a factorial function norn(x,y) return(x^2 + y^2)^0.5 end function twice(x) return 2*x end function fact(n) if n == 0 then return 1 else return n * fact(n-1) end end --print("enter a number:") --a = io.read("*n") --print(fact(a))
local args = {...} local config = dofile(assert(args[1])) local CL, FN, COL, S = dofile(config.LuaRootDir..'/root.lua') local Pm = FN.newPathManager() local commandString = args[2] local commandArgs = {} for i=3,#args do table.insert(commandArgs, args[i]) end --------------------------------------------------- Command List local commands = {} local commandUsageComments = {} table.insert(commandUsageComments, "DoCool = Do something cool.") function commands:DoCool() Pm:setModDir(config.MyModsDir) Pm:loadMod('modTestCoolX.lua') local x = FN.newInstance(CL.CoolThing) x:cool("I say") end table.insert(commandUsageComments, "Usage = Print this message.") function commands:Usage() print("Usage:") for _,ea in ipairs(commandUsageComments) do print("\t"..ea) end end --------------------------------------------------- Process Command local com = commands[commandString] if com then com() else commands["Usage"]() end
-- ? modules not required in main or any file required by main (__root module or submodules) are not included in the bundle require("reporter"); require("luabundle"); require("global"); local githubTrigger = require("githubTrigger"); local reporterTrigger = require("reporterTrigger"); -- ? load external lib -- require("damage-engine"); -- function mainPreHook() -- end function mainPostHook() githubTrigger() reporterTrigger() end -- function configPreHook() -- end -- function configPostHook() -- end -- ? if you don't return require, it won't be acessible outside bundle return require
local Device = require "device" local uxn = require "uxn" local Uxn = uxn.Uxn function init_zero_page(memory) for i = 0, 255 do memory[i] = 0x00 end end function load_program(memory, program) for i = 1, #program do memory[i+255] = program[i] end -- Don't forget a trailing BRK memory[#program+256] = 0x00 end describe("the uxn instruction", function() local cpu local memory local function PS(offset) offset = offset or 0 return cpu.program_stack[cpu.program_stack:len() + offset] end local function RS(offset) offset = offset or 0 return cpu.return_stack[cpu.return_stack:len() + offset] end local function run_program(program) load_program(memory, program) return cpu:runUntilBreak() end before_each(function() memory = {} for i = 0, 255 do memory[i] = 0x00 end cpu = Uxn:new(memory) cpu.ip = 0x100 end) describe("LIT", function() it("requires a value after the opcode in memory", function() -- Run a program that has no literal after the LIT instruction assert.has_errors(function() run_program { 0x80, -- LIT } end) end) it("must have the keep, return, or short bit set", function() run_program { 0x00, -- BRK 0x12, 0x34, } assert(cpu.program_stack:len() == 0) assert(cpu.return_stack:len() == 0) end) it("pushes a short in the correct byte order", function() local high = 0x12 local low = 0x34 run_program { 0x20, -- LIT2 high, low, } assert(PS() == low) assert(PS(-1) == high) end) describe("pushes bytes to", function() it("the program stack by default", function() local value = 0x12 run_program { 0x80, -- LIT value } assert(cpu.program_stack[cpu.program_stack:len()] == value) assert(cpu.return_stack:len() == 0) end) it("the return stack when requested", function() local value = 0x12 run_program { 0x40, -- LITr value, } assert(cpu.return_stack[cpu.return_stack:len()] == value) assert(cpu.program_stack:len() == 0) end) end) end) describe("INC", function() it("increments bytes", function() run_program { 0x80, 0x90, -- LIT 0x90 0x01, -- INC } assert(PS() == 0x91) end) it("increments shorts", function() run_program { 0x20, 0x90, 0xab, -- LIT 0x90ab 0x21, -- INC2 } value = 0x90ab value = value + 1 assert(PS() == bit.band(value, 0xff)) assert(PS(-1) == bit.band(bit.rshift(value, 8), 0xff)) end) it("wraps bytes", function() run_program { 0x80, 0xff, -- LIT 0xff 0x01 -- INC } assert(PS() == 0x00) end) describe("wraps shorts", function() it("with one byte", function() run_program { 0x20, 0xab, 0xff, -- LIT 0xffff 0x21 -- INC2 } assert(PS() == 0x00) assert(PS(-1) == 0xac) end) it("with two bytes", function() run_program { 0x20, 0xff, 0xff, -- LIT 0xffff 0x21 -- INC2 } assert(PS() == 0x00) assert(PS(-1) == 0x00) end) end) end) describe("POP", function() it("removes bytes", function() run_program { 0x80, 0x00, -- LIT 0x00 0x40, 0x00, -- LITr 0x00 0x02 -- POP } assert(cpu.program_stack:len() == 0) assert(cpu.return_stack:len() == 1) end) it("removes bytes from return stack", function() run_program { 0x80, 0x00, -- LIT 0x00 0x40, 0x00, -- LITr 0x00 0x42 -- POPr } assert(cpu.program_stack:len() == 1) assert(cpu.return_stack:len() == 0) end) it("removes no bytes with keep", function() run_program { 0x80, 0xab, --LIT 0xab 0x82 -- POPk } assert(PS() == 0xab) end) it("pops shorts", function() run_program { 0x80, 0xab, -- LIT 0xab 0x20, 0x12, 0x34, -- LIT2 0x1234 0x22 -- POP2 } assert(PS() == 0xab) assert(cpu.program_stack:len() == 1) end) it("can't pop shorts with only one byte on the stack", function() assert.has_errors(function() run_program { 0x80, 0xab, -- LIT 0xab 0x22 -- POP2 } end) end) it("can't pop a byte when the stack is empty", function() assert.has_errors(function() run_program { 0x02, -- POP } end) end) it("can't pop a short when the stack is empty", function() assert.has_errors(function() run_program { 0x22, -- POP2 } end) end) end) describe("DUP", function() it("leaves 6 bytes on the stack with K and S", function() run_program { 0x20, 0x78, 0x9a, 0xa3, -- DUP2k 1010 0011 } assert(cpu.program_stack:len() == 6) end) it("leaves 3 bytes on the stack with Keep", function() run_program { 0x80, 0x12, 0x83, -- DUPk } assert(cpu.program_stack:len() == 3) end) it("duplicates shorts correctly", function() run_program { 0x20, 0x21, 0x43, -- LIT 0x2143 0x23, -- DUP2 } assert(cpu.program_stack:len() == 4) assert(PS() == 0x43) assert(PS(-1) == 0x21) assert(PS() == PS(-2)) assert(PS(-1) == PS(-3)) end) it("duplicates bytes correctly", function() run_program { 0x80, 0x83, 0x03, } assert(cpu.program_stack:len() == 2) assert(PS() == 0x83) assert(PS() == PS(-1)) end) end) describe("NIP", function() pending("one byte fail", true) pending("one short fail", true) pending("one byte short fail", true) pending("byte", true) pending("short", true) pending("return stack", true) pending("keep", true) end) pending("SWAP", function() end) pending("OVER", function() end) describe("EQU", function() describe("returns 1", function() it("with equal bytes", function() run_program { 0x80, 0x34, 0x80, 0x34, 0x08 } assert(PS() == 0x01) assert(cpu.program_stack:len() == 1) end) it("with equal shorts", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x20, 0x12, 0x34, -- LIT 0x1234 0x28 -- EQU2 } assert(PS() == 0x01) assert(cpu.program_stack:len() == 1) end) pending("keep", true) end) describe("returns 0", function() it("not equal bytes", function() run_program { 0x80, 0xab, -- LIT 0xab 0x80, 0x34, -- LIT 0x34 0x08 } assert(PS() == 0x00) assert(cpu.program_stack:len() == 1) end) it("fully not equal shorts", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x20, 0x21, 0x43, -- LIT 0x2143 0x28, -- EQU2 } assert(PS() == 0x00) assert(cpu.program_stack:len() == 1) end) it("with shorts with same low bytes", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x20, 0xab, 0x34, -- LIT 0x1234 0x28 -- EQU2 } assert(PS() == 0x00) assert(cpu.program_stack:len() == 1) end) it("with shorts with same high bytes", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x20, 0x12, 0xde, -- LIT 0x1234 0x28 -- EQU2 } assert(PS() == 0x00) assert(cpu.program_stack:len() == 1) end) end) end) describe("NEQ", function() describe("returns 0", function() it("with equal bytes", function() run_program { 0x80, 0x34, 0x80, 0x34, 0x09 } assert(PS() == 0x00) assert(cpu.program_stack:len() == 1) end) it("with equal shorts", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x20, 0x12, 0x34, -- LIT 0x1234 0x29 -- NEQ2 } assert(PS() == 0x00) assert(cpu.program_stack:len() == 1) end) pending("keep", true) end) describe("returns 1", function() it("not equal bytes", function() run_program { 0x80, 0x34, -- LIT 0x34 0x80, 0xc3, -- LIT 0xc3 0x09 } assert(PS() == 0x01) assert(cpu.program_stack:len() == 1) end) it("fully not equal shorts", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x20, 0x21, 0x43, -- LIT 0x2143 0x29, -- NEQ2 } assert(PS() == 0x01) assert(cpu.program_stack:len() == 1) end) it("with shorts with same low bytes", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x20, 0xab, 0x34, -- LIT 0x1234 0x29 -- NEQ2 } assert(PS() == 0x01) assert(cpu.program_stack:len() == 1) end) it("with shorts with same high bytes", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x20, 0x12, 0xde, -- LIT 0x1234 0x29 -- NEQ2 } assert(PS() == 0x01) assert(cpu.program_stack:len() == 1) end) end) end) pending("GTH", function() end) pending("LTH", function() end) describe("JMP", function() describe("jumps to a relative", function() it("negative offset", function() offset = -10 init_zero_page(memory) load_program(memory, { 0x80, bit.band(offset, 0xff), -- LIT value 0x0c, -- relative byte jump }) cpu:executeOnce() assert(cpu.ip == 0x102) cpu:executeOnce() assert(cpu.ip == 0x102 + 1 + offset, "ip is incremented by 1, so must take that into account") end) it("positive offset", function() offset = 10 load_program(memory, { 0x80, bit.band(offset, 0xff), -- LIT value 0x0c, -- relative byte jump 0x00, -- padding 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }) cpu:executeOnce() assert(cpu.ip == 0x102) cpu:executeOnce() assert(cpu.ip == 0x102 + 1 + offset, "ip is incremented by 1, so must take that into account") end) it("zero offset", function() run_program { 0x80, 0x00, -- LIT 0x00 0x0c, 0x80, 0xab, } assert(PS() == 0xab) assert(cpu.program_stack:len() == 1) end) it("wrapping offset", function() load_program(memory, { 0x80, 0x7f, -- LIT 0x7f (127) 0x80, 0x7b, -- LIT 0x7b (123) 0x0c, -- Relative byte jump }) for i = 0x107, 0x201 do memory[i] = 0x00 end for i = 1, 3 do cpu:executeOnce() end assert(cpu.ip == 0x180) memory[cpu.ip] = 0x0c -- relative byte jump cpu:executeOnce() assert(cpu.ip == 0x200) end) end) describe("jumps to an absolute", function() pending("short", function() end) pending("zero-page address", function() end) end) end) pending("JCN", function() end) pending("JSR", function() end) describe("STASH", function() describe("moves one", function() it("byte from program to return", function() run_program { 0x80, 0x12, -- LIT 0x12 0x40, 0x34, -- LITr 0x34 0x0f, -- STH } assert(cpu.program_stack:len() == 0) assert(cpu.return_stack:len() == 2) assert(RS() == 0x12) assert(RS(-1) == 0x34) end) it("byte from return to program", function() run_program { 0x80, 0x12, -- LIT 0x12 0x40, 0x34, -- LITr 0x34 0x4f, -- STHr } assert(cpu.program_stack:len() == 2) assert(cpu.return_stack:len() == 0) assert(PS() == 0x34) assert(PS(-1) == 0x12) end) it("short from program to return", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x60, 0xab, 0xcd, -- LITr 0xabcd 0x2f -- STH } assert(cpu.program_stack:len() == 0) assert(cpu.return_stack:len() == 4) assert(RS() == 0x34) assert(RS(-1) == 0x12) assert(RS(-2) == 0xcd) assert(RS(-3) == 0xab) end) it("short from return to program", function() run_program { 0x20, 0x12, 0x34, -- LIT 0x1234 0x60, 0xab, 0xcd, -- LITr 0xabcd 0x6f -- STH } assert(cpu.program_stack:len() == 4) assert(cpu.return_stack:len() == 0) assert(PS() == 0xcd) assert(PS(-1) == 0xab) assert(PS(-2) == 0x34) assert(PS(-3) == 0x12) end) end) it("keeps number of bytes properly", function() run_program { 0x20, 0x21, 0x43, -- LIT 0x2143 0xaf, -- STH2k } assert(cpu.program_stack:len() == 2) assert(cpu.return_stack:len() == 2) end) end) describe("ADD", function() it("adds two bytes without overflow", function() value1 = 0x45 value2 = 0x2c run_program { 0x80, value1, 0x80, value2, 0x18, -- ADD } assert(PS() == value1 + value2) end) it("adds two bytes with overflow", function() value1 = 0xdf value2 = 0x30 run_program { 0x80, value1, 0x80, value2, 0x18, -- ADD } assert(PS() == 0x0f) end) describe("adds two shorts", function() it("with no overflow", function() run_program { 0x20, 0x12, 0xa0, -- LIT 0x12fe 0x20, 0x34, 0x02, -- LIT 0x3402 0x38, -- ADD2 } assert(PS() == 0xa0 + 0x02) assert(PS(-1) == 0x12 + 0x34) end) it("with low overflow", function() run_program { 0x20, 0x12, 0xfe, -- LIT 0x12fe 0x20, 0x34, 0x02, -- LIT 0x3402 0x38, -- ADD2 } assert(PS(-1) == 0x12 + 0x34 + 0x01, "top byte should be + 1") assert(PS() == 0x00) end) it("with high overflow", function() run_program { 0x20, 0xdf, 0x12, -- LIT 0x12fe 0x20, 0x21, 0x34, -- LIT 0x3402 0x38, -- ADD2 } assert(PS(-1) == 0x00) assert(PS() == 0x12 + 0x34) end) end) end) describe("DIV", function() it("doesn't divide by zero", function() assert.has_error(function() run_program { 0x80, 0x40, 0x80, 0x00, 0x1b, } end) end) it("divides cleanly by 2", function() run_program { -- DIV 0x34/0x02 0x80, 0x34, 0x80, 0x02, 0x1b, -- DIV 0xfe/0x02 0x80, 0xfe, 0x80, 0x02, 0x1b, -- DIV 0xceaa/0x0002 0x20, 0xce, 0xaa, 0x20, 0x00, 0x02, 0x3b, } assert(cpu.program_stack:len() == 4) assert(PS() == 0x55) assert(PS(-1) == 0x67) assert(PS(-2) == 0x7f) assert(PS(-3) == 0x1a) end) end) describe("LDZ", function() before_each(function() -- Initialize the zero page to avoid uninitialized errors for i = 0x00, 0xff do memory[i] = 0 end -- Boundary conditions memory[0x00] = 0x12 memory[0x01] = 0x34 memory[0xfe] = 0x78 memory[0xff] = 0x9a -- Byte test memory[0x09] = 0x1d memory[0x0a] = 0x3c memory[0x0b] = 0x5a -- Short test memory[0x9f] = 0xab memory[0xa0] = 0xcd memory[0xa1] = 0xef end) it("fetches bytes", function() run_program { -- Fetch 0x00 0x80, 0x00, 0x10, -- Fetch a byte in the middle of the page 0x80, 0x0a, 0x10, -- Fetch 0xff 0x80, 0xff, 0x10, } assert(cpu.program_stack:len() == 3) assert(PS() == 0x9a) assert(PS(-1) == 0x3c) assert(PS(-2) == 0x12) end) it("fetches shorts", function() run_program { -- Fetch 0x00 0x80, 0x00, 0x30, -- Fetch a short in the middle of the page 0x80, 0xa0, 0x30, -- Fetch 0xff 0x80, 0xfe, 0x30, } assert(cpu.program_stack:len() == 6) assert(PS() == 0x9a) assert(PS(-1) == 0x78) assert(PS(-2) == 0xef) assert(PS(-3) == 0xcd) assert(PS(-4) == 0x34) assert(PS(-5) == 0x12) end) end) describe("STZ", function() it("only takes one byte of address", function() run_program { 0x20, 0xff, 0xff, -- Push values that should not be touched 0x80, 0xab, 0x80, 0x0a, 0x11, -- STZ 0x20, 0x21, 0x43, 0x80, 0xa0, -- Store a short at 0xa0 0x31, -- STZ2 } assert(cpu.program_stack:len() == 2) end) it("overwrites manually set values ", function() memory[0x9c] = 0xab run_program { 0x80, 0x34, -- LIT 0x34 0x80, 0x9c, -- Address 0x9c 0x11, -- STZ } assert(memory[0x9c] == 0x34) end) end) pending("LDA", function() end) pending("STA", function() end) describe("LDR", function() it("loads positive offsets", function() run_program { 0x80, 0x02, -- Offset 0x02 0x12, -- LDR 0x00, 0x00, 0x12, } assert(PS() == 0x12) end) it("loads negative offsets", function() run_program { 0x80, 0x08, -- Jump offset 0x0c, -- Relative jump 0x00, 0x00, 0x00, 0x00, 0xab, -- The desired data 0x00, 0x00, 0x00, 0x80, 0xf9, -- Load offset (-6) 0x12, } assert(PS() == 0xab) end) it("loads shorts", function() run_program { 0x80, 0x02, -- Load offset 0x32, -- LDR2 0x00, 0x00, 0x21, 0x43, 0x65, 0x00, } assert(cpu.program_stack:len() == 2) assert(PS() == 0x43) assert(PS(-1) == 0x21) end) end) pending("STR", function() end) describe("DEI", function() before_each(function() local mem_device = Device:new() mem_device:addPort(2, true) mem_device:addPort(4, true) mem_device:addPort(6, false) mem_device:addPort(7, false) mem_device:writeShort(0x02, 0x2143) mem_device[0x04] = 0x7c -- Too short value in short port mem_device[0x06] = 0xab mem_device:writeShort(0x07, 0x1337) -- Too long value in byte port cpu:addDevice(1, mem_device) local func_device = Device:new() func_device:addPort(2, true, function() return 0x87a9 end, nil) func_device:addPort(4, true, function() return 0x34 end, nil) func_device:addPort(6, false, function() return 0xab end, nil) func_device:addPort(7, false, function() return 0x1337 end, nil) cpu:addDevice(2, func_device) end) it("fetches stored bytes", function() run_program { 0x80, 0x17, -- Address of too long byte 0x16, -- DEI 0x80, 0x12, -- Address of short port 0x16, -- DEI 0x80, 0x16, -- Address of proper byte port 0x16, -- DEI } assert(cpu.program_stack:len() == 3, "Only bytes fetched") assert(PS() == 0xab) assert(PS(-1) == 0x21) assert(PS(-2) == 0x13) end) it("fetches stored shorts", function() run_program { 0x80, 0x12, -- Address of short port 0x36, -- DEI2 0x80, 0x14, -- Address of too short short port 0x36, -- DEI2 0x80, 0x16, -- Address of byte port 0x36, -- DEI2 } assert(cpu.program_stack:len() == 6, "Only fetch shorts") print("PS") cpu.program_stack:debug() -- Gets the byte from the next mem slot assert(PS() == 0x13) assert(PS(-1) == 0xab) -- Fetching from a port with too short of a value assert(PS(-2) == 0x00) assert(PS(-3) == 0x7c) -- Fetches normal short properly assert(PS(-4) == 0x43) assert(PS(-5) == 0x21) end) pending("fetches function bytes", function() end) end) end) describe("helper function", function() test("uint8_to_int8", function() local u = uxn.uint8_to_int8 assert(u(0xff) == -1) assert(u(128) == -128) assert(u(127) == 127) assert(u(0) == 0) assert(u(-10) == -10) assert(u(55) == 55) assert(u(0xfffe) == -2) assert(u(0x000e) == 0x0e) end) describe("bytes_to_short", function() pending("larger than 16 bits", true) end) end)
local gui = require("__flib__.gui") local on_tick_n = require("__flib__.on-tick-n") local table = require("__flib__.table") local constants = require("constants") local formatter = require("scripts.formatter") local gui_util = require("scripts.gui.util") local recipe_book = require("scripts.recipe-book") local shared = require("scripts.shared") local root = require("scripts.gui.search.root") local settings_root = require("scripts.gui.settings.root") local actions = {} function actions.get_action_data(msg, e) local player = game.get_player(e.player_index) local player_table = global.players[e.player_index] local gui_data = player_table.guis.search if not gui_data then return end return { e = e, gui_data = gui_data, msg = msg, player = player, player_table = player_table, refs = gui_data.refs, state = gui_data.state, } end function actions.reset_location(data) if data.e.button ~= defines.mouse_button_type.middle then return end if data.player_table.settings.general.interface.search_gui_location == "top_left" then local scale = data.player.display_scale data.refs.window.location = table.map( constants.search_gui_top_left_location, function(pos) return pos * scale end ) data.refs.window.auto_center = false else data.refs.window.force_auto_center() end end function actions.close(data) if not data.state.ignore_closed and not data.player_table.flags.technology_gui_open then root.close(data.player, data.player_table) end end function actions.toggle_pinned(data) local player = data.player local refs = data.refs local state = data.state local pin_button = refs.titlebar.pin_button state.pinned = not state.pinned if state.pinned then pin_button.style = "flib_selected_frame_action_button" pin_button.sprite = "rb_pin_black" if player.opened == data.refs.window then state.ignore_closed = true player.opened = nil state.ignore_closed = false end else pin_button.style = "frame_action_button" pin_button.sprite = "rb_pin_white" player.opened = refs.window end end function actions.toggle_settings(data) local state = data.state local player = data.player state.ignore_closed = true settings_root.toggle(player, data.player_table) state.ignore_closed = false local settings_button = data.refs.titlebar.settings_button if data.player_table.guis.settings then settings_button.style = "flib_selected_frame_action_button" settings_button.sprite = "rb_settings_black" else settings_button.style = "frame_action_button" settings_button.sprite = "rb_settings_white" if not state.pinned then player.opened = data.refs.window end end end function actions.deselect_settings_button(data) local settings_button = data.refs.titlebar.settings_button settings_button.style = "frame_action_button" settings_button.sprite = "rb_settings_white" if not data.state.pinned and data.refs.window.visible then data.player.opened = data.refs.window end end function actions.update_search_query(data) local player_table = data.player_table local state = data.state local refs = data.refs local class_filter local query = string.lower(data.e.element.text) if string.find(query, "/") then -- NOTE: The `_`s here are technically globals, but whatever _, _, class_filter, query = string.find(query, "^/(.-)/(.-)$") if class_filter then class_filter = string.lower(class_filter) end -- Check translations of each class filter local matched = false if class_filter then local gui_translations = player_table.translations.gui for _, class in pairs(constants.classes) do if class_filter == string.lower(gui_translations[class]) then matched = true class_filter = class break end end end -- Invalidate textfield if not class_filter or not query or not matched then class_filter = false query = nil end end -- Remove results update action if there is one if state.update_results_ident then on_tick_n.remove(state.update_results_ident) state.update_results_ident = nil end if query then -- Fuzzy search if player_table.settings.general.search.fuzzy_search then query = string.gsub(query, ".", "%1.*") end -- Input sanitization for pattern, replacement in pairs(constants.input_sanitizers) do query = string.gsub(query, pattern, replacement) end -- Save query state.search_query = query state.class_filter = class_filter -- Update in a while state.update_results_ident = on_tick_n.add( game.tick + constants.search_timeout, {gui = "search", action = "update_search_results", player_index = data.e.player_index} ) refs.search_textfield.style = "rb_search_textfield" else state.search_query = "" refs.search_textfield.style = "rb_search_invalid_textfield" end end function actions.update_search_results(data) local player = data.player local player_table = data.player_table local state = data.state local refs = data.refs -- Data local player_data = formatter.build_player_data(player, player_table) local show_fluid_temperatures = player_table.settings.general.search.show_fluid_temperatures local search_type = player_table.settings.general.search.search_type -- Update results based on query local i = 0 local pane = refs.search_results_pane local children = pane.children local max = constants.search_results_limit local class_filter = state.class_filter local query = state.search_query if class_filter ~= false and (class_filter or #query >= 2) then for class in pairs(constants.pages) do if not class_filter or class_filter == class then for internal, translation in pairs(player_table.translations[class]) do -- Match against search string local matched if search_type == "both" then matched = string.find(string.lower(internal), query) or string.find(string.lower(translation), query) elseif search_type == "internal" then matched = string.find(string.lower(internal), query) elseif search_type == "localised" then matched = string.find(string.lower(translation), query) end if matched then local obj_data = recipe_book[class][internal] -- Check temperature settings if obj_data.class == "fluid" then local temperature_ident = obj_data.temperature_ident if temperature_ident then local is_range = temperature_ident.min ~= temperature_ident.max if is_range then if show_fluid_temperatures ~= "all" then goto continue end else if show_fluid_temperatures == "off" then goto continue end end end end local info = formatter(obj_data, player_data) if info then i = i + 1 local style = info.researched and "rb_list_box_item" or "rb_unresearched_list_box_item" local item = children[i] if item then item.style = style item.caption = info.caption item.tooltip = info.tooltip item.enabled = info.enabled gui.update_tags(item, {context = {class = class, name = internal}}) else gui.add(pane, { type = "button", style = style, caption = info.caption, tooltip = info.tooltip, enabled = info.enabled, mouse_button_filter = {"left", "middle"}, tags = { context = {class = class, name = internal}, }, actions = { on_click = {gui = "search", action = "open_object"}, }, }) if i >= max then break end end end end ::continue:: end end if i >= max then break end end end -- Destroy extraneous items for j = i + 1, #children do children[j].destroy() end end function actions.open_object(data) local context = gui_util.navigate_to(data.e) if context then local attach = data.player_table.settings.general.interface.attach_search_results local sticky = attach and data.e.button == defines.mouse_button_type.left shared.open_page(data.player, data.player_table, context, sticky) if not sticky and data.player_table.settings.general.interface.close_search_gui_after_selection then actions.close(data) end end end function actions.update_favorites(data) root.update_favorites(data.player, data.player_table) end function actions.update_history(data) root.update_history(data.player, data.player_table) end function actions.delete_favorites(data) data.player_table.favorites = {} actions.update_favorites(data) end function actions.delete_history(data) data.player_table.global_history = {} actions.update_history(data) end return actions
return Def.ActorFrame{ Def.Quad{ InitCommand=cmd(FullScreen,diffuse,color("0,0,0,1")) }; LoadActor("bg")..{ InitCommand=cmd(CenterX;valign,0;y,SCREEN_TOP); }; LoadActor("base")..{ InitCommand=cmd(Center;diffusealpha,0); }; };
--[[ Upbit Open API ## REST API for Upbit Exchange - Base URL: [https://api.upbit.com] - Official Upbit API Documents: [https://docs.upbit.com] - Official Support email: [open-api@upbit.com] OpenAPI spec version: 1.0.0 Contact: ujhin942@gmail.com Generated by: https://github.com/swagger-api/swagger-codegen.git ]] --[[ Unit tests for swagger-client.model.withdraw Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("withdraw", function() local swagger-client_withdraw = require "swagger-client.model.withdraw" -- unit tests for the property 'type' describe("property type test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) -- unit tests for the property 'uuid' describe("property uuid test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) -- unit tests for the property 'currency' describe("property currency test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) -- unit tests for the property 'txid' describe("property txid test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) -- unit tests for the property 'state' describe("property state test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) -- unit tests for the property 'created_at' describe("property created_at test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) -- unit tests for the property 'done_at' describe("property done_at test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) -- unit tests for the property 'amount' describe("property amount test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) -- unit tests for the property 'fee' describe("property fee test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) -- unit tests for the property 'transaction_type' describe("property transaction_type test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) end) end)
local _M = {} local templates = require "openresty_org.templates" local i18n = require "openresty_org.i18n" local c = {} function _M.process(key, stash, i18n) stash.c = c c.l = i18n.translate return templates.process(key, stash) end return _M
--- -- @module RoduxActions -- @author Quenty local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore")) local RoduxActionFactory = require("RoduxActionFactory") local Table = require("Table") local RoduxActions = {} RoduxActions.ClassName = "RoduxActions" function RoduxActions.new(initFunction) local self = setmetatable({}, RoduxActions) self._initFunction = initFunction or error("No initFunction") return self end function RoduxActions:Init() assert(not rawget(self, "_actionFactories"), "Already initialized") self._actionFactories = {} self._initFunction(self) end function RoduxActions:CreateReducer(initialState, handlers) assert(type(handlers) == "table") for actionType, func in pairs(handlers) do assert(type(func) == "function") if not self:Get(actionType) then error(("[RoduxActions.CreateReducer] - %q type is not registered"):format(tostring(actionType)), 2) end end return function(state, action) if state == nil then state = initialState end local handler = handlers[action.type] if handler then local validator = self:Get(action.type) or error("No validator") assert(validator:Validate(action)) return handler(state, Table.readonly(Table.copy(action))) end return state end end function RoduxActions:Validate(action) assert(type(action) == "table") assert(type(action.type) == "string") local actionFactory = self:Get(action.type) if not actionFactory then return false, ("%q is not a valid action type"):format(tostring(action.type)) end return actionFactory:Validate(action) end function RoduxActions:Get(actionName) local actionFactories = rawget(self, "_actionFactories") assert(actionFactories, "Not initialized yet") return actionFactories[actionName] end function RoduxActions:Add(actionName, typeTable) local actionFactories = rawget(self, "_actionFactories") assert(actionFactories, "Not initialized yet") assert(actionFactories[actionName] == nil, "Duplicate action already exists") actionFactories[actionName] = RoduxActionFactory.new(actionName, typeTable) end function RoduxActions:__index(index) if RoduxActions[index] then return RoduxActions[index] end local actionFactories = rawget(self, "_actionFactories") assert(actionFactories, "Not initialized yet") if actionFactories[index] then return actionFactories[index] else error(("%q Not a valid index"):format(tostring(index))) end end return RoduxActions
local apps = require('configuration.apps') local filesystem = require('gears.filesystem') -- List of apps to start once on start-up return { run_on_start_up = { -- compositer 'picom --config ' .. '~/.config/picom/picom.conf', -- Network Manager Applet --'nm-applet --indicator', -- wifi -- Bluetooth 'blueman-applet', -- bluetooth tray -- Media controller daemon "playerctld daemon", } }
-- is.lua - Type checking for Lua -- Copyright 2016 Jack Wilsdon -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. IS = {} --- Throw an error caused by invalid arguments. -- @param count The index of the invalid argument. -- @param fname The name of the function that the invalid argument was passed to. -- @param extype The expected type being passed. -- @param actype The actual type passed. function IS.arg_error(count, fname, extype, actype) if type(count) ~= 'number' then IS.arg_error(1, 'arg_error', 'number', type(count)) end if type(fname) ~= 'string' then IS.arg_error(2, 'arg_error', 'string', type(fname)) end if type(extype) ~= 'string' then IS.arg_error(3, 'arg_error', 'string', type(extype)) end if type(actype) ~= 'string' then IS.arg_error(4, 'arg_error', 'string', type(actype)) end local msg = string.format('bad argument #%d to \'%s\' (%s expected, got %s)', count, fname, extype, actype) error(msg) end --- Throw an argument error if two types do not match. -- @param count The index of the invalid argument. -- @param fname The name of the function that the invalid argument was passed to. -- @param extype The expected type being passed. -- @param actype The actual type passed. function IS.enforce_arg(count, fname, extype, actype) if type(count) ~= 'number' then IS.arg_error(1, 'enforce_arg', 'number', type(count)) end if type(fname) ~= 'string' then IS.arg_error(2, 'enforce_arg', 'string', type(fname)) end if type(extype) ~= 'string' then IS.arg_error(3, 'enforce_arg', 'string', type(extype)) end if type(actype) ~= 'string' then IS.arg_error(4, 'enforce_arg', 'string', type(actype)) end if extype ~= actype then IS.arg_error(count, fname, extype, actype) end end --- Throw an argument error if all of the values in a table do not match the type provided. -- @param count The index of the invalid argument. -- @param fname The name of the function that the invalid argument was passed to. -- @param extype The expected type being passed. -- @param tbl The table of valuess to compare. function IS.enforce_arg_table(count, fname, extype, tbl) if type(count) ~= 'number' then IS.arg_error(1, 'enforce_all_values', 'number', type(count)) end if type(fname) ~= 'string' then IS.arg_error(2, 'enforce_all_values', 'string', type(fname)) end if type(extype) ~= 'string' then IS.arg_error(3, 'enforce_all_values', 'string', type(extype)) end if type(tbl) ~= 'table' then IS.arg_error(4, 'enforce_all_values', 'table', type(tbl)) end for _, v in pairs(tbl) do if not IS.is(v, extype) then IS.arg_error(count, fname, extype, type(v)) end end end --- Check whether obj is of type typename. -- @param obj The object to check. -- @param typename The type(s) to check against. -- @return Whether obj is of type typename. function IS.is(obj, typename) if type(typename) ~= 'string' and type(typename) ~= 'table' then IS.arg_error(2, 'is', 'string or table', type(typename)) end if type(typename) == 'table' then for _, v in pairs(typename) do if type(v) ~= 'string' then IS.arg_error(2, 'is', 'string', type(v)) end if type(obj) == v then return true end end else if type(obj) == typename then return true end end return false end --- Check whether all values are of type typename. -- @param tbl The table to check. -- @param typename The type(s) to check against. -- @return Whether all of tbl's values are of type typename. function IS.is_all_values(tbl, typename) if type(tbl) ~= 'table' then IS.arg_error(1, 'is_all_values', 'table', type(tbl)) end if type(typename) ~= 'string' and type(typename) ~= 'table' then IS.arg_error(2, 'is_all_values', 'string or table', type(typename)) end for _, v in pairs(tbl) do if not IS.is(v, typename) then return false end end return true end
Player = {} PlayerState = { Idle = 0, Accelerating = 1, HoveringLeft = 2, HoveringRight = 3, AcceleratingHoveringLeft = 4, AcceleratingHoveringRight = 5 } -- Player constructor function Player.new() local self = {} local bullets = {} local sprites = { idle = love.graphics.newImage('resources/sprites/player-idle.png'), accelerating = love.graphics.newImage('resources/sprites/player-accelerating.png'), hovering_left = love.graphics.newImage('resources/sprites/player-hovering-left.png'), hovering_right = love.graphics.newImage('resources/sprites/player-hovering-right.png'), accelerating_hovering_left = love.graphics.newImage('resources/sprites/player-accelerating-hovering-left.png'), accelerating_hovering_right = love.graphics.newImage('resources/sprites/player-accelerating-hovering-right.png') } local state = nil self.position = { x = 400 - sprites.idle:getWidth() * 0.5, y = 300 - sprites.idle:getHeight() * 0.5, w = sprites.idle:getWidth(), h = sprites.idle:getHeight() } self.health = 10 local yaw = math.rad(270) self.lookAt = { x = math.sin(yaw), y = math.cos(yaw) } function self.load() state = PlayerState.Idle end function self.update(dt) state = PlayerState.Idle if (love.keyboard.isDown('a') or love.keyboard.isDown('left')) and (love.keyboard.isDown('w') or love.keyboard.isDown('up')) then state = PlayerState.AcceleratingHoveringLeft yaw = yaw + math.rad(2.0) self.lookAt.x, self.lookAt.y = math.sin(yaw), -math.cos(yaw) self.position.x, self.position.y = self.position.x + self.lookAt.x * 3, self.position.y + self.lookAt.y * 3 elseif (love.keyboard.isDown('d') or love.keyboard.isDown('right')) and (love.keyboard.isDown('w') or love.keyboard.isDown('up')) then state = PlayerState.AcceleratingHoveringRight yaw = yaw - math.rad(2.0) self.lookAt.x, self.lookAt.y = math.sin(yaw), -math.cos(yaw) self.position.x, self.position.y = self.position.x + self.lookAt.x * 3, self.position.y + self.lookAt.y * 3 elseif love.keyboard.isDown('a') or love.keyboard.isDown('left') then state = PlayerState.HoveringLeft yaw = yaw + math.rad(2.0) self.lookAt.x, self.lookAt.y = math.sin(yaw), -math.cos(yaw) elseif love.keyboard.isDown('d') or love.keyboard.isDown('right') then state = PlayerState.HoveringRight yaw = yaw - math.rad(2.0) self.lookAt.x, self.lookAt.y = math.sin(yaw), -math.cos(yaw) elseif love.keyboard.isDown('w') or love.keyboard.isDown('up') then state = PlayerState.Accelerating self.position.x, self.position.y = self.position.x + self.lookAt.x * 3, self.position.y + self.lookAt.y * 3 end local width, height, _ = love.window.getMode() if self.position.x >= width then self.position.x = self.position.w elseif self.position.x <= 0 then self.position.x = width - self.position.w end if self.position.y >= height then self.position.y = self.position.h elseif self.position.y <= 0 then self.position.y = height - self.position.h end end function self.draw() if state == PlayerState.Idle then love.graphics.draw( sprites.idle, self.position.x - sprites.idle:getWidth() * 0.5, self.position.y - sprites.idle:getHeight() * 0.5, yaw ) elseif state == PlayerState.Accelerating then love.graphics.draw( sprites.accelerating, self.position.x - sprites.accelerating:getWidth() * 0.5, self.position.y - sprites.accelerating:getHeight() * 0.5, yaw ) elseif state == PlayerState.HoveringLeft then love.graphics.draw( sprites.hovering_left, self.position.x - sprites.hovering_left:getWidth() * 0.5, self.position.y - sprites.hovering_left:getHeight() * 0.5, yaw ) elseif state == PlayerState.HoveringRight then love.graphics.draw( sprites.hovering_right, self.position.x - sprites.hovering_right:getWidth() * 0.5, self.position.y - sprites.hovering_right:getHeight() * 0.5, yaw ) elseif state == PlayerState.AcceleratingHoveringLeft then love.graphics.draw( sprites.accelerating_hovering_left, self.position.x - sprites.accelerating_hovering_left:getWidth() * 0.5, self.position.y - sprites.accelerating_hovering_left:getHeight() * 0.5, yaw ) elseif state == PlayerState.AcceleratingHoveringRight then love.graphics.draw( sprites.accelerating_hovering_right, self.position.x - sprites.accelerating_hovering_right:getWidth() * 0.5, self.position.y - sprites.accelerating_hovering_right:getHeight() * 0.5, yaw ) end end return self end return Player
return Def.ActorFrame { LoadActor("pay") .. { Condition = GAMESTATE:GetCoinMode() == "CoinMode_Pay", OnCommand = function(self) self :xy(SCREEN_CENTER_X, SCREEN_CENTER_Y + 120) :diffuseshift() :effectcolor1(0.5, 0.5, 0.5, 1) :effectcolor2(1, 1, 1, 1) end }, LoadActor("free") .. { Condition = GAMESTATE:GetCoinMode() == "CoinMode_Free", OnCommand = function(self) self :xy(SCREEN_CENTER_X, SCREEN_CENTER_Y - 60) :diffuseshift() :effectcolor1(0.5, 0.5, 0.5, 1) :effectcolor2(1, 1, 1, 1) end }, LoadActor("jp") .. { Condition = GAMESTATE:GetPremium() == "Premium_2PlayersFor1Credit", Stretch = 1, NumTilesHigh = 1, TilesStartY = 380, TilesSpacingX = 10000, TileVelocityX = -300, OnCommand = function(self) self:xy(SCREEN_CENTER_X, SCREEN_CENTER_Y + 50) end }, LoadActor("dp") .. { Condition = GAMESTATE:GetPremium() == "Premium_DoubleFor1Credit", Stretch = 1, NumTilesHigh = 1, TilesStartY = 380, TilesSpacingY = 10000, TileVelocityX = -300, OnCommand = function(self) self:xy(SCREEN_CENTER_X, SCREEN_CENTER_Y + 50) end }, }
object_tangible_storyteller_prop_pr_lambda_shuttle_static_s01 = object_tangible_storyteller_prop_shared_pr_lambda_shuttle_static_s01:new { } ObjectTemplates:addTemplate(object_tangible_storyteller_prop_pr_lambda_shuttle_static_s01, "object/tangible/storyteller/prop/pr_lambda_shuttle_static_s01.iff")
local api = vim.api local ts = vim.treesitter local configs = require "nvim-treesitter.configs" local parsers = require "nvim-treesitter.parsers" local queries = require'nvim-treesitter.query' local locals = require'nvim-treesitter.locals' local ts_utils = require'nvim-treesitter.ts_utils' local M = {} function M.select_textobject(query_string) local bufnr = vim.api.nvim_get_current_buf() local ft = api.nvim_buf_get_option(bufnr, "ft") if not ft then return end local lang = parsers.ft_to_lang(ft) local row, col = unpack(vim.api.nvim_win_get_cursor(0)) row = row - 1 local matches = {} if string.match(query_string, '^@.*') then matches = locals.get_capture_matches(bufnr, query_string, 'textobjects') else local parser = parsers.get_parser(bufnr, lang) local root = parser:parse():root() local start_row, _, end_row, _ = root:range() local query = ts.parse_query(lang, query_string) for m in queries.iter_prepared_matches(query, root, bufnr, start_row, end_row) do for _, n in pairs(m) do if n.node then table.insert(matches, n) end end end end local match_length local smallest_range local earliest_start for _, m in pairs(matches) do if ts_utils.is_in_node_range(m.node, row, col) then local length = ts_utils.node_length(m.node) if not match_length or length < match_length then smallest_range = m match_length = length end -- for nodes with same length take the one with earliest start if match_length and length == smallest_range then local start = m.start if start then local _, _, start_byte = m.start.node:start() if not earliest_start or start_byte < earliest_start then smallest_range = m match_length = length earliest_start = start_byte end end end end end if smallest_range then if smallest_range.start then local start_range = {smallest_range.start.node:range()} local node_range = {smallest_range.node:range()} ts_utils.update_selection(bufnr, {start_range[1], start_range[2], node_range[3], node_range[4]}) else ts_utils.update_selection(bufnr, smallest_range.node) end end end function M.attach(bufnr, lang) local buf = bufnr or api.nvim_get_current_buf() local config = configs.get_module("textobjects") local lang = lang or parsers.ft_to_lang(api.nvim_buf_get_option(bufnr, "ft")) for mapping, query in pairs(config.keymaps) do if type(query) == 'table' then query = query[lang] elseif not queries.get_query(lang, 'textobjects') then query = nil end if query then local cmd = ":lua require'nvim-treesitter.textobjects'.select_textobject('"..query.."')<CR>" api.nvim_buf_set_keymap(buf, "o", mapping, cmd, {silent = true}) api.nvim_buf_set_keymap(buf, "v", mapping, cmd, {silent = true}) end end end function M.detach(bufnr) local buf = bufnr or api.nvim_get_current_buf() local config = configs.get_module("textobjects") local lang = parsers.ft_to_lang(api.nvim_buf_get_option(bufnr, "ft")) for mapping, query in pairs(config.keymaps) do if type(query) == 'table' then query = query[lang] elseif not queries.get_query(lang, 'textobjects') then query = nil end if query then api.nvim_buf_del_keymap(buf, "o", mapping) api.nvim_buf_del_keymap(buf, "v", mapping) end end end return M
function template() local extension = vim.fn.expand('%:e') local check_file = templates.."skel."..extension local file = io.open(check_file, "r") if file ~= nil then io.close(file) local command = "read "..check_file vim.cmd(command) else print("Template doesn't exist") end end
hook.Add("xWarnLoaded", "xWarnLoadedWOB", function(admin, target) if xWarn.Config.WarnOnBan then hook.Add("xAdminPlayerBanned", "xWarnHandleBan", function(target, admin, reason, time, archiveEntryId) if time == 0 then return end -- No need to do this for permabans xWarn.Database.CreateWarn((type(target) == "Player" and target:SteamID64()) or target, (type(target) == "Player" and target:Name()) or "Unknown", 0, "xWarn", "Banned", archiveEntryId) hook.Run("xWarnWarnOnBan", (type(target) == "Player" and target:SteamID64()) or target, (type(target) == "Player" and target:Name()) or "Unknown", time, archiveEntryId) end) hook.Add("xAdminCanUnBan", "xWarnHandleUnBan", function(admin, target) xAdmin.Database.IsBanned(target, function(data) if data[1] then xAdmin.Database.LastBan(target, function(lastban) if lastban[1] then xWarn.Database.DestroyBanWarn(lastban[1].id) end end) end end) end) hook.Add("xWarnCanDeleteWarning", "xWarnHandleDeleteWarn", function(admin, warn) if warn.banid and not admin:IsSuperAdmin() then return false, "This is an automatically applied warning due to a ban. It cannot be deleted by you." end end) end end )
local Unit = require("engine.unit.Unit") local Mine = {} function Mine.create(group, x, y, options) local newMine = Unit.create("Mine", group, x, y, options) return newMine end return Mine
local status_ok, _ = pcall(require, "null-ls") if not status_ok then return end local null_ls = require("null-ls") local formatting = null_ls.builtins.formatting local codeActions = null_ls.builtins.code_actions local completion = null_ls.builtins.completion -- register any number of sources simultaneously local sources = { -- Formatting formatting.autopep8, -- not necessary if pylsp formatting.stylua, formatting.clang_format, formatting.fourmolu, --formatting.prettier, codeActions.gitsigns, -- null_ls.builtins.diagnostics.write_good, completion.luasnip, } null_ls.setup({ sources = sources, -- you can reuse a shared lspconfig on_attach callback here -- on_attach = function(client) -- if client.resolved_capabilities.document_formatting then -- vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()") -- end -- end, })
table.insert(data.raw.technology["laser-rifle-1"].effects,{ type = "unlock-recipe", recipe = "electric-vehicles-lo-voltage-transformer" }) table.insert(data.raw.technology["laser-rifle-1"].effects,{ type = "unlock-recipe", recipe = "electric-vehicles-regen-brake-controller" }) table.insert(data.raw.technology["laser-rifle-2"].effects,{ type = "unlock-recipe", recipe = "electric-vehicles-hi-voltage-transformer" })
local Condition = require "condition" local BaffledBrute = Condition:extend() BaffledBrute.name = "Baffled Brute" BaffledBrute.description = "You are not smart, but at least you're strong. +2 ATK -2 MGK" function BaffledBrute:getATK() return 2 end function BaffledBrute:getMGK() return -2 end return BaffledBrute
ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.Author = "baristaner." ENT.Spawnable = true ENT.AdminOnly = true ENT.PrintName = "Koruyucu Kalkan" ENT.Category = "Abluka Sistemi" ENT.Can = abluka.kalkancan function ENT:SetupDataTables() self:NetworkVar( "Bool", 0, "PlayerRepairing" ) end