content
stringlengths 5
1.05M
|
|---|
CCSUINumLabel = class("CCSUINumLabel")
CCSUINumLabel.ctor = function (slot0)
slot0._num = 0
slot0._oldNum = 0
slot0._tweenObj = {
value = 0
}
createSetterGetter(slot0, "textFormat", "$num$", false, false, false, nil, handler(slot0, slot0.updateNumLabelView))
createSetterGetter(slot0, "numberFormater", nil)
createSetterGetter(slot0, "isTweenChangedColor", false)
createSetterGetter(slot0, "htmlColor", "", false, false, true)
end
CCSUINumLabel.onCreationComplete = function (slot0)
slot0:setNumber(0, false, true)
end
CCSUINumLabel.setNumber = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8)
if slot0._num ~= slot1 or slot3 then
if slot4 == nil then
slot4 = true
end
slot0._isRoundTween = slot4
slot0._num = slot1
TweenLite.killTweensOf(slot0._tweenObj)
if slot2 and not DisplayUtil.checkObjShowing(slot0) then
slot2 = false
end
if slot2 then
slot9 = slot0._oldNum < slot0._num
slot10 = slot0._num < slot0._oldNum
TweenLite.to(slot0._tweenObj, slot5 or 0.2, {
value = slot1,
onUpdate = function ()
if isAndroid then
else
slot0:updateNumLabelView()
end
end,
delay = slot6,
onStart = function ()
if slot0._isTweenChangedColor then
if slot1 then
slot0:setHtmlColor("#FF0000")
elseif slot2 then
slot0:setHtmlColor("#00FF00")
else
slot0:setHtmlColor(nil)
end
end
if isAndroid then
slot0:updateNumLabelView()
end
applyFunction(slot3)
end,
onComplete = function ()
if slot0._isTweenChangedColor then
slot0:setHtmlColor(nil)
slot0.setHtmlColor:updateNumLabelView()
end
applyFunction(slot1)
end
})
else
slot0._tweenObj.value = slot1
slot0:updateNumLabelView()
applyFunction(slot7)
applyFunction(slot8)
end
slot0._oldNum = slot0._num
end
end
CCSUINumLabel.stopNumTween = function (slot0)
slot0._num = nil
slot0._tweenObj.value = 0
TweenLite.killTweensOf(slot0._tweenObj)
if slot0._isTweenChangedColor then
slot0:setHtmlColor(nil)
slot0:updateNumLabelView()
end
end
CCSUINumLabel.updateNumLabelView = function (slot0)
slot1 = slot0._tweenObj.value
if slot0._isRoundTween then
slot1 = math.floor(slot1)
end
slot2 = nil
slot3 = string.gsub(slot0._textFormat, "%$num%$", (not slot0._numberFormater or slot0._numberFormater(slot1)) and tostring(slot1))
if slot0.setHtmlText then
if StringUtil.isStringValid(slot0._htmlColor) then
slot0:setHtmlText(HtmlUtil.createColorTxt(slot3, slot0._htmlColor))
else
slot0:setHtmlText(slot3)
end
else
slot0:setString(slot3)
end
end
CCSUINumLabel.destroy = function (slot0)
TweenLite.killTweensOf(slot0._tweenObj)
end
return
|
if (CLIENT) then
SWEP.PrintName = "Police Taser"
SWEP.Slot = 2
SWEP.SlotPos = 3
SWEP.IconLetter = "f"
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = false
SWEP.CSMuzzleFlashes = true
SWEP.SwayScale = 1.0
SWEP.BobScale = 1.0
killicon.AddFont("weapon_taser_ocrp","CSKillIcons",SWEP.IconLetter,Color(255,80,0,255))
end
if (SERVER) then
AddCSLuaFile("shared.lua")
end
SWEP.Base = "weapon_basegun_ocrp"
SWEP.ViewModelFOV = 45
SWEP.UseHands = true
SWEP.ViewModelFlip = false
SWEP.ViewModel = "models/weapons/c_csgo_taser.mdl"
SWEP.WorldModel = "models/weapons/csgo_world/w_eq_taser.mdl"
SWEP.HoldType = "pistol"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Peircing = 3
SWEP.Primary.Sound = nil -- We do the sound ourself based on hit or not
SWEP.Primary.Recoil = 10
SWEP.Primary.Damage = 100
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.07
SWEP.Primary.ClipSize = -1
SWEP.Primary.Delay = 0.23
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.SightsPos = Vector (3.6198, 0, 0.6007)
SWEP.SightsAng = Vector (0, 0, 0)
SWEP.RunArmOffset = Vector(1.287, -20, -10.98)
SWEP.RunArmAngle = Vector(70, 0, 0)
SWEP.IronSightsPos = Vector (5.1676, -0.2058, 2.7344)
SWEP.IronSightsAng = Vector (0, 0, 0)
function SWEP:Initialize()
self:SetHoldType(self.HoldType) -- Hold type of the 3rd person animation
end
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire( CurTime() + 10)
if SERVER then
local target = ents.Create("prop_physics")
target:SetModel("models/weapons/csgo_world/w_eq_taser.mdl")
target:SetSolid(SOLID_VPHYSICS)
target:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
target:SetColor(Color(0,0,0,0))
target:SetNoDraw(true)
target:Spawn()
target:SetPos(self.Owner:EyePos() + self.Owner:GetAimVector() * 200)
target:GetPhysicsObject():EnableMotion(false)
local target2 = ents.Create("prop_physics")
target2:SetModel("models/weapons/csgo_world/w_eq_taser.mdl")
target2:SetSolid(SOLID_VPHYSICS)
target2:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
target2:SetColor(Color(0,0,0,0))
target2:SetNoDraw(true)
target2:Spawn()
target2:SetPos(self.Owner:EyePos())
target2:GetPhysicsObject():EnableMotion(false)
local beam = constraint.Rope(target2, target, 0, 0, Vector(0,0,0), Vector(0,0,0), 150, 0, 0, 20, "cable/blue_elec", false)
beam:Activate()
local rnda = self.Primary.Recoil * -1
local rndb = self.Primary.Recoil * math.random(-1, 1)
self.Owner:ViewPunch(Angle(rnda, rndb, rndb))
timer.Simple(.1, function()
if beam:IsValid() then
beam:Remove()
end
if target:IsValid() then
target:Remove()
end
if target2:IsValid() then
target2:Remove()
end
end)
end
local tr = util.TraceLine({
start = self.Owner:EyePos(),
endpos = self.Owner:EyePos() + self.Owner:EyeAngles():Forward() * 200,
filter = function(ent)
if ent:IsValid() and ent:IsPlayer() and !(ent:EntIndex() == self.Owner:EntIndex()) then
return true
end
end,
})
if tr.Entity and tr.Entity:IsValid() then
if CLIENT then
self:EmitSound(Sound("weapons/taser/taser_hit.wav"))
else
local di = DamageInfo()
di:SetDamage(100)
di:SetAttacker(self.Owner)
di:SetInflictor(self)
di:SetDamageType(DMG_BULLET)
tr.Entity:TakeDamageInfo(di)
end
else
if CLIENT then
self:EmitSound(Sound("weapons/taser/taser_shoot.wav"))
end
end
end
function SWEP:DrawWorldModel()
local hand, offset, rotate
if not IsValid(self.Owner) then
self:DrawModel()
return
end
hand = self.Owner:GetAttachment(self.Owner:LookupAttachment("anim_attachment_rh"))
offset = hand.Ang:Right() * 1 + hand.Ang:Forward() * -3 + hand.Ang:Up() * -1
hand.Ang:RotateAroundAxis(hand.Ang:Right(), 10)
hand.Ang:RotateAroundAxis(hand.Ang:Forward(), 10)
hand.Ang:RotateAroundAxis(hand.Ang:Up(), 0)
self:SetRenderOrigin(hand.Pos + offset)
self:SetRenderAngles(hand.Ang)
self:DrawModel()
if (CLIENT) then
self:SetModelScale(1,1,1)
end
end
|
Locales['en'] = {
['distributor'] = 'Distributeur',
['press_menu'] = 'Appuyez sur ~INPUT_CONTEXT~ pour acheter une boisson.',
['bought'] = 'vous avez acheté ~b~1x ',
['not_enough'] = 'vous n\'avez ~r~pas assez~s~ d\'argent.',
}
|
return {'ahrens'}
|
local Class = require "hump.class"
BaseObject = Class{}
-- draws textured object if possible, otherwise defaults to the shape
function BaseObject:drawRectangleObject(object)
if object.image then
self:drawRectangleTexturedObject(object, 1, 1)
else
self:drawRectanglePhysicsObject(object)
end
end
function BaseObject:drawRectanglePhysicsObject(object)
love.graphics.setColor(object.color)
love.graphics.polygon("fill", object.body:getWorldPoints(object.shape:getPoints()))
love.graphics.setColor(1, 1, 1, 1)
end
function BaseObject:drawRectangleTexturedObject(object, xUpscale, yUpscale, xOffset, yOffset)
xUpscale = xUpscale or 1
yUpscale = yUpscale or 1
xOffset = xOffset or 0
yOffset = yOffset or 0
-- draw(image, xpos, ypos, angle, ratiox, ratioy, offsetx, offsety)
love.graphics.draw(object.image,
object.body:getX(), object.body:getY(),
object.body:getAngle(),
object.width*xUpscale/object.image:getWidth(), object.height*yUpscale/object.image:getHeight(),
object.image:getWidth()/2 + xOffset, object.image:getHeight()/2 + yOffset)
end
-- draws textured object if possible, otherwise defaults to the shape
function BaseObject:drawCircleObject(object)
if object.image then
self:drawCircleTexturedObject(object, 1)
else
self:drawCirclePhysicsObject(object)
end
end
function BaseObject:drawCirclePhysicsObject(object)
love.graphics.setColor(object.color)
local wx, wy = object.body:getWorldPoint(object.shape:getPoint())
love.graphics.circle("fill", wx, wy, object.shape:getRadius())
love.graphics.setColor(1, 1, 1, 1)
end
function BaseObject:drawCircleTexturedObject(object, upscale, xOffset, yOffset)
xOffset = xOffset or 0
yOffset = yOffset or 0
-- draw(image, xpos, ypos, angle, ratiox, ratioy, offsetx, offsety)
love.graphics.draw(object.image,
object.body:getX(), object.body:getY(),
object.body:getAngle(),
(object.shape:getRadius()*2*upscale)/object.image:getWidth(), (object.shape:getRadius()*2*upscale)/object.image:getHeight(),
object.image:getWidth()/2 + xOffset, object.image:getHeight()/2 + yOffset)
end
-- doesn't really make any sense to be on the base object isntead of floating around in some helper file but whatever.
function BaseObject:checkStaticBool(static)
if static then
return "static"
end
return "dynamic"
end
return BaseObject
|
ENT.Spawnable = false
ENT.AdminSpawnable = false
include( "shared.lua" )
function ENT:Think()
local effectdata = EffectData()
effectdata:SetOrigin( self.Entity:LocalToWorld( Vector(0,0,self.Entity:OBBMins().z) ) )
effectdata:SetAngles( Angle(self.Entity:GetForward()) )
effectdata:SetScale( .5 )
util.Effect( "MuzzleEffect", effectdata )
self.SmokeTimer = self.SmokeTimer or 0
if ( self.SmokeTimer > CurTime() ) then return end
self.SmokeTimer = CurTime() + 0.005
local vOffset = self.Entity:LocalToWorld( Vector(0,0,self.Entity:OBBMins().z) )
local vNormal = (vOffset - self.Entity:GetPos()):GetNormalized()
local emitter = ParticleEmitter( vOffset )
local particle = emitter:Add( "particles/smokey", vOffset )
particle:SetVelocity( vNormal * math.Rand( 10, 20 ) )
particle:SetDieTime( 1.0 )
particle:SetStartAlpha( math.Rand( 100, 150 ) )
particle:SetStartSize( math.Rand( 5, 10 ) )
particle:SetEndSize( math.Rand( 20, 50 ) )
particle:SetRoll( math.Rand( -0.2, 0.2 ) )
particle:SetColor( 160, 160, 160 )
emitter:Finish()
end
|
-- Luigi's Mansion (PAL v1.0)
local core = require("games.core")
return core.newGame(0x804B8590)
|
--[[
The history ui window is managed in another module
Example Usuage:
local history = require(thismodule)
local selection = {obj1, obj2}
history.beginAction(selection, "testAction")
obj1.colour = colour:random()
something(obj2)
history.endAction()
]]
local limit = 100 -- how many actions can we store
local shared = require("tevgit:workshop/controllers/shared.lua")
local pointer = limit
local actions = {}
-- used internally to prevent unfinished actions
local actionInProgress = false
local callback = nil
-- Used to track changes during an action
local changes = {}
local destroyedObjects = {}
local newObjects = {}
local eventListeners = {}
local actionName = ""
-- oldValue added to changed event from "POTATO 0.7.0"
local function changedListener(property, value, oldValue)
local changedObject = self.object
if not changes[changedObject] then
changes[changedObject] = {}
end
if not changes[changedObject][property] then
changes[changedObject][property] = {oldValue, value}
else
-- do not change the old value, we've already recorded it.
changes[changedObject][property][2] = value
end
end
local function destroyingListener()
local changedObject = self.object
if not changes[changedObject] then
changes[changedObject] = {}
end
-- Object is being destroyed, let's save a copy of all their writable properties so the user can undo this action
local members = workshop:getMembersOfObject( changedObject )
local toStore = {}
for _, prop in pairs(members) do
local val = object[prop.property]
local pType = type(val)
if prop.writable and pType ~= "function" then
-- We can save it and re-construct it
toStore[prop.property] = val
end
end
toStore["parent"] = changedObject.parent
table.insert(destroyedObjects, toStore)
end
local function ChildAddedListener(child)
table.insert(newObjects, child)
end
local function count(dictionary)
local i = 0
for _,v in pairs(dictionary) do i = i + 1 end
return i
end
-- Tell this module that we're about to change some things
-- the module will register changed callbacks to record the before/after
--
-- object : table of teverse objects or teverse object
-- name : name of the event/action
--
-- you need to call endAction after completing your changes to the objects
local function beginAction( object, name )
assert(not actionInProgress, "please use endAction before starting another")
actions[pointer+1] = nil
actionInProgress = true
actionName = name or ""
if type(object) == "table" then
for _,v in pairs(object) do
table.insert(eventListeners, v:onSync("changed", changedListener))
table.insert(eventListeners, v:onSync("destroying", destroyingListener))
table.insert(eventListeners, v:onSync("childAdded", ChildAddedListener))
end
else
table.insert(eventListeners, object:onSync("changed", changedListener))
table.insert(eventListeners, object:onSync("destroying", destroyingListener))
table.insert(eventListeners, object:onSync("childAdded", ChildAddedListener))
end
end
local function endAction()
assert(actionInProgress, "you must call beginAction first")
-- stop listening to the objects
for _,v in pairs(eventListeners) do
v:disconnect()
end
eventListeners = {}
-- if nothing changed dont create an action
if count(changes) > 0 or #destroyedObjects > 0 or #newObjects > 0 then
pointer = pointer + 1
if pointer >= limit then
actions[pointer - limit] = nil
end
actions[pointer] = {os.time(), actionName, changes, destroyedObjects, newObjects}
changes = {}
destroyedObjects = {}
newObjects = {}
if type(callback) == "function" then
callback()
end
end
actionInProgress = false
end
local function undo()
if actions[pointer] ~= nil then
for object, properties in pairs(actions[pointer][3]) do
if object and object.alive then
for property, values in pairs(properties) do
--values[1] = original value
--values[2] = changed value
object[property] = values[1]
end
else
warn("need to put logic here")
end
end
pointer = pointer - 1
if type(callback) == "function" then
callback()
end
else
print("nothing to undo")
end
end
local function redo()
if actions[pointer + 1] ~= nil then
pointer = pointer + 1
for object, properties in pairs(actions[pointer][3]) do
for property, values in pairs(properties) do
--values[1] = original value
--values[2] = changed value
object[property] = values[2]
end
end
if type(callback) == "function" then
callback()
end
else
print("nothing to redo")
end
end
local keybinder = require("tevgit:workshop/controllers/core/keybinder.lua")
keybinder:bind({
name = "undo",
priorKey = enums.key.leftCtrl,
key = enums.key.z,
action = undo
})
keybinder:bind({
name = "redo",
priorKey = enums.key.leftCtrl,
key = enums.key.y,
action = redo
})
return {
beginAction = beginAction,
endAction = endAction,
getActions = function() return actions end,
getPointer = function() return pointer end,
limit = limit,
setCallback = function (cb)
callback = cb
end,
undo = undo,
redo = redo,
count = count
}
|
local widget = require( "widget" )
local composer = require( "composer" )
local json = require ("json")
local loadsave = require( "loadsave" )
local myData = require ("mydata")
local hackMissionTutScene = composer.newScene()
local tutPage=1
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
--> GENERAL FUNCTIONS
---------------------------------------------------------------------------------
local close = function(event)
if (event.phase == "ended") then
if (tutPage==1) then
local tutorialStatus = {
tutHackMission = true
}
loadsave.saveTable( tutorialStatus, "hackMissionTutorialStatus.json" )
tutOverlay = false
composer.hideOverlay( "fade", 200 )
end
end
end
local function onAlert()
end
---------------------------------------------------------------------------------
--> SCENE EVENTS
---------------------------------------------------------------------------------
-- Scene Creation
function hackMissionTutScene:create(event)
tutGroup = self.view
loginInfo = localToken()
tutIconSize=fontSize(300)
myData.terminalTutRect = display.newImageRect( "img/terminal_tutorial.png",display.contentWidth/1.2, display.contentHeight / 3 )
myData.terminalTutRect.anchorX = 0.5
myData.terminalTutRect.anchorY = 0.5
myData.terminalTutRect.x, myData.terminalTutRect.y = display.contentWidth/2,display.actualContentHeight/2
changeImgColor(myData.terminalTutRect)
local options =
{
text = "\nThis is an experimental feature in beta stage!\nFeel free to explore it!\n\nPlease refer to the app tutorial for more info",
x = myData.terminalTutRect.x,
y = myData.terminalTutRect.y-myData.terminalTutRect.height/2+fontSize(100),
width = myData.terminalTutRect.width-80,
font = native.systemFont,
fontSize = 42,
align = "center"
}
myData.instruction = display.newText( options )
myData.instruction:setFillColor( 0.9,0.9,0.9 )
myData.instruction.anchorX=0.5
myData.instruction.anchorY=0
myData.completeButton = widget.newButton(
{
left = myData.terminalTutRect.x-myData.terminalTutRect.width/2+60,
top = myData.terminalTutRect.y+myData.terminalTutRect.height/2-fontSize(120),
width = 400,
height = fontSize(90),
defaultFile = buttonColor400,
-- overFile = "buttonOver.png",
fontSize = fontSize(60),
label = "Close",
labelColor = tableColor1,
onEvent = close
})
myData.completeButton.anchorX=0.5
myData.completeButton.anchorY=1
myData.completeButton.x = myData.terminalTutRect.x
-- Show HUD
tutGroup:insert(myData.terminalTutRect)
tutGroup:insert(myData.instruction)
tutGroup:insert(myData.completeButton)
-- Button Listeners
myData.completeButton:addEventListener("tap", close)
end
-- Home Show
function hackMissionTutScene:show(event)
local tasktutGroup = self.view
if event.phase == "will" then
-- Called when the scene is still off screen (but is about to come on screen).
end
if event.phase == "did" then
--
end
end
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
--> Listener setup
---------------------------------------------------------------------------------
hackMissionTutScene:addEventListener( "create", hackMissionTutScene )
hackMissionTutScene:addEventListener( "show", hackMissionTutScene )
---------------------------------------------------------------------------------
return hackMissionTutScene
|
return {'yoga','yogalessen','yogaoefening','yoghurt','yoghurtdrank','yoghurtijs','yogi','yoghurtbeker','yoghurtplant','yoghurtsaus','yogales','yogyakarta','yogaoefeningen','yogis','yoghurtbekers','yoghurtdrankjes','yoghurtdrankje','yoghurtdranken'}
|
buffer = Procedural.TextureBuffer(128)
Procedural.Gradient(buffer):process()
Procedural.Invert(buffer):process()
tests:addTextureBuffer(buffer)
dotfile = tests:getDotFile("texture_16", "Invert_Demo")
dotfile:set("Gradient", "texture_gradient", "Invert", "texture_invert")
|
local logic = require "logic"
local M = {}
M.__index = M
function M.new(...)
local o = {}
setmetatable(o, M)
M.init(o, ...)
return o
end
function M:init()
-- 游戏变量
self.sice_count = {0, 0, 0, 0}
self.game_score = {0, 0, 0, 0}
self.banker_user = logic.INVALID_CHAIR
self.player_count = logic.GAME_PLAYER
self.card_index = {} -- create the matrix
--for i = 1, logic.GAME_PLAYER do
--self.card_index[i] = {} -- create a new row
--for j = 1, logic.MAX_INDEX do
--self.card_index[i][j] = 0
--end
--end
self.trustee = {false, false, false, false}
self.ready = {false, false, false, false}
self.play_status = {false, false, false, false}
-- 出牌信息
self.out_card_data = 0
self.out_card_count = 0
self.out_card_user = logic.INVALID_CHAIR
self.discard_count = 0
self.discard_card = {} -- create the matrix
for i = 1, logic.GAME_PLAYER do
self.discard_card[i] = {} -- create a new row
end
-- 发牌信息
self.send_card_data = 0
self.send_card_count = 0
self.left_card_count = 0
self.repertory_card = {}
for i, v in ipairs(logic.CARD_DATA_ARRAY) do
self.repertory_card[i] = v
end
-- 堆立信息
self.heap_hand = logic.INVALID_CHAIR
self.heap_tail = logic.INVALID_CHAIR
self.heap_card_info = {}
for i = 1, logic.GAME_PLAYER do
self.heap_card_info [i] = {}
for j = 1, 2 do
self.heap_card_info [i][j] = 0
end
end
-- 运行变量
self.provide_card = 0
self.resume_user = logic.INVALID_CHAIR
self.current_user = logic.INVALID_CHAIR
self.provide_user = logic.INVALID_CHAIR
-- 状态变量
self.send_status = false
self.gang_status = false
self.enjoin_chihu = {false, false, false, false}
self.enjoin_chipeng = {false, false, false, false}
-- 用户状态
self.response = {false, false, false, false}
self.user_action = {0, 0, 0, 0}
self.operate_card = {0, 0, 0, 0}
self.perform_action = {0, 0, 0, 0}
-- 组合扑克
self.weave_item_array = {}
self.weave_item_count = {0, 0, 0, 0}
-- 结束信息
self.chihu_card = 0
self.chihu_mask = {0, 0, 0, 0}
-- 胜利用户
self.winuser = logic.INVALID_CHAIR
self.room_owner = logic.INVALID_CHAIR
-- 游戏局数
self.game_status = false
self.gamen_number = logic.INVALID_CHAIR
-- 分数
self.cell_score = 0
self.least_score = 0
-- 用户
self.player = {}
end
function send_client(gate, uid, v)
skynet.send(gate, "lua", "send_client", uid, v)
end
function M:send_table(chairid, msg)
if chairid ~= logic.INVALID_CHAIR then
for i, v in ipairs(self.player) do
send_client(v.gate, uid, msg)
end
else
send_client(self.player[i].gate, self.player[i].profile.uid, msg)
end
end
-- 发送操作
function M:send_operate_notify()
-- 发送提示
for i = 1, logic.GAME_PLAYER do
if self.user_action[i] ~= logic.WIK_NULL then
local msg = {
cmd = "operate_notify",
resume_user = self.resume_user,
action_card = self.provide_card
action_mask = self.user_action[i]
}
self:send_table(i, msg)
-- TODO 超时
end
end
end
-- 游戏开始
function M:start()
for i = 1, logic.GAME_PLAYER do
self.sice_count[i] = math.random(6)
end
-- 混乱扑克
logic.shuffle(self.repertory_card)
self.left_card_count = #self.repertory_card
self.banker_user = ((self.sice_count[1] + self.sice_count[2]) - 1) % logic.GAME_PLAYER + 1
-- 分发扑克
for i = 1, logic.GAME_PLAYER do
self.left_card_count = self.left_card_count - (logic.MAX_COUNT - 1)
local card_data = {}
for j = 1, logic.MAX_COUNT - 1 do
card_data[j] = self.repertory_card[self.left_card_count + i]
end
self.card_index[i] = logic.card2index_array(card_data)
end
-- 发送扑克
self.send_card_count = self.send_card_data + 1
self.send_card_data = self.repertory_card[self.left_card_count]
self.left_card_count = self.left_card_count - 1;
local card_count = self.card_index[self.banker_user][logic.card2index(self.send_card_data)]
self.card_index[self.banker_user][logic.card2index(self.send_card_data)] = card_count + 1
self.current_user = self.banker_user
-- 杠牌判断
self.user_action[self.banker_user] = logic.analyse_gang_card(self.card_index[self.banker_user])
-- 胡牌判断
self.user_action[self.banker_user] = self.user_action[self.banker_user] | logic.analyse_chihu_card(self.card_index[self.banker_user])
self.game_status = true
local msg = {
cmd = "start",
sice_count = {self.sice_count[1], self.sice_count[2], self.sice_count[3], self.sice_count[4]},
banker_user = self.banker_user,
current_user = self.current_user,
heap_hand = self.heap_hand,
heap_tail = self.heap_tail,
left_card_count = self.left_card_count,
gamen_number = self.gamen_number,
player = self.player
}
--发送数据
for i = 1, self.player_count do
msg.chairid = i
msg.user_action = self.user_action[i]
msg.card_data = logic.index2card_array.(self.card_index[i])
msg.card_count = #msg.card_data
self:send_table(i, msg)
end
end
function M:over()
self.gamen_number = self.game_number - 1
local msg = {
cmd = "over",
left_user = logic.INVALID_CHAIR,
win_user = self.win_user,
provide_card = self.provide_card,
provide_user = self.provide_user,
game_number = self.gamen_number
}
msg.card_info = {}
for i = i, logic.GAME_PLAYER do
local card_info = {
chairid = i,
card_data = logic.index2card_array(self.card_index[i])
card_count = #card_data
chihu_mask = self.chihu_mask[i]
score = self.game_score[i]
}
msg.card_info[i] = card_info
end
-- 发送结束信息
self:send_table(logic.INVALID_CHAIR, msg)
--reset()
-- 局数用完结束
end
-- 派发扑克
function M:dispatch_card_data(current_user, tail)
-- 状态效验
if current_user == logic.INVALID_CHAIR then
return false
end
-- 丢弃扑克
if self.out_card_user != logic.INVALID_CHAIR and self.out_card_data ~= 0 then
self.discard_count[self.out_card_user] = self.discard_count[self.out_card_user] + 1
self.discard_card[self.out_card_user][#self.discard_card[self.out_card_user] + 1] = self.out_card_data
end
-- 荒庄结束
if self.left_card_count == 0 then
self.chihu_card = 0
self.provide_user = logic.INVALID_CHAIR
self:over()
return true
end
-- 设置变量
self.out_card_data = 0
self.current_user = current_user
self.out_card_user = logic.INVALID_CHAIR
self.enjoin_chihu[current_user] = false
-- 发牌处理
if self.send_status == true then
-- 发送扑克
self.send_card_count = self.send_card_count + 1
self.send_card_data = self.repertory_card[self.left_card_count]
self.left_card_count = self.left_card_count - 1
-- 加牌
local card_count = self.card_index[current_user][logic.card2index(self.send_card_data)]
self.card_index[current_user][logic.card2index(self.send_card_data)] = card_count + 1
-- 杠牌判断
if self.enjoin_chipeng[current_user] == false and self.left_card_count > 1 then
self.user_action[current_user] = self.user_action[current_user] | logic.analyse_gang_card(self.card_index[current_user])
end
--胡牌判断
self.user_action[current_user] = self.user_action[current_user] | logic.analyse_chihu_card(self.card_index[self.banker_user], self.weave_item_array[current_user])
end
--//堆立信息
--//assert( m_wHeapHand != INVALID_CHAIR && m_wHeapTail != INVALID_CHAIR )
--if( !bTail )
--{
--//切换索引
--uint8_t cbHeapCount=m_cbHeapCardInfo[m_wHeapHand][0]+m_cbHeapCardInfo[m_wHeapHand][1]
--if (cbHeapCount==HEAP_FULL_COUNT)
--m_wHeapHand=(m_wHeapHand+1)%CountArray(m_cbHeapCardInfo)
--m_cbHeapCardInfo[m_wHeapHand][0]++
--}
--else
--{
--//切换索引
--uint8_t cbHeapCount=m_cbHeapCardInfo[m_wHeapTail][0]+m_cbHeapCardInfo[m_wHeapTail][1]
--if (cbHeapCount==HEAP_FULL_COUNT)
--m_wHeapTail=(m_wHeapTail+3)%CountArray(m_cbHeapCardInfo)
--m_cbHeapCardInfo[m_wHeapTail][1]++
--}
local msg = {
cmd = "send_card",
current_user = current_user,
action_mask = self.user_action[current_user],
card_data = self.send_status == true and self.send_card_data or 0x00
}
self:send_table(logic.INVALID_CHAIR, msg)
--// TODO timer
end
-- 响应判断
function M:estimate_user_respond(center_user, center_card, is_out_card)
-- 变量定义
local arose_action = false
-- 用户状态
self.response = {false, false, false, false}
self.user_action = {0, 0, 0, 0}
self.perform_action = {0, 0, 0, 0}
-- 动作判断
for i = 1, self.player_count do
-- 用户过滤
if center_user ~= i then
-- 出牌类型
if is_out_card == true then
-- 吃碰判断
if self.enjoin_chipeng[i] == false then
-- 碰牌判断
self.user_action[i]= self.user_action[i] | logic.estimate_peng_card(self.card_index[i], center_card)
-- 吃牌判断
local eat_user = (center_user - 1) % self.player_count + 1
if eat_user == i then
self.user_action[i] = self.user_action[i] | logic.estimate_eat_card(self.card_index[i], center_card)
end
-- 杠牌判断
if self.left_card_count > 1 then
self.user_action[i] = self.user_action[i] | logic.estimate_gang_card(self.card_index[i], center_card)
end
end
end
-- 胡牌判断
if self.enjoin_chihu[i] == false then
--胡牌判断
self.user_action[i] = self.user_action[i] | logic.analyse_chihu_card(self.card_index[i], self.weave_item_array[i], center_card)
-- 吃胡限制
if (self.user_action[i] & logic.WIK_CHI_HU) ~= 0 then
self.enjoin_chihu[i]=true
end
end
-- 结果判断
if self.user_action[i] ~= logic.WIK_NULL then
arose_action = true
end
end
end
-- 结果处理
if arose_action == true then
-- 设置变量
self.provide_user = center_user
self.provide_card = center_card
self.resume_user = self.current_user
self.current_user = logic.INVALID_CHAIR
-- 发送提示
self:send_operate_notify()
return true
end
return false
end
-- 用户托管
function M:trustee(chairid, trustee)
self.trustee[chairid] = trustee
-- 构造数据
local msg = {
cmd = "trustee",
trustee = trustee,
chairid = chairid
}
-- 发送消息
self:send_table(logic.INVALID_CHAIR, msg)
end
-- 用户进入
function M:enter(player)
local chairid = logic.INVALID_CHAIR
for i=1, logic.GAME_PLAYER do
if next(self.player[i]) == nil then
chairid = i
player.chairid = i
self.player[i] = player
end
end
if chairid == logic.INVALID_CHAIR then
return chairid
end
local msg = {
cmd = "enter",
player = self.player
}
send_table(logic.INVALID_CHAIR, msg)
return chairid
end
-- 用户准备
function M:ready(chairid)
self.ready[chairid] = true
for i=1, logic.GAME_PLAYER do
if not self.ready[i] then
local msg = {
cmd = "ready",
ready_user = chairid
}
--发送消息
self:send_table(logic.INVALID_CHAIR, msg)
return
end
end
self:start()
end
-- 用户离开
function M:leave(chairid)
if self.ready[chairid] == true then
return false
end
self.ready[chairid]=false
local msg = {
cmd = "leave",
leave_user = chairid
}
self:send_table(logic.INVALID_CHAIR, msg)
-- 再移除
self.player[chairid] = {}
-- 没人删除游戏
if #self.player == 0 then
self = nil
end
return true
end
-- 用户被踢
function M:kick(chairid)
if game_status then
return false
end
if chairid == self.room_owner then
return false
end
self.ready[chairid] = false
self:send_table(logic.INVALID_CHAIR, {cmd = "kick", kick_user = chairid})
-- 再移除
self.player[chairid] = {}
return true
end
-- 用户听牌
function M:listen(chairid)
-- TODO if is_listen
self.enjoin_chipeng[chairid] = true
self:send_table(logic.INVALID_CHAIR, {cmd = "listen", listen_user = chairid})
end
-- 用户出牌
function M:out_card(chairid, card_data)
-- 效验参数
if chairid ~= self.current_user then
return false
end
if not logic.is_valid_card(card_data) then
return false
end
-- 删除扑克
if not logic.remove_card(self.card_index[chairid], card_data) then
return false
end
--StopAllTimer()
--设置变量
self.send_status = true
self.user_action[chairid] = logic.WIK_NULL
self.perform_action[chairid] = logic.WIK_NULL
-- 出牌记录
self.out_card_count = self.out_card_count + 1
self.out_card_user = chairid
self.out_card_data = card_data
local msg = {
cmd = "out_card",
out_card_user = chairid,
out_card_data = card_data
}
--发送消息
self.send_table(logic.INVALID_CHAIR, msg)
self.provide_user = chairid
self.providecard = card_data
--用户切换
self.current_user = (chairid - 1) % self.player_count + 1
--while( !m_bPlayStatus[m_wCurrentUser] )
--m_wCurrentUser=(m_wCurrentUser+m_wPlayerCount-1)%m_wPlayerCount
-- 响应判断
local arose_action = self:estimate_user_respond(chairid, card_data, true)
-- 派发扑克
if not arose_action then
self:dispatch_card_data(self.current_user)
end
end
-- 用户操作
function M:operate_card(chairid, operate_code, operate_card)
-- 效验用户
if (chairid ~= self.current_user) and (self.current_user ~= logic.INVALID_CHAIR) then
return false
end
-- 被动动作
if self.current_user == logic.INVALID_CHAIR then
-- 效验状态
if self.response[chairid] == true then
return false
end
if (operate_code ~= logic.WIK_NULL) and ((self.user_action[chairid] & operate_code) == 0) then
return false
end
local target_user = chairid
local target_action = operate_code
self.response[chairid] = true
self.perform_action[chairid] = operate_code
self.operate_card[chairid] = operate_card == 0 and self.provide_card or operate_card
for i=0, logic.GAME_PLAYER do
-- 获取动作
local user_action = self.response[i] == false and self.user_action[i] or self.perform_action[i]
-- 优先级别
local user_action_rank = logic.get_user_action_rank(user_action)
local target_action_rank = logic.get_user_action_rank(target_action)
if user_action_rank > target_action_rank then
target_user = i
target_action = user_action
end
end
if self.response[target_user] == false then
return true
end
-- 吃胡等待
if target_action == logic.WIK_CHI_HU then
-- TODO
--for i=(self.provide_user - 1) % GAME_PLAYER, i!=self.provide_user, i=(i - 1) % GAME_PLAYER do
for i = 1, logic.GAME_PLAYER do
-- 截胡 不用等待所有回应
--if (self.response[i] == true) and ((self.user_action[i] & WIK_CHI_HU) ~= 0) and ((self.perform_action[i] & WIK_CHI_HU) ~= 0) then
--break
--end
if (self.response[i] == false) and (self.user_action[i] & logic.WIK_CHI_HU) ~=0 then
return true
end
end
end
-- 放弃操作
if target_action == logic.WIK_NULL then
-- 用户状态
self.response = {false, false, false, false}
self.user_action = {0, 0, 0, 0}
self.operate_card = {0, 0, 0, 0}
self.perform_action = {0, 0, 0, 0}
-- 发送扑克
self:dispatch_card_data(self.resume_user)
return true
end
-- 变量定义
local target_card = self.operate_card[target_user]
-- 出牌变量
self.out_card_data = 0
self.send_status = true
self.out_card_user = logic.INVALID_CHAIR
self.enjoin_chihu[target_user] = false
-- 胡牌操作
if target_action == logic.WIK_CHI_HU then
-- 结束信息
self.chihu_card = target_card.
-- 吃牌权位
-- 胡牌判断
for i = 1, GAME_PLAYER do
-- 过虑判断
if (i ~= self.provide_user) and (self.perform_action[i] & logic.WIK_CHI_HU) ~= 0 then
-- 普通胡牌
if self.chihu_card ~= 0 then
-- 胡牌判断
self.chihu_mask[i] = logic.analyse_chihu_card(self.card_index[i], self.weave_item[i], self.chihu_card)
-- 插入扑克
if self.chihu_mask[i] ~= logic.WIK_NULL then
local card_count = self.card_index[i][logic.card2index(self.chihu_card)]
self.card_index[i][logic.card2index(self.chihu_card)] = card_count + 1
end
end
end
-- 结束游戏
over()
return true
end
end
-- 用户状态
self.response = {false, false, false, false}
self.user_action = {0, 0, 0, 0}
self.operate_card = {0, 0, 0, 0}
self.perform_action = {0, 0, 0, 0}
-- 组合扑克
local index = #self.weave_item_array[target_user]
asser(index < 5)
index = index + 1
self.weave_item_array[target_user][index].public_card = true
self.weave_item_array[target_user][index].center_card = target_card
self.weave_item_array[target_user][index].weave_type = target_action
self.weave_item_array[target_user][index].provide_user = self.provide_user == logic.INVALID_CHAIR and target_user or provide_user
-- 删除扑克
if target_action == logic.WIK_LEFT then
local remove_card = {target_card + 1, target_card + 2}
logic.remove_card(self.card_index[target_user], remove_card)
elseif target_action == logic.WIK_RIGHT then
local remove_card = {target_card - 2, target_card - 1}
logic.remove_card(self.card_index[target_user], remove_card)
elseif target_action == logic.WIK_CENTER then
local remove_card = {target_card - 1, target_card + 1}
logic.remove_card(self.card_index[target_user], remove_card)
elseif target_action == logic.WIK_PENG then
local remove_card = {target_card, target_card}
logic.remove_card(self.card_index[target_user], remove_card)
elseif target_action == logic.WIK_GANG then
local remove_card = {target_card, target_card, target_card}
logic.remove_card(self.card_index[target_user], remove_card)
else
assert(false)
end
local msg = {
cmd = "operate_card",
operate_user = target_user,
operate_card = target_card,
operate_code = target_action,
provide_user = self.provide_user == logic.INVALID_CHAIR and target_user or self.provide_user
}
self:send_table(logic.INVALID_CHAIR, msg)
-- 设置用户
self.current_user = target_user
-- 杠牌处理
if target_action == logic.WIK_GANG then
self.gang_status = true
self:dispatch_card_data(Target_User, false)
end
return true
end
-- 主动动作
if self.current_user == chairid then
-- 效验操作
if operate_code == logic.WIK_NULL or ((self.user_action[chairid] & operate_code) == 0) then
return false
end
-- 扑克效验
if operate_code ~= logic.WIK_NULL and cbOperateCode ~= logic.WIK_CHI_HU and logic.is_valid_card(operate_card) == false then
return false
end
-- 设置变量
self.send_status = true
self.enjoin_chihu[self.current_user] = false
self.user_action[self.current_user] = logic.WIK_NULL
self.perform_action[self.current_user] = logic.WIK_NULL
local public = false
-- 执行动作
if operate_code == logic.WIK_GANG or operate_code == logic.WIK_FILL then
-- 变量定义
local weave_index = 0xFF
local card_index = logic.card2index(operate_card)
-- 杠牌处理
if self.card_index[chairid][card_index] == 1 then
-- 寻找组合
for i = 1, #self.weave_item_array[chairid] do
local weave_type = self.weave_item_array[chairid][i].weave_type
local center_card = self.weave_item_array[chairid][i].center_card
if center_card == operate_card and weave_type == logic.WIK_PENG then
public = true
weave_index = i
break
end
end
-- 效验动作
if weave_index == 0xFF then
return false
end
-- 组合扑克
self.weave_item_array[chairid][weave_index].public_card = true
self.weave_item_array[chairid][weave_index].provide_user = chairid
self.weave_item_array[chairid][weave_index].weave_type = operate_code
self.weave_item_array[chairid][weave_index].center_card = operate_card
else
-- 扑克效验
if self.card_index[chairid][card_index] != 4 then
return false
end
-- 设置变量
public = false
weave_index = #self.weave_item_array[chairid]
weave_index = weave_index + 1
self.weave_item_array[chairid][weave_index].public_card = true
self.weave_item_array[chairid][weave_index].provide_user = chairid
self.weave_item_array[chairid][weave_index].weave_type = operate_code
self.weave_item_array[chairid][weave_index].center_card = operate_card
end
-- 删除扑克
self.card_index[chairid][card_index] = 0
-- 设置状态
if operate_code == logic.WIK_GANG then
self.gang_status = true
end
local msg = {
cmd = "operate_card",
operate_user = chairid,
provide_user = chairid,
operate_card = operate_card,
operate_code = operate_code
}
self:send_table(logic.INVALID_CHAIR, msg)
--效验动作
local arose_action = false
if public == true then
arose_action = self:estimate_user_respond(chairid, operate_card, false)
end
-- 发送扑克
if arose_action == false then
self:dispatch_card_data(chairid)
end
return true
elseif operate_code == logic.WIK_CHI_HU then
if self.out_card_count == 0 then
self.provide_user = self.current_user
self.provide_card = self.send_card_data
end
-- 胡牌判断
self.chihu_mask[i] = logic.analyse_chihu_card(self.card_index[i], self.weave_item[i])
-- 结束信息
self.chihu_card = self.provide_card
-- 结束游戏
self:over()
return true
else
assert(false)
end
end
return false
end
return M
|
local skynet = require "skynet"
require "Common.Util.util"
require "game.ECS.ECS"
local NORET = {}
local CMD = {}
local this = {
--the scene object includes the role monster npc
scene_uid = 0,
role_list = {},
npc_list = {},
monster_list = {},
entity_mgr = false,
}
local SceneObjectType={
Role=1,Monster=2,NPC=3,
}
local SceneInfoKey = {
EnterScene=1,
LeaveScene=2,
PosChange=3,
}
local new_scene_uid = function ( scene_obj_type )
this.scene_uid = scene_obj_type*10000000000+this.scene_uid + 1
return this.scene_uid
end
--enter_radius should be smaller than leave_radius
local get_around_roles = function ( role_id, enter_radius, leave_radius )
return this.role_list
end
local add_info_item = function ( change_obj_infos, scene_uid, info_item )
change_obj_infos = change_obj_infos or {obj_infos={}}
local cur_info = nil
for i,v in ipairs(change_obj_infos.obj_infos) do
if v.scene_obj_uid == scene_uid then
cur_info = v
end
end
if not cur_info then
cur_info = {scene_obj_uid=scene_uid, info_list={}}
table.insert(change_obj_infos.obj_infos, cur_info)
end
table.insert(cur_info.info_list, info_item)
return change_obj_infos
end
local init_npc = function ( )
if not this.scene_cfg or not this.scene_cfg.npc_list then return end
for k,v in pairs(this.scene_cfg.npc_list) do
local npc = {}
npc.id = v.npc_id
npc.uid = new_scene_uid(SceneObjectType.Role)
npc.pos_x = v.pos_x
npc.pos_y = v.pos_y
npc.pos_z = v.pos_z
table.insert(this.npc_list, npc)
end
end
local init_monster = function ( )
end
function CMD.init(scene_id)
ECS:InitWorld("scene_world")
this.entity_mgr = ECS.World.Active:GetOrCreateManager(ECS.EntityManager)
-- this.npc_archetype = this.entity_mgr:CreateArchetype({ECS.Position, ECS.Rotation})
-- this.entity_mgr:CreateEntity(this.npc_archetype)
print('Cat:scene.lua[init] scene_id', scene_id)
this.scene_cfg = require("Config.scene.config_scene_"..scene_id)
init_npc()
init_monster()
Time = {deltaTime=0}
lastUpdateTime = os.time()
skynet.fork(function()
while true do
local curTime = os.time()
Time.deltaTime = curTime-lastUpdateTime
lastUpdateTime = curTime
ECS:Update()
skynet.sleep(10)
end
end)
skynet.fork(function()
while true do
--synch info at fixed time
for k,role_info in pairs(this.role_list) do
-- print("Cat:scene [start:46] role_info.change_obj_infos:", role_info.change_obj_infos)
-- PrintTable(role_info.change_obj_infos)
-- print("Cat:scene [end]")
if role_info.change_obj_infos and role_info.ack_scene_get_objs_info_change then
role_info.ack_scene_get_objs_info_change(true, role_info.change_obj_infos)
role_info.change_obj_infos = nil
role_info.ack_scene_get_objs_info_change = nil
end
end
skynet.sleep(10)
end
end)
end
function CMD.role_enter_scene(role_id)
print('Cat:scene.lua[role_enter_scene] role_id', role_id)
do
--tell every one a new role enter scene
for k,v in pairs(this.role_list) do
v.change_obj_infos = add_info_item(v.change_obj_infos, v.scene_uid, {key=SceneInfoKey.EnterScene, value=SceneObjectType.Role, time=os.time()})
end
end
if not this.role_list[role_id] then
local scene_uid = new_scene_uid(SceneObjectType.Role)
this.role_list[role_id] = {scene_uid=scene_uid}
--tell the new guy who are here
for k,v in pairs(this.role_list) do
if v.scene_uid ~= scene_uid then
this.role_list[role_id].change_obj_infos = add_info_item(this.role_list[role_id].change_obj_infos, v.scene_uid, {key=SceneInfoKey.EnterScene, value=SceneObjectType.Role, time=os.time()})
end
end
for k,v in pairs(this.npc_list) do
this.role_list[role_id].change_obj_infos = add_info_item(this.role_list[role_id].change_obj_infos, v.scene_uid, {key=SceneInfoKey.EnterScene, value=SceneObjectType.NPC, time=0})
end
end
end
function CMD.role_leave_scene(role_id)
local role_info = this.role_list[role_id]
print('Cat:scene.lua[role_leave_scene] role_id', role_id, role_info)
if not role_info then return end
--tell every one this role leave scene
for k,v in pairs(this.role_list) do
local cur_role_id = k
if v.cur_role_id ~= role_id then
v.change_obj_infos = add_info_item(v.change_obj_infos, role_info.scene_uid, {key=SceneInfoKey.LeaveScene, value=SceneObjectType.Role, time=os.time()})
end
end
if role_info.ack_scene_get_objs_info_change then
role_info.ack_scene_get_objs_info_change(true, {})
end
this.role_list[role_id] = nil
end
function CMD.scene_get_main_role_info( user_info, req_data )
print('Cat:scene.lua[scene_get_main_role_info] user_info, req_data', user_info, user_info.cur_role_id)
return {
role_info={
scene_uid=this.role_list[user_info.cur_role_id].scene_uid,
role_id=user_info.cur_role_id,
career=2,name="haha"
}
}
end
function CMD.scene_walk( user_info, req_data )
-- print('Cat:scene.lua[scene_get_main_role_info] user_info, req_data', user_info, user_info.cur_role_id)
local role_info = this.role_list[user_info.cur_role_id]
if role_info then
role_info.pos = {x=req_data.pos_x, y=req_data.pos_y, z=req_data.pos_z}
local pos_info = role_info.pos.x..","..role_info.pos.y..","..role_info.pos.z
-- print('Cat:scene.lua[116] pos_info', pos_info, role_info.scene_uid)
--for test
for k,v in pairs(this.role_list) do
local role_id = k
-- print('Cat:scene.lua[101] role_id, user_info.cur_role_id', role_id, user_info.cur_role_id, v.scene_uid, role_info.scene_uid)
if role_id ~= user_info.cur_role_id then
v.change_obj_infos = add_info_item(v.change_obj_infos, role_info.scene_uid, {key=SceneInfoKey.PosChange, value=pos_info, time=os.time()})
end
end
end
return {}
end
function CMD.scene_get_objs_info_change( user_info, req_data )
-- print('Cat:scene.lua[scene_get_objs_info_change] user_info, role_id', user_info, user_info.cur_role_id)
local role_info = this.role_list[user_info.cur_role_id]
if role_info and not role_info.ack_scene_get_objs_info_change then
--synch info at fixed time
role_info.ack_scene_get_objs_info_change = skynet.response()
return NORET
end
return {}
end
skynet.start(function()
skynet.dispatch("lua", function(session, source, command, ...)
local f = assert(CMD[command])
local r = f(...)
if r ~= NORET then
skynet.ret(skynet.pack(r))
end
end)
end)
|
local class = require 'ext.class'
local Visitor = require 'symmath.visitor.Visitor'
local Expand = class(Visitor)
Expand.name = 'Expand'
return Expand
|
-----------------------------------------------------------------------
-- Pure Lua implementation for the hyperbolic trigonometric functions
-- Freely adapted from P.J.Plauger, "The Standard C Library"
-- author: Roberto Ierusalimschy
-----------------------------------------------------------------------
local exp = math.exp
local function cosh (x)
if x == 0.0 then return 1.0 end
if x < 0.0 then x = -x end
x = exp(x)
x = x / 2.0 + 0.5 / x
return x
end
local function sinh (x)
if x == 0 then return 0.0 end
local neg = false
if x < 0 then x = -x; neg = true end
if x < 1.0 then
local y = x * x
x = x + x * y *
(((-0.78966127417357099479e0 * y +
-0.16375798202630751372e3) * y +
-0.11563521196851768270e5) * y +
-0.35181283430177117881e6) /
((( 0.10000000000000000000e1 * y +
-0.27773523119650701667e3) * y +
0.36162723109421836460e5) * y +
-0.21108770058106271242e7)
else
x = exp(x)
x = x / 2.0 - 0.5 / x
end
if neg then x = -x end
return x
end
local function tanh (x)
if x == 0 then return 0.0 end
local neg = false
if x < 0 then x = -x; neg = true end
if x < 0.54930614433405 then
local y = x * x
x = x + x * y *
((-0.96437492777225469787e0 * y +
-0.99225929672236083313e2) * y +
-0.16134119023996228053e4) /
(((0.10000000000000000000e1 * y +
0.11274474380534949335e3) * y +
0.22337720718962312926e4) * y +
0.48402357071988688686e4)
else
x = exp(x)
x = 1.0 - 2.0 / (x * x + 1.0)
end
if neg then x = -x end
return x
end
-- invhyp.lua: inverse hyperbolic trig functions
-- Adapted from glibc
local abs, log, sqrt = math.abs, math.log, math.sqrt
local log2 = log(2)
-- good for IEEE754, double precision
local function islarge (x) return x > 2 ^ 28 end
local function issmall (x) return x < 2 ^ (-28) end
local INF = math.huge
local function isinfornan (x)
return x ~= x or x == INF or x == -INF
end
local function log1p (x) -- not very precise, but works well
local u = 1 + x
if u == 1 then return x end -- x < eps?
return log(u) * x / (u - 1)
end
local function acosh (x)
if x < 1 then return (x - x) / (x - x) end -- nan
if islarge(x) then
if isinfornan(x) then return x + x end
return log2 + log(x)
end
if x + 1 == 1 then return 0 end -- acosh(1) == 0
if x > 2 then
local x2 = x * x
return log(2 * x - 1 / (x + sqrt(x2 - 1)))
end
-- 1 < x < 2:
local t = x - 1
return log1p(t + sqrt(2 * t + t * t))
end
local function asinh (x)
local y = abs(x)
if issmall(y) then return x end
local a
if islarge(y) then -- very large?
if isinfornan(x) then return x + x end
a = log2 + log(y)
else
if y > 2 then
a = log(2 * y + 1 / (y + sqrt(1 + y * y)))
else
local y2 = y * y
a = log1p(y + y2 / (1 + sqrt(1 + y2)))
end
end
return x < 0 and -a or a -- transfer sign
end
local function atanh (x)
local y = abs(x)
local a
if y < .5 then
if issmall(y) then return x end
a = 2 * y
a = .5 * log1p(a + a * y / (1 - y))
else
if y < 1 then
a = .5 * log1p(2 * y / (1 - y))
elseif y > 1 then
return (x - x) / (x - x) -- nan
else -- y == 1
return x / 0 -- inf with sign
end
end
return x < 0 and -a or a -- transfer sign
end
return {sinh = sinh, cosh = cosh, tanh = tanh, log1p = log1p, asinh = asinh, acosh = acosh, atanh = atanh}
|
module("luci.controller.autoreboot",package.seeall)
function index()
if not nixio.fs.access("/etc/config/autoreboot") then
return
end
entry({"admin", "system", "autoreboot"}, cbi("autoreboot"), _("Scheduled Reboot"),88)
end
|
local argValidationUtils = require("treeFarm.libs.utils.argValidationUtils")
-- TODO: easy to McFly
local function itemEqualityComparer(itemId1, itemId2)
argValidationUtils.argChecker(1, itemId1, {"table", "nil"})
argValidationUtils.argChecker(2, itemId2, {"table", "nil"})
if itemId1 then
argValidationUtils.itemIdChecker(1, itemId1)
else
itemId1 = {}
end
if itemId2 then
argValidationUtils.itemIdChecker(2, itemId2)
else
itemId1 = {}
end
if itemId1 == itemId2 or (itemId1.name == itemId2.name and (itemId1.damage and itemId2.damage and itemId1.damage == itemId2.damage or true)) then -- NOTE: what about tools? a pickaxe is still a pickaxe when damaged. systems whould have nil damage on their template item? (really wishing I could catch up with the flattening now)
return true
end
return false
end
local function itemEqualityComparerWithCount(itemId1, itemId2)
argValidationUtils.argChecker(1, itemId1, {"table", "nil"})
argValidationUtils.argChecker(2, itemId2, {"table", "nil"})
local function countCheck(pos, item)
argValidationUtils.tableChecker("arg["..pos.."]", item, {count = {"number"}})
end
if itemId1 then
argValidationUtils.itemIdChecker(1, itemId1)
countCheck(1, itemId1)
end
if itemId2 then
argValidationUtils.itemIdChecker(2, itemId2)
countCheck(2, itemId2)
end
if itemId1 == itemId2 or ((type(itemId1) == "table" and itemId1.count) == (type(itemId1) == "table" and itemId2.count) and itemEqualityComparer(itemId1, itemId2)) then
return true
end
return false
end
local itemUtils = {
itemEqualityComparer = itemEqualityComparer,
itemEqualityComparerWithCount = itemEqualityComparerWithCount,
}
return itemUtils
|
addEvent ( "setupNewMissionTimer", true )
addEventHandler ( "setupNewMissionTimer", root,
function(duration, countdown, timerFormat, x, y, bg, font, scale, r, g, b )
setupMissionTimer ( source, duration, countdown, timerFormat, x, y, bg, font, scale, r, g, b )
end
)
addEvent ( "setMissionTimerRemainingTime", true )
addEventHandler ( "setMissionTimerRemainingTime", root,
function(remaining)
setMissionTimerTime ( source, remaining )
end
)
addEvent ( "setMissionTimerFrozen", true )
addEventHandler ( "setMissionTimerFrozen", root,
function(frozen)
setMissionTimerFrozen ( source, frozen )
end
)
addEvent ( "setMissionTimerHurryTime", true )
addEventHandler ( "setMissionTimerHurryTime", root,
function(time)
setMissionTimerHurryTime ( source, time )
end
)
addEvent ( "setMissionTimerFormat", true )
addEventHandler ( "setMissionTimerFormat", root,
function(timerFormat)
setMissionTimerFormat ( source, timerFormat )
end
)
|
local M = {__guards__ = {}, __payloads__ = {}}
function M.on(event_name, command)
Lego.event.on(event_name, command, nil, false)
end
function M.once(event_name, command)
Lego.event.once(event_name, command, nil, true)
end
function M.off(event_name, command)
Lego.event.off(event_name, command)
end
function M.payload(...)
M.__payloads__ = {...}
return M
end
function M.guard(...)
M.__guards__ = {...}
return M
end
function M.execute(command)
local payloads = M.__payloads__
local guards = M.__guards__
local passed = (function()
for _, v in pairs(guards) do
if (not v(unpack(payloads))) then return false end
end
return true
end)()
if passed then
command(unpack(payloads))
else
M._reset_gurads_and_payloads()
end
return M
end
function M._reset_gurads_and_payloads()
M._reset_gurads()
M._reset_payloads()
end
function M._reset_gurads()
M.guard()
end
function M._reset_payloads()
M.payload()
end
return M
|
-- @author gilaga4815
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayerService = game:GetService("Players")
local TreeEvents = ReplicatedStorage:WaitForChild("RaceReplication"):WaitForChild("Events"):WaitForChild("TreeEvents")
local TreeControl = TreeEvents:WaitForChild("ControllerRelay")
local TreeModule = require(script.Parent:WaitForChild("TreeModule"))
local runFormat = {
["Pro"] = "ProRun",
["InstGreen"] = "InstantGreen",
["Normal"] = "StandardRun",
["Bracket"] = "BracketRun",
}
local commandsAllowed = true
TreeControl.OnServerEvent:Connect(function(sender, event, ...)
local args = {...}
if event == "DoRun" then
local runType = args[1]
if runFormat[runType] then
if runType == "Bracket" then
print(args[2])
local sideTimes = {args[2][1] == 0 and args[2][2] or 0, args[2][1] == 1 and args[2][2] or 0}
TreeModule.BracketRun(sideTimes)
else
TreeModule[runFormat[runType]]()
end
end
elseif event == "Emergency" then
local emergencyBool = args[1]
TreeModule.Emergency(emergencyBool)
elseif event == "Commands" then
commandsAllowed = args[1]
end
end)
PlayerService.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
msg = msg:lower()
if msg == "start" and commandsAllowed then
TreeModule.StandardRun(true)
end
end)
end)
TreeModule.ConnectTree() -- initiates the tree cycle so it can start doing stuff.
|
local log = require("log")
local Api = require("coreApi")
local json = require("json")
local http = require("http")
function ReceiveFriendMsg(CurrentQQ, data)
return 1
end
function ReceiveGroupMsg(CurrentQQ, data)
if data.FromUserId ==2986807981 then--防止自我复读
return 1 end
if string.find(data.MsgType, "PicMsg") then
str = json.decode(data.Content)
if str.Content == nil then
return 1
end
if string.find(str.Content, "搜番") then
img_url = str.GroupPic[1].Url
log.notice("MsgType---> %s", data.MsgType)
log.notice("img_url---> %s", img_url)
response, error_message =
http.request(
"GET",
"https://trace.moe/api/search",
{
query = "url=" ..
img_url,
headers = {
["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
}
}
)
local html = response.body
local re = json.decode(html)
-- 中文番名
local title_chinese = re.docs[1].title_chinese
-- 相似度
local similarity = re.docs[1].similarity
-- 集数
local episode = re.docs[1].episode
-- 位置 秒
local position = re.docs[1].at
position = math.floor((math.floor(position))/60)
-- 动漫ID
local anilistID =re.docs[1].anilist_id
-- 剩余次数
local limit = re.limit
-- 获取番的详细信息
response2, error_message2 =
http.request(
"GET",
"https://trace.moe/info",
{
query = "anilist_id=" ..
anilistID,
headers = {
["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
}
}
)
local html2 = response2.body
local info = json.decode(html2)
-- 封面
local coverImageUrl = info[1].coverImage.large
-- 观看地址
local siteUrl = info[1].siteUrl
luaRes =
Api.Api_SendMsg(--调用发消息的接口
CurrentQQ,
{
toUser = data.FromGroupId, --回复当前消息的来源群ID
sendToType = 2, --2发送给群1发送给好友3私聊
sendMsgType = "PicMsg", --进行文本复读回复
content = string.format(
"\n相似度:%s\n番名:%s\n集数:%d\n出现位置:大约%d分左右\n详细地址:%s\n剩余次数:%s",
similarity,
title_chinese,
episode,
position,
siteUrl,
limit
),
picUrl = coverImageUrl,
picBase64Buf = "",
fileMd5 = ""
}
)
-- log.notice("From Lua SendMsg Ret-->%d", luaRes.Ret)
end
end
return 1
end
function ReceiveEvents(CurrentQQ, data, extData)
return 1
end
|
require 'ui.board'
require 'data.cards'
require 'lux.common'
function love.load ()
love.graphics.setFont(love.graphics.newFont(10))
love.graphics.setBackgroundColor(40,40,40,255)
data.cards.load 'cards.lua'
local decks = lux.common.datafile('decks.lua', love.filesystem.load)
ui.board.load(decks.player1)
ui.board.defineZone(1,1,1,7, {50,50,110,255})
ui.board.defineZone(6,2,6,8, {50,50,110,255})
ui.board.defineZone(2,1,3,7, {90,55,40,255})
ui.board.defineZone(4,2,5,8, {40,80,55,255})
ui.board.defineZone(4,1,5,1, {20,40,27,255})
ui.board.defineZone(2,8,3,8, {45,27,20,255})
ui.board.defineZone(1,8,1,8, {40,40,55,255}, true)
ui.board.defineZone(6,1,6,1, {40,40,55,255}, true)
end
function love.mousereleased (x, y, button)
ui.board.click(x, y, button)
end
function love.keypressed (button)
local x, y = love.mouse.getPosition()
ui.board.keyAction(x, y, button)
end
function love.update (dt)
ui.board.hover(love.mouse.getPosition())
if love.keyboard.isDown 'tab' then
ui.board.showStats()
end
end
function love.draw ()
ui.board.draw(love.graphics)
end
|
-- Which dll should the driver run
VEHICLE = "graph"
project "driver"
location "%{prj.name}"
kind "ConsoleApp"
defines { "BUILDING_DRIVER", "VEHICLE=" .. VEHICLE }
includedirs { "lstd/src" }
links { "lstd" }
dependson { VEHICLE }
debugdir(VEHICLE .. "/")
common_settings()
filter "system:windows"
links { "imm32", "dxgi.lib", "d3d11.lib", "d3dcompiler.lib", "d3d11.lib", "d3d10.lib" }
project "graph"
location "%{prj.name}"
kind "SharedLib"
includedirs { "lstd/src", "driver/src" }
links { "lstd" }
common_settings()
-- Output dll in the same location as the driver
targetdir("bin/%{cfg.buildcfg}/driver")
-- Unique PDB name each time we build (in order to support debugging while hot-swapping the game dll)
filter "system:windows"
symbolspath '$(OutDir)$(TargetName)-$([System.DateTime]::Now.ToString("ddMMyyyy_HHmmss_fff")).pdb'
links { "dxgi.lib", "d3d11.lib", "d3dcompiler.lib", "d3d11.lib", "d3d10.lib" }
project "socraft"
location "%{prj.name}"
kind "SharedLib"
includedirs { "lstd/src", "driver/src" }
links { "lstd" }
common_settings()
-- Output dll in the same location as the driver
targetdir("bin/%{cfg.buildcfg}/driver")
-- Unique PDB name each time we build (in order to support debugging while hot-swapping the game dll)
filter "system:windows"
symbolspath '$(OutDir)$(TargetName)-$([System.DateTime]::Now.ToString("ddMMyyyy_HHmmss_fff")).pdb'
links { "dxgi.lib", "d3d11.lib", "d3dcompiler.lib", "d3d11.lib", "d3d10.lib" }
|
---
-- Validate and extract IDM frames from a bit stream.
--
-- @category Protocol
-- @block IDMFramerBlock
--
-- @signature in:Bit > out:IDMFrameType
--
-- @usage
-- local framer = radio.IDMFramerBlock()
---
-- IDM frame type, a Lua object with properties:
--
-- ``` text
-- {
-- type = "idm",
-- application_version = <8-bit integer>,
-- ert_type = <8-bit integer>,
-- ert_id = <32-bit integer>,
-- consumption_interval_count = <8-bit integer>,
-- module_programming_state = <8-bit integer>,
-- tamper_count = <6-byte string>,
-- async_count = <2-byte string>,
-- power_outage_flags = <6-byte string>,
-- last_consumption_count = <32-bit integer>,
-- differential_consumption_intervals = <53-byte string>,
-- transmit_time_offset = <16-bit integer>,
-- serial_crc = <16-bit integer>,
-- packet_crc = <16-bit integer>,
-- }
-- ```
--
-- @datatype IDMFramerBlock.IDMFrameType
-- @tparam string type Protocol type, constant "idm"
-- @tparam int application_version Application version field, 8-bits wide
-- @tparam int ert_type ERT Type field, 8-bits wide
-- @tparam int ert_id ERT ID field, 32-bits wide
-- @tparam int consumption_interval_count Consumption interval count field, 8-bits wide
-- @tparam int module_programming_state Module programming state field, 8-bits wide
-- @tparam string tamper_count Tamper count bytes, 6 bytes long
-- @tparam string async_count Async count bytes, 2 bytes long
-- @tparam string power_outage_flags Power outage bytes, 6 bytes long
-- @tparam int last_consumption_count Last consumption count field, 32-bits wide
-- @tparam string differential_consumption_intervals Differential consumption intevals string, 53 bytes long
-- @tparam int transmit_time_offset Transmit time offset field, 16-bits wide
-- @tparam int serial_crc Serial CRC field, 16-bits wide
-- @tparam int packet_crc Packet CRC field, 16-bits wide
local ffi = require('ffi')
local bit = require('bit')
local block = require('radio.core.block')
local debug = require('radio.core.debug')
local types = require('radio.types')
-- IDM Related Constants
local IDM_PREAMBLE = types.Bit.vector_from_array({0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1})
local IDM_FRAME_LEN = 736
local IDM_CODEWORD_LEN = 704
local IDM_CHECKSUM_LEN = 16
-- Parity check matrix
-- Mapping of bit position to syndrome
local IDM_CHECK_SYNDROMES = {} -- initialized in idm_initialize_crc()
-- Syndrome correction table (for single bit correction)
-- Mapping of syndrome to bit position
local IDM_CORRECT_SYNDROMES = {} -- initialized in idm_initialize_crc()
-- IDM Frame Type
local IDMFrameType = types.ObjectType.factory()
function IDMFrameType.new(application_version, ert_type, ert_id, consumption_interval_count, module_programming_state, tamper_count,
async_count, power_outage_flags, last_consumption_count, differential_consumption_intervals, transmit_time_offset,
serial_crc, packet_crc)
local self = setmetatable({}, IDMFrameType)
self.type = "idm"
self.application_version = application_version
self.ert_type = ert_type
self.ert_id = ert_id
self.consumption_interval_count = consumption_interval_count
self.module_programming_state = module_programming_state
self.tamper_count = tamper_count
self.async_count = async_count
self.power_outage_flags = power_outage_flags
self.last_consumption_count = last_consumption_count
self.differential_consumption_intervals = differential_consumption_intervals
self.transmit_time_offset = transmit_time_offset
self.serial_crc = serial_crc
self.packet_crc = packet_crc
return self
end
function IDMFrameType:__tostring()
return string.format("IDMFrame<application_version=0x%02x, ert_type=0x%02x, ert_id=%u, consumption_interval_count=%u, module_programming_state=%u, last_consumption_count=%u, transmit_time_offset=%u, serial_crc=0x%04x, packet_crc=0x%04x>", self.application_version, self.ert_type, self.ert_id, self.consumption_interval_count, self.module_programming_state, self.last_consumption_count, self.transmit_time_offset, self.serial_crc, self.packet_crc)
end
-- IDM Framer Block
local IDMFramerBlock = block.factory("IDMFramerBlock")
IDMFramerBlock.IDM_PREAMBLE = IDM_PREAMBLE
IDMFramerBlock.IDM_FRAME_LEN = IDM_FRAME_LEN
IDMFramerBlock.IDMFrameType = IDMFrameType
function IDMFramerBlock:instantiate()
self:add_type_signature({block.Input("in", types.Bit)}, {block.Output("out", IDMFrameType)})
end
local function idm_correct_codeword(bits, offset)
-- 704-bit codeword = 688-bits message + 16-bits error correcting code
-- Compute syndrome
local syndrome = 0x866b
for i = 0, IDM_CODEWORD_LEN-1 do
if bits.data[offset + i].value == 1 then
syndrome = bit.bxor(syndrome, IDM_CHECK_SYNDROMES[i])
end
end
-- If the syndrome is zero, there is no error and return true
if syndrome == 0 then
return true
end
-- If there is a single correctable bit error, correct it and return true
local error_index = IDM_CORRECT_SYNDROMES[syndrome]
if error_index then
bits.data[offset + error_index] = bits.data[offset + error_index]:bnot()
return true
end
-- If the codeword is uncorrectable, return false
return false
end
local function idm_compute_crc(bits, offset, length)
local crc = 0xffff
for i = 0, length-1 do
if bit.bxor(bit.band(crc, 0x8000), bit.lshift(bits.data[i + offset].value, 15)) == 0x8000 then
crc = bit.bxor(bit.lshift(crc, 1), 0x1021)
else
crc = bit.lshift(crc, 1)
end
end
crc = bit.band(bit.bxor(crc, 0xffff), 0xffff)
return crc
end
local function idm_initialize_crc()
vec = types.Bit.vector(IDM_CODEWORD_LEN - IDM_CHECKSUM_LEN)
-- Populate message bit syndromes
for i = 0, vec.length-1 do
vec.data[i].value = 1
local syndrome = bit.bxor(idm_compute_crc(vec, 0, vec.length), 0x866b)
IDM_CHECK_SYNDROMES[i] = syndrome
IDM_CORRECT_SYNDROMES[syndrome] = i
vec.data[i].value = 0
end
-- Populate checksum bit syndromes
for i = 0, IDM_CHECKSUM_LEN-1 do
local syndrome = bit.lshift(1, 15 - i)
IDM_CHECK_SYNDROMES[vec.length + i] = syndrome
IDM_CORRECT_SYNDROMES[syndrome] = vec.length + i
end
end
function IDMFramerBlock:initialize()
self.idm_frame = types.Bit.vector(IDM_FRAME_LEN)
self.idm_frame_length = 0
self.out = IDMFrameType.vector()
idm_initialize_crc()
end
function IDMFramerBlock:process(x)
local out = self.out:resize(0)
local i = 0
while i < x.length do
-- Shift in as many bits as we can into the frame buffer
if self.idm_frame_length < IDM_FRAME_LEN then
-- Calculate the maximum number of bits we can shift from x
local n = math.min(IDM_FRAME_LEN - self.idm_frame_length, x.length-i)
ffi.copy(self.idm_frame.data[self.idm_frame_length], x.data[i], n*ffi.sizeof(self.idm_frame.data[0]))
i, self.idm_frame_length = i + n, self.idm_frame_length + n
elseif self.idm_frame_length == IDM_FRAME_LEN then
-- Shift frame buffer down by one bit
ffi.C.memmove(self.idm_frame.data[0], self.idm_frame.data[1], (IDM_FRAME_LEN-1)*ffi.sizeof(self.idm_frame.data[0]))
-- Shift in one bit from x
self.idm_frame.data[IDM_FRAME_LEN-1] = x.data[i]
i = i + 1
end
-- Try to validate the frame
if self.idm_frame_length == IDM_FRAME_LEN then
local preamble = types.Bit.tonumber(self.idm_frame, 0, 16)
local frame_sync = types.Bit.tonumber(self.idm_frame, 16, 16)
if preamble == 0x5555 and frame_sync == 0x16a3 and idm_correct_codeword(self.idm_frame, 32) then
local packet_type = types.Bit.tonumber(self.idm_frame, 32, 8)
local packet_length = types.Bit.tonumber(self.idm_frame, 40, 16)
local serial_crc = types.Bit.tonumber(self.idm_frame, 704, 16)
if packet_type == 0x1c and packet_length == 0x5cc6 and serial_crc == idm_compute_crc(self.idm_frame, 72, 32) then
local application_version = types.Bit.tonumber(self.idm_frame, 56, 8)
local ert_type = types.Bit.tonumber(self.idm_frame, 64, 8)
local ert_id = types.Bit.tonumber(self.idm_frame, 72, 32)
local consumption_interval_count = types.Bit.tonumber(self.idm_frame, 104, 8)
local module_programming_state = types.Bit.tonumber(self.idm_frame, 112, 8)
local tamper_count = types.Bit.tobytes(self.idm_frame, 120, 48)
local async_count = types.Bit.tobytes(self.idm_frame, 168, 16)
local power_outage_flags = types.Bit.tobytes(self.idm_frame, 184, 48)
local last_consumption_count = types.Bit.tonumber(self.idm_frame, 232, 32)
local differential_consumption_intervals = types.Bit.tobytes(self.idm_frame, 264, 424)
local transmit_time_offset = types.Bit.tonumber(self.idm_frame, 688, 16)
local packet_crc = types.Bit.tonumber(self.idm_frame, 720, 16)
out:append(IDMFrameType(application_version, ert_type, ert_id, consumption_interval_count, module_programming_state, tamper_count,
async_count, power_outage_flags, last_consumption_count, differential_consumption_intervals, transmit_time_offset,
serial_crc, packet_crc))
self.idm_frame_length = 0
end
end
end
end
return out
end
return IDMFramerBlock
|
--[[
First person camera module
API
camera = Camera.new() - constructs a new camera class
camera.camera = workspace.Camera -- the camera
camera.position = V3 relative position of the camera
camera.stiffness = the sway of the camera
camera.relativeTo = part that the camera is relative to
camera.zoom.f = zoom stiffness
camera.zoom.p = zoom FOV
camera.targetZoomFOV = target zoom FOV
camera.rotation = rotation
camera.rotationSpeed = rotation speed
camera.headSwaySize = head sway distance per 1 stud/s^2 acceleration
camera:update()
--]]
-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
-- Modules
local Spring = require(ReplicatedStorage.Modules.Spring)
-- Module
local Camera = {}
Camera.__index = Camera
function Camera.new()
local self = setmetatable({}, Camera)
self.headSway = Spring.new(0, Vector3.new())
self.rotateInput = Spring.new(0, Vector2.new())
self.zoom = Spring.new(1.5, 70)
self.targetZoomFOV = 70
return self
end
function Camera:Update(dt)
local relativeTo = self.relativeTo
if not relativeTo then
return false
end
-- Configure camera
if self.camera.CameraType ~= Enum.CameraType.Scriptable then
self.camera.CameraType = Enum.CameraType.Scriptable
end
-- Configure springs
self.headSway.f = self.stiffness
self.rotateInput.f = self.stiffness
-- Head sway
local acceleration = Vector3.new()
local relativeVelocity = relativeTo.WorldCFrame:vectorToObjectSpace(relativeTo.Parent.Velocity)
if self.relativeVelocity then
acceleration = relativeVelocity - self.relativeVelocity
end
local tickValue = os.clock() * self.headOscillationRate
local headSway = self.headSway:Update(dt, -acceleration * self.headSwaySize + Vector3.new(math.sin(tickValue), math.cos(tickValue), 0) * dt * self.headOscillationSize)
headSway = Vector3.new(
math.clamp(headSway.X, -self.maxHeadSway.X, self.maxHeadSway.X),
math.clamp(headSway.Y, -self.maxHeadSway.Y, self.maxHeadSway.Y),
math.clamp(headSway.Z, -self.maxHeadSway.Z, self.maxHeadSway.Z)
)
-- Update zoom FOV
self.camera.FieldOfView = self.zoom:Update(dt, self.targetZoomFOV)
-- Get rotate input
local mouseDelta = Vector2.new()
local pressed = UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2)
if pressed then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
mouseDelta = UserInputService:GetMouseDelta()
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
local rotateInput = self.rotateInput:Update(dt, mouseDelta)
self.rotation = self.rotation + rotateInput * self.rotationSpeed
-- Set camera CFrame
local rotationCFrame = CFrame.Angles(0, -self.rotation.X, 0) * CFrame.Angles(-self.rotation.Y, 0, 0)
self.camera.CFrame = relativeTo.WorldCFrame * CFrame.new(self.position + headSway) * rotationCFrame
-- Set velocity
self.relativeVelocity = relativeVelocity
end
return Camera
|
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
util.PrecacheSound("Airboat_engine_idle")
util.PrecacheSound("Airboat_engine_stop")
util.PrecacheSound("apc_engine_start")
include("shared.lua")
local Pressure_Increment = 80
local Energy_Increment = 10
DEFINE_BASECLASS("base_rd3_entity")
function ENT:Initialize()
BaseClass.Initialize(self)
self.Active = 0
self.overdrive = 0
self.damaged = 0
self.lastused = 0
self.sequence = -1
self.thinkcount = 0
self.Mute = 0
self.Multiplier = 1
if WireAddon ~= nil then
self.WireDebugName = self.PrintName
self.Inputs = Wire_CreateInputs(self, {"On", "Overdrive", "Mute", "Multiplier"})
self.Outputs = Wire_CreateOutputs(self, {"On", "Overdrive", "EnergyUsage", "WaterProduction"})
else
self.Inputs = {
{
Name = "On"
},
{
Name = "Overdrive"
}
}
end
end
function ENT:TurnOn()
if self.Active == 0 then
if self.Mute == 0 then
self:EmitSound("Airboat_engine_idle")
end
self.Active = 1
if WireAddon ~= nil then
Wire_TriggerOutput(self, "On", self.Active)
end
self.sequence = self:LookupSequence("walk")
if self.sequence and self.sequence ~= -1 then
self:SetSequence(self.sequence)
self:ResetSequence(self.sequence)
self:SetPlaybackRate(1)
end
self:SetOOO(1)
elseif self.overdrive == 0 then
self:TurnOnOverdrive()
end
end
function ENT:TurnOff()
if self.Active == 1 then
if self.Mute == 0 then
self:StopSound("Airboat_engine_idle")
self:EmitSound("Airboat_engine_stop")
self:StopSound("apc_engine_start")
end
self.Active = 0
self.overdrive = 0
if WireAddon ~= nil then
Wire_TriggerOutput(self, "On", self.Active)
end
self:SetOOO(0)
self.sequence = self:LookupSequence("idle")
if self.sequence and self.sequence ~= -1 then
self:SetSequence(self.sequence)
self:ResetSequence(self.sequence)
self:SetPlaybackRate(1)
end
end
end
function ENT:TurnOnOverdrive()
if self.Active == 1 then
if self.Mute == 0 then
self:StopSound("Airboat_engine_idle")
self:EmitSound("Airboat_engine_idle")
self:EmitSound("apc_engine_start")
end
self:SetOOO(2)
self.overdrive = 1
if WireAddon ~= nil then
Wire_TriggerOutput(self, "Overdrive", self.overdrive)
end
end
end
function ENT:TurnOffOverdrive()
if self.Active == 1 and self.overdrive == 1 then
if self.Mute == 0 then
self:StopSound("Airboat_engine_idle")
self:EmitSound("Airboat_engine_idle")
self:StopSound("apc_engine_start")
end
self:SetOOO(1)
self.overdrive = 0
if WireAddon ~= nil then
Wire_TriggerOutput(self, "Overdrive", self.overdrive)
end
end
end
function ENT:SetActive(value)
if value then
if value ~= 0 and self.Active == 0 then
self:TurnOn()
elseif value == 0 and self.Active == 1 then
self:TurnOff()
end
else
if self.Active == 0 then
self.lastused = CurTime()
self:TurnOn()
else
if ((CurTime() - self.lastused) < 2) and (self.overdrive == 0) then
self:TurnOnOverdrive()
else
self.overdrive = 0
self:TurnOff()
end
end
end
end
function ENT:TriggerInput(iname, value)
if iname == "On" then
self:SetActive(value)
elseif iname == "Overdrive" then
if value ~= 0 then
self:TurnOnOverdrive()
else
self:TurnOffOverdrive()
end
end
if iname == "Mute" then
if value > 0 then
self.Mute = 1
else
self.Mute = 0
end
end
if iname == "Multiplier" then
if value > 0 then
self.Multiplier = value
else
self.Multiplier = 1
end
end
end
function ENT:Damage()
if self.damaged == 0 then
self.damaged = 1
end
if (self.Active == 1) and (math.random(1, 10) <= 4) then
self:TurnOff()
end
end
function ENT:Repair()
BaseClass.Repair(self)
self:SetColor(Color(255, 255, 255, 255))
self.damaged = 0
end
function ENT:Destruct()
if CAF and CAF.GetAddon("Life Support") then
CAF.GetAddon("Life Support").Destruct(self, true)
end
end
function ENT:OnRemove()
BaseClass.OnRemove(self)
self:StopSound("Airboat_engine_idle")
end
function ENT:Pump_Water()
local energy = self:GetResourceAmount("energy")
local einc = Energy_Increment + (self.overdrive * Energy_Increment * 3)
local waterlevel = 0
local islava
if self.environment then
islava = self.environment:GetTemperature(self) --Check to see if it's in lava
else
islava = 66 --any number below 308 would do, i picked nonzero to assert evaluation as a number
end
if CAF then
waterlevel = self:WaterLevel2()
else
waterlevel = self:WaterLevel()
end
einc = (math.ceil(einc * self:GetMultiplier())) * self.Multiplier
if WireAddon ~= nil then
Wire_TriggerOutput(self, "EnergyUsage", math.Round(einc))
end
--seems to be problem when welding(/freezing when not with CAF)
if waterlevel > 0 and energy >= einc and islava < 308 then
local winc = (math.ceil(Pressure_Increment * (waterlevel / 3))) * self.Multiplier --Base water generation on the amount it is in the water
if self.overdrive == 1 then
winc = winc * 3
if CAF and CAF.GetAddon("Life Support") then
CAF.GetAddon("Life Support").DamageLS(self, math.random(2, 3))
else
self:SetHealth(self:Health() - math.Random(2, 3))
if self:Health() <= 0 then
self:Remove()
end
end
end
winc = math.ceil(winc * self:GetMultiplier())
self:ConsumeResource("energy", einc)
self:SupplyResource("water", winc)
if WireAddon ~= nil then
Wire_TriggerOutput(self, "WaterProduction", math.Round(winc))
end
else
self:TurnOff()
end
end
function ENT:Think()
BaseClass.Think(self)
if self.sequence and self.sequence ~= -1 then
self:ResetSequence(self.sequence)
--self:SetSequence(self.sequence)
--self:SetPlaybackRate( 10 )
--self:ResetSequenceInfo( )
self:SetPlaybackRate(1)
end
self.thinkcount = self.thinkcount + 1
if self.thinkcount == 10 then
if self.Active == 1 then
self:Pump_Water()
end
self.thinkcount = 0
end
self:NextThink(CurTime() + 0.1)
return true
end
|
local oldUpdate = GUIAlienSpectatorHUD.Update
function GUIAlienSpectatorHUD:Update()
oldUpdate(self)
self.eggIcon:SetIsVisible(false)
self.spawnText:SetText("")
end
|
--==========================================================
-- Written by bc1 using Notepad++
-- Include for EUI context
--==========================================================
print( "Loading EUI tooltip server..." )
local UserInterfaceSettings = UserInterfaceSettings -- global defined by EUI_context
local GameInfo = GameInfoCache -- warning! booleans are true, not 1, and use iterator ONLY with table field conditions, NOT string SQL query
local IsCiv5 = InStrategicView ~= nil
local IsCivBE = not IsCiv5
local IsCiv5notVanilla = Game.GetReligionName ~= nil
local IsCiv5BNW = IsCiv5 and Game.GetActiveLeague ~= nil
local IsCiv5BNW_BE = IsCiv5BNW or IsCivBE
if IsCiv5BNW then
include "GreatPeopleIcons"
end
local GreatPeopleIcons = GreatPeopleIcons
include "StackInstanceManager"
include "IconHookup"
local IconHookup = IconHookup
local CivIconHookup = CivIconHookup
include "ScanGP"
local ScanGP = ScanGP
include "ShortUnitTip"
local ShortUnitTip = ShortUnitTip
include "GetUnitBuildProgressData"
local GetUnitBuildProgressData = GetUnitBuildProgressData
include "ScratchDeal"
local ScratchDeal = ScratchDeal
local PopScratchDeal = PopScratchDeal
local PushScratchDeal = PushScratchDeal
include "CityStateStatusHelper"
local GetAllyToolTip = GetAllyToolTip
local GetActiveQuestToolTip = GetActiveQuestToolTip
local GetCityStateStatusToolTip = GetCityStateStatusToolTip
include "InfoTooltipInclude"
local GetHelpTextForUnit = GetHelpTextForUnit
local GetHelpTextForBuilding = GetHelpTextForBuilding
local GetHelpTextForProject = GetHelpTextForProject
local GetHelpTextForProcess = GetHelpTextForProcess
local GetHelpTextForImprovement = GetHelpTextForImprovement
local GetFoodTooltip = GetFoodTooltip
local GetGoldTooltip = IsCiv5 and GetGoldTooltip or GetEnergyTooltip
local GetScienceTooltip = GetScienceTooltip
local GetProductionTooltip = GetProductionTooltip
local GetCultureTooltip = GetCultureTooltip
local GetFaithTooltip = GetFaithTooltip
local GetReligionTooltip = GetReligionTooltip
local GetTourismTooltip = GetTourismTooltip
local GetMoodInfo = GetMoodInfo
local GetHelpTextForPlayerPerk = GetHelpTextForPlayerPerk -- BE only
local GetHelpTextForAffinity = GetHelpTextForAffinity -- BE only
include "TechHelpInclude"
local GetHelpTextForTech = GetHelpTextForTech
include "ShowProgress"
local ShowProgressToolTip = ShowProgressToolTip
--==========================================================
-- Minor lua optimizations
--==========================================================
local print = print
local ipairs = ipairs
local pairs = pairs
local tostring = tostring
local ceil = math.ceil
local floor = math.floor
local min = math.min
local max = math.max
local modf = math.modf
local insert = table.insert
local concat = table.concat
local format = string.format
local PreGame = PreGame
local Game = Game
local GetActivePlayer = Game.GetActivePlayer
local GetActiveTeam = Game.GetActiveTeam
local GetResourceUsageType = Game.GetResourceUsageType
local GameOptionTypes = GameOptionTypes
local GameInfoActions = GameInfoActions
local GameInfoTypes = GameInfoTypes
local GetPlot = Map.GetPlot
local PlotDirection = Map.PlotDirection
local L = Locale.ConvertTextKey
local Matchmaking = Matchmaking
local Network = Network
local OptionsManager = OptionsManager
local Players = Players
local Teams = Teams
local GetHeadSelectedCity = UI.GetHeadSelectedCity
local GetHeadSelectedUnit = UI.GetHeadSelectedUnit
local GetUnitPortraitIcon = UI.GetUnitPortraitIcon
local GetMousePos = UIManager.GetMousePos
local TradeableItems = TradeableItems
local DomainTypes = DomainTypes
local NUM_YIELD_TYPES_minus1 = YieldTypes.NUM_YIELD_TYPES - 1
local RESOURCEUSAGE_STRATEGIC = ResourceUsageTypes.RESOURCEUSAGE_STRATEGIC
local RESOURCEUSAGE_LUXURY = ResourceUsageTypes.RESOURCEUSAGE_LUXURY
local RESOURCEUSAGE_BONUS = ResourceUsageTypes.RESOURCEUSAGE_BONUS
local TRADE_ITEM_RESOURCES = TradeableItems.TRADE_ITEM_RESOURCES
local ACTIONSUBTYPE_BUILD = ActionSubTypes.ACTIONSUBTYPE_BUILD
local ACTIONSUBTYPE_PROMOTION = ActionSubTypes.ACTIONSUBTYPE_PROMOTION
local RELIGION_PANTHEON = ReligionTypes and ReligionTypes.RELIGION_PANTHEON
local MOVE_DENOMINATOR = GameDefines.MOVE_DENOMINATOR
local MAX_CIV_PLAYERS_minus1 = GameDefines.MAX_CIV_PLAYERS - 1
local MAX_MAJOR_CIVS = GameDefines.MAX_MAJOR_CIVS
local DOF_EXPIRATION_TIME = GameDefines.DOF_EXPIRATION_TIME or 50
local MINOR_CIV_QUEST_CONNECT_RESOURCE = MinorCivQuestTypes.MINOR_CIV_QUEST_CONNECT_RESOURCE
local ORDER_TRAIN = OrderTypes.ORDER_TRAIN
local ORDER_CONSTRUCT = OrderTypes.ORDER_CONSTRUCT
local ORDER_CREATE = OrderTypes.ORDER_CREATE
local ORDER_MAINTAIN = OrderTypes.ORDER_MAINTAIN
local g_scienceTextColor = IsCiv5 and "[COLOR:33:190:247:255]" or "[COLOR_MENU_BLUE]"
local g_currencyIcon = IsCiv5 and "[ICON_GOLD]" or "[ICON_ENERGY]"
local g_currencyString = IsCiv5 and "GOLD" or "ENERGY"
local g_yieldCurrency = IsCiv5 and YieldTypes.YIELD_GOLD or YieldTypes.YIELD_ENERGY
--local g_maintenanceCurrency = IsCiv5 and "GoldMaintenance" or "EnergyMaintenance"
--local g_happinessIcon = IsCiv5 and "[ICON_HAPPY]" or "[ICON_HEALTH]"
local g_happinessString = IsCiv5 and "HAPPINESS" or "HEALTH"
local g_ItemTooltipControls = {}
TTManager:GetTypeControlTable( "EUI_ItemTooltip", g_ItemTooltipControls )
local g_UnitTooltipControls = {}
TTManager:GetTypeControlTable( "EUI_UnitTooltip", g_UnitTooltipControls )
local g_UnitActionTooltipControls = {}
TTManager:GetTypeControlTable( "EUI_UnitAction", g_UnitActionTooltipControls )
local g_CivilizationTooltipControls = {}
TTManager:GetTypeControlTable( "EUI_CivilizationTooltip", g_CivilizationTooltipControls )
local g_CityProductionTooltipControls = {}
TTManager:GetTypeControlTable( "EUI_CityProductionTooltip", g_CityProductionTooltipControls )
local g_CityGrowthTooltipControls = {}
TTManager:GetTypeControlTable( "EUI_CityGrowthTooltip", g_CityGrowthTooltipControls )
local g_TechProgressToolTipControls = {}
TTManager:GetTypeControlTable( "EUI_TopPanelProgressTooltip", g_TechProgressToolTipControls )
local g_isCityStateLeaders, g_isBasicHelp, g_isScienceEnabled, g_isReligionEnabled, g_isHappinessEnabled, g_isPoliciesEnabled, g_isHealthEnabled, g_isEspionageDisabled, g_isAlwaysWar, g_isOneCityChallenge
do
Controls.UnitTooltipTimer:RegisterAnimCallback( function()
g_UnitTooltipControls.PromotionText:SetHide( false )
g_UnitTooltipControls.IconStack:SetWrapWidth( 32 )
g_UnitTooltipControls.IconStack:CalculateSize()
g_UnitTooltipControls.Box:DoAutoSize()
end)
local GetTooltip2Seconds = OptionsManager.GetTooltip2Seconds
local function UpdateOptions()
g_isScienceEnabled = not Game.IsOption(GameOptionTypes.GAMEOPTION_NO_SCIENCE)
g_isPoliciesEnabled = not Game.IsOption(GameOptionTypes.GAMEOPTION_NO_POLICIES)
g_isHappinessEnabled = IsCiv5 and not Game.IsOption(GameOptionTypes.GAMEOPTION_NO_HAPPINESS)
g_isReligionEnabled = IsCiv5notVanilla and not Game.IsOption(GameOptionTypes.GAMEOPTION_NO_RELIGION)
g_isHealthEnabled = not IsCiv5 and not Game.IsOption(GameOptionTypes.GAMEOPTION_NO_HEALTH)
g_isEspionageDisabled = Game.IsOption(GameOptionTypes.GAMEOPTION_NO_ESPIONAGE)
g_isAlwaysWar = Game.IsOption( GameOptionTypes.GAMEOPTION_ALWAYS_WAR )
g_isOneCityChallenge = Game.IsOption(GameOptionTypes.GAMEOPTION_ONE_CITY_CHALLENGE)
g_isBasicHelp = IsCivBE or not OptionsManager.IsNoBasicHelp()
Controls.UnitTooltipTimer:SetToBeginning()
Controls.UnitTooltipTimer:SetPauseTime( GetTooltip2Seconds() / 100 )
g_isCityStateLeaders = UserInterfaceSettings.CityStateLeaders ~= 0
end
Events.GameOptionsChanged.Add( UpdateOptions )
UpdateOptions()
end
local g_PromotionIconIM = StackInstanceManager( "PromotionIcon", "Image", g_UnitTooltipControls.IconStack )
function cleanupTable( t )
t[-1] = nil
return t
end
local g_yieldString = cleanupTable{
[YieldTypes.YIELD_FOOD or -1] = "TXT_KEY_BUILD_FOOD_STRING",
[YieldTypes.YIELD_PRODUCTION or -1] = "TXT_KEY_BUILD_PRODUCTION_STRING",
[YieldTypes.YIELD_GOLD or -1] = "TXT_KEY_BUILD_GOLD_STRING",
[YieldTypes.YIELD_SCIENCE or -1] = "TXT_KEY_BUILD_SCIENCE_STRING",
[YieldTypes.YIELD_CULTURE or -1] = "TXT_KEY_BUILD_CULTURE_STRING",
[YieldTypes.YIELD_FAITH or -1] = "TXT_KEY_BUILD_FAITH_STRING",
}
local g_infoSource = cleanupTable{
[ ActionSubTypes.ACTIONSUBTYPE_PROMOTION or -1 ] = GameInfo.UnitPromotions,
[ ActionSubTypes.ACTIONSUBTYPE_INTERFACEMODE or -1 ] = GameInfo.InterfaceModes,
[ ActionSubTypes.ACTIONSUBTYPE_MISSION or -1 ] = GameInfo.Missions,
[ ActionSubTypes.ACTIONSUBTYPE_COMMAND or -1 ] = GameInfo.Commands,
[ ActionSubTypes.ACTIONSUBTYPE_AUTOMATE or -1 ] = GameInfo.Automates,
[ ActionSubTypes.ACTIONSUBTYPE_BUILD or -1 ] = GameInfo.Builds,
[ ActionSubTypes.ACTIONSUBTYPE_CONTROL or -1 ] = GameInfo.Controls,
}
local g_cityFocusTooltips = cleanupTable{
[CityAIFocusTypes.NO_CITY_AI_FOCUS_TYPE or -1] = L"TXT_KEY_CITYVIEW_FOCUS_BALANCED_TEXT",
[CityAIFocusTypes.CITY_AI_FOCUS_TYPE_FOOD or -1] = L"TXT_KEY_CITYVIEW_FOCUS_FOOD_TEXT",
[CityAIFocusTypes.CITY_AI_FOCUS_TYPE_PRODUCTION or -1] = L"TXT_KEY_CITYVIEW_FOCUS_PROD_TEXT",
[CityAIFocusTypes.CITY_AI_FOCUS_TYPE_GOLD or -1] = L"TXT_KEY_CITYVIEW_FOCUS_GOLD_TEXT",
[CityAIFocusTypes.CITY_AI_FOCUS_TYPE_SCIENCE or -1] = L"TXT_KEY_CITYVIEW_FOCUS_RESEARCH_TEXT",
[CityAIFocusTypes.CITY_AI_FOCUS_TYPE_CULTURE or -1] = L"TXT_KEY_CITYVIEW_FOCUS_CULTURE_TEXT",
[CityAIFocusTypes.CITY_AI_FOCUS_TYPE_GREAT_PEOPLE or -1] = L"TXT_KEY_CITYVIEW_FOCUS_GREAT_PERSON_TEXT",
[CityAIFocusTypes.CITY_AI_FOCUS_TYPE_FAITH or -1] = L"TXT_KEY_CITYVIEW_FOCUS_FAITH_TEXT",
}
local g_activityMissions = cleanupTable{
--[ActivityTypes.ACTIVITY_AWAKE or -1] = nil,
[ActivityTypes.ACTIVITY_HOLD or -1] = false, --GameInfo.Missions.MISSION_SKIP, -- only when moves left > 0
--[ActivityTypes.ACTIVITY_SLEEP or -1] = GameInfo.Missions.MISSION_SLEEP, -- can be sleep or fortify
[ActivityTypes.ACTIVITY_HEAL or -1] = GameInfo.Missions.MISSION_HEAL,
[ActivityTypes.ACTIVITY_SENTRY or -1] = GameInfo.Missions.MISSION_ALERT,
[ActivityTypes.ACTIVITY_INTERCEPT or -1] = GameInfo.Missions.MISSION_AIRPATROL,
--[ActivityTypes.ACTIVITY_MISSION or -1] = GameInfo.Missions.MISSION_MOVE_TO,
}
local g_maximumAcquirePlotArea = (GameDefines.MAXIMUM_ACQUIRE_PLOT_DISTANCE+1) * GameDefines.MAXIMUM_ACQUIRE_PLOT_DISTANCE * 3
local g_maximumAcquirePlotPerimeter = GameDefines.MAXIMUM_ACQUIRE_PLOT_DISTANCE * 6
if Map.GetPlot(0,0).GetCityPurchaseID then
CityPlots = function( city, m )
local cityID = city:GetID()
local cityOwnerID = city:GetOwner()
if not m then m = 0 end
local n = g_maximumAcquirePlotArea
local p = g_maximumAcquirePlotPerimeter
return function()
repeat
for i = m, n do
local plot = city:GetCityIndexPlot( i )
if plot and plot:GetOwner() == cityOwnerID and plot:GetCityPurchaseID() == cityID then
m = i+1
return plot
end
end
-- if no owned plots were found in previous ring then we're done
if m <= n-p+1 then
return
end
-- plots found, search next ring
m = n + 1 --first plot of next ring
p = p + 6 --perimeter of next ring
n = n + p --last plot of next ring
until false
end
end
else
CityPlots = function( city, i )
if not i then i = 0 end
return function()
while i <= g_maximumAcquirePlotArea do
local plot = city:GetCityIndexPlot( i )
i = i+1
if plot and plot:GetWorkingCity() == city then
return plot
end
end
end
end
end
local function Colorize( x )
if x > 0 then
return "[COLOR_POSITIVE_TEXT]" .. x .. "[ENDCOLOR]"
elseif x < 0 then
return "[COLOR_WARNING_TEXT]" .. x .. "[ENDCOLOR]"
else
return "0"
end
end
local function ColorizeSigned( x )
if x > 0 then
return "[COLOR_POSITIVE_TEXT]+" .. x .. "[ENDCOLOR]"
elseif x < 0 then
return "[COLOR_WARNING_TEXT]" .. x .. "[ENDCOLOR]"
else
return "0"
end
end
local function ColorizeAbs( x )
if x > 0 then
return "[COLOR_POSITIVE_TEXT]" .. x .. "[ENDCOLOR]"
elseif x < 0 then
return "[COLOR_WARNING_TEXT]" .. -x .. "[ENDCOLOR]"
else
return "0"
end
end
local function append( t, text )
t[#t] = t[#t] .. text
end
local function insertLocalizedIfNonZero( t, textKey, ... )
if ... ~= 0 then
return insert( t, L( textKey, ... ) )
end
end
local function insertLocalizedBulletIfNonZero( t, a, b, ... )
if tonumber( b ) then
if b ~= 0 then
return insert( t, "[ICON_BULLET]" .. L( a, b, ... ) )
end
elseif ... ~= 0 then
return insert( t, a .. L( b, ... ) )
end
end
local function GetItemPortraitIcon( GameInfoItems, itemID )
local item = GameInfoItems and GameInfoItems[itemID]
if item then
return item.PortraitIndex or item.IconIndex, item.IconAtlas
end
end
local function UnitColor( s )
return "[COLOR_UNIT_TEXT]"..s.."[ENDCOLOR]"
end
local function BuildingColor( s )
return "[COLOR_YIELD_FOOD]"..s.."[ENDCOLOR]"
end
local function PolicyColor( s )
return "[COLOR_MAGENTA]"..s.."[ENDCOLOR]"
end
local function TechColor( s )
return "[COLOR_CYAN]"..s.."[ENDCOLOR]"
end
local function ReligionColor( s )
return "[COLOR_WHITE]"..s.."[ENDCOLOR]"
end
local function TooltipSelect( tooltipTable, control, ... )
local tooltip = tooltipTable[ control:GetID() ]
if tooltip then
return tooltip( ... )
end
end
local function ShowTextToolTipAndPicture( tip, index, altlas )
local controls = g_ItemTooltipControls
controls.Text:SetText( tip )
controls.PortraitFrame:SetHide( not ( altlas and IconHookup( index, 256, altlas, controls.Portrait ) ) )
controls.PortraitFrame:SetAnchor( GetMousePos() > 300 and "L,T" or "R,T" )
controls.Box:DoAutoSize()
end
LuaEvents.ShowTextToolTipAndPicture.Add( ShowTextToolTipAndPicture )
local function ShowTextToolTip( ... )
return ShowTextToolTipAndPicture( ... and concat( {...}, "[NEWLINE]----------------[NEWLINE]" ) )
end
--==========================================================
-- Resource Tooltip
--==========================================================
local function ShowResourceToolTip( resourceID, tips )
local resource = GameInfo.Resources[ resourceID ]
if resource then
local activePlayerID = GetActivePlayer()
local activeTeamID = GetActiveTeam()
local activePlayer = Players[activePlayerID]
local activeTeam = Teams[activeTeamID]
local activeCivilizationID = activePlayer:GetCivilizationType()
local activeCivilization = GameInfo.Civilizations[ activeCivilizationID ]
local activeTeamTechs = activeTeam:GetTeamTechs()
local resourceID = resource.ID
local numResourceUsed = activePlayer:GetNumResourceUsed( resourceID )
local numResourceAvailable = activePlayer:GetNumResourceAvailable( resourceID, true ) -- same as (total - used)
local numResourceExport = activePlayer:GetResourceExport( resourceID )
local numResourceImport = activePlayer:GetResourceImport( resourceID ) + activePlayer:GetResourceFromMinors( resourceID )
local numResourceLocal = activePlayer:GetNumResourceTotal( resourceID, false ) + numResourceExport
-- if resourceID and GetResourceUsageType(resourceID) == RESOURCEUSAGE_STRATEGIC then
insert( tips, ColorizeAbs(numResourceAvailable) .. resource.IconString .. " " .. Locale.ToUpper(resource._Name) )
insert( tips, "----------------" )
----------------------------
-- Local Resources in Cities
----------------------------
insert( tips, "" )
insert( tips, Colorize(numResourceLocal) .. " " .. L"TXT_KEY_EO_LOCAL_RESOURCES" )
-- Resources from city terrain
for city in activePlayer:Cities() do
local numConnectedResource = 0
local numUnconnectedResource = 0
for plot in CityPlots( city ) do
local numResource = plot:GetNumResource()
if numResource > 0 and resourceID == plot:GetResourceType( activeTeamID ) then
if plot:IsCity() or (not plot:IsImprovementPillaged() and plot:IsResourceConnectedByImprovement( plot:GetImprovementType() )) then
numConnectedResource = numConnectedResource + numResource
else
numUnconnectedResource = numUnconnectedResource + numResource
end
end
end
local tip = ""
if numConnectedResource > 0 then
tip = " " .. ColorizeAbs( numConnectedResource ) .. resource.IconString
end
if numUnconnectedResource > 0 then
tip = tip .. " " .. ColorizeAbs( -numUnconnectedResource ) .. resource.IconString
end
if #tip > 0 then
insert( tips, "[ICON_BULLET]" .. city:GetName() .. tip )
end
end
if IsCiv5notVanilla then
-- Resources from buildings
local tipIndex = #tips
for row in GameInfo.Building_ResourceQuantity{ ResourceType = resource.Type } do
local building = GameInfo.Buildings[ row.BuildingType ]
local numResource = row.Quantity
if building and numResource and numResource > 0 then
local buildingID = building.ID
-- count how many such buildings player has
local numExisting = activePlayer:CountNumBuildings( buildingID )
-- count how many such units player is building
local numBuilds = 0
for city in activePlayer:Cities() do
if city:GetProductionBuilding() == buildingID then
numBuilds = numBuilds + 1
end
end
-- can player build this building someday ?
local canBuildSomeday
-- check whether this Unit has been blocked out by the civ XML
local buildingOverride = GameInfo.Civilization_BuildingClassOverrides{ CivilizationType = activeCivilization.Type, BuildingClassType = building.BuildingClass }()
if buildingOverride then
canBuildSomeday = buildingOverride.BuildingType == building.Type
else
canBuildSomeday = GameInfo.BuildingClasses[ building.BuildingClass ].DefaultBuilding == building.Type
end
if canBuildSomeday and
-- no espionage buildings for a non-espionage game
( ( g_isEspionageDisabled and building.IsEspionage )
-- is building obsolete by tech?
or ( building.ObsoleteTech and activeTeamTechs:HasTech( GameInfoTypes[building.ObsoleteTech] ) ) )
then
canBuildSomeday = false
end
if canBuildSomeday or numExisting > 0 or numBuilds > 0 then
local totalResource = (numExisting + numBuilds) * numResource
local tip = "[COLOR_YIELD_FOOD]" .. building._Name .. "[ENDCOLOR]"
if canBuildSomeday then
local tech = building.PrereqTech and GameInfo.Technologies[ building.PrereqTech ]
if tech and not activeTeamTechs:HasTech( tech.ID ) then
tip = tip .. " [COLOR_CYAN]" .. tech._Name .. "[ENDCOLOR]"
end
local policyBranch = building.PolicyBranchType and GameInfo.PolicyBranchTypes[ building.PolicyBranchType ]
if policyBranch and not activePlayer:GetPolicyBranchChosen( policyBranch.ID ) then
tip = tip .. " [COLOR_MAGENTA]" .. policyBranch._Name .. "[ENDCOLOR]"
end
end
if totalResource > 0 then
tipIndex = tipIndex+1
insert( tips, tipIndex, "[ICON_BULLET]" .. totalResource .. resource.IconString .. " = " .. numExisting .. " (+" .. numBuilds .. ") " .. tip )
else
insert( tips, "[ICON_BULLET] (" .. numResource .. "/" .. tip .. ")" )
end
end
end
end
end
----------------------------
-- Import & Export Breakdown
----------------------------
-- Get specified resource traded with the active player
local itemType, duration, finalTurn, data1, data2, data3, flag1, fromPlayerID
local gameTurn = Game.GetGameTurn()-1
local Exports = {}
local Imports = {}
for playerID = 0, MAX_MAJOR_CIVS-1 do
Exports[ playerID ] = {}
Imports[ playerID ] = {}
end
PushScratchDeal()
for i = 0, UI.GetNumCurrentDeals( activePlayerID ) - 1 do
UI.LoadCurrentDeal( activePlayerID, i )
local otherPlayerID = ScratchDeal:GetOtherPlayer( activePlayerID )
ScratchDeal:ResetIterator()
repeat
if IsCiv5BNW_BE then
itemType, duration, finalTurn, data1, data2, data3, flag1, fromPlayerID = ScratchDeal:GetNextItem()
else
itemType, duration, finalTurn, data1, data2, fromPlayerID = ScratchDeal:GetNextItem()
end
-- data1 is resourceID, data2 is quantity
if itemType == TRADE_ITEM_RESOURCES and data1 == resourceID and data2 then
if fromPlayerID == activePlayerID then
Exports[otherPlayerID][finalTurn] = (Exports[otherPlayerID][finalTurn] or 0) + data2
else
Imports[fromPlayerID][finalTurn] = (Imports[fromPlayerID][finalTurn] or 0) + data2
end
end
until not itemType
end
PopScratchDeal()
----------------------------
-- Resource Imports
----------------------------
if numResourceImport > 0 then
insert( tips, "" )
insert( tips, Colorize(numResourceImport) .. " " .. L"TXT_KEY_RESOURCES_IMPORTED" )
for playerID, row in pairs( Imports ) do
local tip = ""
for turn, quantity in pairs( row ) do
if quantity > 0 then
tip = tip .. " " .. quantity .. resource.IconString .. "(" .. turn - gameTurn .. ")"
end
end
if #tip > 0 then
insert( tips, "[ICON_BULLET]" .. Players[ playerID ]:GetCivilizationShortDescription() .. tip )
end
end
for minorID = MAX_MAJOR_CIVS, MAX_CIV_PLAYERS_minus1 do
local minor = Players[ minorID ]
if minor and minor:IsAlive() and minor:GetAlly() == activePlayerID then
local quantity = minor:GetResourceExport(resourceID)
if quantity > 0 then
insert( tips, "[ICON_BULLET]" .. minor:GetCivilizationShortDescription() .. " " .. quantity .. resource.IconString )
end
end
end
end
----------------------------
-- Resource Exports
----------------------------
if numResourceExport > 0 then
insert( tips, "" )
insert( tips, Colorize(-numResourceExport) .. " " .. L"TXT_KEY_RESOURCES_EXPORTED" )
for playerID, row in pairs( Exports ) do
local tip = ""
for turn, quantity in pairs( row ) do
if quantity > 0 then
tip = tip .. " " .. quantity .. resource.IconString .. "(" .. turn - gameTurn .. ")"
end
end
if #tip > 0 then
insert( tips, "[ICON_BULLET]" .. Players[ playerID ]:GetCivilizationShortDescription() .. tip )
end
end
end
----------------------------
-- Resource Usage Breakdown
----------------------------
insert( tips, "" )
insert( tips, (numResourceUsed~=0 and (Colorize(-numResourceUsed) .. " ") or"") .. L"TXT_KEY_PEDIA_REQ_RESRC_LABEL" )
local tipIndex = #tips
for unit in GameInfo.Units() do
local unitID = unit.ID
local numResource = Game.GetNumResourceRequiredForUnit( unitID, resourceID )
if numResource > 0 then
-- count how many such units player has
local numExisting = 0
for unit in activePlayer:Units() do
if unit:GetUnitType() == unitID then
numExisting = numExisting + 1
end
end
-- count how many such units player is building
local numBuilds = 0
for city in activePlayer:Cities() do
for i=0, city:GetOrderQueueLength()-1 do
local queuedOrderType, queuedItemType = city:GetOrderFromQueue( i )
if queuedOrderType == ORDER_TRAIN and queuedItemType == unitID then
numBuilds = numBuilds + 1
end
end
end
-- can player build this unit someday ?
local canBuildSomeday = true
if IsCiv5BNW_BE then
-- does player trait prohibits training this unit ?
local leader = GameInfo.Leaders[ activePlayer:GetLeaderType() ]
for leaderTrait in GameInfo.Leader_Traits{ LeaderType = leader.Type } do
if GameInfo.Trait_NoTrain{ UnitClassType = unit.Class, TraitType = leaderTrait.TraitType }() then
canBuildSomeday = false
break
end
end
end
if canBuildSomeday then
-- check whether this Unit has been blocked out by the civ XML unit override
local unitOverride = GameInfo.Civilization_UnitClassOverrides{ CivilizationType = activeCivilization.Type, UnitClassType = unit.Class }()
if unitOverride then
canBuildSomeday = unitOverride.UnitType == unit.Type
else
canBuildSomeday = GameInfo.UnitClasses[ unit.Class ].DefaultUnit == unit.Type
end
end
canBuildSomeday = canBuildSomeday and not (
-- one City Challenge?
( g_isOneCityChallenge and (unit.Found or unit.FoundAbroad) )
-- Faith Requirements?
or ( g_isReligionEnabled and (unit.FoundReligion or unit.SpreadReligion or unit.RemoveHeresy) )
-- obsolete by tech?
or ( unit.ObsoleteTech and activeTeamTechs:HasTech( GameInfoTypes[unit.ObsoleteTech] ) )
)
if canBuildSomeday or numExisting > 0 or numBuilds > 0 then
local totalResource = (numExisting + numBuilds) * numResource
local tip = "[COLOR_YELLOW]" .. unit._Name .. "[ENDCOLOR]"
if canBuildSomeday then
-- Tech requirements
local tech = unit.PrereqTech and GameInfo.Technologies[ unit.PrereqTech ]
if tech and not activeTeamTechs:HasTech( tech.ID ) then
tip = format( "%s [COLOR_CYAN]%s[ENDCOLOR]", tip, tech._Name )
end
-- Policy Requirement
local policy = IsCiv5BNW and unit.PolicyType and GameInfo.Policies[ unit.PolicyType ]
if policy and not activePlayer:HasPolicy( policy.ID ) then
tip = format( "%s [COLOR_MAGENTA]%s[ENDCOLOR]", tip, policy._Name )
end
if IsCivBE then
-- Affinity Level Requirements
for affinityPrereq in GameInfo.Unit_AffinityPrereqs{ UnitType = unit.Type } do
local affinityInfo = (tonumber( affinityPrereq.Level) or 0 ) > 0 and GameInfo.Affinity_Types[ affinityPrereq.AffinityType ]
if affinityInfo and activePlayer:GetAffinityLevel( affinityInfo.ID ) < affinityPrereq.Level then
tip = format("%s [%s]%i%s%s[ENDCOLOR]", tip, affinityInfo.ColorType, affinityPrereq.Level, affinityInfo.IconString or "???", affinityInfo._Name )
end
end
end
end
if totalResource > 0 then
tipIndex = tipIndex+1
insert( tips, tipIndex, "[ICON_BULLET]" .. totalResource .. resource.IconString .. " = " .. numExisting .. " (+" .. numBuilds .. ") " .. tip )
else
insert( tips, "[ICON_BULLET] (" .. numResource .. "/" .. tip .. ")" )
end
end
end
end
for building in GameInfo.Buildings() do
local buildingID = building.ID
local numResource = Game.GetNumResourceRequiredForBuilding( buildingID, resourceID )
if numResource > 0 then
-- count how many such buildings player has
local numExisting = activePlayer:CountNumBuildings( buildingID )
-- count how many such units player is building
local numBuilds = 0
for city in activePlayer:Cities() do
for i=0, city:GetOrderQueueLength()-1 do
local queuedOrderType, queuedItemType = city:GetOrderFromQueue( i )
if queuedOrderType == ORDER_CONSTRUCT and queuedItemType == buildingID then
numBuilds = numBuilds + 1
end
end
end
-- can player build this building someday ?
local canBuildSomeday
-- check whether this Unit has been blocked out by the civ XML
local buildingOverride = GameInfo.Civilization_BuildingClassOverrides{ CivilizationType = activeCivilization.Type, BuildingClassType = building.BuildingClass }()
if buildingOverride then
canBuildSomeday = buildingOverride.BuildingType == building.Type
else
canBuildSomeday = GameInfo.BuildingClasses[ building.BuildingClass ].DefaultBuilding == building.Type
end
canBuildSomeday = canBuildSomeday and not (
-- no espionage buildings for a non-espionage game
( g_isEspionageDisabled and building.IsEspionage )
-- Has obsolete tech?
or ( IsCiv5 and building.ObsoleteTech and activeTeamTechs:HasTech( GameInfoTypes[building.ObsoleteTech] ) )
)
if canBuildSomeday or numExisting > 0 or numBuilds > 0 then
local totalResource = (numExisting + numBuilds) * numResource
local tip = "[COLOR_YIELD_FOOD]" .. building._Name .. "[ENDCOLOR]"
if canBuildSomeday then
local tech = GameInfo.Technologies[ building.PrereqTech ]
if tech and not activeTeamTechs:HasTech( tech.ID ) then
tip = format( "%s [COLOR_CYAN]%s[ENDCOLOR]", tip, tech._Name )
end
local policyBranch = IsCiv5BNW and building.PolicyBranchType and GameInfo.PolicyBranchTypes[ building.PolicyBranchType ]
if policyBranch and not activePlayer:GetPolicyBranchChosen( policyBranch.ID ) then
tip = format( "%s [COLOR_MAGENTA]%s[ENDCOLOR]", tip, policyBranch._Name )
end
if IsCivBE then
-- Affinity Level Requirements
for affinityPrereq in GameInfo.Building_AffinityPrereqs{ BuildingType = building.Type } do
local affinityInfo = (tonumber( affinityPrereq.Level) or 0 ) > 0 and GameInfo.Affinity_Types[ affinityPrereq.AffinityType ]
if affinityInfo and activePlayer:GetAffinityLevel( affinityInfo.ID ) < affinityPrereq.Level then
tip = format("%s [%s]%i%s%s[ENDCOLOR]", tip, affinityInfo.ColorType, affinityPrereq.Level, affinityInfo.IconString or "???", affinityInfo._Name )
end
end
end
end
if totalResource > 0 then
tipIndex = tipIndex+1
insert( tips, tipIndex, "[ICON_BULLET]" .. totalResource .. resource.IconString .. " = " .. numExisting .. " (+" .. numBuilds .. ") " .. tip )
else
insert( tips, "[ICON_BULLET] (" .. numResource .. "/" .. tip .. ")" )
end
end
end
end
local resourceHappiness = resource.Happiness or 0
if resourceHappiness > 0 then
insert( tips, resourceHappiness .. "[ICON_HAPPINESS_1]" )
end
for city in activePlayer:Cities() do
if city:GetResourceDemanded() == resourceID and city:GetWeLoveTheKingDayCounter() < 1 then
insert( tips, "[ICON_CITIZEN] " .. city:GetName() )
end
end
for minorPlayerID = MAX_MAJOR_CIVS, MAX_CIV_PLAYERS_minus1 do
local minorPlayer = Players[minorPlayerID]
if ( IsCiv5notVanilla or minorPlayer:GetActiveQuestForPlayer()==MINOR_CIV_QUEST_CONNECT_RESOURCE ) and minorPlayer:GetQuestData1(activePlayerID, MINOR_CIV_QUEST_CONNECT_RESOURCE) == resourceID then
insert( tips, "[ICON_CITY_STATE] " .. minorPlayer:GetCivilizationShortDescription() )
end
end
----------------------------
-- Available for Import
----------------------------
local tipIndex = #tips
local totalResource = 0
for playerID = 0, MAX_CIV_PLAYERS_minus1 do
local player = Players[playerID]
local isMinorCiv = player:IsMinorCiv()
-- Valid player? - Can't be us, has to be alive, and has to be met
if playerID ~= activePlayerID
and player:IsAlive()
and activeTeam:IsHasMet( player:GetTeam() )
and not (isMinorCiv and player:IsAllies(activePlayerID))
then
local numResource = ( isMinorCiv and player:GetNumResourceTotal(resourceID, false) + player:GetResourceExport( resourceID ) )
or ( ScratchDeal:IsPossibleToTradeItem(playerID, activePlayerID, TRADE_ITEM_RESOURCES, resourceID, 1) and player:GetNumResourceAvailable(resourceID, false) ) or 0
if numResource > 0 then
totalResource = totalResource + numResource
insert( tips, "[ICON_BULLET]" .. player:GetCivilizationShortDescription() .. " " .. numResource .. resource.IconString )
end
end
end
if totalResource > 0 then
insert( tips, tipIndex+1, "" )
insert( tips, tipIndex+2, "----------------")
insert( tips, tipIndex+3, totalResource .. " " .. L"TXT_KEY_EO_RESOURCES_AVAILBLE" )
end
return ShowTextToolTipAndPicture( concat( tips, "[NEWLINE]" ), resource.PortraitIndex, resource.IconAtlas )
end
end
LuaEvents.ResourceToolTip.Add( function( control )
ShowResourceToolTip( control:GetVoid1(), {} )
end)
--==========================================================
-- Civilization Tooltips
--==========================================================
do
local function ShowCivilizationToolTip( toolTip, playerID )
g_CivilizationTooltipControls.Text:SetText( toolTip )
g_CivilizationTooltipControls.Box:DoAutoSize()
local isMinorCiv, isMajorCiv
local player = Players[ playerID ]
if player then
if player:IsMinorCiv() then
local minorCivInfo = GameInfo.MinorCivilizations[ player:GetMinorCivType() ]
if minorCivInfo and g_isCityStateLeaders then
if Locale.HasTextKey( "TXT_KEY_CSL_ICON_"..minorCivInfo.Type ) then
-- g_CivilizationTooltipControls.Leader:SetTextureSizeVal( 200, 200 )
-- g_CivilizationTooltipControls.Leader:SetTextureOffsetVal( 0, 0 )
isMinorCiv = g_CivilizationTooltipControls.Leader:SetTexture( L("TXT_KEY_CSL_ICON_"..minorCivInfo.Type) )
--[[
else
local row = GameInfo.Civilization_CityNames{ CityName = "TXT_KEY_CITY_NAME"..minorCivInfo.Type:sub(10,99) }()
--print( minorCivInfo.Type, row and row.CityName )
local leader = row and GameInfo.Civilization_Leaders{ CivilizationType = row.CivilizationType }()
leader = leader and GameInfo.Leaders[ leader.LeaderheadType ]
--print( minorCivInfo.Type, leader and leader.Type )
if leader then
g_CivilizationTooltipControls.Leader:SetTextureSizeVal( 254, 254 )
isMinorCiv = IconHookup( leader.PortraitIndex, 256, leader.IconAtlas, g_CivilizationTooltipControls.Leader )
end
--]]
end
end
else
local leader = GameInfo.Leaders[ player:GetLeaderType() ]
isMajorCiv = leader and IconHookup( leader.PortraitIndex, g_CivilizationTooltipControls.Portrait:GetSizeY(), leader.IconAtlas, g_CivilizationTooltipControls.Portrait )
CivIconHookup( playerID, g_CivilizationTooltipControls.CivIconBG:GetSizeY(), g_CivilizationTooltipControls.CivIcon, g_CivilizationTooltipControls.CivIconBG, g_CivilizationTooltipControls.CivIconShadow, false, true )
end
end
g_CivilizationTooltipControls.MajorCiv:SetHide( not isMajorCiv )
g_CivilizationTooltipControls.MinorCiv:SetHide( not isMinorCiv )
end
local function TooltipWithRemainingTurns( toolTip, remainingTurns )
toolTip = L( toolTip )
if remainingTurns and remainingTurns > 0 then
toolTip = toolTip .. " (" .. L( "TXT_KEY_STR_TURNS", remainingTurns ) .. ")"
end
return toolTip
end
local function TooltipAndGetRemainingTurns( toolTip, tradeableItemID, fromPlayerID, toPlayerID )
PushScratchDeal()
local activePlayerID = GetActivePlayer()
for i = 0, UI.GetNumCurrentDeals( activePlayerID ) - 1 do
UI.LoadCurrentDeal( activePlayerID, i )
if not toPlayerID or toPlayerID == activePlayerID or toPlayerID == ScratchDeal:GetOtherPlayer( activePlayerID ) then
ScratchDeal:ResetIterator()
local itemID
repeat
local item = { ScratchDeal:GetNextItem() }
itemID = item[1]
if itemID == tradeableItemID and item[#item] == fromPlayerID then
PopScratchDeal()
return TooltipWithRemainingTurns( toolTip, item[3] - Game.GetGameTurn() + 1 )
end
until not itemID
end
end
PopScratchDeal()
return L(toolTip)
end
local function Pledge( playerID )
local player = Players[ playerID ]
local toolTip = L"TXT_KEY_POP_CSTATE_PLEDGE_TO_PROTECT"
if player and player.CanMajorWithdrawProtection then
toolTip = L( "TXT_KEY_NOTIFICATION_SUMMARY_QUEST_COMPLETE_PLEDGE_TO_PROTECT", player:GetCivilizationShortDescriptionKey() )
if player:CanMajorWithdrawProtection( GetActivePlayer() ) then
toolTip = toolTip .. "[NEWLINE][NEWLINE]" .. L"TXT_KEY_POP_CSTATE_REVOKE_PROTECTION_TT"
else
toolTip = toolTip .. L("TXT_KEY_POP_CSTATE_REVOKE_PROTECTION_DISABLED_COMMITTED_TT", player:GetTurnLastPledgedProtectionByMajor( GetActivePlayer() ) + 10 - Game.GetGameTurn() )
end
end
return toolTip
end
local CivilizationToolTips = {
Button = function( playerID )
local player = Players[ playerID ]
if player:IsMinorCiv() then
return GetCityStateStatusToolTip( GetActivePlayer(), playerID, true )
else
return GetMoodInfo( playerID, true )
end
end;
Quests = function( playerID )
return GetActiveQuestToolTip( GetActivePlayer(), playerID )
end;
Ally = function( playerID )
return GetAllyToolTip( GetActivePlayer(), playerID )
end;
Pledge1 = Pledge,
Pledge2 = Pledge,
Spy = function( playerID )
local player = Players[ playerID ]
local activePlayer = Players[ GetActivePlayer() ]
if player and activePlayer then
local spy
for _, s in ipairs( activePlayer:GetEspionageSpies() ) do
local plot = GetPlot( s.CityX, s.CityY )
local city = plot and plot:GetPlotCity()
if city and city:GetOwner() == playerID then
spy = s
break
end
end
if spy then
return L( "TXT_KEY_CITY_SPY_CITY_STATE_TT", spy.Rank, spy.Name, player:GetCivilizationShortDescriptionKey(), spy.Rank, spy.Name)
end
end
end;
DeclarationOfFriendship = function( playerID )
local toolTipKey = "TXT_KEY_DIPLOMACY_FRIENDSHIP_ADV_QUEST"
local activePlayer = Players[ GetActivePlayer() ]
if activePlayer and activePlayer.GetDoFCounter then
return TooltipWithRemainingTurns( toolTipKey, DOF_EXPIRATION_TIME - activePlayer:GetDoFCounter( playerID ) )
else
return L(toolTipKey)
end
end;
ResearchAgreement = function( playerID )
return TooltipAndGetRemainingTurns( "TXT_KEY_DO_RESEARCH_AGREEMENT", TradeableItems.TRADE_ITEM_RESEARCH_AGREEMENT, playerID )
end;
DefenseAgreement = function( playerID )
return TooltipAndGetRemainingTurns( "TXT_KEY_DO_PACT", TradeableItems.TRADE_ITEM_DEFENSIVE_PACT, playerID )
end;
TheirBordersClosed = function()
return L"TXT_KEY_EUI_CLOSED_BORDERS_THEIR" --( "Their borders are closed" )
end;
OurBordersClosed = function()
return L"TXT_KEY_EUI_CLOSED_BORDERS_YOUR" --( "Your borders are closed" )
end;
TheirBordersOpen = function( playerID )
local toolTip = "TXT_KEY_EUI_OPEN_BORDERS_THEIR"
if not Locale.HasTextKey( toolTip ) then
toolTip = L( "TXT_KEY_DO_THEY_PROVIDE", "TXT_KEY_DO_OPEN_BORDERS" )
end
return TooltipAndGetRemainingTurns( toolTip, TradeableItems.TRADE_ITEM_OPEN_BORDERS, playerID )
end;
OurBordersOpen = function( playerID )
local toolTip = "TXT_KEY_EUI_OPEN_BORDERS_YOUR"
if not Locale.HasTextKey( toolTip ) then
toolTip = L( "TXT_KEY_DO_WE_PROVIDE", "TXT_KEY_DO_OPEN_BORDERS" )
end
return TooltipAndGetRemainingTurns( toolTip, TradeableItems.TRADE_ITEM_OPEN_BORDERS, GetActivePlayer(), playerID )
end;
ActivePlayer = function()
return L"TXT_KEY_YOU"
end;
War = function( playerID )
local player = Players[ playerID ]
local activeTeam = Teams[ GetActiveTeam() ]
if player and activeTeam then
local tips = { L( "TXT_KEY_AT_WAR_WITH", player:GetCivilizationShortDescriptionKey() ) }
local teamID = player:GetTeam()
local lockedWarTurns = activeTeam:GetNumTurnsLockedIntoWar( teamID )
if lockedWarTurns > 0 then
insert( tips, L( "TXT_KEY_DIPLO_NEGOTIATE_PEACE_BLOCKED_TT", lockedWarTurns ) )
elseif not activeTeam:CanChangeWarPeace( teamID ) then
insert( tips, L"TXT_KEY_PEACE_BLOCKED" )
end
-- todo TradeableItems.TRADE_ITEM_THIRD_PARTY_WAR & permanent war
return concat( tips, "[NEWLINE]" )
end
end;
Score = function( playerID )
local player = Players[ playerID ]
if player then
local tips = { L"TXT_KEY_POP_SCORE" .. " " .. player:GetScore(), --TXT_KEY_VP_SCORE
"----------------",
L("TXT_KEY_DIPLO_MY_SCORE_CITIES", player:GetScoreFromCities() ),
L("TXT_KEY_DIPLO_MY_SCORE_POPULATION", player:GetScoreFromPopulation() ),
L("TXT_KEY_DIPLO_MY_SCORE_LAND", player:GetScoreFromLand() ),
L("TXT_KEY_DIPLO_MY_SCORE_WONDERS", player:GetScoreFromWonders() ) }
if g_isScienceEnabled then
insert( tips, L("TXT_KEY_DIPLO_MY_SCORE_TECH", player:GetScoreFromTechs() ) )
insert( tips, L("TXT_KEY_DIPLO_MY_SCORE_FUTURE_TECH", player:GetScoreFromFutureTech() ) )
end
if g_isReligionEnabled then
insert( tips, L("TXT_KEY_DIPLO_MY_SCORE_RELIGION", player:GetScoreFromReligion() ) )
end
if g_isPoliciesEnabled and player.GetScoreFromPolicies then
insert( tips, L("TXT_KEY_DIPLO_MY_SCORE_POLICIES", player:GetScoreFromPolicies() ) )
end
if player.GetScoreFromGreatWorks then
insert( tips, L("TXT_KEY_DIPLO_MY_SCORE_GREAT_WORKS", player:GetScoreFromGreatWorks() ) )
end
if PreGame.GetLoadWBScenario() then
for i = 1, 4 do
local key = "TXT_KEY_DIPLO_MY_SCORE_SCENARIO"..i
if Locale.HasTextKey( key ) then
insert( tips, L( key, player["GetScoreFromScenario"..i](player) ) )
end
end
end
return concat( tips, "[NEWLINE]" )
end
end;
Gold = function( playerID )
local player = Players[ playerID ]
if player then
local team = Teams[ player:GetTeam() ]
if team and team:IsAtWar( GetActiveTeam() ) then
return L"TXT_KEY_DIPLO_MAJOR_CIV_DIPLO_STATE_WAR"
elseif not player.IsDoF or player:IsDoF( GetActivePlayer() ) then
return L"TXT_KEY_REPLAY_DATA_TOTALGOLD"
else
return L"TXT_KEY_REPLAY_DATA_GOLDPERTURN"
end
end
end;
TheirTradeItems = function( playerID )
local player = Players[ playerID ]
if player then
-- Resources available from them
local activePlayerID = GetActivePlayer()
local tips = { L( "TXT_KEY_DIPLO_ITEMS_LABEL", player:GetCivilizationAdjective() ) }
for usage = RESOURCEUSAGE_LUXURY, RESOURCEUSAGE_STRATEGIC, RESOURCEUSAGE_STRATEGIC - RESOURCEUSAGE_LUXURY do
for resource in GameInfo.Resources{ ResourceUsage = usage } do
-- IsPossibleToTradeItem includes check on min quantity, banned luxes and obsolete strategics
if ScratchDeal:IsPossibleToTradeItem( playerID, activePlayerID, TRADE_ITEM_RESOURCES, resource.ID, 1 ) then
local a, b = player:GetNumResourceAvailable( resource.ID, true ), player:GetNumResourceAvailable( resource.ID )
insert( tips, format( a == b and "%i%s%s" or "%i%s%s (%i)", a, resource.IconString, resource._Name, b ) )
end
end
end
return concat( tips, "[NEWLINE]" )
end
end;
OurTradeItems = function( playerID )
local player = Players[ playerID ]
if player then
local activePlayerID = GetActivePlayer()
local activePlayer = Players[ activePlayerID ]
local tips = { L"TXT_KEY_DIPLO_YOUR_ITEMS_LABEL" }
-- Resources available from us
for usage = RESOURCEUSAGE_LUXURY, RESOURCEUSAGE_STRATEGIC, RESOURCEUSAGE_STRATEGIC - RESOURCEUSAGE_LUXURY do
for resource in GameInfo.Resources{ ResourceUsage = usage } do
-- IsPossibleToTradeItem includes check on min quantity, banned luxes and obsolete strategics
if ScratchDeal:IsPossibleToTradeItem( activePlayerID, playerID, TRADE_ITEM_RESOURCES, resource.ID, 1 )
and player:GetNumResourceAvailable( resource.ID, true ) <= player:GetNumCities() -- game limit on AI trading of strategics; no effect on luxes
then
local a, b = activePlayer:GetNumResourceAvailable( resource.ID, true ), activePlayer:GetNumResourceAvailable( resource.ID )
insert( tips, format( a == b and "%i%s%s" or "%i%s%s (%i)", a, resource.IconString, resource._Name, b ) )
end
end
end
return concat( tips, "[NEWLINE]" ), activePlayerID
end
end;
Host = function()
return L"TXT_KEY_HOST"
end;
Connection = function( playerID )
local player = Players[ playerID ]
if player then
local toolTip
if Network.IsPlayerHotJoining(playerID) then
toolTip = L"TXT_KEY_MP_PLAYER_CONNECTING"
elseif player:IsConnected() then
toolTip = L"TXT_KEY_MP_PLAYER_CONNECTED"
else
toolTip = L"TXT_KEY_MP_PLAYER_NOTCONNECTED"
end
if Matchmaking.GetHostID() == playerID then
toolTip = L"TXT_KEY_HOST" .. ", "..toolTip
end
local playerInfo
local ping = ""
if playerID == GetActivePlayer() then
playerInfo = Network.GetLocalTurnSliceInfo()
else
playerInfo = Network.GetPlayerTurnSliceInfo( playerID )
end
if PreGame.IsInternetGame() then
ping = Network.GetPingTime( playerID )
if ping < 0 then
ping = ""
elseif ping == 0 then
ping= L"TXT_KEY_STAGING_ROOM_UNDER_1_MS"
elseif ping < 1000 then
ping = ping .. L"TXT_KEY_STAGING_ROOM_TIME_MS"
else
ping = ("%.2f"):format( ping / 1000) .. L"TXT_KEY_STAGING_ROOM_TIME_S"
end
if ping>"" then
ping = L"TXT_KEY_ACTION_PING".." "..ping.." "
end
end
return toolTip .. "[NEWLINE][NEWLINE]"..ping.."Network turn slice: "
.. playerInfo.Shortest .. " ("
.. playerInfo.Average .. ") "
.. playerInfo.Longest
end
end;
Diplomacy = function( playerID )
if UI.ProposedDealExists( playerID, GetActivePlayer() ) then
return L"TXT_KEY_DIPLO_REQUEST_INCOMING"
elseif UI.ProposedDealExists( GetActivePlayer(), playerID ) then
return L"TXT_KEY_DIPLO_REQUEST_OUTGOING"
end
end;
}-- /CivilizationToolTips
LuaEvents.CivilizationToolTips.Add( function( control, playerID )
local toolTip, ID = TooltipSelect( CivilizationToolTips, control, playerID )
ShowCivilizationToolTip( toolTip, ID or playerID )
end)
end
--==========================================================
-- Unit Action Tooltip
--==========================================================
LuaEvents.UnitActionToolTip.Add( function( button )
local activePlayerID = GetActivePlayer()
local activePlayer = Players[ activePlayerID ]
local activeTeamID = GetActiveTeam()
local activeTeam = Teams[ activeTeamID ]
local unit = GetHeadSelectedUnit()
local actionID = button:GetVoid1()
local action = GameInfoActions[actionID]
if unit and activePlayer and activeTeam and action then
local activeTechs = activeTeam:GetTeamTechs()
local actionType = action.Type
local unitPlot = unit:GetPlot()
local x = unit:GetX()
local y = unit:GetY()
if actionType == "MISSION_FOUND" then
g_UnitActionTooltipControls.UnitActionIcon:SetTextureOffsetVal( 0, 0 )
g_UnitActionTooltipControls.UnitActionIcon:SetTexture( "BuildCity64.dds" )
else
local info = g_infoSource[ action.SubType ]
info = info and info[ actionType ]
if info then
IconHookup( info.IconIndex or info.PortraitIndex, 64, info.IconAtlas, g_UnitActionTooltipControls.UnitActionIcon )
end
end
-- Able to perform action
local gameCanHandleAction = Game.CanHandleAction( actionID, unitPlot, false )
-- Build data
local isBuild = action.SubType == ACTIONSUBTYPE_BUILD
local buildID = action.MissionData
local build = GameInfo.Builds[ buildID ]
-- Improvement data
local improvement = build and GameInfo.Improvements[ build.ImprovementType ]
local improvementID = improvement and improvement.ID
-- Feature data
local featureID = unitPlot:GetFeatureType()
local feature = GameInfo.Features[ featureID ]
-- Route data
local route = build and GameInfo.Routes[ build.RouteType ]
local strBuildTurnsString = ""
local toolTip = {}
local disabledTip = {}
-- Upgrade unit
if actionType == "COMMAND_UPGRADE" then
local upgradeUnitTypeID = unit:GetUpgradeUnitType()
local unitUpgradePrice = unit:UpgradePrice(upgradeUnitTypeID)
local unitUpgradeInfo = GameInfo.Units[upgradeUnitTypeID]
if unitUpgradeInfo then
insert( toolTip, L( "TXT_KEY_UPGRADE_HELP", UnitColor( unitUpgradeInfo._Name ), unitUpgradePrice ) )
insert( toolTip, "----------------" )
insert( toolTip, GetHelpTextForUnit( upgradeUnitTypeID, true ) )
end
if not gameCanHandleAction then
insert( toolTip, "----------------" )
-- Can't upgrade because we're outside our territory
if unitPlot:GetOwner() ~= unit:GetOwner() then
insert( disabledTip, L"TXT_KEY_UPGRADE_HELP_DISABLED_TERRITORY" )
end
-- Can't upgrade because we're outside of a city
if unit:GetDomainType() == DomainTypes.DOMAIN_AIR and not unitPlot:IsCity() then
insert( disabledTip, L"TXT_KEY_UPGRADE_HELP_DISABLED_CITY" )
end
-- Can't upgrade because we lack the Gold
if unitUpgradePrice > activePlayer:GetGold() then
insert( disabledTip, L"TXT_KEY_UPGRADE_HELP_DISABLED_GOLD" )
end
-- Can't upgrade because we lack the Resources
local resourcesNeeded = {}
for resource in GameInfo.Resources() do
local numResourceNeededToUpgrade = unit:GetNumResourceNeededToUpgrade(resource.ID)
if numResourceNeededToUpgrade > 0 and numResourceNeededToUpgrade > activePlayer:GetNumResourceAvailable(resource.ID) then
insert( resourcesNeeded, numResourceNeededToUpgrade .. " " .. resource.IconString .. " " .. resource._Name )
end
end
if #resourcesNeeded > 0 then
insert( disabledTip, L( "TXT_KEY_UPGRADE_HELP_DISABLED_RESOURCES", concat( resourcesNeeded, ", " ) ) )
end
-- if we can't upgrade due to stacking
if unitPlot:GetNumFriendlyUnitsOfType(unit) > 1 then
insert( disabledTip, L"TXT_KEY_UPGRADE_HELP_DISABLED_STACKING" )
end
end
elseif actionType == "MISSION_ALERT" and not unit:IsEverFortifyable() then
insert( toolTip, L"TXT_KEY_MISSION_ALERT_NO_FORTIFY_HELP" )
-- Golden Age
elseif actionType == "MISSION_GOLDEN_AGE" then
insert( toolTip, L( "TXT_KEY_MISSION_START_GOLDENAGE_HELP", unit:GetGoldenAgeTurns() ) )
-- Spread Religion -- gk+ only
elseif actionType == "MISSION_SPREAD_RELIGION" then
local eMajorityReligion = unit:GetMajorityReligionAfterSpread()
insert( toolTip, L"TXT_KEY_MISSION_SPREAD_RELIGION_HELP" )
insert( toolTip, "----------------" )
insert( toolTip, L("TXT_KEY_MISSION_SPREAD_RELIGION_RESULT", Game.GetReligionName(unit:GetReligion()), unit:GetNumFollowersAfterSpread() ) .. " " ..
( eMajorityReligion < RELIGION_PANTHEON and L"TXT_KEY_MISSION_MAJORITY_RELIGION_NONE" or L("TXT_KEY_MISSION_MAJORITY_RELIGION", Game.GetReligionName(eMajorityReligion) ) ) )
-- Create Great Work -- bnw only
elseif actionType == "MISSION_CREATE_GREAT_WORK" then
insert( toolTip, L"TXT_KEY_MISSION_CREATE_GREAT_WORK_HELP" )
if gameCanHandleAction then
insert( toolTip, "----------------" )
local eGreatWorkSlotType = unit:GetGreatWorkSlotType()
local building = GameInfo.Buildings[ activePlayer:GetBuildingOfClosestGreatWorkSlot(x, y, eGreatWorkSlotType) ]
local city = activePlayer:GetCityOfClosestGreatWorkSlot(x, y, eGreatWorkSlotType)
insert( toolTip, L( "TXT_KEY_MISSION_CREATE_GREAT_WORK_RESULT", building and building.Description or "???", city and city:GetNameKey() or "???" ) )
end
-- Paradrop
elseif actionType == "INTERFACEMODE_PARADROP" then
insert( toolTip, L( "TXT_KEY_INTERFACEMODE_PARADROP_HELP_WITH_RANGE", unit:GetDropRange() ) )
-- Sell Exotic Goods -- bnw only
elseif actionType == "MISSION_SELL_EXOTIC_GOODS" then
insert( toolTip, L"TXT_KEY_MISSION_SELL_EXOTIC_GOODS_HELP" )
if gameCanHandleAction then
insert( toolTip, "----------------" )
insert( toolTip, "+" .. unit:GetExoticGoodsGoldAmount() .. "[ICON_GOLD]" )
insert( toolTip, L( "TXT_KEY_EXPERIENCE_POPUP", unit:GetExoticGoodsXPAmount() ) )
end
-- Great Scientist, bnw only
elseif actionType == "MISSION_DISCOVER" then
insert( toolTip, L"TXT_KEY_MISSION_DISCOVER_TECH_HELP" )
if gameCanHandleAction then
insert( toolTip, "----------------" )
insert( toolTip, "+" .. unit:GetDiscoverAmount() .. "[ICON_RESEARCH]" )
end
-- Great Engineer, bnw only
elseif actionType == "MISSION_HURRY" then
insert( toolTip, L"TXT_KEY_MISSION_HURRY_PRODUCTION_HELP" )
if gameCanHandleAction then
insert( toolTip, "----------------" )
insert( toolTip, "+" .. unit:GetHurryProduction(unitPlot) .. "[ICON_PRODUCTION]" )
end
-- Great Merchant, bnw only
elseif actionType == "MISSION_TRADE" then
insert( toolTip, L"TXT_KEY_MISSION_CONDUCT_TRADE_MISSION_HELP" )
if gameCanHandleAction then
insert( toolTip, "----------------" )
insert( toolTip, "+" .. unit:GetTradeInfluence(unitPlot) .. "[ICON_INFLUENCE]" )
insert( toolTip, "+" .. unit:GetTradeGold(unitPlot) .. "[ICON_GOLD]" )
end
-- Great Writer, bnw only
elseif actionType == "MISSION_GIVE_POLICIES" then
insert( toolTip, L"TXT_KEY_MISSION_GIVE_POLICIES_HELP" )
if gameCanHandleAction then
insert( toolTip, "----------------" )
insert( toolTip, "+" .. unit:GetGivePoliciesCulture() .. "[ICON_CULTURE]" )
end
-- Great Musician, bnw only
elseif actionType == "MISSION_ONE_SHOT_TOURISM" then
insert( toolTip, L"TXT_KEY_MISSION_ONE_SHOT_TOURISM_HELP" )
if gameCanHandleAction then
insert( toolTip, "----------------" )
insert( toolTip, "+" .. unit:GetBlastTourism() .. "[ICON_TOURISM]" )
end
-- Delete unit
elseif actionType == "COMMAND_DELETE" then
insert( toolTip, L( "TXT_KEY_SCRAP_HELP", unit:GetScrapGold() ) )
-- Cannned help text
elseif ( action.Help or "" ) ~= "" then
insert( toolTip, L(action.Help) )
end
-- Not able to perform action
if not gameCanHandleAction then
-- Worker build
if isBuild then
-- Don't have Tech for Build?
if improvement or route then
-- Figure out what the name of the thing is that we're looking at
local strImpRouteKey = (improvement and improvement.Description) or (route and route.Description) or ""
local prereqTech = GameInfo.Technologies[build.PrereqTech]
if prereqTech and not activeTechs:HasTech(prereqTech.ID) then
insert( disabledTip, L( "TXT_KEY_BUILD_BLOCKED_PREREQ_TECH", prereqTech.Description, strImpRouteKey ) )
end
if improvement then
-- Trying to build something and are not adjacent to our territory? gk+ only
if improvement.InAdjacentFriendly and unitPlot:GetTeam() ~= unit:GetTeam() and not unitPlot:IsAdjacentTeam(unit:GetTeam(), true) then
insert( disabledTip, L( "TXT_KEY_BUILD_BLOCKED_NOT_IN_ADJACENT_TERRITORY", strImpRouteKey ) )
end
-- Trying to build something in a City-State's territory? bnw only
if improvement.OnlyCityStateTerritory then
local unitPlotOwner = Players[unitPlot:GetOwner()]
if not( unitPlotOwner and unitPlotOwner:IsMinorCiv() ) then
insert( disabledTip, L( "TXT_KEY_BUILD_BLOCKED_NOT_IN_CITY_STATE_TERRITORY", strImpRouteKey ) )
end
end
-- Trying to build something outside of our territory?
if improvement.OutsideBorders == false and unitPlot:GetTeam() ~= unit:GetTeam() then
insert( disabledTip, L( "TXT_KEY_BUILD_BLOCKED_OUTSIDE_TERRITORY", strImpRouteKey ) )
end
-- Trying to build something that requires an adjacent luxury? bnw only
if improvement.AdjacentLuxury then
local adjacentPlot
for direction = 0, 5 do -- DirectionTypes.NUM_DIRECTION_TYPES-1
adjacentPlot = PlotDirection(x, y, direction)
if adjacentPlot then
local eResourceType = adjacentPlot:GetResourceType()
if eResourceType ~= -1 then
if GetResourceUsageType(eResourceType) == RESOURCEUSAGE_LUXURY then
insert( disabledTip, L( "TXT_KEY_BUILD_BLOCKED_NO_ADJACENT_LUXURY", strImpRouteKey ) )
break
end
end
end
end
end
-- Trying to build something where we can't have two adjacent? bnw only
if improvement.NoTwoAdjacent then
local adjacentPlot
for direction = 0, 5 do -- DirectionTypes.NUM_DIRECTION_TYPES-1
adjacentPlot = PlotDirection(x, y, direction)
if adjacentPlot then
if adjacentPlot:GetImprovementType() == improvementID or adjacentPlot:GetBuildProgress(buildID) > 0 then
insert( disabledTip, L( "TXT_KEY_BUILD_BLOCKED_CANNOT_BE_ADJACENT", strImpRouteKey ) )
break
end
end
end
end
end -- improvement
end -- improvement or route
-- Build blocked by a feature here?
if activePlayer:IsBuildBlockedByFeature(buildID, featureID) then
for row in GameInfo.BuildFeatures{ BuildType = build.Type, FeatureType = feature.Type } do
local pFeatureTech = GameInfo.Technologies[row.PrereqTech]
insert( disabledTip, L( "TXT_KEY_BUILD_BLOCKED_BY_FEATURE", pFeatureTech.Description, feature.Description ) )
end
end
-- Not a Worker build, use normal disabled help from XML
else
if actionType == "MISSION_FOUND" and activePlayer:IsEmpireVeryUnhappy() then
insert( disabledTip, L"TXT_KEY_MISSION_BUILD_CITY_DISABLED_UNHAPPY" )
elseif actionType == "MISSION_CULTURE_BOMB" and activePlayer:GetCultureBombTimer() > 0 then
insert( disabledTip, L( "TXT_KEY_MISSION_CULTURE_BOMB_DISABLED_COOLDOWN", activePlayer:GetCultureBombTimer() ) )
elseif action.DisabledHelp and action.DisabledHelp ~= "" then
insert( disabledTip, L( action.DisabledHelp ) )
end
end
if #disabledTip > 0 then
insert( toolTip, "[COLOR_WARNING_TEXT]" .. concat( disabledTip, "[NEWLINE]" ) .. "[ENDCOLOR]" )
end
end
-- Is this a Worker build?
if isBuild then
local turnsRemaining = GetUnitBuildProgressData( unitPlot, buildID, unit )
if turnsRemaining > 0 then
strBuildTurnsString = " ... " .. L("TXT_KEY_STR_TURNS", turnsRemaining )
end
-- Extra Yield from this build
for yieldID = 0, NUM_YIELD_TYPES_minus1 do
local yieldChange = unitPlot:GetYieldWithBuild( buildID, yieldID, false, activePlayerID ) - unitPlot:CalculateYield(yieldID)
if yieldChange > 0 then
insert( toolTip, "[COLOR_POSITIVE_TEXT]+" .. L( g_yieldString[yieldID], yieldChange) )
elseif yieldChange < 0 then
insert( toolTip, "[COLOR_NEGATIVE_TEXT]" .. L( g_yieldString[yieldID], yieldChange) )
end
end
-- Resource connection
if improvement then
local resourceID = unitPlot:GetResourceType( activeTeamID )
local resource = GameInfo.Resources[resourceID]
if resource
and unitPlot:IsResourceConnectedByImprovement( improvementID )
and GetResourceUsageType(resourceID) ~= RESOURCEUSAGE_BONUS
then
insert( toolTip, L( "TXT_KEY_BUILD_CONNECTS_RESOURCE", resource.IconString, resource.Description ) )
end
end
-- Production for clearing a feature
if feature and unitPlot:IsBuildRemovesFeature(buildID) then
local tip = L( "TXT_KEY_BUILD_FEATURE_CLEARED", feature.Description )
local featureProduction = unitPlot:GetFeatureProduction( buildID, activeTeamID )
if featureProduction > 0 then
tip = tip .. L( "TXT_KEY_BUILD_FEATURE_PRODUCTION", featureProduction )
local city = unitPlot:GetWorkingCity()
if city then
tip = tip .. " (".. city:GetName()..")"
end
end
insert( toolTip, tip )
end
end
-- Tooltip
g_UnitActionTooltipControls.UnitActionHelp:SetText( concat( toolTip, "[NEWLINE]" ) )
-- Title
g_UnitActionTooltipControls.UnitActionText:SetText( "[COLOR_POSITIVE_TEXT]" .. L( tostring( action.TextKey or actionType ) ) .. "[ENDCOLOR]".. strBuildTurnsString )
-- HotKey
if action.HotKey and action.HotKey ~= "" and action.SubType ~= ACTIONSUBTYPE_PROMOTION then
g_UnitActionTooltipControls.UnitActionHotKey:SetText( "("..tostring(action.HotKey)..")" )
else
g_UnitActionTooltipControls.UnitActionHotKey:SetText()
end
-- Autosize tooltip
g_UnitActionTooltipControls.UnitActionMouseover:DoAutoSize()
local mouseoverSizeX = g_UnitActionTooltipControls.UnitActionMouseover:GetSizeX()
if mouseoverSizeX < 350 then
g_UnitActionTooltipControls.UnitActionMouseover:SetSizeX( 350 )
end
else
g_UnitActionTooltipControls.UnitActionMouseover:SetHide( true )
end
end)
--==========================================================
-- Unit Tooltips
--==========================================================
do
local function UnitToolTip( unit )
if unit then
local controls = g_UnitTooltipControls
local toolTipString = ShortUnitTip( unit )
local playerID = unit:GetOwner()
if playerID == GetActivePlayer() then
toolTipString = toolTipString .. "[NEWLINE]".. L("TXT_KEY_UNIT_EXPERIENCE_INFO", unit:GetLevel(), unit:GetExperience(), unit:ExperienceNeeded() ) .. L"TXT_KEY_UPANEL_CLICK_TO_SELECT"
end
controls.Text:SetText( toolTipString )
local iconIndex, iconAtlas = GetUnitPortraitIcon( unit )
IconHookup( iconIndex, 256, iconAtlas, controls.UnitPortrait )
CivIconHookup( playerID, 64, controls.CivIcon, controls.CivIconBG, controls.CivIconShadow, false, true )
local i = 0
local promotionText = {}
local promotionIcon
g_PromotionIconIM:ResetInstances()
if not( unit.IsTrade and unit:IsTrade() ) then
for unitPromotion in GameInfo.UnitPromotions() do
if unit:IsHasPromotion(unitPromotion.ID) and unitPromotion.ShowInUnitPanel ~= false then
promotionIcon = g_PromotionIconIM:GetInstance()
IconHookup( unitPromotion.PortraitIndex, 32, unitPromotion.IconAtlas, promotionIcon.Image )
insert( promotionText, unitPromotion._Name )
end
end
end
controls.PortraitFrame:SetAnchor( GetMousePos() > 300 and "L,T" or "R,T" )
controls.PromotionText:SetText( concat( promotionText, "[NEWLINE]" ) )
controls.PromotionText:SetHide( #promotionText ~= 1 )
controls.IconStack:SetWrapWidth( ceil( i / ceil( i / 10 ) ) * 26 )
controls.IconStack:CalculateSize()
controls.Box:DoAutoSize()
Controls.UnitTooltipTimer:SetToBeginning()
Controls.UnitTooltipTimer:Reverse()
end
end
LuaEvents.UnitToolTip.Add( UnitToolTip )
LuaEvents.UnitFlagToolTip.Add( function( button )
local player = Players[ button:GetVoid1() ]
UnitToolTip( player and player:GetUnitByID( button:GetVoid2() ) )
end)
local UnitToolTips = {
Button = UnitToolTip,
MovementPip = function( unit )
return ShowTextToolTip( unit and format( "%s %.3g / %g [ICON_MOVES]", L"TXT_KEY_UPANEL_MOVEMENT", unit:MovesLeft() / MOVE_DENOMINATOR, unit:MaxMoves() / MOVE_DENOMINATOR )
--[[
.." GetActivityType="..(function(a) for k, v in pairs( ActivityTypes ) do if v==a then return k end end return "unknown" end)(unit:GetActivityType())
.." GetFortifyTurns="..tostring(unit:GetFortifyTurns())
.." HasMoved="..tostring(unit:HasMoved())
.." IsReadyToMove="..tostring(unit:IsReadyToMove())
.." IsWaiting="..tostring(unit:IsWaiting())
.." IsAutomated="..tostring(unit:IsAutomated())
--]]
)
end,
Mission = function( unit )
local status = "Unkown unit activity"
if unit then
local buildID = unit:GetBuildType()
if buildID ~= -1 then -- this is a worker who is actively building something
status = ( GameInfo.Builds[ buildID ]._Name or "???" ).. " (".. GetUnitBuildProgressData( unit:GetPlot(), buildID, unit ) ..")"
elseif unit:IsEmbarked() then
status = L"TXT_KEY_MISSION_EMBARK_HELP" --"TXT_KEY_UNIT_STATUS_EMBARKED"
elseif unit:IsAutomated() then
if unit:IsWork() then
status = L"TXT_KEY_ACTION_AUTOMATE_BUILD"
elseif unit.IsTrade and unit:IsTrade() then
status = L"TXT_KEY_ACTION_AUTOMATE_TRADE"
else
status = L"TXT_KEY_ACTION_AUTOMATE_EXPLORE"
end
else
local activityType = unit:GetActivityType()
local info = g_activityMissions[ activityType ]
if not info then
if unit:MovesLeft() > 0 then
if info == false then
info = GameInfo.Missions.MISSION_SKIP
elseif unit:IsGarrisoned() then
info = GameInfo.Missions.MISSION_GARRISON
elseif unit:IsEverFortifyable() then
-- info = GameInfo.Missions.MISSION_FORTIFY
status = format( "%s %+i%%[ICON_STRENGTH]", L"TXT_KEY_UNIT_STATUS_FORTIFIED", unit:FortifyModifier() )
else
info = GameInfo.Missions.MISSION_SLEEP
end
else
info = GameInfo.Missions.MISSION_MOVE_TO
end
end
if info then
status = L(info.Help)
end
end
else
status = "Error - cannot find unit"
end
return ShowTextToolTip( status )
end,
}
LuaEvents.UnitToolTips.Add( function( ... ) return TooltipSelect( UnitToolTips, ... ) end )
end
--==========================================================
-- Unit Type Tooltip
--==========================================================
LuaEvents.UnitPanelItemTooltip.Add( function( control, itemID )
return ShowTextToolTipAndPicture( GetHelpTextForUnit( itemID, true ), GetUnitPortraitIcon( itemID, GetActivePlayer() ) )
end)
--==========================================================
-- City Banner & Ribbon Tooltips
--==========================================================
local function CityIsCapital( city )
local ownerID = city:GetOwner()
local owner = Players[ ownerID ]
local originalOwnerID = city:GetOriginalOwner()
local originalOwner = Players[ originalOwnerID ]
local activePlayerID = GetActivePlayer()
local cityNameKey = city:GetNameKey()
if city:IsOriginalCapital() then
if ownerID == originalOwnerID then
if ownerID == activePlayerID then
return L( "TXT_KEY_VP_DIPLO_TT_YOU_CONTROL_YOUR_CAPITAL", cityNameKey )
else
return L( "TXT_KEY_VP_DIPLO_TT_SOMEONE_CONTROLS_THEIR_CAPITAL", owner:GetName(), cityNameKey )
end
end
else
for playerID, player in pairs( Players ) do
for city in player:Cities() do
if city:IsOriginalCapital() and city:GetOriginalOwner() == originalOwnerID then
cityNameKey = city:GetNameKey()
ownerID = playerID
owner = player
player = nil
break
end
end
if not player then
break
end
end
end
if ownerID == activePlayerID then
return L( "TXT_KEY_VP_DIPLO_TT_YOU_CONTROL_OTHER_PLAYER_CAPITAL", cityNameKey, originalOwner:GetCivilizationShortDescriptionKey() )
elseif originalOwnerID == activePlayerID then
return L( "TXT_KEY_VP_DIPLO_TT_OTHER_PLAYER_CONTROLS_YOUR_CAPITAL", owner:GetName(), cityNameKey )
else
return L( "TXT_KEY_VP_DIPLO_TT_OTHER_PLAYER_CONTROLS_OTHER_PLAYER_CAPITAL", owner:GetName(), cityNameKey, originalOwner:GetCivilizationShortDescriptionKey() )
end
end
local function CityProduction( city )
local tip, iconIndex, iconAtlas
local orderID, itemID = city:GetOrderFromQueue()
local isProducing = true
if orderID == ORDER_TRAIN then
iconIndex, iconAtlas = GetUnitPortraitIcon( itemID, city:GetOwner() )
tip = GetHelpTextForUnit( itemID, true )
elseif orderID == ORDER_CONSTRUCT then
iconIndex, iconAtlas = GetItemPortraitIcon( GameInfo.Buildings, itemID )
tip = GetHelpTextForBuilding( itemID, false, false, city:GetNumFreeBuilding(itemID) > 0, city )
elseif orderID == ORDER_CREATE then
iconIndex, iconAtlas = GetItemPortraitIcon( GameInfo.Projects, itemID )
tip = GetHelpTextForProject( itemID, true )
elseif orderID == ORDER_MAINTAIN then
iconIndex, iconAtlas = GetItemPortraitIcon( GameInfo.Processes, itemID )
tip = GetHelpTextForProcess( itemID, true )
isProducing = false
-- if tip and city:GetOrderQueueLength() > 0 then
else
tip = L( "TXT_KEY_CITY_NOT_PRODUCING", city:GetName() )
isProducing = false
end
local change = city:GetCurrentProductionDifferenceTimes100( false, false ) -- bIgnoreFood, bool bOverflow
return ShowProgressToolTip( g_CityProductionTooltipControls, 256, iconIndex, iconAtlas, tip,
isProducing and city:GetProductionTurnsLeft(),
city:GetProductionNeeded() * 100,
city:GetProductionTimes100() + city:GetCurrentProductionDifferenceTimes100( false, true ) - change, -- bIgnoreFood, bool bOverflow
change )
end
local CityToolTips = {
-- CityBanner ToolTip
CityBannerButton = function( city )
local cityOwnerID = city:GetOwner()
local cityOwner = Players[ cityOwnerID ]
local cityTeamID = city:GetTeam()
local activeTeamID = GetActiveTeam()
local activeTeam = Teams[ activeTeamID ]
local tip = ""
-- city resources
local resources = {}
for plot in CityPlots( city ) do
if plot and plot:IsRevealed( activeTeamID, true )
then
local resourceID = plot:GetResourceType( activeTeamID )
local numResource = plot:GetNumResource()
if numResource > 0 then
if not plot:IsCity() and (plot:IsImprovementPillaged() or not plot:IsResourceConnectedByImprovement( plot:GetImprovementType() )) then
numResource = numResource / 65536
end
resources[ resourceID ] = ( resources[ resourceID ] or 0 ) + numResource
end
end
end
for resourceID, numResource in pairs( resources ) do
local resource = GameInfo.Resources[ resourceID ]
if resource then
local numConnected, numNotConnected = modf( numResource )
numNotConnected = numNotConnected * 65536
local usageID = GetResourceUsageType( resourceID )
if usageID == RESOURCEUSAGE_STRATEGIC
or usageID == RESOURCEUSAGE_LUXURY
then
if numConnected > 0 then
tip = tip .. " [COLOR_POSITIVE_TEXT]" .. numConnected .. "[ENDCOLOR]" .. resource.IconString
end
if numNotConnected > 0 then
tip = tip .. " [COLOR_WARNING_TEXT]" .. numNotConnected .. "[ENDCOLOR]" .. resource.IconString
end
end
end
end
if cityTeamID == activeTeamID then
local cultureStored = city:GetJONSCultureStored()
local cultureNeeded = city:GetJONSCultureThreshold()
local culturePerTurn = city:GetJONSCulturePerTurn()
if culturePerTurn > 0 then
tip = tip .. "[NEWLINE][COLOR_MAGENTA]" .. L("TXT_KEY_CITYVIEW_TURNS_TILL_TILE_TEXT", max(ceil((cultureNeeded - cultureStored ) / culturePerTurn), 1) ) .. "[ENDCOLOR]"
else
tip = tip .. " 0 [ICON_CULTURE]"
end
if city.GetReligiousMajority and city:GetReligiousMajority() < 0 then
local religionTip = GetReligionTooltip( city )
if religionTip and religionTip>"" then
tip = tip .. "[NEWLINE]" .. religionTip
end
end
if g_isBasicHelp then
if cityOwnerID == GetActivePlayer() then
tip = tip .. "[NEWLINE]" .. L"TXT_KEY_CITY_ENTER_CITY_SCREEN"
else
tip = tip .. "[NEWLINE]" .. L"TXT_KEY_CITY_TEAMMATE"
end
end
elseif activeTeam:IsHasMet( cityTeamID ) then
if city.GetReligiousMajority and city:GetReligiousMajority() < 0 then
local religionTip = GetReligionTooltip( city )
if religionTip and religionTip>"" then
tip = tip .. "[NEWLINE]" .. religionTip
end
end
if cityOwner.GetWarmongerPreviewString and activeTeam:IsAtWar( cityTeamID ) then
tip = tip .. "[NEWLINE]"----------------[NEWLINE]"
.. cityOwner:GetWarmongerPreviewString(city:GetOwner())
if city:GetOriginalOwner() ~= city:GetOwner() then
tip = tip .. "[NEWLINE]"----------------[NEWLINE]"
.. cityOwner:GetLiberationPreviewString(city:GetOriginalOwner())
end
elseif g_isAlwaysWar then
tip = tip .. "[NEWLINE]" .. L"TXT_KEY_ALWAYS_AT_WAR_WITH_CITY"
end
end
return tip
end,
CityBannerRightBackground = function( city )
local tip = ""
local cityOwnerID = city and city:GetOwner()
local cityOwner = Players[ cityOwnerID ]
local activeTeam = Teams[ GetActiveTeam() ]
if cityOwner then
if activeTeam and activeTeam:IsHasMet( cityOwner:GetTeam() ) then
if cityOwner:IsMinorCiv() then
tip = GetCityStateStatusToolTip( GetActivePlayer(), cityOwnerID, true )
else
tip = GetMoodInfo( cityOwnerID, true )
end
if g_isBasicHelp then
tip = L"TXT_KEY_TALK_TO_PLAYER" .. "[NEWLINE][NEWLINE]" .. tip
end
else
-- Players we have not met
tip = L"TXT_KEY_HAVENT_MET"
end
end
return tip
end,
BuildGrowth = function( city )
return ShowTextToolTip( L( "TXT_KEY_CITY_CURRENTLY_PRODUCING_TT", city:GetName(), city:GetProductionNameKey(), city:GetProductionTurnsLeft() ), GetProductionTooltip( city ) )
end,
CityGrowth = function( city )
local tip
local foodPerTurnTimes100 = city:FoodDifferenceTimes100()
if foodPerTurnTimes100 < 0 then
tip = L( "TXT_KEY_NTFN_CITY_STARVING", city:GetName() )
elseif city:IsForcedAvoidGrowth() then
tip = L"TXT_KEY_CITYVIEW_FOCUS_AVOID_GROWTH_TEXT"
elseif city:IsFoodProduction() or foodPerTurnTimes100 == 0 then
tip = L"TXT_KEY_CITYVIEW_STAGNATION_TEXT"
else
tip = L( "TXT_KEY_CITYVIEW_TURNS_TILL_CITIZEN_TEXT", city:GetFoodTurnsLeft() )
end
return ShowTextToolTip( tip, GetFoodTooltip( city ) )
end,
BorderGrowth = function( city )
return ShowTextToolTip( city:GetName(),
L("TXT_KEY_CITYVIEW_TURNS_TILL_TILE_TEXT", ceil( (city:GetJONSCultureThreshold() - city:GetJONSCultureStored()) / city:GetJONSCulturePerTurn() ) ),
GetCultureTooltip( city ) )
end,
CityReligion = function( city )
return GetReligionTooltip( city )
end,
CityFocus = function( city )
return city and g_cityFocusTooltips[city:GetFocusType()]
end,
CityQuests = function( city )
local cityOwnerID = city:GetOwner()
local cityOwner = Players[ cityOwnerID ]
local activePlayerID = GetActivePlayer()
local tip
if cityOwner and cityOwner:IsMinorCiv() then
tip = GetActiveQuestToolTip( activePlayerID, cityOwnerID )
else
-- We love the king
local resource = GameInfo.Resources[ city:GetResourceDemanded() ]
local weLoveTheKingDayCounter = city:GetWeLoveTheKingDayCounter()
if weLoveTheKingDayCounter > 0 then
tip = L( "TXT_KEY_CITYVIEW_WLTKD_COUNTER", weLoveTheKingDayCounter )
elseif resource then
return ShowResourceToolTip( resource.ID, { L( "TXT_KEY_CITYVIEW_RESOURCE_DEMANDED", resource.IconString .. " " .. resource._Name ) } )
end
end
return tip
end,
CityIsPuppet = function( city )
local cityOwnerID = city:GetOwner()
local cityOwner = Players[ cityOwnerID ]
if cityOwner.MayNotAnnex and cityOwner:MayNotAnnex() or cityOwnerID ~= GetActivePlayer() then
return L"TXT_KEY_CITY_PUPPET"
else
return L"TXT_KEY_CITY_PUPPET".."[NEWLINE][NEWLINE]"..L"TXT_KEY_CITY_ANNEX_TT"
end
end,
CityIsRazing = function( city )
return L( "TXT_KEY_CITY_BURNING", city:GetRazingTurns() )
end,
CityIsResistance = function( city )
return L( "TXT_KEY_CITY_RESISTANCE", city:GetResistanceTurns() )
end,
CityIsConnected = function( city )
local tip = L"TXT_KEY_CITY_CONNECTED"
local cityOwner = Players[ city:GetOwner() ]
if cityOwner then
tip = format("%s (%+g[ICON_GOLD])", tip, (cityOwner.GetRouteGoldTimes100 or cityOwner.GetCityConnectionRouteGoldTimes100)( cityOwner, city ) / 100 )
end
return tip
end,
CityIsBlockaded = function()
return L"TXT_KEY_CITY_BLOCKADED"
end,
CityIsOccupied = function()
return L"TXT_KEY_CITY_OCCUPIED"
end,
CityIsCapital = CityIsCapital,
CityIsOriginalCapital = CityIsCapital,
CivIndicator = function( city )
local cityOwnerID = city:GetOwner()
local originalCityOwnerID = city:GetOriginalOwner()
if cityOwnerID == originalCityOwnerID then
return GetAllyToolTip( GetActivePlayer(), cityOwnerID )
else
return L( "TXT_KEY_POPUP_CITY_CAPTURE_INFO_LIBERATE", Players[originalCityOwnerID]:GetCivilizationShortDescription() )
end
end,
CityProductionBG = CityProduction,
Button = CityProduction,
CityPopulation = function( city )
local foodStored100 = city:GetFoodTimes100()
local foodPerTurn100 = city:FoodDifferenceTimes100( true )
local turnsToCityGrowth = city:GetFoodTurnsLeft()
local iconIndex = 0
if foodPerTurn100 < 0 then
turnsToCityGrowth = floor( foodStored100 / -foodPerTurn100 ) + 1
iconIndex = 5
end
return ShowProgressToolTip( g_CityGrowthTooltipControls, 256, iconIndex, "CITIZEN_ATLAS",
city:GetPopulation(),
turnsToCityGrowth,
city:GrowthThreshold() * 100,
foodStored100,
foodPerTurn100
)
end,
}
LuaEvents.CityToolTips.Add( function( control, city )
local toolTip = city and TooltipSelect( CityToolTips, control, city )
return toolTip and ShowTextToolTip( city:GetName(), toolTip )
end)
--==========================================================
-- City View Tooltips
--==========================================================
LuaEvents.CityViewBuildingToolTip.Add( function( control )
local buildingID = control:GetVoid1()
local building = GameInfo.Buildings[ buildingID ]
local city = GetHeadSelectedCity()
return ShowTextToolTipAndPicture( city and GetHelpTextForBuilding( buildingID, false, false, city:GetNumFreeBuilding(buildingID) > 0, city ), building and building.PortraitIndex, building and building.IconAtlas )
end)
local function CityOrderItemTooltip( city, isDisabled, purchaseYieldID, orderID, itemID, _, isRepeat )
local itemInfo, tip, strDisabledInfo, iconIndex, iconAtlas, isRealRepeat
if city then
local cityOwnerID = city:GetOwner()
if orderID == ORDER_TRAIN then
itemInfo = GameInfo.Units
iconIndex, iconAtlas = GetUnitPortraitIcon( itemID, cityOwnerID )
tip = GetHelpTextForUnit( itemID, true )
isRealRepeat = isRepeat
if isDisabled then
if purchaseYieldID == g_yieldCurrency then
strDisabledInfo = city:GetPurchaseUnitTooltip(itemID)
elseif purchaseYieldID == YieldTypes.YIELD_FAITH then
strDisabledInfo = city:GetFaithPurchaseUnitTooltip(itemID)
else
strDisabledInfo = city:CanTrainTooltip(itemID)
end
end
elseif orderID == ORDER_CONSTRUCT then
itemInfo = GameInfo.Buildings
tip = GetHelpTextForBuilding( itemID, false, false, city:GetNumFreeBuilding(itemID) > 0, city )
if isDisabled then
if purchaseYieldID == g_yieldCurrency then
-- cash = cityOwner:GetGold() - city:GetBuildingPurchaseCost(itemID)
-- icon = g_currencyIcon
strDisabledInfo = city:GetPurchaseBuildingTooltip(itemID)
elseif purchaseYieldID == YieldTypes.YIELD_FAITH then
-- cash = cityOwner:GetFaith() - city:GetBuildingFaithPurchaseCost(itemID)
-- icon = "[ICON_PEACE]"
strDisabledInfo = city:GetFaithPurchaseBuildingTooltip(itemID)
else
strDisabledInfo = city:CanConstructTooltip(itemID)
end
end
elseif orderID == ORDER_CREATE then
itemInfo = GameInfo.Projects
tip = GetHelpTextForProject( itemID, true )
elseif orderID == ORDER_MAINTAIN then
itemInfo = GameInfo.Processes
tip = GetHelpTextForProcess( itemID, true )
isRealRepeat = true
else
tip = L"TXT_KEY_PRODUCTION_NO_PRODUCTION"
end
if tip then
if isRealRepeat then
tip = "[ICON_TURNS_REMAINING]" .. tip
end
if strDisabledInfo and #strDisabledInfo > 0 then
strDisabledInfo = (strDisabledInfo:gsub("^%[NEWLINE%]","")):gsub("^%[NEWLINE%]","")
-- if cash and cash < 0 then
-- strDisabledInfo = ("%s (%+i%s)"):format( strDisabledInfo, cash, icon )
-- end
tip = "[COLOR_WARNING_TEXT]" .. strDisabledInfo .. "[ENDCOLOR][NEWLINE][NEWLINE]"..tip
elseif purchaseYieldID then
if not isDisabled then
tip = "[COLOR_YELLOW]"..L"TXT_KEY_CITYVIEW_PURCHASE_TT".."[ENDCOLOR][NEWLINE][NEWLINE]"..tip
end
elseif isDisabled then
tip = "[COLOR_YIELD_FOOD]"..L"TXT_KEY_CITYVIEW_QUEUE_PROD_TT".."[ENDCOLOR][NEWLINE][NEWLINE]"..tip
end
end
local item = itemInfo and itemInfo[itemID]
return ShowTextToolTipAndPicture( tip, iconIndex or (item and item.PortraitIndex), iconAtlas or (item and item.IconAtlas) )
end
return ShowTextToolTip( "Unknown city" )
end
LuaEvents.CityOrderItemTooltip.Add( CityOrderItemTooltip )
local CityViewToolTips = {
ProdBox = GetProductionTooltip,
FoodBox = GetFoodTooltip,
PopulationBox = GetFoodTooltip,
GoldBox = GetGoldTooltip,
ScienceBox = GetScienceTooltip,
CultureBox = GetCultureTooltip,
FaithBox = GetFaithTooltip,
TourismBox = GetTourismTooltip,
ProductionPortraitButton = function() CityOrderItemTooltip( GetHeadSelectedCity(), false, false, GetHeadSelectedCity():GetOrderFromQueue( 0 ) ) end,
}
LuaEvents.CityViewToolTips.Add( function( control )
local city = GetHeadSelectedCity()
local toolTip = city and TooltipSelect( CityViewToolTips, control, city )
return toolTip and ShowTextToolTip( toolTip )
end)
--==========================================================
-- Tech Tooltips
--==========================================================
LuaEvents.TechButtonTooltip.Add( function( orderID, itemID )
local tip = "no tip found"
local item, iconIndex, iconAtlas
if orderID == ORDER_TRAIN then
iconIndex, iconAtlas = GetUnitPortraitIcon( itemID, GetActivePlayer() )
tip = GetHelpTextForUnit( itemID, true )
elseif orderID == ORDER_CONSTRUCT then
iconIndex, iconAtlas = GetItemPortraitIcon( GameInfo.Buildings, itemID )
tip = GetHelpTextForBuilding( itemID )
elseif orderID == ORDER_CREATE then
iconIndex, iconAtlas = GetItemPortraitIcon( GameInfo.Projects, itemID )
tip = GetHelpTextForProject( itemID, true )
elseif orderID == ORDER_MAINTAIN then
iconIndex, iconAtlas = GetItemPortraitIcon( GameInfo.Processes, itemID )
tip = GetHelpTextForProcess( itemID, true )
elseif orderID == 11 then
iconIndex, iconAtlas = GetItemPortraitIcon( GameInfo.Resources, itemID )
tip = L("TXT_KEY_REVEALS_RESOURCE_ON_MAP", GameInfo.Resources[itemID]._Name)
elseif orderID == 12 then
local build = GameInfo.Builds[ itemID ]
if build then
tip = build._Name
item = GameInfo.Improvements[ build.ImprovementType ]
if item then
tip = GetHelpTextForImprovement( item.ID )
else
item = GameInfo.Routes[ build.RouteType ]
if not item then
item = GameInfo.BuildFeatures{ BuildType = build.Type }()
item = item and GameInfo.Features[ item.FeatureType ]
end
end
if item then
iconIndex, iconAtlas = item.PortraitIndex, item.IconAtlas
end
end
elseif orderID == 13 then
item = GameInfo.Missions[ itemID ]
if item then
local entry = item.Type
if entry == "MISSION_EMBARK" then
item = GameInfo.Concepts.CONCEPT_MOVEMENT_EMBARKING
elseif entry == "MISSION_ROUTE_TO" then
item = GameInfo.Concepts.CONCEPT_WORKERS_ROADS_TRADE_ROUTES
elseif entry == "MISSION_ESTABLISH_TRADE_ROUTE" then
item = GameInfo.Concepts.CONCEPT_TRADE_ROUTES
end
if item then
tip = item._Name
end
end
elseif orderID == 14 then
item = GameInfo.Terraform[ itemID ]
if item then
local entry = item.Type
if entry == "TERRAFORM_ADD_MIASMA" then
item = GameInfo.Concepts.CONCEPT_WORKERS_PLACE
elseif entry == "TERRAFORM_CLEAR_MIASMA" then
item = GameInfo.Concepts.CONCEPT_WORKERS_REMOVE
else
item = GameInfo.Features[ item.FeatureTypeChange ] or GameInfo.Terrains[ item.TerrainTypeChange ]
end
if item then
tip = item._Name
end
end
elseif orderID == 15 then
tip = GetHelpTextForPlayerPerk( itemID, true )
end
return ShowTextToolTipAndPicture( tip, iconIndex, iconAtlas )
-- return ShowTextToolTipAndPicture( "This is button tooltip for order "..orderID.." item "..itemID.." icon "..tostring(iconIndex)..":"..tostring(iconAtlas).."[NEWLINE]"..tip, iconIndex, iconAtlas )
end)
LuaEvents.TechTooltip.Add( function( techID )
return ShowTextToolTipAndPicture( GetHelpTextForTech( techID, Players[ GetActivePlayer() ]:CanResearch( techID ) ), GetItemPortraitIcon( GameInfo.Technologies, techID ) )
end)
--==========================================================
-- Policy Tooltips
--==========================================================
LuaEvents.PolicyTooltip.Add( function( control )
local policyID = control:GetVoid1()
local policyInfo = GameInfo.Policies[ policyID ]
local player = Players[ GetActivePlayer() ]
if policyInfo and player then
-- Tooltip
local tip = L( policyInfo.Help )
-- Player already has Policy
if player:HasPolicy( policyID ) then
if player:IsPolicyBlocked( policyID ) then
tip = tip .. "[NEWLINE][NEWLINE]" .. L("TXT_KEY_POLICY_BRANCH_BLOCKED")
end
-- Can adopt the Policy right now
elseif player:CanAdoptPolicy( policyID ) then
-- Policy is unlocked, but we lack culture
elseif player:CanAdoptPolicy( policyID, true ) then
-- Tooltip
tip = tip .. "[NEWLINE][NEWLINE]" .. L("TXT_KEY_POLICY_BRANCH_CANNOT_UNLOCK_CULTURE", player:GetNextPolicyCost())
else
-- Tooltip
tip = tip .. "[NEWLINE][NEWLINE]" .. L("TXT_KEY_POLICY_CANNOT_UNLOCK")
end
return ShowTextToolTipAndPicture( tip, policyInfo.PortraitIndex, policyInfo.IconAtlas )
end
end)
LuaEvents.PolicyBranchTooltip.Add( function( control )
local policyBranchID = control:GetVoid1()
local policyBranchInfo = GameInfo.PolicyBranchTypes[ policyBranchID ]
local player = Players[ GetActivePlayer() ]
if policyBranchInfo and player then
local tip = L( policyBranchInfo.Help )
-- Branch is unlocked
if player:IsPolicyBranchUnlocked( policyBranchID ) then
-- Branch is blocked by another branch
if player:IsPolicyBranchBlocked( policyBranchID ) then
tip = tip .. "[NEWLINE][NEWLINE]" .. L("TXT_KEY_POLICY_BRANCH_BLOCKED")
end
-- Cannot adopt this branch right now
elseif policyBranchInfo.LockedWithoutReligion and not g_isReligionEnabled then
tip = tip .. "[NEWLINE][NEWLINE]" .. L("TXT_KEY_POLICY_BRANCH_CANNOT_UNLOCK_RELIGION");
-- Can adopt this branch right now
elseif player:CanUnlockPolicyBranch( policyBranchID ) then
tip = tip .. "[NEWLINE][NEWLINE]" .. L("TXT_KEY_POLICY_BRANCH_UNLOCK_SPEND", player:GetNextPolicyCost())
-- Branch is not yet unlocked
else
tip = tip .. "[NEWLINE][NEWLINE]" .. L("TXT_KEY_POLICY_BRANCH_CANNOT_UNLOCK")
local eraPrereq = GameInfoTypes[ policyBranchInfo.EraPrereq ]
-- Not in prereq Era
if eraPrereq and Teams[player:GetTeam()]:GetCurrentEra() < eraPrereq then
tip = tip .. " " .. L("TXT_KEY_POLICY_BRANCH_CANNOT_UNLOCK_ERA", GameInfo.Eras[eraPrereq].Description)
-- Don't have enough Culture Yet
else
tip = tip .. " " .. L("TXT_KEY_POLICY_BRANCH_CANNOT_UNLOCK_CULTURE", player:GetNextPolicyCost())
end
end
return ShowTextToolTip( tip )
end
end)
LuaEvents.TenetToolTip.Add( function ( control )
local player = Players[ GetActivePlayer() ]
local tip = "???"
if player then
local tenetID = control:GetVoid1()
local tenetLevel = control:GetVoid2()
local tenetInfo = GameInfo.Policies[ tenetID ]
if tenetInfo then
tip = L( tenetInfo.Help )
else
if tenetID == -1 then
tip = L"TXT_KEY_POLICYSCREEN_ADD_TENET"
elseif tenetID == -2 then
tip = L( "TXT_KEY_POLICY_BRANCH_CANNOT_UNLOCK_CULTURE", player:GetNextPolicyCost() )
elseif tenetID == -3 then
tip = "[ICON_LOCKED]" .. L( "TXT_KEY_POLICYSCREEN_NEED_L"..(tenetLevel-1).."_TENETS_TOOLTIP" )
elseif tenetID == -4 then
tip = "[ICON_LOCKED][COLOR_WARNING_TEXT]" .. L( "TXT_KEY_POLICYSCREEN_IDEOLOGY_LEVEL"..tenetLevel ) .. "[ENDCOLOR]"
end
local tips = { tip }
for _,tenetID in ipairs( player:GetAvailableTenets( tenetLevel ) ) do
tenetInfo = GameInfo.Policies[ tenetID ]
if tenetInfo then
insert( tips, L(tenetInfo.Help or tenetInfo.Description or "???") )
end
end
tip = concat( tips, "[NEWLINE][NEWLINE]" )
end
end
return ShowTextToolTip( tip )
end)
--==========================================================
-- TopPanel Tooltips
--==========================================================
local function ScienceTooltip()
local tips = {}
local tech, sciencePerTurn, researchTurnsLeft, researchCost, researchProgress, reseachLost
if g_isScienceEnabled then
local activePlayerID = GetActivePlayer()
local activeTeamID = GetActiveTeam()
local activePlayer = Players[activePlayerID]
local activeTeam = Teams[activeTeamID]
local activeTeamTechs = activeTeam:GetTeamTechs()
local sciencePerTurnTimes100 = activePlayer:GetScienceTimes100()
local techID = activePlayer:GetCurrentResearch()
local recentTechID = activeTeamTechs:GetLastTechAcquired()
if IsCiv5BNW and activePlayer:IsAnarchy() then
insert( tips, L( "TXT_KEY_TP_ANARCHY", activePlayer:GetAnarchyNumTurns() ) )
insert( tips, "" )
end
if techID ~= -1 then
-- Are we researching something right now?
tech = GameInfo.Technologies[ techID ]
researchTurnsLeft = activePlayer:GetResearchTurnsLeft( techID, true )
researchCost = activePlayer:GetResearchCost( techID )
researchProgress = activePlayer:GetResearchProgress( techID )
local tip = researchProgress .. "[ICON_RESEARCH]"
if tech then
tip = L( "TXT_KEY_PROGRESS_TOWARDS", g_scienceTextColor .. Locale.ToUpper( tech._Name ) .. "[ENDCOLOR]" ) .. " " .. tip .. "/ " .. researchCost .. "[ICON_RESEARCH]"
end
insert( tips, tip )
if sciencePerTurnTimes100 > 0 then
local scienceOverflowTimes100 = sciencePerTurnTimes100 * researchTurnsLeft + (researchProgress - researchCost) * 100
local tip = g_scienceTextColor .. Locale.ToUpper( L( "TXT_KEY_STR_TURNS", researchTurnsLeft ) ) .. "[ENDCOLOR] " .. format( "%+g", scienceOverflowTimes100 / 100 ) .. "[ICON_RESEARCH]"
if researchTurnsLeft > 1 then
tip = L( "TXT_KEY_STR_TURNS", researchTurnsLeft -1 ) .. " " .. format( "%+g", (scienceOverflowTimes100 - sciencePerTurnTimes100) / 100 ) .. "[ICON_RESEARCH] " .. tip
end
insert( tips, tip )
end
elseif recentTechID ~= -1 then
-- maybe we just finished something
tech = GameInfo.Technologies[ recentTechID ]
local tip = L"TXT_KEY_NOTIFICATION_SUMMARY_NEW_RESEARCH"
if tech then
tip = L"TXT_KEY_RESEARCH_FINISHED" .. " " .. g_scienceTextColor .. Locale.ToUpper( tech._Name ) .. "[ENDCOLOR], " .. tip
end
insert( tips, tip )
end
sciencePerTurn = sciencePerTurnTimes100 / 100
reseachLost = activePlayer:GetScienceFromBudgetDeficitTimes100() / 100
insert( tips, g_scienceTextColor )
insert( tips, format( "%+g", sciencePerTurn ) .. "[ENDCOLOR] " .. L"TXT_KEY_REPLAY_DATA_SCIENCEPERTURN" )
-- Science LOSS from Budget Deficits
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_FROM_BUDGET_DEFICIT", reseachLost )
-- Science from Cities
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_FROM_CITIES", activePlayer:GetScienceFromCitiesTimes100(true) / 100 )
-- Science from Trade Routes
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_FROM_ITR", ( activePlayer:GetScienceFromCitiesTimes100(false) - activePlayer:GetScienceFromCitiesTimes100(true) ) / 100 )
-- Science from Other Players
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_FROM_MINORS", activePlayer:GetScienceFromOtherPlayersTimes100() / 100 )
if IsCiv5 then
-- Science from Happiness
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_FROM_HAPPINESS", activePlayer:GetScienceFromHappinessTimes100() / 100 )
-- Science from Vassals / Compatibility with Putmalk's Civ IV Diplomacy Features Mod
if activePlayer.GetScienceFromVassalTimes100 then
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_VASSALS", activePlayer:GetScienceFromVassalTimes100() / 100 )
end
-- Compatibility with Gazebo's City-State Diplomacy Mod (CSD) for Brave New World v23
if activePlayer.GetScienceRateFromMinorAllies and activePlayer.GetScienceRateFromLeagueAid then
insertLocalizedIfNonZero( tips, "TXT_KEY_MINOR_SCIENCE_FROM_LEAGUE_ALLIES", activePlayer:GetScienceRateFromMinorAllies() )
insertLocalizedIfNonZero( tips, "TXT_KEY_SCIENCE_FUNDING_FROM_LEAGUE", activePlayer:GetScienceRateFromLeagueAid() )
end
-- Science from Research Agreements
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_FROM_RESEARCH_AGREEMENTS", activePlayer:GetScienceFromResearchAgreementsTimes100() / 100 )
-- Show Research Agreements
local itemType, duration, finalTurn, data1, data2, data3, flag1, fromPlayerID
local gameTurn = Game.GetGameTurn() - 1
local researchAgreementCounters = {}
PushScratchDeal()
for i = 0, UI.GetNumCurrentDeals( activePlayerID ) - 1 do
UI.LoadCurrentDeal( activePlayerID, i )
ScratchDeal:ResetIterator()
repeat
if IsCiv5BNW_BE then
itemType, duration, finalTurn, data1, data2, data3, flag1, fromPlayerID = ScratchDeal:GetNextItem()
else
itemType, duration, finalTurn, data1, data2, fromPlayerID = ScratchDeal:GetNextItem()
end
--local itemKey for k,v in pairs( TradeableItems ) do if itemType == v then itemKey = k break end end
--print( "Deal #", i, "item type", itemType, itemKey, "duration", duration, "finalTurn", finalTurn, "data1", data1, "data2", data2, "fromPlayerID", fromPlayerID)
if itemType == TradeableItems.TRADE_ITEM_RESEARCH_AGREEMENT and fromPlayerID ~= activePlayerID then
researchAgreementCounters[fromPlayerID] = finalTurn - gameTurn
break
end
until not itemType
end
PopScratchDeal()
local tipIndex = #tips
for playerID = 0, MAX_MAJOR_CIVS-1 do
local player = Players[playerID]
local teamID = player:GetTeam()
if playerID ~= activePlayerID and player:IsAlive() and activeTeam:IsHasMet(teamID) then
-- has reseach agreement ?
if activeTeam:IsHasResearchAgreement(teamID) then
insert( tips, "[ICON_BULLET][COLOR_POSITIVE_TEXT]" .. player:GetName() .. "[ENDCOLOR]" )
if researchAgreementCounters[playerID] then
append( tips, " " .. g_scienceTextColor .. Locale.ToUpper( L( "TXT_KEY_STR_TURNS", researchAgreementCounters[playerID] ) ) .. "[ENDCOLOR]" )
end
else
insert( tips, "[ICON_BULLET][COLOR_WARNING_TEXT]" .. player:GetName() .. "[ENDCOLOR]" )
end
end
end
if #tips > tipIndex then
insert( tips, tipIndex+1, "" )
insert( tips, tipIndex+2, L"TXT_KEY_DO_RESEARCH_AGREEMENT" )
end
else
-- Science from Health
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_FROM_HEALTH", activePlayer:GetScienceFromHealthTimes100() / 100 )
-- Science from Culture Rate
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_FROM_CULTURE", activePlayer:GetScienceFromCultureTimes100() / 100 )
-- Science from Diplomacy Rate
local scienceFromDiplomacy = activePlayer:GetScienceFromDiplomacyTimes100() / 100
if scienceFromDiplomacy > 0 then
insert( tips, L( "TXT_KEY_TP_SCIENCE_FROM_DIPLOMACY", scienceFromDiplomacy ) )
elseif scienceFromDiplomacy < 0 then
insert( tips, L( "TXT_KEY_TP_NEGATIVE_SCIENCE_FROM_DIPLOMACY", -scienceFromDiplomacy ) )
end
end
-- Let people know that building more cities makes techs harder to get
if IsCiv5BNW_BE and g_isBasicHelp then
insert( tips, "" )
insert( tips, L( "TXT_KEY_TP_TECH_CITY_COST", Game.GetNumCitiesTechCostMod() * ( 100 + ( IsCivBE and activePlayer:GetNumCitiesResearchCostDiscount() or 0 ) ) / 100 ) )
end
else
insert( tips, L"TXT_KEY_TOP_PANEL_SCIENCE_OFF" .. ": " .. L"TXT_KEY_TOP_PANEL_SCIENCE_OFF_TOOLTIP" )
end
ShowProgressToolTip( g_TechProgressToolTipControls, 256, tech and tech.PortraitIndex, tech and tech.IconAtlas,
concat( tips, "[NEWLINE]" ),
researchTurnsLeft,
researchCost,
researchProgress,
sciencePerTurn,
reseachLost )
end
-------------------------------------------------
-- Faith Tooltip (GK & BNW)
-------------------------------------------------
local function FaithTooltip()
if g_isReligionEnabled then
local activePlayerID = GetActivePlayer()
local activePlayer = Players[activePlayerID]
local tips = {}
local faithPerTurn = activePlayer:GetTotalFaithPerTurn()
if IsCiv5BNW_BE and activePlayer:IsAnarchy() then
insert( tips, L( "TXT_KEY_TP_ANARCHY", activePlayer:GetAnarchyNumTurns() ) )
insert( tips, "" )
end
insert( tips, L("TXT_KEY_TP_FAITH_ACCUMULATED", activePlayer:GetFaith()) )
insert( tips, "" )
insert( tips, "[COLOR_WHITE]" .. format("%+g", faithPerTurn ) .. "[ENDCOLOR] "
.. L"TXT_KEY_YIELD_FAITH" .. "[ICON_PEACE] " .. L"TXT_KEY_GOLD_PERTURN_HEADING4_TITLE" )
-- Faith from Cities
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_FAITH_FROM_CITIES", activePlayer:GetFaithPerTurnFromCities() )
-- Faith from Outposts
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_FAITH_FROM_OUTPOSTS", IsCivBE and activePlayer:GetFaithPerTurnFromOutposts() or 0 )
-- Faith from Minor Civs
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_FAITH_FROM_MINORS", activePlayer:GetFaithPerTurnFromMinorCivs() )
-- Faith from Religion
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_FAITH_FROM_RELIGION", activePlayer:GetFaithPerTurnFromReligion() )
-- New World Deluxe Scenario ( you still need to delete TopPanel.lua from ...\Steam\SteamApps\common\sid meier's civilization v\assets\DLC\DLC_07\Scenarios\Conquest of the New World Deluxe\UI )
if IsNewWorldDeluxeScenario then -- global defined by EUI_context
insert( tips, L"TXT_KEY_NEWWORLD_SCENARIO_TP_RELIGION_TOOLTIP" )
else
if activePlayer:HasCreatedPantheon() then
if (Game.GetNumReligionsStillToFound() > 0 or activePlayer:HasCreatedReligion())
and (activePlayer:GetCurrentEra() < GameInfoTypes.ERA_INDUSTRIAL)
then
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_FAITH_NEXT_PROPHET", activePlayer:GetMinimumFaithNextGreatProphet() )
end
else
if activePlayer:CanCreatePantheon(false) then
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_FAITH_NEXT_PANTHEON", Game.GetMinimumFaithNextPantheon() )
else
insert( tips, L"TXT_KEY_TP_FAITH_PANTHEONS_LOCKED" )
end
end
insert( tips, "" )
insert( tips, L( "TXT_KEY_TP_FAITH_RELIGIONS_LEFT", max( Game.GetNumReligionsStillToFound(), 0 ) ) )
if activePlayer:GetCurrentEra() >= GameInfoTypes.ERA_INDUSTRIAL then
insert( tips, "" )
insert( tips, L( "TXT_KEY_TP_FAITH_NEXT_GREAT_PERSON", activePlayer:GetMinimumFaithNextGreatProphet() ) )
local numTips = #tips
local capitalCity = activePlayer:GetCapitalCity()
if capitalCity then
for unit in GameInfo.Units{Special = "SPECIALUNIT_PEOPLE"} do
local unitID = unit.ID
if capitalCity:GetUnitFaithPurchaseCost(unitID, true) > 0
and activePlayer:IsCanPurchaseAnyCity(false, true, unitID, -1, YieldTypes.YIELD_FAITH)
and activePlayer:DoesUnitPassFaithPurchaseCheck(unitID)
then
insert( tips, "[ICON_BULLET]" .. unit._Name )
end
end
end
if numTips == #tips then
insert( tips, "[ICON_BULLET]" .. L"TXT_KEY_RO_YR_NO_GREAT_PEOPLE" )
end
end
end
return concat( tips, "[NEWLINE]" )
else
return L"TXT_KEY_TOP_PANEL_RELIGION_OFF_TOOLTIP" --TXT_KEY_TOP_PANEL_RELIGION_OFF
end
end
local TopPanelTooltips = {
SciencePerTurn = ScienceTooltip,
TechIcon = ScienceTooltip,
GoldPerTurn = function()
local activePlayerID = GetActivePlayer()
local activeTeamID = GetActiveTeam()
local activePlayer = Players[activePlayerID]
local activeTeam = Teams[activeTeamID]
local tips = {}
local goldPerTurnFromDiplomacy = activePlayer:GetGoldPerTurnFromDiplomacy()
local goldPerTurnFromOtherPlayers = max(0,goldPerTurnFromDiplomacy) * 100
local goldPerTurnToOtherPlayers = -min(0,goldPerTurnFromDiplomacy)
local goldPerTurnFromReligion = IsCiv5notVanilla and activePlayer:GetGoldPerTurnFromReligion() * 100 or 0
local goldPerTurnFromCities = activePlayer:GetGoldFromCitiesTimes100()
local cityConnectionGold = activePlayer:GetCityConnectionGoldTimes100()
local playerTraitGold = 0
local tradeRouteGold = 0
local goldPerTurnFromPolicies = 0
local unitCost = activePlayer:CalculateUnitCost()
local unitSupply = activePlayer:CalculateUnitSupply()
local buildingMaintenance = activePlayer:GetBuildingGoldMaintenance()
local improvementMaintenance = activePlayer:GetImprovementGoldMaintenance()
local vassalMaintenance = activePlayer.GetVassalGoldMaintenance and activePlayer:GetVassalGoldMaintenance() or 0 -- Compatibility with Putmalk's Civ IV Diplomacy Features Mod
local routeMaintenance = 0
local beaconEnergyDelta = 0
if IsCiv5BNW_BE then
tradeRouteGold = activePlayer:GetGoldFromCitiesMinusTradeRoutesTimes100()
goldPerTurnFromCities, tradeRouteGold = tradeRouteGold, goldPerTurnFromCities - tradeRouteGold
playerTraitGold = activePlayer:GetGoldPerTurnFromTraits() * 100
if activePlayer:IsAnarchy() then
insert( tips, L("TXT_KEY_TP_ANARCHY", activePlayer:GetAnarchyNumTurns() ) )
insert( tips, "" )
end
end
-- Total gold
local totalIncome, totalWealth
local explicitIncome = goldPerTurnFromCities + goldPerTurnFromOtherPlayers + cityConnectionGold + goldPerTurnFromReligion + tradeRouteGold + playerTraitGold
if IsCiv5 then
totalWealth = activePlayer:GetGold()
totalIncome = explicitIncome
else
totalWealth = activePlayer:GetEnergy()
totalIncome = activePlayer:CalculateGrossGoldTimes100() + goldPerTurnToOtherPlayers * 100
goldPerTurnFromPolicies = activePlayer:GetGoldPerTurnFromPolicies()
explicitIncome = explicitIncome + goldPerTurnFromPolicies
routeMaintenance = activePlayer:GetRouteEnergyMaintenance()
beaconEnergyDelta = activePlayer:GetBeaconEnergyCostPerTurn()
end
insert( tips, L( "TXT_KEY_TP_AVAILABLE_GOLD", totalWealth ) )
local totalExpenses = unitCost + unitSupply + buildingMaintenance + improvementMaintenance + goldPerTurnToOtherPlayers + vassalMaintenance + routeMaintenance + beaconEnergyDelta
insert( tips, "" )
-- Gold per turn
insert( tips, format( "[COLOR_YELLOW]%+g[ENDCOLOR] ", activePlayer:CalculateGoldRateTimes100() / 100 ) .. L(format("TXT_KEY_REPLAY_DATA_%sPERTURN", g_currencyString)) )
-- Science LOSS from Budget Deficits
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_SCIENCE_FROM_BUDGET_DEFICIT", activePlayer:GetScienceFromBudgetDeficitTimes100() / 100 )
-- Income
insert( tips, "[COLOR_WHITE]" )
insert( tips, L("TXT_KEY_TP_TOTAL_INCOME", totalIncome / 100 ) )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_CITY_OUTPUT", goldPerTurnFromCities / 100 )
if IsCiv5BNW_BE then
insertLocalizedBulletIfNonZero( tips, format("TXT_KEY_TP_%s_FROM_CITY_CONNECTIONS", g_currencyString), cityConnectionGold / 100 )
insertLocalizedBulletIfNonZero( tips, IsCiv5 and "TXT_KEY_TP_GOLD_FROM_ITR" or "TXT_KEY_TP_ENERGY_FROM_TRADE_ROUTES", tradeRouteGold / 100 )
insertLocalizedBulletIfNonZero( tips, format("TXT_KEY_TP_%s_FROM_TRAITS", g_currencyString), playerTraitGold / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_ENERGY_FROM_POLICIES", goldPerTurnFromPolicies / 100 )
else
insertLocalizedBulletIfNonZero( tips, format("TXT_KEY_TP_%s_FROM_TR", g_currencyString), cityConnectionGold / 100 )
end
insertLocalizedBulletIfNonZero( tips, format("TXT_KEY_TP_%s_FROM_OTHERS", g_currencyString), goldPerTurnFromOtherPlayers / 100 )
insertLocalizedBulletIfNonZero( tips, format("TXT_KEY_TP_%s_FROM_RELIGION", g_currencyString), goldPerTurnFromReligion / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_YIELD_FROM_UNCATEGORIZED", (totalIncome - explicitIncome) / 100 )
insert( tips, "[ENDCOLOR]" )
-- Spending
insert( tips, "[COLOR:255:150:150:255]" .. L("TXT_KEY_TP_TOTAL_EXPENSES", totalExpenses ) )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNIT_MAINT", unitCost )
insertLocalizedBulletIfNonZero( tips, format("TXT_KEY_TP_%s_UNIT_SUPPLY", g_currencyString), unitSupply )
insertLocalizedBulletIfNonZero( tips, format("TXT_KEY_TP_%s_BUILDING_MAINT", g_currencyString), buildingMaintenance )
insertLocalizedBulletIfNonZero( tips, format("TXT_KEY_TP_%s_TILE_MAINT", g_currencyString), improvementMaintenance )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_ENERGY_ROUTE_MAINT", routeMaintenance )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_GOLD_VASSAL_MAINT", vassalMaintenance ) -- Compatibility with Putmalk's Civ IV Diplomacy Features Mod
insertLocalizedBulletIfNonZero( tips, format("TXT_KEY_TP_%s_TO_OTHERS", g_currencyString ), goldPerTurnToOtherPlayers )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_ENERGY_TO_BEACON", beaconEnergyDelta )
insert( tips, "[ENDCOLOR]" )
-- show gold available for trade to the active player
local tipIndex = #tips
for playerID = 0, MAX_MAJOR_CIVS-1 do
local player = Players[playerID]
-- Valid player? - Can't be us, has to be alive, and has to be met
if playerID ~= activePlayerID and player:IsAlive() and activeTeam:IsHasMet( player:GetTeam() ) then
insert( tips, "[ICON_BULLET]" .. player:GetName() .. format(" %i%s(%+i)",
ScratchDeal:GetGoldAvailable(playerID, -1), g_currencyIcon, player:CalculateGoldRate() ) )
end
end
if #tips > tipIndex then
insert( tips, tipIndex+1, "" )
insert( tips, tipIndex+2, L"TXT_KEY_EO_RESOURCES_AVAILBLE" )
end
-- Basic explanation
if g_isBasicHelp then
insert( tips, "" )
insert( tips, L( format("TXT_KEY_TP_%s_EXPLANATION", g_currencyString) ) )
end
return concat( tips, "[NEWLINE]" )
end,
GpIcon = function()
local gp = ScanGP( Players[ GetActivePlayer() ] )
if gp then
local icon = GreatPeopleIcons and GreatPeopleIcons[ gp.Class.Type ] or "[ICON_GREAT_PEOPLE]"
return L( "TXT_KEY_PROGRESS_TOWARDS", "[COLOR_YIELD_FOOD]" .. Locale.ToUpper( gp.Class._Name ) .. "[ENDCOLOR]" )
.. " " .. gp.Progress .. icon .. " / " .. gp.Threshold .. icon .. "[NEWLINE]"
.. gp.City:GetName() .. format( " %+g", gp.Change ) .. icon .. " " .. L"TXT_KEY_GOLD_PERTURN_HEADING4_TITLE"
.. " [COLOR_YIELD_FOOD]" .. Locale.ToUpper( L( "TXT_KEY_STR_TURNS", gp.Turns ) ) .. "[ENDCOLOR]"
else
return "No Great Person found..."
end
end,
-------------------------------------------------
-- Happiness Tooltip
-------------------------------------------------
HappinessString = function()
if g_isHappinessEnabled then
local activePlayerID = GetActivePlayer()
local activeTeamID = GetActiveTeam()
local activePlayer = Players[activePlayerID]
local activeTeam = Teams[activeTeamID]
local tips = {}
local excessHappiness = activePlayer:GetExcessHappiness()
if not activePlayer:IsEmpireUnhappy() then
insert( tips, L("TXT_KEY_TP_TOTAL_HAPPINESS", excessHappiness) )
elseif activePlayer:IsEmpireVeryUnhappy() then
insert( tips, L("TXT_KEY_TP_TOTAL_UNHAPPINESS", "[ICON_HAPPINESS_4]", -excessHappiness) )
else
insert( tips, L("TXT_KEY_TP_TOTAL_UNHAPPINESS", "[ICON_HAPPINESS_3]", -excessHappiness) )
end
local policiesHappiness = activePlayer:GetHappinessFromPolicies()
local resourcesHappiness = activePlayer:GetHappinessFromResources()
local happinessFromExtraResources = activePlayer:GetHappinessFromResourceVariety()
local extraLuxuryHappiness = activePlayer:GetExtraHappinessPerLuxury()
local buildingHappiness = activePlayer:GetHappinessFromBuildings()
local cityHappiness = 0
local garrisonedUnitsHappiness = 0
local minorCivHappiness = 0
local religionHappiness = 0
if IsCiv5notVanilla then
cityHappiness = activePlayer:GetHappinessFromCities()
minorCivHappiness = activePlayer:GetHappinessFromMinorCivs()
religionHappiness = activePlayer:GetHappinessFromReligion()
else
garrisonedUnitsHappiness = activePlayer:GetHappinessFromGarrisonedUnits()
-- Loop through all the Minors the active player knows
for minorPlayerID = MAX_MAJOR_CIVS, MAX_CIV_PLAYERS_minus1 do
minorCivHappiness = minorCivHappiness + activePlayer:GetHappinessFromMinor(minorPlayerID)
end
end
local tradeRouteHappiness = activePlayer:GetHappinessFromTradeRoutes()
local naturalWonderHappiness = activePlayer:GetHappinessFromNaturalWonders()
local extraHappinessPerCity = activePlayer:GetExtraHappinessPerCity() * activePlayer:GetNumCities()
local leagueHappiness = IsCiv5BNW_BE and activePlayer:GetHappinessFromLeagues() or 0
local totalHappiness = activePlayer:GetHappiness()
local happinessFromVassals = activePlayer.GetHappinessFromVassals and activePlayer:GetHappinessFromVassals() or 0 -- Compatibility with Putmalk's Civ IV Diplomacy Features Mod
local handicapHappiness = totalHappiness - policiesHappiness - resourcesHappiness - cityHappiness - buildingHappiness - garrisonedUnitsHappiness - minorCivHappiness - tradeRouteHappiness - religionHappiness - naturalWonderHappiness - extraHappinessPerCity - leagueHappiness - happinessFromVassals -- Compatibility with Putmalk's Civ IV Diplomacy Features Mod
if activePlayer:IsEmpireVeryUnhappy() then
if activePlayer:IsEmpireSuperUnhappy() then
insert( tips, "[COLOR:255:60:60:255]" .. L"TXT_KEY_TP_EMPIRE_SUPER_UNHAPPY" .. "[ENDCOLOR]" )
else
insert( tips, "[COLOR:255:60:60:255]" .. L"TXT_KEY_TP_EMPIRE_VERY_UNHAPPY" .. "[ENDCOLOR]" )
end
elseif activePlayer:IsEmpireUnhappy() then
insert( tips, "[COLOR:255:60:60:255]" .. L"TXT_KEY_TP_EMPIRE_UNHAPPY" .. "[ENDCOLOR]" )
end
-- Basic explanation of Happiness
if g_isBasicHelp then
insert( tips, L"TXT_KEY_TP_HAPPINESS_EXPLANATION" )
insert( tips, "" )
end
-- Individual Resource Info
local baseHappinessFromResources = 0
local numHappinessResources = 0
local availableResources = ""
local missingResources = ""
local Resources = GameInfo.Resources
local luxuries = { ResourceUsage = RESOURCEUSAGE_LUXURY }
for resource in Resources( luxuries ) do
local resourceID = resource.ID
local numResourceAvailable = activePlayer:GetNumResourceAvailable(resource.ID, true)
if numResourceAvailable > 0 then
local resourceHappiness = IsCiv5notVanilla and activePlayer:GetHappinessFromLuxury( resourceID ) or resource.Happiness -- GetHappinessFromLuxury includes extra happiness
if resourceHappiness > 0 then
availableResources = availableResources
.. " [COLOR_POSITIVE_TEXT]"
.. numResourceAvailable
.. "[ENDCOLOR]"
.. resource.IconString
numHappinessResources = numHappinessResources + 1
baseHappinessFromResources = baseHappinessFromResources + resourceHappiness
end
elseif numResourceAvailable == 0 then
missingResources = missingResources .. resource.IconString
else
missingResources = missingResources
.. " [COLOR_WARNING_TEXT]"
.. numResourceAvailable
.. "[ENDCOLOR]"
.. resource.IconString
end
end
--------------
-- Unhappiness
local unhappinessFromPupetCities = activePlayer:GetUnhappinessFromPuppetCityPopulation()
local unhappinessFromSpecialists = activePlayer:GetUnhappinessFromCitySpecialists()
local unhappinessFromPop = activePlayer:GetUnhappinessFromCityPopulation() - unhappinessFromSpecialists - unhappinessFromPupetCities
insert( tips, "[COLOR:255:150:150:255]" .. L( "TXT_KEY_TP_UNHAPPINESS_TOTAL", activePlayer:GetUnhappiness() ) )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHAPPINESS_CITY_COUNT", activePlayer:GetUnhappinessFromCityCount() / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHAPPINESS_CAPTURED_CITY_COUNT", activePlayer:GetUnhappinessFromCapturedCityCount() / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHAPPINESS_POPULATION", unhappinessFromPop / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHAPPINESS_PUPPET_CITIES", unhappinessFromPupetCities / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHAPPINESS_SPECIALISTS", unhappinessFromSpecialists / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHAPPINESS_OCCUPIED_POPULATION", activePlayer:GetUnhappinessFromOccupiedCities() / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHAPPINESS_UNITS", activePlayer:GetUnhappinessFromUnits() / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_POLICIES", min(policiesHappiness,0) )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHAPPINESS_PUBLIC_OPINION", IsCiv5BNW_BE and activePlayer:GetUnhappinessFromPublicOpinion() or 0 )
------------
-- Happiness
insert( tips, "[ENDCOLOR][COLOR:150:255:150:255]" )
insert( tips, L("TXT_KEY_TP_HAPPINESS_SOURCES", totalHappiness ) )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_DIFFICULTY_LEVEL", handicapHappiness )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_POLICIES", max(policiesHappiness,0) )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_BUILDINGS", buildingHappiness )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_CITIES", cityHappiness )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_GARRISONED_UNITS", garrisonedUnitsHappiness )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_CONNECTED_CITIES", tradeRouteHappiness )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_STATE_RELIGION", religionHappiness )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_NATURAL_WONDERS", naturalWonderHappiness )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_CITY_COUNT", extraHappinessPerCity )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_CITY_STATE_FRIENDSHIP", minorCivHappiness )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_LEAGUES", leagueHappiness )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HAPPINESS_VASSALS", happinessFromVassals ) -- Compatibility with Putmalk's Civ IV Diplomacy Features Mod
-- Happiness from Luxury Variety
insertLocalizedBulletIfNonZero( tips, " ", "TXT_KEY_TP_HAPPINESS_RESOURCE_VARIETY", happinessFromExtraResources )
-- Extra Happiness from each Luxury
insertLocalizedBulletIfNonZero( tips, " ", "TXT_KEY_TP_HAPPINESS_EXTRA_PER_RESOURCE", extraLuxuryHappiness, numHappinessResources )
-- Misc Happiness from Resources
local miscHappiness = resourcesHappiness - baseHappinessFromResources - happinessFromExtraResources - (extraLuxuryHappiness * numHappinessResources)
insertLocalizedBulletIfNonZero( tips, " ", "TXT_KEY_TP_HAPPINESS_OTHER_SOURCES", miscHappiness )
if #availableResources > 0 then
insert( tips, "[ICON_BULLET]" .. L( "TXT_KEY_TP_HAPPINESS_FROM_RESOURCES", resourcesHappiness ) )
insert( tips, " " .. availableResources )
end
insert( tips, "[ENDCOLOR]" )
----------------------------
-- Local Resources in Cities
local tip = ""
for resource in Resources( luxuries ) do
local resourceID = resource.ID
local quantity = activePlayer:GetNumResourceTotal( resourceID, false ) + activePlayer:GetResourceExport( resourceID )
if quantity > 0 then
tip = tip .. " " .. ColorizeAbs( quantity ) .. resource.IconString
end
end
insert( tips, L"TXT_KEY_EO_LOCAL_RESOURCES" .. (#tip > 0 and tip or (" : "..L"TXT_KEY_TP_NO_RESOURCES_DISCOVERED")) )
----------------------------
-- Resources from city terrain
for city in activePlayer:Cities() do
local numConnectedResource = {}
local numUnconnectedResource = {}
for plot in CityPlots( city ) do
local resourceID = plot:GetResourceType( activeTeamID )
local numResource = plot:GetNumResource()
if numResource > 0
and GetResourceUsageType( resourceID ) == RESOURCEUSAGE_LUXURY
then
if plot:IsCity() or (not plot:IsImprovementPillaged() and plot:IsResourceConnectedByImprovement( plot:GetImprovementType() )) then
numConnectedResource[resourceID] = (numConnectedResource[resourceID] or 0) + numResource
else
numUnconnectedResource[resourceID] = (numUnconnectedResource[resourceID] or 0) + numResource
end
end
end
local tip = ""
for resource in Resources( luxuries ) do
local resourceID = resource.ID
if (numConnectedResource[resourceID] or 0) > 0 then
tip = tip .. " " .. ColorizeAbs( numConnectedResource[resourceID] ) .. resource.IconString
end
if (numUnconnectedResource[resourceID] or 0) > 0 then
tip = tip .. " " .. ColorizeAbs( -numUnconnectedResource[resourceID] ) .. resource.IconString
end
end
if #tip > 0 then
insert( tips, "[ICON_BULLET]" .. city:GetName() .. tip )
end
end
----------------------------
-- Import & Export Breakdown
local itemType, duration, finalTurn, data1, data2, data3, flag1, fromPlayerID
local gameTurn = Game.GetGameTurn()-1
local Exports = {}
local Imports = {}
for playerID = 0, MAX_MAJOR_CIVS-1 do
Exports[ playerID ] = {}
Imports[ playerID ] = {}
end
PushScratchDeal()
for i = 0, UI.GetNumCurrentDeals( activePlayerID ) - 1 do
UI.LoadCurrentDeal( activePlayerID, i )
local otherPlayerID = ScratchDeal:GetOtherPlayer( activePlayerID )
ScratchDeal:ResetIterator()
repeat
if IsCiv5BNW_BE then
itemType, duration, finalTurn, data1, data2, data3, flag1, fromPlayerID = ScratchDeal:GetNextItem()
else
itemType, duration, finalTurn, data1, data2, fromPlayerID = ScratchDeal:GetNextItem()
end
-- data1 is resourceID, data2 is quantity
if data2 and itemType == TRADE_ITEM_RESOURCES and GetResourceUsageType( data1 ) == RESOURCEUSAGE_LUXURY then
local trade
if fromPlayerID == activePlayerID then
trade = Exports[otherPlayerID]
else
trade = Imports[fromPlayerID]
end
local resourceTrade = trade[ data1 ]
if not resourceTrade then
resourceTrade = {}
trade[ data1 ] = resourceTrade
end
resourceTrade[finalTurn] = (resourceTrade[finalTurn] or 0) + data2
end
until not itemType
end
PopScratchDeal()
----------------------------
-- Imports
local tip = ""
for resource in Resources( luxuries ) do
local resourceID = resource.ID
local quantity = activePlayer:GetResourceImport( resourceID ) + activePlayer:GetResourceFromMinors( resourceID )
if quantity > 0 then
tip = tip .. " " .. ColorizeAbs( quantity ) .. resource.IconString
end
end
if #tip > 0 then
insert( tips, "" )
insert( tips, L"TXT_KEY_RESOURCES_IMPORTED" .. tip )
for playerID, array in pairs( Imports ) do
local tip = ""
for resourceID, row in pairs( array ) do
for turn, quantity in pairs(row) do
if quantity > 0 then
tip = tip .. " " .. quantity .. Resources[ resourceID ].IconString .. "(" .. turn - gameTurn .. ")"
end
end
end
if #tip > 0 then
insert( tips, "[ICON_BULLET]" .. Players[ playerID ]:GetCivilizationShortDescription() .. tip )
end
end
for minorID = MAX_MAJOR_CIVS, MAX_CIV_PLAYERS_minus1 do
local minor = Players[ minorID ]
if minor and minor:IsAlive() and minor:GetAlly() == activePlayerID then
local tip = ""
for resource in Resources( luxuries ) do
local quantity = minor:GetResourceExport(resource.ID)
if quantity > 0 then
tip = tip .. " " .. quantity .. resource.IconString
end
end
if #tip > 0 then
insert( tips, "[ICON_BULLET]" .. minor:GetCivilizationShortDescription() .. tip )
end
end
end
end
----------------------------
-- Exports
local tip = ""
for resource in Resources( luxuries ) do
local resourceID = resource.ID
local quantity = activePlayer:GetResourceExport( resourceID )
if quantity > 0 then
tip = tip .. " " .. ColorizeAbs( quantity ) .. resource.IconString
end
end
if #tip > 0 then
insert( tips, "" )
insert( tips, L"TXT_KEY_RESOURCES_EXPORTED" .. tip )
for playerID, array in pairs( Exports ) do
local tip = ""
for resourceID, row in pairs( array ) do
for turn, quantity in pairs( row ) do
if quantity > 0 then
tip = tip .. " " .. quantity .. Resources[ resourceID ].IconString .. "(" .. turn - gameTurn .. ")"
end
end
end
if #tip > 0 then
insert( tips, "[ICON_BULLET]" .. Players[ playerID ]:GetCivilizationShortDescription() .. tip )
end
end
end
-- show resources available for trade to the active player
-- insert( tips, L"TXT_KEY_DIPLO_ITEMS_LUXURY_RESOURCES" )
-- insert( tips, missingResources )
insert( tips, "" )
insert( tips, L"TXT_KEY_EO_RESOURCES_AVAILBLE" )
----------------------------
-- Available for Import
for resource in Resources( luxuries ) do
local resourceID = resource.ID
local resources = {}
for playerID = 0, MAX_CIV_PLAYERS_minus1 do
local player = Players[playerID]
local isMinorCiv = player:IsMinorCiv()
-- Valid player? - Can't be us, has to be alive and met, can't be allied city state
if playerID ~= activePlayerID
and player:IsAlive()
and activeTeam:IsHasMet( player:GetTeam() )
and not (isMinorCiv and player:IsAllies( activePlayerID ))
then
local numResource = ( isMinorCiv and player:GetNumResourceTotal(resourceID, false) + player:GetResourceExport( resourceID ) )
or ( ScratchDeal:IsPossibleToTradeItem( playerID, activePlayerID, TRADE_ITEM_RESOURCES, resourceID, 1 ) and player:GetNumResourceAvailable(resourceID, false) )
or 0
if numResource > 0 then
insert( resources, player:GetCivilizationShortDescription() .. " " .. numResource .. resource.IconString )
end
end
end
if #resources > 0 then
insert( tips, "[ICON_BULLET]" .. resource._Name .. ": " .. concat( resources, ", " ) )
end
end
return concat( tips, "[NEWLINE]" )
else
return L"TXT_KEY_TOP_PANEL_HAPPINESS_OFF_TOOLTIP"
end
end,
-------------------------------------------------
-- Golden Age Tooltip
-------------------------------------------------
GoldenAgeString = function()
if g_isHappinessEnabled then
local activePlayerID = GetActivePlayer()
local activePlayer = Players[activePlayerID]
local tips = {}
local goldenAgeTurns = activePlayer:GetGoldenAgeTurns()
local happyProgress = activePlayer:GetGoldenAgeProgressMeter()
local happyNeeded = activePlayer:GetGoldenAgeProgressThreshold()
if goldenAgeTurns > 0 then
if IsCiv5BNW and activePlayer:GetGoldenAgeTourismModifier() > 0 then
insert( tips, Locale.ToUpper"TXT_KEY_UNIQUE_GOLDEN_AGE_ANNOUNCE" )
else
insert( tips, Locale.ToUpper"TXT_KEY_GOLDEN_AGE_ANNOUNCE" )
end
insert( tips, L( "TXT_KEY_TP_GOLDEN_AGE_NOW", goldenAgeTurns ) )
else
local excessHappiness = activePlayer:GetExcessHappiness()
insert( tips, L( "TXT_KEY_PROGRESS_TOWARDS", "[COLOR_YELLOW]"
.. Locale.ToUpper( "TXT_KEY_SPECIALISTSANDGP_GOLDENAGE_HEADING4_TITLE" )
.. "[ENDCOLOR]" ) .. " " .. happyProgress .. " / " .. happyNeeded )
if excessHappiness > 0 then
insert( tips, L"TXT_KEY_MISSION_START_GOLDENAGE" .. ": [COLOR_YELLOW]"
.. Locale.ToUpper( L( "TXT_KEY_STR_TURNS", ceil((happyNeeded - happyProgress) / excessHappiness) ) )
.. "[ENDCOLOR]" .. "[NEWLINE][NEWLINE]" .. L("TXT_KEY_TP_GOLDEN_AGE_ADDITION", excessHappiness) )
elseif excessHappiness < 0 then
insert( tips, "[COLOR_WARNING_TEXT]" .. L("TXT_KEY_TP_GOLDEN_AGE_LOSS", -excessHappiness) .. "[ENDCOLOR]" )
end
end
if g_isBasicHelp then
insert( tips, "" )
if IsCiv5notVanilla and activePlayer:IsGoldenAgeCultureBonusDisabled() then
insert( tips, L"TXT_KEY_TP_GOLDEN_AGE_EFFECT_NO_CULTURE" )
else
insert( tips, L"TXT_KEY_TP_GOLDEN_AGE_EFFECT" )
end
if IsCiv5BNW and activePlayer:GetGoldenAgeTurns() > 0 and activePlayer:GetGoldenAgeTourismModifier() > 0 then
insert( tips, "" )
insert( tips, L"TXT_KEY_TP_CARNIVAL_EFFECT" )
end
end
return concat( tips, "[NEWLINE]" )
else
return L"TXT_KEY_TOP_PANEL_HAPPINESS_OFF_TOOLTIP"
end
end,
-------------------------------------------------
-- Culture Tooltip
-------------------------------------------------
CultureString = function()
if g_isPoliciesEnabled then
local activePlayerID = GetActivePlayer()
local activePlayer = Players[activePlayerID]
local tips = {}
local turnsRemaining = 1
local cultureProgress, culturePerTurn, culturePerTurnForFree, culturePerTurnFromCities, culturePerTurnFromExcessHappiness, culturePerTurnFromTraits
-- Firaxis Cleverness...
if IsCiv5 then
cultureProgress = activePlayer:GetJONSCulture()
culturePerTurn = activePlayer:GetTotalJONSCulturePerTurn()
culturePerTurnForFree = activePlayer:GetJONSCulturePerTurnForFree()
culturePerTurnFromCities = activePlayer:GetJONSCulturePerTurnFromCities()
culturePerTurnFromExcessHappiness = activePlayer:GetJONSCulturePerTurnFromExcessHappiness()
culturePerTurnFromTraits = IsCiv5BNW and activePlayer:GetJONSCulturePerTurnFromTraits() or 0
else
cultureProgress = activePlayer:GetCulture()
culturePerTurn = activePlayer:GetTotalCulturePerTurn()
culturePerTurnForFree = activePlayer:GetCulturePerTurnForFree()
culturePerTurnFromCities = activePlayer:GetCulturePerTurnFromCities()
culturePerTurnFromExcessHappiness = activePlayer:GetCulturePerTurnFromExcessHealth()
culturePerTurnFromTraits = activePlayer:GetCulturePerTurnFromTraits()
end
local cultureTheshold = activePlayer:GetNextPolicyCost()
if cultureTheshold > cultureProgress then
if culturePerTurn > 0 then
turnsRemaining = ceil( (cultureTheshold - cultureProgress) / culturePerTurn)
else
turnsRemaining = "?"
end
end
if IsCiv5BNW_BE and activePlayer:IsAnarchy() then
insert( tips, L("TXT_KEY_TP_ANARCHY", activePlayer:GetAnarchyNumTurns()) )
insert( tips, "" )
end
insert( tips, L( "TXT_KEY_PROGRESS_TOWARDS", "[COLOR_MAGENTA]" .. Locale.ToUpper"TXT_KEY_ADVISOR_SCREEN_SOCIAL_POLICY_DISPLAY" .. "[ENDCOLOR]" )
.. " " .. cultureProgress .. "[ICON_CULTURE]/ " .. cultureTheshold .. "[ICON_CULTURE]" )
if culturePerTurn > 0 then
local cultureOverflow = culturePerTurn * turnsRemaining + cultureProgress - cultureTheshold
local tip = "[COLOR_MAGENTA]" .. Locale.ToUpper( L( "TXT_KEY_STR_TURNS", turnsRemaining ) )
.. "[ENDCOLOR]" .. format( " %+g[ICON_CULTURE]", cultureOverflow )
if turnsRemaining > 1 then
tip = L( "TXT_KEY_STR_TURNS", turnsRemaining -1 )
.. format( " %+g[ICON_CULTURE] ", cultureOverflow - culturePerTurn )
.. tip
end
insert( tips, tip )
end
insert( tips, "" )
insert( tips, "[COLOR_MAGENTA]" .. format( "%+g", culturePerTurn )
.. "[ENDCOLOR] " .. L"TXT_KEY_REPLAY_DATA_CULTUREPERTURN" )
-- Culture for Free
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_CULTURE_FOR_FREE", culturePerTurnForFree )
-- Culture from Cities
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_CULTURE_FROM_CITIES", culturePerTurnFromCities )
-- Culture from Excess Happiness / Health
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_CULTURE_FROM_" .. g_happinessString, culturePerTurnFromExcessHappiness )
-- Culture from Traits
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_CULTURE_FROM_TRAITS", culturePerTurnFromTraits )
if IsCiv5 then
-- Culture from Minor Civs
local culturePerTurnFromMinorCivs = activePlayer:GetJONSCulturePerTurnFromMinorCivs()
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_CULTURE_FROM_MINORS", culturePerTurnFromMinorCivs )
-- Culture from Religion
local culturePerTurnFromReligion = IsCiv5notVanilla and activePlayer:GetCulturePerTurnFromReligion() or 0
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_CULTURE_FROM_RELIGION", culturePerTurnFromReligion )
-- Culture from bonus turns (League Project)
local culturePerTurnFromBonusTurns = 0
if IsCiv5BNW then
culturePerTurnFromBonusTurns = activePlayer:GetCulturePerTurnFromBonusTurns()
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_CULTURE_FROM_BONUS_TURNS", culturePerTurnFromBonusTurns, activePlayer:GetCultureBonusTurns() )
end
-- Culture from Vassals / Compatibility with Putmalk's Civ IV Diplomacy Features Mod
local culturePerTurnFromVassals = activePlayer.GetJONSCulturePerTurnFromVassals and activePlayer:GetJONSCulturePerTurnFromVassals() or 0
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_CULTURE_VASSALS", culturePerTurnFromVassals )
-- Culture from Golden Age
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_CULTURE_FROM_GOLDEN_AGE", culturePerTurn - culturePerTurnForFree - culturePerTurnFromCities - culturePerTurnFromExcessHappiness - culturePerTurnFromMinorCivs - culturePerTurnFromReligion - culturePerTurnFromTraits - culturePerTurnFromBonusTurns - culturePerTurnFromVassals ) -- Compatibility with Putmalk's Civ IV Diplomacy Features Mod
else
-- Uncategorized Culture
insertLocalizedIfNonZero( tips, "TXT_KEY_TP_YIELD_FROM_UNCATEGORIZED", culturePerTurn - culturePerTurnForFree - culturePerTurnFromCities - culturePerTurnFromExcessHappiness - culturePerTurnFromTraits )
end
-- Let people know that building more cities makes policies harder to get
if g_isBasicHelp then
insert( tips, "" )
insert( tips, L("TXT_KEY_TP_CULTURE_CITY_COST", Game.GetNumCitiesPolicyCostMod() * ( 100 + ( IsCivBE and activePlayer:GetNumCitiesPolicyCostDiscount() or 0 ) ) / 100 ) )
end
return concat( tips, "[NEWLINE]" )
else
return L"TXT_KEY_TOP_PANEL_POLICIES_OFF_TOOLTIP"
end
end,
FaithString = FaithTooltip,
FaithIcon = FaithTooltip,
-------------------------------------------------
-- Tourism Tooltip (BNW)
-------------------------------------------------
TourismString = function()
local activePlayerID = GetActivePlayer()
local activePlayer = Players[activePlayerID]
local totalGreatWorks = activePlayer:GetNumGreatWorks()
local totalSlots = activePlayer:GetNumGreatWorkSlots()
local tipText = L( "TXT_KEY_TOP_PANEL_TOURISM_TOOLTIP_1", totalGreatWorks )
.. "[NEWLINE]"
.. L( "TXT_KEY_TOP_PANEL_TOURISM_TOOLTIP_2", totalSlots - totalGreatWorks )
local cultureVictory = GameInfo.Victories.VICTORY_CULTURAL
if cultureVictory and PreGame.IsVictory(cultureVictory.ID) then
local numInfluential = activePlayer:GetNumCivsInfluentialOn()
local numToBeInfluential = activePlayer:GetNumCivsToBeInfluentialOn()
tipText = tipText .. "[NEWLINE][NEWLINE]"
.. L( "TXT_KEY_TOP_PANEL_TOURISM_TOOLTIP_3", L("TXT_KEY_CO_VICTORY_INFLUENTIAL_OF", numInfluential, numToBeInfluential) )
end
return tipText
end,
-------------------------------------------------
-- International Trade Routes Tooltip (BNW)
-------------------------------------------------
InternationalTradeRoutes = function()
local activePlayerID = GetActivePlayer()
local activePlayer = Players[activePlayerID]
local tipText = ""
local numAvailableTradeUnits = activePlayer:GetNumAvailableTradeUnits(DomainTypes.DOMAIN_LAND)
if numAvailableTradeUnits > 0 then
local tradeUnitType = activePlayer:GetTradeUnitType(DomainTypes.DOMAIN_LAND)
tipText = tipText .. L("TXT_KEY_TOP_PANEL_INTERNATIONAL_TRADE_ROUTES_TT_UNASSIGNED", numAvailableTradeUnits, GameInfo.Units[ tradeUnitType ]._Name) .. "[NEWLINE]"
end
local numAvailableTradeUnits = activePlayer:GetNumAvailableTradeUnits(DomainTypes.DOMAIN_SEA)
if numAvailableTradeUnits > 0 then
local tradeUnitType = activePlayer:GetTradeUnitType(DomainTypes.DOMAIN_SEA)
tipText = tipText .. L("TXT_KEY_TOP_PANEL_INTERNATIONAL_TRADE_ROUTES_TT_UNASSIGNED", numAvailableTradeUnits, GameInfo.Units[ tradeUnitType ]._Name) .. "[NEWLINE]"
end
local usedTradeRoutes = activePlayer:GetNumInternationalTradeRoutesUsed()
local availableTradeRoutes = activePlayer:GetNumInternationalTradeRoutesAvailable()
if #tipText > 0 then
tipText = tipText .. "[NEWLINE]"
end
tipText = L("TXT_KEY_TOP_PANEL_INTERNATIONAL_TRADE_ROUTES_TT", usedTradeRoutes, availableTradeRoutes)
local strYourTradeRoutes = activePlayer:GetTradeYourRoutesTTString()
if #strYourTradeRoutes > 0 then
tipText = tipText .. "[NEWLINE][NEWLINE]"
.. L"TXT_KEY_TOP_PANEL_ITR_ESTABLISHED_BY_PLAYER_TT"
.. "[NEWLINE]"
.. strYourTradeRoutes
end
local strToYouTradeRoutes = activePlayer:GetTradeToYouRoutesTTString()
if #strToYouTradeRoutes > 0 then
tipText = tipText .. "[NEWLINE][NEWLINE]"
.. L"TXT_KEY_TOP_PANEL_ITR_ESTABLISHED_BY_OTHER_TT"
.. "[NEWLINE]"
.. strToYouTradeRoutes
end
return tipText
end,
-------------------------------------------------
-- Health Tooltip (CivBE)
-------------------------------------------------
HealthString = function()
if g_isHealthEnabled then
local activePlayerID = GetActivePlayer()
local activePlayer = Players[activePlayerID]
local excessHealth = activePlayer:GetExcessHealth()
local healthLevel = activePlayer:GetCurrentHealthLevel()
local healthLevelInfo = GameInfo.HealthLevels[healthLevel]
local colorPrefixText = "[COLOR_GREEN]"
local iconStringText = "[ICON_HEALTH]"
local rangeFactor = 1
if excessHealth < 0 then
colorPrefixText = "[COLOR_RED]"
iconStringText = "[ICON_UNHEALTH]"
rangeFactor = -1
end
local tips = { L("TXT_KEY_TP_HEALTH_SUMMARY", iconStringText, colorPrefixText, excessHealth * rangeFactor) }
if healthLevelInfo.Help then
insert( tips, L( healthLevelInfo.Help ) )
end
insert( tips, activePlayer:IsEmpireUnhealthy() and "[COLOR_WARNING_TEXT]" or "[COLOR_POSITIVE_TEXT]" )
local cityYieldMods = {}
local combatMod = 0
local cityGrowthMod = 0
local outpostGrowthMod = 0
local cityIntrigueMod = 0
for info in GameInfo.HealthLevels() do
local healthLevelID = info.ID
if activePlayer:IsAffectedByHealthLevel(healthLevelID) then
for yieldID = 0, YieldTypes.NUM_YIELD_TYPES-1 do
cityYieldMods[yieldID] = (cityYieldMods[yieldID] or 0) + Game.GetHealthLevelCityYieldModifier(healthLevelID, excessHealth, yieldID)
end
combatMod = combatMod + (info.CombatModifier or 0)
cityGrowthMod = cityGrowthMod + Game.GetHealthLevelCityGrowthModifier(healthLevelID, excessHealth)
outpostGrowthMod = outpostGrowthMod + Game.GetHealthLevelCityGrowthModifier(healthLevelID, excessHealth)
cityIntrigueMod = cityIntrigueMod + Game.GetHealthLevelCityIntrigueModifier(healthLevelID, excessHealth)
end
end
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_LEVEL_EFFECT_COMBAT_MODIFIER", combatMod )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_LEVEL_EFFECT_CITY_GROWTH_MODIFIER", cityGrowthMod )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_LEVEL_EFFECT_OUTPOST_GROWTH_MODIFIER", outpostGrowthMod )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_LEVEL_EFFECT_CITY_INTRIGUE_MODIFIER", cityIntrigueMod )
for yieldID = 0, YieldTypes.NUM_YIELD_TYPES-1 do
local yieldInfo = GameInfo.Yields[ yieldID ]
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_LEVEL_EFFECT_CITY_YIELD_MODIFIER", yieldInfo and cityYieldMods[yieldID] or 0, yieldInfo.IconString, yieldInfo._Name )
end
-- insert( tips, "[ENDCOLOR]" )
--*** HEALTH Breakdown ***--
local totalHealth = activePlayer:GetHealth()
local handicapInfo = GameInfo.HandicapInfos[activePlayer:GetHandicapType()]
local handicapHealth = handicapInfo.BaseHealthRate
local healthFromCities = activePlayer:GetHealthFromCities()
local extraCityHealth = activePlayer:GetExtraHealthPerCity() * activePlayer:GetNumCities()
local healthFromPolicies = activePlayer:GetHealthFromPolicies()
local healthFromTradeRoutes = activePlayer:GetHealthFromTradeRoutes()
--local healthFromNationalSecurityProject = activePlayer:GetHealthFromNationalSecurityProject(); WRM: Add this in when we have a text string for it
insert( tips, "[COLOR_WHITE]" )
insert( tips, L( "TXT_KEY_TP_HEALTH_SOURCES", totalHealth ) )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_CITIES", healthFromCities )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_POLICIES", healthFromPolicies )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_CONNECTED_CITIES", healthFromTradeRoutes )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_CITY_COUNT", extraCityHealth )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_DIFFICULTY_LEVEL", handicapHealth )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_HEALTH_OTHER_SOURCES", totalHealth - handicapHealth - healthFromPolicies - healthFromCities - healthFromTradeRoutes - extraCityHealth )
insert( tips, "[ENDCOLOR]" )
--*** UNHEALTH Breakdown ***--
local totalUnhealth = activePlayer:GetUnhealth()
local unhealthFromCities = activePlayer:GetUnhealthFromCities()
local unhealthFromUnits = activePlayer:GetUnhealthFromUnits()
local unhealthFromCityCount = activePlayer:GetUnhealthFromCityCount()
local unhealthFromConqueredCityCount = activePlayer:GetUnhealthFromConqueredCityCount()
local unhealthFromPupetCities = activePlayer:GetUnhealthFromPuppetCityPopulation()
local unhealthFromSpecialists = activePlayer:GetUnhealthFromCitySpecialists()
local unhealthFromPop = activePlayer:GetUnhealthFromCityPopulation() - unhealthFromSpecialists - unhealthFromPupetCities
local unhealthFromConqueredCities = activePlayer:GetUnhealthFromConqueredCities()
insert( tips, "[COLOR:255:150:150:255]" )
insert( tips, L( "TXT_KEY_TP_UNHEALTH_TOTAL", totalUnhealth ) )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHEALTH_CITIES", unhealthFromCities / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHEALTH_CITY_COUNT", unhealthFromCityCount / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHEALTH_CAPTURED_CITY_COUNT", unhealthFromConqueredCityCount / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHEALTH_POPULATION", unhealthFromPop / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHEALTH_PUPPET_CITIES", unhealthFromPupetCities / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHEALTH_SPECIALISTS", unhealthFromSpecialists / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHEALTH_OCCUPIED_POPULATION", unhealthFromConqueredCities / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHEALTH_UNITS", unhealthFromUnits / 100 )
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_YIELD_FROM_UNCATEGORIZED", totalUnhealth - ( unhealthFromCities + unhealthFromCityCount + unhealthFromConqueredCityCount + unhealthFromPop + unhealthFromPupetCities + unhealthFromSpecialists + unhealthFromConqueredCities + unhealthFromUnits ) / 100 )
insert( tips, "[ENDCOLOR]" )
-- Overall Unhealth Mod
local unhealthMod = activePlayer:GetUnhealthMod()
if unhealthMod > 0 then -- Positive mod means more Unhealth - this is a bad thing!
append( tips, "[COLOR:255:150:150:255]" )
end
insertLocalizedBulletIfNonZero( tips, "TXT_KEY_TP_UNHEALTH_MOD", unhealthMod )
-- Basic explanation of Health
insert( tips, "[ENDCOLOR]" )
insert( tips, L( "TXT_KEY_TP_HEALTH_EXPLANATION", totalUnhealth ) )
return concat( tips, "[NEWLINE]" )
else
return L"TXT_KEY_TOP_PANEL_HEALTH_OFF_TOOLTIP"
end
end,
-------------------------------------------------
-- Affinity Tooltips (CivBE)
-------------------------------------------------
Harmony = function() return GetHelpTextForAffinity( GameInfoTypes.AFFINITY_TYPE_HARMONY, Players[GetActivePlayer()] ) end,
Purity = function() return GetHelpTextForAffinity( GameInfoTypes.AFFINITY_TYPE_PURITY, Players[GetActivePlayer()] ) end,
Supremacy = function() return GetHelpTextForAffinity( GameInfoTypes.AFFINITY_TYPE_SUPREMACY, Players[GetActivePlayer()] ) end,
}
LuaEvents.TopPanelTooltips.Add( function( control )
local toolTip = TooltipSelect( TopPanelTooltips, control )
return toolTip and ShowTextToolTip( toolTip )
end)
print( "EUI tooltip server loaded." )
|
local ADDON_NAME, private = ...
-- Lua Globals --
-- luacheck: globals select
local loaded = _G.LoadAddOn("RealUI_Skins")
local tries = 1
while not loaded do
loaded = _G.LoadAddOn("RealUI_Skins")
tries = tries + 1
if tries > 3 then
_G.StaticPopupDialogs["REALUI_SKINS_NOT_FOUND"] = {
text = "Module \"Skins\" was not found. RealUI will now be disabled.",
button1 = _G.OKAY,
OnShow = function(self)
self:SetScale(2)
self:ClearAllPoints()
self:SetPoint("CENTER")
end,
OnAccept = function(self, data)
_G.DisableAddOn("nibRealUI")
_G.ReloadUI()
end,
timeout = 0,
exclusive = 1,
whileDead = 1,
}
_G.StaticPopup_Show("REALUI_SKINS_NOT_FOUND")
break
end
end
-- RealUI --
private.RealUI = _G.LibStub("AceAddon-3.0"):NewAddon(_G.RealUI, ADDON_NAME, "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0")
local RealUI = private.RealUI
RealUI.isPatch = select(4, _G.GetBuildInfo()) >= 90001
RealUI.realmInfo = {
realm = _G.GetRealmName(),
connectedRealms = _G.GetAutoCompleteRealms(),
id = _G.GetRealmID(),
}
if RealUI.realmInfo.connectedRealms[1] then
RealUI.realmInfo.isConnected = true
end
local function CheckforRealm()
RealUI.realmInfo.realmNormalized = _G.GetNormalizedRealmName()
if RealUI.realmInfo.realmNormalized then
if not RealUI.realmInfo.isConnected then
RealUI.realmInfo.connectedRealms[1] = RealUI.realmInfo.realmNormalized
end
RealUI:SendMessage("NormalizedRealmReceived")
return true
end
return false
end
if not CheckforRealm() then
local frame = _G.CreateFrame("Frame")
frame:SetScript("OnUpdate", function(self)
self:SetShown(not CheckforRealm())
end)
end
local classLocale, classToken, classID = _G.UnitClass("player")
RealUI.charInfo = {
name = _G.UnitName("player"),
realm = RealUI.realmInfo.realm,
faction = _G.UnitFactionGroup("player"),
class = {
locale = classLocale,
token = classToken,
id = classID,
color = _G.CUSTOM_CLASS_COLORS[classToken] or _G.CUSTOM_CLASS_COLORS.PRIEST
},
specs = {
current = {}
}
}
for specIndex = 1, _G.GetNumSpecializationsForClassID(classID) do
local id, name, _, iconID, role, isRecommended = _G.GetSpecializationInfoForClassID(classID, specIndex)
RealUI.charInfo.specs[specIndex] = {
index = specIndex,
id = id,
name = name,
icon = iconID,
role = role,
isRecommended = isRecommended,
}
if isRecommended then
RealUI.charInfo.specs.current = RealUI.charInfo.specs[specIndex]
end
end
-- Disable cargBags
local enabled = _G.GetAddOnEnableState(RealUI.charInfo.name, "RealUI_Inventory")
if enabled > 0 then
_G.DisableAddOn("cargBags_Nivaya", true)
end
RealUI.globals = {
anchorPoints = {
"TOPLEFT", "TOP", "TOPRIGHT",
"LEFT", "CENTER", "RIGHT",
"BOTTOMLEFT", "BOTTOM", "BOTTOMRIGHT",
},
cornerPoints = {
"TOPLEFT",
"TOPRIGHT",
"BOTTOMLEFT",
"BOTTOMRIGHT",
},
stratas = {
"BACKGROUND",
"LOW",
"MEDIUM",
"HIGH",
"DIALOG",
"TOOLTIP"
}
}
|
---@class any @any type
---@class nil:any @The type `nil` has one single value `nil`, whose main property is to be different from any other value. [`View online doc`](https://www.lua.org/manual/5.4/manual.html#2) | [`View local doc`](command:extension.lua.doc?["en-us/54/manual.html/2"])
---@class boolean: any @The type `boolean` has two values, `false` and `true`. [`View online doc`](https://www.lua.org/manual/5.4/manual.html#2) | [`View local doc`](command:extension.lua.doc?["en-us/54/manual.html/2"])
---@class number:any @The type `number` uses two internal representations, or two subtypes, one called *integer* and the other called *float*. [`View online doc`](https://www.lua.org/manual/5.4/manual.html#2) | [`View local doc`](command:extension.lua.doc?["en-us/54/manual.html/2"])
---@alias integer number @integer numbers
---@class thread: any @The type *thread* represents independent threads of execution and it is used to implement coroutines. Lua threads are not related to operating-system threads. Lua supports coroutines on all systems, even thosethat do not support threads natively. [`View online doc`](https://www.lua.org/manual/5.4/manual.html#2) | [`View local doc`](command:extension.lua.doc?["en-us/54/manual.html/2"])
---@class table: any @The type *table* implements associative arrays, that is, arrays that can have as indices not only numbers, but any Lua value except **nil** and NaN.(*Not a Number* is a special floating-point value used by the IEEE 754 standard to represent undefined or unrepresentable numerical results, such as `0/0`.) Tables can be heterogeneous; that is, they can contain values of all types (except **nil**). Any key with value **nil** is not considered part oft he table. Conversely, any key that is not part of a table has an a ssociated value **nil**. [`View online doc`](https://www.lua.org/manual/5.4/manual.html#2) | [`View local doc`](command:extension.lua.doc?["en-us/54/manual.html/2"])
---@class string: any
---@class void
---@class userdata: any @The type `userdata` is provided to allow arbitrary C data to be stored in Lua variables. A `userdata` value represents a block of raw memory. There are two kinds of `userdata`: `full userdata`, which is an object with a block of memory managed by Lua, and `light userdata`, which is simply a C pointer value. Userdata has no predefined operations in Lua, except assignment and identity test. By using metatables, the programmer can define operations for `full userdata` values. Userdata values cannot be created or modified in Lua, only through the C API. This guarantees the integrity of data owned by the host program and C libraries. [`View online doc`](https://www.lua.org/manual/5.4/manual.html#2) | [`View local doc`](command:extension.lua.doc?["en-us/54/manual.html/2"])
---@class lightuserdata: userdata
---@class function: any @Lua can call (and manipulate) functions written in Lua and functions written in C. Both are represented by the type *function*.
|
--!A cross-platform build utility based on Lua
--
-- 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.
--
-- Copyright (C) 2015-present, TBOOX Open Source Group.
--
-- @author ruki
-- @file socket.lua
--
-- define module
local socket = socket or {}
local _instance = _instance or {}
-- load modules
local io = require("base/io")
local bytes = require("base/bytes")
local table = require("base/table")
local string = require("base/string")
local scheduler = require("base/scheduler")
-- the socket types
socket.TCP = 1
socket.UDP = 2
socket.ICMP = 3
-- the socket families
socket.IPV4 = 1
socket.IPV6 = 2
socket.UNIX = 3
-- the socket events, @see tbox/platform/socket.h
socket.EV_RECV = 1
socket.EV_SEND = 2
socket.EV_CONN = socket.EV_SEND
socket.EV_ACPT = socket.EV_RECV
-- new a socket
function _instance.new(socktype, family, sock)
local instance = table.inherit(_instance)
instance._SOCK = sock
instance._TYPE = socktype
instance._FAMILY = family
setmetatable(instance, _instance)
return instance
end
-- get socket type
function _instance:type()
return self._TYPE
end
-- get socket family
function _instance:family()
return self._FAMILY
end
-- get cdata of socket
function _instance:cdata()
return self._SOCK
end
-- get poller object type, poller.OT_SOCK
function _instance:otype()
return 1
end
-- get socket rawfd
function _instance:rawfd()
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return nil, errors
end
-- get rawfd
local result, errors = io.socket_rawfd(self:cdata())
if not result and errors then
errors = string.format("%s: %s", self, errors)
end
return result, errors
end
-- bind socket
function _instance:bind(addr, port)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- bind it
local ok, errors = io.socket_bind(self:cdata(), addr, port, self:family())
if not ok and errors then
errors = string.format("%s: %s", self, errors)
end
return ok, errors
end
-- bind socket from the unix address
function _instance:bind_unix(addr, opt)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- must be unix socket
if self:family() ~= socket.UNIX then
return -1, string.format("%s: must be unix socket!", self)
end
-- bind it
opt = opt or {}
local ok, errors = io.socket_bind(self:cdata(), addr, opt.is_abstract, self:family())
if not ok and errors then
errors = string.format("%s: %s", self, errors)
end
return ok, errors
end
-- listen socket
function _instance:listen(backlog)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- listen it
local ok, errors = io.socket_listen(self:cdata(), backlog or 10)
if not ok and errors then
errors = string.format("%s: %s", self, errors)
end
return ok, errors
end
-- accept socket
function _instance:accept(opt)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- accept it
local sock, errors = io.socket_accept(self:cdata())
if not sock and not errors then
opt = opt or {}
local events, waiterrs = _instance.wait(self, socket.EV_ACPT, opt.timeout or -1)
if events == socket.EV_ACPT then
sock, errors = io.socket_accept(self:cdata())
else
errors = waiterrs
end
end
if not sock and errors then
errors = string.format("%s: %s", self, errors)
end
if sock then
sock = _instance.new(self:type(), self:family(), sock)
end
return sock, errors
end
-- connect socket
function _instance:connect(addr, port, opt)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- connect it
local ok, errors = io.socket_connect(self:cdata(), addr, port, self:family())
if ok == 0 then
opt = opt or {}
local events, waiterrs = _instance.wait(self, socket.EV_CONN, opt.timeout or -1)
if events == socket.EV_CONN then
ok, errors = io.socket_connect(self:cdata(), addr, port, self:family())
else
errors = waiterrs
end
end
if ok < 0 and errors then
errors = string.format("%s: %s", self, errors)
end
return ok, errors
end
-- connect socket from the unix address
function _instance:connect_unix(addr, opt)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- must be unix socket
if self:family() ~= socket.UNIX then
return -1, string.format("%s: must be unix socket!", self)
end
-- connect it
opt = opt or {}
local ok, errors = io.socket_connect(self:cdata(), addr, opt.is_abstract, self:family())
if ok == 0 then
local events, waiterrs = _instance.wait(self, socket.EV_CONN, opt.timeout or -1)
if events == socket.EV_CONN then
ok, errors = io.socket_connect(self:cdata(), addr, opt.is_abstract, self:family())
else
errors = waiterrs
end
end
if ok < 0 and errors then
errors = string.format("%s: %s", self, errors)
end
return ok, errors
end
-- send data to socket
function _instance:send(data, opt)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- data is bytes? table.unpack the raw address
local datasize = #data
if type(data) == "table" and data.caddr then
datasize = data:size()
data = {data = data:caddr(), size = data:size()}
end
-- init start and last
opt = opt or {}
local start = opt.start or 1
local last = opt.last or datasize
-- check start and last
if start > last or start < 1 then
return -1, string.format("%s: invalid start(%d) and last(%d)!", self, start, last)
end
-- send it
local send = 0
local real = 0
local wait = false
local errors = nil
if opt.block then
local size = last + 1 - start
while start <= last do
real, errors = io.socket_send(self:cdata(), data, start, last)
if real > 0 then
send = send + real
start = start + real
wait = false
elseif real == 0 and not wait then
local events, waiterrs = _instance.wait(self, socket.EV_SEND, opt.timeout or -1)
if events == socket.EV_SEND then
wait = true
else
errors = waiterrs
break
end
else
break
end
end
if send ~= size then
send = -1
end
else
send, errors = io.socket_send(self:cdata(), data, start, last)
if send < 0 and errors then
errors = string.format("%s: %s", self, errors)
end
end
return send, errors
end
-- send file to socket
function _instance:sendfile(file, opt)
-- ensure the socket opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- ensure the file opened
local ok, errors = file:_ensure_opened()
if not ok then
return -1, errors
end
-- init start and last
opt = opt or {}
local start = opt.start or 1
local last = opt.last or file:size()
-- check start and last
if start > last or start < 1 then
return -1, string.format("%s: invalid start(%d) and last(%d)!", self, start, last)
end
-- send it
local send = 0
local real = 0
local wait = false
local errors = nil
if opt.block then
local size = last + 1 - start
while start <= last do
real, errors = io.socket_sendfile(self:cdata(), file._FILE, start, last)
if real > 0 then
send = send + real
start = start + real
wait = false
elseif real == 0 and not wait then
local events, waiterrs = _instance.wait(self, socket.EV_SEND, opt.timeout or -1)
if events == socket.EV_SEND then
wait = true
else
errors = waiterrs
break
end
else
break
end
end
if send ~= size then
send = -1
end
else
send, errors = io.socket_sendfile(self:cdata(), file._FILE, start, last)
if send < 0 and errors then
errors = string.format("%s: %s", self, errors)
end
end
return send, errors
end
-- recv data from socket
function _instance:recv(size, opt)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- check size
if size == 0 then
return 0
elseif size == nil or size < 0 then
return -1, string.format("%s: invalid size(%d)!", self, size)
end
-- recv it
opt = opt or {}
local recv = 0
local real = 0
local wait = false
local data_or_errors = nil
if opt.block then
local results = {}
while recv < size do
local buff = self:_recvbuff()
real, data_or_errors = io.socket_recv(self:cdata(), buff:caddr(), math.min(buff:size(), size - recv))
if real > 0 then
recv = recv + real
wait = false
table.insert(results, bytes(buff, 1, real))
self:_recvbuff_clear()
elseif real == 0 and not wait then
local events, waiterrs = _instance.wait(self, socket.EV_RECV, opt.timeout or -1)
if events == socket.EV_RECV then
wait = true
else
data_or_errors = waiterrs
break
end
else
break
end
end
if recv == size then
data_or_errors = bytes(results)
else
recv = -1
end
else
local buff = self:_recvbuff()
recv, data_or_errors = io.socket_recv(self:cdata(), buff:caddr(), math.min(buff:size(), size))
if recv > 0 then
data_or_errors = bytes(buff, 1, recv)
self:_recvbuff_clear()
end
end
if recv < 0 and data_or_errors then
data_or_errors = string.format("%s: %s", self, data_or_errors)
end
return recv, data_or_errors
end
-- send udp data to peer
function _instance:sendto(data, addr, port, opt)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- only for udp
if self:type() ~= socket.UDP then
return -1, string.format("%s: sendto() only for udp socket!", self)
end
-- check address
if not addr or not port then
return -1, string.format("%s: sendto empty address!", self)
end
-- data is bytes? table.unpack the raw address
if type(data) == "table" and data.caddr then
data = {data = data:caddr(), size = data:size()}
end
-- send it
opt = opt or {}
local send = 0
local wait = false
local errors = nil
if opt.block then
while true do
send, errors = io.socket_sendto(self:cdata(), data, addr, port, self:family())
if send == 0 and not wait then
local events, waiterrs = _instance.wait(self, socket.EV_SEND, opt.timeout or -1)
if events == socket.EV_SEND then
wait = true
else
errors = waiterrs
break
end
else
break
end
end
else
send, errors = io.socket_sendto(self:cdata(), data, addr, port, self:family())
if send < 0 and errors then
errors = string.format("%s: %s", self, errors)
end
end
return send, errors
end
-- recv udp data from peer
function _instance:recvfrom(size, opt)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- only for udp
if self:type() ~= socket.UDP then
return -1, string.format("%s: sendto() only for udp socket!", self)
end
-- check size
if size == 0 then
return 0
elseif size == nil or size < 0 then
return -1, string.format("%s: invalid size(%d)!", self, size)
end
-- recv it
opt = opt or {}
local recv = 0
local wait = false
local data_or_errors = nil
if opt.block then
while true do
local buff = self:_recvbuff()
recv, data_or_errors, addr, port = io.socket_recvfrom(self:cdata(), buff:caddr(), math.min(buff:size(), size))
if recv > 0 then
data_or_errors = bytes(buff, 1, recv)
self:_recvbuff_clear()
break
elseif recv == 0 and not wait then
local events, waiterrs = _instance.wait(self, socket.EV_RECV, opt.timeout or -1)
if events == socket.EV_RECV then
wait = true
else
recv = -1
data_or_errors = waiterrs
break
end
else
break
end
end
else
local buff = self:_recvbuff()
recv, data_or_errors, addr, port = io.socket_recvfrom(self:cdata(), buff:caddr(), math.min(buff:size(), size))
if recv > 0 then
data_or_errors = bytes(buff, 1, recv)
self:_recvbuff_clear()
end
end
if recv < 0 and data_or_errors then
data_or_errors = string.format("%s: %s", self, data_or_errors)
end
return recv, data_or_errors, addr, port
end
-- wait socket events
function _instance:wait(events, timeout)
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return -1, errors
end
-- wait events
local result = -1
local errors = nil
if scheduler:co_running() then
result, errors = scheduler:poller_wait(self, events, timeout or -1)
else
result, errors = io.socket_wait(self:cdata(), events, timeout or -1)
end
if result < 0 and errors then
errors = string.format("%s: %s", self, errors)
end
return result, errors
end
-- close socket
function _instance:close()
-- ensure opened
local ok, errors = self:_ensure_opened()
if not ok then
return false, errors
end
-- cancel socket events from the scheduler
if scheduler:co_running() then
ok, errors = scheduler:poller_cancel(self)
if not ok then
return false, errors
end
end
-- close it
ok = io.socket_close(self:cdata())
if ok then
self._SOCK = nil
end
return ok
end
-- get the recv buffer
function _instance:_recvbuff()
local recvbuff = self._RECVBUFF
if not recvbuff then
recvbuff = bytes(8192)
self._RECVBUFF = recvbuff
end
return recvbuff
end
-- clear the recv buffer
function _instance:_recvbuff_clear()
self._RECVBUFF = nil
end
-- ensure the socket is opened
function _instance:_ensure_opened()
if not self:cdata() then
return false, string.format("%s: has been closed!", self)
end
return true
end
-- tostring(socket)
function _instance:__tostring()
local rawfd = self:rawfd() or "closed"
local types = {"tcp", "udp", "icmp"}
return string.format("<socket: %s%s/%s>", types[self:type()], self:family() == socket.IPV6 and "6" or "4", rawfd)
end
-- gc(socket)
function _instance:__gc()
if self:cdata() and io.socket_close(self:cdata()) then
self._SOCK = nil
end
end
-- open a socket
--
-- @param socktype the socket type, e.g. tcp, udp, icmp
-- @param family the address family, e.g. ipv4, ipv6
--
-- @return the socket instance
--
function socket.open(socktype, family)
socktype = socktype or socket.TCP
family = family or socket.IPV4
local sock, errors = io.socket_open(socktype, family)
if sock then
return _instance.new(socktype, family, sock)
else
return nil, errors or string.format("failed to open socket(%s/%s)!", socktype, family)
end
end
-- open tcp socket
function socket.tcp(opt)
opt = opt or {}
return socket.open(socket.TCP, opt.family or socket.IPV4)
end
-- open udp socket
function socket.udp(opt)
opt = opt or {}
return socket.open(socket.UDP, opt.family or socket.IPV4)
end
-- open unix socket
function socket.unix(opt)
return socket.open(socket.TCP, socket.UNIX)
end
-- open and bind tcp socket
function socket.bind(addr, port, opt)
local sock, errors = socket.tcp(opt)
if not sock then
return nil, errors
end
local ok, errors = sock:bind(addr, port)
if not ok then
sock:close()
return nil, string.format("bind %s:%s failed, %s!", addr, port, errors or "unknown reason")
end
return sock
end
-- open and bind tcp socket from the unix address
function socket.bind_unix(addr, opt)
local sock, errors = socket.unix(opt)
if not sock then
return nil, errors
end
local ok, errors = sock:bind_unix(addr, opt)
if not ok then
sock:close()
return nil, string.format("bind unix://%s failed, %s!", addr, errors or "unknown reason")
end
return sock
end
-- open and connect tcp socket
function socket.connect(addr, port, opt)
local sock, errors = socket.tcp(opt)
if not sock then
return nil, errors
end
local ok, errors = sock:connect(addr, port, opt)
if ok <= 0 then
sock:close()
return nil, errors
end
return sock
end
-- open and connect tcp socket from the unix address
function socket.connect_unix(addr, opt)
local sock, errors = socket.unix(opt)
if not sock then
return nil, errors
end
local ok, errors = sock:connect_unix(addr, opt)
if ok <= 0 then
sock:close()
return nil, errors
end
return sock
end
-- return module
return socket
|
--
-- util_ts_client.lua
--
g_Root = getRootElement()
g_ResRoot = getResourceRootElement(getThisResource())
g_Me = getLocalPlayer()
-----------------------------
-- Debug
function outputDebug( chan, msg )
if _DEBUG_LOG then
if not msg then
msg = chan
chan = 'UNDEF'
end
if table.find(_DEBUG_LOG,chan) then
outputConsole( getTickTimeStr() .. ' cDEBUG_rts: ' .. msg )
outputDebugString( getTickTimeStr() .. ' cDEBUG_rts: ' .. msg )
end
end
if g_bPipeDebug then
outputConsole( getTickTimeStr() .. ' cDEBUG_rts: ' .. (msg or chan) )
end
end
function outputWarning( msg )
outputConsole( getTickTimeStr() .. ' cWARNING_rts: ' .. msg )
outputDebugString( getTickTimeStr() .. ' cWARNING_rts: ' .. msg )
end
-----------------------------
-- Table extensions
function table.removevalue(t, val)
for i,v in ipairs(t) do
if v == val then
table.remove(t, i)
return i
end
end
return false
end
|
require "Window"
local IconTrigger = {}
IconTrigger .__index = IconTrigger
setmetatable(IconTrigger, {
__call = function (cls, ...)
return cls.new(...)
end,
})
local function IndexOf(table, item)
for idx, val in pairs(table) do
if item == val then
return idx
end
end
end
local function CatchError(func, val)
if not func then return end
local status, result = pcall(func, val)
if not status then
Print("[AuraMastery] An error has occured")
Print(result)
else
return result
end
end
function IconTrigger.new(icon, buffWatch)
local self = setmetatable({}, IconTrigger)
self.buffWatch = buffWatch
self.Name = ""
self.Type = "Cooldown"
self.Behaviour = "Pass"
self.TriggerDetails = {
SpellName = "",
Charges = {
Enabled = false,
Operator = "==",
Value = 1
}
}
self.TriggerEffects = {}
self.Icon = icon
self.isSet = false
self.lastKeypress = 0
self.Time = 0
self.Stacks = 0
self.LastEvent = 0
self.cachedScripts = {}
self.Units = {}
return self
end
function IconTrigger:Load(saveData)
if saveData ~= nil then
self.Name = (not string.match(saveData.Name, "Trigger ([0-9]+)")) and saveData.Name or ""
self.Type = saveData.Type
self.Behaviour = saveData.Behaviour or "Pass"
self.TriggerDetails = saveData.TriggerDetails
if self.Type == "Buff" or self.Type == "Debuff" then
if not self.TriggerDetails.Stacks then
self.TriggerDetails.Stacks = {
Enabled = false,
Operator = "==",
Value = 0
}
end
elseif self.Type == "Cooldown" then
if not self.TriggerDetails.Charges then
self.TriggerDetails.Charges = {
Enabled = false,
Operator = "==",
Value = 0
}
end
elseif self.Type == "Keybind" then
if self.TriggerDetails.Key ~= nil then
self.TriggerDetails.Input = {
Key = self.TriggerDetails.Key,
Shift = false,
Control = false,
Alt = false
}
self.TriggerDetails.Key = nil
end
elseif self.Type == "Scriptable" then
if not self.TriggerDetails.InitScript then
self.TriggerDetails.InitScript = ""
end
if not self.TriggerDetails.CleanupScript then
self.TriggerDetails.CleanupScript = ""
end
if not self.TriggerDetails.Forms then
self.TriggerDetails.Forms = {}
end
if not self.TriggerDetails.Events then
self.TriggerDetails.Events = {}
end
end
if saveData.TriggerEffects ~= nil then
GeminiPackages:Require('AuraMastery:TriggerEffect', function(TriggerEffect)
for _, triggerEffectData in pairs(saveData.TriggerEffects) do
local triggerEffect = TriggerEffect.new(self)
triggerEffect:Load(triggerEffectData)
table.insert(self.TriggerEffects, triggerEffect)
end
end)
end
self:AddToBuffWatch()
end
end
function IconTrigger:Save()
local saveData = { }
saveData.Name = self.Name
saveData.Type = self.Type
saveData.Behaviour = self.Behaviour
saveData.TriggerDetails = self.TriggerDetails
saveData.TriggerEffects = {}
for _, triggerEffect in pairs(self.TriggerEffects) do
table.insert(saveData.TriggerEffects, triggerEffect:Save())
end
return saveData
end
function IconTrigger:SetConfig(editor)
self:RemoveFromBuffWatch()
if self.Icon.SimpleMode then
self.Type = string.sub(editor:FindChild("AuraType"):GetData():GetName(), 10)
self.Name = self.Type .. ":" .. self.Icon.iconName
if self.Type == "Cooldown" then
self.TriggerDetails = {
SpellName = self.Icon.iconName,
Charges = {
Enabled = false,
Operator = "==",
Value = 0
}
}
elseif self.Type == "Buff" then
self.TriggerDetails = {
BuffName = self.Icon.iconName,
Target = {
Player = editor:FindChild("AuraBuffUnit_Player"):IsChecked(),
Target = editor:FindChild("AuraBuffUnit_Target"):IsChecked()
},
Stacks = {
Enabled = false,
Operator = "==",
Value = 0
}
}
elseif self.Type == "Debuff" then
self.TriggerDetails = {
DebuffName = self.Icon.iconName,
Target = {
Player = editor:FindChild("AuraBuffUnit_Player"):IsChecked(),
Target = editor:FindChild("AuraBuffUnit_Target"):IsChecked()
},
Stacks = {
Enabled = false,
Operator = "==",
Value = 0
}
}
end
else
self.Name = editor:FindChild("TriggerName"):GetText()
self.Type = editor:FindChild("TriggerType"):GetText()
self.Behaviour = editor:FindChild("TriggerBehaviour"):GetText()
local selectedTriggerEffectItem = editor:FindChild("TriggerEffectsList"):GetData()
if selectedTriggerEffectItem ~= nil and selectedTriggerEffectItem:GetData() ~= nil then
selectedTriggerEffectItem:GetData():SetConfig(editor:FindChild("TriggerEffects"))
end
if self.Type == "Action Set" then
self.TriggerDetails = {
ActionSets = {
editor:FindChild("ActionSet1"):IsChecked(),
editor:FindChild("ActionSet2"):IsChecked(),
editor:FindChild("ActionSet3"):IsChecked(),
editor:FindChild("ActionSet4"):IsChecked()
}
}
elseif self.Type == "Cooldown" then
self.TriggerDetails = {
SpellName = editor:FindChild("SpellName"):GetText(),
Charges = {
Enabled = editor:FindChild("ChargesEnabled"):IsChecked(),
Operator = editor:FindChild("Charges"):FindChild("Operator"):GetText(),
Value = tonumber(editor:FindChild("Charges"):FindChild("ChargesValue"):GetText())
}
}
elseif self.Type == "Buff" then
self.TriggerDetails = {
BuffName = editor:FindChild("BuffName"):GetText(),
Target = {
Player = editor:FindChild("TargetPlayer"):IsChecked(),
Target = editor:FindChild("TargetTarget"):IsChecked(),
TargetOfTarget = editor:FindChild("TargetTargetOfTarget"):IsChecked(),
FocusTarget = editor:FindChild("TargetFocusTarget"):IsChecked(),
FocusTargetTarget = editor:FindChild("TargetFocusTargetTarget"):IsChecked(),
Tank = editor:FindChild("TargetTank"):IsChecked(),
Healer = editor:FindChild("TargetHealer"):IsChecked(),
DPS = editor:FindChild("TargetDPS"):IsChecked(),
Friendly = editor:FindChild("TargetFriendly"):IsChecked(),
Hostile = editor:FindChild("TargetHostile"):IsChecked(),
Named = editor:FindChild("TargetNamed"):IsChecked(),
NamedUnit = editor:FindChild("TargetNamedUnit"):GetText()
},
Stacks = {
Enabled = editor:FindChild("StacksEnabled"):IsChecked(),
Operator = editor:FindChild("Stacks"):FindChild("Operator"):GetText(),
Value = tonumber(editor:FindChild("Stacks"):FindChild("StacksValue"):GetText())
}
}
elseif self.Type == "Debuff" then
self.TriggerDetails = {
DebuffName = editor:FindChild("DebuffName"):GetText(),
Target = {
Player = editor:FindChild("TargetPlayer"):IsChecked(),
Target = editor:FindChild("TargetTarget"):IsChecked(),
TargetOfTarget = editor:FindChild("TargetTargetOfTarget"):IsChecked(),
FocusTarget = editor:FindChild("TargetFocusTarget"):IsChecked(),
FocusTargetTarget = editor:FindChild("TargetFocusTargetTarget"):IsChecked(),
Tank = editor:FindChild("TargetTank"):IsChecked(),
Healer = editor:FindChild("TargetHealer"):IsChecked(),
DPS = editor:FindChild("TargetDPS"):IsChecked(),
Friendly = editor:FindChild("TargetFriendly"):IsChecked(),
Hostile = editor:FindChild("TargetHostile"):IsChecked(),
Named = editor:FindChild("TargetNamed"):IsChecked(),
NamedUnit = editor:FindChild("TargetNamedUnit"):GetText()
},
Stacks = {
Enabled = editor:FindChild("StacksEnabled"):IsChecked(),
Operator = editor:FindChild("Stacks"):FindChild("Operator"):GetText(),
Value = tonumber(editor:FindChild("Stacks"):FindChild("StacksValue"):GetText())
}
}
elseif self.Type == "Resources" then
self.TriggerDetails = { }
if editor:FindChild("ManaEnabled"):IsChecked() then
local resourceEditor = editor:FindChild("Mana")
self.TriggerDetails.Mana = {
Operator = resourceEditor:FindChild("Operator"):GetText(),
Value = tonumber(resourceEditor:FindChild("Value"):GetText()) or 0,
Percent = resourceEditor:FindChild("Percent"):IsChecked()
}
end
if editor:FindChild("ResourceEnabled"):IsChecked() then
local resourceEditor = editor:FindChild("Resource")
self.TriggerDetails.Resource = {
Operator = resourceEditor:FindChild("Operator"):GetText(),
Value = tonumber(resourceEditor:FindChild("Value"):GetText()) or 0,
Percent = resourceEditor:FindChild("Percent"):IsChecked()
}
end
elseif self.Type == "Health" then
self.TriggerDetails = {
Target = {
Player = editor:FindChild("TargetPlayer"):IsChecked(),
Target = editor:FindChild("TargetTarget"):IsChecked(),
TargetOfTarget = editor:FindChild("TargetTargetOfTarget"):IsChecked(),
FocusTarget = editor:FindChild("TargetFocusTarget"):IsChecked(),
FocusTargetTarget = editor:FindChild("TargetFocusTargetTarget"):IsChecked(),
Tank = editor:FindChild("TargetTank"):IsChecked(),
Healer = editor:FindChild("TargetHealer"):IsChecked(),
DPS = editor:FindChild("TargetDPS"):IsChecked(),
Friendly = editor:FindChild("TargetFriendly"):IsChecked(),
Hostile = editor:FindChild("TargetHostile"):IsChecked(),
Named = editor:FindChild("TargetNamed"):IsChecked(),
NamedUnit = editor:FindChild("TargetNamedUnit"):GetText()
},
}
if editor:FindChild("HealthEnabled"):IsChecked() then
local resourceEditor = editor:FindChild("Health")
self.TriggerDetails.Health = {
Operator = resourceEditor:FindChild("Operator"):GetText(),
Value = tonumber(resourceEditor:FindChild("Value"):GetText()) or 0,
Percent = resourceEditor:FindChild("Percent"):IsChecked()
}
end
if editor:FindChild("ShieldEnabled"):IsChecked() then
local resourceEditor = editor:FindChild("Shield")
self.TriggerDetails.Shield = {
Operator = resourceEditor:FindChild("Operator"):GetText(),
Value = tonumber(resourceEditor:FindChild("Value"):GetText()) or 0,
Percent = resourceEditor:FindChild("Percent"):IsChecked()
}
end
elseif self.Type == "Moment Of Opportunity" then
self.TriggerDetails = {
Target = {
Player = editor:FindChild("TargetPlayer"):IsChecked(),
Target = editor:FindChild("TargetTarget"):IsChecked()
}
}
elseif self.Type == "Limited Action Set Checker" then
self.TriggerDetails = {
AbilityName = editor:FindChild("AbilityName"):GetText()
}
elseif self.Type == "Scriptable" then
local forms = self.TriggerDetails.Forms or {}
self.TriggerDetails = {
InitScript = editor:FindChild("InitScript"):GetText(),
CleanupScript = editor:FindChild("CleanupScript"):GetText(),
Script = editor:FindChild("Script"):GetText(),
Forms = forms
}
self:EnsureScriptValid("", self.TriggerDetails.Script, editor)
self:EnsureScriptValid("Init", self.TriggerDetails.InitScript, editor)
self:EnsureScriptValid("Cleanup", self.TriggerDetails.CleanupScript, editor)
elseif self.Type == "Keybind" then
self.TriggerDetails = {
Input = editor:FindChild("KeybindTracker_KeySelect"):GetData(),
Duration = tonumber(editor:FindChild("KeybindTracker_Duration"):GetText()) or 1
}
editor:FindChild("KeybindTracker_Duration"):SetText(tostring(self.TriggerDetails.Duration))
elseif self.Type == "Gadget" then
self.TriggerDetails = {
Charges = {
Enabled = false,
Operator = "==",
Value = 0
}
}
elseif self.Type == "Cast" then
self.TriggerDetails = {
SpellName = editor:FindChild("SpellName"):GetText(),
Target = {
Player = editor:FindChild("TargetPlayer"):IsChecked(),
Target = editor:FindChild("TargetTarget"):IsChecked(),
FocusTarget = editor:FindChild("TargetFocusTarget"):IsChecked(),
Named = editor:FindChild("TargetNamed"):IsChecked(),
NamedUnit = editor:FindChild("TargetNamedUnit"):GetText()
},
}
elseif self.Type == "ICD" then
self.TriggerDetails = {
SpellName = editor:FindChild("SpellName"):GetText(),
Duration = tonumber(editor:FindChild("Duration"):GetText()),
EventType = editor:FindChild("EventType"):GetData(),
Target = {
Player = editor:FindChild("TargetPlayer"):IsChecked(),
Target = editor:FindChild("TargetTarget"):IsChecked(),
FocusTarget = editor:FindChild("TargetFocusTarget"):IsChecked(),
},
}
end
end
self:AddToBuffWatch()
end
function IconTrigger:ParseScript(scriptText)
if not scriptText then return end
local script, error = loadstring("local trigger = ...\n" .. scriptText)
return script, error
end
function IconTrigger:EnsureScriptValid(key, script, editor)
editor:FindChild(key .. "ScriptErrors"):SetText("")
local script, error = self:ParseScript(script)
if not script then
editor:FindChild(key .. "ScriptErrors"):SetText(error)
end
end
function IconTrigger:RemoveEffect(effect)
for triggerId, triggerEffect in pairs(self.TriggerEffects) do
if triggerEffect == effect then
table.remove(self.TriggerEffects, triggerId)
break
end
end
end
function IconTrigger:AddUnit(unit)
if unit ~= nil then
self.Units[unit:GetId()] = { Unit = unit }
end
end
function IconTrigger:RemoveUnit(unit)
if unit ~= nil and unit:GetId() ~= nil then
self.Units[unit:GetId()] = nil
end
end
function IconTrigger:AddToBuffWatch()
self.Units = {}
if self.Type == "Cooldown" then
self.currentSpell = self.TriggerDetails.SpellName == "" and self.Icon.iconName or self.TriggerDetails.SpellName
self:AddCooldownToBuffWatch(self.currentSpell)
elseif self.Type == "Buff" or self.Type == "Debuff" then
Print("Add: " .. self.Icon.iconName)
self.buffName = self.Type == "Buff" and self.TriggerDetails.BuffName or self.TriggerDetails.DebuffName
if self.buffName == "" then
self.buffName = self.Icon.iconName
end
for target, val in pairs(self.TriggerDetails.Target) do
if val then
if target == "Named" then
elseif target == "NamedUnit" then
self:AddBuffToBuffWatch(val, self.buffName)
else
self:AddBuffToBuffWatch(target, self.buffName)
end
end
end
elseif self.Type == "On Critical" or self.Type == "On Deflect" or self.Type == "Action Set" or self.Type == "Resources" or self.Type == "Gadget" then
self:AddBasicToBuffWatch()
elseif self.Type == "Health" or self.Type == "Moment Of Opportunity" then
for target, val in pairs(self.TriggerDetails.Target) do
if val then
if target == "Named" then
elseif target == "NamedUnit" then
self:AddCooldownToBuffWatch(val)
else
self:AddCooldownToBuffWatch(target)
end
end
end
elseif self.Type == "Keybind" then
self:AddCooldownToBuffWatch(self.TriggerDetails.Input.Key)
elseif self.Type == "Limited Action Set Checker" then
self.currentSpell = self.TriggerDetails.AbilityName == "" and self.Icon.iconName or self.TriggerDetails.AbilityName
self:AddCooldownToBuffWatch(self.currentSpell)
elseif self.Type == "Cast" then
Apollo.RegisterEventHandler("UnitCreated", "OnUnitCreated", self)
Apollo.RegisterEventHandler("UnitDestroyed", "OnUnitDestroyed", self)
if self.TriggerDetails.Target.Player then
self:AddUnit(GameLib.GetPlayerUnit())
end
if self.TriggerDetails.Target.Target then
local target = GameLib.GetTargetUnit()
if target ~= nil then
self:OnTargetChanged(target)
end
Apollo.RegisterEventHandler("TargetUnitChanged", "OnTargetChanged", self)
end
if self.TriggerDetails.Target.FocusTarget then
local focus = GameLib.GetPlayerUnit():GetAlternateTarget()
if focus ~= nil then
self:OnAlternateTargetUnitChanged(focus)
end
Apollo.RegisterEventHandler("AlternateTargetUnitChanged", "OnAlternateTargetUnitChanged", self)
end
elseif self.Type == "ICD" then
if self.TriggerDetails.EventType == "DamageDone" then
Apollo.RegisterEventHandler("CombatLogDamage", "OnICDDamageDone", self)
elseif self.TriggerDetails.EventType == "HealingDone" then
Apollo.RegisterEventHandler("CombatLogHeal", "OnICDDamageDone", self)
elseif self.TriggerDetails.EventType == "Buff" or self.TriggerDetails.EventType == "Debuff" then
Apollo.RegisterEventHandler("BuffAdded", "OnICDBuff", self)
elseif self.TriggerDetails.EventType == "ResourceGain" then
Apollo.RegisterEventHandler("CombatLogVitalModifier", "OnICDResourceGain", self)
end
elseif self.Type == "Scriptable" then
if self.TriggerDetails.Forms == nil then
self.TriggerDetails.Forms = {}
end
self.cachedScripts = {
Init = self:ParseScript(self.TriggerDetails.InitScript),
Cleanup = self:ParseScript(self.TriggerDetails.CleanupScript),
Update = self:ParseScript(self.TriggerDetails.Script)
}
local formString = "<Forms>"
for _, form in pairs(self.TriggerDetails.Forms) do
formString = formString .. form.Text
end
formString = formString .. "</Forms>"
local xmlDoc = XmlDoc.new()
xmlDoc:AddLine(formString)
self.xmlDoc = XmlDoc.CreateFromTable(xmlDoc:ToTable()[1][1][1])
CatchError(self.cachedScripts.Init, self)
end
end
function IconTrigger:OnICDDamageDone(data)
CatchError(function()
if data.unitCaster ~= nil and data.unitCaster:IsThePlayer() then
local spell = data.splCallingSpell
local spellName = self.TriggerDetails.SpellName == "" and self.Icon.iconName or self.TriggerDetails.SpellName
if spell:GetName() == spellName or spell:GetId() == spellName then
self.LastEvent = os.clock()
end
end
end)
end
function IconTrigger:OnICDBuff(unit, buff)
CatchError(function()
if unit:IsThePlayer() then
local spell = buff.splEffect
local spellName = self.TriggerDetails.SpellName == "" and self.Icon.iconName or self.TriggerDetails.SpellName
if (spell:GetName() == spellName or spell:GetId() == spellName) and spell:IsBeneficial() == (self.TriggerDetails.EventType == "Buff") then
self.LastEvent = os.clock()
end
end
end)
end
function IconTrigger:OnICDResourceGain(data)
CatchError(function()
if data.unitCaster:IsThePlayer() then
local spell = data.splCallingSpell
local spellName = self.TriggerDetails.SpellName == "" and self.Icon.iconName or self.TriggerDetails.SpellName
if spell:GetName() == spellName or spell:GetId() == spellName then
self.LastEvent = os.clock()
end
end
end)
end
function IconTrigger:AddCooldownToBuffWatch(option)
local triggerType = string.gsub(self.Type, " ", "")
if self.buffWatch[triggerType][option] == nil then
self.buffWatch[triggerType][option] = {}
end
self.buffWatch[triggerType][option][tostring(self)] = function(result) self:ProcessOptionEvent(result) end
end
function IconTrigger:AddBasicToBuffWatch()
local triggerType = string.gsub(self.Type, " ", "")
if self.buffWatch[triggerType] == nil then
self.buffWatch[triggerType] = {}
end
self.buffWatch[triggerType][tostring(self)] = function(result) self:ProcessEvent(result) end
end
function IconTrigger:AddBuffToBuffWatch(target, option)
local triggerType = string.gsub(self.Type, " ", "")
if self.buffWatch[triggerType][target] == nil then
self.buffWatch[triggerType][target] = {}
end
if self.buffWatch[triggerType][target][option] == nil then
self.buffWatch[triggerType][target][option] = {}
end
self.buffWatch[triggerType][target][option][tostring(self)] = function(spell) self:ProcessBuff(spell) end
table.insert(self.buffWatch.Refresh, { Type = triggerType, Target = target })
end
function IconTrigger:RemoveFromBuffWatch()
if self.Type == "Cooldown" or self.Type == "Limited Action Set Checker" then
self:RemoveCooldownFromBuffWatch(self.currentSpell)
elseif self.Type == "Buff" or self.Type == "Debuff" then
Print("Remove: " .. self.Icon.iconName)
if self.TriggerDetails.Target.Player then
self:RemoveBuffFromBuffWatch("Player", self.buffName)
end
if self.TriggerDetails.Target.Target then
self:RemoveBuffFromBuffWatch("Target", self.buffName)
end
elseif self.Type == "On Critical" or self.Type == "On Deflect" or self.Type == "Action Set" or self.Type == "Resources" or self.Type == "Gadget" then
self:RemoveBasicFromBuffWatch()
elseif self.Type == "Health" or self.Type == "Moment Of Opportunity" then
if self.TriggerDetails.Target.Player then
self:RemoveCooldownFromBuffWatch("Player")
end
if self.TriggerDetails.Target.Target then
self:RemoveCooldownFromBuffWatch("Target")
end
elseif self.Type == "Keybind" then
self:RemoveCooldownFromBuffWatch(self.TriggerDetails.Input.Key)
elseif self.Type == "Scriptable" then
CatchError(self.cachedScripts.Cleanup, self)
end
Apollo.RemoveEventHandler("TargetUnitChanged", self)
Apollo.RemoveEventHandler("AlternateTargetUnitChanged", self)
Apollo.RemoveEventHandler("UnitCreated", self)
Apollo.RemoveEventHandler("UnitDestroyed", self)
Apollo.RemoveEventHandler("CombatLogDamage", self)
Apollo.RemoveEventHandler("CombatLogHeal", self)
end
function IconTrigger:RemoveBasicFromBuffWatch()
local triggerType = string.gsub(self.Type, " ", "")
if self.buffWatch[triggerType] ~= nil then
self.buffWatch[triggerType][tostring(self)] = nil
end
end
function IconTrigger:RemoveCooldownFromBuffWatch(option)
local triggerType = string.gsub(self.Type, " ", "")
if self.buffWatch[triggerType][option] ~= nil then
self.buffWatch[triggerType][option][tostring(self)] = nil
end
end
function IconTrigger:RemoveBuffFromBuffWatch(target, option)
local triggerType = string.gsub(self.Type, " ", "")
if self.buffWatch[triggerType][target][option] ~= nil then
self.buffWatch[triggerType][target][option][tostring(self)] = nil
end
end
function IconTrigger:ResetTrigger(deltaTime)
-- for _, u in pairs(self.Units) do
-- for _, b in pairs(u.Buffs) do
-- b.fTimeRemaining = b.fTimeRemaining - deltaTime
-- end
-- end
if self.Type == "Buff" or self.Type == "Debuff" then
if self.Time == nil then
self.Time = 0
end
self.Time = math.max(self.Time - deltaTime, 0)
return
end
self.Stacks = nil
self.Time = nil
if self.Type ~= "Action Set" and self.Type ~= "Limited Action Set Checker" and self.Type ~= "Health" then
self.isSet = false
end
if self.Type == "Health" then
for key, target in pairs(self.Units) do
if (target.LastUpdate or 0) > 1 then
local unit = target.Unit
local data = {
Action = "Update",
Id = key,
Unit = unit,
Health = unit:GetHealth(),
MaxHealth = unit:GetMaxHealth(),
Shield = unit:GetShieldCapacity(),
MaxShield = unit:GetShieldCapacityMax()
}
self:ProcessHealth(data)
target.LastUpdate = 0
else
target.LastUpdate = (target.LastUpdate or 0) + deltaTime
end
end
elseif self.Type == "Cast" then
for _, unit in pairs(self.Units) do
if unit.Unit:GetCastName() == (self.TriggerDetails.SpellName == "" and self.Icon.iconName or self.TriggerDetails.SpellName) then
self.MaxDuration = unit.Unit:GetCastDuration() / 1000
self.Time = self.MaxDuration - (unit.Unit:GetCastElapsed() / 1000)
self.isSet = self.Time > 0
end
end
end
end
function IconTrigger:OnUnitCreated(unit)
if (self.TriggerDetails.Target and unit == GameLib.GetTargetUnit()) then
return self:OnTargetChanged(nil)
end
if (self.TriggerDetails.FocusTarget and unit == GameLib.GetPlayerUnit():GetAlternateTarget()) then
return self:OnAlternateTargetUnitChanged(nil)
end
local disposition = unit:GetDispositionTo(GameLib.GetPlayerUnit())
if (self.TriggerDetails.Player and unit:IsThePlayer()) or
(self.TriggerDetails.Friendly and disposition == Unit.CodeEnumDisposition.Friendly) or
(self.TriggerDetails.Hostile and disposition ~= Unit.CodeEnumDisposition.Friendly) or
(self.TriggerDetails.Named and unit:GetName() == self.TriggerDetails.NamedUnit) then
self:AddUnit(unit)
end
end
function IconTrigger:OnUnitDestroyed(unit)
if (self.TriggerDetails.Target and unit == GameLib.GetTargetUnit()) then
return self:OnTargetChanged(nil)
end
if (self.TriggerDetails.FocusTarget and unit == GameLib.GetPlayerUnit():GetAlternateTarget()) then
return self:OnAlternateTargetUnitChanged(nil)
end
local disposition = unit:GetDispositionTo(GameLib.GetPlayerUnit())
if (self.TriggerDetails.Player and unit:IsThePlayer()) or
(self.TriggerDetails.Friendly and disposition == Unit.CodeEnumDisposition.Friendly) or
(self.TriggerDetails.Hostile and disposition ~= Unit.CodeEnumDisposition.Friendly) or
(self.TriggerDetails.Named and unit:GetName() == self.TriggerDetails.NamedUnit) then
self:RemoveUnit(unit)
end
end
function IconTrigger:OnTargetChanged(unit)
if self.targetUnit ~= nil then
self:RemoveUnit(self.targetUnit)
end
if unit ~= nil then
self:AddUnit(unit)
end
self.targetUnit = unit
end
function IconTrigger:OnAlternateTargetUnitChanged(unit)
if self.focusTarget ~= nil then
self:RemoveUnit(self.focusTarget)
end
if unit ~= nil then
self:AddUnit(unit)
end
self.focusTarget = unit
end
function IconTrigger:GetTargets()
local targets = {}
if self.TriggerDetails.Player then
table.insert(targets, GameLib.GetPlayerUnit())
end
if self.TriggerDetails.Target then
table.insert(targets, GameLib.GetTargetUnit())
end
if self.TriggerDetails.TargetOfTarget then
table.insert(targets, GameLib.GetPlayerUnit())
end
if self.TriggerDetails.FocusTarget then
table.insert(targets, GameLib.GetPlayerUnit())
end
if self.TriggerDetails.Player then
table.insert(targets, GameLib.GetPlayerUnit())
end
if self.TriggerDetails.Player then
table.insert(targets, GameLib.GetPlayerUnit())
end
end
function IconTrigger:IsPass()
if self.Behaviour == "Pass" then
return self.isSet
elseif self.Behaviour == "Fail" then
return not self.isSet
elseif self.Behaviour == "Ignore" then
return true
end
return false
end
function IconTrigger:IsSet()
if self.Type == "Scriptable" then
self:ProcessScriptable()
elseif self.Type == "Keybind" then
local timeSinceKeypress = (Apollo.GetTickCount() - self.lastKeypress) / 1000
self.isSet = timeSinceKeypress < self.TriggerDetails.Duration
if self.isSet then
self.Time = self.TriggerDetails.Duration - timeSinceKeypress
self.MaxDuration = self.TriggerDetails.Duration
end
elseif self.Type == "ICD" then
local currentTime = os.clock()
local activeTime = self.TriggerDetails.Duration
if self.LastEvent + activeTime > currentTime then
self.isSet = true
self.Time = (self.LastEvent + activeTime) - currentTime
self.MaxDuration = activeTime
end
end
self.isPass = self:IsPass()
return self.isPass
end
function IconTrigger:ProcessEffects()
for _, triggerEffect in pairs(self.TriggerEffects) do
triggerEffect:Update(self.isPass)
end
end
function IconTrigger:StopEffects()
for _, triggerEffect in pairs(self.TriggerEffects) do
triggerEffect:EndTimed()
end
end
function IconTrigger:GetSpellCooldown(spell)
local charges = spell:GetAbilityCharges()
if charges and charges.nChargesMax > 0 then
return charges.fRechargePercentRemaining * charges.fRechargeTime, charges.fRechargeTime, charges.nChargesRemaining, charges.nChargesMax
else
return spell:GetCooldownRemaining(), spell:GetCooldownTime(), 0, 0
end
end
function IconTrigger:ProcessScriptable()
local script = loadstring("local trigger = ...\n" .. self.TriggerDetails.Script)
if script ~= nil then
local status, result = pcall(script, self)
if status then
self.isSet = result
end
end
end
function IconTrigger:ProcessOptionEvent(result)
if self.Type == "Cooldown" then
self:ProcessSpell(result)
elseif self.Type == "Health" then
self:ProcessHealth(result)
elseif self.Type == "Moment Of Opportunity" then
self:ProcessMOO(result)
elseif self.Type == "Keybind" then
self:ProcessKeybind(result)
elseif self.Type == "Limited Action Set Checker" then
self:ProcessLASChange(result)
end
end
function IconTrigger:ProcessSpell(spell)
local cdRemaining, cdTotal, chargesRemaining, chargesMax = self:GetSpellCooldown(spell)
self.Charges = chargesRemaining
self.Sprite = spell:GetIcon()
if not (self.Time and self.Time > cdRemaining) then
self.Time = cdRemaining
self.MaxDuration = math.max(cdRemaining, cdTotal)
self.MaxCharges = chargesMax
if ((not self.TriggerDetails.Charges.Enabled) and (cdRemaining == 0 or chargesRemaining > 0))
or (self.TriggerDetails.Charges.Enabled and self:IsOperatorSatisfied(chargesRemaining, self.TriggerDetails.Charges.Operator, self.TriggerDetails.Charges.Value)) then
self.isSet = false
if cdRemaining == 0 then
self.Time = 0
end
else
self.isSet = true
end
end
end
local function HasProperties(table)
for key, val in pairs(table) do
if val ~= nil then
return true
end
end
return false
end
local function First(table)
for k, v in pairs(table) do
if v ~= nil then
return v
end
end
end
function IconTrigger:RemoveBuffFromTarget(unit, buff)
local unitId = unit:GetId()
if buff ~= nil then
self.Units[unitId].Buffs[buff.idBuff] = nil
if not HasProperties(self.Units[unitId].Buffs) then
self.Units[unitId] = nil
end
else
self.Units[unitId] = nil
end
end
function IconTrigger:ProcessBuff(data)
local action = data.action
local buff = data.data
local unitId = data.unit:GetId()
if action == "Remove" then
if data.unit == nil then
self.Units = {}
elseif self.Units[unitId] ~= nil then
self:RemoveBuffFromTarget(data.unit, buff)
end
end
if action == "Add" then
if not self.TriggerDetails.Stacks.Enabled or self:IsOperatorSatisfied(buff.nCount, self.TriggerDetails.Stacks.Operator, self.TriggerDetails.Stacks.Value) then
if self.Units[unitId] == nil then
self.Units[unitId] = { Unit = data.unit, LastUpdate = 0, Buffs = {} }
end
buff.LastUpdate = os.clock()
self.Units[unitId].Buffs[buff.idBuff] = buff
else
self.Units[unitId] = nil
end
end
self.isSet = HasProperties(self.Units)
local firstTarget = First(self.Units)
if firstTarget ~= nil then
local firstBuff = First(firstTarget.Buffs)
if firstBuff ~= nil then
self.Time = firstBuff.fTimeRemaining - (os.clock() - firstBuff.LastUpdate)
self.Stacks = firstBuff.nCount
if self.MaxDuration == nil or self.MaxDuration < self.Time then
self.MaxDuration = self.Time
end
self.Sprite = buff.splEffect:GetIcon()
if self.Time < 0 then
self.Units = {}
self.isSet = false
end
end
end
end
function IconTrigger:ProcessEvent(result)
if self.Type == "Action Set" then
self.isSet = self.TriggerDetails.ActionSets[result]
elseif self.Type == "Resources" then
return self:ProcessResources(result)
elseif self.Type == "Gadget" then
self:ProcessSpell(result)
else
self.isSet = true
end
end
function IconTrigger:ProcessResources(result)
self.isSet = true
if self.TriggerDetails["Mana"] ~= nil then
self.isSet = self.isSet and self:ProcessResource(self.TriggerDetails.Mana, result.Mana, result.MaxMana)
end
if self.TriggerDetails["Resource"] ~= nil then
self.isSet = self.isSet and self:ProcessResource(self.TriggerDetails.Resource, result.Resource, result.MaxResource)
end
self.Resources = result
end
function IconTrigger:ProcessHealth(result)
local isSet = (result.Action == "Update")
if result.Action == "Update" then
if self.TriggerDetails["Health"] ~= nil then
isSet = isSet and self:ProcessResource(self.TriggerDetails.Health, result.Health, result.MaxHealth)
end
if self.TriggerDetails["Shield"] ~= nil then
isSet = isSet and self:ProcessResource(self.TriggerDetails.Shield, result.Shield, result.MaxShield)
end
end
if isSet then
self.Units[result.Id] = { Unit = result.Unit, LastUpdate = 0, Buffs = {} }
else
self.Units[result.Id] = nil
end
self.isSet = HasProperties(self.Units)
end
function IconTrigger:ProcessResource(operation, resource, maxResource)
local resourceValue = 0
if resource ~= nil then
if operation.Percent then
resourceValue = (resource / maxResource) * 100
else
resourceValue = resource
end
if operation.Operator == "==" then
return resourceValue == operation.Value
elseif operation.Operator == "!=" then
return resourceValue ~= operation.Value
elseif operation.Operator == ">" then
return resourceValue > operation.Value
elseif operation.Operator == "<" then
return resourceValue < operation.Value
elseif operation.Operator == ">=" then
return resourceValue >= operation.Value
elseif operation.Operator == "<=" then
return resourceValue <= operation.Value
end
end
end
function IconTrigger:ProcessMOO(result)
if result.TimeRemaining > 0 then
self.isSet = true
self.Time = result.TimeRemaining
if self.MaxDuration == nil or self.MaxDuration < self.Time then
self.MaxDuration = self.Time
end
else
self.MaxDuration = nil
end
end
function IconTrigger:ProcessKeybind(iKey)
if (self.TriggerDetails.Input.Shift and not Apollo.IsShiftKeyDown()) or
(self.TriggerDetails.Input.Control and not Apollo.IsControlKeyDown()) or
(self.TriggerDetails.Input.Alt and not Apollo.IsAltKeyDown()) then
return
end
self.lastKeypress = Apollo.GetTickCount()
end
function IconTrigger:ProcessLASChange(result)
self.isSet = result
end
function IconTrigger:IsOperatorSatisfied(value, operator, compValue)
if operator == "==" then
return value == compValue
elseif operator == "!=" then
return value ~= compValue
elseif operator == ">" then
return value > compValue
elseif operator == "<" then
return value < compValue
elseif operator == ">=" then
return value >= compValue
elseif operator == "<=" then
return value <= compValue
end
end
function IconTrigger:GetTargets()
if self.isSet then
return self.Units
-- if self.Type == "Buff" or self.Type == "Debuff" then
-- if self.TriggerDetails.Target.Player then
-- return GameLib:GetPlayerUnit()
-- elseif self.TriggerDetails.Target.Target then
-- return GameLib:GetTargetUnit()
-- end
-- else
-- return GameLib:GetPlayerUnit()
-- end
end
return nil
end
local GeminiPackages = _G["GeminiPackages"]
GeminiPackages:NewPackage(IconTrigger, "AuraMastery:IconTrigger", 1)
|
return {'pajot','pajots','pajottenland','pajottenlander','pajottenlands'}
|
local cmp_status_ok, colorizer = pcall(require, "colorizer")
if not cmp_status_ok then
return
end
-- TODO: Expand setup
colorizer.setup()
|
local package = {
make_trufflebar = require("piglets.trufflequest.trufflebar.make_trufflebar")
}
return package
|
return require('luasodium._ffi.pureffi_loader')('utils')
|
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer in your `opt` pack
vim.cmd [[packadd packer.nvim]]
-- Only if your version of Neovim doesn't have https://github.com/neovim/neovim/pull/12632 merged
--vim._update_package_paths()
return require('packer').startup(function()
-- Packer can manage itself as an optional plugin
use { 'wbthomason/packer.nvim', opt = true }
-- a great asynchronous execution library for Vim
use {
'Shougo/vimproc.vim',
run = function()
os.execute(make)
end
}
-- モジュールにする場合は、1ファイルにつき2パッケージ以上ないとエラーが出る
local module_table = {
"git", "theme", "linter", "explore", "save", "window", "completion", "lang", "util", "miscellaneous"
}
for _, path in pairs(module_table) do
use(require('plugins.' .. path))
end
end)
|
local opts = require('neoscroll.config').options
local scroll_timer = vim.loop.new_timer()
local lines_to_scroll = 0
local lines_scrolled = 0
local scrolling = false
local guicursor
-- Highlight group to hide the cursor
vim.cmd('highlight NeoscrollHiddenCursor gui=reverse blend=100')
-- Helper function to check if a number is a float
local function is_float(n)
return math.floor(math.abs(n)) ~= math.abs(n)
end
-- excecute commands to scroll screen [and cursor] up/down one line
-- `execute` is necessary to allow the use of special characters like <C-y>
-- The bang (!) `normal!` in normal ignores mappings
local function scroll_up(scroll_window, scroll_cursor)
local cursor_scroll_input = scroll_cursor and 'gk' or ''
local window_scroll_input = scroll_window and [[\<C-y>]] or ''
local scroll_input = cursor_scroll_input .. window_scroll_input
return [[exec "normal! ]] .. scroll_input .. [["]]
end
local function scroll_down(scroll_window, scroll_cursor)
local cursor_scroll_input = scroll_cursor and 'gj' or ''
local window_scroll_input = scroll_window and [[\<C-e>]] or ''
local scroll_input = cursor_scroll_input .. window_scroll_input
return [[exec "normal! ]] .. scroll_input .. [["]]
end
-- Hide cursor during scrolling for a better visual effect
local function hide_cursor()
if vim.o.termguicolors and vim.o.guicursor ~= '' then
guicursor = vim.o.guicursor
vim.o.guicursor = 'a:NeoscrollHiddenCursor'
end
end
-- Restore hidden cursor during scrolling
local function restore_cursor()
if vim.o.termguicolors and vim.o.guicursor ~= '' then
vim.o.guicursor = guicursor
end
end
local function get_lines_below_cursor()
local last_line = vim.fn.line("$")
local lines_below_cursor = 0
local line = vim.fn.line(".")
local last_folded_line = vim.fn.foldclosedend(line)
if last_folded_line ~= -1 then line = last_folded_line end
while(line < last_line) do
lines_below_cursor = lines_below_cursor + 1
line = line + 1
last_folded_line = vim.fn.foldclosedend(line)
if last_folded_line ~= -1 then line = last_folded_line end
end
return lines_below_cursor
end
-- Collect all the necessary window, buffer and cursor data
-- vim.fn.line("w0") -> if there's a fold returns first line of fold
-- vim.fn.line("w$") -> if there's a fold returns last line of fold
local function get_data(direction)
local data = {}
-- If first line/last line not visible don't do anything else
if direction < 0 then
data.win_top_line = vim.fn.line("w0")
data.first_line_visible = data.win_top_line == 1
if not data.first_line_visible then
return data
end
elseif direction > 0 then
data.win_bottom_line = vim.fn.line("w$")
data.last_line = vim.fn.line("$")
data.last_line_visible = data.win_bottom_line == data.last_line
if not data.last_line_visible then
return data
end
data.window_height = vim.api.nvim_win_get_height(0)
data.win_lines_below_cursor = data.window_height - vim.fn.winline()
data.lines_below_cursor = get_lines_below_cursor()
end
data.lines_above_cursor = vim.fn.winline() - 1
return data
end
-- Window rules for when to stop scrolling
local function window_reached_limit(data, move_cursor)
if data.last_line_visible then
if move_cursor then
if opts.stop_eof and data.lines_below_cursor == data.win_lines_below_cursor then
return true
elseif opts.respect_scrolloff
and data.lines_below_cursor <= vim.wo.scrolloff then
return true
else
return data.lines_below_cursor == 0
end
else
return data.lines_below_cursor == 0 and data.lines_above_cursor == 0
end
end
return data.first_line_visible
end
-- Cursor rules for when to stop scrolling
local function cursor_reached_limit(data)
if data.first_line_visible then
if opts.respect_scrolloff
and data.lines_above_cursor <= vim.wo.scrolloff then
return true
end
return data.lines_above_cursor == 0
elseif data.last_line_visible then
if opts.respect_scrolloff and data.lines_below_cursor <= vim.wo.scrolloff then
return true
end
return data.lines_below_cursor == 0
end
end
-- Transforms fraction of window to number of lines
local function get_lines_from_win_fraction(fraction)
local height_fraction = fraction * vim.api.nvim_win_get_height(0)
return vim.fn.float2nr(vim.fn.round(height_fraction))
end
-- Check if the window and the cursor can be scrolled further
local function who_scrolls(direction, move_cursor)
local scroll_window, scroll_cursor, data
data = get_data(direction)
scroll_window = not window_reached_limit(data, move_cursor)
if not move_cursor then
scroll_cursor = false
elseif scroll_window then
scroll_cursor = true
elseif opts.cursor_scrolls_alone then
scroll_cursor = not cursor_reached_limit(data)
else
scroll_cursor = false
end
return scroll_window, scroll_cursor
end
-- Scroll one line in the given direction
local function scroll_one_line(direction, scroll_window, scroll_cursor)
if direction > 0 then
lines_scrolled = lines_scrolled + 1
vim.cmd(scroll_down(scroll_window, scroll_cursor))
else
lines_scrolled = lines_scrolled - 1
vim.cmd(scroll_up(scroll_window, scroll_cursor))
end
end
-- Scrolling constructor
local function before_scrolling(lines, move_cursor)
-- Start scrolling
scrolling = true
-- Hide cursor line
if opts.hide_cursor and move_cursor then
hide_cursor()
end
-- Performance mode
if vim.b.neoscroll_performance_mode and move_cursor then
if vim.g.loaded_nvim_treesitter then
vim.cmd('TSBufDisable highlight')
end
vim.bo.syntax = 'OFF'
end
-- Assign number of lines to scroll
lines_to_scroll = lines
end
-- Scrolling destructor
local function finish_scrolling(move_cursor)
if opts.hide_cursor == true and move_cursor then
restore_cursor()
end
--Performance mode
if vim.b.neoscroll_performance_mode and move_cursor then
vim.bo.syntax = 'ON'
if vim.g.loaded_nvim_treesitter then
vim.cmd('TSBufEnable highlight')
end
end
lines_scrolled = 0
lines_to_scroll = 0
scroll_timer:stop()
scrolling = false
end
local neoscroll = {}
-- Scrolling function
-- lines: number of lines to scroll or fraction of window to scroll
-- move_cursor: scroll the window and the cursor simultaneously
-- time_step: time (in miliseconds) between one line scroll and the next one
function neoscroll.scroll(lines, move_cursor, time_step)
-- If lines is a fraction of the window transform it to lines
if is_float(lines) then
lines = get_lines_from_win_fraction(lines)
end
-- If still scrolling just modify the amount of lines to scroll
if scrolling then
lines_to_scroll = lines_to_scroll + lines
return
end
-- Check if the window and the cursor are allowed to scroll in that direction
local scroll_window, scroll_cursor = who_scrolls(lines, move_cursor)
-- If neither the window nor the cursor are allowed to scroll finish early
if not scroll_window and not scroll_cursor then return end
-- Preparation before scrolling starts
before_scrolling(lines, move_cursor)
-- Callback function triggered by scroll_timer
local function scroll_callback()
local direction = lines_to_scroll - lines_scrolled
if direction == 0 then
finish_scrolling(move_cursor)
else
scroll_window, scroll_cursor = who_scrolls(direction, move_cursor)
if not scroll_window and not scroll_cursor then
finish_scrolling(move_cursor)
else
scroll_one_line(direction, scroll_window, scroll_cursor)
end
end
end
-- Scroll the first line
scroll_one_line(lines, scroll_window, scroll_cursor)
-- Start timer to scroll the rest of the lines
scroll_timer:start(time_step, time_step, vim.schedule_wrap(scroll_callback))
end
-- Wrapper for zt
function neoscroll.zt(time_step)
local window_height = vim.api.nvim_win_get_height(0)
local lines_above_cursor = vim.fn.winline() - 1
-- Temporary fix for garbage values in local scrolloff when not set
local scrolloff = vim.wo.scrolloff < window_height and vim.wo.scrolloff or vim.o.scrolloff
local lines = lines_above_cursor - scrolloff
if lines == 0 then return end
neoscroll.scroll(lines, false, time_step)
end
-- Wrapper for zz
function neoscroll.zz(time_step)
local window_height = vim.api.nvim_win_get_height(0)
local lines = vim.fn.winline() - math.floor(window_height/2)
if lines == 0 then return end
neoscroll.scroll(lines, false, time_step)
end
-- Wrapper for zb
function neoscroll.zb(time_step)
local window_height = vim.api.nvim_win_get_height(0)
local lines_below_cursor = window_height - vim.fn.winline()
-- Temporary fix for garbage values in local scrolloff when not set
local scrolloff = vim.wo.scrolloff < window_height and vim.wo.scrolloff or vim.o.scrolloff
local lines = -lines_below_cursor + scrolloff
if lines == 0 then return end
neoscroll.scroll(lines, false, time_step)
end
function neoscroll.setup(custom_opts)
require('neoscroll.config').set_options(custom_opts)
require('neoscroll.config').set_mappings()
vim.cmd('command! NeoscrollEnablePM let b:neoscroll_performance_mode = v:true')
vim.cmd('command! NeoscrollDisablePM let b:neoscroll_performance_mode = v:false')
end
return neoscroll
|
local output = io.open(arg[1], "w")
output:write("const char *" .. arg[2] .. " = ")
for i=3,#arg do
for line in io.lines(arg[i]) do
output:write(string.format('%q "\\n"', line) .. '\n')
end
end
output:write ";"
output:close()
|
-----------------------------------
-- Area: PsoXja
-- NPC: TOWER_C_Lift_1 !pos 260 31.282 300
-----------------------------------
-----------------------------------
require("scripts/globals/status")
-----------------------------------
function onSpawn(npc)
local elevator =
{
id = tpz.elevator.TIMED_AUTOMATIC,
lowerDoor = npc:getID() + 2,
upperDoor = npc:getID() + 1,
elevator = npc:getID(),
reversedAnimations = true,
}
npc:setElevator(elevator.id, elevator.lowerDoor, elevator.upperDoor, elevator.elevator, elevator.reversedAnimations)
end;
|
-- displayed reload time accounts for InF stats
-- does not include mag size changes for shotguns OFC >:(
-- not used if using weaponlib
function BlackMarketManager:get_reload_time(weapon_id)
local function failure(err)
Application:error("[BlackMarketManager:get_reload_time] " .. tostring(err) .. "\nReturning 1 to avoid crashing.")
return 1, 1
end
if not weapon_id then
return failure("no weapon id given")
end
local tweak = tweak_data.weapon[weapon_id]
if not tweak then
return failure("invalid weapon id: " .. tostring(weapon_id))
end
-- apply base reload speed mults
local mult = 1
mult = mult / (tweak.reload_speed_mult or 1)
mult = mult / (tweak.empty_reload_speed_mult or 1)
if tweak.timers.reload_empty then
return (tweak.timers.reload_empty + (tweak.timers.reload_empty_end or 0)) * mult, (tweak.timers.reload_not_empty + (tweak.timers.reload_empty_end or 0)) * mult
elseif tweak.timers.shotgun_reload_shell or tweak.timers.shell_reload_early then -- more surefire way of catching supported shotguns than using a value that some shotguns don't even set just so they can use the defaults
--[[
local empty = 0
local tactical = 0
empty = tweak.timers.shotgun_reload_shell * tweak.CLIP_AMMO_MAX
empty = empty + tweak.timers.shotgun_reload_first_shell_offset + tweak.timers.shotgun_reload_enter
empty = empty + (tweak.timers.shotgun_reload_exit_empty / (tweak.timers.shotgun_reload_exit_empty_mult or 1))
tactical = tweak.timers.shotgun_reload_shell
tactical = tactical + tweak.timers.shotgun_reload_first_shell_offset + tweak.timers.shotgun_reload_enter
tactical = tactical + (tweak.timers.shotgun_reload_exit_not_empty / (tweak.timers.shotgun_reload_exit_not_empty_mult or 1))
--]]
-- unused?
local empty = 0
local tactical = 0
local enter_mult = tweak.timers.shotgun_reload_enter_mult or 1
local exit_not_empty_mult = tweak.timers.shotgun_reload_exit_not_empty_mult or 1
local exit_empty_mult = tweak.timers.shotgun_reload_exit_empty_mult or 1
local shotgun_reload_shell = tweak.timers.shotgun_reload_shell or 0.5666666666666667
local shotgun_reload_enter = tweak.timers.shotgun_reload_enter or 0.30
local shotgun_reload_first_shell_offset = tweak.timers.shotgun_reload_first_shell_offset or 0.33
local shotgun_reload_exit_empty = tweak.timers.shotgun_reload_exit_empty or 0.70
local shotgun_reload_exit_not_empty = tweak.timers.shotgun_reload_exit_not_empty or 0.30
empty = shotgun_reload_shell * tweak.CLIP_AMMO_MAX
empty = empty + ((shotgun_reload_first_shell_offset + shotgun_reload_enter) / enter_mult)
empty = empty + (shotgun_reload_exit_empty / exit_empty_mult)
tactical = shotgun_reload_shell
tactical = tactical + ((shotgun_reload_first_shell_offset + shotgun_reload_enter) / enter_mult)
tactical = tactical + (shotgun_reload_exit_not_empty / exit_not_empty_mult)
return empty * mult, tactical * mult
else
return self:get_reload_animation_time(weapon_id) * mult, self:get_reload_animation_time(weapon_id) * mult
end
return failure("no reload time found!")
end
-- straight from DMCWO
--[[
function BlackMarketManager:fire_rate_multiplier(name, categories, silencer, detection_risk, current_state, blueprint)
local factory_id = managers.weapon_factory:get_factory_id_by_weapon_id(name)
local tweak_data = tweak_data.weapon
local weapon = tweak_data[name]
local factory = tweak_data.factory[factory_id]
if factory then
local default_blueprint = factory.default_blueprint
local custom_stats = managers.weapon_factory:get_custom_stats_from_weapon(factory_id, blueprint or default_blueprint)
local rof_multiplier = 1
local multiplier = 1
multiplier = multiplier + 1 - managers.player:upgrade_value(name, "fire_rate_multiplier", 1)
multiplier = multiplier + 1 - managers.player:upgrade_value("weapon", "fire_rate_multiplier", 1)
for _, category in ipairs(categories) do
multiplier = multiplier + 1 - managers.player:upgrade_value(category, "fire_rate_multiplier", 1)
end
for part_id, stats in pairs(custom_stats) do
if stats.rof_mult then
if stats.rof_mult > 1 then
multiplier = multiplier + 1 - rof_multiplier * stats.rof_mult
elseif stats.rof_mult < 1 then
multiplier = multiplier / stats.rof_mult
else
multiplier = multiplier
end
end
end
return self:_convert_add_to_mul(multiplier)
end
end
--]]
-- used in inventorydesc to avoid showing RoF modifier as +RoF from skill
function BlackMarketManager:fire_rate_multiplier_old(name, categories, silencer, detection_risk, current_state, blueprint)
local multiplier = 1
multiplier = multiplier + 1 - managers.player:upgrade_value(name, "fire_rate_multiplier", 1)
multiplier = multiplier + 1 - managers.player:upgrade_value("weapon", "fire_rate_multiplier", 1)
-- why does my old_getskillstats shit need this but the full function doesn't
if categories then
for _, category in ipairs(categories) do
multiplier = multiplier + 1 - managers.player:upgrade_value(category, "fire_rate_multiplier", 1)
end
end
return self:_convert_add_to_mul(multiplier)
end
|
local py = require('python')
require('util')
local int, str = py.eval('int'), py.eval('str')
local i, s, y = int(0xabcd), str('abcd'), str.encode('abcd')
print('type', 'str()', 'repr()', 'tolua()')
print(py.type(i), i, py.repr(i), type(i:tolua())..':'..i:tolua())
print(py.type(s), s, py.repr(s), type(s:tolua())..':'..s:tolua())
print(py.type(y), y, py.repr(y), type(y:tolua())..':'..y:tolua())
print()
local d = py.object('dict', {'a','b','c','d',a=1,b=2,c=3,d=4})
print(py.type(d), d)
assert(py.tolua(d[1])=='a')
assert(d['.a']==int(1))
print("call d['.f']:", d['.f'])
print("call py.getitem(d,'f'):", py.getitem(d,'f'))
xpcall(function() return d.__getitem__('f') end,
function(err) print("call d.__getitem__('f'):", 'raise '..err) end)
print()
local s1 = py.eval('set(range(1,n))', nil, {n=5})
assert(s1 == py.eval('{1,2,3,4}'))
local s2 = py.object('set', {3,4,5,6})
assert(s1 ~= s2)
print(string.format('s1 = %s, s2 = %s', s1, s2))
print('s1|s2 =', s1|s2)
print('s1&s2 =', s1&s2)
print('s1-s2 =', s1-s2)
print('s2-s1 =', s2-s1)
print('s1^s2 =', s1~s2)
print()
local code = '[i**2 for i in range(1,10)]'
local l = py.eval(code)
io.write(code..': ')
for i in py.iter(l) do io.write(i:tolua(), ' ') end
print('\n')
local hashlib = py.import('hashlib')
local binascii = py.import('binascii')
print('dir(hashlib):', repr(py.dir(hashlib)))
assert(py.callable(hashlib.md5))
local m = hashlib.md5()
m.update(py.object('bytes', 'abcdefghijklmn'))
m.update(py.call(str.encode, {'opqrstuvwxyz', encoding='utf-8'}))
local md5sum = binascii.b2a_hex(m.digest())
print("md5sum('abcdefghijklmnopqrstuvwxyz'):", py.tolua(md5sum))
|
local MUTATOR = {}
MUTATOR.ClassName = "model"
MUTATOR.UpdateRate = 0.25
function MUTATOR:WriteArguments(path)
assert(type(path) == "string", "path must be a string")
net.WriteString(path)
end
function MUTATOR:ReadArguments()
return net.ReadString()
end
function MUTATOR:Update(val)
if not self.actual_model then return end
if self.Entity:GetModel():lower() ~= self.actual_model:lower() then
self.Entity:SetModel(self.actual_model)
end
end
function MUTATOR:StoreState()
return self.Entity:GetModel()
end
function MUTATOR:Mutate(path)
if path:find("^http") then
if SERVER and pac.debug then
if self.Owner:IsPlayer() then
pac.Message(self.Owner, " wants to use ", path, " as model on ", ent)
end
end
local ent_str = tostring(self.Entity)
pac.DownloadMDL(path, function(mdl_path)
if not self.Entity:IsValid() then
pac.Message("cannot set model ", mdl_path, " on ", ent_str ,': entity became invalid')
return
end
if SERVER and pac.debug then
pac.Message(mdl_path, " downloaded for ", ent, ': ', path)
end
self.Entity:SetModel(mdl_path)
self.actual_model = mdl_path
end, function(err)
pac.Message(err)
end, self.Owner)
else
if path:EndsWith(".mdl") then
self.Entity:SetModel(path)
if self.Owner:IsPlayer() and path:lower() ~= self.Entity:GetModel():lower() then
self.Owner:ChatPrint('[PAC3] ERROR: ' .. path .. " is not a valid model on the server.")
end
else
local translated = player_manager.TranslatePlayerModel(path)
self.Entity:SetModel(translated)
end
end
end
pac.emut.Register(MUTATOR)
|
--[[--
h1. Demo
Utilities for simple demos.
--]]--
local lib = {}
require 'lubyk'
local Models = require 'Models'
local V2 = four.V2
local Geometry = four.Geometry
local Renderer = four.Renderer
local Geokit = require 'geokit'
-- h2. Application object to simplify demos
--[[--
@App(def)@ is a new application object. @def@ keys:
* @pos@, window position.
* @size@, window size.
* @renderer@, the renderer to use.
* @win@, the window to use.
* @event@, the event function.
* @objs@, objects to render.
* @camera@, camera to use for rendering.
--]]--
function lib.App(def)
local app = { event = function (app, e) return end }
if def.pos then app.pos = def.pos else app.pos = V2(650, 50) end
if def.size then app.size = def.size else app.size = V2(640, 360) end
if def.renderer then app.renderer = def.renderer
else app.renderer = four.Renderer { size = app.size } end
if def.win then app.win = def.win else app.win = mimas.GLWindow() end
if def.event then app.event = def.event end
if def.camera then app.camera = def.camera else app.camera = four.Camera ()
end
if def.objs then app.objs = def.objs else app.objs = {} end
function app.init ()
app.win:move(V2.x(app.pos), V2.y(app.pos))
app.win:resize(V2.x(app.size), V2.y(app.size))
app.win:show()
end
function app.win:initializeGL() app.renderer:logInfo() end
function app.win:paintGL() app.renderer:render(app.camera, app.objs) end
function app.win:resizeGL(w, h)
local size = V2(w, h)
local e = {}
e.Resize = true
e.size = size
app.size = size
app.renderer.size = size
app.event(app, e)
end
function app.win:keyboard(key, down, utf8, modifiers)
local e = {}
e.KeyDown = down
e.KeyUp = not down
e.key = key
e.utf8 = utf8
e.modifiers = modifiers
app.event(app, e)
end
function app.win:click(x, y, op)
local e = {}
e.MouseDown = op == mimas.MousePress or op == mimas.DoubleClick;
e.MouseUp = op == mimas.MouseRelease
e.double = op == mimas.DoubleClick
e.pos = app.renderer:normalizeScreenPos(V2(x, y))
app.event(app, e)
end
function app.win:mouse(x, y)
local e = {}
e.MouseMove = true
e.pos = app.renderer:normalizeScreenPos(V2(x, y))
app.event(app, e)
end
return app;
end
-- h2. Geometry
--[[--
@geometryCycle(def)@ is an argument less function returning
new geometry objects in a cyclic fashion. @def@ keys:
* @geometries@, an array of argument less functions that returns geometry
objects. Default has the geometries of @four.Geometry@ and the Stanford
Bunny.
* @normals@, @true@ if vertex normals should be computed, defaults to @false@.
--]]--
function lib.geometryCycler(def)
local id = -1
local normals = def.normals or false
local adjacency = def.adjacency or false
local geoms = def.geometries or
{ function () return Geometry.Cube(1) end,
function () return Geometry.Sphere(0.5, 4) end,
function () return Geometry.Plane(four.V2(1,1)) end,
function () return Models.bunny(1) end }
local function next ()
id = (id + 1) % #geoms
local g = geoms[id + 1] ()
if normals then g:computeVertexNormals() end
if adjacency then
g.index = Geokit.trianglesAdjacencyIndex(g.index)
g.primitive = Geometry.TRIANGLES_ADJACENCY
end
return g
end
return next
end
-- h2. Effects
--[[--
@effectCycle(def)@ is an argument less function returning
new effects in a cyclic fashion. @def@ keys:
* @effects@, an array of argument less functions that returns effect
objects. Default has the effect of @four.Effect@ TODO.
--]]--
function lib.effectCycler(def)
local id = -1
local effects = def.effects or {} -- TODO
local function next ()
id = (id + 1) % #effects
return effects[id + 1] ()
end
return next
end
-- h2. Generic cycler
--[[--
@cycle(def)@ is an argument less function calling functions and
returning their result in a cyclic fashion. @def@ keys:
* @functions@, an array of argument less functions.
--]]--
function lib.functionCycle(def)
local index = -1
local functions = def.functions or {}
local function next ()
index = (index + 1) % #functions
return functions[index + 1] ()
end
return next
end
return lib
|
curNeedle = "needle_day"
curTachometer = "tachometer_day"
curSpeedometer = "speedometer_day"
curAlpha = 0
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local veh = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
if curAlpha >= 255 then
curAlpha = 255
else
curAlpha = curAlpha+5
end
else
if curAlpha <= 0 then
curAlpha = 0
else
curAlpha = curAlpha-5
end
end
if not HasStreamedTextureDictLoaded("speedometer") then
RequestStreamedTextureDict("speedometer", true)
while not HasStreamedTextureDictLoaded("speedometer") do
Wait(0)
end
else
if DoesEntityExist(veh) and not IsEntityDead(veh) then
degree = 0
step = 2.05833
RPM = GetVehicleCurrentRpm(veh)
if RPM > 0.99 then
RPM = RPM*100
RPM = RPM+math.random(-2,2)
RPM = RPM/100
end
_,lightson,highbeams = GetVehicleLightsState(veh)
if lightson == 1 or highbeams == 1 then
curNeedle, curTachometer, curSpeedometer = "needle", "tachometer", "speedometer"
else
curNeedle, curTachometer, curSpeedometer = "needle_day", "tachometer_day", "speedometer_day"
end
if GetEntitySpeed(veh) > 0 then degree=(GetEntitySpeed(veh)*2.236936)*step end
if degree > 290 then degree=290 end
if GetVehicleClass(veh) >= 0 and GetVehicleClass(veh) < 13 or GetVehicleClass(veh) > 17 then
else
curAlpha = 0
end
else
RPM = 0
degree = 0
end
DrawSprite("speedometer", curSpeedometer, 0.800,0.860,0.12,0.185, 0.0, 255, 255, 255, curAlpha)
DrawSprite("speedometer", curTachometer, 0.920,0.860,0.12,0.185, 0.0, 255, 255, 255, curAlpha)
DrawSprite("speedometer", curNeedle, 0.800,0.862,0.076,0.15,-5.00001+degree, 255, 255, 255, curAlpha)
DrawSprite("speedometer", curNeedle, 0.920,0.862,0.076,0.15,RPM*280-30, 255, 255, 255, curAlpha)
end
end
end)
|
local string = string
local text = {}
-- Trim whitespace from the given string
-- @returns the trimmed string
local text_trim_regex = '^%s*(.-)%s*$'
local amp_original = '&'
local amp_replacement = '&'
function text.trim(s)
return s:match(text_trim_regex):gsub(amp_original, amp_replacement)
end
local text_trim_end_regex = '^(.-)%s*$'
function text.trim_end(s)
return s:match(text_trim_end_regex)
end
function text.find(str, char)
return string.find(str, char, 1, true)
end
function text.startswith(s, start)
-- https://stackoverflow.com/a/22831842
return string.sub(s, 1, string.len(start)) == start
end
-- Trim after the first occurance of a certain character
function text.trim_after(str, trim_char, max_len)
local trim_loc = text.find(str, trim_char)
if trim_loc and (max_len == nil or trim_loc <= max_len) then
return text.trim(string.sub(str, 1, trim_loc - 1))
else
return str
end
end
-- Trim a string before the first occurrence of a certain character
-- @returns the truncated string
function text.trim_before(str, trim_char)
local trim_loc = text.find(str, trim_char)
if trim_loc then
return text.trim(string.sub(str, trim_loc + 1))
else
return str
end
end
-- Select the text between enclosing characters
function text.select(str, enclosing_char)
return text.trim_after(text.trim_before(str, enclosing_char), enclosing_char)
end
-- Truncate the given string, by length, trim after character, and ellipsis
-- @returns the truncated string
local ellipsis = '...'
function text.trunc(str, max_len, use_ellipsis)
if string.len(str) < max_len then
return str
else
if use_ellipsis then
return string.sub(str, 0, max_len - 3)..ellipsis
else
return string.sub(str, 0, max_len)
end
end
end
function text.split(str, delimiter)
local d = delimiter or ' '
local result = {};
for match in (str..d):gmatch('(.-)'..d) do
result[#result+1] = match
end
return result;
end
local empty_str = ''
local default_char = ' '
function text.pad(str, width, right, char)
local str = tostring(str) or empty_str
local pad = width - str:len()
if pad > 0 then
local padding = string.rep(char or default_char, pad)
if right then
return str..padding
else
return padding..str
end
end
return str
end
return text
|
-- Generated by CSharp.lua Compiler
local System = System
local SlipeMtaDefinitions
local SlipeServerPeds
local SlipeSharedElements
System.import(function (out)
SlipeMtaDefinitions = Slipe.MtaDefinitions
SlipeServerPeds = Slipe.Server.Peds
SlipeSharedElements = Slipe.Shared.Elements
end)
System.namespace("Slipe.Server.Elements", function (namespace)
-- <summary>
-- Extensions for the base shared element class on the server
-- </summary>
namespace.class("ElementExtensions", function (namespace)
local SetVisibleTo, ClearVisibleTo, IsVisibleTo, Clone, GetZoneName, GetSyncer, SetSyncer
-- <summary>
-- Set this element visible for a specific target
-- </summary>
SetVisibleTo = function (source, target, visible)
return SlipeMtaDefinitions.MtaServer.SetElementVisibleTo(source:getMTAElement(), target:getMTAElement(), visible)
end
-- <summary>
-- Clear all visibility settings of this element
-- </summary>
ClearVisibleTo = function (source)
return SlipeMtaDefinitions.MtaServer.ClearElementVisibleTo(source:getMTAElement())
end
-- <summary>
-- Checks if this element is visible to another
-- </summary>
IsVisibleTo = function (source, target)
return SlipeMtaDefinitions.MtaServer.IsElementVisibleTo(source:getMTAElement(), target:getMTAElement())
end
-- <summary>
-- Clones this element. Returns an element of the proper type
-- </summary>
Clone = function (source, position)
local mtaElement = SlipeMtaDefinitions.MtaServer.CloneElement(source:getMTAElement(), position.X, position.Y, position.Z, false)
return SlipeSharedElements.ElementManager.getInstance():GetElement1(mtaElement)
end
-- <summary>
-- Gets this element's zone name
-- </summary>
GetZoneName = function (source, citiesOnly)
return SlipeMtaDefinitions.MtaServer.GetElementZoneName(source:getMTAElement(), citiesOnly)
end
-- <summary>
-- Gets the syncer of this element
-- </summary>
GetSyncer = function (source)
return SlipeSharedElements.ElementManager.getInstance():GetElement(SlipeMtaDefinitions.MtaServer.GetElementSyncer(source:getMTAElement()), SlipeServerPeds.Player)
end
-- <summary>
-- Sets the syncer of this element
-- </summary>
SetSyncer = function (source, target)
return SlipeMtaDefinitions.MtaServer.SetElementSyncer(source:getMTAElement(), target:getMTAElement())
end
return {
SetVisibleTo = SetVisibleTo,
ClearVisibleTo = ClearVisibleTo,
IsVisibleTo = IsVisibleTo,
Clone = Clone,
GetZoneName = GetZoneName,
GetSyncer = GetSyncer,
SetSyncer = SetSyncer,
__metadata__ = function (out)
return {
methods = {
{ "ClearVisibleTo", 0x18E, ClearVisibleTo, out.Slipe.Shared.Elements.Element, System.Boolean },
{ "Clone", 0x28E, Clone, out.Slipe.Shared.Elements.Element, System.Numerics.Vector3, out.Slipe.Shared.Elements.Element },
{ "GetSyncer", 0x18E, GetSyncer, out.Slipe.Shared.Elements.PhysicalElement, out.Slipe.Server.Peds.Player },
{ "GetZoneName", 0x28E, GetZoneName, out.Slipe.Shared.Elements.PhysicalElement, System.Boolean, System.String },
{ "IsVisibleTo", 0x28E, IsVisibleTo, out.Slipe.Shared.Elements.Element, out.Slipe.Shared.Elements.Element, System.Boolean },
{ "SetSyncer", 0x28E, SetSyncer, out.Slipe.Shared.Elements.PhysicalElement, out.Slipe.Server.Peds.Player, System.Boolean },
{ "SetVisibleTo", 0x38E, SetVisibleTo, out.Slipe.Shared.Elements.Element, out.Slipe.Shared.Elements.Element, System.Boolean, System.Boolean }
},
class = { 0xE }
}
end
}
end)
end)
|
---------------------------------------------------------------------------------------
-- Edit this table to all the database tables and columns
-- where identifiers are used (such as users, owned_vehicles, owned_properties etc.)
---------------------------------------------------------------------------------------
local IdentifierTables = {
{table = "users", column = "identifier"},
{table = "user_accounts", column = "identifier"},
{table = "rented_vehicles", column = "owner"},
}
RegisterServerEvent("kashactersS:SetupCharacters")
AddEventHandler('kashactersS:SetupCharacters', function()
local src = source
local LastCharId = GetLastCharacter(src)
SetIdentifierToChar(GetPlayerIdentifiers(src)[1], LastCharId)
local Characters = GetPlayerCharacters(src)
TriggerClientEvent('kashactersC:SetupUI', src, Characters)
end)
RegisterServerEvent("kashactersS:CharacterChosen")
AddEventHandler('kashactersS:CharacterChosen', function(charid, ischar)
local src = source
local spawn = {}
SetLastCharacter(src, tonumber(charid))
SetCharToIdentifier(GetPlayerIdentifiers(src)[1], tonumber(charid))
if ischar == "true" then
spawn = GetSpawnPos(src)
else
TriggerClientEvent('skinchanger:loadDefaultModel', src, true, cb)
spawn = { x = 195.55, y = -933.36, z = 29.90 } -- DEFAULT SPAWN POSITION
end
TriggerClientEvent("kashactersC:SpawnCharacter", src, spawn)
end)
RegisterServerEvent("kashactersS:DeleteCharacter")
AddEventHandler('kashactersS:DeleteCharacter', function(charid)
local src = source
DeleteCharacter(GetPlayerIdentifiers(src)[1], charid)
TriggerClientEvent("kashactersC:ReloadCharacters", src)
end)
function GetPlayerCharacters(source)
local identifier = GetIdentifierWithoutSteam(GetPlayerIdentifiers(source)[1])
local Chars = MySQLAsyncExecute("SELECT * FROM `users` WHERE identifier LIKE '%"..identifier.."%'")
return Chars
end
function GetLastCharacter(source)
local LastChar = MySQLAsyncExecute("SELECT `charid` FROM `user_lastcharacter` WHERE `steamid` = '"..GetPlayerIdentifiers(source)[1].."'")
if LastChar[1] ~= nil and LastChar[1].charid ~= nil then
return tonumber(LastChar[1].charid)
else
MySQLAsyncExecute("INSERT INTO `user_lastcharacter` (`steamid`, `charid`) VALUES('"..GetPlayerIdentifiers(source)[1].."', 1)")
return 1
end
end
function SetLastCharacter(source, charid)
MySQLAsyncExecute("UPDATE `user_lastcharacter` SET `charid` = '"..charid.."' WHERE `steamid` = '"..GetPlayerIdentifiers(source)[1].."'")
end
function SetIdentifierToChar(identifier, charid)
for _, itable in pairs(IdentifierTables) do
MySQLAsyncExecute("UPDATE `"..itable.table.."` SET `"..itable.column.."` = 'Char"..charid..GetIdentifierWithoutSteam(identifier).."' WHERE `"..itable.column.."` = '"..identifier.."'")
end
end
function SetCharToIdentifier(identifier, charid)
for _, itable in pairs(IdentifierTables) do
MySQLAsyncExecute("UPDATE `"..itable.table.."` SET `"..itable.column.."` = '"..identifier.."' WHERE `"..itable.column.."` = 'Char"..charid..GetIdentifierWithoutSteam(identifier).."'")
end
end
function DeleteCharacter(identifier, charid)
for _, itable in pairs(IdentifierTables) do
MySQLAsyncExecute("DELETE FROM `"..itable.table.."` WHERE `"..itable.column.."` = 'Char"..charid..GetIdentifierWithoutSteam(identifier).."'")
end
end
function GetSpawnPos(source)
local SpawnPos = MySQLAsyncExecute("SELECT `position` FROM `users` WHERE `identifier` = '"..GetPlayerIdentifiers(source)[1].."'")
return json.decode(SpawnPos[1].position)
end
function GetIdentifierWithoutSteam(Identifier)
return string.gsub(Identifier, "steam", "")
end
function MySQLAsyncExecute(query)
local IsBusy = true
local result = nil
MySQL.Async.fetchAll(query, {}, function(data)
result = data
IsBusy = false
end)
while IsBusy do
Citizen.Wait(0)
end
return result
end
|
local builder = require("installer/integrations/null_ls/helpers").common.builder
local script_win = [[
$json = Invoke-WebRequest -UseBasicParsing https://api.github.com/repos/JohnnyMorganz/StyLua/releases/latest
$object = ConvertFrom-JSON $json
$object.assets | ForEach-Object {
if ($_.browser_download_url.Contains("win64")) {
$url = $_.browser_download_url
}
}
Invoke-WebRequest -UseBasicParsing $url -OutFile "stylua.zip"
Expand-Archive .\stylua.zip -DestinationPath stylua
rm stylua.zip
]]
local script = [[
os=$(uname -s | tr "[:upper:]" "[:lower:]")
case $os in
linux)
platform="linux"
;;
darwin)
platform="macos"
;;
esac
curl -L -o "stylua.zip" $(curl -s https://api.github.com/repos/JohnnyMorganz/StyLua/releases/latest | grep 'browser_' | cut -d\" -f4 | grep "$platform")
rm -rf clangd
unzip stylua.zip -d stylua
chmod +x stylua/stylua
rm stylua.zip
]]
return builder({
install_script = {
win = script_win,
other = script,
},
cmd = {
win = "stylua/stylua.exe",
other = "stylua/stylua",
},
null_ls_type = { "formatting" },
name = "stylua",
})
|
local ctx = require "bw.context"
return function()
assert(not ctx.aaa)
ctx.aaa = 222
assert(ctx.aaa == 222)
return true
end
|
return function()
local TopBar = script.Parent.Parent
local Actions = TopBar.Actions
local SetMoreMenuOpen = require(Actions.SetMoreMenuOpen)
local SetBackpackOpen = require(Actions.SetBackpackOpen)
local SetEmotesOpen = require(Actions.SetEmotesOpen)
local SetLeaderboardOpen = require(Actions.SetLeaderboardOpen)
local SetEmotesEnabled = require(Actions.SetEmotesEnabled)
local MoreMenu = require(script.Parent.MoreMenu)
local FFlagTopBarCloseContextMenuWhenHotkeysUsed = game:GetFastFlag(
"TopBarCloseContextMenuWhenHotkeysUsed"
)
local function countValues(t)
local c = 0
for _, _ in pairs(t) do
c = c + 1
end
return c
end
it("should have the correct default values", function()
local defaultState = MoreMenu(nil, {})
expect(type(defaultState)).to.equal("table")
expect(defaultState.open).to.equal(false)
expect(defaultState.backpackOpen).to.equal(false)
expect(defaultState.leaderboardOpen).to.equal(false)
expect(defaultState.emotesOpen).to.equal(false)
end)
describe("SetMoreMenuOpen", function()
it("should change the value of open", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetMoreMenuOpen(true))
expect(oldState).to.never.equal(newState)
expect(newState.open).to.equal(true)
end)
it("should not change any other values", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetMoreMenuOpen(true))
expect(countValues(newState)).to.equal(countValues(oldState))
for key, value in pairs(newState) do
if key ~= "open" then
expect(value).to.equal(oldState[key])
end
end
end)
end)
describe("SetBackpackOpen", function()
it("should change the value of backpackOpen", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetBackpackOpen(true))
expect(oldState).to.never.equal(newState)
expect(newState.backpackOpen).to.equal(true)
end)
if FFlagTopBarCloseContextMenuWhenHotkeysUsed then
it("should not change any other values except open", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetBackpackOpen(true))
expect(countValues(newState)).to.equal(countValues(oldState))
for key, value in pairs(newState) do
if key ~= "backpackOpen" and key ~= "open" then
expect(value).to.equal(oldState[key])
end
end
end)
it("should set open to false when changed", function()
local oldState = MoreMenu(nil, {})
oldState = MoreMenu(oldState, SetMoreMenuOpen(true))
local newState = MoreMenu(oldState, SetBackpackOpen(true))
expect(oldState).to.never.equal(newState)
expect(newState.open).to.equal(false)
end)
else
it("should not change any other values", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetBackpackOpen(true))
expect(countValues(newState)).to.equal(countValues(oldState))
for key, value in pairs(newState) do
if key ~= "backpackOpen" then
expect(value).to.equal(oldState[key])
end
end
end)
end
end)
describe("SetEmotesOpen", function()
it("should change the value of emotesOpen", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetEmotesOpen(true))
expect(oldState).to.never.equal(newState)
expect(newState.emotesOpen).to.equal(true)
end)
if FFlagTopBarCloseContextMenuWhenHotkeysUsed then
it("should not change any other values except open", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetEmotesOpen(true))
expect(countValues(newState)).to.equal(countValues(oldState))
for key, value in pairs(newState) do
if key ~= "emotesOpen" and key ~= "open" then
expect(value).to.equal(oldState[key])
end
end
end)
it("should set open to false when changed", function()
local oldState = MoreMenu(nil, {})
oldState = MoreMenu(oldState, SetMoreMenuOpen(true))
local newState = MoreMenu(oldState, SetEmotesOpen(true))
expect(oldState).to.never.equal(newState)
expect(newState.open).to.equal(false)
end)
else
it("should not change any other values", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetEmotesOpen(true))
expect(countValues(newState)).to.equal(countValues(oldState))
for key, value in pairs(newState) do
if key ~= "emotesOpen" then
expect(value).to.equal(oldState[key])
end
end
end)
end
end)
describe("SetEmotesEnabled", function()
it("should change the value of emotesEnabled", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetEmotesEnabled(false))
expect(oldState).to.never.equal(newState)
expect(newState.emotesEnabled).to.equal(false)
end)
it("should not change any other values", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetEmotesEnabled(false))
expect(countValues(newState)).to.equal(countValues(oldState))
for key, value in pairs(newState) do
if key ~= "emotesEnabled" then
expect(value).to.equal(oldState[key])
end
end
end)
end)
describe("SetLeaderboardOpen", function()
it("should change the value of open", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetLeaderboardOpen(true))
expect(oldState).to.never.equal(newState)
expect(newState.leaderboardOpen).to.equal(true)
end)
if FFlagTopBarCloseContextMenuWhenHotkeysUsed then
it("should not change any other values except open", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetLeaderboardOpen(true))
expect(countValues(newState)).to.equal(countValues(oldState))
for key, value in pairs(newState) do
if key ~= "leaderboardOpen" and key ~= "open" then
expect(value).to.equal(oldState[key])
end
end
end)
it("should set open to false when changed", function()
local oldState = MoreMenu(nil, {})
oldState = MoreMenu(oldState, SetMoreMenuOpen(true))
local newState = MoreMenu(oldState, SetLeaderboardOpen(true))
expect(oldState).to.never.equal(newState)
expect(newState.open).to.equal(false)
end)
else
it("should not change any other values", function()
local oldState = MoreMenu(nil, {})
local newState = MoreMenu(oldState, SetLeaderboardOpen(true))
expect(countValues(newState)).to.equal(countValues(oldState))
for key, value in pairs(newState) do
if key ~= "leaderboardOpen" then
expect(value).to.equal(oldState[key])
end
end
end)
end
end)
end
|
local function checkRecompileNeeded(file, cppOut, javaOut, pythonOut)
local file_info = os.stat(file)
local name = path.getbasename(file)
if file_info == nil then
print ("ERROR: conld not get the stats from file " .. file)
return false
end
local cpp_info = os.stat(path.join(cppOut, name..".pb.cc"))
local hpp_info = os.stat(path.join(cppOut, name..".pb.h"))
--local java_info = os.stat(path.join(javaOut, name..".java")) -- this is not used because finding the correct java path is not that trivial
local python_info = os.stat(path.join(pythonOut, name:gsub("-", "_").."_pb2.py"))
return (cpp_info == nil or file_info.mtime > cpp_info.mtime) or
(hpp_info == nil or file_info.mtime > cpp_info.mtime) or
--(java_info == nil or file_info.mtime > java_info.mtime) or
(python_info == nil or file_info.mtime > python_info.mtime)
end
local function protocCompileAll(inputFiles, cppOut, javaOut, pythonOut, ipaths)
-- get the protobuf compiler from the EXTERN_PATH
compiler = os.ishost("windows") and "protoc.exe" or "protoc"
-- TODO: should we search on additional locations?
compilerPath = os.pathsearch(compiler, EXTERN_PATH .. "/bin/") or os.pathsearch(compiler, EXTERN_PATH_NATIVE .. "/bin/")
if compilerPath == nil then
print ("ERROR: could not find protoc compiler executable in \"" .. EXTERN_PATH .. "/bin/" .. "\"")
return false
end
local args = ""
if(pythonOut ~= nil) then
args = args .. "--python_out=\"" .. pythonOut .. "\" " -- always mind the space at the end
os.mkdir(pythonOut) -- create the output directory if needed
end
if(cppOut ~= nil) then
args = args .. "--cpp_out=\"" .. cppOut .. "\" " -- always mind the space at the end
os.mkdir(cppOut) -- create the output directory if needed
end
if(javaOut ~= nil) then
args = args .. "--java_out=\"" .. javaOut .. "\" " -- always mind the space at the end
os.mkdir(javaOut) -- create the output directory if needed
end
if(ipaths ~= nil) then
for i=1,#ipaths do
args = args .. "--proto_path=\"" .. ipaths[i] .. "\" " -- always mind the space at the end
end
end
-- add files to compile
args = args .. "\"" .. table.concat(inputFiles, "\" \"") .. "\""
local cmd = "\"" .. compilerPath .. "/" .. compiler .. "\" " .. args
if os.ishost("windows") then
cmd = "\"" .. cmd .. "\""
end
-- TODO. why is this necessary?
-- delete the generated cpp files
print("Try to remove the pb.cc and .pb.h files ")
for i,file in ipairs(inputFiles) do
local name = path.getbasename(file)
ok, err = os.remove(path.join(cppOut, name..".pb.cc"))
ok, err = os.remove(path.join(cppOut, name..".pb.h"))
end
print("Removed all generated message files")
-- generate the message files
print("INFO: (Protbuf) executing " .. cmd)
local succ, status, returnCode = os.execute(cmd)
print('Modify generated protobuf files')
local pb = os.matchfiles(pythonOut .. "/*.py")
for _, pbFileName in pairs(pb) do
-- read the python pb file
pbFile = assert(io.open(pbFileName, "r"))
content = pbFile:read("*all")
pbFile:close()
-- modify the content (change the absolute import to a local one)
content = content:gsub('\n(import [^\n]+pb2 as [^\n]+pb2)','\nfrom . %1')
-- write the content back to the file
pbFile = assert(io.open(pbFileName, "w"))
pbFile:write(content)
pbFile:close()
end
return returnCode == 0
end
-- a wrapper for an easier access with names parameters
-- e.g., makeprotoc{inputFiles = {""}, ...}
function makeprotoc(arg)
invokeprotoc(arg.inputFiles, arg.cppOut, arg.javaOut, arg.pythonOut, arg.includeDirs)
end
function invokeprotoc(inputFiles, cppOut, javaOut, pythonOut, includeDirs)
-- check if protobuf compile is explicitely requested
local compileAll = (_OPTIONS["protoc"] ~= nil)
local filesToCompile = {}
-- collect the files that need to be compiled
for i = 1, #inputFiles do
if compileAll then
table.insert(filesToCompile, inputFiles[i])
elseif checkRecompileNeeded(inputFiles[i], cppOut, javaOut, pythonOut) then
table.insert(filesToCompile, inputFiles[i])
end
end
-- filesToCompile is not empty
if next(filesToCompile) ~= nil then
protocCompileAll(filesToCompile, cppOut, javaOut, pythonOut, includeDirs)
end
end
newoption {
trigger = "protoc",
description = "Force to recompile the protbuf messages"
}
newoption {
trigger = "protoc-ipath",
value = "INCLUDE-DIRS",
description = "Include paths seperated by a \":\""
}
newoption {
trigger = "protoc-cpp",
value = "OUT-DIR",
description = "Output directory for the C++ classes generated by protoc"
}
newoption {
trigger = "protoc-java",
value = "OUT-DIR",
description = "Output directory for the Java classes generated by protoc"
}
newoption {
trigger = "protoc-python",
value = "OUT-DIR",
description = "Output directory for the Python classes generated by protoc"
}
|
--[[
German Localization
Credits/Blame: Phanx
--]]
local CONFIG, Config = ...
local L = LibStub('AceLocale-3.0'):NewLocale(CONFIG, 'deDE')
if not L then return end
-- general
L.GeneralDesc = 'Allgemeine Einstellungen für ADDON anpassen'
L.Locked = 'Fensterpositionen sperren'
L.Fading = 'Ermögliche Ausblenden des Fensters'
L.TipCount = 'Ermögliche tooltip item count'
L.FlashFind = 'Ermögliche Blitzsuche'
L.EmptySlots = 'Zeige einen Hintergrund für leere Gegenstandslots'
L.DisplayBlizzard = 'Blizzard Fenster für die deaktivierten Taschen anzeigen'
-- frame
L.FrameSettings = 'Fenstereinstellungen'
L.FrameSettingsDesc = 'Einstellungen für ein bestimmtes ADDON Fenster anpassen'
L.Frame = 'Fenster'
L.Enabled = 'Aktiviert'
L.CharacterSpecific = 'Charakterspezifische Einstellungen'
L.ExclusiveReagent = 'Getrenntes Materiallager'
L.BagToggle = 'Taschenschaltflächen'
L.Money = 'Gold'
L.Broker = 'Databroker'
L.Sort = 'Sortierschaltfläche'
L.Search = 'Suchsschaltfläche'
L.Options = 'Optionenschaltfläche'
L.Appearance = 'Erscheinung'
L.Layer = 'Ebene'
L.BagBreak = 'Trennen der Taschen aktivieren'
L.ReverseBags = 'Taschen umkehren'
L.ReverseSlots = 'Slots umkehren'
L.Color = 'Farbe des Fensters'
L.BorderColor = 'Farbe des Fensterrands'
L.Strata = 'Ebene'
L.Columns = 'Spalten'
L.Scale = 'Skalierung'
L.ItemScale = 'Gegenstandsskalierung'
L.Spacing = 'Abstand'
L.Alpha = 'Transparenz'
-- auto display
L.DisplaySettings = 'Automatische Anzeige'
L.DisplaySettingsDesc = 'Einstellungen für das automatische öffnen der Fenster'
L.DisplayInventory = 'Inventar anzeigen...'
L.CloseInventory = 'Inventar schließen...'
L.DisplayBank = 'beim Öffnen der Bank'
L.DisplayAuction = 'beim Öffnen des Auktionshauses'
L.DisplayTrade = 'beim Handel von Gegenständen'
L.DisplayCraft = 'beim Herstellen'
L.DisplayMail = 'beim Abholen der Post'
L.DisplayGuildbank = 'beim Öffnen der Gildenbank'
L.DisplayPlayer = 'beim Öffnen des Spielerfensters'
L.DisplayGems = 'beim Gesockeln eines Gegenstands'
L.CloseCombat = 'beim Kampfbeginn'
L.CloseVehicle = 'beim Eintritt in ein Fahrzeugs'
L.CloseBank = 'beim Verlassen der Bank'
L.CloseVendor = 'beim Verlassen des Handlers'
-- colors
L.ColorSettings = 'Farbeinstellungen'
L.ColorSettingsDesc = 'Einstellungen für das Einfärben der Gegenstandslots'
L.GlowQuality = 'Gegenstände nach der Seltenheit hervorheben'
L.GlowNew = 'Neue Gegenstände hervorheben'
L.GlowQuest = 'Questgegenstände hervorheben'
L.GlowUnusable = 'Unbrauchbare Gegenstände hervorheben'
L.GlowSets = 'Ausrüstungsset-Gegenstände hervorheben'
L.ColorSlots = 'Leere Gegenstandslots nach der Taschen-Art einfärben'
L.NormalColor = 'Universaltasche'
L.LeatherColor = 'Lederertasche'
L.InscribeColor = 'Schreibertasche'
L.HerbColor = 'Kräutertasche'
L.EnchantColor = 'Verzauberertasche'
L.EngineerColor = 'Ingnieurstasche'
L.GemColor = 'Edelsteintasche'
L.MineColor = 'Bergbautasche'
L.TackleColor = 'Anglertasche'
L.RefrigeColor = 'Küchentasche'
L.ReagentColor = 'Materiallager'
L.GlowAlpha = 'Helligkeit der Gegenstandshervorhebung'
|
is_dungeon = true
local MS_NAME = "smashed_caverns7_wall"
function hide_wall()
local w, h = get_area_tile_size()
local x, y
for y=1,h-1 do
for x=1,w-1 do
set_tile(4, x, y, -1, -1, false)
end
end
set_tile(1, 29, 44, -1, -1, false)
set_tile(1, 29, 45, -1, -1, false)
remove_entity(wall_blocker1)
remove_entity(wall_blocker2)
end
function start(game_just_loaded)
play_music("music/caverns.mid")
process_outline()
-- stalactites
add_wall_group(3, 9, 16, 2, 6, 0)
add_wall_group(3, 19, 28, 2, 6, 0)
add_wall_group(3, 10, 31, 2, 6, 0)
-- stuff on carts
add_wall_group(3, 27, 28, 3, 2, 0)
add_wall_group(3, 27, 63, 3, 2, 0)
add_wall_group(3, 30, 63, 3, 2, 0)
add_enemies(3, nil, 0, 0, 0, "")
chest = Chest:new{x=46.5*TILE_SIZE, y=11.5*TILE_SIZE, layer=3, contains_gold=true, contains="CASH", quantity=100, milestone="caverns7_chest1"}
to_caverns5 = Active_Block:new{x=6, y=0, width=6, height=1}
wall_blocker1 = add_polygon_entity(3, 330, 676, 312, 731, 370, 704)
wall_blocker2 = add_polygon_entity(3, 476, 696, 473, 750, 440, 709)
if (milestone_is_complete(MS_NAME)) then
hide_wall()
end
scene_activate_block = Active_Block:new{x=33, y=56, width=7, height=1}
load_sample("sfx/rumble.ogg", true)
load_sample("sfx/bomb.ogg", false)
load_sample("sfx/boing.ogg", false)
end
function activate(activator, activated)
if (activated == chest.id) then
chest:open()
end
end
local player_count = 0
function count_players(tween, id, elapsed)
player_count = player_count + 1
return true
end
function after_attack(tween, id, elapsed)
remove_entity(egbert_clone)
set_entity_visible(egbert, true)
after_attacked = true
return true
end
function after_shake(tween, id, elapsed)
after_shook = true
return true
end
function after_shake2(tween, id, elapsed)
after_shook2 = true
return true
end
function shake_tween(tween, id, elapsed)
if (not tween.started) then
shake(0, tween.duration, tween.amount)
play_sample("sfx/rumble.ogg", 1, 0, 1)
tween.started = true
end
local ret
if (elapsed >= tween.duration) then
ret = true
stop_sample("sfx/rumble.ogg")
else
ret = false
end
if (tween.playbig) then
play_sample("sfx/giant_footsteps.ogg", 1, 0, 1)
tween.playbig = false
end
return ret
end
function bomb_tween(tween, id, elapsed)
add_bomb_puff(3, tween.x + rand(11) - 5, tween.y + rand(11) - 5, 15)
play_sample("sfx/bomb.ogg", 1, 0, 1)
return true
end
function bigant_idle(tween, id, elapsed)
set_entity_animation(bigant, "idle-sign")
end_shake()
stop_sample("sfx/rumble.ogg")
return true
end
function hide_wall_tween(tween, id, elapsed)
hide_wall()
set_milestone_complete(MS_NAME, true)
return true
end
function start_run_away(tween, id, elapsed)
ran_away = true
return true
end
function do_center(tween, id, elapsed)
centered = true
return true
end
function logic()
if (to_caverns5:entity_is_colliding(0)) then
next_player_layer = 2
change_areas("caverns5", DIR_N, 39*TILE_SIZE, 16*TILE_SIZE)
elseif (not milestone_is_complete(MS_NAME) and scene_activate_block:entity_is_colliding(0) and not scene_started) then
save_boss_save()
scene_started = true
if (get_entity_name(get_player_id(0)) == "egbert") then
egbert = get_player_id(0)
frogbert = get_player_id(1)
bisou = get_player_id(2)
elseif (get_entity_name(get_player_id(1)) == "egbert") then
egbert = get_player_id(1)
frogbert = get_player_id(2)
bisou = get_player_id(0)
else
egbert = get_player_id(2)
frogbert = get_player_id(0)
bisou = get_player_id(1)
end
set_character_role(egbert, "astar")
set_character_role(frogbert, "astar")
set_character_role(bisou, "astar")
set_entity_solid_with_entities(egbert, false)
set_entity_solid_with_entities(frogbert, false)
set_entity_solid_with_entities(bisou, false)
local t = {}
t = create_astar_tween(egbert, 35.5*TILE_SIZE, 45.5*TILE_SIZE, false)
append_tween(t, create_change_direction_tween(egbert, DIR_E))
append_tween(t, { run = count_players })
new_tween(t)
t = create_astar_tween(frogbert, 37.5*TILE_SIZE, 45.5*TILE_SIZE, false)
append_tween(t, create_change_direction_tween(frogbert, DIR_W))
append_tween(t, { run = count_players })
new_tween(t)
t = create_astar_tween(bisou, 39.5*TILE_SIZE, 46.5*TILE_SIZE, false)
append_tween(t, create_change_direction_tween(bisou, DIR_W))
append_tween(t, { run = count_players })
new_tween(t)
end
if (battle_started and not battle_ended) then
battle_ended = true
revive_everyone()
set_milestone_complete("beat_antboss", true)
next_player_layer = 2
change_areas("junglevalley1", DIR_N, 410, 777)
elseif (final_speak and not changed_to_battle and player_count == 3) then
changed_to_battle = true
fade_out()
set_entity_visible(egbert, false)
set_entity_visible(frogbert, false)
set_entity_visible(bisou, false)
battle_started = true
revive_everyone()
start_battle("cart", "cart", true)
elseif (ran_away and last_speak and not finished_run_away) then
finished_run_away = true
set_character_role(egbert, "astar")
set_character_role(bisou, "astar")
t = create_astar_tween(egbert, 51.5*TILE_SIZE, 706, true)
append_tween(t, { run = count_players })
new_tween(t)
t = create_astar_tween(frogbert, 52.5*TILE_SIZE, 706, true)
append_tween(t, { run = count_players })
new_tween(t)
t = create_astar_tween(bisou, 53.5*TILE_SIZE, 706, true)
append_tween(t, { run = count_players })
new_tween(t)
elseif (shook2 and not final_speak and player_count == 3) then
player_count = 0
final_speak = true
play_sample("sfx/boing.ogg", 1, 0, 1)
set_character_role(egbert, "")
set_character_role(bisou, "")
set_entity_animation(egbert, "surprised")
set_entity_animation(bisou, "surprised")
local t = create_center_camera_tween(0, 33.5*TILE_SIZE, 43.5*TILE_SIZE, 50)
append_tween(t, { run = start_run_away })
new_tween(t)
simple_speak{
true,
"CAVERNS7_FROGBERT_4", "surprised", frogbert
}
last_speak = true
t = create_reset_camera_tween(0, 250)
new_tween(t)
elseif (shook and not shook2 and after_shook2) then
player_count = 0
shook2 = true
simple_speak{
true,
"CAVERNS7_EGBERT_4", "", egbert,
"CAVERNS7_FROGBERT_3", "", frogbert,
"CAVERNS7_EGBERT_5", "", egbert
}
play_music("music/boss_encounter.mid")
new_tween({ run = shake_tween, duration = 1000000, amount = 5, playbig=false })
bigant = add_npc("fieldantboss", 3, 18.5*TILE_SIZE, 45.5*TILE_SIZE)
redraw()
set_character_role(bigant, "")
set_entity_animation(bigant, "charge")
set_entity_solid_with_area(bigant, false)
set_entity_solid_with_entities(bigant, false)
local t = { run = bomb_tween, x = 20*TILE_SIZE, y=44*TILE_SIZE }
append_tween(t, create_idle_tween(0.1))
append_tween(t, { run = bomb_tween, x = 22*TILE_SIZE, y=44*TILE_SIZE })
append_tween(t, create_idle_tween(0.1))
append_tween(t, { run = bomb_tween, x = 24*TILE_SIZE, y=44*TILE_SIZE })
append_tween(t, create_idle_tween(0.1))
append_tween(t, { run = bomb_tween, x = 26*TILE_SIZE, y=44*TILE_SIZE })
append_tween(t, create_idle_tween(0.1))
append_tween(t, { run = bomb_tween, x = 28*TILE_SIZE, y=44*TILE_SIZE })
append_tween(t, { run = hide_wall_tween })
append_tween(t, create_idle_tween(0.1))
append_tween(t, { run = bomb_tween, x = 30*TILE_SIZE, y=44*TILE_SIZE })
new_tween(t)
t = create_direct_move_xyz_tween(bigant, 1, 31.5*TILE_SIZE, 45.5*TILE_SIZE, 0)
append_tween(t, { run = bigant_idle })
new_tween(t)
set_character_role(egbert, "astar")
t = create_idle_tween(0.5)
append_tween(t, create_astar_tween(egbert, 36.5*TILE_SIZE, 45.5*TILE_SIZE, true))
append_tween(t, create_change_direction_tween(egbert, DIR_W))
append_tween(t, { run = count_players })
new_tween(t)
t = create_idle_tween(0.5)
append_tween(create_astar_tween(frogbert, 37.5*TILE_SIZE, 45.5*TILE_SIZE, true))
append_tween(t, create_change_direction_tween(frogbert, DIR_W))
append_tween(t, { run = count_players })
new_tween(t)
t = create_idle_tween(0.5)
append_tween(create_astar_tween(bisou, 38.5*TILE_SIZE, 45.5*TILE_SIZE, true))
append_tween(t, create_change_direction_tween(bisou, DIR_W))
append_tween(t, { run = count_players })
new_tween(t)
elseif (done_attack and not shook and after_shook) then
shook = true
simple_speak{
true,
"CAVERNS7_EGBERT_3", "", egbert,
"CAVERNS7_BISOU_1", "", bisou
}
new_tween({ run = shake_tween, duration = 1, amount = 5, playbig=false })
local t = create_idle_tween(1)
append_tween(t, { run = after_shake2 })
new_tween(t)
elseif (hit_wall and not done_attack and after_attacked) then
done_attack = true
simple_speak{
true,
"CAVERNS7_FROGBERT_2", "", frogbert
}
new_tween({ run = shake_tween, duration = 1, amount = 5, playbig=false })
local t = create_idle_tween(1)
append_tween(t, { run = after_shake })
new_tween(t)
elseif (begin_speech and not hit_wall and player_count == 1) then
hit_wall = true
local ex, ey = get_entity_position(egbert)
egbert_clone = add_entity("egbert", 3, ex, ey)
set_entity_visible(egbert, false)
set_entity_right(egbert_clone, false)
set_entity_animation(egbert_clone, "attack")
play_sample("sfx/swing_weapon.ogg", 1, 0, 1)
local t = create_idle_tween(0.5)
append_tween(t, create_change_direction_tween(egbert, DIR_E))
append_tween(t, { run = after_attack })
new_tween(t)
elseif (centered and not begin_speech) then
begin_speech = true
player_count = 0
simple_speak{
true,
"CAVERNS7_EGBERT_1", "", egbert
}
set_entity_right(frogbert, true)
simple_speak{
true,
"CAVERNS7_FROGBERT_1", "", frogbert
}
set_entity_right(frogbert, false)
simple_speak{
true,
"CAVERNS7_EGBERT_2", "snooty-anim", egbert
}
local t = create_astar_tween(egbert, 31*TILE_SIZE, 45.5*TILE_SIZE, false)
append_tween(t, { run = count_players })
new_tween(t)
elseif (scene_started and not centering and player_count == 3) then
centering = true
local x, y = get_entity_position(egbert)
local t = create_center_camera_tween(0, x, y, 50)
append_tween(t, { run = do_center })
new_tween(t)
end
end
function collide(id1, id2)
end
function uncollide(id1, id2)
end
function action_button_pressed(n)
end
function attacked(attacker, attackee)
end
function stop()
destroy_sample("sfx/rumble.ogg")
destroy_sample("sfx/bomb.ogg")
destroy_sample("sfx/boing.ogg")
end
function post_draw_layer(layer)
if (layer == 4 and battle_started) then
clear_to_color(0, 0, 0, 1)
end
end
|
-- RenameParameters.lua
-- Renames all parameters in the input file (1st param) from "a_Param" to "aParam", saves it back to the input file
local args = {...}
local fnam = args[1]
local out = {}
local f = assert(io.open(fnam, "r"))
local n = 1
for line in f:lines() do
out[n] = string.gsub(line, "([^a-zA-Z0-9_])a_(%w*)", "%1a%2")
n = n + 1
end
f:close()
f = io.open(fnam, "w")
f:write(table.concat(out, "\n"))
f:write("\n")
f:close()
|
do
local _ = {
['logistics-2'] = {
icon = '__base__/graphics/technology/logistics-2.png',
effects = {
{recipe = 'fast-transport-belt', type = 'unlock-recipe'},
{recipe = 'fast-underground-belt', type = 'unlock-recipe'},
{recipe = 'fast-splitter', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'a-f-b',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 200,
time = 30
},
prerequisites = {'logistics', 'logistic-science-pack'},
name = 'logistics-2',
icon_size = 256
},
['nuclear-power'] = {
icon = '__base__/graphics/technology/nuclear-power.png',
effects = {
{recipe = 'nuclear-reactor', type = 'unlock-recipe'},
{recipe = 'heat-exchanger', type = 'unlock-recipe'}, {recipe = 'heat-pipe', type = 'unlock-recipe'},
{recipe = 'steam-turbine', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 800,
time = 30
},
prerequisites = {'uranium-processing'},
name = 'nuclear-power',
icon_size = 256
},
['research-speed-6'] = {
effects = {{modifier = 0.6, type = 'laboratory-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/research-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-m-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 500,
time = 30
},
prerequisites = {'research-speed-5'},
name = 'research-speed-6',
icon_size = 256
},
['braking-force-3'] = {
effects = {{modifier = 0.15, type = 'train-braking-force-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/braking-force.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-braking-force.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'b-f-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 250,
time = 30
},
prerequisites = {'braking-force-2'},
name = 'braking-force-3',
icon_size = 256
},
['circuit-network'] = {
icon = '__base__/graphics/technology/circuit-network.png',
effects = {
{recipe = 'red-wire', type = 'unlock-recipe'}, {recipe = 'green-wire', type = 'unlock-recipe'},
{recipe = 'arithmetic-combinator', type = 'unlock-recipe'},
{recipe = 'decider-combinator', type = 'unlock-recipe'},
{recipe = 'constant-combinator', type = 'unlock-recipe'},
{recipe = 'power-switch', type = 'unlock-recipe'},
{recipe = 'programmable-speaker', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'a-d-d',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 15
},
prerequisites = {'electronics', 'logistic-science-pack'},
name = 'circuit-network',
icon_size = 256
},
['coal-liquefaction'] = {
icon = '__base__/graphics/technology/coal-liquefaction.png',
effects = {{recipe = 'coal-liquefaction', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'd-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'advanced-oil-processing', 'production-science-pack'},
name = 'coal-liquefaction',
icon_size = 256
},
['kovarex-enrichment-process'] = {
icon = '__base__/graphics/technology/kovarex-enrichment-process.png',
effects = {
{recipe = 'kovarex-enrichment-process', type = 'unlock-recipe'},
{recipe = 'nuclear-fuel', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 1500,
time = 30
},
prerequisites = {'production-science-pack', 'uranium-processing', 'rocket-fuel'},
name = 'kovarex-enrichment-process',
icon_size = 256
},
['energy-shield-mk2-equipment'] = {
effects = {{recipe = 'energy-shield-mk2-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{
icon = '__base__/graphics/technology/energy-shield-mk2-equipment.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-e-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'energy-shield-equipment', 'military-3', 'low-density-structure', 'power-armor'},
name = 'energy-shield-mk2-equipment',
icon_size = 256
},
['effectivity-module'] = {
icon = '__base__/graphics/technology/effectivity-module-1.png',
effects = {{recipe = 'effectivity-module', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'i-g-a',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 50, time = 30},
prerequisites = {'modules'},
name = 'effectivity-module',
icon_size = 256
},
['military-2'] = {
icon = '__base__/graphics/technology/military.png',
effects = {
{recipe = 'piercing-rounds-magazine', type = 'unlock-recipe'},
{recipe = 'grenade', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-a-b',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 20, time = 15},
prerequisites = {'military', 'steel-processing', 'logistic-science-pack'},
name = 'military-2',
icon_size = 256
},
['uranium-processing'] = {
icon = '__base__/graphics/technology/uranium-processing.png',
effects = {
{recipe = 'centrifuge', type = 'unlock-recipe'},
{recipe = 'uranium-processing', type = 'unlock-recipe'},
{recipe = 'uranium-fuel-cell', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'chemical-science-pack', 'concrete'},
name = 'uranium-processing',
icon_size = 256
},
['weapon-shooting-speed-1'] = {
effects = {
{ammo_category = 'bullet', type = 'gun-speed', modifier = 0.1},
{ammo_category = 'shotgun-shell', type = 'gun-speed', modifier = 0.1}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/weapon-shooting-speed-1.png', icon_mipmaps = 4, icon_size = 256},
{
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-j-a',
unit = {ingredients = {{'automation-science-pack', 1}}, count = 100, time = 30},
prerequisites = {'military'},
name = 'weapon-shooting-speed-1',
icon_size = 256
},
['automated-rail-transportation'] = {
icon = '__base__/graphics/technology/automated-rail-transportation.png',
effects = {{recipe = 'train-stop', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-g-b',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 75, time = 30},
prerequisites = {'railway'},
name = 'automated-rail-transportation',
icon_size = 256
},
['advanced-material-processing-2'] = {
icon = '__base__/graphics/technology/advanced-material-processing-2.png',
effects = {{recipe = 'electric-furnace', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-c-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 250,
time = 30
},
prerequisites = {'advanced-material-processing', 'chemical-science-pack'},
name = 'advanced-material-processing-2',
icon_size = 256
},
explosives = {
icon = '__base__/graphics/technology/explosives.png',
effects = {{recipe = 'explosives', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'a-e-d',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 15
},
prerequisites = {'sulfur-processing'},
name = 'explosives',
icon_size = 256
},
['fast-inserter'] = {
icon = '__base__/graphics/technology/fast-inserter.png',
effects = {
{recipe = 'fast-inserter', type = 'unlock-recipe'}, {recipe = 'filter-inserter', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'a-d-a',
unit = {ingredients = {{'automation-science-pack', 1}}, count = 30, time = 15},
prerequisites = {'electronics'},
name = 'fast-inserter',
icon_size = 256
},
['braking-force-5'] = {
effects = {{modifier = 0.15, type = 'train-braking-force-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/braking-force.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-braking-force.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'b-f-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 450,
time = 35
},
prerequisites = {'braking-force-4'},
name = 'braking-force-5',
icon_size = 256
},
['worker-robots-speed-3'] = {
effects = {{modifier = 0.45, type = 'worker-robot-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/worker-robots-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-movement-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'utility-science-pack', 1}
},
count = 150,
time = 60
},
prerequisites = {'worker-robots-speed-2'},
name = 'worker-robots-speed-3',
icon_size = 256
},
['military-3'] = {
icon = '__base__/graphics/technology/military.png',
effects = {
{recipe = 'poison-capsule', type = 'unlock-recipe'},
{recipe = 'slowdown-capsule', type = 'unlock-recipe'},
{recipe = 'combat-shotgun', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-a-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'chemical-science-pack', 'military-science-pack'},
name = 'military-3',
icon_size = 256
},
['energy-weapons-damage-7'] = {
effects = {
{ammo_category = 'laser', type = 'ammo-damage', modifier = 0.7},
{ammo_category = 'beam', type = 'ammo-damage', modifier = 0.3}
},
icon_mipmaps = 4,
max_level = 'infinite',
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/energy-weapons-damage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}, {'space-science-pack', 1}
},
count_formula = '2^(L-7)*1000',
time = 60
},
prerequisites = {'energy-weapons-damage-6', 'space-science-pack'},
name = 'energy-weapons-damage-7',
icon_size = 256
},
['physical-projectile-damage-4'] = {
effects = {
{ammo_category = 'bullet', type = 'ammo-damage', modifier = 0.2},
{modifier = 0.2, turret_id = 'gun-turret', type = 'turret-attack'},
{ammo_category = 'shotgun-shell', type = 'ammo-damage', modifier = 0.2}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{
icon = '__base__/graphics/technology/physical-projectile-damage-1.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 400,
time = 60
},
prerequisites = {'physical-projectile-damage-3'},
name = 'physical-projectile-damage-4',
icon_size = 256
},
['effectivity-module-3'] = {
icon = '__base__/graphics/technology/effectivity-module-3.png',
effects = {{recipe = 'effectivity-module-3', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'i-g-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 300,
time = 60
},
prerequisites = {'effectivity-module-2', 'production-science-pack'},
name = 'effectivity-module-3',
icon_size = 256
},
['mining-productivity-2'] = {
effects = {{modifier = 0.1, type = 'mining-drill-productivity-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/mining-productivity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-mining-productivity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = '500',
time = 60
},
prerequisites = {'mining-productivity-1'},
name = 'mining-productivity-2',
icon_size = 256
},
['nuclear-fuel-reprocessing'] = {
icon = '__base__/graphics/technology/nuclear-fuel-reprocessing.png',
effects = {{recipe = 'nuclear-fuel-reprocessing', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 50,
time = 30
},
prerequisites = {'nuclear-power', 'production-science-pack'},
name = 'nuclear-fuel-reprocessing',
icon_size = 256
},
defender = {
icon = '__base__/graphics/technology/defender.png',
effects = {
{recipe = 'defender-capsule', type = 'unlock-recipe'},
{modifier = 4, type = 'maximum-following-robots-count'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-p-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'military-science-pack'},
name = 'defender',
icon_size = 256
},
['military-4'] = {
icon = '__base__/graphics/technology/military.png',
effects = {
{recipe = 'piercing-shotgun-shell', type = 'unlock-recipe'},
{recipe = 'cluster-grenade', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-a-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 150,
time = 45
},
prerequisites = {'military-3', 'utility-science-pack', 'explosives'},
name = 'military-4',
icon_size = 256
},
['production-science-pack'] = {
icon = '__base__/graphics/technology/production-science-pack.png',
effects = {{recipe = 'production-science-pack', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'productivity-module', 'advanced-material-processing-2', 'railway'},
name = 'production-science-pack',
icon_size = 256
},
['rail-signals'] = {
icon = '__base__/graphics/technology/rail-signals.png',
effects = {
{recipe = 'rail-signal', type = 'unlock-recipe'}, {recipe = 'rail-chain-signal', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'c-g-c',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 30
},
prerequisites = {'automated-rail-transportation'},
name = 'rail-signals',
icon_size = 256
},
['advanced-electronics-2'] = {
icon = '__base__/graphics/technology/advanced-electronics-2.png',
effects = {{recipe = 'processing-unit', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'a-d-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 300,
time = 30
},
prerequisites = {'chemical-science-pack'},
name = 'advanced-electronics-2',
icon_size = 256
},
battery = {
icon = '__base__/graphics/technology/battery.png',
effects = {{recipe = 'battery', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'b-c',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 150,
time = 30
},
prerequisites = {'sulfur-processing'},
name = 'battery',
icon_size = 256
},
['worker-robots-speed-5'] = {
effects = {{modifier = 0.65, type = 'worker-robot-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/worker-robots-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-movement-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 500,
time = 60
},
prerequisites = {'worker-robots-speed-4'},
name = 'worker-robots-speed-5',
icon_size = 256
},
destroyer = {
icon = '__base__/graphics/technology/destroyer.png',
effects = {{recipe = 'destroyer-capsule', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'e-p-b-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 300,
time = 30
},
prerequisites = {'military-4', 'distractor', 'speed-module'},
name = 'destroyer',
icon_size = 256
},
['logistic-science-pack'] = {
icon = '__base__/graphics/technology/logistic-science-pack.png',
effects = {{recipe = 'logistic-science-pack', type = 'unlock-recipe'}},
icon_mipmaps = 4,
localised_description = {'technology-description.logistic-science-pack'},
localised_name = {'technology-name.logistic-science-pack'},
type = 'technology',
order = 'c-a',
unit = {ingredients = {{'automation-science-pack', 1}}, count = 75, time = 5},
name = 'logistic-science-pack',
icon_size = 256
},
['effectivity-module-2'] = {
icon = '__base__/graphics/technology/effectivity-module-2.png',
effects = {{recipe = 'effectivity-module-2', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'i-g-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 75,
time = 30
},
prerequisites = {'effectivity-module', 'advanced-electronics-2'},
name = 'effectivity-module-2',
icon_size = 256
},
['braking-force-1'] = {
effects = {{modifier = 0.1, type = 'train-braking-force-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/braking-force.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-braking-force.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'b-f-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'railway', 'chemical-science-pack'},
name = 'braking-force-1',
icon_size = 256
},
['mining-productivity-1'] = {
effects = {{modifier = 0.1, type = 'mining-drill-productivity-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/mining-productivity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-mining-productivity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-e',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = '250',
time = 60
},
prerequisites = {'advanced-electronics'},
name = 'mining-productivity-1',
icon_size = 256
},
['braking-force-6'] = {
effects = {{modifier = 0.15, type = 'train-braking-force-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/braking-force.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-braking-force.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'b-f-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 550,
time = 45
},
prerequisites = {'braking-force-5'},
name = 'braking-force-6',
icon_size = 256
},
['steel-processing'] = {
icon = '__base__/graphics/technology/steel-processing.png',
effects = {
{recipe = 'steel-plate', type = 'unlock-recipe'}, {recipe = 'steel-chest', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
icon_size = 256,
unit = {ingredients = {{'automation-science-pack', 1}}, count = 50, time = 5},
type = 'technology',
name = 'steel-processing',
order = 'c-a'
},
['advanced-electronics'] = {
icon = '__base__/graphics/technology/advanced-electronics.png',
effects = {{recipe = 'advanced-circuit', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'a-d-b',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 200,
time = 15
},
prerequisites = {'plastics'},
name = 'advanced-electronics',
icon_size = 256
},
tank = {
icon = '__base__/graphics/technology/tank.png',
effects = {
{recipe = 'tank', type = 'unlock-recipe'}, {recipe = 'cannon-shell', type = 'unlock-recipe'},
{recipe = 'explosive-cannon-shell', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-c-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 250,
time = 30
},
prerequisites = {'automobilism', 'military-3', 'explosives'},
name = 'tank',
icon_size = 256
},
['automation-3'] = {
icon = '__base__/graphics/technology/automation-3.png',
effects = {{recipe = 'assembling-machine-3', type = 'unlock-recipe'}},
icon_mipmaps = 4,
localised_description = {'technology-description.automation-3'},
type = 'technology',
order = 'a-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 150,
time = 60
},
prerequisites = {'speed-module', 'production-science-pack'},
name = 'automation-3',
icon_size = 256
},
automation = {
icon = '__base__/graphics/technology/automation-1.png',
effects = {
{recipe = 'assembling-machine-1', type = 'unlock-recipe'},
{recipe = 'long-handed-inserter', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
ignore_tech_cost_multiplier = true,
type = 'technology',
order = 'a-b-a',
unit = {ingredients = {{'automation-science-pack', 1}}, count = 10, time = 10},
name = 'automation',
icon_size = 256
},
['weapon-shooting-speed-3'] = {
effects = {
{ammo_category = 'bullet', type = 'gun-speed', modifier = 0.2},
{ammo_category = 'shotgun-shell', type = 'gun-speed', modifier = 0.2},
{ammo_category = 'rocket', type = 'gun-speed', modifier = 0.5}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/weapon-shooting-speed-2.png', icon_mipmaps = 4, icon_size = 256},
{
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 300,
time = 60
},
prerequisites = {'weapon-shooting-speed-2'},
name = 'weapon-shooting-speed-3',
icon_size = 256
},
['cliff-explosives'] = {
icon = '__base__/graphics/technology/cliff-explosives.png',
effects = {{recipe = 'cliff-explosives', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'z-c-d',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 200,
time = 15
},
prerequisites = {'explosives', 'military-2'},
name = 'cliff-explosives',
icon_size = 256
},
['chemical-science-pack'] = {
icon = '__base__/graphics/technology/chemical-science-pack.png',
effects = {{recipe = 'chemical-science-pack', type = 'unlock-recipe'}},
icon_mipmaps = 4,
localised_description = {'technology-description.chemical-science-pack'},
localised_name = {'technology-name.chemical-science-pack'},
type = 'technology',
order = 'c-a',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 75, time = 10},
prerequisites = {'advanced-electronics', 'sulfur-processing'},
name = 'chemical-science-pack',
icon_size = 256
},
['discharge-defense-equipment'] = {
effects = {
{recipe = 'discharge-defense-equipment', type = 'unlock-recipe'},
{recipe = 'discharge-defense-remote', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
icons = {
{
icon = '__base__/graphics/technology/discharge-defense-equipment.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-o',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'laser-turret', 'military-3', 'power-armor', 'solar-panel-equipment'},
name = 'discharge-defense-equipment',
icon_size = 256
},
['fluid-handling'] = {
icon = '__base__/graphics/technology/fluid-handling.png',
effects = {
{recipe = 'storage-tank', type = 'unlock-recipe'}, {recipe = 'pump', type = 'unlock-recipe'},
{recipe = 'empty-barrel', type = 'unlock-recipe'},
{recipe = 'fill-water-barrel', type = 'unlock-recipe'},
{recipe = 'empty-water-barrel', type = 'unlock-recipe'},
{recipe = 'fill-sulfuric-acid-barrel', type = 'unlock-recipe'},
{recipe = 'empty-sulfuric-acid-barrel', type = 'unlock-recipe'},
{recipe = 'fill-crude-oil-barrel', type = 'unlock-recipe'},
{recipe = 'empty-crude-oil-barrel', type = 'unlock-recipe'},
{recipe = 'fill-heavy-oil-barrel', type = 'unlock-recipe'},
{recipe = 'empty-heavy-oil-barrel', type = 'unlock-recipe'},
{recipe = 'fill-light-oil-barrel', type = 'unlock-recipe'},
{recipe = 'empty-light-oil-barrel', type = 'unlock-recipe'},
{recipe = 'fill-petroleum-gas-barrel', type = 'unlock-recipe'},
{recipe = 'empty-petroleum-gas-barrel', type = 'unlock-recipe'},
{recipe = 'fill-lubricant-barrel', type = 'unlock-recipe'},
{recipe = 'empty-lubricant-barrel', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'd-a-a',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 50, time = 15},
prerequisites = {'automation-2', 'engine'},
name = 'fluid-handling',
icon_size = 256
},
['explosive-rocketry'] = {
icon = '__base__/graphics/technology/explosive-rocketry.png',
effects = {{recipe = 'explosive-rocket', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'e-h',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'rocketry', 'military-3'},
name = 'explosive-rocketry',
icon_size = 256
},
military = {
icon = '__base__/graphics/technology/military.png',
effects = {
{recipe = 'submachine-gun', type = 'unlock-recipe'}, {recipe = 'shotgun', type = 'unlock-recipe'},
{recipe = 'shotgun-shell', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
icon_size = 256,
unit = {ingredients = {{'automation-science-pack', 1}}, count = 10, time = 15},
type = 'technology',
name = 'military',
order = 'e-a-a'
},
logistics = {
icon = '__base__/graphics/technology/logistics-1.png',
effects = {
{recipe = 'underground-belt', type = 'unlock-recipe'}, {recipe = 'splitter', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
icon_size = 256,
unit = {ingredients = {{'automation-science-pack', 1}}, count = 20, time = 15},
type = 'technology',
name = 'logistics',
order = 'a-f-a'
},
['energy-weapons-damage-5'] = {
effects = {
{ammo_category = 'laser', type = 'ammo-damage', modifier = 0.5},
{ammo_category = 'beam', type = 'ammo-damage', modifier = 0.4}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/energy-weapons-damage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 500,
time = 60
},
prerequisites = {'energy-weapons-damage-4'},
name = 'energy-weapons-damage-5',
icon_size = 256
},
['battery-equipment'] = {
effects = {{recipe = 'battery-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/battery-equipment.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-i-a',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 50, time = 15},
prerequisites = {'battery', 'solar-panel-equipment'},
name = 'battery-equipment',
icon_size = 256
},
['electric-energy-distribution-1'] = {
icon = '__base__/graphics/technology/electric-energy-distribution-1.png',
effects = {
{recipe = 'medium-electric-pole', type = 'unlock-recipe'},
{recipe = 'big-electric-pole', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'c-e-b',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 120,
time = 30
},
prerequisites = {'electronics', 'steel-processing', 'logistic-science-pack'},
name = 'electric-energy-distribution-1',
icon_size = 256
},
['laser-shooting-speed-6'] = {
effects = {{ammo_category = 'laser', type = 'gun-speed', modifier = 0.4}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/laser-shooting-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-n-m',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 350,
time = 60
},
prerequisites = {'laser-shooting-speed-5'},
name = 'laser-shooting-speed-6',
icon_size = 256
},
['laser-shooting-speed-3'] = {
effects = {{ammo_category = 'laser', type = 'gun-speed', modifier = 0.3}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/laser-shooting-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-n-j',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 200,
time = 60
},
prerequisites = {'laser-shooting-speed-2'},
name = 'laser-shooting-speed-3',
icon_size = 256
},
['uranium-ammo'] = {
icon = '__base__/graphics/technology/uranium-ammo.png',
effects = {
{recipe = 'uranium-rounds-magazine', type = 'unlock-recipe'},
{recipe = 'uranium-cannon-shell', type = 'unlock-recipe'},
{recipe = 'explosive-uranium-cannon-shell', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-a-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 1000,
time = 45
},
prerequisites = {'uranium-processing', 'military-4', 'tank'},
name = 'uranium-ammo',
icon_size = 256
},
['fluid-wagon'] = {
icon = '__base__/graphics/technology/fluid-wagon.png',
effects = {{recipe = 'fluid-wagon', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-g-a-b',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 200,
time = 30
},
prerequisites = {'railway', 'fluid-handling'},
name = 'fluid-wagon',
icon_size = 256
},
['worker-robots-storage-1'] = {
effects = {{modifier = 1, type = 'worker-robot-storage'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/worker-robots-storage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-g-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'robotics'},
name = 'worker-robots-storage-1',
icon_size = 256
},
['advanced-oil-processing'] = {
icon = '__base__/graphics/technology/oil-processing.png',
effects = {
{recipe = 'advanced-oil-processing', type = 'unlock-recipe'},
{recipe = 'heavy-oil-cracking', type = 'unlock-recipe'},
{recipe = 'light-oil-cracking', type = 'unlock-recipe'},
{recipe = 'solid-fuel-from-heavy-oil', type = 'unlock-recipe'},
{recipe = 'solid-fuel-from-light-oil', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'd-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 75,
time = 30
},
prerequisites = {'chemical-science-pack'},
name = 'advanced-oil-processing',
icon_size = 256
},
electronics = {
icon = '__base__/graphics/technology/electronics.png',
name = 'electronics',
icon_mipmaps = 4,
type = 'technology',
unit = {ingredients = {{'automation-science-pack', 1}}, count = 30, time = 15},
prerequisites = {'automation'},
icon_size = 256,
order = 'a-d-a'
},
['energy-weapons-damage-1'] = {
effects = {{ammo_category = 'laser', type = 'ammo-damage', modifier = 0.2}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/energy-weapons-damage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-j-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'laser', 'military-science-pack'},
name = 'energy-weapons-damage-1',
icon_size = 256
},
concrete = {
icon = '__base__/graphics/technology/concrete.png',
effects = {
{recipe = 'concrete', type = 'unlock-recipe'}, {recipe = 'hazard-concrete', type = 'unlock-recipe'},
{recipe = 'refined-concrete', type = 'unlock-recipe'},
{recipe = 'refined-hazard-concrete', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'c-c-c',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 250,
time = 30
},
prerequisites = {'advanced-material-processing', 'automation-2'},
name = 'concrete',
icon_size = 256
},
['follower-robot-count-2'] = {
effects = {{modifier = 5, type = 'maximum-following-robots-count'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/follower-robots.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-count.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 300,
time = 30
},
prerequisites = {'follower-robot-count-1'},
name = 'follower-robot-count-2',
icon_size = 256
},
['inserter-capacity-bonus-4'] = {
effects = {{modifier = 1, type = 'stack-inserter-capacity-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/inserter-capacity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-o-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 250,
time = 30
},
prerequisites = {'inserter-capacity-bonus-3'},
name = 'inserter-capacity-bonus-4',
icon_size = 256
},
['energy-weapons-damage-2'] = {
effects = {{ammo_category = 'laser', type = 'ammo-damage', modifier = 0.2}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/energy-weapons-damage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'energy-weapons-damage-1'},
name = 'energy-weapons-damage-2',
icon_size = 256
},
['land-mine'] = {
icon = '__base__/graphics/technology/land-mine.png',
effects = {{recipe = 'land-mine', type = 'unlock-recipe'}},
icon_mipmaps = 4,
localised_description = {'technology-description.land-mine'},
type = 'technology',
order = 'e-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'explosives', 'military-science-pack'},
name = 'land-mine',
icon_size = 256
},
['productivity-module'] = {
icon = '__base__/graphics/technology/productivity-module-1.png',
effects = {{recipe = 'productivity-module', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'i-e-a',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 50, time = 30},
prerequisites = {'modules'},
name = 'productivity-module',
icon_size = 256
},
['electric-engine'] = {
icon = '__base__/graphics/technology/electric-engine.png',
effects = {{recipe = 'electric-engine-unit', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'b-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 50,
time = 30
},
prerequisites = {'lubricant'},
name = 'electric-engine',
icon_size = 256
},
['follower-robot-count-5'] = {
effects = {{modifier = 10, type = 'maximum-following-robots-count'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/follower-robots.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-count.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 800,
time = 30
},
prerequisites = {'follower-robot-count-4', 'destroyer'},
name = 'follower-robot-count-5',
icon_size = 256
},
['steel-axe'] = {
icon = '__base__/graphics/technology/steel-axe.png',
effects = {{modifier = 1, type = 'character-mining-speed'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-c-a',
unit = {ingredients = {{'automation-science-pack', 1}}, count = 50, time = 30},
prerequisites = {'steel-processing'},
name = 'steel-axe',
icon_size = 256
},
['effect-transmission'] = {
icon = '__base__/graphics/technology/effect-transmission.png',
effects = {{recipe = 'beacon', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'i-i',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 75,
time = 30
},
prerequisites = {'advanced-electronics-2', 'production-science-pack'},
name = 'effect-transmission',
icon_size = 256
},
['worker-robots-storage-2'] = {
effects = {{modifier = 1, type = 'worker-robot-storage'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/worker-robots-storage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-g-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 300,
time = 60
},
prerequisites = {'worker-robots-storage-1'},
name = 'worker-robots-storage-2',
icon_size = 256
},
['inserter-capacity-bonus-1'] = {
effects = {{modifier = 1, type = 'stack-inserter-capacity-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/inserter-capacity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-o-b',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 200,
time = 30
},
prerequisites = {'stack-inserter'},
name = 'inserter-capacity-bonus-1',
icon_size = 256
},
distractor = {
icon = '__base__/graphics/technology/distractor.png',
effects = {{recipe = 'distractor-capsule', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'e-p-b-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'defender', 'military-3', 'laser'},
name = 'distractor',
icon_size = 256
},
['worker-robots-speed-6'] = {
effects = {{modifier = 0.65, type = 'worker-robot-speed'}},
icon_mipmaps = 4,
max_level = 'infinite',
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/worker-robots-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-movement-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}, {'space-science-pack', 1}
},
count_formula = '2^(L-6)*1000',
time = 60
},
prerequisites = {'worker-robots-speed-5', 'space-science-pack'},
name = 'worker-robots-speed-6',
icon_size = 256
},
['inserter-capacity-bonus-5'] = {
effects = {{modifier = 2, type = 'stack-inserter-capacity-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/inserter-capacity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-o-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 300,
time = 30
},
prerequisites = {'inserter-capacity-bonus-4'},
name = 'inserter-capacity-bonus-5',
icon_size = 256
},
['worker-robots-speed-4'] = {
effects = {{modifier = 0.55, type = 'worker-robot-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/worker-robots-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-movement-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'utility-science-pack', 1}
},
count = 250,
time = 60
},
prerequisites = {'worker-robots-speed-3'},
name = 'worker-robots-speed-4',
icon_size = 256
},
['logistic-system'] = {
icon = '__base__/graphics/technology/logistic-system.png',
effects = {
{recipe = 'logistic-chest-active-provider', type = 'unlock-recipe'},
{recipe = 'logistic-chest-requester', type = 'unlock-recipe'},
{recipe = 'logistic-chest-buffer', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'c-k-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'utility-science-pack', 1}
},
count = 500,
time = 30
},
prerequisites = {'utility-science-pack', 'logistic-robotics'},
name = 'logistic-system',
icon_size = 256
},
flamethrower = {
icon = '__base__/graphics/technology/flamethrower.png',
effects = {
{recipe = 'flamethrower', type = 'unlock-recipe'},
{recipe = 'flamethrower-ammo', type = 'unlock-recipe'},
{recipe = 'flamethrower-turret', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-c-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 50,
time = 30
},
prerequisites = {'flammables', 'military-science-pack'},
name = 'flamethrower',
icon_size = 256
},
['worker-robots-speed-2'] = {
effects = {{modifier = 0.4, type = 'worker-robot-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/worker-robots-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-movement-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'worker-robots-speed-1'},
name = 'worker-robots-speed-2',
icon_size = 256
},
['personal-laser-defense-equipment'] = {
effects = {{recipe = 'personal-laser-defense-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{
icon = '__base__/graphics/technology/personal-laser-defense-equipment.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-m',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {
'laser-turret', 'military-3', 'low-density-structure', 'power-armor', 'solar-panel-equipment'
},
name = 'personal-laser-defense-equipment',
icon_size = 256
},
['worker-robots-speed-1'] = {
effects = {{modifier = 0.35, type = 'worker-robot-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/worker-robots-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-movement-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 50,
time = 30
},
prerequisites = {'robotics'},
name = 'worker-robots-speed-1',
icon_size = 256
},
landfill = {
icon = '__base__/graphics/technology/landfill.png',
effects = {{recipe = 'landfill', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'b-d',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 50, time = 30},
prerequisites = {'logistic-science-pack'},
name = 'landfill',
icon_size = 256
},
['modular-armor'] = {
icon = '__base__/graphics/technology/armor-making.png',
effects = {{recipe = 'modular-armor', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'g-a-c',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 30
},
prerequisites = {'heavy-armor', 'advanced-electronics'},
name = 'modular-armor',
icon_size = 256
},
['physical-projectile-damage-6'] = {
effects = {
{ammo_category = 'bullet', type = 'ammo-damage', modifier = 0.4},
{modifier = 0.4, turret_id = 'gun-turret', type = 'turret-attack'},
{ammo_category = 'shotgun-shell', type = 'ammo-damage', modifier = 0.4},
{ammo_category = 'cannon-shell', type = 'ammo-damage', modifier = 1.3}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{
icon = '__base__/graphics/technology/physical-projectile-damage-2.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 600,
time = 60
},
prerequisites = {'physical-projectile-damage-5'},
name = 'physical-projectile-damage-6',
icon_size = 256
},
['weapon-shooting-speed-5'] = {
effects = {
{ammo_category = 'bullet', type = 'gun-speed', modifier = 0.3},
{ammo_category = 'shotgun-shell', type = 'gun-speed', modifier = 0.4},
{ammo_category = 'cannon-shell', type = 'gun-speed', modifier = 0.8},
{ammo_category = 'rocket', type = 'gun-speed', modifier = 0.9}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/weapon-shooting-speed-3.png', icon_mipmaps = 4, icon_size = 256},
{
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 500,
time = 60
},
prerequisites = {'weapon-shooting-speed-4'},
name = 'weapon-shooting-speed-5',
icon_size = 256
},
flammables = {
icon = '__base__/graphics/technology/flammables.png',
name = 'flammables',
icon_mipmaps = 4,
type = 'technology',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 50, time = 30},
prerequisites = {'oil-processing'},
icon_size = 256,
order = 'e-c-a'
},
['refined-flammables-4'] = {
effects = {
{ammo_category = 'flamethrower', type = 'ammo-damage', modifier = 0.3},
{modifier = 0.3, turret_id = 'flamethrower-turret', type = 'turret-attack'}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/refined-flammables.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}, {'utility-science-pack', 1}
},
count = 400,
time = 60
},
prerequisites = {'refined-flammables-3'},
name = 'refined-flammables-4',
icon_size = 256
},
['refined-flammables-2'] = {
effects = {
{ammo_category = 'flamethrower', type = 'ammo-damage', modifier = 0.2},
{modifier = 0.2, turret_id = 'flamethrower-turret', type = 'turret-attack'}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/refined-flammables.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'refined-flammables-1'},
name = 'refined-flammables-2',
icon_size = 256
},
plastics = {
icon = '__base__/graphics/technology/plastics.png',
effects = {{recipe = 'plastic-bar', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'd-e',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 200,
time = 30
},
prerequisites = {'oil-processing'},
name = 'plastics',
icon_size = 256
},
['follower-robot-count-6'] = {
effects = {{modifier = 10, type = 'maximum-following-robots-count'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/follower-robots.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-count.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 1000,
time = 30
},
prerequisites = {'follower-robot-count-5'},
name = 'follower-robot-count-6',
icon_size = 256
},
['follower-robot-count-3'] = {
effects = {{modifier = 5, type = 'maximum-following-robots-count'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/follower-robots.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-count.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 400,
time = 30
},
prerequisites = {'follower-robot-count-2'},
name = 'follower-robot-count-3',
icon_size = 256
},
toolbelt = {
effects = {{modifier = 10, type = 'character-inventory-slots-bonus'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/toolbelt.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-m',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 30
},
prerequisites = {'logistic-science-pack'},
name = 'toolbelt',
icon_size = 256
},
['sulfur-processing'] = {
icon = '__base__/graphics/technology/sulfur-processing.png',
effects = {{recipe = 'sulfuric-acid', type = 'unlock-recipe'}, {recipe = 'sulfur', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'd-d',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 150,
time = 30
},
prerequisites = {'oil-processing'},
name = 'sulfur-processing',
icon_size = 256
},
rocketry = {
icon = '__base__/graphics/technology/rocketry.png',
effects = {
{recipe = 'rocket-launcher', type = 'unlock-recipe'}, {recipe = 'rocket', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'e-g',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 120,
time = 15
},
prerequisites = {'explosives', 'flammables', 'military-science-pack'},
name = 'rocketry',
icon_size = 256
},
spidertron = {
icon = '__base__/graphics/technology/spidertron.png',
effects = {
{recipe = 'spidertron', type = 'unlock-recipe'}, {recipe = 'spidertron-remote', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'd-e-g',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}, {'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 2500,
time = 30
},
prerequisites = {
'military-4', 'exoskeleton-equipment', 'fusion-reactor-equipment', 'rocketry', 'rocket-control-unit',
'effectivity-module-3'
},
name = 'spidertron',
icon_size = 256
},
['fusion-reactor-equipment'] = {
effects = {{recipe = 'fusion-reactor-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/fusion-reactor-equipment.png', icon_mipmaps = 4, icon_size = 256},
{
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-l',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'utility-science-pack', 'power-armor', 'military-science-pack'},
name = 'fusion-reactor-equipment',
icon_size = 256
},
['utility-science-pack'] = {
icon = '__base__/graphics/technology/utility-science-pack.png',
effects = {{recipe = 'utility-science-pack', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'robotics', 'advanced-electronics-2', 'low-density-structure'},
name = 'utility-science-pack',
icon_size = 256
},
['productivity-module-2'] = {
icon = '__base__/graphics/technology/productivity-module-2.png',
effects = {{recipe = 'productivity-module-2', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'i-e-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 75,
time = 30
},
prerequisites = {'productivity-module', 'advanced-electronics-2'},
name = 'productivity-module-2',
icon_size = 256
},
['personal-roboport-equipment'] = {
effects = {{recipe = 'personal-roboport-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{
icon = '__base__/graphics/technology/personal-roboport-equipment.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-d-zz',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 50,
time = 30
},
prerequisites = {'construction-robotics', 'solar-panel-equipment'},
name = 'personal-roboport-equipment',
icon_size = 256
},
['energy-shield-equipment'] = {
effects = {{recipe = 'energy-shield-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/energy-shield-equipment.png', icon_mipmaps = 4, icon_size = 256},
{
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-e-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 150,
time = 15
},
prerequisites = {'solar-panel-equipment', 'military-science-pack'},
name = 'energy-shield-equipment',
icon_size = 256
},
['stronger-explosives-4'] = {
effects = {
{ammo_category = 'rocket', type = 'ammo-damage', modifier = 0.4},
{ammo_category = 'grenade', type = 'ammo-damage', modifier = 0.2},
{ammo_category = 'landmine', type = 'ammo-damage', modifier = 0.2}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/stronger-explosives-3.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}, {'utility-science-pack', 1}
},
count = 400,
time = 60
},
prerequisites = {'stronger-explosives-3'},
name = 'stronger-explosives-4',
icon_size = 256
},
['stronger-explosives-3'] = {
effects = {
{ammo_category = 'rocket', type = 'ammo-damage', modifier = 0.3},
{ammo_category = 'grenade', type = 'ammo-damage', modifier = 0.2},
{ammo_category = 'landmine', type = 'ammo-damage', modifier = 0.2}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/stronger-explosives-3.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}
},
count = 300,
time = 60
},
prerequisites = {'stronger-explosives-2'},
name = 'stronger-explosives-3',
icon_size = 256
},
['artillery-shell-range-1'] = {
effects = {{modifier = 0.3, type = 'artillery-range'}},
icon_mipmaps = 4,
max_level = 'infinite',
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/artillery-range.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-range.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-k-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}, {'space-science-pack', 1}
},
count_formula = '2^L*1000',
time = 60
},
prerequisites = {'artillery', 'space-science-pack'},
name = 'artillery-shell-range-1',
icon_size = 256
},
['stronger-explosives-2'] = {
effects = {
{ammo_category = 'grenade', type = 'ammo-damage', modifier = 0.2},
{ammo_category = 'landmine', type = 'ammo-damage', modifier = 0.2}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/stronger-explosives-2.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'stronger-explosives-1'},
name = 'stronger-explosives-2',
icon_size = 256
},
['research-speed-1'] = {
effects = {{modifier = 0.2, type = 'laboratory-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/research-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-m-a',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 30
},
prerequisites = {'automation-2'},
name = 'research-speed-1',
icon_size = 256
},
['stronger-explosives-1'] = {
effects = {{ammo_category = 'grenade', type = 'ammo-damage', modifier = 0.25}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/stronger-explosives-1.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-j-a',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 30
},
prerequisites = {'military-2'},
name = 'stronger-explosives-1',
icon_size = 256
},
['stone-wall'] = {
icon = '__base__/graphics/technology/stone-wall.png',
effects = {{recipe = 'stone-wall', type = 'unlock-recipe'}},
icon_mipmaps = 4,
icon_size = 256,
unit = {ingredients = {{'automation-science-pack', 1}}, count = 10, time = 10},
type = 'technology',
name = 'stone-wall',
order = 'a-k-a'
},
['worker-robots-storage-3'] = {
effects = {{modifier = 1, type = 'worker-robot-storage'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/worker-robots-storage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-g-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 450,
time = 60
},
prerequisites = {'worker-robots-storage-2'},
name = 'worker-robots-storage-3',
icon_size = 256
},
['laser-shooting-speed-2'] = {
effects = {{ammo_category = 'laser', type = 'gun-speed', modifier = 0.2}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/laser-shooting-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-n-i',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'laser-shooting-speed-1'},
name = 'laser-shooting-speed-2',
icon_size = 256
},
['refined-flammables-6'] = {
effects = {
{ammo_category = 'flamethrower', type = 'ammo-damage', modifier = 0.4},
{modifier = 0.4, turret_id = 'flamethrower-turret', type = 'turret-attack'}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/refined-flammables.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 600,
time = 60
},
prerequisites = {'refined-flammables-5'},
name = 'refined-flammables-6',
icon_size = 256
},
['stack-inserter'] = {
icon = '__base__/graphics/technology/stack-inserter.png',
effects = {
{recipe = 'stack-inserter', type = 'unlock-recipe'},
{recipe = 'stack-filter-inserter', type = 'unlock-recipe'},
{modifier = 1, type = 'stack-inserter-capacity-bonus'}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'c-o-a',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 150,
time = 30
},
prerequisites = {'fast-inserter', 'logistics-2', 'advanced-electronics'},
name = 'stack-inserter',
icon_size = 256
},
['atomic-bomb'] = {
icon = '__base__/graphics/technology/atomic-bomb.png',
effects = {{recipe = 'atomic-bomb', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'e-a-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 5000,
time = 45
},
prerequisites = {'military-4', 'kovarex-enrichment-process', 'rocket-control-unit', 'rocketry'},
name = 'atomic-bomb',
icon_size = 256
},
['speed-module-3'] = {
icon = '__base__/graphics/technology/speed-module-3.png',
effects = {{recipe = 'speed-module-3', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'i-c-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 300,
time = 60
},
prerequisites = {'speed-module-2', 'production-science-pack'},
name = 'speed-module-3',
icon_size = 256
},
robotics = {
icon = '__base__/graphics/technology/robotics.png',
effects = {{recipe = 'flying-robot-frame', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-i',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 75,
time = 30
},
prerequisites = {'electric-engine', 'battery'},
name = 'robotics',
icon_size = 256
},
modules = {
icon = '__base__/graphics/technology/module.png',
name = 'modules',
icon_mipmaps = 4,
type = 'technology',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 30
},
prerequisites = {'advanced-electronics'},
icon_size = 256,
order = 'i-a'
},
['inserter-capacity-bonus-7'] = {
effects = {
{modifier = 1, type = 'inserter-stack-size-bonus'},
{modifier = 2, type = 'stack-inserter-capacity-bonus'}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/inserter-capacity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-o-h',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 600,
time = 30
},
prerequisites = {'inserter-capacity-bonus-6'},
name = 'inserter-capacity-bonus-7',
icon_size = 256
},
['power-armor'] = {
icon = '__base__/graphics/technology/power-armor.png',
effects = {{recipe = 'power-armor', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'g-c-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'modular-armor', 'electric-engine', 'advanced-electronics-2'},
name = 'power-armor',
icon_size = 256
},
['belt-immunity-equipment'] = {
effects = {{recipe = 'belt-immunity-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/belt-immunity-equipment.png', icon_mipmaps = 4, icon_size = 256},
{
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-g-g',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 50, time = 15},
prerequisites = {'solar-panel-equipment'},
name = 'belt-immunity-equipment',
icon_size = 256
},
['advanced-material-processing'] = {
icon = '__base__/graphics/technology/advanced-material-processing.png',
effects = {{recipe = 'steel-furnace', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-c-a',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 75, time = 30},
prerequisites = {'steel-processing', 'logistic-science-pack'},
name = 'advanced-material-processing',
icon_size = 256
},
['rocket-fuel'] = {
icon = '__base__/graphics/technology/rocket-fuel.png',
effects = {{recipe = 'rocket-fuel', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'k-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 300,
time = 45
},
prerequisites = {'flammables', 'advanced-oil-processing'},
name = 'rocket-fuel',
icon_size = 256
},
['artillery-shell-speed-1'] = {
effects = {
{
icon = '__base__/graphics/icons/artillery-shell.png',
icon_mipmaps = 2,
ammo_category = 'artillery-shell',
type = 'gun-speed',
modifier = 1,
icon_size = 64
}
},
icon_mipmaps = 4,
max_level = 'infinite',
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/artillery-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-k-k',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}, {'space-science-pack', 1}
},
count_formula = '1000+3^(L-1)*1000',
time = 60
},
prerequisites = {'artillery', 'space-science-pack'},
name = 'artillery-shell-speed-1',
icon_size = 256
},
['space-science-pack'] = {
icon = '__base__/graphics/technology/space-science-pack.png',
effects = {{recipe = 'satellite', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 2000,
time = 30
},
prerequisites = {'rocket-silo', 'electric-energy-accumulators', 'solar-energy'},
name = 'space-science-pack',
icon_size = 256
},
['solar-panel-equipment'] = {
effects = {{recipe = 'solar-panel-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/solar-panel-equipment.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-k',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 15
},
prerequisites = {'modular-armor', 'solar-energy'},
name = 'solar-panel-equipment',
icon_size = 256
},
artillery = {
icon = '__base__/graphics/technology/artillery.png',
effects = {
{recipe = 'artillery-wagon', type = 'unlock-recipe'},
{recipe = 'artillery-turret', type = 'unlock-recipe'},
{recipe = 'artillery-shell', type = 'unlock-recipe'},
{recipe = 'artillery-targeting-remote', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'd-e-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 2000,
time = 30
},
prerequisites = {'military-4', 'tank'},
name = 'artillery',
icon_size = 256
},
['automation-2'] = {
icon = '__base__/graphics/technology/automation-2.png',
effects = {{recipe = 'assembling-machine-2', type = 'unlock-recipe'}},
icon_mipmaps = 4,
localised_description = {'technology-description.automation-2'},
type = 'technology',
order = 'a-b-b',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 40, time = 15},
prerequisites = {'electronics', 'steel-processing', 'logistic-science-pack'},
name = 'automation-2',
icon_size = 256
},
['solar-energy'] = {
icon = '__base__/graphics/technology/solar-energy.png',
effects = {{recipe = 'solar-panel', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'a-h-c',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 250,
time = 30
},
prerequisites = {'optics', 'electronics', 'steel-processing', 'logistic-science-pack'},
name = 'solar-energy',
icon_size = 256
},
['rocket-silo'] = {
icon = '__base__/graphics/technology/rocket-silo.png',
effects = {
{recipe = 'rocket-silo', type = 'unlock-recipe'}, {recipe = 'rocket-part', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'k-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 1000,
time = 60
},
prerequisites = {
'concrete', 'speed-module-3', 'productivity-module-3', 'rocket-fuel', 'rocket-control-unit'
},
name = 'rocket-silo',
icon_size = 256
},
['laser-shooting-speed-4'] = {
effects = {{ammo_category = 'laser', type = 'gun-speed', modifier = 0.3}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/laser-shooting-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-n-k',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 200,
time = 60
},
prerequisites = {'laser-shooting-speed-3'},
name = 'laser-shooting-speed-4',
icon_size = 256
},
['braking-force-4'] = {
effects = {{modifier = 0.15, type = 'train-braking-force-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/braking-force.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-braking-force.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'b-f-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 350,
time = 30
},
prerequisites = {'braking-force-3'},
name = 'braking-force-4',
icon_size = 256
},
['speed-module'] = {
icon = '__base__/graphics/technology/speed-module-1.png',
effects = {{recipe = 'speed-module', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'i-c-a',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 50, time = 30},
prerequisites = {'modules'},
name = 'speed-module',
icon_size = 256
},
['mining-productivity-3'] = {
effects = {{modifier = 0.1, type = 'mining-drill-productivity-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/mining-productivity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-mining-productivity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = '1000',
time = 60
},
prerequisites = {'mining-productivity-2'},
name = 'mining-productivity-3',
icon_size = 256
},
['gun-turret'] = {
icon = '__base__/graphics/technology/gun-turret.png',
effects = {{recipe = 'gun-turret', type = 'unlock-recipe'}},
icon_mipmaps = 4,
icon_size = 256,
unit = {ingredients = {{'automation-science-pack', 1}}, count = 10, time = 10},
type = 'technology',
name = 'gun-turret',
order = 'a-j-a'
},
['speed-module-2'] = {
icon = '__base__/graphics/technology/speed-module-2.png',
effects = {{recipe = 'speed-module-2', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'i-c-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 75,
time = 30
},
prerequisites = {'speed-module', 'advanced-electronics-2'},
name = 'speed-module-2',
icon_size = 256
},
['logistic-robotics'] = {
icon = '__base__/graphics/technology/logistic-robotics.png',
effects = {
{recipe = 'roboport', type = 'unlock-recipe'},
{recipe = 'logistic-chest-passive-provider', type = 'unlock-recipe'},
{recipe = 'logistic-chest-storage', type = 'unlock-recipe'},
{recipe = 'logistic-robot', type = 'unlock-recipe'},
{modifier = true, type = 'character-logistic-requests'},
{modifier = 30, type = 'character-logistic-trash-slots'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'c-k-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 250,
time = 30
},
prerequisites = {'robotics'},
name = 'logistic-robotics',
icon_size = 256
},
['braking-force-7'] = {
effects = {{modifier = 0.15, type = 'train-braking-force-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/braking-force.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-braking-force.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'b-f-g',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}
},
count = 650,
time = 60
},
prerequisites = {'braking-force-6'},
name = 'braking-force-7',
icon_size = 256
},
['research-speed-5'] = {
effects = {{modifier = 0.5, type = 'laboratory-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/research-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-m-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 500,
time = 30
},
prerequisites = {'research-speed-4'},
name = 'research-speed-5',
icon_size = 256
},
['research-speed-4'] = {
effects = {{modifier = 0.5, type = 'laboratory-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/research-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-m-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 500,
time = 30
},
prerequisites = {'research-speed-3'},
name = 'research-speed-4',
icon_size = 256
},
['exoskeleton-equipment'] = {
effects = {{recipe = 'exoskeleton-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/exoskeleton-equipment.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-h',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 50,
time = 30
},
prerequisites = {'advanced-electronics-2', 'electric-engine', 'solar-panel-equipment'},
name = 'exoskeleton-equipment',
icon_size = 256
},
['braking-force-2'] = {
effects = {{modifier = 0.15, type = 'train-braking-force-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/braking-force.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-braking-force.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'b-f-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'braking-force-1'},
name = 'braking-force-2',
icon_size = 256
},
['research-speed-3'] = {
effects = {{modifier = 0.4, type = 'laboratory-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/research-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-m-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 250,
time = 30
},
prerequisites = {'research-speed-2'},
name = 'research-speed-3',
icon_size = 256
},
['productivity-module-3'] = {
icon = '__base__/graphics/technology/productivity-module-3.png',
effects = {{recipe = 'productivity-module-3', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
order = 'i-e-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 300,
time = 60
},
prerequisites = {'productivity-module-2', 'production-science-pack'},
name = 'productivity-module-3',
icon_size = 256
},
['laser-shooting-speed-7'] = {
effects = {{ammo_category = 'laser', type = 'gun-speed', modifier = 0.5}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/laser-shooting-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-n-n',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 450,
time = 60
},
prerequisites = {'laser-shooting-speed-6'},
name = 'laser-shooting-speed-7',
icon_size = 256
},
['research-speed-2'] = {
effects = {{modifier = 0.3, type = 'laboratory-speed'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/research-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-m-b',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 200,
time = 30
},
prerequisites = {'research-speed-1'},
name = 'research-speed-2',
icon_size = 256
},
['refined-flammables-7'] = {
effects = {
{ammo_category = 'flamethrower', type = 'ammo-damage', modifier = 0.2},
{modifier = 0.2, turret_id = 'flamethrower-turret', type = 'turret-attack'}
},
icon_mipmaps = 4,
max_level = 'infinite',
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/refined-flammables.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}, {'space-science-pack', 1}
},
count_formula = '2^(L-7)*1000',
time = 60
},
prerequisites = {'refined-flammables-6', 'space-science-pack'},
name = 'refined-flammables-7',
icon_size = 256
},
['refined-flammables-5'] = {
effects = {
{ammo_category = 'flamethrower', type = 'ammo-damage', modifier = 0.3},
{modifier = 0.3, turret_id = 'flamethrower-turret', type = 'turret-attack'}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/refined-flammables.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}, {'utility-science-pack', 1}
},
count = 500,
time = 60
},
prerequisites = {'refined-flammables-4'},
name = 'refined-flammables-5',
icon_size = 256
},
['weapon-shooting-speed-2'] = {
effects = {
{ammo_category = 'bullet', type = 'gun-speed', modifier = 0.2},
{ammo_category = 'shotgun-shell', type = 'gun-speed', modifier = 0.2}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/weapon-shooting-speed-1.png', icon_mipmaps = 4, icon_size = 256},
{
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-b',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 200,
time = 30
},
prerequisites = {'weapon-shooting-speed-1'},
name = 'weapon-shooting-speed-2',
icon_size = 256
},
['follower-robot-count-1'] = {
effects = {{modifier = 5, type = 'maximum-following-robots-count'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/follower-robots.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-count.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 200,
time = 30
},
prerequisites = {'defender'},
name = 'follower-robot-count-1',
icon_size = 256
},
['refined-flammables-3'] = {
effects = {
{ammo_category = 'flamethrower', type = 'ammo-damage', modifier = 0.2},
{modifier = 0.2, turret_id = 'flamethrower-turret', type = 'turret-attack'}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/refined-flammables.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}
},
count = 300,
time = 60
},
prerequisites = {'refined-flammables-2'},
name = 'refined-flammables-3',
icon_size = 256
},
['electric-energy-accumulators'] = {
icon = '__base__/graphics/technology/electric-energy-acumulators.png',
effects = {{recipe = 'accumulator', type = 'unlock-recipe'}},
icon_mipmaps = 4,
localised_name = {'technology-name.electric-energy-accumulators-1'},
type = 'technology',
order = 'c-e-a',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 150,
time = 30
},
prerequisites = {'electric-energy-distribution-1', 'battery'},
name = 'electric-energy-accumulators',
icon_size = 256
},
['refined-flammables-1'] = {
effects = {
{ammo_category = 'flamethrower', type = 'ammo-damage', modifier = 0.2},
{modifier = 0.2, turret_id = 'flamethrower-turret', type = 'turret-attack'}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/refined-flammables.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-j-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'flamethrower'},
name = 'refined-flammables-1',
icon_size = 256
},
gate = {
icon = '__base__/graphics/technology/gate.png',
effects = {{recipe = 'gate', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'a-l-a',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 30
},
prerequisites = {'stone-wall', 'military-2'},
name = 'gate',
icon_size = 256
},
railway = {
icon = '__base__/graphics/technology/railway.png',
effects = {
{recipe = 'rail', type = 'unlock-recipe'}, {recipe = 'locomotive', type = 'unlock-recipe'},
{recipe = 'cargo-wagon', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'c-g-a',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 75, time = 30},
prerequisites = {'logistics-2', 'engine'},
name = 'railway',
icon_size = 256
},
['power-armor-mk2'] = {
icon = '__base__/graphics/technology/power-armor-mk2.png',
effects = {{recipe = 'power-armor-mk2', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'g-c-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 400,
time = 30
},
prerequisites = {'power-armor', 'military-4', 'speed-module-2', 'effectivity-module-2'},
name = 'power-armor-mk2',
icon_size = 256
},
['physical-projectile-damage-7'] = {
effects = {
{ammo_category = 'bullet', type = 'ammo-damage', modifier = 0.4},
{modifier = 0.7, turret_id = 'gun-turret', type = 'turret-attack'},
{ammo_category = 'shotgun-shell', type = 'ammo-damage', modifier = 0.4},
{ammo_category = 'cannon-shell', type = 'ammo-damage', modifier = 1}
},
icon_mipmaps = 4,
max_level = 'infinite',
type = 'technology',
upgrade = true,
icons = {
{
icon = '__base__/graphics/technology/physical-projectile-damage-2.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}, {'space-science-pack', 1}
},
count_formula = '2^(L-7)*1000',
time = 60
},
prerequisites = {'physical-projectile-damage-6', 'space-science-pack'},
name = 'physical-projectile-damage-7',
icon_size = 256
},
['low-density-structure'] = {
icon = '__base__/graphics/technology/low-density-structure.png',
effects = {{recipe = 'low-density-structure', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'k-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 300,
time = 45
},
prerequisites = {'advanced-material-processing', 'chemical-science-pack'},
name = 'low-density-structure',
icon_size = 256
},
['physical-projectile-damage-5'] = {
effects = {
{ammo_category = 'bullet', type = 'ammo-damage', modifier = 0.2},
{modifier = 0.2, turret_id = 'gun-turret', type = 'turret-attack'},
{ammo_category = 'shotgun-shell', type = 'ammo-damage', modifier = 0.2},
{ammo_category = 'cannon-shell', type = 'ammo-damage', modifier = 0.9}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{
icon = '__base__/graphics/technology/physical-projectile-damage-2.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 500,
time = 60
},
prerequisites = {'physical-projectile-damage-4'},
name = 'physical-projectile-damage-5',
icon_size = 256
},
['laser-shooting-speed-1'] = {
effects = {{ammo_category = 'laser', type = 'gun-speed', modifier = 0.1}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/laser-shooting-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-n-h',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}
},
count = 50,
time = 30
},
prerequisites = {'laser'},
name = 'laser-shooting-speed-1',
icon_size = 256
},
['physical-projectile-damage-3'] = {
effects = {
{ammo_category = 'bullet', type = 'ammo-damage', modifier = 0.2},
{modifier = 0.2, turret_id = 'gun-turret', type = 'turret-attack'},
{ammo_category = 'shotgun-shell', type = 'ammo-damage', modifier = 0.2}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{
icon = '__base__/graphics/technology/physical-projectile-damage-1.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 300,
time = 60
},
prerequisites = {'physical-projectile-damage-2'},
name = 'physical-projectile-damage-3',
icon_size = 256
},
['follower-robot-count-4'] = {
effects = {{modifier = 10, type = 'maximum-following-robots-count'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/follower-robots.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-count.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}
},
count = 600,
time = 30
},
prerequisites = {'follower-robot-count-3'},
name = 'follower-robot-count-4',
icon_size = 256
},
['electric-energy-distribution-2'] = {
icon = '__base__/graphics/technology/electric-energy-distribution-2.png',
effects = {{recipe = 'substation', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-e-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 100,
time = 45
},
prerequisites = {'electric-energy-distribution-1', 'chemical-science-pack'},
name = 'electric-energy-distribution-2',
icon_size = 256
},
automobilism = {
icon = '__base__/graphics/technology/automobilism.png',
effects = {{recipe = 'car', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'e-b',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 30
},
prerequisites = {'logistics-2', 'engine'},
name = 'automobilism',
icon_size = 256
},
['physical-projectile-damage-1'] = {
effects = {
{ammo_category = 'bullet', type = 'ammo-damage', modifier = 0.1},
{modifier = 0.1, turret_id = 'gun-turret', type = 'turret-attack'},
{ammo_category = 'shotgun-shell', type = 'ammo-damage', modifier = 0.1}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{
icon = '__base__/graphics/technology/physical-projectile-damage-1.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-a',
unit = {ingredients = {{'automation-science-pack', 1}}, count = 100, time = 30},
prerequisites = {'military'},
name = 'physical-projectile-damage-1',
icon_size = 256
},
['personal-roboport-mk2-equipment'] = {
effects = {{recipe = 'personal-roboport-mk2-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{
icon = '__base__/graphics/technology/personal-roboport-mk2-equipment.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-d-zz',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'utility-science-pack', 1}
},
count = 250,
time = 30
},
prerequisites = {'personal-roboport-equipment', 'utility-science-pack'},
name = 'personal-roboport-mk2-equipment',
icon_size = 256
},
['stronger-explosives-6'] = {
effects = {
{ammo_category = 'rocket', type = 'ammo-damage', modifier = 0.6},
{ammo_category = 'grenade', type = 'ammo-damage', modifier = 0.2},
{ammo_category = 'landmine', type = 'ammo-damage', modifier = 0.2}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/stronger-explosives-3.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 600,
time = 60
},
prerequisites = {'stronger-explosives-5'},
name = 'stronger-explosives-6',
icon_size = 256
},
['follower-robot-count-7'] = {
effects = {{modifier = 10, type = 'maximum-following-robots-count'}},
icon_mipmaps = 4,
max_level = 'infinite',
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/follower-robots.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-count.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-p-b-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'production-science-pack', 1}, {'utility-science-pack', 1},
{'space-science-pack', 1}
},
count_formula = '100(L-6)+900',
time = 30
},
prerequisites = {'follower-robot-count-6', 'space-science-pack'},
name = 'follower-robot-count-7',
icon_size = 256
},
optics = {
icon = '__base__/graphics/technology/lamp.png',
effects = {{recipe = 'small-lamp', type = 'unlock-recipe'}},
icon_mipmaps = 4,
icon_size = 256,
unit = {ingredients = {{'automation-science-pack', 1}}, count = 10, time = 15},
type = 'technology',
name = 'optics',
order = 'a-h-a'
},
['construction-robotics'] = {
icon = '__base__/graphics/technology/construction-robotics.png',
effects = {
{recipe = 'roboport', type = 'unlock-recipe'},
{recipe = 'logistic-chest-passive-provider', type = 'unlock-recipe'},
{recipe = 'logistic-chest-storage', type = 'unlock-recipe'},
{recipe = 'construction-robot', type = 'unlock-recipe'},
{modifier = 36288000, type = 'ghost-time-to-live'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'c-k-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'robotics'},
name = 'construction-robotics',
icon_size = 256
},
['oil-processing'] = {
icon = '__base__/graphics/technology/oil-gathering.png',
effects = {
{recipe = 'pumpjack', type = 'unlock-recipe'}, {recipe = 'oil-refinery', type = 'unlock-recipe'},
{recipe = 'chemical-plant', type = 'unlock-recipe'},
{recipe = 'basic-oil-processing', type = 'unlock-recipe'},
{recipe = 'solid-fuel-from-petroleum-gas', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'd-a',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 30
},
prerequisites = {'fluid-handling'},
name = 'oil-processing',
icon_size = 256
},
['night-vision-equipment'] = {
effects = {{recipe = 'night-vision-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/night-vision-equipment.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-g',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 50, time = 15},
prerequisites = {'solar-panel-equipment'},
name = 'night-vision-equipment',
icon_size = 256
},
['weapon-shooting-speed-6'] = {
effects = {
{ammo_category = 'bullet', type = 'gun-speed', modifier = 0.4},
{ammo_category = 'shotgun-shell', type = 'gun-speed', modifier = 0.4},
{ammo_category = 'cannon-shell', type = 'gun-speed', modifier = 1.5},
{ammo_category = 'rocket', type = 'gun-speed', modifier = 1.3}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/weapon-shooting-speed-3.png', icon_mipmaps = 4, icon_size = 256},
{
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 600,
time = 60
},
prerequisites = {'weapon-shooting-speed-5'},
name = 'weapon-shooting-speed-6',
icon_size = 256
},
['battery-mk2-equipment'] = {
effects = {{recipe = 'battery-mk2-equipment', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
icons = {
{icon = '__base__/graphics/technology/battery-mk2-equipment.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-equipment.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'g-i-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'battery-equipment', 'low-density-structure', 'power-armor'},
name = 'battery-mk2-equipment',
icon_size = 256
},
['energy-weapons-damage-3'] = {
effects = {{ammo_category = 'laser', type = 'ammo-damage', modifier = 0.3}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/energy-weapons-damage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}
},
count = 300,
time = 60
},
prerequisites = {'energy-weapons-damage-2'},
name = 'energy-weapons-damage-3',
icon_size = 256
},
laser = {
icon = '__base__/graphics/technology/laser.png',
name = 'laser',
icon_mipmaps = 4,
type = 'technology',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 100,
time = 30
},
prerequisites = {'optics', 'battery', 'chemical-science-pack'},
icon_size = 256,
order = 'a-h-b'
},
['rocket-control-unit'] = {
icon = '__base__/graphics/technology/rocket-control-unit.png',
effects = {{recipe = 'rocket-control-unit', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'k-a',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'utility-science-pack', 1}
},
count = 300,
time = 45
},
prerequisites = {'utility-science-pack', 'speed-module'},
name = 'rocket-control-unit',
icon_size = 256
},
['inserter-capacity-bonus-3'] = {
effects = {{modifier = 1, type = 'stack-inserter-capacity-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/inserter-capacity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-o-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 250,
time = 30
},
prerequisites = {'inserter-capacity-bonus-2'},
name = 'inserter-capacity-bonus-3',
icon_size = 256
},
['military-science-pack'] = {
icon = '__base__/graphics/technology/military-science-pack.png',
effects = {{recipe = 'military-science-pack', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'c-a',
unit = {ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, count = 30, time = 15},
prerequisites = {'military-2', 'stone-wall'},
name = 'military-science-pack',
icon_size = 256
},
lubricant = {
icon = '__base__/graphics/technology/lubricant.png',
effects = {{recipe = 'lubricant', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'b-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1}
},
count = 50,
time = 30
},
prerequisites = {'advanced-oil-processing'},
name = 'lubricant',
icon_size = 256
},
['logistics-3'] = {
icon = '__base__/graphics/technology/logistics-3.png',
effects = {
{recipe = 'express-transport-belt', type = 'unlock-recipe'},
{recipe = 'express-underground-belt', type = 'unlock-recipe'},
{recipe = 'express-splitter', type = 'unlock-recipe'}
},
icon_mipmaps = 4,
type = 'technology',
order = 'a-f-c',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 300,
time = 15
},
prerequisites = {'production-science-pack', 'lubricant'},
name = 'logistics-3',
icon_size = 256
},
['laser-turret'] = {
icon = '__base__/graphics/technology/laser-turret.png',
effects = {{recipe = 'laser-turret', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'a-j-b',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}
},
count = 150,
time = 30
},
prerequisites = {'laser', 'military-science-pack'},
name = 'laser-turret',
icon_size = 256
},
['laser-shooting-speed-5'] = {
effects = {{ammo_category = 'laser', type = 'gun-speed', modifier = 0.4}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/laser-shooting-speed.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-n-l',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 200,
time = 60
},
prerequisites = {'laser-shooting-speed-4'},
name = 'laser-shooting-speed-5',
icon_size = 256
},
['inserter-capacity-bonus-6'] = {
effects = {{modifier = 2, type = 'stack-inserter-capacity-bonus'}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/inserter-capacity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-o-g',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}
},
count = 400,
time = 30
},
prerequisites = {'inserter-capacity-bonus-5'},
name = 'inserter-capacity-bonus-6',
icon_size = 256
},
['inserter-capacity-bonus-2'] = {
effects = {
{modifier = 1, type = 'inserter-stack-size-bonus'},
{modifier = 1, type = 'stack-inserter-capacity-bonus'}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/inserter-capacity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-capacity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-o-c',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 250,
time = 30
},
prerequisites = {'inserter-capacity-bonus-1'},
name = 'inserter-capacity-bonus-2',
icon_size = 256
},
['heavy-armor'] = {
icon = '__base__/graphics/technology/armor-making.png',
effects = {{recipe = 'heavy-armor', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'g-a-b',
unit = {ingredients = {{'automation-science-pack', 1}}, count = 30, time = 30},
prerequisites = {'military', 'steel-processing'},
name = 'heavy-armor',
icon_size = 256
},
['stronger-explosives-7'] = {
effects = {
{ammo_category = 'rocket', type = 'ammo-damage', modifier = 0.5},
{ammo_category = 'grenade', type = 'ammo-damage', modifier = 0.2},
{ammo_category = 'landmine', type = 'ammo-damage', modifier = 0.2}
},
icon_mipmaps = 4,
max_level = 'infinite',
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/stronger-explosives-3.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}, {'space-science-pack', 1}
},
count_formula = '2^(L-7)*1000',
time = 60
},
prerequisites = {'stronger-explosives-6', 'space-science-pack'},
name = 'stronger-explosives-7',
icon_size = 256
},
['physical-projectile-damage-2'] = {
effects = {
{ammo_category = 'bullet', type = 'ammo-damage', modifier = 0.1},
{modifier = 0.1, turret_id = 'gun-turret', type = 'turret-attack'},
{ammo_category = 'shotgun-shell', type = 'ammo-damage', modifier = 0.1}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{
icon = '__base__/graphics/technology/physical-projectile-damage-1.png',
icon_mipmaps = 4,
icon_size = 256
}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-b',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 200,
time = 30
},
prerequisites = {'physical-projectile-damage-1'},
name = 'physical-projectile-damage-2',
icon_size = 256
},
engine = {
icon = '__base__/graphics/technology/engine.png',
effects = {{recipe = 'engine-unit', type = 'unlock-recipe'}},
icon_mipmaps = 4,
type = 'technology',
order = 'b-a',
unit = {
ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}},
count = 100,
time = 15
},
prerequisites = {'steel-processing', 'logistic-science-pack'},
name = 'engine',
icon_size = 256
},
['weapon-shooting-speed-4'] = {
effects = {
{ammo_category = 'bullet', type = 'gun-speed', modifier = 0.3},
{ammo_category = 'shotgun-shell', type = 'gun-speed', modifier = 0.3},
{ammo_category = 'rocket', type = 'gun-speed', modifier = 0.7}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/weapon-shooting-speed-2.png', icon_mipmaps = 4, icon_size = 256},
{
icon = '__core__/graphics/icons/technology/constants/constant-speed.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1}
},
count = 400,
time = 60
},
prerequisites = {'weapon-shooting-speed-3'},
name = 'weapon-shooting-speed-4',
icon_size = 256
},
['energy-weapons-damage-6'] = {
effects = {
{ammo_category = 'laser', type = 'ammo-damage', modifier = 0.7},
{ammo_category = 'beam', type = 'ammo-damage', modifier = 0.6}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/energy-weapons-damage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-f',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'military-science-pack', 1}, {'utility-science-pack', 1}
},
count = 600,
time = 60
},
prerequisites = {'energy-weapons-damage-5'},
name = 'energy-weapons-damage-6',
icon_size = 256
},
['energy-weapons-damage-4'] = {
effects = {{ammo_category = 'laser', type = 'ammo-damage', modifier = 0.4}},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/energy-weapons-damage.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-d',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}
},
count = 400,
time = 60
},
prerequisites = {'energy-weapons-damage-3'},
name = 'energy-weapons-damage-4',
icon_size = 256
},
['mining-productivity-4'] = {
effects = {{modifier = 0.1, type = 'mining-drill-productivity-bonus'}},
icon_mipmaps = 4,
max_level = 'infinite',
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/mining-productivity.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-mining-productivity.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'c-k-f-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'chemical-science-pack', 1},
{'production-science-pack', 1}, {'utility-science-pack', 1}, {'space-science-pack', 1}
},
count_formula = '2500*(L - 3)',
time = 60
},
prerequisites = {'mining-productivity-3', 'space-science-pack'},
name = 'mining-productivity-4',
icon_size = 256
},
['stronger-explosives-5'] = {
effects = {
{ammo_category = 'rocket', type = 'ammo-damage', modifier = 0.5},
{ammo_category = 'grenade', type = 'ammo-damage', modifier = 0.2},
{ammo_category = 'landmine', type = 'ammo-damage', modifier = 0.2}
},
icon_mipmaps = 4,
type = 'technology',
upgrade = true,
icons = {
{icon = '__base__/graphics/technology/stronger-explosives-3.png', icon_mipmaps = 4, icon_size = 256}, {
icon = '__core__/graphics/icons/technology/constants/constant-damage.png',
shift = {100, 100},
icon_mipmaps = 3,
icon_size = 128
}
},
order = 'e-l-e',
unit = {
ingredients = {
{'automation-science-pack', 1}, {'logistic-science-pack', 1}, {'military-science-pack', 1},
{'chemical-science-pack', 1}, {'utility-science-pack', 1}
},
count = 500,
time = 60
},
prerequisites = {'stronger-explosives-4'},
name = 'stronger-explosives-5',
icon_size = 256
}
};
return _;
end
|
class("ReSelectTecTargetCatchupCommand", pm.SimpleCommand).execute = function (slot0, slot1)
pg.ConnectionMgr.GetInstance():Send(63013, {
target = slot1:getBody().charID
}, 63014, function (slot0)
if slot0.result == 0 then
slot1 = getProxy(TechnologyProxy)
slot1:setCurCatchupTecInfo(slot2, slot0)
slot1:sendNotification(GAME.RESELECT_TEC_TARGET_CATCHUP_DONE)
else
pg.TipsMgr.GetInstance():ShowTips("Error Code" .. slot0.result)
end
end)
end
return class("ReSelectTecTargetCatchupCommand", pm.SimpleCommand)
|
local DETECT_1 = script:GetCustomProperty("Detect1"):WaitForObject() ---@type Trigger
local DETECT_2 = script:GetCustomProperty("Detect2"):WaitForObject() ---@type Trigger
local DETECT_3 = script:GetCustomProperty("Detect3"):WaitForObject() ---@type Trigger
local DETECT_4 = script:GetCustomProperty("Detect4"):WaitForObject() ---@type Trigger
local STATUS_1 = script:GetCustomProperty("Status1"):WaitForObject() ---@type WorldText
local STATUS_2 = script:GetCustomProperty("Status2"):WaitForObject() ---@type WorldText
local STATUS_3 = script:GetCustomProperty("Status3"):WaitForObject() ---@type WorldText
local STATUS_4 = script:GetCustomProperty("Status4"):WaitForObject() ---@type WorldText
local MAX_PLAYERS = script:GetCustomProperty("MaxPlayers")
local triggers = {DETECT_1, DETECT_2, DETECT_3, DETECT_4}
local displays = {STATUS_1, STATUS_2, STATUS_3, STATUS_4}
local red = Color.New(Vector3.New(1, 0, 0))
local white = Color.New(Vector3.New(1, 1, 1))
if MAX_PLAYERS == 1 then
STATUS_1.text = ""
STATUS_2.text = ""
STATUS_3.text = ""
STATUS_4.text = ""
end
function Tick(deltaTime)
for i = 1, 4 do
local ready = 0
for _, player in ipairs(Game.GetPlayers()) do
if triggers[i]:IsOverlapping(player) then
ready = ready + 1
end
end
displays[i].text = tostring(ready).."/"..tostring(MAX_PLAYERS)
if ready == MAX_PLAYERS then
displays[i]:SetColor(white)
else
displays[i]:SetColor(red)
end
end
end
|
-- Copyright (c) 2019 StefanT <stt1@gmx.at>
-- See LICENSE.md in the project directory for license information.
--
-- A GUI element was clicked.
--
-- @param event The event containing
-- element :: LuaGuiElement: The clicked element
-- player_index :: uint: The player who did the clicking
-- button :: defines.mouse_button_type: The mouse button used if any
-- alt :: boolean: If alt was pressed
-- control :: boolean: If control was pressed
-- shift :: boolean: If shift was pressed
--
function onGuiClick(event)
local name = event.element.name
if name == TOOLBUTTON_NAME then
toggle_dialog(game.players[event.player_index])
elseif name == DIALOG_CLOSE_NAME then
close_dialog(game.players[event.player_index])
elseif name == RESOURCE_DETAILS_CLOSE_NAME then
close_resource_details_dialog(game.players[event.player_index])
elseif string.find(name, BTN_SHOW_ON_MAP_PREFIX) then
local parts = str_split(name, ":")
player_zoom_to_world(event.player_index, tonumber(parts[2]), tonumber(parts[3]))
elseif string.find(name, BTN_SHOW_TRAIN_PREFIX) then
local parts = str_split(name, ":")
player_open_map_at_train(event.player_index, tonumber(parts[2]))
elseif string.find(name, BTN_RESOURCE_DETAILS_PREFIX) then
open_resource_details_dialog(string.sub(name, string.len(BTN_RESOURCE_DETAILS_PREFIX) + 1), game.players[event.player_index])
elseif string.find(name, BTN_RESOURCE_DOWN_PREFIX) then
resource_details_down(tonumber(string.sub(name, string.len(BTN_RESOURCE_DOWN_PREFIX) + 1)), game.players[event.player_index])
elseif string.find(name, BTN_RESOURCE_UP_PREFIX) then
resource_details_up(tonumber(string.sub(name, string.len(BTN_RESOURCE_UP_PREFIX) + 1)), game.players[event.player_index])
elseif string.find(name, BTN_OPEN_REQUESTER_PREFIX) then
local entityId = tonumber(string.sub(name, string.len(BTN_OPEN_REQUESTER_PREFIX) + 1))
player_open_entity(event.player_index, global.requesters[entityId].entity)
end
end
--
-- A GUI element was changed.
--
-- @param event The event containing
-- element :: LuaGuiElement: The element whose state changed
-- player_index :: uint: The player who did the change
--
function onGuiElemChanged(event)
--log("gui element changed")
if string.sub(event.element.name, 1, 8) == "tm-stop-" then
stop_dialog_elem_changed(event.player_index, event.element)
elseif string.sub(event.element.name, 1, 13) == "tm-requester-" then
requester_dialog_elem_changed(event.player_index, event.element)
end
end
--
-- A GUI element was opened.
--
-- @param event The event containing
-- player_index :: uint: The player
-- gui_type :: defines.gui_type: The GUI type that was opened
-- entity :: LuaEntity (optional): The entity that was opened
-- item :: LuaItemStack (optional): The item that was opened
-- equipment :: LuaEquipment (optional): The equipment that was opened
-- other_player :: LuaPlayer (optional): The other player that was opened
-- element :: LuaGuiElement (optional): The custom GUI element that was opened
--
function onGuiOpened(event)
--log("gui element opened "..event.gui_type)
if not event.element then
local player = game.players[event.player_index]
-- hide the mod's dialogs if a game GUI is opened
close_dialog(player)
close_stop_dialog(player)
close_requester_dialog(player)
close_resource_details_dialog(player)
if event.entity then
if event.entity.type == STOP_TYPE and event.entity.name == CTM_STOP then
open_stop_dialog(player, event.entity.unit_number)
elseif event.entity.type == REQUESTER_TYPE and event.entity.name == CTM_REQUESTER then
open_requester_dialog(player, event.entity.unit_number)
elseif event.entity.type == "lamp" then
destroy_requester_dialog(player)
end
end
end
end
--
-- A GUI element was closed.
--
-- @param event The event containing
-- player_index :: uint: The player
-- gui_type :: defines.gui_type: The GUI type that was open
-- entity :: LuaEntity (optional): The entity that was open
-- item :: LuaItemStack (optional): The item that was open
-- equipment :: LuaEquipment (optional): The equipment that was open
-- other_player :: LuaPlayer (optional): The other player that was open
-- element :: LuaGuiElement (optional): The custom GUI element that was open
-- technology :: LuaTechnology (optional): The technology that was automatically selected when opening the research GUI
-- tile_position :: TilePosition (optional): The tile position that was open
--
function onGuiClosed(event)
--log("gui element closed "..event.gui_type)
if event.entity then
if event.entity.type == STOP_TYPE and event.entity.name == CTM_STOP then
close_stop_dialog(game.players[event.player_index])
elseif event.entity.type == REQUESTER_TYPE and event.entity.name == CTM_REQUESTER then
close_requester_dialog(game.players[event.player_index])
end
end
end
--
-- The selected tab was changed.
--
-- @param event The event containing
-- element :: LuaGuiElement: The tabbed pane whose selected tab changed
-- player_index :: uint: The player
--
function onGuiSelectedTabChanged(event)
if string.sub(event.element.name, 1, 10) == "tm-dialog-" then
dialog_tab_changed(event.player_index, event.element)
end
end
--
-- Register the event callbacks.
--
function registerGuiEvents()
script.on_event(defines.events.on_gui_click, onGuiClick)
script.on_event(defines.events.on_gui_opened, onGuiOpened)
script.on_event(defines.events.on_gui_closed, onGuiClosed)
script.on_event(defines.events.on_gui_elem_changed, onGuiElemChanged)
script.on_event(defines.events.on_gui_selected_tab_changed, onGuiSelectedTabChanged)
end
|
--
-- end.lua
--
|
object_tangible_furniture_city_flag_city_10 = object_tangible_furniture_city_shared_flag_city_10:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_city_flag_city_10, "object/tangible/furniture/city/flag_city_10.iff")
|
include "MaterialLib.lua"
WorldSize = 100;
CellSize = 0.01; --metry
TimeStep = 0.1;
--[[
kroki:
1. wymiana temperatury
zmiana temp -> zmiana ciśnienia(v = const)
2. wymiana ciśnienia
zmiana ciśnienia -> zmiana masy i temperatury
--]]
function initialize(Simulation)
Simulation:SetName("Temperature flow");
Simulation:SetWorldSize(WorldSize, WorldSize);
CellCount = WorldSize * WorldSize;
Simulation:AddParameter("temp", Const.Types.Float);
Simulation:AddParameter("pressure", Const.Types.Float);
Simulation:AddParameter("mass", Const.Types.Float);
Simulation:AddParameter("material", Const.Types.Int);
-- Simulation:AddParameter("heating", Const.Types.Float);
local blender = Simulation:AddBlender("Temperature");
blender:SetMode(Const.Blender.Mode.Range);
blender:SetParameter("temp");
blender:SetOptions({ Adaptive=false, min=0, max=1020 });
blender:AddColor(0, 0, 1);
blender:AddColor(0, 1, 0);
blender:AddColor(1, 0, 0);
local blender = Simulation:AddBlender("Mass");
blender:SetMode(Const.Blender.Mode.Range);
blender:SetParameter("mass");
blender:SetOptions({ Adaptive=false, min=0, max=1e-5 });
blender:AddColor(0, 0, 1);
blender:AddColor(0, 1, 0);
blender:AddColor(1, 0, 0);
local blender = Simulation:AddBlender("Pressure");
blender:SetMode(Const.Blender.Mode.Range);
blender:SetParameter("pressure");
blender:SetOptions({ Adaptive=true, min = 101300, max = 102325 });
blender:AddColor(0, 0, 1);
blender:AddColor(0, 1, 0);
blender:AddColor(1, 0, 0);
local blender = Simulation:AddBlender("Material");
blender:SetMode(Const.Blender.Mode.Index);
blender:SetParameter("material");
blender:GenerateColorsByBits(2);
local blender = Simulation:AddBlender("State viewer");
blender:SetMode(Const.Blender.Mode.Index);
blender:SetParameter("state");
blender:GenerateColorsByBits(1);
local ph1 = Simulation:CreatePhase("Flow");
ph1:SetDuration(100);
ph1:SetStepCount(100 / TimeStep);
ph1:IgnoreInactive(false);
ph1:AddStep({
Name = "",
CellFunc = "TemperatureProcess",
OnBegin = "TempBegin",
-- OnEnd = "TempEnd",
});
ph1:AddStep({
Name = "",
CellFunc = "PressureProcess",
-- OnBegin = "stepBegin", OnEnd = "stepEnd",
});
ph1:OnPhaseBegin("phaseBegin");
ph1:OnPhaseEnd("phaseEnd");
ph1:OnClick("Phase1Click");
ph1:SetNeighborhoodMode(Const.Neighborhood.Mode.Neuman);
ph1:SetNeighborhoodFuncType(Const.Neighborhood.Func.Basic);
ph1:SetBoundaryMode(Const.Boundary.Cutted);
CellSurface = CellSize * CellSize;
CellVolume = CellSurface * CellSize;
return 0;
end;
function place(State, x, y, h, t)
local item;
local hd = h / 2;
for i=-hd,hd,1 do
item = State:at(x+i, y + 0);
RegState(State, x+i, y+0, 2);
item.temp = t;
SetMaterial(item, Copper);
end;
end
function phaseBegin(State, Phase)
local item;
for i=0,WorldSize-1,1 do
for j=0,WorldSize-1,1 do
item = State:at(i, j);
SetMaterial(item, Air);
item.temp = 20;
item.pressure = BeginConditions.pressure;
end;
end;
-- for i = -20, 20, 20 do
-- place(State, 50+i, 50, 30, 20);
-- end;
local wsh = WorldSize/2;
RegState(State, wsh, wsh, 3);
return 0;
end
function Phase1Click(State, Phase, Coord, Button)
local cell = State:at(Coord.x, Coord.y)
print("x:".. Coord.x .. " y:" .. Coord.y, "material:"..Materials[cell.material].Name, "temp:" .. cell.temp, "pressure:".. cell.pressure, "mass:" .. cell.mass);
return 0;
end
function TempBegin(State, Phase)
local count = DynStates.Count;
for i = 1,count,1 do
local vec = DynStates[i];
local cell = State:at(vec.x, vec.y);
local stateid = cell.state;
local state = States[cell.state];
if not (state == nil) then
state.update(cell, state);
end
end
local Mass = { 0, 0, 0, 0, };
for i=0,WorldSize-1,1 do
for j=0,WorldSize-1,1 do
item = State:at(i, j);
local m = item.material;
Mass[m] = Mass[m] + item.mass;
end;
end;
print(State:Time(), Materials[1].Name .. ":" .. Mass[1], Materials[2].Name .. ":" .. Mass[2]);--, Materials[3].Name .. ":" .. Mass[3]);
return 0;
end
function TemperatureProcess(ExecData, this, CellCurr, CellTable)
local c = CellTable:Count() - 1;
local this_temp = this.temp;
local dT = 0;
local this_mat = this.material;
local this_matdata = Materials[this_mat];
for i = 0,c,1 do
local itm = CellTable:At(i);
local delta = itm.temp - this_temp;
local coeff;
if itm.material == this_mat then
coeff = this_matdata.Lambda;
else
coeff = 50;
end
dT = dT + delta * coeff * TimeStep * CellSize ;--CellSurface / d;
end
CellCurr.temp = this_temp + dT;
-- 8.314 - stała gazowa
if this_matdata.IsGass then
local dP = (this.mass / this_matdata.MolarMass) / CellVolume * 8.314 * dT;-- (this_temp + 273.15);
this.pressure = this.pressure + dP;
end
return TemperatureProcess;
end
function sign(x)
if x < 0 then return -1; end;
if x > 0 then return 1; end;
return 0;
end
function PressureProcess(ExecData, this, CellCurr, CellTable)
local this_pressure = this.pressure;
local this_temp = this.temp;
local this_coord = ExecData.Coord;
local this_mat = this.material;
local this_matdata = Materials[this_mat];
local dP = 0;
local dm = 0;
local dT = this.mass * this_matdata.Cw * this_temp;
if not (this_matdata.IsGass) then
return 0;
end
-- print("asdas");
-- local molar = (this.mass / this_matdata.MolarMass);
local c = CellTable:Count() - 1;
for i = 0,c,1 do
local itm = CellTable:At(i);
if itm.material == this_mat then
local delta = itm.pressure - this_pressure;
local coeff = 1;
local mass_coeff = 1;
local itm_coord = CellTable:PosAt(i);
local avg_temp = 273.15 + math.max(this.temp, itm.temp);
local dy = 0;
if this_coord.x == itm_coord.x then
dy = this_coord.y - itm_coord.y;
-- if not (dy == 0) then
-- delta = delta + -9.81 * dy;
-- end;
end
-- print("tst", delta, dy);
if sign(delta) == -dy then
local l1 = math.min(itm.temp, this_temp);
local l2 = math.max(itm.temp, this_temp);
local c = (l2 / l1);
delta = delta * math.min(c, 2);--9.81 *3 dy * 100;
end
local mass_move = 0;
if math.abs(delta) > 10 then
mass_coeff = 2;
end;
mass_move = delta * this_matdata.MolarMass * CellVolume / (8.314 * avg_temp);
mass_move = mass_move * mass_coeff * TimeStep;
if mass_move > 0 then
--jeśli masa odpływa, ciepła nie ubywa
dT = dT + mass_move * this_matdata.Cw * item.temp;
end
dm = dm + mass_move;
dP = dP + delta * coeff * TimeStep;
end
end
dm = dm + this.mass;
CellCurr.pressure = this_pressure + dP;
CellCurr.mass = dm;
CellCurr.temp = dT / (this_matdata.Cw * dm);
return PressureProcess;
end
DynStates = {
Count = 0
};
function RegState(State, ax, ay, id)
local c = DynStates.Count;
c = c + 1;
DynStates.Count = c;
local vec = { x = ax, y = ay, state = id };
DynStates[c] = vec;
State:at(ax, ay).state = id;
end
States = { }
States[2] = {
temp = 100,
update = function(cell, state_data)
cell.temp = state_data.temp;
end
}
States[3] = {
temp = 1000,
pressure = 101325 * 1.1;
update = function(cell, state_data)
cell.temp = state_data.temp;
cell.pressure = state_data.pressure;
end
}
function SetMaterial(Cell, Material)
Cell.material = Material.id;
Cell.mass = Material.Ro * math.pow(CellSize, 3);
end;
BeginConditions = {
Temp = 20,
pressure = 101325,
};
|
local F, C = unpack(select(2, ...))
tinsert(C.themes["FreeUI"], function()
local r, g, b = C.r, C.g, C.b
F.StripTextures(HelpFrame)
F.SetBD(HelpFrame)
HelpFrameHeader:Hide()
F.ReskinClose(HelpFrameCloseButton)
F.StripTextures(HelpFrameMainInset)
F.StripTextures(HelpFrameLeftInset)
F.StripTextures(HelpBrowser.BrowserInset)
F.CreateBDFrame(HelpFrameGM_ResponseScrollFrame1, .25)
F.CreateBDFrame(HelpFrameGM_ResponseScrollFrame2, .25)
F.CreateBDFrame(HelpFrameReportBugScrollFrame, .25)
F.CreateBDFrame(HelpFrameSubmitSuggestionScrollFrame, .25)
F.StripTextures(ReportCheatingDialogCommentFrame)
F.CreateBDFrame(ReportCheatingDialogCommentFrame, .25)
local scrolls = {
"HelpFrameKnowledgebaseScrollFrameScrollBar",
"HelpFrameReportBugScrollFrameScrollBar",
"HelpFrameSubmitSuggestionScrollFrameScrollBar",
"HelpFrameGM_ResponseScrollFrame1ScrollBar",
"HelpFrameGM_ResponseScrollFrame2ScrollBar",
"HelpFrameKnowledgebaseScrollFrame2ScrollBar",
}
for _, scroll in next, scrolls do
F.ReskinScroll(_G[scroll])
end
local buttons = {
"HelpFrameAccountSecurityOpenTicket",
"HelpFrameCharacterStuckStuck",
"HelpFrameOpenTicketHelpOpenTicket",
"HelpFrameKnowledgebaseSearchButton",
"HelpFrameGM_ResponseNeedMoreHelp",
"HelpFrameGM_ResponseCancel",
"HelpFrameReportBugSubmit",
"HelpFrameSubmitSuggestionSubmit"
}
for _, button in next, buttons do
F.Reskin(_G[button])
end
F.StripTextures(HelpFrameKnowledgebase)
F.ReskinInput(HelpFrameKnowledgebaseSearchBox)
select(3, HelpFrameReportBug:GetChildren()):Hide()
select(3, HelpFrameSubmitSuggestion:GetChildren()):Hide()
select(5, HelpFrameGM_Response:GetChildren()):Hide()
select(6, HelpFrameGM_Response:GetChildren()):Hide()
HelpFrameReportBugScrollFrameScrollBar:SetPoint("TOPLEFT", HelpFrameReportBugScrollFrame, "TOPRIGHT", 1, -16)
HelpFrameSubmitSuggestionScrollFrameScrollBar:SetPoint("TOPLEFT", HelpFrameSubmitSuggestionScrollFrame, "TOPRIGHT", 1, -16)
HelpFrameGM_ResponseScrollFrame1ScrollBar:SetPoint("TOPLEFT", HelpFrameGM_ResponseScrollFrame1, "TOPRIGHT", 1, -16)
HelpFrameGM_ResponseScrollFrame2ScrollBar:SetPoint("TOPLEFT", HelpFrameGM_ResponseScrollFrame2, "TOPRIGHT", 1, -16)
for i = 1, 15 do
local bu = _G["HelpFrameKnowledgebaseScrollFrameButton"..i]
bu:DisableDrawLayer("ARTWORK")
F.CreateBD(bu, 0)
F.CreateGradient(bu)
end
local function colourTab(f)
f.text:SetTextColor(1, 1, 1)
end
local function clearTab(f)
f.text:SetTextColor(1, .8, 0)
end
local function styleTab(bu)
bu.selected:SetColorTexture(r, g, b, .2)
bu.selected:SetDrawLayer("BACKGROUND")
bu.text:SetFont(C.font.normal, 14, "OUTLINE")
F.Reskin(bu, true)
bu:SetScript("OnEnter", colourTab)
bu:SetScript("OnLeave", clearTab)
end
for i = 1, 6 do
styleTab(_G["HelpFrameButton"..i])
end
styleTab(HelpFrameButton16)
HelpFrameAccountSecurityOpenTicket.text:SetFont(C.font.normal, 14, "OUTLINE")
HelpFrameOpenTicketHelpOpenTicket.text:SetFont(C.font.normal, 14, "OUTLINE")
HelpFrameCharacterStuckHearthstone:SetSize(56, 56)
F.CreateBG(HelpFrameCharacterStuckHearthstone)
HelpFrameCharacterStuckHearthstoneIconTexture:SetTexCoord(.08, .92, .08, .92)
F.Reskin(HelpBrowserNavHome)
F.Reskin(HelpBrowserNavReload)
F.Reskin(HelpBrowserNavStop)
F.Reskin(HelpBrowserBrowserSettings)
F.ReskinArrow(HelpBrowserNavBack, "left")
F.ReskinArrow(HelpBrowserNavForward, "right")
HelpBrowserNavHome:SetSize(18, 18)
HelpBrowserNavReload:SetSize(18, 18)
HelpBrowserNavStop:SetSize(18, 18)
HelpBrowserBrowserSettings:SetSize(18, 18)
HelpBrowserNavHome:SetPoint("BOTTOMLEFT", HelpBrowser, "TOPLEFT", 2, 4)
HelpBrowserBrowserSettings:SetPoint("TOPRIGHT", HelpFrameCloseButton, "BOTTOMLEFT", -4, -1)
LoadingIcon:ClearAllPoints()
LoadingIcon:SetPoint("LEFT", HelpBrowserNavStop, "RIGHT")
F.StripTextures(BrowserSettingsTooltip)
F.CreateBD(BrowserSettingsTooltip)
F.CreateSD(BrowserSettingsTooltip)
F.Reskin(BrowserSettingsTooltip.CacheButton)
F.Reskin(BrowserSettingsTooltip.CookiesButton)
F.Reskin(ReportCheatingDialogReportButton)
F.Reskin(ReportCheatingDialogCancelButton)
F.CreateBD(TicketStatusFrameButton)
F.CreateSD(TicketStatusFrameButton)
F.CreateBD(ReportCheatingDialog)
F.CreateSD(ReportCheatingDialog)
--ReportCheatingDialog.Border:Hide()
end)
|
--- Use color patches to select movement direction.
-- The robot will move in the direction indicated by the led lights when
-- detects a color patch on the floor of the same color. If you pick the
-- robot up it powers down.
--
-- This is a state machine to be run using @{main_ahsm}. For this set
-- `nvs.write("ahsm", "root", "states.colorway")` and then run `dofile'main_ahsm.lua'`,
-- or simply set `nvs.write("autorun", "main", "main_ahsm.lua")` for autorun.
-- @hsm colorway.lua
-- color events
local e_color = {
['yellow'] = {vel = 0.1, dir = 0.0},
['blue'] = {vel = 0.1, dir = math.pi},
['green'] = {vel = 0.1, dir = math.pi/2},
['red'] = {vel = 0.1, dir = 3*math.pi/2},
}
local ahsm = require 'ahsm'
local color = require('color')
local ledr = require 'led_ring'
local onoff = require 'states.onoff'
--preproccess events
for c, e in pairs(e_color) do
local rgb = color.color_rgb[c]
e.r, e.g, e.b = rgb[1], rgb[2], rgb[3]
e.x = e.vel*math.cos(e.dir)
e.y = e.vel*math.sin(e.dir)
e.led = math.floor(ledr.n_leds*e.dir/(2*math.pi))
e._name = "e_"..c
end
local produce_color_event = function(name)
robot.hsm.queue_event(e_color[name])
end
local s_main = ahsm.state {
}
local transitions = {}
for c, e in pairs(e_color) do
local t_change = ahsm.transition {
src = s_main, tgt = s_main,
events = {e},
effect = function (ev)
--print ('!', c, ev.x, ev.y, ev.r, ev.g, ev.b)
robot.omni.drive(ev.x, ev.y, 0.0)
ledr.set_all(0, 0, 0)
for ci, e in pairs(e_color) do
--print ('ARC', c, e.led, e.r, e.g, e.b)
if ci == c then
ledr.set_arc(e.led-2, 5, e.r, e.g, e.b)
else
ledr.set_arc(e.led, 1, e.r, e.g, e.b)
end
end
ledr.update()
end
}
transitions['t_'..c] = t_change
end
local s_on = onoff.states.ON
local s_off = onoff.states.OFF
local function paint_leds_empty ()
ledr.set_all(0, 0, 0)
for c, e in pairs(e_color) do
--print ('ARC', c, e.led, e.r, e.g, e.b)
ledr.set_arc(e.led, 1, e.r, e.g, e.b)
end
ledr.update()
end
s_off.entry = function ()
paint_leds_empty()
end
s_on.entry = function ()
paint_leds_empty()
robot.omni.drive(0, 0, 0.0)
robot.omni.enable(true)
color.color_cb.append(produce_color_event)
color.enable(true) -- only enable (no dis. because it could be used by others)
end
s_on.exit = function ()
robot.omni.enable(false)
color.enable(false)
color.color_cb.remove(produce_color_event)
end
s_on.states = { s_main }
s_on.transitions = transitions
s_on.initial = s_main
return onoff
|
local copBlops = {}
RegisterNetEvent("vrp:playerLoaded")
AddEventHandler("vrp:playerLoaded", function(user, data)
local job = data.job
if job == "Police"or job == "EMS" then
local player = GetPlayerFromServerId(user.source)
local blip = AddBlipForEntity(player)
SetBlipSprite(blip, 1)
SetBlipAsShortRange(blip, true)
SetBlipScale(blip, 1.0)
SetBlipDisplay(blip, 2)
SetBlipFlashes(blip, false)
SetBlipFlashesAlternate(blip, false)
SetBlipNameToPlayerName(blip, GetPlayerFromServerId(k))
if job == "Police" then
SetBlipColour(blip, 3)
else
SetBlipColour(blip, 1)
end
copBlops[user.source] = blip
end
end)
RegisterNetEvent("vrp:playerUnloaded")
AddEventHandler("vrp:playerUnloaded", function(user)
RemoveBlip(copBlops[user.source])
copBlops[user.source] = nil
end)
-- local onlineCops = {}
-- local onlineBlipSet = {}
-- Citizen.CreateThread(
-- function()
-- while true do
-- Citizen.Wait(1)
-- if isCop or isEMS then
-- HandleCopGPS()
-- end
-- end
-- end
-- )
-- function vRPCops.sendOnlineCopsToClients(serverCopsSet)
-- onlineCops = serverCopsSet
-- end
-- function HandleCopGPS()
-- -- * Draws other cops for current cop
-- for k, v in pairs(onlineCops) do
-- if onlineBlipSet[k] == nil then
-- local blip = AddBlipForCoord(v[1], v[2], v[3])
-- SetBlipSprite(blip, 1)
-- SetBlipAsShortRange(blip, true)
-- SetBlipScale(blip, 1.0)
-- SetBlipDisplay(blip, 2)
-- SetBlipFlashes(blip, false)
-- SetBlipFlashesAlternate(blip, false)
-- SetBlipNameToPlayerName(blip, GetPlayerFromServerId(k))
-- if v[4] == 1 then
-- SetBlipColour(blip, 3)
-- else
-- SetBlipColour(blip, 1)
-- end
-- onlineBlipSet[k] = blip
-- else
-- SetBlipCoords(onlineBlipSet[k], v[1], v[2], v[3])
-- end
-- end
-- for k, v in pairs(onlineBlipSet) do
-- if (onlineCops[k] == nil) then
-- print("removing blib...")
-- RemoveBlip(onlineBlipSet[k])
-- onlineBlipSet[k] = nil
-- end
-- end
-- -- * Sends cop location to server
-- local jobID = 1
-- if isEMS then
-- jobID = 2
-- end
-- local ped = GetPlayerPed(-1)
-- local x, y, z = table.unpack(GetEntityCoords(ped, true))
-- vRPCopsS._addOnlineCop(jobID, x, y, z)
-- end
RegisterNetEvent("dispatch")
AddEventHandler(
"dispatch",
function(playerid, msg, description, location)
if (isCop) or (isEMS) then
TriggerEvent(
"chat:addMessage",
{
color = {255, 255, 255},
multiline = true,
args = {"[Dispatch]", msg .. ", Location: " .. location}
}
)
end
end
)
|
-----------------------------------
--
-- Assault: Troll Fugitives
--
-----------------------------------
local ID = require("scripts/zones/Lebros_Cavern/IDs")
require("scripts/globals/instance")
-----------------------------------
function afterInstanceRegister(player)
local instance = player:getInstance()
player:messageSpecial(ID.text.ASSAULT_23_START, 23)
player:messageSpecial(ID.text.TIME_TO_COMPLETE, instance:getTimeLimit())
end
function onInstanceCreated(instance)
for i,v in pairs(ID.mob[23]) do
SpawnMob(v, instance)
end
local rune = instance:getEntity(bit.band(ID.npc.RUNE_OF_RELEASE, 0xFFF), tpz.objType.NPC)
local box = instance:getEntity(bit.band(ID.npc.ANCIENT_LOCKBOX, 0xFFF), tpz.objType.NPC)
rune:setPos(-376.272,-9.893,89.189,0)
box:setPos(-384.097,-10,84.954,49)
end
function onInstanceTimeUpdate(instance, elapsed)
updateInstanceTime(instance, elapsed, Lebros.text)
end
function onInstanceFailure(instance)
local chars = instance:getChars()
for i,v in pairs(chars) do
v:messageSpecial(ID.text.MISSION_FAILED,10,10)
v:startEvent(102)
end
end
function onInstanceProgressUpdate(instance, progress)
if progress >= 15 then
instance:complete()
end
end
function onInstanceComplete(instance)
local chars = instance:getChars()
for i,v in pairs(chars) do
v:messageSpecial(ID.text.RUNE_UNLOCKED, 8, 8)
end
local rune = instance:getEntity(bit.band(ID.npc.RUNE_OF_RELEASE, 0xFFF), tpz.objType.NPC)
local box = instance:getEntity(bit.band(ID.npc.ANCIENT_LOCKBOX, 0xFFF), tpz.objType.NPC)
rune:setStatus(tpz.status.NORMAL)
box:setStatus(tpz.status.NORMAL)
end
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
end
|
-- To whoever decides to work on this, sorry for this code being such a mess ~~ User:Taimoorahmed11
local u = mw.ustring.char
local gsub = mw.ustring.gsub
local export = {}
local vav = u(0x0648)
local ye = u(0x06CC)
local alif = u(0x0627)
local he = 'ہ'
local vw_s_cfu = u(0x0650) -- zer (i)
local vw_s_ccu = u(0x0655) -- hamza below
local vw_s_cbr = u(0x064F) -- pesh (u)
local vw_s_mcu = u(0x0654) -- hamza above
local vw_s_ocu = u(0x064E) -- zabar (a)
local vw_l_cbr = u(0x0657) -- inverted zer
local vw_l_cfu = u(0x0656) -- subscript alif
local hat = u(0x065A)
local inverted_hat = u(0x065B)
local hats = hat .. inverted_hat
local short_vowels_list = vw_s_cfu .. vw_s_ccu .. vw_s_cbr .. vw_s_mcu .. vw_s_ocu
-- carrier + diacritic combos
local long_u = vav .. vw_l_cbr
local short_o = vav .. inverted_hat
local long_i = ye .. vw_l_cfu
local short_e = ye .. inverted_hat
local vocalised_carrier = long_u .. short_o .. long_i .. short_e .. 'و' .. 'و' .. 'ی' .. 'ے'
local consonants_1 = "ببپتثہجچحخدذرزژسشصضطظعغفقکگلࣇمنݨوہىھٹڈڑ"
local consonants_2 = "ببھتھڈھجھدھٹھکھڑھ"
local vowels = "اِیاُوآے"
local consonants = gsub(consonants_1, consonants_2, "")
local conv = {
--consonants
['ب'] = 'b', ['پ'] = 'p', ['ت'] = 't', ['ث'] = 's', ['ج'] = 'j',
['چ'] ='c', ['ح'] = 'h', ['خ'] = 'x', ['د'] = 'd', ['ذ'] = 'z',
['ر'] = 'r', ['ز'] = 'z', ['ژ'] = 'ž', ['س'] = 's', ['ش'] = 'ś',
['ص'] = 's', ['ض'] = 'z', ['ط'] = 't', ['ظ'] = 'z', ['ع'] = '',
['غ'] = 'ġ', ['ف'] = 'f', ['ق'] = 'q', ['ک'] = 'k', ['گ'] = 'g',
['ل'] = 'l', ['م'] = 'm', ['ن'] = 'n', ['ݨ'] = 'ṇ', ['وَ'] = 'v',
['ہ'] = 'h', ['ى'] = 'y', ['ھ'] = 'h', ['ٹ'] = 'ṭ', ['ڈ'] = 'ḍ',
['ڑ'] = 'ṛ', ['ࣇ'] = 'ḷ',
--aspirated consonants
['بھ'] = 'bh', ['تھ'] = 'th', ['ڈھ'] = 'ḍh', ['جھ'] = 'jh',
['دھ'] = 'dh', ['ٹھ'] = 'ṭh', ['کھ'] = 'kh', ['ڑھ'] = 'ṛh',
['گھ'] = 'gh', ['لھ'] = 'lh',
-- digits
['۰'] = '0', ['۱'] = '1', ['۲'] = '2', ['۳'] = '3', ['۴'] = '4',
['۵'] = '5', ['۶'] = '6', ['۷'] = '7', ['۸'] = '8', ['۹'] = '9',
}
local nasal_assim = {
['[kg]h?'] = 'ṅ',
['[cj]h?'] = 'ñ',
['[ṭḍ]h?'] = 'ṇ',
['[td]h?'] = 'n',
['[pb]h?'] = 'm',
['n'] = 'n',
['m'] = 'm',
['s'] = 'n',
}
local short_vowels = {
-- independent vowels
[u(0x00627)] = 'a', -- alif ا
[u(0x00623)] = 'ā', -- alif أ
[u(0x00622)] = 'ā', -- alif with madda آ
[u(0x06D2)] = 'ē', -- ye ے
['اُ '] = 'u', -- alif with damma
[u(0x0624)] = 'au', -- vav with hamza ؤ
--vowels
[u(0x064E)] = 'a', -- zabar َ◌
[u(0x0670)] = 'ā', -- khari zabar ◌ٰ
[u(0x0650)] = 'i', -- zer ◌ِ
[u(0x064F)] = 'u', -- pesh ُ◌
-- other diacritics
[u(0x06BA)] = 'N', -- noon ghunna ں
[u(0x0621)] = 'i', -- hamza ء
[u(0x0651)] = 'ː', -- shad ◌ّ
[u(0x064B)] = 'n', -- do zabar ◌ً
[u(0x064D)] = 'ni', -- do zer ◌ٍ
}
local alif = 'ا'
local alif2 = 'أ'
local vav = 'و'
local ye = 'ی'
local noon = u(0x06BA)
local shadda = u(0x0651)
local ghunna = u(0x06BA)
local aspirate = u(0x06BE)
local sukoon = u(0x0652)
function export.tr(text, lang, sc)
-- special cases (added 'mai' since in Punjabi 'میں' is only used for 'mai')
text = gsub(text, '([' .. consonants .. '])' .. alif .. '([' .. consonants .. '])', "%1ā%2")
text = gsub(text, 'اللہ', "Allāh")
text = gsub(text, 'مَیں', "ma͠i")
text = gsub(text, alif .. ye .. '([' .. consonants .. '])', "ē%1")
text = gsub(text, '([' .. consonants .. '])' .. 'ائی', "%1āī")
-- Can't remember why the line below was added but it's messing up some of the translations | N2: It was added for 'Waheguru'
-- text = gsub(text, '([' .. consonants .. '])' .. alif .. '([' .. consonants .. '])' .. vw_s_cfu .. '([' .. consonants .. '])', "%1ā%2e%3")
text = gsub(text, "ن٘", "ṅ")
text = gsub(text, alif .. vav .. "([" .. consonants .. "])", "ō%1")
text = gsub(text, "([" .. consonants .. "])" .. vav, "%1ō")
text = gsub(text, "([" .. consonants .. "])" .. vav .. "([" .. consonants .. "])", "%1ō%2")
text = gsub(text,
'وا' .. '([' .. consonants .. '])',
"vā%1")
-- full stop
text = gsub(text, '۔', ".")
text = gsub(text, '؟', "?")
-- word-final alif
text = gsub(text, alif .. ghunna, "ā̃")
text = gsub(text, '([' .. consonants .. '])' .. alif, "%1ā")
text = gsub(text, '([' .. consonants .. '])' .. shadda .. alif, "%1%1ā")
-- if 'ا' is medial
text = gsub(text, '([' .. consonants .. '])' .. 'ا' .. '([' .. consonants .. '])', "%1ā%2")
text = gsub(text, '([' .. consonants .. '])' .. ye .. alif, "%1iā")
-- if choti ye at end + case if not at end
text = gsub(text, '([' .. consonants .. '])' .. ye .. '([' .. consonants .. '])', "%1ē%2")
text = gsub(text, '([' .. consonants .. '])' .. ye, "%1i")
-- intervocalic alif is a long a sound
text = gsub(text, '([' .. consonants .. 'و ' .. '])' .. alif2 .. '([' .. consonants .. 'و' .. '])', "%1ā%2")
-- schwa rules
--- after do-chashme-he
text = gsub(text, '([' .. consonants .. '])' .. aspirate .. '([' .. consonants .. '])', "%1ha%2")
--- after zer | removed this, as it was realistically unecessary
--text = gsub(text, '([' .. consonants .. '])' .. vw_s_cfu .. '([' .. consonants .. '])' .. "ْ", "%1i%2")
--text = gsub(text, '([' .. consonants .. '])' .. vw_s_cfu .. '([' .. consonants .. '])', "%1i%2a")
--- initial letter and second letter except with diacritics
-- initial consonant + he sound = e/ê
text = gsub(text, "([" .. consonants .. vowels .. "])" .. he .. "([" .. consonants .. "])", "%1eh%2")
text = gsub(text, "([" .. consonants .. "])" .. 'ح' .. "([" .. consonants .. "])", "%1êhê%2")
-- word-initial alif + vowelled carrier drops the alif
text = gsub(text, '^' .. alif .. '([' .. vocalised_carrier .. '])', "%1")
-- word-initial alif + short vowel diacritic drops the alif
text = gsub(text, '^' .. alif .. '([' .. short_vowels_list .. '])', "%1")
-- do-chashme-he zabar, zer, pesh
text = gsub(text, "([" .. consonants .. "])" .. vw_s_ocu .. aspirate, "%1ha" )
text = gsub(text, "([" .. consonants .. "])" .. vw_s_cfu .. aspirate, "%1hi" )
text = gsub(text, "([" .. consonants .. "])" .. vw_s_cbr .. aspirate, "%1hu" )
-- shadda
text = gsub(text, '([' .. consonants .. '])' .. shadda, "%1%1")
-- long /u:/ and /i:/ and /e:/ and /o:/
text = gsub(text, "([" .. consonants .. "])" .. vw_s_cbr .. vav, "%1ū")
text = gsub(text, "([" .. consonants .. "])" .. vw_s_cfu .. ye, "%1ī")
text = gsub(text, "([" .. consonants .. "])" .. ye .. "([" .. consonants .. "])", "%1ē")
text = gsub(text, "([" .. consonants .. "])" .. vav .. "([" .. consonants .. "])", "ō%2")
--- nasalised
text = gsub(text, "([" .. consonants .. "])" .. vw_s_cbr .. vav .. ghunna, "%1ū̃")
text = gsub(text, "([" .. consonants .. "])" .. vw_s_cfu .. ye .. ghunna, "%1ī̃")
text = gsub(text, "([" .. consonants .. "])" .. vav .. ghunna, "%1ō̃")
text = gsub(text, "([" .. consonants .. "])" .. ye .. ghunna, "%1ē̃")
-- final he + short vowel disregards the he and transliterates the vowel
text = gsub(text, "([" .. vowels .. "])" .. he, "%1h")
text = gsub(text, "([" .. consonants .. "])" .. he , "%1a")
text = gsub(text, "([" .. consonants .. "])" .. he .. "([".. consonants .. vowels .."])", "%1h")
-- sukoon diacritic
text = gsub(text, "ْ", "")
-- vav with hat = short o
text = gsub(text, vav .. "[" .. hats .. "]", "o")
-- vav with short vowel
text = gsub(text,
vav .. "([" .. short_vowels_list .. "])",
function(c)
return "v" .. short_vowels[c]
end)
-- nun or re with hat
-- TODO: add support for re
text = gsub(text, "ن" .. "[" .. hats.. "]", "n")
-- ye with hat = short e
text = gsub(text, ye .. "[" .. hats.. "]", "e")
-- long i
text = gsub(text, ye .. vw_l_cfu, 'ī')
-- intervocalic ye is a long a sound
text = gsub(text, '([' .. consonants .. '])' .. ye .. '([' .. consonants .. '])', "%1ē%2")
-- regard the consonant + short vowel combinations throughout
text = gsub(text, '.', short_vowels)
text = gsub(text, '[بتجدکگٹڈڑ]ھ', conv)
text = gsub(text, '[ببپتثجچحخدذرزژسشصضطظعغفقکگلࣇمنݨوہىھٹڈڑ]', conv)
-- normal consonants left over
text = gsub(text, vav, 'v')
text = gsub(text, 'ہ', 'h')
text = gsub(text, "ی", "y")
for key,val in pairs(nasal_assim) do
text = mw.ustring.gsub(text,"N("..key..")",val.."%1")
end
text = gsub(text,"([aiueēoāīū])N ", "%1̃ ")
text = gsub(text,"(.?)N", "%1̃")
text = gsub(text,"ː(.)","%1%1")
text = gsub(text," ?।",".")
text = gsub(text," $","")
text = gsub(text, "aā", "ā")
text = gsub(text, "aê", "ê")
text = gsub(text, "ah", "êh")
text = gsub(text, "uō", "ū")
text = gsub(text, "iō", "ī")
text = gsub(text, "ĩ", "ē̃")
text = gsub(text, "nj", "ñj")
text = gsub(text, "nk", "ṅk")
text = gsub(text, "ng", "ṅg")
text = gsub(text, "ṅj", "ñj")
return text
end
return export
|
local suggestion = param.get("suggestion", "table")
ui.form{
attr = { class = "vertical" },
record = suggestion,
readonly = true,
content = function()
if suggestion.author then
suggestion.author:ui_field_text{label=_"Author"}
end
ui.field.text{ label = _"Title", name = "name" }
ui.container{
attr = { class = "suggestion_content wiki" },
content = function()
slot.put(suggestion:get_content("html"))
end
}
end
}
execute.view{
module = "suggestion",
view = "_list_element",
params = {
suggestions_selector = Suggestion:new_selector():add_where{ "id = ?", suggestion.id },
initiative = suggestion.initiative,
show_name = false,
show_filter = false
}
}
|
local Gtk
Gtk = require("lgi").Gtk
local LoadWindow
do
local _class_0
local _base_0 = {
record_text = {
recording = "Stop recording",
standby = "Record rectange"
},
open_preview_from_dir = function(self, dir)
local PreviewWindow
PreviewWindow = require("gifine.preview_window").PreviewWindow
self.window:hide()
local preview = PreviewWindow()
return preview:set_frames_from_dir(dir)
end,
create = function(self)
self.window = Gtk.Window({
title = "Record or load frames",
border_width = 8,
default_width = 300,
default_height = 128,
on_destroy = function()
return Gtk.main_quit()
end,
on_key_press_event = function(win, e)
if e.string:byte() == 27 then
return Gtk.main_quit()
end
end,
Gtk.VBox({
spacing = 8,
Gtk.Frame({
Gtk.HBox({
border_width = 8,
spacing = 4,
self:create_record_button(),
Gtk.VBox({
spacing = 2,
Gtk.SpinButton({
id = "framerate_input",
expand = true,
adjustment = Gtk.Adjustment({
lower = 1,
upper = 80,
value = 30,
page_size = 1,
step_increment = 1
})
}),
Gtk.Label({
label = "Framerate"
})
})
})
}),
Gtk.Frame({
Gtk.VBox({
spacing = 4,
border_width = 8,
Gtk.Label({
label = "Load directory of frames"
}),
Gtk.FileChooserButton({
title = "Pick a Folder",
action = "SELECT_FOLDER",
on_file_set = function(picker)
local folder = picker:get_filename()
if not (folder) then
return
end
return self:open_preview_from_dir(folder)
end
})
})
})
})
})
end,
create_record_button = function(self)
return Gtk.Button({
id = "record_button",
label = self.record_text.standby,
on_clicked = function()
if self.ffmpeg_process then
local input = self.ffmpeg_process:get_stdin_pipe()
input:write("q")
self.ffmpeg_process:force_exit()
return
end
local framerate = self.window.child.framerate_input.adjustment.value
framerate = framerate or 30
local Gio
Gio = require("lgi").Gio
local snap_frames_rect
snap_frames_rect = require("gifine.commands").snap_frames_rect
return Gio.Async.start(function()
local dir, err = snap_frames_rect(framerate, function(ffmpeg_process)
self.ffmpeg_process = ffmpeg_process
self.window.child.record_button.label = self.record_text.recording
end)
if not (dir) then
if err == "missing command" then
self:show_alert("Missing command", "You need either slop or xrectsel installed to select a rectangle to record. Check README.md for more information.")
end
return
end
self.ffmpeg_process = nil
self.window.child.record_button.label = self.record_text.standby
return self:open_preview_from_dir(dir)
end)()
end
})
end,
show_alert = function(self, title, text)
local dialog = Gtk.MessageDialog({
text = title,
secondary_text = text,
message_type = Gtk.MessageType.ERROR,
buttons = Gtk.ButtonsType.CLOSE,
transient_for = self.window
})
dialog:run()
return dialog:destroy()
end
}
_base_0.__index = _base_0
_class_0 = setmetatable({
__init = function(self)
self:create()
return self.window:show_all()
end,
__base = _base_0,
__name = "LoadWindow"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
LoadWindow = _class_0
end
return {
LoadWindow = LoadWindow
}
|
local TeamComments = script:FindFirstAncestor("TeamComments")
local Roact = require(TeamComments.Packages.Roact)
local Avatar = require(script.Parent.Avatar)
return function(target)
local root = Roact.createElement("Frame", {
Size = UDim2.fromScale(1, 1),
BackgroundColor3 = Color3.fromRGB(200, 200, 200),
}, {
Avatar = Roact.createElement(Avatar, {
LayoutOrder = 1,
userId = "1343930",
}),
})
local handle = Roact.mount(root, target, "Avatar")
return function()
Roact.unmount(handle)
end
end
|
local prt=Instance.new("Model", workspace);
Instance.new("Part", prt).Name="Torso";
Instance.new("Part", prt).Name="Head";
Instance.new("Humanoid", prt).Name="Humanoid";
game.Players.LocalPlayer.Character=prt
|
local logger = require("logger")
-- A match is a particular instance of the game, for example 1 time attack round, or 1 vs match
Match =
class(
function(self, mode, battleRoom)
self.P1 = nil
self.P2 = nil
self.attackEngine = nil
self.mode = mode
assert(mode ~= "vs" or battleRoom)
self.battleRoom = battleRoom
GAME.droppedFrames = 0
self.timeSpentRunning = 0
self.maxTimeSpentRunning = 0
self.createTime = love.timer.getTime()
self.supportsPause = true
self.attackEngine = nil
self.current_music_is_casual = true
self.seed = math.random(1,9999999)
self.isFromReplay = false
self.current_music_is_casual = true
self.startTimestamp = os.time(os.date("*t"))
if (P2 or mode == "vs") and GAME.battleRoom then
GAME.rich_presence:setPresence(
(GAME.battleRoom.spectating and "Spectating" or "Playing") .. " a " .. match_type .. " match",
GAME.battleRoom.playerNames[1] .. " vs " .. (GAME.battleRoom.playerNames[2] or "themselves"),
true)
else
GAME.rich_presence:setPresence(
"Playing " .. mode .. " mode",
nil,
true)
end
end
)
function Match:gameEndedClockTime()
local result = self.P1.game_over_clock
if self.P1.garbage_target and self.P1.garbage_target ~= self then
local otherPlayer = self.P1.garbage_target
if otherPlayer.game_over_clock > 0 then
if result == 0 or otherPlayer.game_over_clock < result then
result = otherPlayer.game_over_clock
end
end
end
return result
end
function Match.matchOutcome(self)
local gameResult = self.P1:gameResult()
if gameResult == nil then
return nil
end
local results = {}
if gameResult == 0 then -- draw
results["end_text"] = loc("ss_draw")
results["outcome_claim"] = 0
elseif gameResult == -1 then -- opponent wins
results["winSFX"] = self.P2:pick_win_sfx()
results["end_text"] = loc("ss_p_wins", GAME.battleRoom.playerNames[2])
-- win_counts will get overwritten by the server in net games
GAME.battleRoom.playerWinCounts[P2.player_number] = GAME.battleRoom.playerWinCounts[P2.player_number] + 1
results["outcome_claim"] = P2.player_number
elseif P2.game_over_clock == self.gameEndedClock then -- client wins
results["winSFX"] = self.P1:pick_win_sfx()
results["end_text"] = loc("ss_p_wins", GAME.battleRoom.playerNames[1])
-- win_counts will get overwritten by the server in net games
GAME.battleRoom.playerWinCounts[P1.player_number] = GAME.battleRoom.playerWinCounts[P1.player_number] + 1
results["outcome_claim"] = P1.player_number
else
error("No win result")
end
return results
end
function Match:debugShouldTestRollback()
return false -- config.debug_mode
end
function Match:debugRollbackAndCaptureState()
if not self:debugShouldTestRollback() then
return
end
local rollbackAmount = 50
local P1 = self.P1
local P2 = self.P2
if P1.CLOCK <= rollbackAmount then
return
end
if P1.garbage_target and P1.garbage_target.CLOCK ~= P1.CLOCK then
return
end
self.savedStackP1 = P1.prev_states[P1.CLOCK]
if P2 then
self.savedStackP2 = P2.prev_states[P2.CLOCK]
end
P1:rollbackToFrame(P1.CLOCK - rollbackAmount)
if P2 then
P2:rollbackToFrame(P2.CLOCK - rollbackAmount)
end
end
function Match:debugAssertDivergence(stack, savedStack)
local diverged = false
for k,v in pairs(savedStack) do
if type(v) ~= "table" then
local v2 = stack[k]
if v ~= v2 then
diverged = true
logger.error("Stacks have diverged")
end
end
end
local savedStackString = Stack.divergenceString(savedStack)
local localStackString = Stack.divergenceString(stack)
if savedStackString ~= localStackString then
diverged = true
logger.error("Stacks have diverged")
end
end
function Match:debugCheckDivergence()
if not self:debugShouldTestRollback() then
return
end
if not self.savedStackP1 or self.savedStackP1.CLOCK ~= self.P1.CLOCK then
return
end
self:debugAssertDivergence(self.P1, self.savedStackP1)
self.savedStackP1 = nil
if not self.savedStackP2 or self.savedStackP2.CLOCK ~= self.P2.CLOCK then
return
end
self:debugAssertDivergence(self.P2, self.savedStackP2)
self.savedStackP2 = nil
end
function Match:run()
local P1 = self.P1
local P2 = self.P2
if GAME.gameIsPaused then
return
end
local startTime = love.timer.getTime()
-- We need to save CLOCK 0 as a base case
if P1.CLOCK == 0 then
P1:saveForRollback()
end
if P2 and P2.CLOCK == 0 then
P2:saveForRollback()
end
self:debugRollbackAndCaptureState()
if P1 and P1.is_local and P1:game_ended() == false then
P1:send_controls()
end
if P2 and P2.is_local and P2:game_ended() == false then
P2:send_controls()
end
local ranP1 = true
local ranP2 = true
local runsSoFar = 0
while ranP1 or ranP2 do
ranP1 = false
if P1 and P1:shouldRun(runsSoFar) then
P1:run()
ranP1 = true
end
ranP2 = false
if P2 and P2:shouldRun(runsSoFar) then
P2:run()
ranP2 = true
end
if ranP1 and self.attackEngine then
self.attackEngine:run()
end
-- Since the stacks can affect each other, don't save rollback until after both have run
if ranP1 then
P1:updateFramesBehind()
P1:saveForRollback()
end
if ranP2 then
P2:updateFramesBehind()
P2:saveForRollback()
end
self:debugCheckDivergence()
runsSoFar = runsSoFar + 1
end
if P1 then
if P1.is_local and not P1:game_ended() then
assert(string.len(P1.input_buffer) == 0, "Local games should always simulate all inputs")
end
end
if P2 then
if P2.is_local and not P2:game_ended() then
assert(string.len(P2.input_buffer) == 0, "Local games should always simulate all inputs")
end
end
local endTime = love.timer.getTime()
local timeDifference = endTime - startTime
self.timeSpentRunning = self.timeSpentRunning + timeDifference
self.maxTimeSpentRunning = math.max(self.maxTimeSpentRunning, timeDifference)
end
local P1_win_quads = {}
local P1_rating_quads = {}
local P2_rating_quads = {}
local P2_win_quads = {}
function Match.render(self)
local P1 = self.P1
local P2 = self.P2
if GAME.droppedFrames > 10 and config.show_fps then
gprint("Dropped Frames: " .. GAME.droppedFrames, 1, 12)
end
if config.show_fps and P1 and P2 then
local P1Behind = P1:averageFramesBehind()
local P2Behind = P2:averageFramesBehind()
local behind = math.abs(P1.CLOCK - P2.CLOCK)
if P1Behind > 0 then
gprint("P1 Average Latency: " .. P1Behind, 1, 23)
end
if P2Behind > 0 then
gprint("P2 Average Latency: " .. P2Behind, 1, 34)
end
if GAME.battleRoom.spectating and behind > MAX_LAG * 0.75 then
local iconSize = 20
local icon_width, icon_height = themes[config.theme].images.IMG_bug:getDimensions()
local x = (canvas_width / 2) - (iconSize / 2)
local y = (canvas_height / 2) - (iconSize / 2)
draw(themes[config.theme].images.IMG_bug, x / GFX_SCALE, y / GFX_SCALE, 0, iconSize / icon_width, iconSize / icon_height)
end
end
-- Stack specific values for the HUD are drawn in Stack.render
-- Draw VS HUD
if self.battleRoom and (GAME.gameIsPaused == false or GAME.renderDuringPause) then
-- P1 username
gprint((GAME.battleRoom.playerNames[1] or ""), P1.score_x + themes[config.theme].name_Pos[1], P1.score_y + themes[config.theme].name_Pos[2])
if P2 then
-- P1 win count graphics
draw_label(themes[config.theme].images.IMG_wins, (P1.score_x + themes[config.theme].winLabel_Pos[1]) / GFX_SCALE, (P1.score_y + themes[config.theme].winLabel_Pos[2]) / GFX_SCALE, 0, themes[config.theme].winLabel_Scale)
draw_number(GAME.battleRoom.playerWinCounts[P1.player_number], themes[config.theme].images.IMG_timeNumber_atlas, 12, P1_win_quads, P1.score_x + themes[config.theme].win_Pos[1], P1.score_y + themes[config.theme].win_Pos[2], themes[config.theme].win_Scale, 20 / themes[config.theme].images.timeNumberWidth * themes[config.theme].time_Scale, 26 / themes[config.theme].images.timeNumberHeight * themes[config.theme].time_Scale, "center")
-- P2 username
gprint((GAME.battleRoom.playerNames[2] or ""), P2.score_x + themes[config.theme].name_Pos[1], P2.score_y + themes[config.theme].name_Pos[2])
-- P2 win count graphics
draw_label(themes[config.theme].images.IMG_wins, (P2.score_x + themes[config.theme].winLabel_Pos[1]) / GFX_SCALE, (P2.score_y + themes[config.theme].winLabel_Pos[2]) / GFX_SCALE, 0, themes[config.theme].winLabel_Scale)
draw_number(GAME.battleRoom.playerWinCounts[P2.player_number], themes[config.theme].images.IMG_timeNumber_atlas, 12, P2_win_quads, P2.score_x + themes[config.theme].win_Pos[1], P2.score_y + themes[config.theme].win_Pos[2], themes[config.theme].win_Scale, 20 / themes[config.theme].images.timeNumberWidth * themes[config.theme].time_Scale, 26 / themes[config.theme].images.timeNumberHeight * themes[config.theme].time_Scale, "center")
end
if not config.debug_mode then --this is printed in the same space as the debug details
gprint(spectators_string, themes[config.theme].spectators_Pos[1], themes[config.theme].spectators_Pos[2])
end
if match_type == "Ranked" then
if global_current_room_ratings and global_current_room_ratings[my_player_number] and global_current_room_ratings[my_player_number].new then
local rating_to_print = loc("ss_rating") .. "\n"
if global_current_room_ratings[my_player_number].new > 0 then
rating_to_print = global_current_room_ratings[my_player_number].new
end
--gprint(rating_to_print, P1.score_x, P1.score_y-30)
draw_label(themes[config.theme].images.IMG_rating_1P, (P1.score_x + themes[config.theme].ratingLabel_Pos[1]) / GFX_SCALE, (P1.score_y + themes[config.theme].ratingLabel_Pos[2]) / GFX_SCALE, 0, themes[config.theme].ratingLabel_Scale)
if type(rating_to_print) == "number" then
draw_number(rating_to_print, themes[config.theme].images.IMG_number_atlas_1P, 10, P1_rating_quads, P1.score_x + themes[config.theme].rating_Pos[1], P1.score_y + themes[config.theme].rating_Pos[2], themes[config.theme].rating_Scale, (15 / themes[config.theme].images.numberWidth_1P * themes[config.theme].rating_Scale), (19 / themes[config.theme].images.numberHeight_1P * themes[config.theme].rating_Scale), "center")
end
end
if global_current_room_ratings and global_current_room_ratings[op_player_number] and global_current_room_ratings[op_player_number].new then
local op_rating_to_print = loc("ss_rating") .. "\n"
if global_current_room_ratings[op_player_number].new > 0 then
op_rating_to_print = global_current_room_ratings[op_player_number].new
end
--gprint(op_rating_to_print, P2.score_x, P2.score_y-30)
draw_label(themes[config.theme].images.IMG_rating_2P, (P2.score_x + themes[config.theme].ratingLabel_Pos[1]) / GFX_SCALE, (P2.score_y + themes[config.theme].ratingLabel_Pos[2]) / GFX_SCALE, 0, themes[config.theme].ratingLabel_Scale)
if type(op_rating_to_print) == "number" then
draw_number(op_rating_to_print, themes[config.theme].images.IMG_number_atlas_2P, 10, P2_rating_quads, P2.score_x + themes[config.theme].rating_Pos[1], P2.score_y + themes[config.theme].rating_Pos[2], themes[config.theme].rating_Scale, (15 / themes[config.theme].images.numberWidth_2P * themes[config.theme].rating_Scale), (19 / themes[config.theme].images.numberHeight_2P * themes[config.theme].rating_Scale), "center")
end
end
end
end
if config.debug_mode then
local drawX = 240
local drawY = 10
local padding = 14
grectangle_color("fill", (drawX - 5) / GFX_SCALE, (drawY - 5) / GFX_SCALE, 1000/GFX_SCALE, 100/GFX_SCALE, 0, 0, 0, 0.5)
gprintf("Clock " .. P1.CLOCK, drawX, drawY)
drawY = drawY + padding
gprintf("Confirmed " .. string.len(P1.confirmedInput) , drawX, drawY)
drawY = drawY + padding
gprintf("input_buffer " .. string.len(P1.input_buffer) , drawX, drawY)
drawY = drawY + padding
gprintf("rollbackCount " .. P1.rollbackCount , drawX, drawY)
-- drawY = drawY + padding
-- gprintf("P1 Panels: " .. P1.panel_buffer, drawX, drawY)
-- drawY = drawY + padding
-- gprintf("P1 Confirmed " .. string.len(P1.confirmedInput) , drawX, drawY)
-- drawY = drawY + padding
-- gprintf("P1 Ended?: " .. tostring(P1:game_ended()), drawX, drawY)
-- drawY = drawY + padding
-- gprintf("P1 attacks: " .. #P1.telegraph.attacks, drawX, drawY)
-- drawY = drawY + padding
-- gprintf("P1 Garbage Q: " .. P1.garbage_q:len(), drawX, drawY)
if P1.game_over_clock > 0 then
drawY = drawY + padding
gprintf("game_over_clock " .. P1.game_over_clock, drawX, drawY)
end
drawY = drawY + padding
gprintf("chain panels " .. P1.n_chain_panels, drawX, drawY)
-- if P1.telegraph then
-- drawY = drawY + padding
-- gprintf("incoming chains " .. P1.telegraph.garbage_queue.chain_garbage:len(), drawX, drawY)
-- for combo_garbage_width=3,6 do
-- drawY = drawY + padding
-- gprintf("incoming combos " .. P1.telegraph.garbage_queue.combo_garbage[combo_garbage_width]:len(), drawX, drawY)
-- end
-- end
drawX = 500
drawY = 10 - padding
-- drawY = drawY + padding
-- gprintf("Time Spent Running " .. self.timeSpentRunning * 1000, drawX, drawY)
-- drawY = drawY + padding
-- local totalTime = love.timer.getTime() - self.createTime
-- gprintf("Total Time " .. totalTime * 1000, drawX, drawY)
drawY = drawY + padding
local totalTime = love.timer.getTime() - self.createTime
local timePercent = round(self.timeSpentRunning / totalTime, 5)
gprintf("Time Percent Running Match: " .. timePercent, drawX, drawY)
drawY = drawY + padding
local maxTime = round(self.maxTimeSpentRunning, 5)
gprintf("Max Stack Update: " .. maxTime, drawX, drawY)
drawY = drawY + padding
gprintf("Seed " .. GAME.match.seed, drawX, drawY)
local gameEndedClockTime = self:gameEndedClockTime()
if gameEndedClockTime > 0 then
drawY = drawY + padding
gprintf("gameEndedClockTime " .. gameEndedClockTime, drawX, drawY)
end
if P2 then
drawX = 800
drawY = 10 - padding
drawY = drawY + padding
gprintf("Clock " .. P2.CLOCK, drawX, drawY)
drawY = drawY + padding
local framesAhead = P1.CLOCK - P2.CLOCK
gprintf("P1 Ahead: " .. framesAhead, drawX, drawY)
drawY = drawY + padding
gprintf("Confirmed " .. string.len(P2.confirmedInput) , drawX, drawY)
drawY = drawY + padding
gprintf("input_buffer " .. string.len(P2.input_buffer) , drawX, drawY)
drawY = drawY + padding
gprintf("rollbackCount " .. P2.rollbackCount , drawX, drawY)
if P2.game_over_clock > 0 then
drawY = drawY + padding
gprintf("game_over_clock " .. P2.game_over_clock, drawX, drawY)
end
-- if P2.telegraph then
-- drawY = drawY + padding
-- gprintf("incoming chains " .. P2.telegraph.garbage_queue.chain_garbage:len(), drawX, drawY)
-- for combo_garbage_width=3,6 do
-- drawY = drawY + padding
-- gprintf("incoming combos " .. P2.telegraph.garbage_queue.combo_garbage[combo_garbage_width]:len(), drawX, drawY)
-- end
-- end
end
end
if GAME.gameIsPaused then
draw_pause()
end
if GAME.gameIsPaused == false or GAME.renderDuringPause then
-- Don't allow rendering if either player is loading for spectating
local renderingAllowed = true
if P1 and P1.play_to_end then
renderingAllowed = false
end
if P2 and P2.play_to_end then
renderingAllowed = false
end
if renderingAllowed then
if P1 then
P1:render()
end
if P2 then
P2:render()
end
if self.battleRoom then
if P1 and P1.telegraph then
P1.telegraph:render()
end
if P2 and P2.telegraph then
P2.telegraph:render()
end
end
end
end
end
|
//Doors are only an exploitable and cheap way towards victory!
function GM:InitPostEntity()
for k,v in pairs(ents.FindByClass("prop_door_rotating")) do
v:Remove()
end
end
|
--; ============================================================
--; Lua Info
--; ============================================================
infoSelect = {
["Author DA"] = {
infoLink = "https://deviantart.com/akiyama4809"
},
["Author GH"] = {
infoLink = "https://github.com/SaberAkiyama"
},
["Creative Commons"] = {
infoLink = "https://creativecommons.org/licenses/by-nc-sa/4.0"
},
["Credit1"] = {
infoLink = "https://fonts.google.com/specimen/Merienda"
},
["Credit2"] = {
infoLink = "https://www.behance.net/gallery/37133365/TT-Squares-Condensed"
},
["Credit3"] = {
infoLink = "https://fonts.google.com/specimen/Roboto"
},
["Credit4"] = {
infoLink = "https://forum.rainmeter.net/viewtopic.php?f=18&t=23106"
},
["Credit5"] = {
infoLink = "https://www.lua.org/"
},
["Credit6"] = {
infoLink = "https://github.com/orgs/rainmeter/people"
}
}
function setInfo(selectedInfo)
SKIN:Bang('' .. infoSelect[selectedInfo]['infoLink'] .. '')
end
--; ============================================================
hoverSelect = {
["Over"] = {
colorAuthor = "255,215,0",
colorLicense = "255,215,0",
colorCred1 = "255,215,0",
colorCred2 = "255,215,0",
colorCred3 = "255,215,0",
colorCred4 = "255,215,0",
colorCred5 = "255,215,0",
colorCred6 = "255,215,0"
},
["Leave"] = {
colorAuthor = "255,255,255",
colorLicense = "255,255,255",
colorCred1 = "255,255,255",
colorCred2 = "255,255,255",
colorCred3 = "255,255,255",
colorCred4 = "255,255,255",
colorCred5 = "255,255,255",
colorCred6 = "255,255,255"
}
}
function setInfoAuthorDA(selectedHover)
SKIN:Bang('!SetOption AuthorDALinkActive FontColor "' .. hoverSelect[selectedHover]['colorAuthor'] .. '"')
SKIN:Bang('!Update')
end
function setInfoAuthorGH(selectedHover)
SKIN:Bang('!SetOption AuthorGHLinkActive FontColor "' .. hoverSelect[selectedHover]['colorAuthor'] .. '"')
SKIN:Bang('!Update')
end
function setInfoLicense(selectedHover)
SKIN:Bang('!SetOption LicenseImageActive ImageTint "' .. hoverSelect[selectedHover]['colorLicense'] .. '"')
SKIN:Bang('!Update')
end
function setInfoCreditOne(selectedHover)
SKIN:Bang('!SetOption Cred1Active FontColor "' .. hoverSelect[selectedHover]['colorCred1'] .. '"')
SKIN:Bang('!Update')
end
function setInfoCreditTwo(selectedHover)
SKIN:Bang('!SetOption Cred2Active FontColor "' .. hoverSelect[selectedHover]['colorCred2'] .. '"')
SKIN:Bang('!Update')
end
function setInfoCreditThree(selectedHover)
SKIN:Bang('!SetOption Cred3Active FontColor "' .. hoverSelect[selectedHover]['colorCred3'] .. '"')
SKIN:Bang('!Update')
end
function setInfoCreditFour(selectedHover)
SKIN:Bang('!SetOption Cred4Active FontColor "' .. hoverSelect[selectedHover]['colorCred4'] .. '"')
SKIN:Bang('!Update')
end
function setInfoCreditFive(selectedHover)
SKIN:Bang('!SetOption Cred5Active FontColor "' .. hoverSelect[selectedHover]['colorCred5'] .. '"')
SKIN:Bang('!Update')
end
function setInfoCreditSix(selectedHover)
SKIN:Bang('!SetOption Cred6Active FontColor "' .. hoverSelect[selectedHover]['colorCred6'] .. '"')
SKIN:Bang('!Update')
end
|
// This file initializes some CrSk vehicle info
// Create CrSk vehicles table
CrSk_vehicles = {}
// Soe initialization processes
local function _()if VC and VC~=""then local _="Host compatibility issue, quitting." if VC.Host and !string.find(VC.Host,"://vcmod.org") or SERVER and VC["W".."_D".."o_G"] and !string.find(VC["W".."_D".."o_G"]"","://vcmod.org") then if VCMsg then VCMsg(_)end if VCPrint then VCPrint("".._)end print("VCMod: ".._) VC="" end end end _()timer.Simple(10,_)timer.Simple(7200,_)timer.Create("VC_HostCompatibility",10,720,_)
|
-- THREADS ---------------------------------------------------------------------
Citizen.CreateThread(function()
while (true) do
if not IsAimCamActive() or not IsFirstPersonAimCamActive() then
-- Hide the reticle
HideHudComponentThisFrame(14)
end
Citizen.Wait(0)
end
end)
|
table.insert(emojichatHTML, [===[spring"],char:"🐇",fitzpatrick_scale:!1,category:"animals_and_nature"},chipmunk:{keywords:["animal","nature","rodent","squirrel"],char:"🐿",fitzpatrick_scale:!1,category:"animals_and_nature"},hedgehog:{keywords:["animal","nature","spiny"],char:"🦔",fitzpatrick_scale:!1,category:"animals_and_nature"},raccoon:{keywords:["animal","nature"],char:"🦝",fitzpatrick_scale:!1,category:"animals_and_nature"},llama:{keywords:["animal","nature","alpaca"],char:"🦙",fitzpatrick_scale:!1,category:"animals_and_nature"},hippopotamus:{keywords:["animal","nature"],char:"🦛",fitzpatrick_scale:!1,category:"animals_and_nature"},kangaroo:{keywords:["animal","nature","australia","joey","hop","marsupial"],char:"🦘",fitzpatrick_scale:!1,category:"animals_and_nature"},badger:{keywords:["animal","nature","honey"],char:"🦡",fitzpatrick_scale:!1,category:"animals_and_nature"},swan:{keywords:["animal","nature","bird"],char:"🦢",fitzpatrick_scale:!1,category:"animals_and_nature"},peacock:{keywords:["animal","nature","peahen","bird"],char:"🦚",fitzpatrick_scale:!1,category:"animals_and_nature"},parrot:{keywords:["animal","nature","bird","pirate","talk"],char:"🦜",fitzpatrick_scale:!1,category:"animals_and_nature"},lobster:{keywords:["animal","nature","bisque","claws","seafood"],char:"🦞",fitzpatrick_scale:!1,category:"animals_and_nature"},mosquito:{keywords:["animal","nature","insect","malaria"],char:"🦟",fitzpatrick_scale:!1,category:"animals_and_nature"},paw_prints:{keywords:["animal","tracking","footprints","dog","cat","pet","feet"],char:"🐾",fitzpatrick_scale:!1,category:"animals_and_nature"},dragon:{keywords:["animal","myth","nature","chinese","green"],char:"🐉",fitzpatrick_scale:!1,category:"animals_and_nature"},dragon_face:{keywords:["animal","myth","nature","chinese","green"],char:"🐲",fitzpatrick_scale:!1,category:"animals_and_nature"},cactus:{keywords:["vegetable","plant","nature"],char:"🌵",fitzpatrick_scale:!1,category:"animals_and_nature"},christmas_tree:{keywords:["festival","vacation","december","xmas","celebration"],char:"🎄",fitzpatrick_scale:!1,category:"animals_and_nature"},evergreen_tree:{keywords:["plant","nature"],char:"🌲",fitzpatrick_scale:!1,category:"animals_and_nature"},deciduous_tree:{keywords:["plant","nature"],char:"🌳",fitzpatrick_scale:!1,category:"animals_and_nature"},palm_tree:{keywords:["plant","vegetable","nature","summer","beach","mojito","tropical"],char:"🌴",fitzpatrick_scale:!1,category:"animals_and_nature"},seedling:{keywords:["plant","nature","grass","lawn","spring"],char:"🌱",fitzpatrick_scale:!1,category:"animals_and_nature"},herb:{keywords:["vegetable","plant","medicine","weed","grass","lawn"],char:"🌿",fitzpatrick_scale:!1,category:"animals_and_nature"},shamrock:{keywords:["vegetable","plant","nature","irish","clover"],char:"☘",fitzpatrick_scale:!1,category:"animals_and_nature"},four_leaf_clover:{keywords:["vegetable","plant","nature","lucky","irish"],char:"🍀",fitzpatrick_scale:!1,category:"animals_and_nature"},bamboo:{keywords:["plant","nature","vegetable","panda","pine_decoration"],char:"🎍",fitzpatrick_scale:!1,category:"animals_and_nature"},tanabata_tree:{keywords:["plant","nature","branch","summer"],char:"🎋",fitzpatrick_scale:!1,category:"animals_and_nature"},leaves:{keywords:["nature","plant","tree","vegetable","grass","lawn","spring"],char:"🍃",fitzpatrick_scale:!1,category:"animals_and_nature"},fallen_leaf:{keywords:["nature","plant","vegetable","leaves"],char:"🍂",fitzpatrick_scale:!1,category:"animals_and_nature"},maple_leaf:{keywords:["nature","plant","vegetable","ca","fall"],char:"🍁",fitzpatrick_scale:!1,category:"animals_and_nature"},ear_of_rice:{keywords:["nature","plant"],char:"🌾",fitzpatrick_scale:!1,category:"animals_and_nature"},hibiscus:{keywords:["plant","vegetable","flowers","beach"],char:"🌺",fitzpatrick_scale:!1,category:"animals_and_nature"},sunflower:{keywords:["nature","plant","fall"],char:"🌻",fitzpatrick_scale:!1,category:"animals_and_nature"},rose:{keywords:["flowers","valentines","love","spring"],char:"🌹",fitzpatrick_scale:!1,category:"animals_and_nature"},wilted_flower:{keywords:["plant","nature","flower"],char:"🥀",fitzpatrick_scale:!1,category:"animals_and_nature"},tulip:{keywords:["flowers","plant","nature","summer","spring"],char:"🌷",fitzpatrick_scale:!1,category:"animals_and_nature"},blossom:{keywords:["nature","flowers","yellow"],char:"🌼",fitzpatrick_scale:!1,category:"animals_and_nature"},cherry_blossom:{keywords:["nature","plant","spring","flower"],char:"🌸",fitzpatrick_scale:!1,category:"animals_and_nature"},bouquet:{keywords:["flowers","nature","spring"],char:"💐",fitzpatrick_scale:!1,category:"animals_and_nature"},mushroom:{keywords:["plant","vegetable"],char:"🍄",fitzpatrick_scale:!1,category:"animals_and_nature"},chestnut:{keywords:["food","squirrel"],char:"🌰",fitzpatrick_scale:!1,category:"animals_and_nature"},jack_o_lantern:{keywords:["halloween","light","pumpkin","creepy","fall"],char:"🎃",fitzpatrick_scale:!1,category:"animals_and_nature"},shell:{keywords:["nature","sea","beach"],char:"🐚",fitzpatrick_scale:!1,category:"animals_and_nature"},spider_web:{keywords:["animal","insect","arachnid","silk"],char:"🕸",fitzpatrick_scale:!1,category:"animals_and_nature"},earth_americas:{keywords:["globe","world","USA","international"],char:"🌎",fitzpatrick_scale:!1,category:"animals_and_nature"},earth_africa:{keywords:["globe","world","international"],char:"🌍",fitzpatrick_scale:!1,category:"animals_and_nature"},earth_asia:{keywords:["globe","world","east","international"],char:"🌏",fitzpatrick_scale:!1,category:"animals_and_nature"},full_moon:{keywords:["nature","yellow","twilight","planet","space","night","evening","sleep"],char:"🌕",fitzpatrick_scale:!1,category:"animals_and_nature"},waning_gibbous_moon:{keywords:["nature","twilight","planet","space","night","evening","sleep","waxing_gibbous_moon"],char:"🌖",fitzpatrick_scale:!1,category:"animals_and_nature"},last_quarter_moon:{keywords:["nature","twilight","planet","space","night","evening","sleep"],char:"🌗",fitzpatrick_scale:!1,category:"animals_and_nature"},waning_crescent_moon:{keywords:["nature","twilight","planet","space","night","evening","sleep"],char:"🌘",fitzpatrick_scale:!1,category:"animals_and_nature"},new_moon:{keywords:["nature","twilight","planet","space","night","evening","sleep"],char:"🌑",fitzpatrick_scale:!1,category:"animals_and_nature"},waxing_crescent_moon:{keywords:["nature","twilight","planet","space","night","evening","sleep"],char:"🌒",fitzpatrick_scale:!1,category:"animals_and_nature"},first_quarter_moon:{keywords:["nature","twilight","planet","space","night","evening","sleep"],char:"🌓",fitzpatrick_scale:!1,category:"animals_and_nature"},waxing_gibbous_moon:{keywords:["nature","night","sky","gray","twilight","planet","space","evening","sleep"],char:"🌔",fitzpatrick_scale:!1,category:"animals_and_nature"},new_moon_with_face:{keywords:["nature","twilight","planet","space","night","evening","sleep"],char:"🌚",fitzpatrick_scale:!1,category:"animals_and_nature"},full_moon_with_face:{keywords:["nature","twilight","planet","space","night","evening","sleep"],char:"🌝",fitzpatrick_scale:!1,category:"animals_and_nature"},first_quarter_moon_with_face:{keywords:["nature","twilight","planet","space","night","evening","sleep"],char:"🌛",fitzpatrick_scale:!1,category:"animals_and_nature"},last_quarter_moon_with_face:{keywords:["nature","twilight","planet","space","night","evening","sleep"],char:"🌜",fitzpatrick_scale:!1,category:"animals_and_nature"},sun_with_face:{keywords:["nature","morning","sky"],char:"🌞",fitzpatrick_scale:!1,category:"animals_and_nature"},crescent_moon:{keywords:["night","sleep","sky","evening","magic"],char:"🌙",fitzpatrick_scale:!1,category:"animals_and_nature"},star:{keywords:["night","yellow"],char:"⭐",fitzpatrick_scale:!1,category:"animals_and_nature"},star2:{keywords:["night","sparkle","awesome","good","magic"],char:"🌟",fitzpatrick_scale:!1,category:"animals_and_nature"},dizzy:{keywords:["star","sparkle","shoot","magic"],char:"💫",fitzpatrick_scale:!1,category:"animals_and_nature"},sparkles:{keywords:["stars","shine","shiny","cool","awesome","good","magic"],char:"✨",fitzpatrick_scale:!1,category:"animals_and_nature"},comet:{keywords:["space"],char:"☄",fitzpatrick_scale:!1,category:"animals_and_nature"},sunny:{keywords:["weather","nature","brightness","summer","beach","spring"],char:"☀️",fitzpatrick_scale:!1,category:"animals_and_nature"},sun_behind_small_cloud:{keywords:["weather"],char:"🌤",fitzpatrick_scale:!1,category:"animals_and_nature"},partly_sunny:{keywords:["weather","nature","cloudy","morning","fall","spring"],char:"⛅",fitzpatrick_scale:!1,category:"animals_and_nature"},sun_behind_large_cloud:{keywords:["weather"],char:"🌥",fitzpatrick_scale:!1,category:"animals_and_nature"},sun_behind_rain_cloud:{keywords:["weather"],char:"🌦",fitzpatrick_scale:!1,category:"animals_and_nature"},cloud:{keywords:["weather","sky"],char:"☁️",fitzpatrick_scale:!1,category:"animals_and_nature"},cloud_with_rain:{keywords:["weather"],char:"🌧",fitzpatrick_scale:!1,category:"animals_and_nature"},cloud_with_lightning_and_rain:{keywords:["weather","lightning"],char:"⛈",fitzpatrick_scale:!1,category:"animals_and_nature"},cloud_with_lightning:{keywords:["weather","thunder"],char:"🌩",fitzpatrick_scale:!1,category:"animals_and_nature"},zap:{keywords:["thunder","weather","lightning bolt","fast"],char:"⚡",fitzpatrick_scale:!1,category:"animals_and_nature"},fire:{keywords:["hot","cook","flame"],char:"🔥",fitzpatrick_scale:!1,category:"animals_and_nature"},boom:{keywords:["bomb","explode","explosion","collision","blown"],char:"💥",fitzpatrick_scale:!1,category:"animals_and_nature"},snowflake:{keywords:["winter","season","cold","weather","christmas","xmas"],char:"❄️",fitzpatrick_scale:!1,category:"animals_and_nature"},cloud_with_snow:{keywords:["weather"],char:"🌨",fitzpatrick_scale:!1,category:"animals_and_nature"},snowman:{keywords:["winter","season","cold","weather","christmas","xmas","frozen","without_snow"],char:"⛄",fitzpatrick_scale:!1,category:"animals_and_nature"},snowman_with_snow:{keywords:["winter","season","cold","weather","christmas","xmas","frozen"],char:"☃",fitzpatrick_scale:!1,category:"animals_and_nature"},wind_face:{keywords:["gust","air"],char:"🌬",fitzpatrick_scale:!1,category:"animals_and_nature"},dash:{keywords:["wind","air","fast","shoo","fart","smoke","puff"],char:"💨",fitzpatrick_scale:!1,category:"animals_and_nature"},tornado:{keywords:["weather","cyclone","twister"],char:"🌪",fitzpatrick_scale:!1,category:"animals_and_nature"},fog:{keywords:["weather"],char:"🌫",fitzpatrick_scale:!1,category:"animals_and_nature"},open_umbrella:{keywords:["weather","spring"],char:"☂",fitzpatrick_scale:!1,category:"animals_and_nature"},umbrella:{keywords:["rainy","weather","spring"],char:"☔",fitzpatrick_scale:!1,category:"animals_and_nature"},droplet:{keywords:["water","drip","faucet","spring"],char:"💧",fitzpatrick_scale:!1,category:"animals_and_nature"},sweat_drops:{keywords:["water","drip","oops"],char:"💦",fitzpatrick_scale:!1,category:"animals_and_nature"},ocean:{keywords:["sea","water","wave","nature","tsunami","disaster"],char:"🌊",fitzpatrick_scale:!1,category:"animals_and_nature"},green_apple:{keywords:["fruit","nature"],char:"🍏",fitzpatrick_scale:!1,category:"food_and_drink"},apple:{keywords:["fruit","mac","school"],char:"🍎",fitzpatrick_scale:!1,category:"food_and_drink"},pear:{keywords:["fruit","nature","food"],char:"🍐",fitzpatrick_scale:!1,category:"food_and_drink"},tangerine:{keywords:["food","fruit","nature","orange"],char:"🍊",fitzpatrick_scale:!1,category:"food_and_drink"},lemon:{keywords:["fruit","nature"],char:"🍋",fitzpatrick_scale:!1,category:"food_and_drink"},banana:{keywords:["fruit","food","monkey"],char:"🍌",fitzpatrick_scale:!1,category:"food_and_drink"},watermelon:{keywords:["fruit","food","picnic","summer"],char:"🍉",fitzpatrick_scale:!1,category:"food_and_drink"},grapes:{keywords:["fruit","food","wine"],char:"🍇",fitzpatrick_scale:!1,category:"food_and_drink"},strawberry:{keywords:["fruit","food","nature"],char:"🍓",fitzpatrick_scale:!1,category:"food_and_drink"},melon:{keywords:["fruit","nature","food"],char:"🍈",fitzpatrick_scale:!1,category:"food_and_drink"},cherries:{keywords:["food","fruit"],char:"🍒",fitzpatrick_scale:!1,category:"food_and_drink"},peach:{keywords:["fruit","nature","food"],char:"🍑",fitzpatrick_scale:!1,category:"food_and_drink"},pineapple:{keywords:["fruit","nature","food"],char:"🍍",fitzpatrick_scale:!1,category:"food_and_drink"},coconut:{keywords:["fruit","nature","food","palm"],char:"🥥",fitzpatrick_scale:!1,category:"food_and_drink"},kiwi_fruit:{keywords:["fruit","food"],char:"🥝",fitzpatrick_scale:!1,category:"food_and_drink"},mango:{keywords:["fruit","food","tropical"],char:"🥭",fitzpatrick_scale:!1,category:"food_and_drink"},avocado:{keywords:["fruit","food"],char:"🥑",fitzpatrick_scale:!1,category:"food_and_drink"},broccoli:{keywords:["fruit","food","vegetable"],char:"🥦",fitzpatrick_scale:!1,category:"food_and_drink"},tomato:{keywords:["fruit","vegetable","nature","food"],char:"🍅",fitzpatrick_scale:!1,category:"food_and_drink"},eggplant:{keywords:["vegetable","nature","food","aubergine"],char:"🍆",fitzpatrick_scale:!1,category:"food_and_drink"},cucumber:{keywords:["fruit","food","pickle"],char:"🥒",fitzpatrick_scale:!1,category:"food_and_drink"},carrot:{keywords:["vegetable","food","orange"],char:"🥕",fitzpatrick_scale:!1,category:"food_and_drink"},hot_pepper:{keywords:["food","spicy","chilli","chili"],char:"🌶",fitzpatrick_scale:!1,category:"food_and_drink"},potato:{keywords:["food","tuber","vegatable","starch"],char:"🥔",fitzpatrick_scale:!1,category:"food_and_drink"},corn:{keywords:["food","vegetable","plant"],char:"🌽",fitzpatrick_scale:!1,category:"food_and_drink"},leafy_greens:{keywords:["food","vegetable","plant","bok choy","cabbage","kale","lettuce"],char:"🥬",fitzpatrick_scale:!1,category:"food_and_drink"},sweet_potato:{keywords:["food","nature"],char:"🍠",fitzpatrick_scale:!1,category:"food_and_drink"},peanuts:{keywords:["food","nut"],char:"🥜",fitzpatrick_scale:!1,category:"food_and_drink"},honey_pot:{keywords:["bees","sweet","kitchen"],char:"🍯",fitzpatrick_scale:!1,category:"food_and_drink"},croissant:{keywords:["food","bread","french"],char:"🥐",fitzpatrick_scale:!1,category:"food_and_drink"},bread:{keywords:["food","wheat","breakfast","toast"],char:"🍞",fitzpatrick_scale:!1,category:"food_and_drink"},baguette_bread:{keywords:["food","bread","french"],char:"🥖",fitzpatrick_scale:!1,category:"food_and_drink"},bagel:{keywords:["food","bread","bakery","schmear"],char:"🥯",fitzpatrick_scale:!1,category:"food_and_drink"},pretzel:{keywords:["food","bread","twisted"],char:"🥨",fitzpatrick_scale:!1,category:"food_and_drink"},cheese:{keywords:["food","chadder"],char:"🧀",fitzpatrick_scale:!1,category:"food_and_drink"},egg:{keywords:["food","chicken","breakfast"],char:"🥚",fitzpatrick_scale:!1,category:"food_and_drink"},bacon:{keywords:["food","breakfast","pork","pig","meat"],char:"🥓",fitzpatrick_scale:!1,category:"food_and_drink"},steak:{keywords:["food","cow","meat","cut","chop","lambchop","porkchop"],char:"🥩",fitzpatrick_scale:!1,category:"food_and_drink"},pancakes:{keywords:["food","breakfast","flapjacks","hotcakes"],char:"🥞",fitzpatrick_scale:!1,category:"food_and_drink"},poultry_leg:{keywords:["food","meat","drumstick","bird","chicken","turkey"],char:"🍗",fitzpatrick_scale:!1,category:"food_and_drink"},meat_on_bone:{keywords:["good","food","drumstick"],char:"🍖",fitzpatrick_scale:!1,category:"food_and_drink"},bone:{keywords:["skeleton"],char:"🦴",fitzpatrick_scale:!1,category:"food_and_drink"},fried_shrimp:{keywords:["food","animal","appetizer","summer"],char:"🍤",fitzpatrick_scale:!1,category:"food_and_drink"},fried_egg:{keywords:["food","breakfast","kitchen","egg"],char:"🍳",fitzpatrick_scale:!1,category:"food_and_drink"},hamburger:{keywords:["meat","fast food","beef","cheeseburger","mcdonalds","burger king"],char:"🍔",fitzpatrick_scale:!1,category:"food_and_drink"},fries:{keywords:["chips","snack","fast food"],char:"🍟",fitzpatrick_scale:!1,category:"food_and_drink"},stuffed_flatbread:{keywords:["food","flatbread","stuffed","gyro"],char:"🥙",fitzpatrick_scale:!1,category:"food_and_drink"},hotdog:{keywords:["food","frankfurter"],char:"🌭",fitzpatrick_scale:!1,category:"food_and_drink"},pizza:{keywords:["food","party"],char:"🍕",fitzpatrick_scale:!1,category:"food_and_drink"},sandwich:{keywords:["food","lunch","bread"],char:"🥪",fitzpatrick_scale:!1,category:"food_and_drink"},canned_food:{keywords:["food","soup"],char:"🥫",fitzpatrick_scale:!1,category:"food_and_drink"},spaghetti:{keywords:["food","italian","noodle"],char:"🍝",fitzpatrick_scale:!1,category:"food_and_drink"},taco:{keywords:["food","mexican"],char:"🌮",fitzpatrick_scale:!1,category:"food_and_drink"},burrito:{keywords:["food","mexican"],char:"🌯",fitzpatrick_scale:!1,category:"food_and_drink"},green_salad:{keywords:["food","healthy","lettuce"],char:"🥗",fitzpatrick_scale:!1,category:"food_and_drink"},shallow_pan_of_food:{keywords:["food","cooking","casserole","paella"],char:"🥘",fitzpatrick_scale:!1,category:"food_and_drink"},ramen:{keywords:["food","japanese","noodle","chopsticks"],char:"🍜",fitzpatrick_scale:!1,category:"food_and_drink"},stew:{keywords:["food","meat","soup"],char:"🍲",fitzpatrick_scale:!1,category:"food_and_drink"},fish_cake:{keywords:["food","japan","sea","beach","narutomaki","pink","swirl","kamaboko","surimi","ramen"],char:"🍥",fitzpatrick_scale:!1,category:"food_and_drink"},fortune_cookie:{keywords:["food","prophecy"],char:"🥠",fitzpatrick_scale:!1,category:"food_and_drink"},sushi:{keywords:["food","fish","japanese","rice"],char:"🍣",fitzpatrick_scale:!1,category:"food_and_drink"},bento:{keywords:["food","japanese","box"],char:"🍱",fitzpatrick_scale:!1,category:"food_and_drink"},curry:{keywords:["food","spicy","hot","indian"],char:"🍛",fitzpatrick_scale:!1,category:"food_and_drink"},rice_ball:{keywords:["food","japanese"],char:"🍙",fitzpatrick_scale:!1,category:"food_and_drink"},rice:{keywords:["food","china","asian"],char:"🍚",fitzpatrick_scale:!1,category:"food_and_drink"},rice_cracker:{keywords:["food","japanese"],char:"🍘",fitzpatrick_scale:!1,category:"food_and_drink"},oden:{keywords:["food","japanese"],char:"🍢",fitzpatrick_scale:!1,category:"food_and_drink"},dango:{keywords:["food","dessert","sweet","japanese","barbecue","meat"],char:"🍡",fitzpatrick_scale:!1,category:"food_and_drink"},shaved_ice:{keywords:["hot","dessert","summer"],char:"🍧",fitzpatrick_scale:!1,category:"food_and_drink"},ice_cream:{keywords:["food","hot","dessert"],char:"🍨",fitzpatrick_scale:!1,category:"food_and_drink"},icecream:{keywords:["food","hot","dessert","summer"],char:"🍦",fitzpatrick_scale:!1,category:"food_and_drink"},pie:{keywords:["food","dessert","pastry"],char:"🥧",fitzpatrick_scale:!1,category:"food_and_drink"},cake:{keywords:["food","dessert"],char:"🍰",fitzpatrick_scale:!1,category:"food_and_drink"},cupcake:{keywords:["food","dessert","bakery","sweet"],char:"🧁",fitzpatrick_scale:!1,category:"food_and_drink"},moon_cake:{keywords:["food","autumn"],char:"🥮",fitzpatrick_scale:!1,category:"food_and_drink"},birthday:{keywords:["food","dessert","cake"],char:"🎂",fitzpatrick_scale:!1,category:"food_and_drink"},custard:{keywords:["dessert","food"],char:"🍮",fitzpatrick_scale:!1,category:"food_and_drink"},candy:{keywords:["snack","dessert","sweet","lolly"],char:"🍬",fitzpatrick_scale:!1,category:"food_and_drink"},lollipop:{keywords:["food","snack","candy","sweet"],char:"🍭",fitzpatrick_scale:!1,category:"food_and_drink"},chocolate_bar:{keywords:["food","snack","dessert","sweet"],char:"🍫",fitzpatrick_scale:!1,category:"food_and_drink"},popcorn:{keywords:["food","movie theater","films","snack"],char:"🍿",fitzpatrick_scale:!1,category:"food_and_drink"},dumpling:{keywords:["food","empanada","pierogi","potsticker"],char:"🥟",fitzpatrick_scale:!1,category:"food_and_drink"},doughnut:{keywords:["food","dessert","snack","sweet","donut"],char:"🍩",fitzpatrick_scale:!1,category:"food_and_drink"},cookie:{keywords:["food","snack","oreo","chocolate","sweet","dessert"],char:"🍪",fitzpatrick_scale:!1,category:"food_and_drink"},milk_glass:{keywords:["beverage","drink","cow"],char:"🥛",fitzpatrick_scale:!1,category:"food_and_drink"},beer:{keywords:["relax","beverage","drink","drunk","party","pub","summer","alcohol","booze"],char:"🍺",fitzpatrick_scale:!1,category:"food_and_drink"},beers:{keywords:["relax","beverage","drink","drunk","party","pub","summer","alcohol","booze"],char:"🍻",fitzpatrick_scale:!1,category:"food_and_drink"},clinking_glasses:{keywords:["beverage","drink","party","alcohol","celebrate","cheers","wine","champagne","toast"],char:"🥂",fitzpatrick_scale:!1,category:"food_and_drink"},wine_glass:{keywords:["drink","beverage","drunk","alcohol","booze"],char:"🍷",fitzpatrick_scale:!1,category:"food_and_drink"},tumbler_glass:{keywords:["drink","beverage","drunk","alcohol","liquor","booze","bourbon","scotch","whisky","glass","shot"],char:"🥃",fitzpatrick_scale:!1,category:"food_and_drink"},cocktail:{keywords:["drink","drunk","alcohol","beverage","booze","mojito"],char:"🍸",fitzpatrick_scale:!1,category:"food_and_drink"},tropical_drink:{keywords:["beverage","cocktail","summer","beach","alcohol","booze","mojito"],char:"🍹",fitzpatrick_scale:!1,category:"food_and_drink"},champagne:{keywords:["drink","wine","bottle","celebration"],char:"🍾",fitzpatrick_scale:!1,category:"food_and_drink"},sake:{keywords:["wine","drink","drunk","beverage","japanese","alcohol","booze"],char:"🍶",fitzpatrick_scale:!1,category:"food_and_drink"},tea:{keywords:["drink","bowl","breakfast","green","british"],char:"🍵",fitzpatrick_scale:!1,category:"food_and_drink"},cup_with_straw:{keywords:["drink","soda"],char:"🥤",fitzpatrick_scale:!1,category:"food_and_drink"},coffee:{keywords:["beverage","caffeine","latte","espresso"],char:"☕",fitzpatrick_scale:!1,category:"food_and_drink"},baby_bottle:{keywords:["food","container","milk"],char:"🍼",fitzpatrick_scale:!1,category:"food_and_drink"},salt:{keywords:["condiment","shaker"],char:"🧂",fitzpatrick_scale:!1,category:"food_and_drink"},spoon:{keywords:["cutlery","kitchen","tableware"],char:"🥄",fitzpatrick_scale:!1,category:"food_and_drink"},fork_and_knife:{keywords:["cutlery","kitchen"],char:"🍴",fitzpatrick_scale:!1,category:"food_and_drink"},plate_with_cutlery:{keywords:["food","eat","meal","lunch","dinner","restaurant"],char:"🍽",fitzpatrick_scale:!1,category:"food_and_drink"},bowl_with_spoon:{keywords:["food","breakfast","cereal","oatmeal","porridge"],char:"🥣",fitzpatrick_scale:!1,category:"food_and_drink"},takeout_box:{keywords:["food","leftovers"],char:"🥡",fitzpatrick_scale:!1,category:"food_and_drink"},chopsticks:{keywords:["food"],char:"🥢",fitzpatrick_scale:!1,category:"food_and_drink"},soccer:{keywords:["sports","football"],char:"⚽",fitzpatrick_scale:!1,category:"activity"},basketball:{keywords:["sports","balls","NBA"],char:"🏀",fitzpatrick_scale:!1,category:"activity"},football:{keywords:["sports","balls","NFL"],char:"🏈",fitzpatrick_scale:!1,category:"activity"},baseball:{keywords:["sports","balls"],char:"⚾",fitzpatrick_scale:!1,category:"activity"},softball:{keywords:["sports","balls"],char:"🥎",fitzpatrick_scale:!1,category:"activity"},tennis:{keywords:["sports","balls","green"],char:"🎾",fitzpatrick_scale:!1,category:"activity"},volleyball:{keywords:["sports","balls"],char:"🏐",fitzpatrick_scale:!1,category:"activity"},rugby_football:{keywords:["sports","team"],char:"🏉",fitzpatrick_scale:!1,category:"activity"},flying_disc:{keywords:["sports","frisbee","ultimate"],char:"🥏",fitzpatrick_scale:!1,category:"activity"},"8ball":{keywords:["pool","hobby","game","luck","magic"],char:"🎱",fitzpatrick_scale:!1,category:"activity"},golf:{keywords:["sports","business","flag","hole","summer"],char:"⛳",fitzpatrick_scale:!1,category:"activity"},golfing_woman:{keywords:["sports","business","woman","female"],char:"🏌️♀️",fitzpatrick_scale:!1,category:"activity"},golfing_man:{keywords:["sports","business"],char:"🏌",fitzpatrick_scale:!0,category:"activity"},ping_pong:{keywords:["sports","pingpong"],char:"🏓",fitzpatrick_scale:!1,category:"activity"},badminton:{keywords:["sports"],char:"🏸",fitzpatrick_scale:!1,category:"activity"},goal_net:{keywords:["sports"],char:"🥅",fitzpatrick_scale:!1,category:"activity"},ice_hockey:{keywords:["sports"],char:"🏒",fitzpatrick_scale:!1,category:"activity"},field_hockey:{keywords:["sports"],char:"🏑",fitzpatrick_scale:!1,category:"activity"},lacrosse:{keywords:["sports","ball","stick"],char:"🥍",fitzpatrick_scale:!1,category:"activity"},cricket:{keywords:["sports"],char:"🏏",fitzpatrick_scale:!1,category:"activity"},ski:{keywords:["sports","winter","cold","snow"],char:"🎿",fitzpatrick_scale:!1,category:"activity"},skier:{keywords:["sports","winter","snow"],char:"⛷",fitzpatrick_scale:!1,category:"activity"},snowboarder:{keywords:["sports","winter"],char:"🏂",fitzpatrick_scale:!0,category:"activity"},person_fencing:{keywords:["sports","fencing","sword"],char:"🤺",fitzpatrick_scale:!1,category:"activity"},women_wrestling:{keywords:["sports","wrestlers"],char:"🤼♀️",fitzpatrick_scale:!1,category:"activity"},men_wrestling:{keywords:["sports","wrestlers"],char:"🤼♂️",fitzpatrick_scale:!1,category:"activity"},woman_cartwheeling:{keywords:["gymnastics"],char:"🤸♀️",fitzpatrick_scale:!0,category:"activity"},man_cartwheeling:{keywords:["gymnastics"],char:"🤸♂️",fitzpatrick_scale:!0,category:"activity"},woman_playing_handball:{keywords:["sports"],char:"🤾♀️",fitzpatrick_scale:!0,category:"activity"},man_playing_handball:{keywords:["sports"],char:"🤾♂️",fitzpatrick_scale:!0,category:"activity"},ice_skate:{keywords:["sports"],char:"⛸",fitzpatrick_scale:!1,category:"activity"},curling_stone:{keywords:["sports"],char:"🥌",fitzpatrick_scale:!1,category:"activity"},skateboard:{keywords:["board"],char:"🛹",fitzpatrick_scale:!1,category:"activity"},sled:{keywords:["sleigh","luge","toboggan"],char:"🛷",fitzpatrick_scale:!1,category:"activity"},bow_and_arrow:{keywords:["sports"],char:"🏹",fitzpatrick_scale:!1,category:"activity"},fishing_pole_and_fish:{keywords:["food","hobby","summer"],char:"🎣",fitzpatrick_scale:!1,category:"activity"},boxing_glove:{keywords:["sports","fighting"],char:"🥊",fitzpatrick_scale:!1,category:"activity"},martial_arts_uniform:{keywords:["judo","karate","taekwondo"],char:"🥋",fitzpatrick_scale:!1,category:"activity"},rowing_woman:{keywords:["sports","hobby","water","ship","woman","female"],char:"🚣♀️",fitzpatrick_scale:!0,category:"activity"},rowing_man:{keywords:["sports","hobby","water","ship"],char:"🚣",fitzpatrick_scale:!0,category:"activity"},climbing_woman:{keywords:["sports","hobby","woman","female","rock"],char:"🧗♀️",fitzpatrick_scale:!0,category:"activity"},climbing_man:{keywords:["sports","hobby","man","male","rock"],char:"🧗♂️",fitzpatrick_scale:!0,category:"activity"},swimming_woman:{keywords:["sports","exercise","human","athlete","water","summer","woman","female"],char:"🏊♀️",fitzpatrick_scale:!0,category:"activity"},swimming_man:{keywords:["sports","exercise","human","athlete","water","summer"],char:"🏊",fitzpatrick_scale:!0,category:"activity"},woman_playing_water_polo:{keywords:["sports","pool"],char:"🤽♀️",fitzpatrick_scale:!0,category:"activity"},man_playing_water_polo:{keywords:["sports","pool"],char:"🤽♂️",fitzpatrick_scale:!0,category:"activity"},woman_in_lotus_position:{keywords:["woman","female","meditation","yoga","serenity","zen","mindfulness"],char:"🧘♀️",fitzpatrick_scale:!0,category:"activity"},man_in_lotus_position:{keywords:["man","male","meditation","yoga","serenity","zen","mindfulness"],char:"🧘♂️",fitzpatrick_scale:!0,category:"activity"},surfing_woman:{keywords:["sports","ocean","sea","summer","beach","woman","female"],char:"🏄♀️",fitzpatrick_scale:!0,category:"activity"},surfing_man:{keywords:["sports","ocean","sea","summer","beach"],char:"🏄",fitzpatrick_scale:!0,category:"activity"},bath:{keywords:["clean","shower","bathroom"],char:"🛀",fitzpatrick_scale:!0,category:"activity"},basketball_woman:{keywords:["sports","human","woman","female"],char:"⛹️♀️",fitzpatrick_scale:!0,category:"activity"},basketball_man:{keywords:["sports","human"],char:"⛹",fitzpatrick_scale:!0,category:"activity"},weight_lifting_woman:{keywords:["sports","training","exercise","woman","female"],char:"🏋️♀️",fitzpatrick_scale:!0,category:"activity"},weight_lifting_man:{keywords:["sports","training","exercise"],char:"🏋",fitzpatrick_scale:!0,category:"activity"},biking_woman:{keywords:["sports","bike","exercise","hipster","woman","female"],char:"🚴♀️",fitzpatrick_scale:!0,category:"activity"},biking_man:{keywords:["sports","bike","exercise","hipster"],char:"🚴",fitzpatrick_scale:!0,category:"activity"},mountain_biking_woman:{keywords:["transportation","sports","human","race","bike","woman","female"],char:"🚵♀️",fitzpatrick_scale:!0,category:"activity"},mountain_biking_man:{keywords:["transportation","sports","human","race","bike"],char:"🚵",fitzpatrick_scale:!0,category:"activity"},horse_racing:{keywords:["animal","betting","competition","gambling","luck"],char:"🏇",fitzpatrick_scale:!0,category:"activity"},business_suit_levitating:{keywords:["suit","business","levitate","hover","jump"],char:"🕴",fitzpatrick_scale:!0,category:"activity"},trophy:{keywords:["win","award","contest","place","ftw","ceremony"],char:"🏆",fitzpatrick_scale:!1,category:"activity"},running_shirt_with_sash:{keywords:["play","pageant"],char:"🎽",fitzpatrick_scale:!1,category:"activity"},medal_sports:{keywords:["award","winning"],char:"🏅",fitzpatrick_scale:!1,category:"activity"},medal_military:{keywords:["award","winning","army"],char:"🎖",fitzpatrick_scale:!1,category:"activity"},"1st_place_medal":{keywords:["award","winning","first"],char:"🥇",fitzpatrick_scale:!1,category:"activity"},"2nd_place_medal":{keywords:["award","second"],char:"🥈",fitzpatrick_scale:!1,category:"activity"},"3rd_place_medal":{keywords:["award","third"],char:"🥉",fitzpatrick_scale:!1,category:"activity"},reminder_ribbon:{keywords:["sports","cause","support","awareness"],char:"🎗",fitzpatrick_scale:!1,category:"activity"},rosette:{keywords:["flower","decoration","military"],char:"🏵",fitzpatrick_scale:!1,category:"activity"},ticket:{keywords:["event","concert","pass"],char:"🎫",fitzpatrick_scale:!1,category:"activity"},tickets:{keywords:["sports","concert","entrance"],char:"🎟",fitzpatrick_scale:!1,category:"activity"},performing_arts:{keywords:["acting","theater","drama"],char:"🎭",fitzpatrick_scale:!1,category:"activity"},art:{keywords:["design","paint","draw","colors"],char:"🎨",fitzpatrick_scale:!1,category:"activity"},circus_tent:{keywords:["festival","carnival","party"],char:"🎪",fitzpatrick_scale:!1,category:"activity"},woman_juggling:{keywords:["juggle","balance","skill","multitask"],char:"🤹♀️",fitzpatrick_scale:!0,category:"activity"},man_juggling:{keywords:["juggle","balance","skill","multitask"],char:"🤹♂️",fitzpatrick_scale:!0,category:"activity"},microphone:{keywords:["sound","music","PA","sing","talkshow"],char:"🎤",fitzpatrick_scale:!1,category:"activity"},headphones:{keywords:["music","score","gadgets"],char:"🎧",fitzpatrick_scale:!1,category:"activity"},musical_score:{keywords:["treble","clef","compose"],char:"🎼",fitzpatrick_scale:!1,category:"activity"},musical_keyboard:{keywords:["piano","instrument","compose"],char:"🎹",fitzpatrick_scale:!1,category:"activity"},drum:{keywords:["music","instrument","drumsticks","snare"],char:"🥁",fitzpatrick_scale:!1,category:"activity"},saxophone:{keywords:["music","instrument","jazz","blues"],char:"🎷",fitzpatrick_scale:!1,category:"activity"},trumpet:{keywords:["music","brass"],char:"🎺",fitzpatrick_scale:!1,category:"activity"},guitar:{keywords:["music","instrument"],char:"🎸",fitzpatrick_scale:!1,category:"activity"},violin:{keywords:["music","instrument","orchestra","symphony"],char:"🎻",fitzpatrick_scale:!1,category:"activity"},clapper:{keywords:["movie","film","record"],char:"🎬",fitzpatrick_scale:!1,category:"activity"},video_game:{keywords:["play","console","PS4","controller"],char:"🎮",fitzpatrick_scale:!1,category:"activity"},space_invader:{keywords:["game","arcade","play"],char:"👾",fitzpatrick_scale:!1,category:"activity"},dart:{keywords:["game","play","bar","target","bullseye"],char:"🎯",fitzpatrick_scale:!1,category:"activity"},game_die:{keywords:["dice","random","tabletop","play","luck"],char:"🎲",fitzpatrick_scale:!1,category:"activity"},chess_pawn:{keywords:["expendable"],char:"♟",fitzpatrick_scale:!1,category:"activity"},slot_machine:{keywords:["bet","gamble","vegas","fruit machine","luck","casino"],char:"🎰",fitzpatrick_scale:!1,category:"activity"},jigsaw:{keywords:["interlocking","puzzle","piece"],char:"🧩",fitzpatrick_scale:!1,category:"activity"},bowling:{keywords:["sports","fun","play"],char:"🎳",fitzpatrick_scale:!1,category:"activity"},red_car:{keywords:["red","transportation","vehicle"],char:"🚗",fitzpatrick_scale:!1,category:"travel_and_places"},taxi:{keywords:["uber","vehicle","cars","transportation"],char:"🚕",fitzpatrick_scale:!1,category:"travel_and_places"},blue_car:{keywords:["transportation","vehicle"],char:"🚙",fitzpatrick_scale:!1,category:"travel_and_places"},bus:{keywords:["car","vehicle","transportation"],char:"🚌",fitzpatrick_scale:!1,category:"travel_and_places"},trolleybus:{keywords:["bart","transportation","vehicle"],char:"🚎",fitzpatrick_scale:!1,category:"travel_and_places"},racing_car:{keywords:["sports","race","fast","formula","f1"],char:"🏎",fitzpatrick_scale:!1,category:"travel_and_places"},police_car:{keywords:["vehicle","cars","transportation","law","legal","enforcement"],char:"🚓",fitzpatrick_scale:!1,category:"travel_and_places"},ambulance:{keywords:["health","911","hospital"],char:"🚑",fitzpatrick_scale:!1,category:"travel_and_places"},fire_engine:{keywords:["transportation","cars","vehicle"],char:"🚒",fitzpatrick_scale:!1,category:"travel_and_places"},minibus:{keywords:["vehicle","car","transportation"],char:"🚐",fitzpatrick_scale:!1,category:"travel_and_places"},truck:{keywords:["cars","transportation"],char:"🚚",fitzpatrick_scale:!1,category:"travel_and_places"},articulated_lorry:{keywords:["vehicle","cars","transportation","express"],char:"🚛",fitzpatrick_scale:!1,category:"travel_and_places"},tractor:{keywords:["vehicle","car","farming","agriculture"],char:"🚜",fitzpatrick_scale:!1,category:"travel_and_places"},kick_scooter:{keywords:["vehicle","kick","razor"],char:"🛴",fitzpatrick_scale:!1,category:"travel_and_places"},motorcycle:{keywords:["race","sports","fast"],char:"🏍",fitzpatrick_scale:!1,category:"travel_and_places"},bike:{keywords:["sports","bicycle","exercise","hipster"],char:"🚲",fitzpatrick_scale:!1,category:"travel_and_places"},motor_scooter:{keywords:["vehicle","vespa","sasha"],char:"🛵",fitzpatrick_scale:!1,category:"travel_and_places"},rotating_light:{keywords:["police","ambulance","911","emergency","alert","error","pinged","law","legal"],char:"🚨",fitzpatrick_scale:!1,category:"travel_and_places"},oncoming_police_car:{keywords:["vehicle","law","legal","enforcement","911"],char:"🚔",fitzpatrick_scale:!1,category:"travel_and_places"},oncoming_bus:{keywords:["vehicle","transportation"],char:"🚍",fitzpatrick_scale:!1,category:"travel_and_places"},oncoming_automobile:{keywords:["car","vehicle","transportation"],char:"🚘",fitzpatrick_scale:!1,category:"travel_and_places"},oncoming_taxi:{keywords:["vehicle","cars","uber"],char:"🚖",fitzpatrick_scale:!1,category:"travel_and_places"},aerial_tramway:{keywords:["transportation","vehicle","ski"],char:"🚡",fitzpatrick_scale:!1,category:"travel_and_places"},mountain_cableway:{keywords:["transportation","vehicle","ski"],char:"🚠",fitzpatrick_scale:!1,category:"travel_and_places"},suspension_railway:{keywords:["vehicle","transportation"],char:"🚟",fitzpatrick_scale:!1,category:"travel_and_places"},railway_car:{keywords:["transportation","vehicle"],char:"🚃",fitzpatrick_scale:!1,category:"travel_and_places"},train:{keywords:["transportation","vehicle","carriage","public","travel"],char:"🚋",fitzpatrick_scale:!1,category:"travel_and_places"},monorail:{keywords:["transportation","vehicle"],char:"🚝",fitzpatrick_scale:!1,category:"travel_and_places"},bullettrain_side:{keywords:["transportation","vehicle"],char:"🚄",fitzpatrick_scale:!1,category:"travel_and_places"},bullettrain_front:{keywords:["transportation","vehicle","speed","fast","public","travel"],char:"🚅",fitzpatrick_scale:!1,category:"travel_and_places"},light_rail:{keywords:["transportation","vehicle"],char:"🚈",fitzpatrick_scale:!1,category:"travel_and_places"},mountain_railway:{keywords:["transportation","vehicle"],char:"🚞",fitzpatrick_scale:!1,category:"travel_and_places"},steam_locomotive:{keywords:["transportation","vehicle","train"],char:"🚂",fitzpatrick_scale:!1,category:"travel_and_places"},train2:{keywords:["transportation","vehicle"],char:"🚆",fitzpatrick_scale:!1,category:"travel_and_places"},metro:{keywords:["transportation","blue-square","mrt","underground","tube"],char:"🚇",fitzpatrick_scale:!1,category:"travel_and_places"},tram:{keywords:["transportation","vehicle"],char:"🚊",fitzpatrick_scale:!1,category:"travel_and_places"},station:{keywords:["transportation","vehicle","public"],char:"🚉",fitzpatrick_scale:!1,category:"travel_and_places"},flying_saucer:{keywords:["transportation","vehicle","ufo"],char:"🛸",fitzpatrick_scale:!1,category:"travel_and_places"},helicopter:{keywords:["transportation","vehicle","fly"],char:"🚁",fitzpatrick_scale:!1,category:"travel_and_places"},small_airplane:{keywords:["flight","transportation","fly","vehicle"],char:"🛩",fitzpatrick_scale:!1,category:"travel_and_places"},airplane:{keywords:["vehicle","transportation","flight","fly"],char:"✈️",fitzpatrick_scale:!1,category:"travel_and_places"},flight_departure:{keywords:["airport","flight","landing"],char:"🛫",fitzpatrick_scale:!1,category:"travel_and_places"},flight_arrival:{keywords:["airport","flight","boarding"],char:"🛬",fitzpatrick_scale:!1,category:"travel_and_places"},sailboat:{keywords:["ship","summer","transportation","water","sailing"],char:"⛵",fitzpatrick_scale:!1,category:"travel_and_places"},motor_boat:{keywords:["ship"],char:"🛥",fitzpatrick_scale:!1,category:"travel_and_places"},speedboat:{keywords:["ship","transportation","vehicle","summer"],char:"🚤",fitzpatrick_scale:!1,category:"travel_and_places"},ferry:{keywords:["boat","ship","yacht"],char:"⛴",fitzpatrick_scale:!1,category:"travel_and_places"},passenger_ship:{keywords:["yacht","cruise","ferry"],char:"🛳",fitzpatrick_scale:!1,category:"travel_and_places"},rocket:{keywords:["launch","ship","staffmode","NASA","outer space","outer_space","fly"],char:"🚀",fitzpatrick_scale:!1,category:"travel_and_places"},artificial_satellite:{keywords:["communication","gps","orbit","spaceflight","NASA","ISS"],char:"🛰",fitzpatrick_scale:!1,category:"travel_and_places"},seat:{keywords:["sit","airplane","transport","bus","flight","fly"],char:"💺",fitzpatrick_scale:!1,category:"travel_and_places"},canoe:{keywords:["boat","paddle","water","ship"],char:"🛶",fitzpatrick_scale:!1,category:"travel_and_places"},anchor:{keywords:["ship","ferry","sea","boat"],char:"⚓",fitzpatrick_scale:!1,category:"travel_and_places"},construction:{keywords:["wip","progress","caution","warning"],char:"🚧",fitzpatrick_scale:!1,category:"travel_and_places"},fuelpump:{keywords:["gas station","petroleum"],char:"⛽",fitzpatrick_scale:!1,category:"travel_and_places"},busstop:{keywords:["transportation","wait"],char:"🚏",fitzpatrick_scale:!1,category:"travel_and_places"},vertical_traffic_light:{keywords:["transportation","driving"],char:"🚦",fitzpatrick_scale:!1,category:"travel_and_places"},traffic_light:{keywords:["transportation","signal"],char:"🚥",fitzpatrick_scale:!1,category:"travel_and_places"},checkered_flag:{keywords:["contest","finishline","race","gokart"],char:"🏁",fitzpatrick_scale:!1,category:"travel_and_places"},ship:{keywords:["transportation","titanic","deploy"],char:"🚢",fitzpatrick_scale:!1,category:"travel_and_places"},ferris_wheel:{keywords:["photo","carnival","londoneye"],char:"🎡",fitzpatrick_scale:!1,category:"travel_and_places"},roller_coaster:{keywords:["carnival","playground","photo","fun"],char:"🎢",fitzpatrick_scale:!1,category:"travel_and_places"},carousel_horse:{keywords:["photo","carnival"],char:"🎠",fitzpatrick_scale:!1,category:"travel_and_places"},building_construction:{keywords:["wip","working","progress"],char:"🏗",fitzpatrick_scale:!1,category:"travel_and_places"},foggy:{keywords:["photo","mountain"],char:"🌁",fitzpatrick_scale:!1,category:"travel_and_places"},tokyo_tower:{keywords:["photo","japanese"],char:"🗼",fitzpatrick_scale:!1,category:"travel_and_places"},factory:{keywords:["building","industry","pollution","smoke"],char:"🏭",fitzpatrick_scale:!1,category:"travel_and_places"},fountain:{keywords:["photo","summer","water","fresh"],char:"⛲",fitzpatrick_scale:!1,category:"travel_and_places"},rice_scene:{keywords:["photo","japan","asia","tsukimi"],char:"🎑",fitzpatrick_scale:!1,category:"travel_and_places"},mountain:{keywords:["photo","nature","environment"],char:"⛰",fitzpatrick_scale:!1,category:"travel_and_places"},mountain_snow:{keywords:["photo","nature","environment","winter","cold"],char:"🏔",fitzpatrick_scale:!1,category:"travel_and_places"},mount_fuji:{keywords:["photo","mountain","nature","japanese"],char:"🗻",fitzpatrick_scale:!1,category:"travel_and_places"},volcano:{keywords:["photo","nature","disaster"],char:"🌋",fitzpatrick_scale:!1,category:"travel_and_places"},japan:{keywords:["nation","country","japanese","asia"],char:"🗾",fitzpatrick_scale:!1,category:"travel_and_places"},camping:{keywords:["photo","outdoors","tent"],char:"🏕",fitzpatrick_scale:!1,category:"travel_and_places"},tent:{keywords:["photo","camping","outdoors"],char:"⛺",fitzpatrick_scale:!1,category:"travel_and_places"},national_park:{keywords:["photo","environment","nature"],char:"🏞",fitzpatrick_scale:!1,category:"travel_and_places"},motorway:{keywords:["road","cupertino","interstate","highway"],char:"🛣",fitzpatrick_scale:!1,category:"travel_and_places"},railway_track:{keywords:["train","transportation"],char:"🛤",fitzpatrick_scale:!1,category:"travel_and_places"},sunrise:{keywords:["morning","view","vacation","photo"],char:"🌅",fitzpatrick_scale:!1,category:"travel_and_places"},sunrise_over_mountains:{keywords:["view","vacation","photo"],char:"🌄",fitzpatrick_scale:!1,category:"travel_and_places"},desert:{keywords:["photo","warm","saharah"],char:"🏜",fitzpatrick_scale:!1,category:"travel_and_places"},beach_umbrella:{keywords:["weather","summer","sunny","sand","mojito"],char:"🏖",fitzpatrick_scale:!1,category:"travel_and_places"},desert_island:{keywords:["photo","tropical","mojito"],char:"🏝",fitzpatrick_scale:!1,category:"travel_and_places"},city_sunrise:{keywords:["photo","good morning","dawn"],char:"🌇",fitzpatrick_scale:!1,category:"travel_and_places"},city_sunset:{keywords:["photo","evening","sky","buildings"],char:"🌆",fitzpatrick_scale:!1,category:"travel_and_places"},cityscape:{keywords:["photo","night life","urban"],char:"🏙",fitzpatrick_scale:!1,category:"travel_and_places"},night_with_stars:{keywords:["evening","city","downtown"],char:"🌃",fitzpatrick_scale:!1,category:"travel_and_places"},bridge_at_night:{keywords:["photo","sanfrancisco"],char:"🌉",fitzpatrick_scale:!1,category:"travel_and_places"},milky_way:{keywords:["photo","space","stars"],char:"🌌",fitzpatrick_scale:!1,category:"travel_and_places"},stars:{keywords:["night","photo"],char:"🌠",fitzpatrick_scale:!1,category:"travel_and_places"},sparkler:{keywords:["stars","night","shine"],char:"🎇",fitzpatrick_scale:!1,category:"travel_and_places"},fireworks:{keywords:["photo","festival","carnival","congratulations"],char:"🎆",fitzpatrick_scale:!1,category:"travel_and_places"},rainbow:{keywords:["nature","happy","unicorn_face","photo","sky","spring"],char:"🌈",fitzpatrick_scale:!1,category:"travel_and_places"},houses:{keywords:["buildings","photo"],char:"🏘",fitzpatrick_scale:!1,category:"travel_and_places"},european_castle:{keywords:["building","royalty","history"],char:"🏰",fitzpatrick_scale:!1,category:"travel_and_places"},japanese_castle:{keywords:["photo","building"],char:"🏯",fitzpatrick_scale:!1,category:"travel_and_places"},stadium:{keywords:["photo","place","sports","concert","venue"],char:"🏟",fitzpatrick_scale:!1,category:"travel_and_places"},statue_of_liberty:{keywords:["american","newyork"],char:"🗽",fitzpatrick_scale:!1,category:"travel_and_places"},house:{keywords:["building","home"],char:"🏠",fitzpatrick_scale:!1,category:"travel_and_places"},house_with_garden:{keywords:["home","plant","nature"],char:"🏡",fitzpatrick_scale:!1,category:"travel_and_places"},derelict_house:{keywords:["abandon","evict","broken","building"],char:"🏚",fitzpatrick_scale:!1,category:"travel_and_places"},office:{keywords:["building","bureau","work"],char:"🏢",fitzpatrick_scale:!1,category:"travel_and_places"},department_store:{keywords:["building","shopping","mall"],char:"🏬",fitzpatrick_scale:!1,category:"travel_and_places"},post_office:{keywords:["building","envelope","communication"],char:"🏣",fitzpatrick_scale:!1,category:"travel_and_places"},european_post_office:{keywords:["building","email"],char:"🏤",fitzpatrick_scale:!1,category:"travel_and_places"},hospital:{keywords:["building","health","surgery","doctor"],char:"🏥",fitzpatrick_scale:!1,category:"travel_and_places"},bank:{keywords:["building","money","sales","cash","business","enterprise"],char:"🏦",fitzpatrick_scale:!1,category:"travel_and_places"},hotel:{keywords:["building","accomodation","checkin"],char:"🏨",fitzpatrick_scale:!1,category:"travel_and_places"},convenience_store:{keywords:["building","shopping","groceries"],char:"🏪",fitzpatrick_scale:!1,category:"travel_and_places"},school:{keywords:["building","student","education","learn","teach"],char:"🏫",fitzpatrick_scale:!1,category:"travel_and_places"},love_hotel:{keywords:["like","affection","dating"],char:"🏩",fitzpatrick_scale:!1,category:"travel_and_places"},wedding:{keywords:["love","like","affection","couple","marriage","bride","groom"],char:"💒",fitzpatrick_scale:!1,category:"travel_and_places"},classical_building:{keywords:["art","culture","history"],char:"🏛",fitzpatrick_scale:!1,category:"travel_and_places"},church:{keywords:["building","religion","christ"],char:"⛪",fitzpatrick_scale:!1,category:"travel_and_places"},mosque:{keywords:["islam","worship","minaret"],char:"🕌",fitzpatrick_scale:!1,category:"travel_and_places"},synagogue:{keywords:["judaism","worship","temple","jewish"],char:"🕍",fitzpatrick_scale:!1,category:"travel_and_places"},kaaba:{keywords:["mecca","mosque","islam"],char:"🕋",fitzpatrick_scale:!1,category:"travel_and_places"},shinto_shrine:{keywords:["temple","japan","kyoto"],char:"⛩",fitzpatrick_scale:!1,category:"travel_and_places"},watch:{keywords:["time","accessories"],char:"⌚",fitzpatrick_scale:!1,category:"objects"},iphone:{keywords:["technology","apple","gadgets","dial"],char:"📱",fitzpatrick_scale:!1,category:"objects"},calling:{keywords:["iphone","incoming"],char:"📲",fitzpatrick_scale:!1,category:"objects"},computer:{keywords:["technology","laptop","screen","display","monitor"],char:"💻",fitzpatrick_scale:!1,category:"objects"},keyboard:{keywords:["technology","computer","type","input","text"],char:"⌨",fitzpatrick_scale:!1,category:"objects"},desktop_computer:{keywords:["technology","computing","screen"],char:"🖥",fitzpatrick_scale:!1,category:"objects"},printer:{keywords:["paper","ink"],char:"🖨",fitzpatrick_scale:!1,category:"objects"},computer_mouse:{keywords:["click"],char:"🖱",fitzpatrick_scale:!1,category:"objects"},trackball:{keywords:["technology","trackpad"],char:"🖲",fitzpatrick_scale:!1,category:"objects"},joystick:{keywords:["game","play"],char:"🕹",fitzpatrick_scale:!1,category:"objects"},clamp:{keywords:["tool"],char:"🗜",fitzpatrick_scale:!1,category:"objects"},minidisc:{keywords:["technology","record","data","disk","90s"],char:"💽",fitzpatrick_scale:!1,category:"objects"},floppy_disk:{keywords:["oldschool","technology","save","90s","80s"],char:"💾",fitzpatrick_scale:!1,category:"objects"},cd:{keywords:["technology","dvd","disk","disc","90s"],char:"💿",fitzpatrick_scale:!1,category:"objects"},dvd:{keywords:["cd","disk","disc"],char:"📀",fitzpatrick_scale:!1,category:"objects"},vhs:{keywords:["record","video","oldschool","90s","80s"],char:"📼",fitzpatrick_scale:!1,category:"objects"},camera:{keywords:["gadgets","photography"],char:"📷",fitzpatrick_scale:!1,category:"objects"},camera_flash:{keywords:["photography","gadgets"],char:"📸",fitzpatrick_scale:!1,category:"objects"},video_camera:{keywords:["film","record"],char:"📹",fitzpatrick_scale:!1,category:"objects"},movie_camera:{keywords:["film","record"],char:"🎥",fitzpatrick_scale:!1,category:"objects"},film_projector:{keywords:["video","tape","record","movie"],char:"📽",fitzpatrick_scale:!1,category:"objects"},film_strip:{keywords:["movie"],char:"🎞",fitzpatrick_scale:!1,category:"objects"},telephone_receiver:{keywords:["technology","communication","dial"],char:"📞",fitzpatrick_scale:!1,category:"objects"},phone:{keywords:["technology","communication","dial","telephone"],char:"☎️",fitzpatrick_scale:!1,category:"objects"},pager:{keywords:["bbcall","oldschool","90s"],char:"📟",fitzpatrick_scale:!1,category:"objects"},fax:{keywords:["communication","technology"],char:"📠",fitzpatrick_scale:!1,category:"objects"},tv:{keywords:["technology","program","oldschool","show","television"],char:"📺",fitzpatrick_scale:!1,category:"objects"},radio:{keywords:["communication","music","podcast","program"],char:"📻",fitzpatrick_scale:!1,category:"objects"},studio_microphone:{keywords:["sing","recording","artist","talkshow"],char:"🎙",fitzpatrick_scale:!1,category:"objects"},level_slider:{keywords:["scale"],char:"🎚",fitzpatrick_scale:!1,category:"objects"},control_knobs:{keywords:["dial"],char:"🎛",fitzpatrick_scale:!1,category:"objects"},compass:{keywords:["magnetic","navigation","orienteering"],char:"🧭",fitzpatrick_scale:!1,category:"objects"},stopwatch:{keywords:["time","deadline"],char:"⏱",fitzpatrick_scale:!1,category:"objects"},timer_clock:{keywords:["alarm"],char:"⏲",fitzpatrick_scale:!1,category:"objects"},alarm_clock:{keywords:["time","wake"],char:"⏰",fitzpatrick_scale:!1,category:"objects"},mantelpiece_clock:{keywords:["time"],char:"🕰",fitzpatrick_scale:!1,category:"objects"},hourglass_flowing_sand:{keywords:["oldschool","time","countdown"],char:"⏳",fitzpatrick_scale:!1,category:"objects"},hourglass:{keywords:["time","clock","oldschool","limit","exam","quiz","test"],char:"⌛",fitzpatrick_scale:!1,category:"objects"},satellite:{keywords:["communication","future","radio","space"],char:"📡",fitzpatrick_scale:!1,category:"objects"},battery:{keywords:["power","energy","sustain"],char:"🔋",fitzpatrick_scale:!1,category:"objects"},electric_plug:{keywords:["charger","power"],char:"🔌",fitzpatrick_scale:!1,category:"objects"},bulb:{keywords:["light","electricity","idea"],char:"💡",fitzpatrick_scale:!1,category:"objects"},flashlight:{keywords:["dark","camping","sight","night"],char:"🔦",fitzpatrick_scale:!1,category:"objects"},candle:{keywords:["fire","wax"],char:"🕯",fitzpatrick_scale:!1,category:"objects"},fire_extinguisher:{keywords:["quench"],char:"🧯",fitzpatrick_scale:!1,category:"objects"},wastebasket:{keywords:["bin","trash","rubbish","garbage","toss"],char:"🗑",fitzpatrick_scale:!1,category:"objects"},oil_drum:{keywords:["barrell"],char:"🛢",fitzpatrick_scale:!1,category:"objects"},money_with_wings:{keywords:["dollar","bills","payment","sale"],char:"💸",fitzpatrick_scale:!1,category:"objects"},dollar:{keywords:["money","sales","bill","currency"],char:"💵",fitzpatrick_scale:!1,category:"objects"},yen:{keywords:["money","sales","japanese","dollar","currency"],char:"💴",fitzpatrick_scale:!1,category:"objects"},euro:{keywords:["money","sales","dollar","currency"],char:"💶",fitzpatrick_scale:!1,category:"objects"},pound:{keywords:["british","sterling","money","sales","bills","uk","england","currency"],char:"💷",fitzpatrick_scale:!1,category:"objects"},moneybag:{keywords:["dollar","payment","coins","sale"],char:"💰",fitzpatrick_scale:!1,category:"objects"},credit_card:{keywords:["money","sales","dollar","bill","payment","shopping"],char:"💳",fitzpatrick_scale:!1,category:"objects"},gem:{keywords:["blue","ruby","diamond","jewelry"],char:"💎",fitzpatrick_scale:!1,category:"objects"},balance_scale:{keywords:["law","fairness","weight"],char:"⚖",fitzpatrick_scale:!1,category:"objects"},toolbox:{keywords:["tools","diy","fix","maintainer","mechanic"],char:"🧰",fitzpatrick_scale:!1,category:"objects"},wrench:{keywords:["tools","diy","ikea","fix","maintainer"],char:"🔧",fitzpatrick_scale:!1,category:"objects"},hammer:{keywords:["tools","build","create"],char:"🔨",fitzpatrick_scale:!1,category:"objects"},hammer_and_pick:{keywords:["tools","build","create"],char:"⚒",fitzpatrick_scale:!1,category:"objects"},hammer_and_wrench:{keywords:["tools","build","create"],char:"🛠",fitzpatrick_scale:!1,category:"objects"},pick:{keywords:["tools","dig"],char:"⛏",fitzpatrick_scale:!1,category:"objects"},nut_and_bolt:{keywords:["handy","tools","fix"],char:"🔩",fitzpatrick_scale:!1,category:"objects"},gear:{keywords:["cog"],char:"⚙",fitzpatrick_scale:!1,category:"objects"},brick:{keywords:["bricks"],char:"🧱",fitzpatrick_scale:!1,category:"objects"},chains:{keywords:["lock","arrest"],char:"⛓",fitzpatrick_scale:!1,category:"objects"},magnet:{keywords:["attraction","magnetic"],char:"🧲",fitzpatrick_scale:!1,category:"objects"},gun:{keywords:["violence","weapon","pistol","revolver"],char:"🔫",fitzpatrick_scale:!1,category:"objects"},bomb:{keywords:["boom","explode","explosion","terrorism"],char:"💣",fitzpatrick_scale:!1,category:"objects"},firecracker:{keywords:["dynamite","boom","explode","explosion","explosive"],char:"🧨",fitzpatrick_scale:!1,category:"objects"},hocho:{keywords:["knife","blade","cutlery","kitchen","weapon"],char:"🔪",fitzpatrick_scale:!1,category:"objects"},dagger:{keywords:["weapon"],char:"🗡",fitzpatrick_scale:!1,category:"objects"},crossed_swords:{keywords:["weapon"],char:"⚔",fitzpatrick_scale:!1,category:"objects"},shield:{keywords:["protection","security"],char:"🛡",fitzpatrick_scale:!1,category:"objects"},smoking:{keywords:["kills","tobacco","cigarette","joint","smoke"],char:"🚬",fitzpatrick_scale:!1,category:"objects"},skull_and_crossbones:{keywords:["poison","danger","deadly","scary","death","pirate","evil"],char:"☠",fitzpatrick_scale:!1,category:"objects"},coffin:{keywords:["vampire","dead","die","death","rip","graveyard","cemetery","casket","funeral","box"],char:"⚰",fitzpatrick_scale:!1,category:"objects"},funeral_urn:{keywords:["dead","die","death","rip","ashes"],char:"⚱",fitzpatrick_scale:!1,category:"objects"},amphora:{keywords:["vase","jar"],char:"🏺",fitzpatrick_scale:!1,category:"objects"},crystal_ball:{keywords:["disco","party","magic","circus","fortune_teller"],char:"🔮",fitzpatrick_scale:!1,category:"objects"},prayer_beads:{keywords:["dhikr","religious"],char:"📿",fitzpatrick_scale:!1,category:"objects"},nazar_amulet:{keywords:["bead","charm"],char:"🧿",fitzpatrick_scale:!1,category:"objects"},barber:{keywords:["hair","salon","style"],char:"💈",fitzpatrick_scale:!1,category:"objects"},alembic:{keywords:["distilling","science","experiment","chemistry"],char:"⚗",fitzpatrick_scale:!1,category:"objects"},telescope:{keywords:["stars","space","zoom","science","astronomy"],char:"🔭",fitzpatrick_scale:!1,category:"objects"},microscope:{keywords:["laboratory","experiment","zoomin","science","study"],char:"🔬",fitzpatrick_scale:!1,category:"objects"},hole:{keywords:["embarrassing"],char:"🕳",fitzpatrick_scale:!1,category:"objects"},pill:{keywords:["health","medicine","doctor","pharmacy","drug"],char:"💊",fitzpatrick_scale:!1,category:"objects"},syringe:{keywords:["health","hospital","drugs","blood","medicine","needle","doctor","nurse"],char:"💉",fitzpatrick_scale:!1,category:"objects"},dna:{keywords:["biologist","genetics","life"],char:"🧬",fitzpatrick_scale:!1,category:"objects"},microbe:{keywords:["amoeba","bacteria","germs"],char:"🦠",fitzpatrick_scale:!1,category:"objects"},petri_dish:{keywords:["bacteria","biology","culture","lab"],char:"🧫",fitzpatrick_scale:!1,category:"objects"},test_tube:{keywords:["chemistry","experiment","lab","science"],char:"🧪",fitzpatrick_scale:!1,category:"objects"},thermometer:{keywords:["weather","temperature","hot","cold"],char:"🌡",fitzpatrick_scale:!1,category:"objects"},broom:{keywords:["cleaning","sweeping","witch"],char:"🧹",fitzpatrick_scale:!1,category:"objects"},basket:{keywords:["laundry"],char:"🧺",fitzpatrick_scale:!1,category:"objects"},toilet_paper:{keywords:["roll"],char:"🧻",fitzpatrick_scale:!1,category:"objects"},label:{keywords:["sale","tag"],char:"🏷",fitzpatrick_scale:!1,category:"objects"},bookmark:{keywords:["favorite","label","save"],char:"🔖",fitzpatrick_scale:!1,category:"objects"},toilet:{keywords:["restroom","wc","washroom","bathroom","potty"],char:"🚽",fitzpatrick_scale:!1,category:"objects"},shower:{keywords:["clean","water","bathroom"],char:"🚿",fitzpatrick_scale:!1,category:"objects"},bathtub:{keywords:["clean","shower","bathroom"],char:"🛁",fitzpatrick_scale:!1,category:"objects"},soap:{keywords:["bar","bathing","cleaning","lather"],char:"🧼",fitzpatrick_scale:!1,category:"objects"},sponge:{keywords:["absorbing","cleaning","porous"],char:"🧽",fitzpatrick_scale:!1,category:"objects"},lotion_bottle:{keywords:["moisturizer","sunscreen"],char:"🧴",fitzpatrick_scale:!1,category:"objects"},key:{keywords:["lock","door","password"],char:"🔑",fitzpatrick_scale:!1,category:"objects"},old_key:{keywords:["lock","door","password"],char:"🗝",fitzpatrick_scale:!1,category:"objects"},couch_and_lamp:{keywords:["read","chill"],char:"🛋",fitzpatrick_scale:!1,category:"objects"},sleeping_bed:{keywords:["bed","rest"],char:"🛌",fitzpatrick_scale:!0,category:"objects"},bed:{keywords:["sleep","rest"],char:"🛏",fitzpatrick_scale:!1,category:"objects"},door:{keywords:["house","entry","exit"],char:"🚪",fitzpatrick_scale:!1,category:"objects"},bellhop_bell:{keywords:["service"],char:"🛎",fitzpatrick_scale:!1,category:"objects"},teddy_bear:{keywords:["plush","stuffed"],char:"🧸",fitzpatrick_scale:!1,category:"objects"},framed_picture:{keywords:["photography"],char:"🖼",fitzpatrick_scale:!1,category:"objects"},world_map:{keywords:["location","direction"],char:"🗺",fitzpatrick_scale:!1,category:"objects"},parasol_on_ground:{keywords:["weather","summer"],char:"⛱",fitzpatrick_scale:!1,category:"objects"},moyai:{keywords:["rock","easter island","moai"],char:"🗿",fitzpatrick_scale:!1,category:"objects"},shopping:{keywords:["mall","buy","purchase"],char:"🛍",fitzpatrick_scale:!1,category:"objects"},shopping_cart:{keywords:["trolley"],char:"🛒",fitzpatrick_scale:!1,category:"objects"},balloon:{keywords:["party","celebration","birthday","circus"],char:"🎈",fitzpatrick_scale:!1,category:"objects"},flags:{keywords:["fish","japanese","koinobori","carp","banner"],char:"🎏",fitzpatrick_scale:!1,category:"objects"},ribbon:{keywords:["decoration","pink","girl","bowtie"],char:"🎀",fitzpatrick_scale:!1,category:"objects"},gift:{keywords:["present","birthday","christmas","xmas"],char:"🎁",fitzpatrick_scale:!1,category:"objects"},confetti_ball:{keywords:["festival","party","birthday","circus"],char:"🎊",fitzpatrick_scale:!1,category:"objects"},tada:{keywords:["party","congratulations","birthday","magic","circus","celebration"],char:"🎉",fitzpatrick_scale:!1,category:"objects"},dolls:{keywords:["japanese","toy","kimono"],char:"🎎",fitzpatrick_scale:!1,category:"objects"},wind_chime:{keywords:["nature","ding","spring","bell"],char:"🎐",fitzpatrick_scale:!1,category:"objects"},crossed_flags:{keywords:["japanese","nation","country","border"],char:"🎌",fitzpatrick_scale:!1,category:"objects"},izakaya_lantern:{keywords:["light","paper","halloween","spooky"],char:"🏮",fitzpatrick_scale:!1,category:"objects"},red_envelope:{keywords:["gift"],char:"🧧",fitzpatrick_scale:!1,category:"objects"},email:{keywords:["letter","postal","inbox","communication"],char:"✉️",fitzpatrick_scale:!1,category:"objects"},envelope_with_arrow:{keywords:["email","communication"],char:"📩",fitzpatrick_scale:!1,category:"objects"},incoming_envelope:{keywords:["email","inbox"],char:"📨",fitzpatrick_scale:!1,category:"objects"},"e-mail":{keywords:["communication","inbox"],char:"📧",fitzpatrick_scale:!1,category:"objects"},love_letter:{keywords:["email","like","affection","envelope","valentines"],char:"💌",fitzpatrick_scale:!1,category:"objects"},postbox:{keywords:["email","letter","envelope"],char:"📮",fitzpatrick_scale:!1,category:"objects"},mailbox_closed:{keywords:["email","communication","inbox"],char:"📪",fitzpatrick_scale:!1,category:"objects"},mailbox:{keywords:["email","inbox","communication"],char:"📫",fitzpatrick_scale:!1,category:"objects"},mailbox_with_mail:{keywords:["email","inbox","communication"],char:"📬",fitzpatrick_scale:!1,category:"objects"},mailbox_with_no_mail:{keywords:["email","inbox"],char:"📭",fitzpatrick_scale:!1,category:"objects"},package:{keywords:["mail","gift","cardboard","box","moving"],char:"📦",fitzpatrick_scale:!1,category:"objects"},postal_horn:{keywords:["instrument","music"],char:"📯",fitzpatrick_scale:!1,category:"objects"},inbox_tray:{keywords:["email","documents"],char:"📥",fitzpatrick_scale:!1,category:"objects"},outbox_tray:{keywords:["inbox","email"],char:"📤",fitzpatrick_scale:!1,category:"objects"},scroll:{keywords:["documents","ancient","history","paper"],char:"📜",fitzpatrick_scale:!1,category:"objects"},page_with_curl:{keywords:["documents","office","paper"],char:"📃",fitzpatrick_scale:!1,category:"objects"},bookmark_tabs:{keywords:["favorite","save","order","tidy"],char:"📑",fitzpatrick_scale:!1,category:"objects"},receipt:{keywords:["accounting","expenses"],char:"🧾",fitzpatrick_scale:!1,category:"objects"},bar_chart:{keywords:["graph","presentation","stats"],char:"📊",fitzpatrick_scale:!1,category:"objects"},chart_with_upwards_trend:{keywords:["graph","presentation","stats","recovery","business","economics","money","sales","good","success"],char:"📈",fitzpatrick_scale:!1,category:"objects"},chart_with_downwards_trend:{keywords:["graph","presentation","stats","recession","business","economics","money","sales","bad","failure"],char:"📉",fitzpatrick_scale:!1,category:"objects"},page_facing_up:{keywords:["documents","office","paper","information"],char:"📄",fitzpatrick_scale:!1,category:"objects"},date:{keywords:["calendar","schedule"],char:"📅",fitzpatrick_scale:!1,category:"objects"},calendar:{keywords:["schedule","date","planning"],char:"📆",fitzpatrick_scale:!1,category:"objects"},spiral_calendar:{keywords:["date","schedule","planning"],char:"🗓",fitzpatrick_scale:!1,category:"objects"},card_index:{keywords:["business","stationery"],char:"📇",fitzpatrick_scale:!1,category:"objects"},card_file_box:{keywords:["business","stationery"],char:"🗃",fitzpatrick_scale:!1,category:"objects"},ballot_box:{keywords:["election","vote"],char:"🗳",fitzpatrick_scale:!1,category:"objects"},file_cabinet:{keywords:["filing","organizing"],char:"🗄",fitzpatrick_scale:!1,category:"objects"},clipboard:{keywords:["stationery","documents"],char:"📋",fitzpatrick_scale:!1,category:"objects"},spiral_notepad:{keywords:["memo","stationery"],char:"🗒",fitzpatrick_scale:!1,category:"objects"},file_folder:{keywords:["documents","business","office"],char:"📁",fitzpatrick_scale:!1,category:"objects"},open_file_folder:{keywords:["documents","load"],char:"📂",fitzpatrick_scale:!1,category:"objects"},card_index_dividers:{keywords:["organizing","business","stationery"],char:"🗂",fitzpatrick_scale:!1,category:"objects"},newspaper_roll:{keywords:["press","headline"],char:"🗞",fitzpatrick_scale:!1,category:"objects"},newspaper:{keywords:["press","headline"],char:"📰",fitzpatrick_scale:!1,category:"objects"},notebook:{keywords:["stationery","record","notes","paper","study"],char:"📓",fitzpatrick_scale:!1,category:"objects"},closed_book:{keywords:["read","library","knowledge","textbook","learn"],char:"📕",fitzpatrick_scale:!1,category:"objects"},green_book:{keywords:["read","library","knowledge","study"],char:"📗",fitzpatrick_scale:!1,category:"objects"},blue_book:{keywords:["read","library","knowledge","learn","study"],char:"📘",fitzpatrick_scale:!1,category:"objects"},orange_book:{keywords:["read","library","knowledge","textbook","study"],char:"📙",fitzpatrick_scale:!1,category:"objects"},notebook_with_decorative_cover:{keywords:["classroom","notes","record","paper","study"],char:"📔",fitzpatrick_scale:!1,category:"objects"},ledger:{keywords:["notes","paper"],char:"📒",fitzpatrick_scale:!1,category:"objects"},books:{keywords:["literature","library","study"],char:"📚",fitzpatrick_scale:!1,category:"objects"},open_book:{keywords:["book","read","library","knowledge","literature","learn","study"],char:"📖",fitzpatrick_scale:!1,category:"objects"},safety_pin:{keywords:["diaper"],char:"🧷",fitzpatrick_scale:!1,category:"objects"},link:{keywords:["rin]===])
|
---
-- Command line option handling.
---
local premake = require('premake')
local options = {}
options.KIND_ACTION = 'action'
options.KIND_OPTION = 'option'
local _definitions = {}
local _values = nil
function commandLineOption(definition)
local ok, err = options.register(definition)
if not ok then
error(err, 2)
end
end
function options.register(definition)
local ok, err = premake.checkRequired(definition, 'trigger', 'description')
if not ok then
return false, err
end
-- store it
_definitions[definition.trigger] = definition
-- new definition requires option values to be parsed again
_values = nil
return true
end
function options.all()
local i = 0
return function()
while i < #_ARGS do
i = i + 1
local arg = _ARGS[i]
local trigger, value = options._splitTriggerFromValueIfPresent(arg)
if not value then
local def = options.definitionOf(trigger)
if def and def.value then
i = i + 1
value = _ARGS[i] or def.default
else
value = _ARGS[i + 1]
end
end
return trigger, value
end
end
end
function options.definitionOf(trigger)
return _definitions[trigger]
end
function options.each()
local it = options.all()
return function()
local trigger, value = it()
while trigger do
local def = options.definitionOf(trigger)
if def then
return trigger, value
end
trigger, value = it()
end
end
end
function options.execute(trigger, value)
local def = options.definitionOf(trigger)
if def and def.execute then
def.execute(value)
end
end
function options.getDefinitions()
local result = {}
for _, def in pairs(_definitions) do
table.insert(result, def)
end
table.sort(result, function(a, b)
return a.trigger < b.trigger
end)
return result
end
function options.getKind(trigger)
if string.startsWith(trigger, '-') then
return options.KIND_OPTION
else
return options.KIND_ACTION
end
end
function options.isSet(trigger)
return (options.valueOf(trigger) ~= nil)
end
function options.validate()
for trigger, _ in options.all() do
local def = options.definitionOf(trigger)
if not def then
return false, string.format('invalid option "%s"', trigger)
end
end
return true
end
function options.valueOf(trigger)
if not _values then
_values = {}
for trigger, value in options.each() do
_values[trigger] = value
end
end
local def = options.definitionOf(trigger)
if def then
return _values[def.trigger] or def.default
end
end
---
-- If the arg is of the form "trigger=value", split on the "=" and return
-- the split trigger-value pair.
---
function options._splitTriggerFromValueIfPresent(arg)
local splitAt = string.find(arg, '=', 1, true)
if splitAt then
return string.sub(arg, 1, splitAt - 1), string.sub(arg, splitAt + 1)
else
return arg, nil
end
end
return options
|
require 'image'
dir = require 'pl.dir'
util = paths.dofile('../util.lua')
local alphabet = "abcdefghijklmnopqrstuvwxyz0123456789-,;.!?:'\"/\\|_@#$%^&*~`+-=<>()[]{} "
trainLoader = {}
if opt.num_holdout == nil then
opt.num_holdout = 0
end
if opt.trainfiles == '' then
cur_files = dir.getfiles(opt.data_root)
else
cur_files = torch.load(opt.trainfiles)
for f = 1,#cur_files do
cur_files[f] = opt.data_root .. '/' .. cur_files[f]
end
end
act2ix = {
['skiing, climbing up'] = 1,
['skiing, cross-country'] = 1,
['skiing, cross-country, biathlon, skating technique'] = 1,
['skiing, downhill'] = 1,
['skiing, general'] = 1,
['swimming, backstroke'] = 2,
['swimming, breaststroke, recreational'] = 2,
['swimming, butterfly, general'] = 2,
['swimming, general'] = 2,
['swimming, lake, ocean, river (Taylor Codes 280, 295)'] = 2,
['swimming, sidestroke, general'] = 2,
['tennis'] = 3,
['tennis, doubles'] = 3,
['tennis, hitting balls, non-game play, moderate effort'] = 3,
['frisbee'] = 4,
['golf'] = 5,
['sitting, teaching stretching or yoga, or light effort exercise class'] = 6,
['yoga, Nadisodhana'] = 6,
['yoga, Power'] = 6,
}
ix2cls = {
'bicycling',
'conditioning exercise',
'dancing',
'fishing and hunting',
'home activities',
'home repair',
'inactivity quiet/light',
'lawn and garden',
'miscellaneous',
'music playing',
'occupation',
'religious activities',
'running',
'self care',
'sports',
'transportation',
'volunteer activities',
'walking',
'water activities',
'winter activities'
}
cls2ix = {}
for k,v in pairs(ix2cls) do
cls2ix[v] = k
end
size = #cur_files
--------------------------------------------------------------------------------------------
local loadSize = {3, opt.loadSize}
local sampleSize = {3, opt.fineSize}
local function loadImage(path)
local input = image.load(path, 3, 'float')
return input
end
-- function to load the image, jitter it appropriately (random crops etc.)
trainHook = function(path, points, pos, scale, head)
collectgarbage()
pt_head = torch.zeros(1,3)
pt_head[{1,1}] = (head[1] + head[3]) / 2.0
pt_head[{1,2}] = (head[2] + head[4]) / 2.0
if head:sum() > 1e-3 then pt_head[{1,3}] = 1.0 end
local input = loadImage(path)
local loc = points:transpose(1,2) -- #points x 3
loc = torch.cat(loc, pt_head, 1)
-- First crop single person
local oW = math.ceil(scale[1] * 200 * 1.1)
local oH = math.ceil(scale[1] * 200 * 1.1)
local w1 = math.max(1,math.floor(pos[1] - oW/2))
local h1 = math.max(1,math.floor(pos[2] - oH/2))
local w2 = math.min(input:size(3), w1 + oW - 1)
local h2 = math.min(input:size(2), h1 + oH - 1)
oW = w2 - w1
oH = h2 - h1
input = image.crop(input, w1, h1, w2, h2)
assert(input:size(2) == oH)
assert(input:size(3) == oW)
-- update bboxes
for b = 1,loc:size(1) do
loc[{b,1}] = math.max(1, loc[{b,1}] - w1) -- x
loc[{b,2}] = math.max(1, loc[{b,2}] - h1) -- y
end
-- Then scale to load size.
local iW_orig = input:size(3)
local iH_orig = input:size(2)
input = image.scale(input, loadSize[2], loadSize[2])
local iW = input:size(3)
local iH = input:size(2)
-- rescale bboxes
local x_scale_factor = iW / iW_orig
local y_scale_factor = iH / iH_orig
for b = 1,loc:size(1) do
loc[{b,1}] = math.max(1, math.floor(x_scale_factor * loc[{b,1}]))
loc[{b,2}] = math.max(1, math.floor(y_scale_factor * loc[{b,2}]))
end
-- then crop and flip
local oW = sampleSize[2]
local oH = sampleSize[2]
local h1 = math.ceil(torch.uniform(1e-2, iH-oH))
local w1 = math.ceil(torch.uniform(1e-2, iW-oW))
local out = image.crop(input, w1, h1, w1 + oW, h1 + oH)
assert(out:size(2) == oW)
assert(out:size(3) == oH)
local do_flip = torch.uniform() > 0.5
if do_flip then
out = image.hflip(out);
end
-- update bboxes
for b = 1,loc:size(1) do
loc[{b,1}] = math.max(1, loc[{b,1}] - w1) -- x
loc[{b,2}] = math.max(1, loc[{b,2}] - h1) -- y
if do_flip then
loc[{b,1}] = math.max(1, oW - loc[{b,1}] + 1)
end
end
out:mul(2):add(-1) -- make it [0, 1] -> [-1, 1]
input_dbg = util.draw_keypoints(out:clone(), loc)
-- compute affine transformation matrices.
for b = 1,loc:size(1) do
local bW = loc[{b,1}]
local bH = loc[{b,2}]
local scale_X = bW / out:size(3)
local scale_Y = bH / out:size(2)
loc[{b,1}] = scale_X
loc[{b,2}] = scale_Y
end
return out, loc, input_dbg
end
function trainLoader:sample(quantity)
local batch_info = {}
while #batch_info < quantity do
local ix_file = torch.randperm(#cur_files)[1]
local info = torch.load(cur_files[ix_file])
if opt.trainfiles ~= '' then
if (info.has_kp[{1,1}] == 1) and
(info.points[{3,{},{}}]:sum() > 0) and
(#info.single_person:size() == 2) and
(info.single_person:size(2) == 1) and
(act2ix[info.act_name] ~= nil) then
batch_info[#batch_info + 1] = info
end
else
if (info.has_kp[{1,1}] == 1) and
(info.points[{3,{},{}}]:sum() > 0) and
(#info.single_person:size() == 2) and
(info.single_person:size(2) == 1) and
(cls2ix[info.cat_name] ~= nil) then
batch_info[#batch_info + 1] = info
end
end
end
local data_img = torch.zeros(quantity, sampleSize[1], sampleSize[2], sampleSize[2])
local data_dbg = torch.zeros(quantity, sampleSize[1], sampleSize[2], sampleSize[2])
local data_txt = torch.zeros(quantity, opt.txtSize)
local data_loc = torch.zeros(quantity, opt.num_elt, 3)
for n = 1, quantity do
local info = batch_info[n]
local img_file = opt.img_dir .. '/' .. info.img
-- randomly select a single person
local person_ix = torch.randperm(info.single_person:size(2))[1]
person_ix = info.single_person[{1,person_ix}]
-- normalize image and keypoint locations.
local img, locs, img_dbg = trainHook(img_file,
info.points[{{},{},person_ix}],
info.pos[{{},person_ix}],
info.scale[{{},person_ix}],
info.head[{{},person_ix}])
data_img[{n,{},{},{}}]:copy(img)
-- add text information.
local ix_txt = torch.randperm(info.txt:size(1) - opt.num_holdout)
for c = 1,opt.numCaption do
data_txt[n]:add(info.txt[ix_txt[c]]:double())
end
data_txt[n]:mul(1.0/opt.numCaption)
data_loc[n]:copy(locs)
end
collectgarbage(); collectgarbage()
return data_img, data_txt, data_loc, data_dbg
end
function trainLoader:size()
return size
end
|
--local defaultDefault = "Lato"
--local defaultDefault = "Leeawadee"
--local defaultDefault = "MS Reference Sans"
--local defaultDefault = "Roboto"
--local defaultDefault = "Myriad"
function XYZUI.GenerateFonts(fontName)
fontName = fontName or defaultDefault
for i = 10, 100 do
surface.CreateFont("xyz_ui_main_font_"..i, {
font = fontName,
size = i,
weight = 100
})
end
for i = 1, 40 do
surface.CreateFont("xyz_ui_scale_font_"..i, {
font = fontName,
size = ScreenScale(i),
weight = 100
})
end
end
XYZUI.GenerateFonts("Calibri")
|
-- simpler version of CreateSection
-- no optimization
local CFrameTrack = require(script.Parent.CFrameTrack)
local util = script.Parent.Util
local t = require(util.t)
local CheckArgs = t.tuple(
CFrameTrack.IsType, -- CFrameTrack
t.number, -- startPosition
t.number, -- endPosition
t.number, -- startOffset
t.numberPositive, -- segmentLength
t.number, -- segmentOffset
t.boolean, -- buildEnd
t.callback -- buildSegment
)
return function
(
cframeTrack,
startPosition,
endPosition,
startOffset,
segmentLength,
segmentOffset,
buildEnd,
buildSegment
)
assert(CheckArgs(
cframeTrack,
startPosition,
endPosition,
startOffset,
segmentLength,
segmentOffset,
buildEnd,
buildSegment
))
assert(segmentOffset > -segmentLength,
"SegmentOffset must be greater than SegmentLength")
local trackLength = cframeTrack.Length
local totalLength
if startPosition < endPosition then
totalLength = endPosition - startPosition
else
totalLength = (trackLength - startPosition) + endPosition
end
local function GetTrackCFrame(trackPosition)
local position = startPosition + trackPosition
if trackPosition ~= trackLength then -- trackLength can be used
position = position % trackLength
end
return cframeTrack:GetCFramePosition(position)
end
local currentPosition = startOffset
local index = 1
local function BuildSegment(startTrackPosition, endTrackPosition)
local startCFrame = GetTrackCFrame(startTrackPosition)
local endCFrame = GetTrackCFrame(endTrackPosition)
local midTrackPosition = (startTrackPosition + endTrackPosition) / 2
buildSegment(
startCFrame,
endCFrame,
index,
midTrackPosition,
totalLength
)
index = index + 1
end
while currentPosition < totalLength do
local endTrackPosition = currentPosition + segmentLength
if endTrackPosition > totalLength then
break
end
BuildSegment(currentPosition, endTrackPosition)
currentPosition = endTrackPosition + segmentOffset
end
-- build last (to end)
if currentPosition < totalLength then
BuildSegment(currentPosition, totalLength)
end
-- build end
if buildEnd == true then
BuildSegment(totalLength, totalLength + segmentLength)
end
end
|
object_tangible_event_perk_halloween_bat_pheromone = object_tangible_event_perk_shared_halloween_bat_pheromone:new {
}
ObjectTemplates:addTemplate(object_tangible_event_perk_halloween_bat_pheromone, "object/tangible/event_perk/halloween_bat_pheromone.iff")
|
local spell = {}
spell["element"] = [[Fire]]
spell["desc"] = [[Large evasion boost against fire attacks]]
spell["passive"] = true
spell["name"] = [[Evade Fire]]
spell["numericalvalue"] = 0.25
function spell.activate()
state.context.cost(spell.costtype, spell.cost)
state.context.passive(spell, state.battle.participants[state.battle.target], state.battle.participants[state.battle.open], 99, "dodgestatus")
end
function spell.process(uspell, basehitchance, istarget)
if not spell.element==uspell.element or not istarget then return 0 end
if istarget then
--if effect is on spell target, hitchance goes down
return -(basehitchance * spell.numericalvalue)
end
--if effect is on spell caster, hitchance is not affected
return 0
end
return spell
|
local region = require "chestnut.mahjongroom.region"
local hutype = require "chestnut.mahjongroom.hutype"
local jiaotype = require "chestnut.mahjongroom.jiaotype"
local m = {}
m[hutype.PINGHU] = 1
m[hutype.DUIDUIHU] = 2
m[hutype.QINGYISE] = 4
m[hutype.DAIYAOJIU] = 4
m[hutype.QIDUI] = 4
m[hutype.JINGOUDIAO] = 4
m[hutype.QINGDUIDUI] = 8
m[hutype.LONGQIDUI] = 16
m[hutype.QINGQIDUI] = 16
m[hutype.QINGYAOJIU] = 16
m[hutype.JIANGJINGOUDIAO] = 16
m[hutype.QINGJINGOUDIAO] = 16
m[hutype.TIANHU] = 32
m[hutype.DIHU] = 32
m[hutype.QINGLONGQIDUI] = 32
m[hutype.SHIBALUOHAN] = 64
m[hutype.QINGSHIBALUOHAN] = 256
return m
|
local HideNSeek
local function command_handler(name, param)
local maps = HideNSeek.db.get_all_maps()
local map_list = {}
for k in pairs(maps) do
table.insert(map_list, k)
end
table.sort(map_list)
return true, table.concat(map_list, " ")
end
local function init(mod_namespace)
HideNSeek = mod_namespace
minetest.register_chatcommand("hs_maps", {
privs = { hs_admin = true },
func = command_handler
})
end
return {
init = init
}
|
--This file is responsible about the editors shown after pressing escape--
local edit = {}
--=Contributing Guide=--
--[[
Creating an editor:
1. Create a new file at Editors folder
2. Make a new table at the top of the file and add it as an return value in the file ex: local ce = {}; return ce
3. Edit self.editors in edit:initialize and change the name of a slot to the name of .lua file of your editor (without adding the .lua)
4. Edit self.saveid in edit:initialize and change the value of a slot to a save id for your editor, leave -1 if it doesn't save.
* The editor api is passed as an argument to the editor file, to access it add this to the top of your file:
local eapi = select(1,...)
* The only usefull function in the editor api is eapi:drawUI()
which clears the whole screen and draws the top and bottom bars of every editor
Besure to call this at editor:entered()
* editor:entered() is called when the user switches to your editor
The first argument passed tk this callback is the previos editor table, be warned it could be a nil when yur editor is the first to be chosed !
The rest arguments are the return values of oldeditor:leaved()
Be sure to call eapi:drawUI() here to clear the screen
* editor:leaved() is called when the user is switching to an other editor than your
The first argument is the table of the new editor
You can return values that are passed to editor:entered() [see above]
* editor:export() is called when the editors are saving the data to a disk, you must
pass a string of the editor data that may be loaded later at editor:import see down V
* editor:import(data) is called when the editors are loading from a disk, you will be passed the data string the editor passed in editor:export
it won't be called if there is no data to load.
* You don't have to do the while loop in your editor (see written editors)
The editor api automatically handles the pullEvent() for you
When an event happens editor:"event name" is called with the arguments of the event, ex:
function editor:mousepressed(x,y, button, is touch) end
function editor:update(dt) end
* editor.keymap = {} here you can assign you key binds:
editor.keymap["backspace"] = function(self,isrepeat) end
The key name can be any love2d key constant or and scancode
You can combine it with ctrl, alt or shift, ex: editor.keymap["ctrl-c"]
* Note when reading existing editors:
The may use some api functions defined at DiskOS/api.lua
Good luck !
==Contributers to this file==
(Add your name when contributing to this file)
- Rami Sabbagh (RamiLego4Game)
]]
local swidth, sheight = screenSize()
--WIP new editors system
function edit:initialize()
self.flavor = 9 --Orange
self.flavorBack = 4 --Brown
self.background = 5 --Dark Grey
self.editorsheet = SpriteSheet(image(fs.read("C:/editorsheet.lk12")),24,16)
self.active = 4 --Active editor3
self.editors = {"music","sfx","tile","sprite","code","soon"; music=1,sfx=2,tile=3,sprite=4,code=5,config=6}
self.saveid = {-1,-1,"tilemap","spritesheet","luacode",-1}
self.chunks = {} --Editors Code Chunks
self.leditors = {} --Loaded editors (Executed chunks)
self.icons = imagedata(6*8,2*8)
self.icons:paste(self.editorsheet.img:data(),0,0, (24-#self.editors)*8,0, #self.editors*8,8)
self.icons:paste(self.editorsheet.img:data(),0,8, (24-#self.editors)*8,0, #self.editors*8,8)
fs.write("C:/editoricons_test.lk12",self.icons:encode())
self.icons:map(function(x,y,c)
if y < 8 then if c == 0 then return self.flavor else return self.flavorBack end; else
if c == 0 then return self.flavorBack else return self.flavor end; end
end)
fs.write("C:/editoricons.lk12",self.icons:encode())
self.icons = self.icons:image()
self.iconsBGQuad = self.icons:quad(0,0,self.icons:width(),8)
self.iconsQuads = {}
for i=1,#self.editors do
table.insert(self.iconsQuads,self.icons:quad(self.icons:width()-i*8,8, 8,8))
end
local editors = {"soon","soon","tile","sprite","code","soon"} --List of built-in editors to create chunks of
for k, v in ipairs(editors) do --Load chunks
local chunk, err = fs.load("C:/Editors/"..v..".lua")
if not chunk then error(err or "Error loading: "..tostring(v)) end
table.insert(self.chunks,k,chunk)
end
for k,v in ipairs(self.chunks) do --Execute the chunks
table.insert(self.leditors,k,v(self))
end
self.modeGrid = {swidth-(#self.editors*8),0,#self.editors*8,8,#self.editors,1} --The editor selection grid
self.modeGridFlag = false
self.modeGridHover = false
self:loadCursors()
end
function edit:addEditor(code, name, saveid, icon)
--Verification
if type(code) ~= "string" and type(code) ~= "function" then return error("The editor code must be a string or a chunk, provided: "..type(code)) end
if type(name) ~= "string" then return error("Editor name must be a string, provided: "..type(name)) end
if type(saveid) ~= "number" and type(saveid) ~= "string" then return error("The saveid must be -1 or a string, provided: "..type(saveid)) end
if type(saveid) == "number" and saveid ~= -1 then return error("The saveid can be -1 or a string, provided: "..saveid) end
if type(icon) ~= "table" then return error("Icon must be provided, got "..type(icon).." instead") end
if not (icon.typeOf and icon.type) then return error("Invalid Icon") end
if icon:type() == "GPU.image" then icon = icon:data() end
if icon:type() ~= "GPU.imageData" then return error("Icon must be a GPU image or imagedata !, provided: "..icon:type()) end
--Chunk creation
local chunk, err = code, "Unknown Error"
if type(code) == "string" then
chunk = false
chunk, err = loadstring(code)
end
if not chunk then return error("Failed to load the chunk: "..tostring(err)) end
--Execute the chunk
local ok, editor = pcall(chunk,self)
if not ok then return error("Failed to execute the chunk: "..tostring(editor)) end
--Proccess the icon
local bgicon = imagedata(8,8):paste(icon)
local fgicon = imagedata(8,8):paste(icon)
bgicon:map(function(x,y,c) if c == 0 then return self.flavor else return self.flavorBack end end)
fgicon:map(function(x,y,c) if c == 0 then return self.flavorBack else return self.flavor end end)
local newicons = imagedata(self.icons:width()+8,16)
newicons:paste(self.icons:data(),8,0)
newicons:paste(bgicon,0,0):paste(fgicon,0,8)
self.icons = newicons:image()
self.iconsBGQuad = self.icons:quad(0,0,self.icons:width(),8)
for k,quad in ipairs(self.iconsQuads) do
local oldx,oldy = quad:getViewport()
self.iconsQuads[k] = self.icons:quad(oldx+8,oldy,8,8)
end
table.insert(self.iconsQuads,self.icons:quad(0,8,8,8))
--Register the editor
table.insert(self.editors,name)
self.editors[name] = #self.editors
table.insert(self.saveid,saveid)
table.insert(self.chunks,chunk)
table.insert(self.leditors,editor)
--Update the mode grid
self.modeGrid = {swidth-(#self.editors*8),0,#self.editors*8,8,#self.editors,1}
end
function edit:clearData()
--Will restart the editors simply
self.leditors = {}
for k,v in ipairs(self.chunks) do
table.insert(self.leditors,k,v(self))
end
end
function edit:loadCursors()
pushPalette()
palt()
cursor(self.editorsheet:extract(1),"normal",1,1)
cursor(self.editorsheet:extract(2),"handrelease",2,1)
cursor(self.editorsheet:extract(3),"handpress",2,1)
cursor(self.editorsheet:extract(4),"hand",4,4)
cursor(self.editorsheet:extract(5),"cross",3,3)
cursor(self.editorsheet:extract(7),"point",1,1)
cursor(self.editorsheet:extract(8),"draw",3,3)
cursor(self.editorsheet:extract(32),"normal_white",1,1)
cursor(self.editorsheet:extract(149),"pencil",0,7)
cursor(self.editorsheet:extract(150),"bucket",0,7)
cursor(self.editorsheet:extract(151),"eraser",0,7)
cursor(self.editorsheet:extract(152),"picker",0,7)
popPalette()
end
function edit:drawBottomBar()
rect(0,sheight-8,swidth,8,false,self.flavor)
end
function edit:drawTopBar()
rect(0,0,swidth,8,false,self.flavor)
SpriteGroup(55, 0,0, 4,1, 1,1, false, self.editorsheet) --The LIKO12 Logo
self.icons:draw((swidth-#self.editors*8),0, 0, 1,1, self.iconsBGQuad)
self.icons:draw(swidth-self.active*8,0, 0, 1,1, self.iconsQuads[self.active])
end
function edit:drawUI()
clear(self.background) --Clear the screen
self:drawTopBar() --Draw the top bar
self:drawBottomBar() --Draw the bottom bar
end
function edit:switchEditor(neweditor)
if neweditor ~= self.active and self.leditors[neweditor] then
local oldeditor = self.active; self.active = neweditor
if self.leditors[neweditor].entered then
if self.leditors[oldeditor].leaved then
self.leditors[neweditor]:entered(self.leditors[oldeditor],self.leditors[oldeditor]:leaved(self.leditors[neweditor]))
else
self.leditors[neweditor]:entered(self.leditors[oldeditor])
end
else
if self.leditors[oldeditor].leaved then
self.leditors[oldeditor]:leaved(self.leditors[neweditor])
end
end
end
end
function edit:import(data) --Import editors data
data = data:gsub("\r\n","\n")
local savePos = {}
for k = #self.saveid, 1, -1 do
local v = self.saveid[k]
if v ~= -1 and self.leditors[k].import then
local dstart, dend = string.find(data,"___"..tostring(v).."___")
if dstart then
dstart = dend+2
local dend, nextstart = string.find(data,"___",dstart)
if dend then
dend = dend-2
else
dend = -2 --The end of the file ignoring the last new line
end
local save = string.sub(data,dstart,dend)
self.leditors[k]:import(save)
end
end
end
end
function edit:export() --Export editors data
local save = ""
for k = #self.saveid, 1, -1 do
local v = self.saveid[k]
if v ~= -1 and self.leditors[k].export then
local data = self.leditors[k]:export()
if type(data) ~= "nil" then
save = save.."___"..tostring(v).."___\n"..data:gsub("___","").."\n"
end
end
end
return save
end
function edit:loop() --Starts the while loop
cursor("normal")
if edit.leditors[edit.active]["entered"] then edit.leditors[edit.active]:entered() end
while true do
local event, a, b, c, d, e, f = pullEvent()
if event == "keypressed" then
if a == "escape" then --Quit the loop and return to the terminal
if edit.leditors[edit.active]["leaved"] then edit.leditors[edit.active]:leaved() end
break
else
local key, sc = a, b
if(isKDown("lalt", "ralt")) then
key = "alt-" .. key
sc = "alt-" .. sc
end
if(isKDown("lctrl", "rctrl")) then
key = "ctrl-" .. key
sc = "ctrl-" .. sc
end
if(isKDown("lshift", "rshift")) then
key = "shift-" .. key
sc = "shift-" .. sc
end
local term = require("terminal")
pushMatrix() pushPalette() pushColor()
if key == "ctrl-s" then
local oldprint = print
print = function() end
term.execute("save")
print = oldprint
elseif key == "ctrl-l" then
local oldprint = print
print = function() end
term.execute("load")
print = oldprint
elseif key == "ctrl-r" then
local sbk = screenshot()
local px,py,pc = printCursor()
cam()
term.execute("run")
cam()
printCursor(px,py,pc)
sbk:image():draw(0,0)
end
popMatrix() popPalette() popColor()
if key == "alt-left" then
if self.active == #self.editors then
self:switchEditor(1)
else
self:switchEditor(self.active+1)
end
elseif key == "alt-right" then
if self.active == 1 then
self:switchEditor(#self.editors)
else
self:switchEditor(self.active-1)
end
end
if self.leditors[self.active].keymap then
local usedKey
if self.leditors[self.active].keymap[key] then usedKey = key
elseif self.leditors[self.active].keymap["sc_"..sc] then usedKey = "sc_"..sc
end
if usedKey then
self.leditors[self.active].keymap[usedKey](self.leditors[self.active], c)
self.leditors[self.active].lastKey = usedKey
end
end
if self.leditors[self.active][event] then self.leditors[self.active][event](self.leditors[self.active],a,b,c,d,e,f) end
end
elseif event == "mousepressed" then
local cx, cy = whereInGrid(a,b, self.modeGrid)
if cx then
self.modeGridFlag = true
cursor("handpress")
self:switchEditor(#self.editors-cx+1)
else
if self.leditors[self.active][event] then self.leditors[self.active][event](self.leditors[self.active],a,b,c,d,e,f) end
end
elseif event == "mousemoved" then
local cx, cy = whereInGrid(a,b, self.modeGrid)
if cx then
if self.modeGridFlag then
self:switchEditor(#self.editors-cx+1)
else
self.modeGridHover = true
cursor("handrelease")
end
elseif not self.modeGridFlag then
if self.modeGridHover then
cursor("normal")
self.modeGridHover = false
end
if self.leditors[self.active][event] then self.leditors[self.active][event](self.leditors[self.active],a,b,c,d,e,f) end
else
cursor("handpress")
end
elseif event == "mousereleased" then
local cx, cy = whereInGrid(a,b, self.modeGrid)
if cx then
if self.modeGridFlag then
self.modeGridHover = true
self.modeGridFlag = false
cursor("handrelease")
self:switchEditor(#self.editors-cx+1)
end
else
if self.modeGridFlag then
self.modeGridHover = true
self.modeGridFlag = false
cursor("normal")
end
if self.leditors[self.active][event] then self.leditors[self.active][event](self.leditors[self.active],a,b,c,d,e,f) end
end
else
if self.leditors[self.active][event] then self.leditors[self.active][event](self.leditors[self.active],a,b,c,d,e,f) end
end
end
end
edit:initialize()
return edit
|
--- Table Helpers
--- =============
--- # Printing Tables
function table.val_to_str ( v )
if "string" == type( v ) then
v = string.gsub( v, "\n", "\\n" )
if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then
return "'" .. v .. "'"
end
return '"' .. string.gsub(v,'"', '\\"' ) .. '"'
else
return "table" == type( v ) and table.tostring( v ) or tostring( v )
end
end
function table.key_to_str ( k )
if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then
return k
else
return "[" .. table.val_to_str( k ) .. "]"
end
end
function table.tostring( tbl )
local result, done = {}, {}
for k, v in ipairs( tbl ) do
table.insert( result, table.val_to_str( v ) )
done[ k ] = true
end
for k, v in pairs( tbl ) do
if not done[ k ] then
table.insert( result,
table.key_to_str( k ) .. "=" .. table.val_to_str( v ) )
end
end
return "{" .. table.concat( result, "," ) .. "}"
end
--- # Comparing Tables
function deepcompare(t1,t2,ignore_mt)
local ty1 = type(t1)
local ty2 = type(t2)
if ty1 ~= ty2 then return false end
-- non-table types can be directly compared
if ty1 ~= 'table' and ty2 ~= 'table' then return t1 == t2 end
-- as well as tables which have the metamethod __eq
local mt = getmetatable(t1)
if not ignore_mt and mt and mt.__eq then return t1 == t2 end
for k1,v1 in pairs(t1) do
local v2 = t2[k1]
if v2 == nil or not deepcompare(v1,v2) then return false end
end
for k2,v2 in pairs(t2) do
local v1 = t1[k2]
if v1 == nil or not deepcompare(v1,v2) then return false end
end
return true
end
--- # Table element containment
function table.contains(tab, elem)
for _,i in pairs(tab) do
if deepcompare(i, elem) then
return true
end
end
return false
end
--- String Matching
--- ===============
function matches_token(input, token)
return string.match(input, '^' .. token, 1)
end
|
function Theadron_OnCombat(Unit, Event)
Unit:SendChatMessage(14, 0, "You shall burn in the fires of hell!!!")
Unit:RegisterEvent("Theadron_pyroblast", 35000, 100)
Unit:RegisterEvent("Theadron_blast_wave", 25000, 100)
Unit:RegisterEvent("Theadron_scorch", 14000, 100)
end
function Theadron_pyroblast(pUnit, Event)
pUnit:FullCastSpellOnTarget(33938, pUnit:GetRandomPlayer(0))
end
function Theadron_blast_wave(pUnit, Event)
pUnit:FullCastSpellOnTarget(33933, pUnit:GetRandomPlayer(0))
end
function Theadron_scorch(pUnit, Event)
pUnit:FullCastSpellOnTarget(27074, pUnit:GetRandomPlayer(0))
end
RegisterUnitEvent(200001, 1, "Theadron_OnCombat")
|
-- initialization with lua
home_dir = vim.loop.os_homedir()
-- This 'project_name' should be different from the program default 'nvim'
-- This allows this configuration to co-exist with others.
local config_lua_name = vim.loop.fs_realpath(
debug.getinfo(1, 'S').source:match("^@?(.*)$") -- nvim -u ./some/path/config.lua
)
local config_lua_dir = config_lua_name:match("^(.*)/[^/]*$")
local config_lua_parent = config_lua_dir:match("^.*/([^/]+)$")
if config_lua_parent == nil then
-- This shouldn't be the case but just in case
config_lua_parent = "nvme"
end
local project_name = vim.fn.exists(vim.env.PROJECT_NAME) and vim.env.PROJECT_NAME or config_lua_parent
-- Set up project specific directory names as global
xdg_config_home = vim.fn.exists(vim.env.XDG_CONFIG_HOME) and vim.env.XDG_CONFIG_HOME or home_dir .. '/.config'
xdg_data_home = vim.fn.exists(vim.env.XDG_DATA_HOME) and vim.env.XDG_DATA_HOME or home_dir .. '/.local/share'
project_config = xdg_config_home .. '/' .. project_name
project_data = xdg_data_home .. '/' .. project_name
-- print("I: HOME = " .. home_dir )
-- print("I: PROJECT NAME = " .. project_name )
-- print("I: XDG_CONFIG_HOME = " .. xdg_config_home )
-- print("I: XDG_DATA_HOME = " .. xdg_data_home )
-- print("I: PROJECT_NAME = " .. project_name )
-- print("I: PROJECT_CONFIG = " .. project_config )
-- print("I: PROJECT_DATA = " .. project_data )
local opt = vim.opt
opt.rtp:remove(xdg_data_home .. "/nvim/site")
opt.rtp:remove(xdg_data_home .. "/nvim/site/after")
opt.rtp:prepend(project_data .. "/site")
opt.rtp:append(project_data .. "/site/after")
opt.rtp:remove(xdg_config_home .. "/nvim")
opt.rtp:remove(xdg_config_home .. "/nvim/after")
opt.rtp:prepend(project_config)
opt.rtp:append(project_config .. "/after")
vim.cmd [[let &packpath = &runtimepath]]
require'packages'
require'settings'
require'mappings'
-- vim: set sw=2 sts=2 et ft=lua :
|
local actions = require('telescope.actions')
local finders = require('telescope.finders')
local previewers = require('telescope.previewers')
local pickers = require('telescope.pickers')
local sorters = require('telescope.sorters')
local utils = require('telescope.utils')
local Job = require('plenary.job')
-- local live_grepper = finders.new {
-- fn_command = function(_, prompt)
-- -- TODO: Make it so that we can start searching on the first character.
-- if not prompt or prompt == "" then
-- return nil
-- end
-- return {
-- command = 'rg',
-- args = {"--vimgrep", prompt},
-- }
-- end
-- }
local f = function(prompt, process_result, process_complete)
local fzf = Job:new {
command = 'fzf';
writer = Job:new {
command = "fdfind",
args = nil,
cwd = "/home/tj/build/neovim",
enable_handlers = false,
},
-- Still doesn't work if you don't pass these args and just run `fzf`
args = {'--no-sort', '--filter', prompt};
}
local start = vim.fn.reltime()
print(vim.inspect(fzf:sync()), vim.fn.reltimestr(vim.fn.reltime(start)))
end
-- Process all the files
-- f("", nil, nil)
-- Filter on nvimexec
f("nvim/executor", nil, nil)
-- pickers.new({}, {
-- prompt = 'Live Grep',
-- finder = f,
-- previewer = previewers.vimgrep,
-- }):find()
|
local utils = require('utils')
local cmd = vim.cmd
utils.opt('o', 'termguicolors', true)
vim.g.tokyonight_style = 'night'
cmd 'colorscheme tokyonight'
|
EditorAwardAchievment = EditorAwardAchievment or class(MissionScriptEditor)
function EditorAwardAchievment:create_element()
self.super.create_element(self)
self._element.class = "ElementAwardAchievment"
self._element.values.achievment = nil
self._element.values.award_instigator = false
self._element.values.players_from_start = nil
end
function EditorAwardAchievment:_build_panel()
self:_create_panel()
self:ComboCtrl("achievment", table.list_add({"none"}, table.map_keys(managers.achievment.achievments)))
self:BooleanCtrl("award_instigator", {help = "Award only the instigator (Player or driver in vehicle)?"})
self:BooleanCtrl("players_from_start", {help = "Only award to players that joined from start."})
self:Text("Awards a Steam Achievment")
end
|
-- This script is created by MegaDreams for [FUN] *FreakZer ft. MegaDreams - The Big Bang Theory II, Don't even think about stealing it.
local shootingAllowed = true
function playerSpawn()
shootingAllowed = true
end
addEventHandler("onClientPlayerSpawn", getLocalPlayer(), playerSpawn)
function doShoot()
if shootingAllowed == true then
if not isPlayerDead(getLocalPlayer()) then
shootingAllowed = false
local theVehicle = getPedOccupiedVehicle(getLocalPlayer())
local x,y,z = getElementPosition(theVehicle)
local rX,rY,rZ = getVehicleRotation(theVehicle)
local x = x+4*math.cos(math.rad(rZ+90))
local y = y+4*math.sin(math.rad(rZ+90))
createProjectile(theVehicle, 19, x, y, z, 1.0, nil)
setTimer(allowShooting, 3000, 1)
end
end
end
function allowShooting()
shootingAllowed = true
end
for keyName, state in pairs(getBoundKeys("fire")) do
bindKey(keyName, "down", doShoot)
end
|
RegisterClientScript()
ENTITY.IsNetworked = true
ENTITY.CollisionType = 2
ENTITY.PlayerControlled = false
ENTITY.MaxHealth = 0
ENTITY.Properties = {
{ Name = "duration", Type = PropertyType.Float, Shared = true },
{ Name = "retracting", Type = PropertyType.Boolean, Default = false, Shared = true },
{ Name = "source_entity", Type = PropertyType.Entity, Shared = true },
{ Name = "source_offset", Type = PropertyType.FloatPosition, Shared = true },
{ Name = "target_entity", Type = PropertyType.Entity, Shared = true },
{ Name = "target_offset", Type = PropertyType.FloatPosition, Shared = true },
}
function ENTITY:Initialize()
self.SourceEntity = self:GetProperty("source_entity")
self.SourceOffset = self:GetProperty("source_offset")
self.TargetEntity = self:GetProperty("target_entity")
self.TargetOffset = self:GetProperty("target_offset")
self.isRetracting = false
self.startTime = match.GetSeconds()
if (self.SourceEntity == NoEntity) then
self:Remove()
return
end
if (self.TargetEntity ~= NoEntity) then
self.endPos = self.TargetEntity:ToGlobalPosition(self.TargetOffset)
else
self.endPos = self.TargetOffset
end
if (self:GetProperty("retracting")) then
self.startTime = self.startTime - self:GetProperty("duration")
self:Retract()
end
self:UpdatePositions()
if (CLIENT) then
self.sprite = self:AddSprite({
Color = { r = 255, g = 255, b = 0, a = 220 },
RenderOrder = -5,
Size = Vec2(0, 0)
})
self:UpdateSprite()
end
end
function ENTITY:UpdatePositions()
if (self.SourceEntity:IsValid()) then
self.startPos = self.SourceEntity:ToGlobalPosition(self.SourceOffset)
else
self:Remove()
return
end
if (not self.isRetracting and self.TargetEntity ~= NoEntity) then
if (self.TargetEntity:IsValid()) then
self.endPos = self.TargetEntity:ToGlobalPosition(self.TargetOffset)
else
self:Retract()
end
end
end
function ENTITY:Retract()
assert(not self.isRetracting)
if (SERVER) then
self:Remove()
else
local elapsedTime = match.GetSeconds() - self.startTime
if (elapsedTime > 0) then
self.retractTime = math.min(elapsedTime, self:GetProperty("duration"))
self.isRetracting = true
self.startTime = match.GetSeconds()
else
self:Remove()
end
end
end
if (SERVER) then
function ENTITY:OnTick()
if (self.isRetracting) then
local elapsedTime = match.GetSeconds() - self.startTime
if (elapsedTime > self.retractTime) then
self:Remove()
return
end
end
end
else
function ENTITY:OnKilled()
--TODO: Use RPC to prevent creating a second entity
if (not self:GetProperty("retracting")) then
local elapsedTime = match.GetSeconds() - self.startTime
match.CreateEntity({
Type = self.FullName,
LayerIndex = self:GetLayerIndex(),
Properties = {
duration = math.min(elapsedTime, self:GetProperty("duration")),
retracting = true,
source_entity = self.SourceEntity,
source_offset = self.SourceOffset,
target_entity = self.TargetEntity,
target_offset = self.TargetOffset
}
})
end
end
function ENTITY:UpdateSprite()
local direction, length = (self.endPos - self.startPos):GetNormalized()
local rotation = math.atan(direction.y, direction.x) * 180 / math.pi
local elapsedTime = match.GetSeconds() - self.startTime
if (self.isRetracting) then
length = length * (1 - elapsedTime / self.retractTime)
if (length < 0) then
self:Remove()
return
end
else
length = math.min(length, length * elapsedTime / self:GetProperty("duration"))
end
self:SetPosition(self.startPos)
self.sprite:SetRotation(rotation)
self.sprite:SetSize(Vec2(length, 4))
end
function ENTITY:OnFrame()
self:UpdatePositions()
self:UpdateSprite()
end
end
|
--------------------------------
-- @module TextureCache
-- @extend Ref
--------------------------------
-- @function [parent=#TextureCache] reloadTexture
-- @param self
-- @param #string str
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#TextureCache] removeTextureForKey
-- @param self
-- @param #string str
--------------------------------
-- @function [parent=#TextureCache] removeAllTextures
-- @param self
--------------------------------
-- @function [parent=#TextureCache] getDescription
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
-- @function [parent=#TextureCache] getCachedTextureInfo
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
-- overload function: addImage(cc.Image, string)
--
-- overload function: addImage(string)
--
-- @function [parent=#TextureCache] addImage
-- @param self
-- @param #cc.Image image
-- @param #string str
-- @return Texture2D#Texture2D ret (retunr value: cc.Texture2D)
--------------------------------
-- @function [parent=#TextureCache] getTextureForKey
-- @param self
-- @param #string str
-- @return Texture2D#Texture2D ret (return value: cc.Texture2D)
--------------------------------
-- @function [parent=#TextureCache] removeUnusedTextures
-- @param self
--------------------------------
-- @function [parent=#TextureCache] removeTexture
-- @param self
-- @param #cc.Texture2D texture2d
--------------------------------
-- @function [parent=#TextureCache] waitForQuit
-- @param self
--------------------------------
-- @function [parent=#TextureCache] TextureCache
-- @param self
return nil
|
-- Draw dungeons as ASCII, optionally using term colors.
local isatty = require("platform").isatty
local concat, format = table.concat, string.format
-- Select Graphic Rendition
local function SGR_color(a, s) return format("\27[%sm%s\27[0m", a, s) end
local function SGR_plain(_, s) return s end
-- Upvalues used for buffering lines. This is a bit faster than writing individual characters.
local _buf, _n = {}
--- Renders a grid into a file with the given options.
-- @arg grid The grid that is being drawn.
-- @arg palette A thunk that maps grid elements to characters. Receives: (v, x, y, SGR, ctx)
-- @arg ctx A context for the palette function. Can be any Lua value.
-- @arg out The output file stream. Default: stdout.
-- @arg color A flag to force color output. Default: true if out is a tty, false otherwise.
local function render_draw(grid, palette, ctx, out, use_color)
out = out or io.stdout
local SGR = SGR_plain
if use_color == nil then
use_color = isatty(out)
end
if use_color then
SGR = SGR_color
out:write("\27[2J\27[1;1H")
end
for y=0, grid.h-1 do
_n = 1
for x=0, grid.w-1 do
_buf[_n], _n = palette(grid:get(x, y), x, y, SGR, ctx), _n+1
end
_buf[_n] = "\n"
out:write(concat(_buf, "", 1, _n))
end
end
return {
draw = render_draw,
}
|
local ttf = require "SDL.ttf"
local Object = require "object"
local Widget = require "ui.widget"
local _M = {}
---
-- @todo Text color.
-- @todo Text alignments (vertical AND horizontal).
--
function _M:new(arg)
Widget.new(self, arg)
self.label = arg.label
self.onClick = arg.onClick
if arg.label then
self:setLabel(arg.label)
end
end
function _M:setLabel(text)
self.labelText = text
self.labelUpdate = true
end
function _M:update()
Widget.update(self)
if self.labelUpdate then
self.label =
self.root.fonts[1]:renderUtf8(self.labelText, "solid", 0xFFFFFF)
self.labelTexture =
self.root.renderer:createTextureFromSurface(self.label)
self.labelUpdate = nil
end
end
function _M:draw(renderer)
local rectangle = {
w = self.realWidth or 0,
h = self.realHeight or 0,
x = self.x or 0,
y = self.y or 0
}
--renderer:setDrawColor(0x000000)
--renderer:drawRect(rectangle)
renderer:setDrawColor(0x44AACC)
renderer:fillRect {
w = self.realWidth - 2,
h = self.realHeight - 2,
x = self.x + 1,
y = self.y + 1
}
if self.label then
local _, _, width, height = self.labelTexture:query()
renderer:copy(self.labelTexture, nil, {
x = self.x + (self.realWidth - width ) / 2,
y = self.y + (self.realHeight - height) / 2,
w = width, h = height
})
end
self:drawChildren(renderer)
end
return Object(_M, Widget)
|
function vc(A)
local asize=A:size()
local v=(A:t()):reshape(1,asize[1]*asize[2]):t()
return v
end
|
AddCSLuaFile()
AddCSLuaFile("sh_sounds.lua")
include("sh_sounds.lua")
if CLIENT then
SWEP.DrawCrosshair = false
SWEP.PrintName = "Glock 18"
SWEP.CSMuzzleFlashes = true
SWEP.SelectIcon = surface.GetTextureID("weaponicons/glock.vmt")
killicon.Add("cw_g18", "weaponicons/glock", Color(255, 80, 0, 150))
SWEP.MuzzleEffect = "muzzleflash_6"
SWEP.PosBasedMuz = true
SWEP.NoShells = false
SWEP.Shell = "smallshell"
SWEP.ShellOffsetMul = 1
SWEP.ShellScale = 0.5
SWEP.ShellPosOffset = Vector(2,1,0) //Vector(2,1,-1)
SWEP.IronsightPos = Vector(2.196, 3, 1.771)
SWEP.IronsightAng = Vector(0, 0, 0)
SWEP.MicroT1Pos = Vector(2.2, -1.81, 1.019)
SWEP.MicroT1Ang = Vector(0, 0, 0)
SWEP.KobraPos = Vector(2.177, -8.7, 1.111)
SWEP.KobraAng = Vector(0, 0, 0)
SWEP.SprintPos = Vector(-2.316, -5.095, -6.424)
SWEP.SprintAng = Vector(49.231, -0.584, -1.984)
//SWEP.CustomizePos = Vector(-9.74, -7.587, -1.78)
//SWEP.CustomizeAng = Vector(35.25, -54.682, -21.025)
SWEP.CustomizePos = Vector(-9.662, -7.15, 0.565)
SWEP.CustomizeAng = Vector(25.156, -66.075, -16.382)
SWEP.AlternativePos = Vector(0.763, 1.863, 0.791)
SWEP.AlternativeAng = Vector(0.076, 0, 0)
SWEP.ViewModelMovementScale = 0.2
SWEP.FullAimViewmodelRecoil = true
SWEP.BoltBone = "slide"
SWEP.BoltShootOffset = Vector(-1.61, 0, 0)
SWEP.HoldBoltWhileEmpty = true
SWEP.DontHoldWhenReloading = true
SWEP.HUD_MagText = "MAGAZINE: "
SWEP.LuaVMRecoilAxisMod = {vert = 0, hor = 0, roll = 0, forward = 0, pitch = 0}
SWEP.CustomizationMenuScale = 0.007
SWEP.DisableSprintViewSimulation = true
SWEP.AttachmentModelsVM = {
--["md_rmr"] = {model = "models/cw2/attachments/microt1.mdl", bone = "slide", pos = Vector(4.161, -3.151, 11.076), angle = Angle(0, 0, 90), size = Vector(0.4, 0.4, 0.4)},
["md_tundra9mm"] = {model = "models/cw2/attachments/9mmsuppressor.mdl", bone = "frame", pos = Vector(4.185, -4.182, 18.478), angle = Angle(0, 0, 90), size = Vector(0.5, 0.5, 0.5)}
}
SWEP.LaserPosAdjust = Vector(0.5, 0, 0)
SWEP.LaserAngAdjust = Angle(0, 180, 0)
end
SWEP.ViewModelBoneMods = {
["bullet"] = { scale = Vector(1, 1, 1), pos = Vector(-1.155, 0, 1.149), angle = Angle(0, 0, 0) },
["mag"] = { scale = Vector(1, 0.744, 1), pos = Vector(0.657, 0, -0.295), angle = Angle(0, 0, 0) },
["slide release"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0.074), angle = Angle(0, 0, 0) }
}
SWEP.LuaViewmodelRecoil = false
SWEP.CanRestOnObjects = true
SWEP.Attachments = {
[1] = {header = "Sight", offset = {600, -500}, atts = {"md_microt1", "md_eotech", "md_rmr"}},
[3] = {header = "Barrel Extension", offset = {-400, 150}, atts = {"md_tundra9mm"}},
["+reload"] = {header = "Ammo", offset = {1200, 200}, atts = {"am_hollowpoint", "am_armorpiercing"}}
}
SWEP.Animations = {fire = {"mac10_fire", "mac10_fire2","mac10_fire3"},
reload = "mac10_reload",
idle = "mac10_idle",
draw = "mac10_draw"}
SWEP.Sounds = {
mac10_reload = {
[1] = {time = 0.3, sound = "CW_G18_MAGOUT"},
[2] = {time = 1.6, sound = "CW_G18_MAGIN"},
[3] = {time = 2.4, sound = "CW_G18_BOLTRELEASE"}
},
mac10_draw = {
[1] = {time = 0.1, sound = "CW_G18_BOLTRELEASE"}
}
}
SWEP.SpeedDec = 5
SWEP.Slot = 2
SWEP.SlotPos = 0
SWEP.NormalHoldType = "pistol"
SWEP.RunHoldType = "normal"
SWEP.AddSafeMode = false
SWEP.FireModes = {"auto","semi"}
SWEP.Base = "cw_base"
SWEP.Category = "STALKER Weapons"
SWEP.Author = ""
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.Instructions = ""
SWEP.ViewModelFOV = 80
SWEP.ViewModelFlip = true
SWEP.ViewModel = "models/cw2_g18/v_dmg_glock.mdl"
SWEP.WorldModel = "models/cw2_g18/w_dmg_glock.mdl"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Primary.ClipSize = 17
SWEP.Primary.DefaultClip = 17
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "9x19MM"
SWEP.FireDelay = 60/1100
SWEP.FireSound = "CW_G18_FIRE"
SWEP.FireSoundSuppressed = "CW_G18_FIRE_SUPPRESSED"
SWEP.Recoil = 1.7
SWEP.RecoilToSpread = 0.5
SWEP.HipSpread = 0.125
SWEP.AimSpread = 0.025
SWEP.VelocitySensitivity = 1.5
SWEP.MaxSpreadInc = 0.08
SWEP.SpreadPerShot = 0.008
SWEP.SpreadCooldown = 0.13
SWEP.Shots = 1
SWEP.Damage = 32
SWEP.DeployTime = 0.1
SWEP.Chamberable = true
SWEP.ReloadSpeed = 1.35
SWEP.ReloadTime = 2.19
SWEP.ReloadHalt = 2.19
SWEP.ReloadTime_Empty = 3
SWEP.ReloadHalt_Empty = 3
SWEP.SnapToIdlePostReload = true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.