content stringlengths 5 1.05M |
|---|
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ==========
PlaceObj('XTemplate', {
group = "Infopanel Sections",
id = "ipBuilding",
PlaceObj('XTemplateTemplate', {
'__context_of_kind', "Building",
'__template', "Infopanel",
}, {
PlaceObj('XTemplateGroup', {
'__condition', function (parent, context) return not context.destroyed end,
}, {
PlaceObj('XTemplateTemplate', {
'__template', "sectionUpgrades",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionServiceArea",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionDome",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionStorageWarning",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionCrop",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionCustom",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionConstructionSite",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionVisitors",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionTraits",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionResidence",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionResourceProducer",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionMine",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionStorage",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionResearchProject",
}),
PlaceObj('XTemplateTemplate', {
'__condition', function (parent, context) return IsDlcAvailable("gagarin") end,
'__template', "sectionGameDevProgress",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionPowerProduction",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionWindTurbineBoost",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionWaterProduction",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionAirProduction",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionWorkshifts",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionPowerStorage",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionWaterStorage",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionAirStorage",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionPowerGrid",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionWaterGrid",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionAirGrid",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionConsumption",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionMaintenance",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionCold",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionSupplyProducerAttention",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionWarning",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionSensorTower",
}),
PlaceObj('XTemplateTemplate', {
'comment', "priority",
'__context', function (parent, context) return context:HasMember("construction_group") and context.construction_group and context.construction_group[1] or context end,
'__condition', function (parent, context) return context.prio_button end,
'__template', "InfopanelButton",
'RolloverText', T(370449987367, --[[XTemplate ipBuilding RolloverText]] "Priority affects how often this building is serviced by Drones as well as its share of Power and life support. Notifications are not shown for buildings with low priority.<newline><newline>Current priority: <em><UIPriority></em>"),
'RolloverTitle', T(369, --[[XTemplate ipBuilding RolloverTitle]] "Change Priority"),
'RolloverHintGamepad', T(7659, --[[XTemplate ipBuilding RolloverHintGamepad]] "<ButtonA> Change priority<newline><ButtonX> Change priority of all <display_name_pl>"),
'Id', "idPriority",
'OnContextUpdate', function (self, context, ...)
if context.priority == 1 then
self:SetIcon("UI/Icons/IPButtons/normal_priority.tga")
elseif context.priority == 2 then
self:SetIcon("UI/Icons/IPButtons/high_priority.tga")
else
self:SetIcon("UI/Icons/IPButtons/urgent_priority.tga")
end
local shortcuts = GetShortcuts("actionPriority")
local binding = ""
if shortcuts and (shortcuts[1] or shortcuts[2]) then
binding = T(10950, "<newline><center><em><ShortcutName('actionPriority', 'keyboard')></em> Increase Priority")
end
self:SetRolloverHint(T{10951, "<left><left_click> Increase priority<right><right_click> Decrease priority<binding><newline><center><em>Ctrl + <left_click></em> Change priority of all <display_name_pl>", binding = binding})
end,
'OnPress', function (self, gamepad)
PlayFX("UIChangePriority")
self.context:TogglePriority(1, not gamepad and IsMassUIModifierPressed())
ObjModified(self.context)
end,
'AltPress', true,
'OnAltPress', function (self, gamepad)
if gamepad then
self.context:TogglePriority(1, true)
else
self.context:TogglePriority(-1, IsMassUIModifierPressed())
end
ObjModified(self.context)
end,
'Translate', true,
}),
PlaceObj('XTemplateTemplate', {
'comment', "on/off",
'__condition', function (parent, context) return context.on_off_button and not (IsKindOf(context, "ConstructionSite") and context.building_class == "BlackCubeMonolith") end,
'__template', "InfopanelButton",
'RolloverText', T(382329017655, --[[XTemplate ipBuilding RolloverText]] "Buildings that are turned off do not function and never consume Power or resources.<newline><newline>Current status: <em><UIWorkingStatus></em>"),
'RolloverDisabledText', T(10553, --[[XTemplate ipBuilding RolloverDisabledText]] "This building is currently disabled."),
'RolloverTitle', T(627191661712, --[[XTemplate ipBuilding RolloverTitle]] "Turn On/Off"),
'RolloverHint', T(238148642034, --[[XTemplate ipBuilding RolloverHint]] "<left_click> Activate <newline><em>Ctrl + <left_click></em> Activate for all <display_name_pl>"),
'RolloverHintGamepad', T(919224409562, --[[XTemplate ipBuilding RolloverHintGamepad]] "<ButtonA> Activate <newline><ButtonX> Activate for all <display_name_pl>"),
'OnPressParam', "ToggleWorking",
'OnPress', function (self, gamepad)
self.context:ToggleWorking(not gamepad and IsMassUIModifierPressed())
end,
'AltPress', true,
'OnAltPress', function (self, gamepad)
if gamepad then
self.context:ToggleWorking(true)
end
end,
}),
PlaceObj('XTemplateTemplate', {
'__template', "customDomeButtons",
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionWorkplace",
}),
PlaceObj('XTemplateTemplate', {
'comment', "tunnel",
'__condition', function (parent, context) return IsKindOf(context, "Tunnel") end,
'__template', "InfopanelButton",
'RolloverText', T(8629, --[[XTemplate ipBuilding RolloverText]] "Move the camera to the other side of the tunnel."),
'RolloverTitle', T(8630, --[[XTemplate ipBuilding RolloverTitle]] "View Exit"),
'RolloverHint', T(8631, --[[XTemplate ipBuilding RolloverHint]] "<left_click> View"),
'RolloverHintGamepad', T(7605, --[[XTemplate ipBuilding RolloverHintGamepad]] "<ButtonA> View"),
'OnPress', function (self, gamepad)
ViewAndSelectObject(self.context.linked_obj)
end,
'Icon', "UI/Icons/IPButtons/tunnel.tga",
}),
PlaceObj('XTemplateTemplate', {
'comment', "salvage",
'__context_of_kind', "Demolishable",
'__condition', function (parent, context) return context:ShouldShowDemolishButton() end,
'__template', "InfopanelButton",
'RolloverTitle', T(3973, --[[XTemplate ipBuilding RolloverTitle]] "Salvage"),
'RolloverHintGamepad', T(7657, --[[XTemplate ipBuilding RolloverHintGamepad]] "<ButtonY> Activate"),
'Id', "idSalvage",
'OnContextUpdate', function (self, context, ...)
local refund = context:GetRefundResources() or empty_table
local rollover = T(7822, "Destroy this building.")
if #refund > 0 then
rollover = rollover .. "<newline><newline>" .. T(7823, "<UIRefundRes> will be refunded upon salvage.")
end
self:SetRolloverText(rollover)
context:ToggleDemolish_Update(self)
end,
'OnPressParam', "ToggleDemolish",
'Icon', "UI/Icons/IPButtons/salvage_1.tga",
}, {
PlaceObj('XTemplateFunc', {
'name', "OnXButtonDown(self, button)",
'func', function (self, button)
if button == "ButtonY" then
return self:OnButtonDown(false)
elseif button == "ButtonX" then
return self:OnButtonDown(true)
end
return (button == "ButtonA") and "break"
end,
}),
PlaceObj('XTemplateFunc', {
'name', "OnXButtonUp(self, button)",
'func', function (self, button)
if button == "ButtonY" then
return self:OnButtonUp(false)
elseif button == "ButtonX" then
return self:OnButtonUp(true)
end
return (button == "ButtonA") and "break"
end,
}),
}),
}),
PlaceObj('XTemplateTemplate', {
'comment', "toggle lrt",
'__condition', function (parent, context) return IsKindOfClasses(context, "StorageDepot", "MechanizedDepot") and not IsKindOf(context, "SupplyRocket") end,
'__template', "InfopanelButton",
'RolloverText', T(11233, --[[XTemplate ipBuilding RolloverText]] "Storages with forbidden Shuttle Access are never serviced by Shuttles.<newline><newline>Current status: <em><on_off(user_include_in_lrt)></em>"),
'RolloverTitle', T(11254, --[[XTemplate ipBuilding RolloverTitle]] "Shuttle Access"),
'RolloverHint', T(11255, --[[XTemplate ipBuilding RolloverHint]] "<left_click> Toggle <newline><em>Ctrl + <left_click></em> Toggle for all <display_name_pl>"),
'RolloverHintGamepad', T(454042608125, --[[XTemplate ipBuilding RolloverHintGamepad]] "<ButtonA> Toggle <newline><ButtonX> Toggle for all <display_name_pl>"),
'Id', "ToggleLRTServiceButton",
'FoldWhenHidden', true,
'OnPressParam', "ToggleLRTService",
'OnPress', function (self, gamepad)
self.context:ToggleLRTService(not gamepad and IsMassUIModifierPressed())
end,
'AltPress', true,
'OnAltPress', function (self, gamepad)
if gamepad then
self.context:ToggleLRTService(true)
end
end,
'Icon', "UI/Icons/IPButtons/rebuild.tga",
}),
PlaceObj('XTemplateGroup', nil, {
PlaceObj('XTemplateTemplate', {
'comment', "rebuild",
'__template', "InfopanelButton",
'RolloverText', T(593, --[[XTemplate ipBuilding RolloverText]] "Rebuild this building."),
'RolloverTitle', T(592, --[[XTemplate ipBuilding RolloverTitle]] "Rebuild"),
'RolloverHint', T(238148642034, --[[XTemplate ipBuilding RolloverHint]] "<left_click> Activate <newline><em>Ctrl + <left_click></em> Activate for all <display_name_pl>"),
'RolloverHintGamepad', T(919224409562, --[[XTemplate ipBuilding RolloverHintGamepad]] "<ButtonA> Activate <newline><ButtonX> Activate for all <display_name_pl>"),
'FoldWhenHidden', true,
'OnContextUpdate', function (self, context, ...)
self:SetEnabled(not g_Tutorial or g_Tutorial.EnableRebuild)
self:SetVisible(context.destroyed and not context.demolishing and not context.bulldozed)
XTextButton.OnContextUpdate(self, context, ...)
end,
'OnPressParam', "DestroyedRebuild",
'OnPress', function (self, gamepad)
self.context:DestroyedRebuild(not gamepad and IsMassUIModifierPressed())
end,
'AltPress', true,
'OnAltPress', function (self, gamepad)
if gamepad then
self.context:DestroyedRebuild(true)
end
end,
'Icon', "UI/Icons/IPButtons/rebuild.tga",
}),
PlaceObj('XTemplateTemplate', {
'comment', "clear",
'__template', "InfopanelButton",
'RolloverText', T(595, --[[XTemplate ipBuilding RolloverText]] "Remove the remains of this building."),
'RolloverDisabledText', T(596, --[[XTemplate ipBuilding RolloverDisabledText]] "You need the Decommission Protocol (Engineering) Tech to remove these building remains."),
'RolloverTitle', T(594, --[[XTemplate ipBuilding RolloverTitle]] "Clear"),
'RolloverHint', T(238148642034, --[[XTemplate ipBuilding RolloverHint]] "<left_click> Activate <newline><em>Ctrl + <left_click></em> Activate for all <display_name_pl>"),
'RolloverHintGamepad', T(919224409562, --[[XTemplate ipBuilding RolloverHintGamepad]] "<ButtonA> Activate <newline><ButtonX> Activate for all <display_name_pl>"),
'Id', "idDecommission",
'FoldWhenHidden', true,
'OnContextUpdate', function (self, context, ...)
self:SetEnabled(UICity:IsTechResearched("DecommissionProtocol") or false)
self:SetVisible(context.destroyed and not context.demolishing and not context.bulldozed)
XTextButton.OnContextUpdate(self, context, ...)
end,
'OnPressParam', "DestroyedClear",
'OnPress', function (self, gamepad)
self.context:DestroyedClear(not gamepad and IsMassUIModifierPressed())
end,
'AltPress', true,
'OnAltPress', function (self, gamepad)
if gamepad then
self.context:DestroyedClear(true)
end
end,
'Icon', "UI/Icons/IPButtons/demolition.tga",
}),
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionCheats",
}),
}),
})
|
--
-- Created by IntelliJ IDEA.
-- User: jon
-- Date: 11/5/11
-- Time: 9:55 AM
-- To change this template use File | Settings | File Templates.
--
module "table"
function concat() end
function insert() end
function maxn() end
function remove() end
function sort() end
|
--[[
3p8_kookospahkina_puu
Uses: It's a cononut tree.
Grows on its own up until a certain global number.
Players can still cultivate it further though.
History: Refactored version of the old micro_item_salainen_kookospahkina_puu (all 8 of them...)
Memes: puu on kaunis
cocnut21
Todo: make it like the potato is. none of this gene crap, or timer crap.
Realisations: self:SetSubMaterial(...,...) DOES NOTHING
fancy timers and fancy genes are hard to do right... something about local vs. self
]]
AddCSLuaFile()
ENT.Base = "3p8_base_ent"
ENT.ItemModel = "models/hunter/misc/sphere025x025.mdl"
function ENT:Use(ply)
--plant the coconut
self:Upgrayed()
if !self.isPlanted then
self:GetPhysicsObject():Wake()
end
end
function ENT:Initialize()
--global variable for the softcap of "nature" autoplanting potatos
GLOBAL_coconut = GLOBAL_coconut + 1
self:SetMaterial("models/props_pipes/guttermetal01a")
self:SetModel(self.ItemModel)
self:PhysicsInitStandard()
--self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
--stop movement
self:SetMoveType(MOVETYPE_VPHYSICS)
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Sleep()
--make float (bouyancy)
phys:SetBuoyancyRatio(1.0) --0 min, 1 max (wood)
end
self.isPlanted = false
self.numberOfFruitMax = 5
self.treeLevel = 0
--self.plantTime = math.random(10, 50)
self.angle1 = math.random(-9,9)
self.angle2 = math.random(-179,180)
self.timer = 0
self.longTimer = 0
self.health = 75
self.growthTime = 180
--print(GLOBAL_coconut .. " global")
if GLOBAL_coconut <= 5 then
self.growthTime = 10
end
if SERVER then
--energy timer
local timer_name = "treeCoco_" .. self:EntIndex()
timer.Create(timer_name,self.growthTime,0, function() --every (some amount) seconds, update energy status
--print("yeah, we doing it now!1")
chance = math.Rand(0,1)
if IsValid(self) then
if !self.isPlanted then
if !self:OnGroundNotStupidEdition(self:GetPos()) then
--randomly make coconuts fall
self:GetPhysicsObject():Wake()
end
if chance > 0.5 && GLOBAL_coconut < GLOBAL_coconut_max then
-- autoplant functionality
--plant itself. below copy pasted from ENT:Use()
self:Upgrayed()
elseif self.timer == 2 then
self:Remove()
timer.Remove(timer_name)
end
self.timer = self.timer + 1
end
if self.isPlanted && self.longTimer == 16 then
self:Remove()
timer.Remove(timer_name)
end
self.longTimer = self.longTimer + 1
if self:IsOnFire() then
self:Remove()
timer.Remove(timer_name)
end
--upgrade statement...
if self.isPlanted && self.treeLevel <= 8 then
self:Upgrayed()
end
elseif !IsValid(self) then
timer.Remove(timer_name)
end
end)
end
end
if SERVER then
function ENT:OnRemove()
GLOBAL_coconut = GLOBAL_coconut - 1
--PrintTable( self:GetChildren() )
self:EmitSound("weapons/debris1.wav")
if self.treeLevel >= 5 then
--PRODUCE WOOD HERE
puulle = ents.Create("micro_item_salainen_puulle")
if ( !IsValid( puulle ) ) then return end
puulle:SetPos(self:GetPos() + Vector(0,0,100))
puulle:Spawn()
--make a stump: kanto
kanto = ents.Create("micro_item_salainen_kanto")
if ( !IsValid( kanto ) ) then return end
kanto:SetPos(self:GetPos() + Vector(0,0,0))
kanto:Spawn()
--make leaf gibs...
--models/props_foliage/fern01.mdl
--make leaves fall
--leaf = ents.Create("prop_physics")
--if ( !IsValid( leaf ) ) then return end
--leaf:SetModel("models/props_foliage/fern01.mdl")
--leaf:SetPos(self:GetPos() + Vector(0,0,128))
--leaf:PhysicsInitStandard()
--leaf:Spawn()
--simple timer for like 2 seconds to destroy the new leaf(ves)
end
end
end --end SERVER
function ENT:Upgrayed()
--plant the coconut
if self:WaterLevel() == 0 && SERVER then
if !self.isPlanted && self.treeLevel == 0 && self:OnGroundNotStupidEdition(self:GetPos()) then
self.isPlanted = true
--stop movement
self:SetMoveType(0)
--make sound
self:EmitSound("phx/eggcrack.wav")
--go to next level
self.treeLevel = 1
--move down to ground for the first time only
self:SetPos(self:GetPos() + Vector(0,0,-7))
--rotate the thing to be upwards
self:SetAngles( Angle(self.angle1,self.angle2,0))
elseif self.treeLevel == 1 then
self:GetPhysicsObject():EnableCollisions(false)
self:SetModel("models/props_foliage/ferns03.mdl")
--PrintTable(self:GetMaterials())
self:SetMaterial()
self:PhysicsInitStandard()
--self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetMoveType(0)
self.treeLevel = 2
self.health = 250 * self.treeLevel
elseif self.treeLevel == 2 then
self:GetPhysicsObject():EnableCollisions(false)
self:SetModel("models/props_foliage/ferns02.mdl")
--PrintTable(self:GetMaterials())
self:SetMaterial()
self:PhysicsInitStandard()
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetMoveType(0)
self.treeLevel = 3
self.health = 250 * self.treeLevel
elseif self.treeLevel == 3 then
self:GetPhysicsObject():EnableCollisions(false)
self:SetModel("models/props/de_dust/palm_tree_head_skybox.mdl")
--PrintTable(self:GetMaterials())
self:SetMaterial()
self:PhysicsInitStandard()
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetMoveType(0)
self.treeLevel = 4
self.health = 250 * self.treeLevel
elseif self.treeLevel == 4 then
self:GetPhysicsObject():EnableCollisions(false)
self:SetModel("models/props_foliage/urban_small_palm01.mdl")
--PrintTable(self:GetMaterials())
self:SetMaterial()
self:PhysicsInitStandard()
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetMoveType(0)
self.treeLevel = 5
self.health = 250 * self.treeLevel
elseif self.treeLevel == 5 then
self:GetPhysicsObject():EnableCollisions(false)
self:SetModel("models/props_foliage/mall_palmplant02.mdl")
--PrintTable(self:GetMaterials())
self:SetMaterial()
--print("bad material for leaves")
self:PhysicsInitStandard()
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetMoveType(0)
self.treeLevel = 6
self.health = 250 * self.treeLevel
elseif self.treeLevel == 6 then
self:GetPhysicsObject():EnableCollisions(false)
self:SetModel("models/props_foliage/mall_palm01_medium.mdl")
self:SetMaterial()
self:PhysicsInitStandard()
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetMoveType(0)
self.treeLevel = 7
self.health = 250 * self.treeLevel
elseif self.treeLevel == 7 then
self:GetPhysicsObject():EnableCollisions(false)
self:SetModel("models/props_foliage/mall_palm01.mdl")
self:SetMaterial()
self:PhysicsInitStandard()
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetMoveType(0)
self.treeLevel = 8
self.health = 250 * self.treeLevel
elseif self.treeLevel == 8 && GLOBAL_coconut < 1.5*GLOBAL_coconut_max then
for i = 1,math.random(1,self.numberOfFruitMax) do
--print("making coconut again")
newFruit = ents.Create("3p8_kookospahkina_puu")
if ( !IsValid( newFruit ) ) then return end
newFruit:SetPos(self:GetPos() + Vector(math.random(-12,12),math.random(-12,12),128+math.random(0,25)))
--at position up in the tree (might need some if statements to do bearing fruit earlier/later)
--maybe use the entity's height subtract some?
newFruit:Spawn()
newFruit:GetPhysicsObject():Wake()
end
end
end
end
function ENT:OnGroundNotStupidEdition(position)
local plantable = false
local startpos = position
local endpos = startpos + Vector(0,0,-1)*10
local tmin = Vector(1,1,1)*-5
local tmax = Vector(1,1,1)*5
local tr = util.TraceHull( {
start = startpos,
endpos = endpos,
filter = self,
mins = tmin,
maxs = tmax,
mask = MASK_SHOT_HULL
} )
if not IsValid(tr.Entity) then
tr = util.TraceLine({
start = startpos,
endpos = endpos,
filter = self,
mask = MASK_SHOT_HULL
})
end
local ent = tr.Entity
if IsValid(ent) && ent:GetClass() == "func_brush" then
plantable = true
end
return plantable
end
function ENT:OnTakeDamage(damageto)
self.health = self.health - damageto:GetDamage()
if self.health <= 0 then
self:EmitSound("weapons/debris1.wav")
self:Remove()
end
end
--models/props_forest/log.mdl
--cocnut21
--0 models/hunter/misc/sphere025x025.mdl
--models/props_pipes/guttermetal01a --material
--from tree thing on workshop
--1 models/props_foliage/ferns03.mdl
--2 models/props_foliage/ferns02.mdl
--3 models/props/de_dust/palm_tree_head_skybox.mdl
--4 models/props_foliage/urban_small_palm01.mdl
--5 models/props_foliage/mall_palmplant02.mdl
--6 models/props_foliage/mall_palm01_medium.mdl
--7 models/props_foliage/mall_palm01.mdl
--http://gamebanana.com/models/3622
--8 models/domitibingen/foliage/palms/d_palm_01/d_palm_s_07.mdl
--9 models/domitibingen/foliage/palms/d_palm_01/d_palm_b_01.mdl |
--[[
TheNexusAvenger
Stores partitions of instances.
--]]
local NexusGit = require(script.Parent.Parent):GetContext(script)
local NexusInstance = NexusGit:GetResource("NexusPluginFramework.NexusInstance.NexusInstance")
local RobloxAPI = NexusGit:GetResource("Serialization.RobloxAPI")
local InstanceSerializier = NexusGit:GetResource("Serialization.InstanceSerializier")
local HttpService = game:GetService("HttpService")
local Partitions = NexusInstance:Extend()
Partitions:SetClassName("Partitions")
--[[
Creates a partitions object.
--]]
function Partitions:__new()
self.Partitions = {}
end
--[[
Returns the data for a partition.
--]]
function Partitions:GetData(Name)
return self.Partitions[Name]
end
--[[
Returns the instance for a partition.
--]]
function Partitions:GetInstance(Name)
return InstanceSerializier:Deserialize(self.Partitions[Name])
end
--[[
Stores data in a partition.
--]]
function Partitions:StoreData(Name,Data)
self.Partitions[Name] = Data
end
--[[
Stores an Instance in a partition.
--]]
function Partitions:StoreInstance(Name,Ins)
self:StoreData(Name,InstanceSerializier:Serialize(Ins))
end
--[[
Serializes the partitions to a JSON string.
--]]
function Partitions:ToJSON()
return HttpService:JSONEncode({
Type = "Partitions",
Instances = self.Partitions,
})
end
--[[
Deserailizes the partitions from a JSON string.
--]]
function Partitions:FromJSON(JSONString)
--Deserialize the string.
local PartitionsData = HttpService:JSONDecode(JSONString)
--Add the data.
local NewPartitions = Partitions.new()
for Name,PartitionData in pairs(PartitionsData.Instances) do
NewPartitions:StoreData(Name,PartitionData)
end
--Return the new partitions.
return NewPartitions
end
return Partitions |
AddCSLuaFile("cl_init.lua");
AddCSLuaFile("shared.lua");
include("shared.lua");
function ENT:Initialize()
end
function ENT:StartTouch(entity)
if(IsValid(entity) and entity:GetClass() == "minigolf_ball")then
if(self:GetHoleName() == entity:GetStart():GetHoleName())then
Minigolf.Holes.End(entity:GetPlayer(), entity, entity:GetStart(), self)
else
hook.Call("MinigolfBallOutOfBounds", gm(), entity:GetPlayer(), entity, self)
end
elseif(entity.OnHoleEndTouched)then
entity:OnHoleEndTouched(self)
end
end
function ENT:KeyValue(key, value)
key = string.lower(key)
if(key == "hole")then
self:SetHoleName(tostring(value):Trim())
elseif(key == "course")then
self:SetCourse(tostring(value):Trim())
end
end
function ENT:SetHoleName(holeName)
self._HoleName = holeName
self:SetNWString("HoleName", holeName)
end
function ENT:GetHoleName()
return self._HoleName
end
function ENT:GetUniqueHoleName()
return self:GetCourse() .. self:GetHoleName()
end
function ENT:SetCourse(courseName)
self._HoleCourse = courseName
end
function ENT:GetCourse()
return self._HoleCourse or ""
end
function ENT:GetStart()
if(self._Start)then
return self._Start
end
for _, otherEntity in pairs(ents.FindByClass("minigolf_hole_start")) do
if(otherEntity:GetUniqueHoleName() == self:GetUniqueHoleName())then
self._Start = otherEntity
return self._Start
end
end
end
function ENT:UpdateTransmitState()
return TRANSMIT_ALWAYS
end |
--[[Register]]--
RegisterNetEvent('FinishMoneyCheckForVeh')
RegisterNetEvent('vehshop:spawnVehicle')
RegisterNetEvent('vehshop:leftvehicle')
RegisterNetEvent('veh:spawn')
RegisterNetEvent('veh:retrieve')
--[[Local/Global]]--
local vehshop = {
opened = false,
title = "Vehicle Shop",
currentmenu = "main",
lastmenu = nil,
currentpos = nil,
selectedbutton = 0,
marker = { r = 0, g = 155, b = 255, a = 200, type = 1 },
menu = {
x = 0.9,
y = 0.08,
width = 0.2,
height = 0.04,
buttons = 10,
from = 1,
to = 10,
scale = 0.4,
font = 0,
["main"] = {
title = "CATEGORIES",
name = "main",
buttons = {
{name = "Vehicles", description = ""},
{name = "Motorcycles", description = ""},
}
},
["vehicles"] = {
title = "VEHICLES",
name = "vehicles",
buttons = {
{name = "Compacts", description = ''},
{name = "Coupes", description = ''},
{name = "Sedans", description = ''},
{name = "Sports", description = ''},
{name = "Sports Classics", description = ''},
{name = "Super", description = ''},
{name = "Muscle", description = ''},
{name = "Off-Road", description = ''},
{name = "SUVs", description = ''},
{name = "Vans", description = ''},
{name = "Cycles", description = ''},
}
},
["compacts"] = {
title = "compacts",
name = "compacts",
buttons = {
{name = "Blista", costs = 20000, description = {}, model = "blista"},
{name = "Brioso R/A", costs = 35000, description = {}, model = "brioso"},
{name = "Dilettante", costs = 6000, description = {}, model = "Dilettante"},
{name = "Issi", costs = 35000, description = {}, model = "issi2"},
{name = "Panto", costs = 8000, description = {}, model = "panto"},
{name = "Prairie", costs = 35000, description = {}, model = "prairie"},
{name = "Rhapsody", costs = 40000, description = {}, model = "rhapsody"},
}
},
["coupes"] = {
title = "coupes",
name = "coupes",
buttons = {
{name = "Cognoscenti Cabrio", costs = 270000, description = {}, model = "cogcabrio"},
{name = "Exemplar", costs = 210000, description = {}, model = "exemplar"},
{name = "F620", costs = 200000, description = {}, model = "f620"},
{name = "Felon", costs = 150000, description = {}, model = "felon"},
{name = "Felon GT", costs = 170000, description = {}, model = "felon2"},
{name = "Jackal", costs = 90000, description = {}, model = "jackal"},
{name = "Oracle", costs = 80000, description = {}, model = "oracle"},
{name = "Oracle XS", costs = 85000, description = {}, model = "oracle2"},
{name = "Sentinel", costs = 110000, description = {}, model = "sentinel2"},
{name = "Sentinel XS", costs = 130000, description = {}, model = "sentinel"},
{name = "Windsor", costs = 300000, description = {}, model = "windsor"},
{name = "Windsor Drop", costs = 400000, description = {}, model = "windsor2"},
{name = "Zion", costs = 90000, description = {}, model = "zion"},
{name = "Zion Cabrio", costs = 100000, description = {}, model = "zion2"},
}
},
["sports"] = {
title = "sports",
name = "sports",
buttons = {
{name = "9F", costs = 300000, description = {}, model = "ninef"},
{name = "9F Cabrio", costs = 350000, description = {}, model = "ninef2"},
{name = "Alpha", costs = 275000, description = {}, model = "alpha"},
{name = "Banshee", costs = 150000, description = {}, model = "banshee"},
{name = "Bestia GTS", costs = 250000, description = {}, model = "bestiagts"},
{name = "Buffalo", costs = 90000, description = {}, model = "buffalo"},
{name = "Buffalo S", costs = 110000, description = {}, model = "buffalo2"},
{name = "Carbonizzare", costs = 350000, description = {}, model = "carbonizzare"},
{name = "Comet", costs = 200000, description = {}, model = "comet2"},
{name = "Coquette", costs = 300000, description = {}, model = "coquette"},
{name = "Elegy RH8", costs = 200000, description = {}, model = "elegy2"},
{name = "Feltzer", costs = 270000, description = {}, model = "feltzer2"},
{name = "Furore GT", costs = 300000, description = {}, model = "furoregt"},
{name = "Fusilade", costs = 150000, description = {}, model = "fusilade"},
{name = "Futo", costs = 115000, description = {}, model = "futo"},
{name = "Jester", costs = 700000, description = {}, model = "jester"},
{name = "Khamelion", costs = 450000, description = {}, model = "khamelion"},
{name = "Kuruma", costs = 250000, description = {}, model = "kuruma"},
{name = "Lynx", costs = 250000, description = {}, model = "lynx"},
{name = "Massacro", costs = 275000, description = {}, model = "massacro"},
{name = "Penumbra", costs = 80000, description = {}, model = "penumbra"},
{name = "Rapid GT", costs = 180000, description = {}, model = "rapidgt"},
{name = "Rapid GT Convertible", costs = 200000, description = {}, model = "rapidgt2"},
{name = "Schafter LWB", costs = 250000, description = {}, model = "schafter4"},
{name = "Schafter V12", costs = 300000, description = {}, model = "schafter3"},
{name = "Schwarzer", costs = 175000, description = {}, model = "schwarzer"},
{name = "Seven 70", costs = 700000, description = {}, model = "seven70"},
{name = "Specter", costs = 500000, description = {}, model = "specter"},
{name = "Sultan", costs = 210000, description = {}, model = "sultan"},
{name = "Surano", costs = 375000, description = {}, model = "surano"},
{name = "Verkierer", costs = 400000, description = {}, model = "verlierer2"},
}
},
["sportsclassics"] = {
title = "sports classics",
name = "sportsclassics",
buttons = {
{name = "Coquette Classic", costs = 320000, description = {}, model = "coquette2"},
{name = "Manana", costs = 20000, description = {}, model = "manana"},
{name = "Peyote", costs = 30000, description = {}, model = "peyote"},
{name = "Pigalle", costs = 60000, description = {}, model = "pigalle"},
{name = "Tornado", costs = 25000, description = {}, model = "tornado"},
}
},
["super"] = {
title = "super",
name = "super",
buttons = {
{name = "811", costs = 705000, description = {}, model = "pfister811"},
{name = "Adder", costs = 1000000, description = {}, model = "adder"},
{name = "Bullet", costs = 500000, description = {}, model = "bullet"},
{name = "Cheetah", costs = 850000, description = {}, model = "cheetah"},
{name = "Entity XF", costs = 600000, description = {}, model = "entityxf"},
{name = "FMJ", costs = 900000, description = {}, model = "fmj"},
{name = "GP1", costs = 900000, description = {}, model = "gp1"},
{name = "Infernus", costs = 400000, description = {}, model = "infernus"},
{name = "Itali GTB", costs = 500000, description = {}, model = "italigtb"},
{name = "Nero", costs = 1500000, description = {}, model = "nero"},
{name = "Osiris", costs = 1000000, description = {}, model = "osiris"},
{name = "Penetrator", costs = 1000000, description = {}, model = "penetrator"},
{name = "Reaper", costs = 600000, description = {}, model = "reaper"},
{name = "T20", costs = 800000, description = {}, model = "t20"},
{name = "Tempesta", costs = 800000, description = {}, model = "tempesta"},
{name = "Turismo R", costs = 900000, description = {}, model = "turismor"},
{name = "Vacca", costs = 700000, description = {}, model = "vacca"},
{name = "Vagner", costs = 1000000, description = {}, model = "vagner"},
{name = "Voltic", costs = 500000, description = {}, model = "voltic"},
{name = "XA 21", costs = 800000, description = {}, model = "xa21"},
{name = "Zentorno", costs = 1000000, description = {}, model = "zentorno"},
}
},
["muscle"] = {
title = "muscle",
name = "muscle",
buttons = {
{name = "Blade", costs = 35000, description = {}, model = "blade"},
{name = "Buccaneer", costs = 50000, description = {}, model = "buccaneer"},
{name = "Chino", costs = 40000, description = {}, model = "chino"},
{name = "Dominator", costs = 70000, description = {}, model = "dominator"},
{name = "Dukes", costs = 70000, description = {}, model = "dukes"},
{name = "Faction", costs = 40000, description = {}, model = "faction"},
{name = "Gauntlet", costs = 75000, description = {}, model = "gauntlet"},
{name = "Hotknife", costs = 60000, description = {}, model = "hotknife"},
{name = "Moonbeam", costs = 30000, description = {}, model = "moonbeam"},
{name = "Phoenix", costs = 50000, description = {}, model = "phoenix"},
{name = "Picador", costs = 40000, description = {}, model = "picador"},
{name = "Ruiner", costs = 55000, description = {}, model = "ruiner"},
{name = "Sabre Turbo", costs = 45000, description = {}, model = "sabregt"},
{name = "Slam Van", costs = 40000, description = {}, model = "slamvan"},
{name = "Stalion", costs = 40000, description = {}, model = "stalion"},
{name = "Tampa", costs = 65000, description = {}, model = "tampa"},
{name = "Virgo", costs = 65000, description = {}, model = "virgo"},
{name = "Virgo Classic", costs = 30000, description = {}, model = "virgo2"},
{name = "Vigero", costs = 50000, description = {}, model = "vigero"},
{name = "Voodoo", costs = 35000, description = {}, model = "voodoo2"},
}
},
["offroad"] = {
title = "off-road",
name = "off-road",
buttons = {
{name = "Bifta", costs = 50000, description = {}, model = "bifta"},
{name = "Blazer", costs = 20000, description = {}, model = "blazer"},
{name = "Blazer Street", costs = 35000, description = {}, model = "blazer4"},
{name = "Bodhi", costs = 17000, description = {}, model = "bodhi2"},
{name = "Brawler", costs = 200000, description = {}, model = "brawler"},
{name = "Bubsta 6x6", costs = 500000, description = {}, model = "dubsta3"},
{name = "BF Injection", costs = 25000, description = {}, model = "bfinjection"},
{name = "Contender", costs = 300000, description = {}, model = "contender"},
{name = "Kalahari", costs = 30000, description = {}, model = "kalahari"},
{name = "Mesa", costs = 80000, description = {}, model = "mesa"},
{name = "Rancher XL", costs = 35000, description = {}, model = "ranhcerxl"},
{name = "Rebel Rusty", costs = 20000, description = {}, model = "rebel"},
{name = "Rebel", costs = 40000, description = {}, model = "rebel2"},
{name = "Sandking XL", costs = 110000, description = {}, model = "sandking"},
}
},
["suvs"] = {
title = "suvs",
name = "suvs",
buttons = {
{name = "Baller", costs = 50000, description = {}, model = "baller"},
{name = "Baller LE", costs = 90000, description = {}, model = "baller3"},
{name = "Baller LE-LWB", costs = 11000, description = {}, model = "baller4"},
{name = "Beejay XL", costs = 35000, description = {}, model = "bjxl"},
{name = "Cavalcade", costs = 45000, description = {}, model = "cavalcade"},
{name = "Cavalcade LE", costs = 85000, description = {}, model = "cavalcade2"},
{name = "Dubsta", costs = 250000, description = {}, model = "dubsta"},
{name = "FQ 2", costs = 50000, description = {}, model = "fq2"},
{name = "Granger", costs = 80000, description = {}, model = "granger"},
{name = "Gresley", costs = 55000, description = {}, model = "gresley"},
{name = "Habanero", costs = 35000, description = {}, model = "habanero"},
{name = "Huntley S", costs = 170000, description = {}, model = "huntley"},
{name = "Landstalker", costs = 65000, description = {}, model = "landstalker"},
{name = "Patriot H2", costs = 100000, description = {}, model = "patriot"},
{name = "Radius", costs = 55000, description = {}, model = "radi"},
{name = "Rocoto", costs = 80000, description = {}, model = "rocoto"},
{name = "Seminole", costs = 40000, description = {}, model = "seminole"},
{name = "Serrano", costs = 80000, description = {}, model = "serrano"},
{name = "XLS", costs = 100000, description = {}, model = "xls"},
}
},
["vans"] = {
title = "vans",
name = "vans",
buttons = {
{name = "Bison", costs = 35000, description = {}, model = "bison"},
{name = "Bobcat XL", costs = 25000, description = {}, model = "bobcatxl"},
{name = "Burrito", costs = 30000, description = {}, model = "burrito"},
{name = "Camper", costs = 40000, description = {}, model = "camper"},
{name = "Journey", costs = 8000, description = {}, model = "journey"},
{name = "Minivan", costs = 15000, description = {}, model = "minivan"},
{name = "Paradise", costs = 35000, description = {}, model = "paradise"},
{name = "Pony", costs = 30000, description = {}, model = "pony"},
{name = "Rumpo", costs = 25000, description = {}, model = "rumpo"},
{name = "Speedo", costs = 32500, description = {}, model = "speedo"},
{name = "Surfer", costs = 40000, description = {}, model = "surfer"},
{name = "Youga", costs = 30000, description = {}, model = "youga"},
{name = "Youga Classic", costs = 20000, description = {}, model = "youga2"},
}
},
["sedans"] = {
title = "sedans",
name = "sedans",
buttons = {
{name = "Asea", costs = 17800, description = {}, model = "asea"},
{name = "Asterope", costs = 22000, description = {}, model = "asterope"},
{name = "Cognoscenti", costs = 250000, description = {}, model = "cognoscenti"},
{name = "Cognoscenti 55", costs = 230000, description = {}, model = "cog55"},
{name = "Emperor", costs = 10000, description = {}, model = "emperor"},
{name = "Fugitive", costs = 50000, description = {}, model = "fugitive"},
{name = "Glendale", costs = 65000, description = {}, model = "glendale"},
{name = "Ingot", costs = 10000, description = {}, model = "ingot"},
{name = "Intruder", costs = 45000, description = {}, model = "intruder"},
{name = "Premier", costs = 20000, description = {}, model = "premier"},
{name = "Primo", costs = 40000, description = {}, model = "primo"},
{name = "Regina", costs = 10000, description = {}, model = "regina"},
{name = "Schafter", costs = 80000, description = {}, model = "schafter2"},
{name = "Stanier", costs = 10000, description = {}, model = "stanier"},
{name = "Stratum", costs = 10000, description = {}, model = "stratum"},
{name = "Super Diamond", costs = 260000, description = {}, model = "superd"},
{name = "Surge", costs = 22000, description = {}, model = "surge"},
{name = "Tailgater", costs = 70000, description = {}, model = "tailgater"},
{name = "Warrener", costs = 65000, description = {}, model = "warrener"},
{name = "Washington", costs = 25000, description = {}, model = "washington"},
}
},
["motorcycles"] = {
title = "MOTORCYCLES",
name = "motorcycles",
buttons = {
{name = "Akuma", costs = 24000, description = {}, model = "AKUMA"},
{name = "Bagger", costs = 32000, description = {}, model = "bagger"},
{name = "Bati 801", costs = 50000, description = {}, model = "bati"},
{name = "BF400", costs = 48500, description = {}, model = "bf400"},
{name = "Carbon RS", costs = 60000, description = {}, model = "carbonrs"},
{name = "Cliffhanger", costs = 25000, description = {}, model = "cliffhanger"},
{name = "Daemon", costs = 25000, description = {}, model = "daemon"},
{name = "Diabolus", costs = 30000, description = {}, model = "diabolus"},
{name = "Double T", costs = 55000, description = {}, model = "double"},
{name = "Enduro", costs = 10000, description = {}, model = "enduro"},
{name = "Faggio", costs = 4000, description = {}, model = "faggio2"},
{name = "FCR 1000", costs = 30000, description = {}, model = "fcr"},
{name = "Gargoyle", costs = 30000, description = {}, model = "gargoyle"},
{name = "Hakuchou", costs = 80000, description = {}, model = "hakuchou"},
{name = "Hexer", costs = 15000, description = {}, model = "hexer"},
{name = "Innovation", costs = 14000, description = {}, model = "innovation"},
{name = "Lectro", costs = 40000, description = {}, model = "lectro"},
{name = "Manchez", costs = 30000, description = {}, model = "manchez"},
{name = "Nemesis", costs = 12000, description = {}, model = "nemesis"},
{name = "Nightblade", costs = 40000, description = {}, model = "nightblade"},
{name = "PCJ-600", costs = 16000, description = {}, model = "pcj"},
{name = "Ruffian", costs = 16000, description = {}, model = "ruffian"},
{name = "Sanchez", costs = 26000, description = {}, model = "sanchez2"},
{name = "Sanchez KIT", costs = 36000, description = {}, model = "sanchez"},
{name = "Thrust", costs = 30000, description = {}, model = "thrust"},
{name = "Vader", costs = 18000, description = {}, model = "vader"},
{name = "Vindicator", costs = 50000, description = {}, model = "vindicator"},
{name = "Vortex", costs = 60000, description = {}, model = "vortex"},
{name = "Wolfsbane", costs = 25000, description = {}, model = "wolfsbane"},
}
},
}
}
local fakecar = {model = '', car = nil}
local vehshop_locations = {{entering = {-33.803,-1102.322,25.422}, inside = {-46.56327,-1097.382,25.99875, 120.1953}, outside = {-31.849,-1090.648,25.998,322.345}}}
local vehshop_blips ={}
local inrangeofvehshop = false
local currentlocation = nil
local boughtcar = false
local vehicle_price = 0
local backlock = false
local firstspawn = 0
--[[Functions]]--
function LocalPed()
return GetPlayerPed(-1)
end
function drawTxt(text,font,centre,x,y,scale,r,g,b,a)
SetTextFont(font)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextColour(r, g, b, a)
SetTextDropShadow(0, 0, 0, 0,255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextCentre(centre)
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x , y)
end
function IsPlayerInRangeOfVehshop()
return inrangeofvehshop
end
function ShowVehshopBlips(bool)
if bool and #vehshop_blips == 0 then
for station,pos in pairs(vehshop_locations) do
local loc = pos
pos = pos.entering
local blip = AddBlipForCoord(pos[1],pos[2],pos[3])
SetBlipSprite(blip,326)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString('Concessionnaire')
EndTextCommandSetBlipName(blip)
SetBlipAsShortRange(blip,true)
SetBlipAsMissionCreatorBlip(blip,true)
table.insert(vehshop_blips, {blip = blip, pos = loc})
end
Citizen.CreateThread(function()
while #vehshop_blips > 0 do
Citizen.Wait(0)
local inrange = false
for i,b in ipairs(vehshop_blips) do
DrawMarker(1,b.pos.entering[1],b.pos.entering[2],b.pos.entering[3],0,0,0,0,0,0,2.001,2.0001,0.5001,0,155,255,200,0,0,0,0)
if vehshop.opened == false and IsPedInAnyVehicle(LocalPed(), true) == false and GetDistanceBetweenCoords(b.pos.entering[1],b.pos.entering[2],b.pos.entering[3],GetEntityCoords(LocalPed())) < 5 then
drawTxt('Appuyer sur ~g~Entrée~s~ pour accéder au menu d\'achat',0,1,0.5,0.8,0.6,255,255,255,255)
currentlocation = b
inrange = true
end
end
inrangeofvehshop = inrange
end
end)
elseif bool == false and #vehshop_blips > 0 then
for i,b in ipairs(vehshop_blips) do
if DoesBlipExist(b.blip) then
SetBlipAsMissionCreatorBlip(b.blip,false)
Citizen.InvokeNative(0x86A652570E5F25DD, Citizen.PointerValueIntInitialized(b.blip))
end
end
vehshop_blips = {}
end
end
function f(n)
return n + 0.0001
end
function try(f, catch_f)
local status, exception = pcall(f)
if not status then
catch_f(exception)
end
end
function firstToUpper(str)
return (str:gsub("^%l", string.upper))
end
function OpenCreator()
boughtcar = false
local ped = LocalPed()
local pos = currentlocation.pos.inside
FreezeEntityPosition(ped,true)
SetEntityVisible(ped,false)
local g = Citizen.InvokeNative(0xC906A7DAB05C8D2B,pos[1],pos[2],pos[3],Citizen.PointerValueFloat(),0)
SetEntityCoords(ped,pos[1],pos[2],g)
SetEntityHeading(ped,pos[4])
vehshop.currentmenu = "main"
vehshop.opened = true
vehshop.selectedbutton = 0
end
function CloseCreator(name, veh, price)
Citizen.CreateThread(function()
local ped = LocalPed()
if not boughtcar then
local pos = currentlocation.pos.entering
SetEntityCoords(ped,pos[1],pos[2],pos[3])
FreezeEntityPosition(ped,false)
SetEntityVisible(ped,true)
else
local name = name
local vehicle = veh
local price = price
local veh = GetVehiclePedIsUsing(ped)
local model = GetEntityModel(veh)
local colors = table.pack(GetVehicleColours(veh))
local extra_colors = table.pack(GetVehicleExtraColours(veh))
local mods = {}
for i = 0,24 do
mods[i] = GetVehicleMod(veh,i)
end
Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(veh))
local pos = currentlocation.pos.outside
FreezeEntityPosition(ped,false)
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(0)
end
personalvehicle = CreateVehicle(model,pos[1],pos[2],pos[3],pos[4],true,false)
SetModelAsNoLongerNeeded(model)
for i,mod in pairs(mods) do
SetVehicleModKit(personalvehicle,0)
SetVehicleMod(personalvehicle,i,mod)
end
SetVehicleOnGroundProperly(personalvehicle)
local plate = GetVehicleNumberPlateText(personalvehicle)
SetVehicleHasBeenOwnedByPlayer(personalvehicle,true)
local id = NetworkGetNetworkIdFromEntity(personalvehicle)
SetNetworkIdCanMigrate(id, true)
-- Citizen.InvokeNative(0x629BFA74418D6239,Citizen.PointerValueIntInitialized(personalvehicle))
SetVehicleColours(personalvehicle,colors[1],colors[2])
SetVehicleExtraColours(personalvehicle,extra_colors[1],extra_colors[2])
TaskWarpPedIntoVehicle(GetPlayerPed(-1),personalvehicle,-1)
SetEntityVisible(ped,true)
local primarycolor = colors[1]
local secondarycolor = colors[2]
local pearlescentcolor = extra_colors[1]
local wheelcolor = extra_colors[2]
TriggerServerEvent('BuyForVeh', name, vehicle, price, plate, primarycolor, secondarycolor, pearlescentcolor, wheelcolor)
end
vehshop.opened = false
vehshop.menu.from = 1
vehshop.menu.to = 10
end)
end
function drawMenuButton(button,x,y,selected)
local menu = vehshop.menu
SetTextFont(menu.font)
SetTextProportional(0)
SetTextScale(menu.scale, menu.scale)
if selected then
SetTextColour(0, 0, 0, 255)
else
SetTextColour(255, 255, 255, 255)
end
SetTextCentre(0)
SetTextEntry("STRING")
AddTextComponentString(button.name)
if selected then
DrawRect(x,y,menu.width,menu.height,255,255,255,255)
else
DrawRect(x,y,menu.width,menu.height,0,0,0,150)
end
DrawText(x - menu.width/2 + 0.005, y - menu.height/2 + 0.0028)
end
function drawMenuInfo(text)
local menu = vehshop.menu
SetTextFont(menu.font)
SetTextProportional(0)
SetTextScale(0.45, 0.45)
SetTextColour(255, 255, 255, 255)
SetTextCentre(0)
SetTextEntry("STRING")
AddTextComponentString(text)
DrawRect(0.675, 0.95,0.65,0.050,0,0,0,150)
DrawText(0.365, 0.934)
end
function drawMenuRight(txt,x,y,selected)
local menu = vehshop.menu
SetTextFont(menu.font)
SetTextProportional(0)
SetTextScale(menu.scale, menu.scale)
SetTextRightJustify(1)
if selected then
SetTextColour(0, 0, 0, 255)
else
SetTextColour(255, 255, 255, 255)
end
SetTextCentre(0)
SetTextEntry("STRING")
AddTextComponentString(txt)
DrawText(x + menu.width/2 - 0.03, y - menu.height/2 + 0.0028)
end
function drawMenuTitle(txt,x,y)
local menu = vehshop.menu
SetTextFont(2)
SetTextProportional(0)
SetTextScale(0.5, 0.5)
SetTextColour(255, 255, 255, 255)
SetTextEntry("STRING")
AddTextComponentString(txt)
DrawRect(x,y,menu.width,menu.height,0,0,0,150)
DrawText(x - menu.width/2 + 0.005, y - menu.height/2 + 0.0028)
end
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
function drawNotification(text)
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(false, false)
end
function DoesPlayerHaveVehicle(model,button,y,selected)
local t = false
--TODO:check if player own car
if t then
drawMenuRight("OWNED",vehshop.menu.x,y,selected)
else
drawMenuRight(button.costs.."$",vehshop.menu.x,y,selected)
end
end
function stringstarts(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
function round(num, idp)
if idp and idp>0 then
local mult = 10^idp
return math.floor(num * mult + 0.5) / mult
end
return math.floor(num + 0.5)
end
function ButtonSelected(button)
local ped = GetPlayerPed(-1)
local this = vehshop.currentmenu
local btn = button.name
if this == "main" then
if btn == "Vehicles" then
OpenMenu('vehicles')
elseif btn == "Motorcycles" then
OpenMenu('motorcycles')
end
elseif this == "vehicles" then
if btn == "Sports" then
OpenMenu('sports')
elseif btn == "Sedans" then
OpenMenu('sedans')
elseif btn == "Compacts" then
OpenMenu('compacts')
elseif btn == "Coupes" then
OpenMenu('coupes')
elseif btn == "Sports Classics" then
OpenMenu("sportsclassics")
elseif btn == "Super" then
OpenMenu('super')
elseif btn == "Muscle" then
OpenMenu('muscle')
elseif btn == "Off-Road" then
OpenMenu('offroad')
elseif btn == "SUVs" then
OpenMenu('suvs')
elseif btn == "Vans" then
OpenMenu('vans')
end
elseif this == "compacts" or this == "coupes" or this == "sedans" or this == "sports" or this == "sportsclassics" or this == "super" or this == "muscle" or this == "offroad" or this == "suvs" or this == "vans" or this == "industrial" or this == "cycles" or this == "motorcycles" then
TriggerServerEvent('CheckMoneyForVeh',button.name, button.model, button.costs)
end
end
function OpenMenu(menu)
fakecar = {model = '', car = nil}
vehshop.lastmenu = vehshop.currentmenu
if menu == "vehicles" then
vehshop.lastmenu = "main"
elseif menu == "bikes" then
vehshop.lastmenu = "main"
elseif menu == 'race_create_objects' then
vehshop.lastmenu = "main"
elseif menu == "race_create_objects_spawn" then
vehshop.lastmenu = "race_create_objects"
end
vehshop.menu.from = 1
vehshop.menu.to = 10
vehshop.selectedbutton = 0
vehshop.currentmenu = menu
end
function Back()
if backlock then
return
end
backlock = true
if vehshop.currentmenu == "main" then
CloseCreator()
elseif vehshop.currentmenu == "compacts" or vehshop.currentmenu == "coupes" or vehshop.currentmenu == "sedans" or vehshop.currentmenu == "sports" or vehshop.currentmenu == "sportsclassics" or vehshop.currentmenu == "super" or vehshop.currentmenu == "muscle" or vehshop.currentmenu == "offroad" or vehshop.currentmenu == "suvs" or vehshop.currentmenu == "vans" or vehshop.currentmenu == "industrial" or vehshop.currentmenu == "cycles" or vehshop.currentmenu == "motorcycles" then
if DoesEntityExist(fakecar.car) then
Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(fakecar.car))
end
fakecar = {model = '', car = nil}
OpenMenu(vehshop.lastmenu)
else
OpenMenu(vehshop.lastmenu)
end
end
--[[Citizen]]--
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustPressed(1,201) and IsPlayerInRangeOfVehshop() then
if vehshop.opened then
CloseCreator()
else
OpenCreator()
end
end
if vehshop.opened then
local ped = LocalPed()
local menu = vehshop.menu[vehshop.currentmenu]
drawTxt(vehshop.title,1,1,vehshop.menu.x,vehshop.menu.y,1.0, 255,255,255,255)
drawMenuTitle(menu.title, vehshop.menu.x,vehshop.menu.y + 0.08)
drawTxt(vehshop.selectedbutton.."/"..tablelength(menu.buttons),0,0,vehshop.menu.x + vehshop.menu.width/2 - 0.0385,vehshop.menu.y + 0.067,0.4, 255,255,255,255)
local y = vehshop.menu.y + 0.12
buttoncount = tablelength(menu.buttons)
local selected = false
for i,button in pairs(menu.buttons) do
if i >= vehshop.menu.from and i <= vehshop.menu.to then
if i == vehshop.selectedbutton then
selected = true
else
selected = false
end
drawMenuButton(button,vehshop.menu.x,y,selected)
if button.costs ~= nil then
if vehshop.currentmenu == "compacts" or vehshop.currentmenu == "coupes" or vehshop.currentmenu == "sedans" or vehshop.currentmenu == "sports" or vehshop.currentmenu == "sportsclassics" or vehshop.currentmenu == "super" or vehshop.currentmenu == "muscle" or vehshop.currentmenu == "offroad" or vehshop.currentmenu == "suvs" or vehshop.currentmenu == "vans" or vehshop.currentmenu == "industrial" or vehshop.currentmenu == "cycles" or vehshop.currentmenu == "motorcycles" then
DoesPlayerHaveVehicle(button.model,button,y,selected)
else
drawMenuRight(button.costs.."$",vehshop.menu.x,y,selected)
end
end
y = y + 0.04
if vehshop.currentmenu == "compacts" or vehshop.currentmenu == "coupes" or vehshop.currentmenu == "sedans" or vehshop.currentmenu == "sports" or vehshop.currentmenu == "sportsclassics" or vehshop.currentmenu == "super" or vehshop.currentmenu == "muscle" or vehshop.currentmenu == "offroad" or vehshop.currentmenu == "suvs" or vehshop.currentmenu == "vans" or vehshop.currentmenu == "industrial" or vehshop.currentmenu == "cycles" or vehshop.currentmenu == "motorcycles" then
if selected then
if fakecar.model ~= button.model then
if DoesEntityExist(fakecar.car) then
Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(fakecar.car))
end
local pos = currentlocation.pos.inside
local hash = GetHashKey(button.model)
RequestModel(hash)
while not HasModelLoaded(hash) do
Citizen.Wait(0)
drawTxt("~b~Loading...",0,1,0.5,0.5,1.5,255,255,255,255)
end
local veh = CreateVehicle(hash,pos[1],pos[2],pos[3],pos[4],false,false)
while not DoesEntityExist(veh) do
Citizen.Wait(0)
drawTxt("~b~Loading...",0,1,0.5,0.5,1.5,255,255,255,255)
end
FreezeEntityPosition(veh,true)
SetEntityInvincible(veh,true)
SetVehicleDoorsLocked(veh,4)
--SetEntityCollision(veh,false,false)
TaskWarpPedIntoVehicle(LocalPed(),veh,-1)
for i = 0,24 do
SetVehicleModKit(veh,0)
RemoveVehicleMod(veh,i)
end
fakecar = { model = button.model, car = veh}
end
end
end
if selected and IsControlJustPressed(1,201) then
ButtonSelected(button)
end
end
end
end
if vehshop.opened then
if IsControlJustPressed(1,202) then
Back()
end
if IsControlJustReleased(1,202) then
backlock = false
end
if IsControlJustPressed(1,27) then
if vehshop.selectedbutton > 1 then
vehshop.selectedbutton = vehshop.selectedbutton -1
if buttoncount > 10 and vehshop.selectedbutton < vehshop.menu.from then
vehshop.menu.from = vehshop.menu.from -1
vehshop.menu.to = vehshop.menu.to - 1
end
end
end
if IsControlJustPressed(1,173)then
if vehshop.selectedbutton < buttoncount then
vehshop.selectedbutton = vehshop.selectedbutton +1
if buttoncount > 10 and vehshop.selectedbutton > vehshop.menu.to then
vehshop.menu.to = vehshop.menu.to + 1
vehshop.menu.from = vehshop.menu.from + 1
end
end
end
end
end
end)
AddEventHandler('FinishMoneyCheckForVeh', function(name, vehicle, price)
local name = name
local vehicle = vehicle
local price = price
boughtcar = true
CloseCreator(name, vehicle, price)
end)
AddEventHandler('vehshop:leftvehicle', function()
TriggerEvent("pNotify:SendNotification", { type = "info", timeout = 1000, layout = "centerLeft", text = "TEST"})
local player = GetPlayerPed(-1)
local posPlayer = GetEntityCoords(player, false)
local playerX, playerY, playerZ = posPlayer.x, posPlayer.y, posPlayer.z
local radius = 2.0
local nearestVeh = GetClosestVehicle(playerX, playerY, playerZ, radius, 0, 19)
local nearestVehPlate = GetVehicleNumberPlateText(nearestVeh)
LastPosX, LastPosY, LastPosZ = table.unpack(GetEntityCoords(nearestVeh, true))
local LastPosH = GetEntityHeading(nearestVeh)
if nearestVehPlate ~= nil then
TriggerServerEvent('vehshop:checkveh', nearestVeh, nearestVehPlate, LastPosX, LastPosY, LastPosZ, LastPosH)
end
end)
AddEventHandler('veh:spawn', function(vehicle, plate, state, primarycolor, secondarycolor, pearlescentcolor, wheelcolor, lastpos)
local ToSpawnPos = json.decode(lastpos)
local X = tonumber(ToSpawnPos[1])
local Y = tonumber(ToSpawnPos[2])
local Z = tonumber(ToSpawnPos[3])
local H = tonumber(ToSpawnPos[4])
local car = GetHashKey(vehicle)
local plate = plate
local state = state
local primarycolor = tonumber(primarycolor)
local secondarycolor = tonumber(secondarycolor)
local pearlescentcolor = tonumber(pearlescentcolor)
local wheelcolor = tonumber(wheelcolor)
local playerPed = GetPlayerPed(-1)
local mods = {}
for i = 0,24 do
mods[i] = GetVehicleMod(veh,i)
end
RequestModel(car)
while not HasModelLoaded(car) do
Citizen.Wait(0)
end
local caisseo = GetClosestVehicle(X, Y, Z, 10.001, 0, 19)
local caisseoplate = GetVehicleNumberPlateText(caisseo)
--SetNotificationTextEntry("STRING")
--AddTextComponentString("DB="..plate)
local isVehiculeInWorld = false
if caisseo ~= 0 and caisseo ~= nil then
Citizen.Trace("SpawnVeh: un vehicule occupe la place")
if (caisseoplate ~= plate) then
Citizen.Trace("SpawnVeh: La plaque est differente on fait spawn les vehicule")
Citizen.Trace(tostring(caisseoplate) .. "!=" .. tostring(plate))
X = GetOffsetFromEntityInWorldCoords(caisseo, 2.5, 0, 0)
else
Citizen.Trace("SpawnVeh: Il s'agit de votre vehicule")
isVehiculeInWorld = true
end
else
Citizen.Trace("SpawnVeh: Aucun vehicule trouvé sur la place, creation du vehicule")
end
if isVehiculeInWorld == false then
veh = CreateVehicle(car, X, Y, Z, H, true, false)
for i,mod in pairs(mods) do
SetVehicleModKit(personalvehicle,0)
SetVehicleMod(personalvehicle,i,mod)
end
SetVehicleNumberPlateText(veh, plate)
SetVehicleOnGroundProperly(veh)
SetVehicleHasBeenOwnedByPlayer(veh,true)
local id = NetworkGetNetworkIdFromEntity(veh)
SetNetworkIdCanMigrate(id, true)
SetVehicleColours(veh, primarycolor, secondarycolor)
SetVehicleExtraColours(veh, pearlescentcolor, wheelcolor)
SetEntityInvincible(veh, false)
end
end)
-- Citizen.CreateThread(function()
-- while true do
-- Wait(0)
-- if IsControlJustReleased(1, 38) then
-- -- local player = GetPlayerPed(-1)
-- -- local posPlayer = GetEntityCoords(player, false)
-- -- local playerX, playerY, playerZ = posPlayer.x, posPlayer.y, posPlayer.z
-- -- local radius = 5.0
-- -- local nearestVeh = GetClosestVehicle(playerX, playerY, playerZ, radius, 0, 19)
-- -- local nearestVehPlate = GetVehicleNumberPlateText(nearestVeh)
-- -- SetNotificationTextEntry("STRING")
-- -- if nearestVehPlate == nil then
-- -- AddTextComponentString(nearestVeh)
-- -- else
-- -- AddTextComponentString(nearestVehPlate ..":".. nearestVeh)
-- -- end
-- -- DrawNotification(false, false)
-- end
-- end
-- end)
AddEventHandler('playerSpawned', function(spawn)
if firstspawn == 0 then
--326 car blip 227 225
ShowVehshopBlips(true)
firstspawn = 1
end
end)
AddEventHandler("playerFirstSpawn", function()
ShowVehshopBlips(true)
end)
RegisterNetEvent("veh:BlibAfterRestart")
AddEventHandler("veh:BlibAfterRestart", function()
ShowVehshopBlips(true)
end)
AddEventHandler('vehshop:spawnVehicle', function(v)
local car = GetHashKey(v)
local playerPed = GetPlayerPed(-1)
if playerPed and playerPed ~= -1 then
RequestModel(car)
while not HasModelLoaded(car) do
Citizen.Wait(0)
end
local playerCoords = GetEntityCoords(playerPed)
veh = CreateVehicle(car, playerCoords, 0.0, true, false)
TaskWarpPedIntoVehicle(playerPed, veh, -1)
SetEntityInvincible(veh, true)
end
end)
local firstspawn = 0
AddEventHandler('playerSpawned', function(spawn)
if firstspawn == 0 then
RemoveIpl('v_carshowroom')
RemoveIpl('shutter_open')
RemoveIpl('shutter_closed')
RemoveIpl('shr_int')
RemoveIpl('csr_inMission')
RequestIpl('v_carshowroom')
RequestIpl('shr_int')
RequestIpl('shutter_closed')
local utext = "SWAGCLIENT"
SetNotificationTextEntry("STRING")
AddTextComponentString(utext)
DrawNotification(false, false)
firstspawn = 1
end
end)
RegisterNetEvent("veh:test")
AddEventHandler("veh:test", function()
TriggerServerEvent('vehshop:retrieve')
end)
RegisterNetEvent("veh_s:notif")
AddEventHandler("veh_s:notif", function(text)
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(false, false)
end)
--Thread Garage :
local toDeleteVehicle = {}
local isInGarage = false
local function freezePlayer(id, freeze)
local player = id
SetPlayerControl(player, not freeze, false)
local ped = GetPlayerPed(player)
if not freeze then
if not IsEntityVisible(ped) then
SetEntityVisible(ped, true)
end
if not IsPedInAnyVehicle(ped) then
SetEntityCollision(ped, true)
end
FreezeEntityPosition(ped, false)
--SetCharNeverTargetted(ped, false)
SetPlayerInvincible(player, false)
else
if IsEntityVisible(ped) then
SetEntityVisible(ped, false)
end
SetEntityCollision(ped, false)
FreezeEntityPosition(ped, true)
--SetCharNeverTargetted(ped, true)
SetPlayerInvincible(player, true)
--RemovePtfxFromPed(ped)
if not IsPedFatallyInjured(ped) then
ClearPedTasksImmediately(ped)
end
end
end
freezePlayer(PlayerId(), false)
function TpTo(Coords)
RequestCollisionAtCoord(Coords.x, Coords.y, Coords.z)
freezePlayer(PlayerId(), true)
SetEntityCoords(GetPlayerPed(-1), Coords.x, Coords.y, Coords.z, 0, 0, 0, 0)
SetEntityHeading(GetPlayerPed(-1), Coords.heading)
while not HasCollisionLoadedAroundEntity(GetPlayerPed(-1)) do
Citizen.Wait(0)
end
ShutdownLoadingScreen()
DoScreenFadeIn(1500)
while IsScreenFadingIn() do
Citizen.Wait(0)
end
freezePlayer(PlayerId(), false)
end
function OpenGarageMenu(result)
ClearMenu()
MenuTitle = "Gestion Garage"
print(json.encode(result.garagePoint))
Menu.addButton("Acheter pour ".. " " ..result.price.."$", "BuyGarage", result.price)
Menu.addButton("Visiter", "VisitGarage", {garagePoint = result.garagePoint, sortieGarage = result.sortieGarage})
Menu.addButton("Vendre pour".. " " ..math.ceil(result.price/2).."$", "SellGarage", math.ceil(result.price/2))
Menu.addButton("Fermer le menu", "CloseMenu", {} )
Menu.hidden = false
end
function CloseMenu(fake)
ClearMenu()
Menu.hidden = true
end
Citizen.CreateThread(function()
while true do
Wait(0)
if not(Menu.hidden) then
Menu.renderGUI()
end
TriggerEvent("izone:isPlayerInZoneReturnResult", "gestionAchatGarage", function(result)
if result then
DisplayHelpText("Appuyez sur ~INPUT_CONTEXT~ pour "..result.displayedMessageInZone)
if IsControlJustPressed(1, 38) then
Menu.hidden = not(Menu.hidden)
if not(Menu.hidden) then
OpenGarageMenu(result)
end
end
else
if not(Menu.hidden) then
CloseMenu("OSEF")
end
end
end)
TriggerEvent("izone:isPlayerInZoneReturnResult", "sortieGarage", function(result)
if result then
local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
if z<0 then
if not(IsPedInAnyVehicle(GetPlayerPed(-1), false)) then
DisplayHelpText("Appuyez sur ~INPUT_CONTEXT~ pour "..result.displayedMessageInZone)
if IsControlJustPressed(1, 38) then
LeaveGarage(result)
end
else
LeaveGarageWithCar(result, "TODO")
end
end
end
end)
TriggerEvent("izone:isPlayerInZoneReturnResult", "entréeGarage", function(result)
if result then
if not(IsPedInAnyVehicle(GetPlayerPed(-1), false)) then
DisplayHelpText("Appuyez sur ~INPUT_CONTEXT~ pour "..result.displayedMessageInZone)
if IsControlJustPressed(1, 38) then
EnterGarage(result)
end
else
EnterGarageWithCar(result, "TODO")
end
end
end)
end
end)
function EnterGarage(result)
TriggerServerEvent("iGarage:playerGotAGarage", result, nil)
end
RegisterNetEvent("iGarage:returnPlayerGotAGarage")
AddEventHandler("iGarage:returnPlayerGotAGarage", function(isGotting, result, cars)
if isGotting then
if IsPedInAnyVehicle(GetPlayerPed(-1), false) then
Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(GetVehiclePedIsIn(GetPlayerPed(-1), false)))
end
isInGarage = true
TpTo(result.garagePoint)
if #cars ~= 0 then
SpawnCars(cars, result)
end
end
end)
function EnterGarageWithCar(result, carPlate)
local myCar = GetVehiclePedIsIn(GetPlayerPed(-1), false)
local plate = GetVehicleNumberPlateText(myCar)
TriggerServerEvent("iGarage:playerGotAGarage", result, plate)
end
function LeaveGarage(result)
for i=1, #toDeleteVehicle do
Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(toDeleteVehicle[i], false))
end
TpTo(result.finalPoint)
isInGarage = false
end
function LeaveGarageWithCar(result, carPlate)
TriggerServerEvent("iGarage:leaveGarageWithCar", result, plate)
-- faire spawn le véhicle puis le wrap dedans
-- mettre le véhicle à out
end
RegisterNetEvent("iGarage:returnLeaveGarageWithCar")
AddEventHandler("iGarage:returnLeaveGarageWithCar", function(result, car)
for i=1, #toDeleteVehicle do
Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(toDeleteVehicle[i], false))
end
TpTo(result.finalPoint)
SpawnCarOutSide(car, result)
isInGarage = false
end)
function BuyGarage(garagePrice) -- fonction appelées quand on clique sur le boutton.
TriggerServerEvent("iGarage:buyCheckForMoney", garagePrice)
end
function VisitGarage(Coords)
isInGarage = true
Citizen.CreateThread(function()
local nowTime = GetGameTimer()
TriggerEvent("pv:voip", "null")
TpTo(Coords.garagePoint)
-- on le fait entrer pendant 5 minutes maximum, ou (inclusif) alors quand il se rend sur la zone.
while isInGarage and (GetGameTimer() <= nowTime + 3000) do
Wait(0)
local playerPed = GetPlayerPed(-1)
for i=0, 32 do
if i ~= PlayerId() then
local otherPlayerPed = GetPlayerPed(i)
SetEntityLocallyInvisible(otherPlayerPed)
SetEntityNoCollisionEntity(playerPed, otherPlayerPed, true)
end
end
end
if isInGarage == false then
TriggerEvent("pNotify:notifyFromServer","Tu viens de sortir du garage, il t'a plut? Achète-le!", "success", "topCenter", true, 5000)
elseif GetGameTimer() > nowTime + 3000 then
TriggerEvent("pNotify:notifyFromServer","Le temps est écoulé, la visite t'a plut? N'hésite pas à acheter le garage!", "success", "topCenter", true, 5000)
TpTo(Coords.sortieGarage)
end
TriggerEvent("pv:voip", "default")
end)
end
function SellGarage(garageSellingPrice)
TriggerServerEvent("sellCheckForGotting", garageSellingPrice)
end
function DisplayHelpText(str)
SetTextComponentFormat("STRING")
AddTextComponentString(str)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end
RegisterNetEvent("izio:spawnCar") -- Débugg
AddEventHandler("izio:spawnCar", function(plate, model)
RequestModel(GetHashKey(model))
while not HasModelLoaded(GetHashKey(model)) do
Citizen.Wait(0)
end
local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local heading = GetEntityHeading(GetPlayerPed(-1))
veh = CreateVehicle(GetHashKey(model), x, y, z, heading, true, false) --
SetVehicleNumberPlateText(veh, plate)
SetVehicleOnGroundProperly(veh)
SetVehicleColours(veh, 24, 0)
end)
function SpawnCars(cars, result)
for i = 1, #cars do
vehicle = cars[i].model
plate = cars[i].plate
primarycolor = cars[i].colorprimary
secondarycolor = cars[i].colorsecondary
pearlescentcolor = cars[i].pearlescentcolor
wheelcolor = cars[i].wheelcolor
lastpos = result.spawnPointCar[i]
local X = tonumber(lastpos.x)
local Y = tonumber(lastpos.y)
local Z = tonumber(lastpos.z)
local H = tonumber(lastpos.heading)
local car = GetHashKey(vehicle)
local mods = {}
RequestModel(car)
while not HasModelLoaded(car) do
Citizen.Wait(0)
end
veh = CreateVehicle(car, X, Y, Z, H, false, false)
table.insert(toDeleteVehicle, veh)
for i = 0,24 do
mods[i] = GetVehicleMod(veh,i)
end
for i,mod in pairs(mods) do
SetVehicleModKit(veh,0)
SetVehicleMod(veh,i,mod)
end
SetVehicleNumberPlateText(veh, plate)
SetVehicleOnGroundProperly(veh)
SetVehicleColours(veh, primarycolor, secondarycolor)
SetVehicleExtraColours(veh, pearlescentcolor, wheelcolor)
end
end
function SpawnCarOutSide(car, result)
vehicle = car.model
plate = car.plate
primarycolor = car.colorprimary
secondarycolor = car.colorsecondary
pearlescentcolor = car.pearlescentcolor
wheelcolor = car.wheelcolor
lastpos = result.finalPoint
print(vehicle)
print(plate)
print(json.encode(lastpos))
local X = tonumber(lastpos.x)
local Y = tonumber(lastpos.y)
local Z = tonumber(lastpos.z)
local H = tonumber(lastpos.heading)
local modelHash = GetHashKey(vehicle)
local mods = {}
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Citizen.Wait(0)
end
veh = CreateVehicle(modelHash, X, Y, Z, H, true, false)
for i = 0,24 do
mods[i] = GetVehicleMod(veh,i)
end
for i,mod in pairs(mods) do
SetVehicleModKit(veh,0)
SetVehicleMod(veh,i,mod)
end
local netid = NetworkGetNetworkIdFromEntity(veh)
SetVehicleHasBeenOwnedByPlayer(veh,true)
SetNetworkIdCanMigrate(netid, true)
TaskWarpPedIntoVehicle(GetPlayerPed(-1), veh, -1)
SetEntityInvincible(veh, false)
SetEntityAsMissionEntity(veh, true, true)
SetVehicleNumberPlateText(veh, plate)
SetVehicleOnGroundProperly(veh)
SetVehicleColours(veh, primarycolor, secondarycolor)
SetVehicleExtraColours(veh, pearlescentcolor, wheelcolor)
end |
pg = pg or {}
pg.enemy_data_statistics_185 = {
[12000231] = {
cannon = 115,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 70039,
air = 0,
rarity = 5,
dodge = 30,
torpedo = 180,
durability_growth = 0,
antiaircraft = 165,
reload_growth = 0,
dodge_growth = 398,
hit_growth = 210,
star = 5,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 45,
base = 180,
durability = 15400,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 33,
luck = 5,
id = 12000231,
antiaircraft_growth = 0,
antisub = 0,
armor = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
608021,
608022,
608023,
608024
}
},
[12000301] = {
cannon = 7,
reload = 150,
speed_growth = 0,
cannon_growth = 540,
pilot_ai_template_id = 20005,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 24,
durability_growth = 4500,
antiaircraft = 30,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 144,
star = 1,
hit = 10,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 25,
base = 106,
durability = 220,
armor_growth = 0,
torpedo_growth = 2800,
luck_growth = 0,
speed = 15,
luck = 0,
id = 12000301,
antiaircraft_growth = 800,
antisub = 0,
armor = 0,
appear_fx = {
"appearQ"
},
equipment_list = {
100102
}
},
[12000302] = {
cannon = 10,
reload = 150,
speed_growth = 0,
cannon_growth = 600,
pilot_ai_template_id = 20005,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 28,
durability_growth = 5000,
antiaircraft = 30,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 120,
star = 1,
hit = 8,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 20,
base = 106,
durability = 250,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
speed = 15,
luck = 0,
id = 12000302,
antiaircraft_growth = 800,
antisub = 0,
armor = 0,
appear_fx = {
"appearQ"
},
equipment_list = {
100102
}
},
[12000303] = {
cannon = 13,
reload = 150,
speed_growth = 0,
cannon_growth = 660,
pilot_ai_template_id = 20005,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 32,
durability_growth = 5500,
antiaircraft = 30,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 120,
star = 1,
hit = 8,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 20,
base = 106,
durability = 280,
armor_growth = 0,
torpedo_growth = 3200,
luck_growth = 0,
speed = 15,
luck = 0,
id = 12000303,
antiaircraft_growth = 800,
antisub = 0,
armor = 0,
appear_fx = {
"appearQ"
},
equipment_list = {
100102
}
},
[12000304] = {
cannon = 19,
reload = 150,
speed_growth = 0,
cannon_growth = 740,
pilot_ai_template_id = 10001,
air = 0,
rarity = 3,
dodge = 18,
torpedo = 62,
durability_growth = 23800,
antiaircraft = 50,
reload_growth = 0,
dodge_growth = 264,
hit_growth = 210,
star = 3,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 60,
base = 340,
durability = 920,
armor_growth = 0,
torpedo_growth = 5000,
luck_growth = 0,
speed = 20,
luck = 0,
id = 12000304,
antiaircraft_growth = 1760,
antisub = 0,
armor = 0,
appear_fx = {
"appearQ"
},
equipment_list = {
1100010,
1100506
}
},
[12000305] = {
cannon = 0,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 20001,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 0,
durability_growth = 6800,
antiaircraft = 0,
reload_growth = 0,
dodge_growth = 0,
speed = 30,
star = 1,
hit = 8,
antisub_growth = 0,
air_growth = 0,
hit_growth = 120,
base = 90,
durability = 700,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
antiaircraft_growth = 0,
luck = 0,
battle_unit_type = 20,
id = 12000305,
antisub = 0,
armor = 0,
appear_fx = {
"appearsmall"
}
},
[12000306] = {
cannon = 0,
battle_unit_type = 35,
rarity = 1,
speed_growth = 0,
pilot_ai_template_id = 20001,
air = 0,
luck = 0,
dodge = 0,
wave_fx = "danchuanlanghuaxiao2",
cannon_growth = 0,
speed = 15,
reload_growth = 0,
dodge_growth = 0,
id = 12000306,
star = 1,
hit = 8,
antisub_growth = 0,
air_growth = 0,
reload = 150,
base = 70,
durability = 265,
armor_growth = 0,
torpedo_growth = 864,
luck_growth = 0,
hit_growth = 120,
armor = 0,
torpedo = 30,
durability_growth = 2550,
antisub = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
540100
}
},
[12000307] = {
cannon = 50,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 80000,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 100,
durability_growth = 2550,
antiaircraft = 0,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 1200,
star = 1,
hit = 81,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 15,
base = 80,
durability = 70,
armor_growth = 0,
torpedo_growth = 1080,
luck_growth = 0,
speed = 30,
luck = 0,
id = 12000307,
antiaircraft_growth = 0,
antisub = 0,
armor = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
540101
}
},
[12000331] = {
cannon = 160,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 70040,
air = 0,
rarity = 6,
dodge = 35,
torpedo = 240,
durability_growth = 0,
antiaircraft = 220,
reload_growth = 0,
dodge_growth = 462,
hit_growth = 210,
star = 6,
hit = 120,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 95,
base = 341,
durability = 26200,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 24,
luck = 10,
id = 12000331,
antiaircraft_growth = 0,
antisub = 0,
armor = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
608031,
608032,
608033,
608034
}
},
[12100101] = {
cannon = 5,
reload = 150,
speed_growth = 0,
cannon_growth = 300,
pilot_ai_template_id = 20005,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 27,
durability_growth = 4000,
antiaircraft = 25,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 144,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 25,
base = 135,
durability = 105,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
speed = 15,
luck = 0,
id = 12100101,
antiaircraft_growth = 800,
antisub = 0,
armor = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
1100100,
1100496
}
},
[12100102] = {
cannon = 12,
reload = 150,
speed_growth = 0,
cannon_growth = 1500,
pilot_ai_template_id = 20005,
air = 0,
rarity = 2,
dodge = 0,
torpedo = 15,
durability_growth = 16000,
antiaircraft = 35,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 144,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 35,
base = 136,
durability = 270,
armor_growth = 0,
torpedo_growth = 1200,
luck_growth = 0,
speed = 15,
luck = 0,
id = 12100102,
antiaircraft_growth = 1000,
antisub = 0,
armor = 0,
equipment_list = {
1100040,
1100570,
1100455
}
},
[12100103] = {
cannon = 35,
reload = 150,
speed_growth = 0,
cannon_growth = 2000,
pilot_ai_template_id = 20005,
air = 0,
rarity = 2,
dodge = 0,
torpedo = 0,
durability_growth = 33600,
antiaircraft = 40,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 144,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 60,
base = 137,
durability = 650,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 15,
luck = 0,
id = 12100103,
antiaircraft_growth = 1200,
antisub = 0,
armor = 0,
equipment_list = {
1100575,
100505
}
},
[12100104] = {
cannon = 0,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 20001,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 0,
durability_growth = 6800,
antiaircraft = 0,
reload_growth = 0,
dodge_growth = 0,
speed = 30,
star = 1,
hit = 8,
antisub_growth = 0,
air_growth = 0,
hit_growth = 120,
base = 90,
durability = 650,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
antiaircraft_growth = 0,
luck = 0,
battle_unit_type = 20,
id = 12100104,
antisub = 0,
armor = 0,
appear_fx = {
"appearsmall"
}
},
[12100105] = {
cannon = 0,
battle_unit_type = 35,
rarity = 1,
speed_growth = 0,
pilot_ai_template_id = 20001,
air = 0,
luck = 0,
dodge = 0,
wave_fx = "danchuanlanghuaxiao2",
cannon_growth = 0,
speed = 15,
reload_growth = 0,
dodge_growth = 0,
id = 12100105,
star = 1,
hit = 8,
antisub_growth = 0,
air_growth = 0,
reload = 150,
base = 70,
durability = 250,
armor_growth = 0,
torpedo_growth = 864,
luck_growth = 0,
hit_growth = 120,
armor = 0,
torpedo = 15,
durability_growth = 2550,
antisub = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
540100
}
},
[12100106] = {
cannon = 45,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 80000,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 85,
durability_growth = 2550,
antiaircraft = 0,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 1200,
star = 1,
hit = 81,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 15,
base = 138,
durability = 60,
armor_growth = 0,
torpedo_growth = 900,
luck_growth = 0,
speed = 30,
luck = 0,
id = 12100106,
antiaircraft_growth = 0,
antisub = 0,
armor = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
540101
}
},
[12100107] = {
cannon = 6,
battle_unit_type = 50,
rarity = 5,
speed_growth = 0,
pilot_ai_template_id = 10001,
air = 0,
luck = 0,
dodge = 15,
id = 12100107,
cannon_growth = 468,
speed = 33,
reload_growth = 0,
dodge_growth = 222,
reload = 150,
star = 5,
hit = 14,
antisub_growth = 0,
air_growth = 0,
torpedo = 54,
base = 356,
durability = 510,
armor_growth = 0,
torpedo_growth = 4491,
luck_growth = 0,
hit_growth = 210,
armor = 0,
durability_growth = 18800,
antiaircraft = 20,
antisub = 0,
antiaircraft_growth = 1638,
smoke = {
{
70,
{
{
"smoke",
{
-0.26,
0.686,
-0.081
}
}
}
},
{
40,
{
{
"smoke",
{
-0.46,
0.486,
-0.481
}
},
{
"smoke",
{
0.54,
0.486,
-0.481
}
}
}
}
},
appear_fx = {
"appearQ"
},
equipment_list = {
1100055,
1100100,
1100165,
1100495
}
}
}
return
|
if not ATTACHMENT then
ATTACHMENT = {}
end
ATTACHMENT.Name = "Kobra Reflex Sight"
--ATTACHMENT.ID = "base" -- normally this is just your filename
ATTACHMENT.Description = { TFA.AttachmentColors["="], "5% higher zoom", TFA.AttachmentColors["-"], "5% higher zoom time" }
ATTACHMENT.Icon = "entities/ins2_si_kobra.png" --Revers to label, please give it an icon though! This should be the path to a png, like "entities/tfa_ammo_match.png"
ATTACHMENT.ShortName = "KOBRA"
ATTACHMENT.WeaponTable = {
["VElements"] = {
["rail_sights"] = {
["active"] = true
},
["sight_kobra"] = {
["active"] = function(wep, val) TFA.INS2.AnimateSight(wep) return true end,
["ins2_sightanim_idle"] = "idle",
["ins2_sightanim_iron"] = "zoom",
},
["sights_folded"] = {
["active"] = false
},
["sight_kobra_lens"] = {
["active"] = true
}
},
["WElements"] = {
["rail_sights"] = {
["active"] = true
},
["sight_kobra"] = {
["active"] = true
},
["sights_folded"] = {
["active"] = false
},
["sight_kobra_lens"] = {
["active"] = true
}
},
["IronSightsPos"] = function( wep, val ) return wep.IronSightsPos_Kobra or val end,
["IronSightsAng"] = function( wep, val ) return wep.IronSightsAng_Kobra or val end,
["Secondary"] = {
["IronFOV"] = function( wep, val ) return wep.Secondary.IronFOV_Kobra or val * 0.95 end
},
["IronSightTime"] = function( wep, val ) return val * 1.05 end,
["INS2_SightVElement"] = "sight_kobra",
}
if not TFA_ATTACHMENT_ISUPDATING then
TFAUpdateAttachments()
end
|
local M = {}
function M.next()
M._search("")
end
function M.prev()
M._search("b")
end
function M._search(flag)
local indent_size = vim.fn.indent(".")
if indent_size >= 4 then
indent_size = 2
end
local pattern = [[\v^]] .. (" "):rep(indent_size) .. [[\{]]
vim.fn.search(pattern, flag)
end
return M
|
ITEM.name = "Mushroom"
ITEM.description = "A tasty edible mushroom."
ITEM.model = "models/devcon/mrp/props/mushroom_2.mdl"
ITEM.height = 1
ITEM.width = 1
ITEM.category = "Farming"
ITEM.uniqueID = "mushroom"
ITEM.price = 3
|
-- If the player touches the block, health is set to 0.
local trap= script.Parent
local function onTouch(otherPart)
local character= otherPart.Parent
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
humanoid.Health = 0
end
end
trap.Touched:Connect(onTouch) |
print (foo)
foo = "bar"
print (foo)
foo = nil
print (foo) |
local colors = require('codedark.colors')
local theme = {}
function theme.load_syntax()
local syntax = {
Comment = { fg = colors.green, style = 'italic' },
Constant = { fg = colors.blue },
String = { fg = colors.orange },
Character = { fg = colors.orange },
Number = { fg = colors.light_green },
Boolean = { fg = colors.blue },
Float = { fg = colors.light_green },
Identifier = { fg = colors.front },
Function = { fg = colors.front },
Statement = { fg = colors.blue },
Conditional = { fg = colors.blue },
Repeat = { fg = colors.blue },
Label = { fg = colors.blue },
Operator = { fg = colors.front },
Keyword = { fg = colors.blue },
pythonOperator = { fg = colors.pink },
Exception = { fg = colors.blue },
PreProc = { fg = colors.pink },
Include = { fg = colors.pink },
Define = { fg = colors.pink },
Macro = { fg = colors.pink },
PreCondit = { fg = colors.pink },
Type = { fg = colors.blue },
StorageClass = { fg = colors.blue },
Structure = { fg = colors.blue },
Typedef = { fg = colors.blue },
Special = { fg = colors.yellow_orange },
SpecialChar = { fg = colors.front },
Tag = { fg = colors.yellow },
Delimiter = { fg = colors.front },
SpecialComment = { fg = colors.green, style = 'italic' },
Debug = { fg = colors.front },
Underlined = { fg = colors.none, style = 'underline' },
Conceal = { fg = colors.front, bg = colors.back },
Ignore = { fg = colors.front },
Error = { fg = colors.red, bg = colors.back, style = 'undercurl', sp = colors.red },
Todo = { fg = colors.none, bg = colors.left_mid },
SpellBad = { fg = colors.red, bg = colors.back, style = 'undercurl', sp = colors.red },
SpellCap = { fg = colors.red, bg = colors.back, style = 'undercurl', sp = colors.red },
SpellRare = { fg = colors.red, bg = colors.back, style = 'undercurl', sp = colors.red },
SpellLocal = { fg = colors.red, bg = colors.back, style = 'undercurl', sp = colors.red },
}
return syntax
end
function theme.load_editor()
local editor = {
Normal = { fg = colors.front, bg = colors.back },
ColorColumn = { bg = colors.cursor_dark_dark },
Cursor = { fg = colors.cursor_dark, bg = colors.cursor_light },
CursorLine = { bg = colors.cursor_dark_dark },
CursorColumn = { bg = colors.cursor_dark_dark },
Directory = { fg = colors.blue, bg = colors.back },
DiffAdd = { bg = colors.diff_green_light },
DiffChange = { bg = colors.diff_red_dark },
DiffDelete = { bg = colors.diff_red_light },
DiffText = { bg = colors.diff_red_light },
EndOfBuffer = { fg = colors.line_number, bg = colors.back },
ErrorMsg = { fg = colors.red, bg = colors.back },
VertSplit = { fg = colors.split_dark, bg = colors.back },
Folded = { fg = colors.left_light, bg = colors.left_dark, style = 'underline' },
FoldColumn = { fg = colors.line_number, bg = colors.back },
SignColumn = { bg = colors.back },
IncSearch = { fg = colors.none, bg = colors.search_current },
LineNr = { fg = colors.line_number, bg = colors.back },
CursorLineNr = { fg = colors.popup_front, bg = colors.back },
MatchParen = { fg = colors.none, bg = colors.cursor_dark },
ModeMsg = { fg = colors.front, bg = colors.left_dark },
MoreMsg = { fg = colors.front, bg = colors.left_dark },
NonText = { fg = colors.line_number, bg = colors.back },
Pmenu = { fg = colors.popup_front, bg = colors.popup_back },
PmenuSel = { fg = colors.popup_front, bg = colors.popup_highlight_blue },
PmenuSbar = { bg = colors.popup_highlight_gray },
PmenuThumb = { bg = colors.popup_front },
Question = { fg = colors.blue, bg = colors.back },
Search = { fg = colors.none, bg = colors.search },
SpecialKey = { fg = colors.blue, bg = colors.none },
StatusLine = { fg = colors.front, bg = colors.left_mid },
StatusLineNC = { fg = colors.front, bg = colors.left_dark },
TabLine = { fg = colors.front, bg = colors.tab_other },
TabLineFill = { fg = colors.front, bg = colors.tab_outside },
TabLineSel = { fg = colors.front, bg = colors.blue },
Title = { fg = colors.none, bg = colors.none, style = 'bold' },
Visual = { fg = colors.none, bg = colors.selection },
VisualNOS = { fg = colors.none, bg = colors.selection },
WarningMsg = { fg = colors.orange, bg = colors.back },
WildMenu = { fg = colors.none, bg = colors.selection },
}
return editor
end
function theme.load_tree_sitter()
local tree_sitter = {
TSError = { fg = colors.red },
TSPunctDelimiter = { fg = colors.front },
TSPunctBracket = { fg = colors.front },
TSPunctSpecial = { fg = colors.front },
TSConstant = { fg = colors.yellow },
TSConstBuiltin = { fg = colors.blue },
TSConstMacro = { fg = colors.blue_green },
TSStringRegex = { fg = colors.orange },
TSString = { fg = colors.orange },
TSStringEscape = { fg = colors.yellow_orange },
TSCharacter = { fg = colors.orange },
TSNumber = { fg = colors.light_green },
TSBoolean = { fg = colors.blue },
TSFloat = { fg = colors.light_green },
TSAnnotation = { fg = colors.yellow },
TSAttribute = { fg = colors.blue_green },
TSNamespace = { fg = colors.blue_green },
TSFuncBuiltin = { fg = colors.yellow },
TSFunction = { fg = colors.yellow },
TSFuncMacro = { fg = colors.yellow },
TSParameter = { fg = colors.light_blue },
TSParameterReference = { fg = colors.light_blue },
TSMethod = { fg = colors.yellow },
TSField = { fg = colors.front },
TSProperty = { fg = colors.light_blue },
TSConstructor = { fg = colors.blue_green },
TSConditional = { fg = colors.pink },
TSRepeat = { fg = colors.pink },
TSLabel = { fg = colors.light_blue },
TSKeyword = { fg = colors.blue },
TSKeywordFunction = { fg = colors.pink },
TSKeywordOperator = { fg = colors.blue },
TSOperator = { fg = colors.front },
TSException = { fg = colors.pink },
TSType = { fg = colors.blue_green },
TSTypeBuiltin = { fg = colors.blue },
TSStructure = { fg = colors.light_blue },
TSInclude = { fg = colors.pink },
TSVariable = { fg = colors.front },
TSVariableBuiltin = { fg = colors.blue_green },
TSText = { fg = colors.yellow_orange },
TSStrong = { fg = colors.yellow_orange, style = 'bold' },
TSEmphasis = { fg = colors.yellow_orange, style = 'bold,italic' },
TSUnderline = { fg = colors.yellow_orange, style = 'underline' },
TSTitle = { fg = colors.yellow_orange },
TSLiteral = { fg = colors.yellow_orange },
TSURI = { fg = colors.yellow_orange },
TSTag = { fg = colors.blue },
TSTagDelimiter = { fg = colors.gray },
TSComment = { fg = colors.green, style = 'italic' },
}
return tree_sitter
end
function theme.load_plugins()
local plugins = {
-- Markdown
markdownBold = { fg = colors.blue, style = 'bold' },
markdownCode = { fg = colors.orange },
markdownRule = { fg = colors.blue, style = 'bold' },
markdownCodeDelimiter = { fg = colors.orange },
markdownHeadingDelimiter = { fg = colors.blue },
markdownFootnote = { fg = colors.orange },
markdownFootnoteDefinition = { fg = colors.orange },
markdownUrl = { fg = colors.light_blue, style = 'underline' },
markdownLinkText = { fg = colors.orange },
markdownEscape = { fg = colors.yellow_orange },
-- Asciidoc
asciidocAttributeEntry = { fg = colors.yellow_orange },
asciidocAttributeList = { fg = colors.pink },
asciidocAttributeRef = { fg = colors.yellow_orange },
asciidocHLabel = { fg = colors.blue, style = bold },
asciidocListingBlock = { fg = colors.orange },
asciidocMacroAttributes = { fg = colors.yellow_orange },
asciidocOneLineTitle = { fg = colors.blue, style = bold },
asciidocPassthroughBlock = { fg = colors.blue },
asciidocQuotedMonospaced = { fg = colors.orange },
asciidocTriplePlusPassthrough = { fg = colors.yellow },
asciidocMacro = { fg = colors.pink },
asciidocAdmonition = { fg = colors.orange },
asciidocQuotedEmphasized = { fg = colors.blue, style = italic },
asciidocQuotedEmphasized2 = { fg = colors.blue, style = italic },
asciidocQuotedEmphasizedItalic = { fg = colors.blue, style = italic },
-- JSON
jsonKeyword = { fg = colors.light_blue },
jsonEscape = { fg = colors.yellow_orange },
jsonNull = { fg = colors.blue },
jsonBoolean = { fg = colors.blue },
-- HTML
htmlTag = { fg = colors.gray },
htmlEndTag = { fg = colors.gray },
htmlTagName = { fg = colors.blue },
htmlSpecialTagName = { fg = colors.blue },
htmlArg = { fg = colors.light_blue },
-- JSX:
jsxTag = { fg = colors.gray },
jsxTagName = { fg = colors.blue },
jsxCloseString = { fg = colors.gray },
jsxCloseTag = { fg = colors.gray },
jsxComponentName = { fg = colors.blue },
jsxAttrib = { fg = colors.light_blue },
-- CSS:
cssBraces = { fg = colors.front },
cssInclude = { fg = colors.pink },
cssTagName = { fg = colors.yellow_orange },
cssClassName = { fg = colors.yellow_orange },
cssPseudoClass = { fg = colors.yellow_orange },
cssPseudoClassId = { fg = colors.yellow_orange },
cssPseudoClassLang = { fg = colors.yellow_orange },
cssIdentifier = { fg = colors.yellow_orange },
cssProp = { fg = colors.light_blue },
cssDefinition = { fg = colors.light_blue },
cssAttr = { fg = colors.orange },
cssAttrRegion = { fg = colors.orange },
cssColor = { fg = colors.orange },
cssFunction = { fg = colors.orange },
cssFunctionName = { fg = colors.orange },
cssVendor = { fg = colors.orange },
cssValueNumber = { fg = colors.orange },
cssValueLength = { fg = colors.orange },
cssUnitDecorators = { fg = colors.orange },
cssStyle = { fg = colors.light_blue },
cssImportant = { fg = colors.blue },
-- JavaScript:
jsVariableDef = { fg = colors.front },
jsFuncArgs = { fg = colors.light_blue },
jsFuncBlock = { fg = colors.light_blue },
jsRegexpString = { fg = colors.Lightred },
jsThis = { fg = colors.blue },
jsOperatorKeyword = { fg = colors.blue },
jsDestructuringBlock = { fg = colors.light_blue },
jsObjectKey = { fg = colors.light_blue },
jsGlobalObjects = { fg = colors.blue_green },
jsModuleKeyword = { fg = colors.light_blue },
jsClassDefinition = { fg = colors.blue_green },
jsClassKeyword = { fg = colors.blue },
jsExtendsKeyword = { fg = colors.blue },
jsExportDefault = { fg = colors.pink },
jsFuncCall = { fg = colors.yellow },
jsObjectValue = { fg = colors.light_blue },
jsParen = { fg = colors.light_blue },
jsObjectProp = { fg = colors.light_blue },
jsIfElseBlock = { fg = colors.light_blue },
jsParenIfElse = { fg = colors.light_blue },
jsSpreadOperator = { fg = colors.light_blue },
jsSpreadExpression = { fg = colors.light_blue },
-- Typescript:
typescriptLabel = { fg = colors.light_blue },
typescriptExceptions = { fg = colors.light_blue },
typescriptBraces = { fg = colors.front },
typescriptEndColons = { fg = colors.light_blue },
typescriptParens = { fg = colors.front },
typescriptDocTags = { fg = colors.blue },
typescriptDocComment = { fg = colors.blue_green },
typescriptLogicSymbols = { fg = colors.light_blue },
typescriptImport = { fg = colors.pink },
typescriptBOM = { fg = colors.light_blue },
typescriptVariableDeclaration = { fg = colors.light_blue },
typescriptVariable = { fg = colors.blue },
typescriptExport = { fg = colors.pink },
typescriptAliasDeclaration = { fg = colors.blue_green },
typescriptAliasKeyword = { fg = colors.blue },
typescriptClassName = { fg = colors.blue_green },
typescriptAccessibilityModifier = { fg = colors.blue },
typescriptOperator = { fg = colors.blue },
typescriptArrowFunc = { fg = colors.blue },
typescriptMethodAccessor = { fg = colors.blue },
typescriptMember = { fg = colors.yellow },
typescriptTypeReference = { fg = colors.blue_green },
typescriptDefault = { fg = colors.light_blue },
typescriptTemplateSB = { fg = colors.yellow_orange },
typescriptArrowFuncArg = { fg = colors.light_blue },
typescriptParamImpl = { fg = colors.light_blue },
typescriptFuncComma = { fg = colors.light_blue },
typescriptCastKeyword = { fg = colors.light_blue },
typescriptCall = { fg = colors.blue },
typescriptCase = { fg = colors.light_blue },
typescriptReserved = { fg = colors.pink },
typescriptDefault = { fg = colors.light_blue },
typescriptDecorator = { fg = colors.yellow },
typescriptPredefinedType = { fg = colors.blue_green },
typescriptClassHeritage = { fg = colors.blue_green },
typescriptClassExtends = { fg = colors.blue },
typescriptClassKeyword = { fg = colors.blue },
typescriptBlock = { fg = colors.light_blue },
typescriptDOMDocProp = { fg = colors.light_blue },
typescriptTemplateSubstitution = { fg = colors.light_blue },
typescriptClassBlock = { fg = colors.light_blue },
typescriptFuncCallArg = { fg = colors.light_blue },
typescriptIndexExpr = { fg = colors.light_blue },
typescriptConditionalParen = { fg = colors.light_blue },
typescriptArray = { fg = colors.yellow },
typescriptES6SetProp = { fg = colors.light_blue },
typescriptObjectLiteral = { fg = colors.light_blue },
typescriptTypeParameter = { fg = colors.blue_green },
typescriptEnumKeyword = { fg = colors.blue },
typescriptEnum = { fg = colors.blue_green },
typescriptLoopParen = { fg = colors.light_blue },
typescriptParenExp = { fg = colors.light_blue },
typescriptModule = { fg = colors.light_blue },
typescriptAmbientDeclaration = { fg = colors.blue },
typescriptModule = { fg = colors.blue },
typescriptFuncTypeArrow = { fg = colors.blue },
typescriptInterfaceHeritage = { fg = colors.blue_green },
typescriptInterfaceName = { fg = colors.blue_green },
typescriptInterfaceKeyword = { fg = colors.blue },
typescriptInterfaceExtends = { fg = colors.blue },
typescriptGlobal = { fg = colors.blue_green },
typescriptAsyncFuncKeyword = { fg = colors.blue },
typescriptFuncKeyword = { fg = colors.blue },
typescriptGlobalMethod = { fg = colors.yellow },
typescriptPromiseMethod = { fg = colors.yellow },
-- Ruby:
rubyClassNameTag = { fg = colors.blue_green },
rubyClassName = { fg = colors.blue_green },
rubyModuleName = { fg = colors.blue_green },
rubyConstant = { fg = colors.blue_green },
-- Graphql:
graphqlStructure = { fg = colors.blue },
graphqlType = { fg = colors.front },
graphqlName = { fg = colors.light_blue },
graphqlVariable = { fg = colors.pink },
-- Git:
gitcommitHeader = { fg = colors.gray },
gitcommitOnBranch = { fg = colors.gray },
gitcommitBranch = { fg = colors.pink },
gitcommitComment = { fg = colors.gray },
gitcommitSelectedType = { fg = colors.green },
gitcommitSelectedFile = { fg = colors.green },
gitcommitDiscardedType = { fg = colors.red },
gitcommitDiscardedFile = { fg = colors.red },
gitcommitOverflow = { fg = colors.red },
gitcommitSummary = { fg = colors.pink },
gitcommitBlank = { fg = colors.pink },
-- Lua:
luaFuncCall = { fg = colors.yellow },
luaFuncArgName = { fg = colors.light_blue },
luaFuncKeyword = { fg = colors.pink },
luaLocal = { fg = colors.pink },
luaBuiltIn = { fg = colors.blue },
}
return plugins
end
return theme
|
local skynet = require "skynet"
local SceneConst = require "game.scene.SceneConst"
local SceneHelper = require "game.scene.SceneHelper"
local RoleMgr = BaseClass()
function RoleMgr:Init( sceneMgr )
self.sceneMgr = sceneMgr
self.entityMgr = sceneMgr.entityMgr
self.aoi = sceneMgr.aoi
self.roleList = {}
self:InitArchetype()
end
function RoleMgr:GetRole( roleID )
return self.roleList[roleID]
end
function RoleMgr:InitArchetype( )
self.role_archetype = self.entityMgr:CreateArchetype({
"UMO.Position", "UMO.TargetPos", "UMO.UID", "UMO.TypeID", "UMO.HP", "UMO.SceneObjType", "UMO.MoveSpeed", "UMO.AOIHandle", "UMO.Beatable", "UMO.DamageEvents", "UMO.MsgAgent"
})
end
function RoleMgr:CreateRole( uid, roleID, pos_x, pos_y, pos_z, aoi_handle, agent )
local role = self.entityMgr:CreateEntityByArcheType(self.role_archetype)
self.entityMgr:SetComponentData(role, "UMO.Position", {x=pos_x, y=pos_y, z=pos_z})
self.entityMgr:SetComponentData(role, "UMO.TargetPos", {x=pos_x, y=pos_y, z=pos_z})
self.entityMgr:SetComponentData(role, "UMO.UID", uid)
self.entityMgr:SetComponentData(role, "UMO.TypeID", roleID)
self.entityMgr:SetComponentData(role, "UMO.HP", {cur=1000, max=1000})
self.entityMgr:SetComponentData(role, "UMO.SceneObjType", {value=SceneConst.ObjectType.Role})
self.entityMgr:SetComponentData(role, "UMO.MoveSpeed", {value=100})
self.entityMgr:SetComponentData(role, "UMO.AOIHandle", {value=aoi_handle})
self.entityMgr:SetComponentData(role, "UMO.MsgAgent", agent)
return role
end
function RoleMgr:GetBaseInfoByRoleID( roleID )
local gameDBServer = skynet.localname(".GameDBServer")
local is_ok, role_info = skynet.call(gameDBServer, "lua", "select_by_key", "RoleBaseInfo", "role_id", roleID)
if is_ok and role_info and role_info[1] then
return role_info[1]
end
return nil
end
function RoleMgr:GetLooksInfoByRoleID( roleID )
local gameDBServer = skynet.localname(".GameDBServer")
local is_ok, looks_info = skynet.call(gameDBServer, "lua", "select_by_key", "RoleLooksInfo", "role_id", roleID)
if is_ok and looks_info and looks_info[1] then
return looks_info[1]
end
return nil
end
function RoleMgr:InitPosInfo( baseInfo, targetDoor )
if not baseInfo then return end
local is_need_reset_pos = false
if not baseInfo.scene_id or self.sceneMgr.curSceneID ~= baseInfo.scene_id or not baseInfo.pos_x then
is_need_reset_pos = true
end
if is_need_reset_pos then
local born_list = self.sceneMgr.scene_cfg.born_list
local door_num = born_list and #born_list or 0
if door_num > 0 then
local random_index = math.random(1, door_num)
local born_info = born_list[random_index]
baseInfo.pos_x = born_info.pos_x
baseInfo.pos_y = born_info.pos_y
baseInfo.pos_z = born_info.pos_z
end
end
end
function RoleMgr:RoleEnter( roleID, agent )
print('Cat:RoleMgr.lua[role enter] self.roleList[roleID]', self.roleList[roleID], roleID)
if not self.roleList[roleID] then
local scene_uid = SceneHelper:NewSceneUID(SceneConst.ObjectType.Role)
local base_info = self:GetBaseInfoByRoleID(roleID)
local looks_info = self:GetLooksInfoByRoleID(roleID)
self:InitPosInfo(base_info)
local handle = self.sceneMgr.aoi:add()
self.sceneMgr.aoi:set_user_data(handle, "uid", scene_uid)
self.roleList[roleID] = {scene_uid=scene_uid, base_info=base_info, looks_info=looks_info, aoi_handle=handle, around_objs={}, radius_short=5000, radius_long=6000, fight_events_in_around={}}
-- self.sceneMgr:SetSceneObj(scene_uid, self.roleList[roleID])
-- self.aoi_handle_uid_map[handle] = scene_uid
self.sceneMgr.aoi:set_pos(handle, base_info.pos_x, base_info.pos_y, base_info.pos_z)
local entity = self:CreateRole(scene_uid, roleID, base_info.pos_x, base_info.pos_y, base_info.pos_z, handle, agent)
self.sceneMgr:SetEntity(scene_uid, entity)
-- self.sceneMgr.aoi:set_user_data(handle, "entity", entity)
local changeSceneStr = self.sceneMgr.curSceneID..","..base_info.pos_x..","..base_info.pos_y..","..base_info.pos_z
local change_scene_event_info = {key=SceneConst.InfoKey.SceneChange, value=changeSceneStr}
change_scene_event_info.is_private = true
-- self.sceneMgr.eventMgr:AddSceneEvent(scene_uid, change_scene_event_info)
self.roleList[roleID].change_obj_infos = SceneHelper.AddInfoItem(self.roleList[roleID].change_obj_infos, scene_uid, change_scene_event_info)
end
end
local save_role_pos = function ( role_id, pos_x, pos_y, pos_z, scene_id )
local gameDBServer = skynet.localname(".GameDBServer")
is_succeed = skynet.call(gameDBServer, "lua", "update", "RoleBaseInfo", "role_id", role_id, {pos_x=pos_x, pos_y=pos_y, pos_z=pos_z, scene_id=scene_id})
end
function RoleMgr:RoleLeave( roleID )
local role_info = self.roleList[roleID]
print('Cat:RoleMgr.lua[role_leave_scene] roleID', roleID, role_info)
if not role_info then return end
self.sceneMgr.aoi:remove(role_info.aoi_handle)
-- self.sceneMgr.aoi_handle_uid_map[role_info.aoi_handle] = nil --角色离开后还需要通过aoi_handle获取ta的uid
save_role_pos(roleID, role_info.base_info.pos_x, role_info.base_info.pos_y, role_info.base_info.pos_z, self.sceneMgr.curSceneID)
if role_info.ack_scene_get_objs_info_change then
role_info.ack_scene_get_objs_info_change(true, {})
role_info.ack_scene_get_objs_info_change = nil
end
if role_info.ack_scene_listen_fight_event then
role_info.ack_scene_listen_fight_event(true, {})
role_info.ack_scene_listen_fight_event = nil
end
self.roleList[roleID] = nil
end
function RoleMgr:GetMainRoleInfo( roleID )
local role_info = self.roleList[roleID]
local base_info = role_info and role_info.base_info or nil
if base_info then
local entity = self.sceneMgr:GetEntity(self.roleList[roleID].scene_uid)
local hpData = self.sceneMgr.entityMgr:GetComponentData(entity, "UMO.HP")
local result = {
role_info={
scene_uid = self.roleList[roleID].scene_uid,
role_id = roleID,
career = base_info.career,
name = base_info.name,
scene_id = self.sceneMgr.curSceneID,
pos_x = base_info.pos_x,
pos_y = base_info.pos_y,
pos_z = base_info.pos_z,
cur_hp = hpData.cur,
max_hp = hpData.max,
base_info = {
level = 0,
},
}
}
return result
else
--cannot find main role?
return {
role_info={
scene_uid=self.roleList[roleID].scene_uid,
role_id=roleID,
career=2,
name="unknow_role_name",
scene_id = self.sceneMgr.curSceneID,
pos_x = 0,
pos_y = 0,
pos_z = 0,
base_info = {
level = 0,
},
}
}
end
end
function RoleMgr:GetRoleLooksInfo( uid )
local looks_info
local entity = self.sceneMgr:GetEntity(uid)
if entity then
local hpData = self.sceneMgr.entityMgr:GetComponentData(entity, "UMO.HP")
local role_id = self.sceneMgr.entityMgr:GetComponentData(entity, "UMO.TypeID")
local role_info = self:GetRole(role_id)
if not role_info then
looks_info = {result=1}
end
looks_info = {
result = 0,
role_looks_info = {
career = role_info.base_info.career or 1,
name = role_info.base_info.name,
hp = hpData.cur,
max_hp = hpData.max,
body = role_info.looks_info.body or 0,
hair = role_info.looks_info.hair or 0,
weapon = role_info.looks_info.weapon or 0,
wing = role_info.looks_info.wing or 0,
horse = 0,
}
}
else
looks_info = {result=1}
end
return looks_info
end
function RoleMgr:RoleWalk( roldID, req_data )
local role_info = self.roleList[roldID]
if role_info and role_info.base_info then
-- role_info.base_info.pos = {x=req_data.start_x, y=req_data.start_y, z=req_data.start_z}
role_info.base_info.pos_x = req_data.start_x
role_info.base_info.pos_y = req_data.start_y
role_info.base_info.pos_z = req_data.start_z
local entity = self.sceneMgr:GetEntity(role_info.scene_uid)
if entity then
self.sceneMgr.entityMgr:SetComponentData(entity, "UMO.Position", {x=req_data.start_x, y=req_data.start_y, z=req_data.start_z})
self.sceneMgr.entityMgr:SetComponentData(entity, "UMO.TargetPos", {x=req_data.end_x, y=req_data.start_y, z=req_data.end_z})
end
self.sceneMgr.aoi:set_pos(role_info.aoi_handle, role_info.base_info.pos_x, role_info.base_info.pos_y, role_info.base_info.pos_z)
local pos_info = role_info.base_info.pos_x..","..role_info.base_info.pos_y..","..role_info.base_info.pos_z
local target_pos_info = req_data.end_x..","..req_data.end_z
local cur_time = Time.timeMS
-- local change_pos_event_info = {key=SceneConst.InfoKey.PosChange, value=pos_info, time= cur_time}
local change_target_pos_event_info = {key=SceneConst.InfoKey.TargetPos, value=target_pos_info, time=cur_time}
self.sceneMgr.eventMgr:AddSceneEvent(role_info.scene_uid, change_target_pos_event_info)
if req_data.jump_state ~= 0 then
-- table.insert(self.sceneMgr.event_list[role_info.scene_uid], {key=SceneConst.InfoKey.JumpState, value="1", time=cur_time})
self.sceneMgr.eventMgr:AddSceneEvent(role_info.scene_uid, {key=SceneConst.InfoKey.JumpState, value="1", time=cur_time})
end
end
return {}
end
return RoleMgr |
#!/usr/bin/env tarantool
local tap = require('tap')
local ffi = require('ffi')
ffi.cdef([[
void *dlsym(void *handle, const char *symbol);
struct curl_version_info_data {
int age; /* see description below */
const char *version; /* human readable string */
unsigned int version_num; /* numeric representation */
const char *host; /* human readable string */
int features; /* bitmask, see below */
char *ssl_version; /* human readable string */
long ssl_version_num; /* not used, always zero */
const char *libz_version; /* human readable string */
const char * const *protocols; /* protocols */
/* when 'age' is CURLVERSION_SECOND or higher, the members below exist */
const char *ares; /* human readable string */
int ares_num; /* number */
/* when 'age' is CURLVERSION_THIRD or higher, the members below exist */
const char *libidn; /* human readable string */
/* when 'age' is CURLVERSION_FOURTH or higher (>= 7.16.1), the members
below exist */
int iconv_ver_num; /* '_libiconv_version' if iconv support enabled */
const char *libssh_version; /* human readable string */
/* when 'age' is CURLVERSION_FIFTH or higher (>= 7.57.0), the members
below exist */
unsigned int brotli_ver_num; /* Numeric Brotli version
(MAJOR << 24) | (MINOR << 12) | PATCH */
const char *brotli_version; /* human readable string. */
/* when 'age' is CURLVERSION_SIXTH or higher (>= 7.66.0), the members
below exist */
unsigned int nghttp2_ver_num; /* Numeric nghttp2 version
(MAJOR << 16) | (MINOR << 8) | PATCH */
const char *nghttp2_version; /* human readable string. */
const char *quic_version; /* human readable quic (+ HTTP/3) library +
version or NULL */
/* when 'age' is CURLVERSION_SEVENTH or higher (>= 7.70.0), the members
below exist */
const char *cainfo; /* the built-in default CURLOPT_CAINFO, might
be NULL */
const char *capath; /* the built-in default CURLOPT_CAPATH, might
be NULL */
};
struct curl_version_info_data *curl_version_info(int age);
]])
local info = ffi.C.curl_version_info(7)
local test = tap.test('curl-features')
test:plan(5)
if test:ok(info.ssl_version ~= nil, 'Curl built with SSL support') then
test:diag('ssl_version: ' .. ffi.string(info.ssl_version))
end
if test:ok(info.libz_version ~= nil, 'Curl built with LIBZ') then
test:diag('libz_version: ' .. ffi.string(info.libz_version))
end
local RTLD_DEFAULT
-- See `man 3 dlsym`:
-- RTLD_DEFAULT
-- Find the first occurrence of the desired symbol using the default
-- shared object search order. The search will include global symbols
-- in the executable and its dependencies, as well as symbols in shared
-- objects that were dynamically loaded with the RTLD_GLOBAL flag.
if jit.os == "OSX" then
RTLD_DEFAULT = ffi.cast("void *", -2LL)
else
RTLD_DEFAULT = ffi.cast("void *", 0LL)
end
--
-- gh-5223: Check if all curl symbols are exported.
--
-- The following list was obtained by parsing libcurl.a static library:
-- nm libcurl.a | grep -oP 'T \K(curl_.+)$' | sort
local curl_symbols = {
'curl_easy_cleanup',
'curl_easy_duphandle',
'curl_easy_escape',
'curl_easy_getinfo',
'curl_easy_init',
'curl_easy_pause',
'curl_easy_perform',
'curl_easy_recv',
'curl_easy_reset',
'curl_easy_send',
'curl_easy_setopt',
'curl_easy_strerror',
'curl_easy_unescape',
'curl_easy_upkeep',
'curl_escape',
'curl_formadd',
'curl_formfree',
'curl_formget',
'curl_free',
'curl_getdate',
'curl_getenv',
'curl_global_cleanup',
'curl_global_init',
'curl_global_init_mem',
'curl_global_sslset',
'curl_maprintf',
'curl_mfprintf',
'curl_mime_addpart',
'curl_mime_data',
'curl_mime_data_cb',
'curl_mime_encoder',
'curl_mime_filedata',
'curl_mime_filename',
'curl_mime_free',
'curl_mime_headers',
'curl_mime_init',
'curl_mime_name',
'curl_mime_subparts',
'curl_mime_type',
'curl_mprintf',
'curl_msnprintf',
'curl_msprintf',
'curl_multi_add_handle',
'curl_multi_assign',
'curl_multi_cleanup',
'curl_multi_fdset',
'curl_multi_info_read',
'curl_multi_init',
'curl_multi_perform',
'curl_multi_poll',
'curl_multi_remove_handle',
'curl_multi_setopt',
'curl_multi_socket',
'curl_multi_socket_action',
'curl_multi_socket_all',
'curl_multi_strerror',
'curl_multi_timeout',
'curl_multi_wait',
'curl_mvaprintf',
'curl_mvfprintf',
'curl_mvprintf',
'curl_mvsnprintf',
'curl_mvsprintf',
'curl_pushheader_byname',
'curl_pushheader_bynum',
'curl_share_cleanup',
'curl_share_init',
'curl_share_setopt',
'curl_share_strerror',
'curl_slist_append',
'curl_slist_free_all',
'curl_strequal',
'curl_strnequal',
'curl_unescape',
'curl_url',
'curl_url_cleanup',
'curl_url_dup',
'curl_url_get',
'curl_url_set',
'curl_version',
'curl_version_info',
}
test:test('curl_symbols', function(t)
t:plan(#curl_symbols)
for _, sym in ipairs(curl_symbols) do
t:ok(
ffi.C.dlsym(RTLD_DEFAULT, sym) ~= nil,
('Symbol %q found'):format(sym)
)
end
end)
local function has_protocol(protocol_str)
local i = 0
-- curl_version_info_data.protocols is a null terminated array
-- of pointers to char.
-- See curl/lib/version.c:
-- static const char * const protocols[]
local info = ffi.C.curl_version_info(7)
local protocol = info.protocols[i]
while protocol ~= nil do
if ffi.string(protocol) == protocol_str then
return true
end
i = i + 1
protocol = info.protocols[i]
end
return false
end
--
-- gh-4559: check if smtp and smtps protocols are enabled.
--
test:ok(has_protocol('smtp'), 'smtp protocol is supported')
test:ok(has_protocol('smtps'), 'smtps protocol is supported')
os.exit(test:check() and 0 or 1)
|
local config_loader = require 'config_loader'
local http = require "resty.http"
local function make_http_request(method, uri, headers)
local configs = config_loader.get_spectre_config_for_namespace(config_loader.CASPER_INTERNAL_NAMESPACE)['http']
local httpc = http.new()
httpc:set_timeout(configs['timeout_ms'])
-- If body data is already read by some module use it.
local body = ngx.var.request_body
if body == nil then
-- Load client body reader if body is not loaded already.
local _
body, _= httpc:get_client_body_reader()
end
local response, error_message = httpc:request_uri(uri, {
method = method,
body = body,
headers = headers,
})
return response, error_message
end
return {
make_http_request = make_http_request
}
|
-- Created by LuaView.
-- Copyright (c) 2017, Alibaba Group. All rights reserved.
--
-- This source code is licensed under the MIT.
-- For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
require "kit/lv_kit"
print(type(System))
print(System.ios())
print(System.android())
print(System.vmVersion())
print(System.osVersion())
print(System.platform())
print(System.scale())
printTable(System.device())
print(System.screenSize())
-- network
Timer(function()
print("Timer--" .. System.network())
end).start(1, true)
System.gc()
print(window.size())
btn1 = Button();
btn1.text("Screen-On")
btn1.xy(0, 0)
btn1.callback(function()
System.keepScreenOn()
end)
btn2 = Button()
btn2.xy(120, 0)
btn2.text("Screen-Off")
btn2.callback(function()
System.keepScreenOn(false)
end)
print("System.ios = " , System.ios() )
print("System.android = ", System.android() )
print("System.vmVersion = ", System.vmVersion() )
print("System.osVersion = ", System.osVersion() ) --获取手机操作系统版本号
print("System.platform = ", System.platform() ) --获取平台信息
print("System.scale = ", System.scale() ) --获取屏幕分辨率
print("System.device = ", System.device() ) --获取设备信息
print("System.screenSize() = ", System.screenSize() ); |
local PANEL = {}
function PANEL:Init()
self:SetSize(256, 280)
self:Center()
self:MakePopup()
self:SetTitle("Faction Editor")
self.scroll = self:Add("DScrollPanel")
self.scroll:Dock(FILL)
self.scroll:DockPadding(0, 0, 0, 4)
self.factions = {}
self.classes = {}
for k, v in ipairs(ix.faction.indices) do
local panel = self.scroll:Add("DPanel")
panel:Dock(TOP)
panel:DockPadding(4, 4, 4, 4)
panel:DockMargin(0, 0, 0, 4)
local faction = panel:Add("DCheckBoxLabel")
faction:Dock(TOP)
faction:SetText(L(v.name))
faction:DockMargin(0, 0, 0, 4)
faction.OnChange = function(this, state)
self:updateVendor("faction", v.uniqueID)
end
self.factions[v.uniqueID] = faction
for _, v2 in ipairs(ix.class.list) do
if (v2.faction == k) then
local class = panel:Add("DCheckBoxLabel")
class:Dock(TOP)
class:DockMargin(16, 0, 0, 4)
class:SetText(L(v2.name))
class.OnChange = function(this, state)
self:updateVendor("class", v2.uniqueID)
end
self.classes[v2.uniqueID] = class
panel:SetTall(panel:GetTall() + class:GetTall() + 4)
end
end
end
end
function PANEL:Setup()
for k, _ in pairs(self.entity.factions or {}) do
self.factions[k]:SetChecked(true)
end
for k, _ in pairs(self.entity.classes or {}) do
self.classes[k]:SetChecked(true)
end
end
function PANEL:updateVendor(key, value)
net.Start("ixContainerUpdate")
net.WriteEntity(self.entity)
net.WriteString(key)
net.WriteType(value)
net.SendToServer()
end
net.Receive("ixBuildContainerFactionEditor", function()
local entity = net.ReadEntity()
local factions = net.ReadTable()
local classes = net.ReadTable()
ix.gui.containerFaction = vgui.Create("ixContainerFactionEditor")
ix.gui.containerFaction.entity = entity
ix.gui.containerFaction.entity.factions = factions
ix.gui.containerFaction.entity.classes = classes
ix.gui.containerFaction:Setup()
end)
vgui.Register("ixContainerFactionEditor", PANEL, "DFrame")
|
require "/scripts/augments/item.lua"
function apply(input)
--for k, v in pairs(_ENV) do sb.logInfo(string.format("%s \"%s\"", type(v), k)) end
local data = config.getParameter("catalystData") or { }
local output = Item.new(input)
if not output:instanceValue("acceptsUpgradeCatalyst") then return nil end -- only on compatible items (pulse weapons etc.)
local consume = 1
local ilevel = output:instanceValue("level") or 1
if data.level then
if ilevel >= data.level then consume = 0 -- no non-upgrades
else output:setInstanceValue("level", data.level) end
end
local odata = output:instanceValue("catalystData") or { }
if ilevel > (data.level or 1) then -- preserve name and level if already on higher tier, while taking other attributes
data.name = odata.name or data.name
data.level = odata.level or data.level
end
output:setInstanceValue("catalystData", data)
output:setInstanceValue("_catalystUpdated", true)
return output:descriptor(), consume
end
|
------------------------------------------Overview------------------------------------------
-- Name: Notification Functions
-- Notes: Copyright (c) 2017 Jeremy Gulickson
-- Version: 1.0.03112017
-- Usage: Functions to simplify common notification operations.
--
-- Requirements: FXTS (FXCM Trading Station)
-- Download Link: http://download.fxcorporate.com/FXCM/FXTS2Install.EXE
-- Documentation: http://www.fxcodebase.com/bin/products/IndicoreSDK/3.3.0/help/Lua/web-content.htm
--
---------------------------------------Version History--------------------------------------
-- v1.0.11062014: Initial release
--
--------------------------------------------------------------------------------------------
function Send_Notification(aType, aSymbol, aOpen, aMessage, aTime, aEmailAddress)
if aType == "Alert" then
terminal:alertMessage(aSymbol, aOpen, aMessage, aTime);
elseif aType == "Trace" then
core.host:trace(aMessage);
elseif aType == "Email" then
local zTime_In_Table = core.dateToTable(aTime);
local zDate = string.format("%02i/%02i/%02i", zTime_In_Table.month, zTime_In_Table.day, zTime_In_Table.year);
local zTime =string.format("%02i:%02i", zTime_In_Table.hour, zTime_In_Table.min);
terminal:alertEmail(aEmailAddress, "ADD TEXT HERE " .. zDate .. " at " .. zTime, aMessage);
else
core.host:trace("Send_Notification() Failed | In Else Clause");
end
end |
pg = pg or {}
pg.enemy_data_statistics_178 = {
[11800221] = {
cannon = 35,
reload = 150,
speed_growth = 0,
cannon_growth = 1200,
pilot_ai_template_id = 10001,
air = 0,
rarity = 5,
dodge = 19,
torpedo = 120,
durability_growth = 105600,
antiaircraft = 85,
reload_growth = 0,
dodge_growth = 270,
hit_growth = 210,
star = 6,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 167,
durability = 1190,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
speed = 20,
luck = 0,
id = 11800221,
antiaircraft_growth = 2800,
antisub = 0,
armor = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
1100176,
1100316,
1101501,
1101506,
1101511
}
},
[11800222] = {
cannon = 35,
reload = 150,
speed_growth = 0,
cannon_growth = 1200,
pilot_ai_template_id = 10001,
air = 0,
rarity = 5,
dodge = 19,
torpedo = 120,
durability_growth = 115200,
antiaircraft = 85,
reload_growth = 0,
dodge_growth = 270,
hit_growth = 210,
star = 6,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 167,
durability = 1300,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
speed = 20,
luck = 0,
id = 11800222,
antiaircraft_growth = 2800,
antisub = 0,
armor = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
1100176,
1100316,
1101501,
1101506,
1101511
}
},
[11800223] = {
cannon = 55,
reload = 150,
speed_growth = 0,
cannon_growth = 1600,
pilot_ai_template_id = 10001,
air = 0,
rarity = 4,
dodge = 11,
torpedo = 80,
durability_growth = 134400,
antiaircraft = 145,
reload_growth = 0,
dodge_growth = 156,
hit_growth = 210,
star = 5,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 190,
durability = 1550,
armor_growth = 0,
torpedo_growth = 2000,
luck_growth = 0,
speed = 20,
luck = 0,
id = 11800223,
antiaircraft_growth = 3600,
antisub = 0,
armor = 0,
appear_fx = {},
equipment_list = {
1100346,
1100376,
1100216,
1100496
}
},
[11800224] = {
cannon = 35,
reload = 150,
speed_growth = 0,
cannon_growth = 1200,
pilot_ai_template_id = 10001,
air = 0,
rarity = 5,
dodge = 19,
torpedo = 120,
durability_growth = 124800,
antiaircraft = 85,
reload_growth = 0,
dodge_growth = 270,
hit_growth = 210,
star = 6,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 167,
durability = 1400,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
speed = 20,
luck = 0,
id = 11800224,
antiaircraft_growth = 2800,
antisub = 0,
armor = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
1100176,
1100316,
1101501,
1101506,
1101511
}
},
[11800225] = {
cannon = 55,
reload = 150,
speed_growth = 0,
cannon_growth = 1600,
pilot_ai_template_id = 10001,
air = 0,
rarity = 4,
dodge = 11,
torpedo = 80,
durability_growth = 145600,
antiaircraft = 145,
reload_growth = 0,
dodge_growth = 156,
hit_growth = 210,
star = 5,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 190,
durability = 1680,
armor_growth = 0,
torpedo_growth = 2000,
luck_growth = 0,
speed = 20,
luck = 0,
id = 11800225,
antiaircraft_growth = 3600,
antisub = 0,
armor = 0,
appear_fx = {},
equipment_list = {
1100346,
1100376,
1100216,
1100496
}
},
[11800226] = {
cannon = 80,
reload = 150,
speed_growth = 0,
cannon_growth = 2000,
rarity = 5,
air = 0,
torpedo = 55,
dodge = 11,
durability_growth = 166400,
antiaircraft = 120,
luck = 0,
reload_growth = 0,
dodge_growth = 156,
hit_growth = 210,
star = 6,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 264,
durability = 2610,
armor_growth = 0,
torpedo_growth = 1500,
luck_growth = 0,
speed = 20,
armor = 0,
id = 11800226,
antiaircraft_growth = 3200,
antisub = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
1100026,
1101516,
1100446,
1101521
}
},
[11800233] = {
cannon = 180,
hit_growth = 210,
rarity = 5,
speed_growth = 0,
pilot_ai_template_id = 10001,
air = 0,
luck = 10,
dodge = 11,
cannon_growth = 0,
speed = 18,
reload = 150,
reload_growth = 0,
dodge_growth = 156,
id = 11800233,
star = 6,
hit = 14,
antisub_growth = 0,
air_growth = 0,
torpedo = 120,
base = 338,
durability = 28500,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
battle_unit_type = 95,
armor = 0,
durability_growth = 0,
antiaircraft = 360,
antisub = 0,
antiaircraft_growth = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
606050,
606051,
606052,
606053
},
buff_list = {
{
ID = 50500,
LV = 2
}
}
},
[11800241] = {
cannon = 7,
prefab = "srDD2",
reload = 150,
cannon_growth = 500,
speed_growth = 0,
air = 0,
rarity = 2,
dodge = 0,
torpedo = 30,
durability_growth = 5120,
antiaircraft = 25,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 0,
hit_growth = 144,
base = 123,
durability = 200,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
speed = 15,
armor = 0,
battle_unit_type = 25,
antisub = 0,
id = 11800241,
antiaircraft_growth = 800,
equipment_list = {
1000591,
1000597,
1000602
}
},
[11800242] = {
cannon = 13,
prefab = "srCL2",
reload = 150,
cannon_growth = 800,
speed_growth = 0,
air = 0,
rarity = 2,
dodge = 0,
torpedo = 24,
durability_growth = 11680,
antiaircraft = 45,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 0,
hit_growth = 144,
base = 124,
durability = 310,
armor_growth = 0,
torpedo_growth = 2000,
luck_growth = 0,
speed = 15,
armor = 0,
battle_unit_type = 30,
antisub = 0,
id = 11800242,
antiaircraft_growth = 1600,
equipment_list = {
1000606,
1000612
}
},
[11800243] = {
cannon = 16,
prefab = "srCA2",
reload = 150,
cannon_growth = 1500,
speed_growth = 0,
air = 0,
rarity = 2,
dodge = 0,
torpedo = 16,
durability_growth = 20000,
antiaircraft = 35,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 0,
hit_growth = 144,
base = 125,
durability = 460,
armor_growth = 0,
torpedo_growth = 1200,
luck_growth = 0,
speed = 15,
armor = 0,
battle_unit_type = 35,
antisub = 0,
id = 11800243,
antiaircraft_growth = 1000,
equipment_list = {
1000616,
1000622,
1000626
}
},
[11800244] = {
cannon = 39,
prefab = "srBB2",
reload = 150,
cannon_growth = 2000,
speed_growth = 0,
air = 0,
rarity = 2,
dodge = 0,
torpedo = 0,
durability_growth = 41600,
antiaircraft = 40,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 0,
hit_growth = 144,
base = 126,
durability = 1020,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 15,
armor = 0,
battle_unit_type = 60,
antisub = 0,
id = 11800244,
antiaircraft_growth = 1200,
equipment_list = {
1000631,
1000637,
1000641
}
},
[11800245] = {
cannon = 0,
prefab = "srCV2",
reload = 150,
cannon_growth = 0,
speed_growth = 0,
air = 42,
rarity = 2,
dodge = 0,
torpedo = 0,
durability_growth = 34400,
antiaircraft = 40,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 1800,
hit_growth = 144,
base = 127,
durability = 880,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 15,
armor = 0,
battle_unit_type = 65,
antisub = 0,
id = 11800245,
antiaircraft_growth = 1200,
bound_bone = {
cannon = {
{
1.8,
1.14,
0
}
},
torpedo = {
{
1.07,
0.24,
0
}
},
antiaircraft = {
{
1.8,
1.14,
0
}
},
plane = {
{
1.8,
1.14,
0
}
}
},
equipment_list = {
1000647,
1000652,
1000656,
1000662
}
},
[11800246] = {
cannon = 6,
reload = 150,
speed_growth = 0,
cannon_growth = 468,
rarity = 4,
air = 0,
torpedo = 54,
dodge = 15,
durability_growth = 20080,
antiaircraft = 20,
luck = 0,
reload_growth = 0,
dodge_growth = 222,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 50,
base = 248,
durability = 640,
armor_growth = 0,
torpedo_growth = 4491,
luck_growth = 0,
speed = 32,
armor = 0,
id = 11800246,
antiaircraft_growth = 1638,
antisub = 0,
equipment_list = {
1000711,
1000717,
1000722
}
},
[11800247] = {
cannon = 20,
reload = 150,
speed_growth = 0,
cannon_growth = 936,
rarity = 4,
air = 0,
torpedo = 27,
dodge = 11,
durability_growth = 30500,
antiaircraft = 28,
luck = 0,
reload_growth = 0,
dodge_growth = 162,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 55,
base = 249,
durability = 760,
armor_growth = 0,
torpedo_growth = 3366,
luck_growth = 0,
speed = 25,
armor = 0,
id = 11800247,
antiaircraft_growth = 3744,
antisub = 0,
equipment_list = {
1000681,
1000687,
1000691,
1000697
}
},
[11800248] = {
cannon = 31,
reload = 150,
speed_growth = 0,
cannon_growth = 2592,
rarity = 3,
air = 0,
torpedo = 0,
dodge = 3,
durability_growth = 59840,
antiaircraft = 45,
luck = 0,
reload_growth = 0,
dodge_growth = 48,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 65,
base = 251,
durability = 1360,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 18,
armor = 0,
id = 11800248,
antiaircraft_growth = 3744,
antisub = 0,
equipment_list = {
1000776,
1000782,
1000786
},
buff_list = {
{
ID = 50510,
LV = 2
}
}
},
[11800249] = {
cannon = 0,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
rarity = 3,
air = 44,
torpedo = 0,
dodge = 5,
durability_growth = 54400,
antiaircraft = 45,
luck = 0,
reload_growth = 0,
dodge_growth = 72,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 3627,
battle_unit_type = 70,
base = 252,
durability = 1070,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 18,
armor = 0,
id = 11800249,
antiaircraft_growth = 3744,
antisub = 0,
equipment_list = {
1000801,
1000807,
1000816,
1000821
}
}
}
return
|
object_tangible_furniture_flooring_tile_frn_flooring_tile_s42 = object_tangible_furniture_flooring_tile_shared_frn_flooring_tile_s42:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_flooring_tile_frn_flooring_tile_s42, "object/tangible/furniture/flooring/tile/frn_flooring_tile_s42.iff")
|
local posix = require 'posix'
local getopt = require 'lj.web.alt_getopt'
local util = require 'lj.web.util'
local web_cmd = {}
function web_cmd.run(arg)
local cmd = arg[1]
if cmd and web_cmd['cmd_' .. cmd] then
arg.cmd = cmd
table.remove(arg, 1)
arg.cwd = posix.getcwd()
return web_cmd['cmd_' .. cmd](arg)
end
end
function web_cmd.cmd_ss(arg)
local ngx_conf = require 'lj.web.ngx_conf'
local optarg, optidx = getopt.get_opts(arg, 'l:', {})
local port = 9000
if optarg.l then
local n = string.match(optarg.l, ':?(%d+)$')
port = tonumber(n)
end
local conf = ngx_conf.get_default_conf()
local srv = ngx_conf.find_first(conf, 'http server')
ngx_conf.find_first(srv, 'listen')[2] = port
ngx_conf.find_first(srv, 'root')[2] = arg.cwd
local loc = ngx_conf.find_first(srv, 'location')
table.insert(loc[3], {'autoindex', 'on'})
local p = os.tmpname()
posix.unlink(p)
posix.mkdir(p)
util.printf('nginx run prefix: %s, visit: http://localhost:%d', p, port)
ngx_conf.run_srv {p .. '/', conf, no_fork = true}
end
function web_cmd.cmd_run(arg)
local web = require 'lj.web'
local file = arg[1]
if not file then
file = 'app.lua'
end
local stat, msg = posix.stat(file)
if not stat then
error(msg)
end
loadfile(file)()
-- print(web.last_run_config)
if web.last_run_config then
web.last_run_config[1] = file
web.run(web.last_run_config)
end
end
function web_cmd.cmd_init(arg)
error 'not impl.'
end
return web_cmd
|
target("inline_and_template")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
set_languages("c++11")
|
local Purchase_API = require(script:GetCustomProperty("Purchase_API"))
local PurchasePanel_Texts = require(script:GetCustomProperty("PurchasePanel_Texts"))
local PurchaseConfirmationBox = script:GetCustomProperty("PurchaseConfirmationBox")
local PURCHASE_SUCCESS_SOUND = script:GetCustomProperty("PURCHASE_SUCCESS_SOUND")
local PURCHASE_FAIL_SOUND = script:GetCustomProperty("PURCHASE_FAIL_SOUND")
-----------------------------------------------------------|
--[[
Purchase weapon client
Handles purchasing Equipment.
]]
-----------------------------------------------------------|
local ConfirmationPanel
local PurchaseClientManager = {}
PurchaseClientManager.__index = PurchaseClientManager
--show purchase buttons
local function ShowOtherButtons()
ConfirmationPanel:GetCustomProperty("PurchaseMoney"):WaitForObject().visibility = Visibility.FORCE_ON
ConfirmationPanel:GetCustomProperty("PurchaseOtherMeans"):WaitForObject().visibility = Visibility.FORCE_ON
ConfirmationPanel:GetCustomProperty("PurchaseButtion"):WaitForObject().visibility = Visibility.FORCE_OFF
end
--Hide Purchase buttons
local function HideOtherButton()
ConfirmationPanel:GetCustomProperty("PurchaseMoney"):WaitForObject().visibility = Visibility.FORCE_OFF
ConfirmationPanel:GetCustomProperty("PurchaseOtherMeans"):WaitForObject().visibility = Visibility.FORCE_OFF
ConfirmationPanel:GetCustomProperty("PurchaseButtion"):WaitForObject().visibility = Visibility.FORCE_ON
end
--@param Weapon,skin
--Sets up purchasing panel for client depending on what is neaded
function PurchaseClientManager.SetUpPanel(Weapon,Skin)
if PurchaseClientManager then PurchaseClientManager.ClosePanel() end
-- Return if level is too low
if Game.GetLocalPlayer():GetResource('Level') < Weapon:GetLevel() then
PurchaseClientManager.OpenFailed()
return
end
--Setup confirmation panel connections and easy acess
ConfirmationPanel = World.SpawnAsset(PurchaseConfirmationBox)
ConfirmationPanel:GetCustomProperty("CloseButton"):WaitForObject().releasedEvent:Connect(PurchaseClientManager.ClosePanel)
ConfirmationPanel.clientUserData.Skin = Skin
ConfirmationPanel.clientUserData.Weapon = Weapon
ConfirmationPanel.clientUserData.Button = ConfirmationPanel:GetCustomProperty("ButtonText"):WaitForObject()
--Seperate skin and others since skin can be purchased with strike coins
if Skin then
ConfirmationPanel.clientUserData.type = "Skin"
ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format( PurchasePanel_Texts.PurchaseableSkin,Skin.name,Weapon.data.name,Skin.rarity:GetCost(), Skin.rarity:GetPremiumCost() )
ConfirmationPanel:GetCustomProperty("PurchaseMoney"):WaitForObject():GetCustomProperty("PurchaseText"):WaitForObject().text = string.format("Purchase for $%d",Skin.rarity:GetCost())
ConfirmationPanel:GetCustomProperty("PurchaseOtherMeans"):WaitForObject():GetCustomProperty("PurchaseText"):WaitForObject().text = string.format("Purchase for %d SC",Skin.rarity:GetPremiumCost())
ShowOtherButtons()
ConfirmationPanel.clientUserData.buttonEvent = ConfirmationPanel:GetCustomProperty("PurchaseMoney"):WaitForObject().releasedEvent:Connect( PurchaseClientManager.PurchaseSkin,Weapon,Skin,"Cash")
ConfirmationPanel.clientUserData.buttonEventOther = ConfirmationPanel:GetCustomProperty("PurchaseOtherMeans"):WaitForObject().releasedEvent:Connect( PurchaseClientManager.PurchaseSkin,Weapon,Skin,"StrikeCoins")
elseif Weapon:GetSlot() == "Cosmetics" then
ConfirmationPanel.clientUserData.type = "Cosmetics"
ConfirmationPanel.clientUserData.buttonEvent = ConfirmationPanel:GetCustomProperty("PurchaseButtion"):WaitForObject().releasedEvent:Connect( PurchaseClientManager.PurchaseCosmetic,Weapon)
ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(PurchasePanel_Texts.PurchaseableWeapon,Weapon.data.name, Weapon:GetCost())
else
ConfirmationPanel.clientUserData.type = "Weapon"
ConfirmationPanel.clientUserData.buttonEvent = ConfirmationPanel:GetCustomProperty("PurchaseButtion"):WaitForObject().releasedEvent:Connect( PurchaseClientManager.PurchaseWeapon,Weapon)
ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(PurchasePanel_Texts.PurchaseableWeapon,Weapon.data.name, Weapon:GetCost())
end
end
--Finish with confirmation panel and close/destroy the panel
function PurchaseClientManager.ClosePanel( )
if ConfirmationPanel then
PurchaseClientManager.DisconnectEvents()
if Object.IsValid(ConfirmationPanel) then
ConfirmationPanel:Destroy()
end
ConfirmationPanel = nil
end
end
--@Params int
--@Returns string
--returns a string based on codes
function GetSkinText(Code)
local ReturnText ={
[1] = PurchasePanel_Texts.PurchaseableSkinPending,
[2] = PurchasePanel_Texts.PurchaseableSkinFailed,
[3] = PurchasePanel_Texts.PurchaseableSkinAlreadyOwned,
[4] = PurchasePanel_Texts.PurchaseableSkinLowLevel,
[5] = PurchasePanel_Texts.PurchaseableSkinError,
}
return ReturnText[Code]
end
--@Params int
--@Returns string
--returns a string based on codes
function GetWeaponText(Code)
local ReturnText ={
[1] = PurchasePanel_Texts.PurchaseableWeaponPending,
[2] = PurchasePanel_Texts.PurchaseableWeaponFailed,
[3] = PurchasePanel_Texts.PurchaseableWeaponAlreadyOwned,
[4] = PurchasePanel_Texts.PurchaseableWeaponLowLevel,
[5] = PurchasePanel_Texts.PurchaseableWeaponLowLevel,
}
return ReturnText[Code]
end
--@Params int
--@Returns string
--returns a string based on codes
function GetCosmeticText(Code)
local ReturnText ={
[1] = PurchasePanel_Texts.PurchaseableCosmeticPending,
[2] = PurchasePanel_Texts.PurchaseableCosmeticFailed,
[3] = PurchasePanel_Texts.PurchaseableCosmeticAlreadyOwned,
[4] = PurchasePanel_Texts.PurchaseableCosmeticLowLevel,
[5] = PurchasePanel_Texts.PurchaseableCosmeticLowLevel,
}
return ReturnText[Code]
end
--Disconnects events of successful/failed purchases
function PurchaseClientManager.DisconnectEvents()
if ConfirmationPanel.clientUserData.SuccessEvent then
ConfirmationPanel.clientUserData.SuccessEvent:Disconnect()
end
if ConfirmationPanel.clientUserData.ErrorEvent then
ConfirmationPanel.clientUserData.ErrorEvent:Disconnect()
end
end
--Rewards the client with the Purchase
function PurchaseClientManager.PurchaseSuccessful()
Task.Wait()
--Updates confirmation panel
local LOCAL_PLAYER = Game.GetLocalPlayer()
World.SpawnAsset(PURCHASE_SUCCESS_SOUND)
local Weapon = ConfirmationPanel.clientUserData.Weapon
local skin = ConfirmationPanel.clientUserData.Skin
if ConfirmationPanel.clientUserData.type == "Skin" then
Weapon:EquipSkinByID(skin.id)
ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(PurchasePanel_Texts.PurchaseableSkinSuccess, ConfirmationPanel.clientUserData.Skin.name)
Events.BroadcastToServer("UpdateEquipment", Weapon:ReturnIDs(), Weapon.data.slot , tostring(LOCAL_PLAYER.clientUserData.SelectedSlot) )
Events.Broadcast("UpdateEquipment",Weapon:ReturnIDs(), Weapon.data.slot, tostring(LOCAL_PLAYER.clientUserData.SelectedSlot) )
Events.Broadcast("UpdateDataPanel")
elseif ConfirmationPanel.clientUserData.type == "Weapon" then
ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(PurchasePanel_Texts.PurchaseableWeaponSuccess, ConfirmationPanel.clientUserData.Weapon.data.name)
Events.BroadcastToServer("UpdateEquipment", Weapon:ReturnIDs(), Weapon.data.slot , tostring(LOCAL_PLAYER.clientUserData.SelectedSlot) )
Events.Broadcast("UpdateEquipment",Weapon:ReturnIDs(), Weapon.data.slot, tostring(LOCAL_PLAYER.clientUserData.SelectedSlot) )
Events.Broadcast("UpdateDataPanel")
elseif ConfirmationPanel.clientUserData.type == "Cosmetics" then
ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(PurchasePanel_Texts.PurchaseableWeaponSuccess, ConfirmationPanel.clientUserData.Weapon.data.name)
Events.Broadcast("UpdateCosmetics",Weapon:ReturnIDs(), Weapon.data.slot, tostring(LOCAL_PLAYER.clientUserData.CosmeticSlot) )
end
--Changes confirmation panel so the players understand what went wrong
ConfirmationPanel:GetCustomProperty("ButtonText"):WaitForObject().text = "Okay"
ConfirmationPanel.clientUserData.buttonEvent = ConfirmationPanel:GetCustomProperty("PurchaseButtion"):WaitForObject().releasedEvent:Connect(PurchaseClientManager.ClosePanel)
PurchaseClientManager.DisconnectEvents()
Task.Wait(.5)
Events.Broadcast("UpdatePanels")
end
--@Param int
--Failed Purchasing
function PurchaseClientManager.PurchaseError(Code)
Task.Wait()
World.SpawnAsset(PURCHASE_FAIL_SOUND)
ConfirmationPanel.clientUserData.Button.text = "Okay"
--Sets up skin error and tells why it has failed
if ConfirmationPanel.clientUserData.type == "Skin" then
ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(GetSkinText(Code),ConfirmationPanel.clientUserData.Skin.name)
ConfirmationPanel:GetCustomProperty("PurchaseCreditButton"):WaitForObject().visibility = Visibility.FORCE_ON
--Sets up Weapon error and tells why it failed
elseif ConfirmationPanel.clientUserData.type == "Weapon" then
ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(GetWeaponText(Code),ConfirmationPanel.clientUserData.Weapon.data.name)
--Sets up Cosmetic error and tells why it failed
elseif ConfirmationPanel.clientUserData.type == "Cosmetics" then
ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(GetCosmeticText(Code),ConfirmationPanel.clientUserData.Weapon.data.name)
end
--Okay button to say it has failed-
ConfirmationPanel.clientUserData.buttonEvent = ConfirmationPanel:GetCustomProperty("PurchaseButtion"):WaitForObject().releasedEvent:Connect(PurchaseClientManager.ClosePanel)
PurchaseClientManager.DisconnectEvents()
end
--@Param int
--Tells client opening failed
function PurchaseClientManager.OpenFailed(Code)
Task.Wait()
World.SpawnAsset(PURCHASE_FAIL_SOUND)
end
--@Params nil, Weapon, skin, currency
--Sends message to the api that the local player wants to buy a skin
function PurchaseClientManager.PurchaseSkin(_,Weapon,Skin,type)
HideOtherButton()
--Disconnect and connect events
ConfirmationPanel.clientUserData.buttonEvent:Disconnect()
ConfirmationPanel.clientUserData.buttonEventOther:Disconnect()
ConfirmationPanel.clientUserData.SuccessEvent = Events.Connect("PurchaseAPI_PurchaseSuccessful", PurchaseClientManager.PurchaseSuccessful)
ConfirmationPanel.clientUserData.ErrorEvent = Events.Connect("PurchaseAPI_PurchaseError", PurchaseClientManager.PurchaseError)
ConfirmationPanel.clientUserData.Button.text = "Purchasing..."
--Purchase
local Code = Purchase_API.BuySkin(Weapon,Skin,type)
if Code ~= 1 then
PurchaseClientManager.PurchaseError(Code)
end
if _G.Funnel then
_G.Funnel.SetPlayerStepComplete(Game.GetLocalPlayer(), 9)
end
end
--@Params nil, Weapon, skin
--Sends message to the api that the local player wants to buy a Weapon
function PurchaseClientManager.PurchaseWeapon(_,Weapon,Skin)
ConfirmationPanel.clientUserData.Button.text = "Purchasing..."
ConfirmationPanel.clientUserData.buttonEvent:Disconnect()
ConfirmationPanel.clientUserData.SuccessEvent = Events.Connect("PurchaseAPI_PurchaseSuccessful", PurchaseClientManager.PurchaseSuccessful)
ConfirmationPanel.clientUserData.ErrorEvent = Events.Connect("PurchaseAPI_PurchaseError", PurchaseClientManager.PurchaseError)
local Code = Purchase_API.BuyWeapon(Weapon)
--ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(GetWeaponText(Code),Weapon.data.name)
if Code ~= 1 then
PurchaseClientManager.PurchaseError(Code)
end
if _G.Funnel then
_G.Funnel.SetPlayerStepComplete(Game.GetLocalPlayer(), 9)
end
end
--@Params nil, Weapon, skin
--Sends message to the api that the local player wants to buy a Weapon
function PurchaseClientManager.PurchaseCosmetic(_,Weapon,Skin)
ConfirmationPanel.clientUserData.Button.text = "Purchasing..."
ConfirmationPanel.clientUserData.buttonEvent:Disconnect()
ConfirmationPanel.clientUserData.SuccessEvent = Events.Connect("PurchaseAPI_PurchaseSuccessful", PurchaseClientManager.PurchaseSuccessful)
ConfirmationPanel.clientUserData.ErrorEvent = Events.Connect("PurchaseAPI_PurchaseError", PurchaseClientManager.PurchaseError)
local Code = Purchase_API.BuyCosmetic(Weapon)
--ConfirmationPanel:GetCustomProperty("StateText"):WaitForObject().text = string.format(GetWeaponText(Code),Weapon.data.name)
if Code ~= 1 then
PurchaseClientManager.PurchaseError(Code)
end
if _G.Funnel then
_G.Funnel.SetPlayerStepComplete(Game.GetLocalPlayer(), 9)
end
end
Events.Connect("ClosePurchasePanel",PurchaseClientManager.ClosePanel)
Events.Connect("PurchaseItem",PurchaseClientManager.SetUpPanel)
_G["PurchaseClientManager"] = PurchaseClientManager |
-- AWARDS
--
-- Copyright (C) 2013-2015 rubenwardy
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation; either version 2.1 of the License, or
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
-- You should have received a copy of the GNU Lesser General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--
awards.register_trigger("chat", {
type = "counted",
progress = "@1/@2 chat messages",
auto_description = { "Send a chat message", "Chat @1 times" },
})
minetest.register_on_chat_message(function(name, message)
local player = minetest.get_player_by_name(name)
if not player or string.find(message, "/") then
return
end
awards.notify_chat(player)
end)
awards.register_trigger("join", {
type = "counted",
progress = "@1/@2 joins",
auto_description = { "Join once", "Join @1 times" },
})
minetest.register_on_joinplayer(awards.notify_join)
awards.register_trigger("death", {
type = "counted_key",
progress = "@1/@2 deaths",
auto_description = { "Die once of @2", "Die @1 times of @2" },
auto_description_total = { "Die @1 times.", "Mine @1 times" },
get_key = function(self, def)
return def.trigger.reason
end,
})
minetest.register_on_dieplayer(function(player, reason)
if reason then
reason = reason.type
else
reason = "unknown"
end
awards.notify_death(player, reason)
end)
awards.register_trigger("dig", {
type = "counted_key",
progress = "@1/@2 dug",
auto_description = { "Mine: @2", "Mine: @1×@2" },
auto_description_total = { "Mine @1 block.", "Mine @1 blocks." },
get_key = function(self, def)
return minetest.registered_aliases[def.trigger.node] or def.trigger.node
end,
key_is_item = true,
})
minetest.register_on_dignode(function(pos, node, player)
if not player or not pos or not node then
return
end
local node_name = node.name
node_name = minetest.registered_aliases[node_name] or node_name
awards.notify_dig(player, node_name)
end)
awards.register_trigger("place", {
type = "counted_key",
progress = "@1/@2 placed",
auto_description = { "Place: @2", "Place: @1×@2" },
auto_description_total = { "Place @1 block.", "Place @1 blocks." },
get_key = function(self, def)
return minetest.registered_aliases[def.trigger.node] or def.trigger.node
end,
key_is_item = true,
})
minetest.register_on_placenode(function(pos, node, player)
if not player or not pos or not node then
return
end
local node_name = node.name
node_name = minetest.registered_aliases[node_name] or node_name
awards.notify_place(player, node_name)
end)
awards.register_trigger("craft", {
type = "counted_key",
progress = "@1/@2 crafted",
auto_description = { "Craft: @2", "Craft: @1×@2" },
auto_description_total = { "Craft @1 item", "Craft @1 items." },
get_key = function(self, def)
return minetest.registered_aliases[def.trigger.item] or def.trigger.item
end,
key_is_item = true,
})
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
if not player or itemstack:is_empty() then
return
end
local itemname = itemstack:get_name()
itemname = minetest.registered_aliases[itemname] or itemname
awards.notify_craft(player, itemname, itemstack:get_count())
end)
awards.register_trigger("eat", {
type = "counted_key",
progress = "@1/@2 eaten",
auto_description = { "Eat @2", "Eat @1×@2" },
auto_description_total = { "Eat @1 item", "Eat @1 items." },
get_key = function(self, def)
return minetest.registered_aliases[def.trigger.item] or def.trigger.item
end,
key_is_item = true,
})
minetest.register_on_item_eat(function(_, _, itemstack, player, _)
if not player or itemstack:is_empty() then
return
end
local itemname = itemstack:get_name()
itemname = minetest.registered_aliases[itemname] or itemname
awards.notify_craft(player, itemname, itemstack:get_count())
end)
|
return {
global_env_def = 'vim',
gen_target = '5.1',
source_dir = '.',
build_dir = 'dist',
}
|
local Action = require(script.Parent.Parent.Action)
return Action("SetDevConsoleVisibility", function(visibility)
return {
isVisible = visibility
}
end) |
local S = technic.getter
function technic.handle_machine_upgrades(meta)
-- Get the names of the upgrades
local inv = meta:get_inventory()
local upg_item1
local upg_item2
local srcstack = inv:get_stack("upgrade1", 1)
if srcstack then
upg_item1 = srcstack:to_table()
end
srcstack = inv:get_stack("upgrade2", 1)
if srcstack then
upg_item2 = srcstack:to_table()
end
-- Save some power by installing battery upgrades.
-- Tube loading speed can be upgraded using control logic units.
local EU_upgrade = 0
local tube_upgrade = 0
if upg_item1 then
if upg_item1.name == "technic:battery" then
EU_upgrade = EU_upgrade + 1
elseif upg_item1.name == "technic:control_logic_unit" then
tube_upgrade = tube_upgrade + 1
end
end
if upg_item2 then
if upg_item2.name == "technic:battery" then
EU_upgrade = EU_upgrade + 1
elseif upg_item2.name == "technic:control_logic_unit" then
tube_upgrade = tube_upgrade + 1
end
end
return EU_upgrade, tube_upgrade
end
function technic.send_items(pos, x_velocity, z_velocity, output_name)
-- Send items on their way in the pipe system.
if output_name == nil then
output_name = "dst"
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local i = 0
for _, stack in ipairs(inv:get_list(output_name)) do
i = i + 1
if stack then
local item0 = stack:to_table()
if item0 then
item0["count"] = "1"
technic.tube_inject_item(pos, pos, vector.new(x_velocity, 0, z_velocity), item0)
stack:take_item(1)
inv:set_stack(output_name, i, stack)
return
end
end
end
end
function technic.smelt_item(meta, result, speed)
local inv = meta:get_inventory()
meta:set_int("cook_time", meta:get_int("cook_time") + 1)
if meta:get_int("cook_time") < result.time / speed then
return
end
local result
local afterfuel
result, afterfuel = minetest.get_craft_result({method = "cooking", width = 1, items = inv:get_list("src")})
if result and result.item then
meta:set_int("cook_time", 0)
-- check if there's room for output in "dst" list
if inv:room_for_item("dst", result.item) then
inv:set_stack("src", 1, afterfuel.items[1])
inv:add_item("dst", result.item)
end
end
end
function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function)
if send_function == nil then
send_function = technic.send_items
end
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local pos1 = vector.new(pos)
local x_velocity = 0
local z_velocity = 0
-- Output is on the left side of the furnace
if node.param2 == 3 then pos1.z = pos1.z - 1 z_velocity = -1 end
if node.param2 == 2 then pos1.x = pos1.x - 1 x_velocity = -1 end
if node.param2 == 1 then pos1.z = pos1.z + 1 z_velocity = 1 end
if node.param2 == 0 then pos1.x = pos1.x + 1 x_velocity = 1 end
local output_tube_connected = false
local node1 = minetest.get_node(pos1)
if minetest.get_item_group(node1.name, "tubedevice") > 0 then
output_tube_connected = true
end
local tube_time = meta:get_int("tube_time") + tube_upgrade
if tube_time >= 2 then
tube_time = 0
if output_tube_connected then
send_function(pos, x_velocity, z_velocity)
end
end
meta:set_int("tube_time", tube_time)
end
function technic.machine_can_dig(pos, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") or
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
if player then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
end
return false
else
return true
end
end
local function inv_change(pos, player, count)
if minetest.is_protected(pos, player:get_player_name()) then
minetest.chat_send_player(player:get_player_name(),
S("Inventory move disallowed due to protection"))
return 0
end
return count
end
function technic.machine_inventory_put(pos, listname, index, stack, player)
return inv_change(pos, player, stack:get_count())
end
function technic.machine_inventory_take(pos, listname, index, stack, player)
return inv_change(pos, player, stack:get_count())
end
function technic.machine_inventory_move(pos, from_list, from_index,
to_list, to_index, count, player)
return inv_change(pos, player, count)
end
|
--Nginx日志写入
local log = ngx.log;
--获取全局共享内存
local shared_data = ngx.shared.shared_data;
--获取用户标签ID
local tag_id = ngx.var.tag_id;
--代理目标URL
local proxy_url = ngx.null;
if tag_id ~= nil and tag_id ~= "" then
--当用户标签ID不为空时
--判断是否启用缓存
if if_cache_proxy_data then
--通过共享内存获取代理地址
local shared_data_proxy = shared_data:get(tag_id);
if ( shared_data_proxy ~= nil and shared_data_proxy ~= "" ) then
ngx.var.dynamic_proxy_path = shared_data_proxy;
return ;
end
end
--创建redis实例
local red = getRedisConnect();
if not red then
log(ngx.ERR, "Get Redis connect failure, Please check the Redis Service !");
else
--调用API获取数据
local resp, err = red:get(user_proxy_prefix .. ngx.var.tag_id);
if resp == ngx.null then
log(ngx.ERR, "get [", user_proxy_prefix, ngx.var.tag_id, "] error : ", err);
else
proxy_url = resp;
end
--关闭Redis连接
close_redis(red);
end
else
log(ngx.ERR, "The [Tag-ID] is not found in Cookies !");
end
--得到的数据为空处理
if proxy_url == ngx.null then
--设定默认值
proxy_url = "http://127.0.0.1:" .. ngx.var.server_port .. "/errorproxy";
else
--判断是否启用全局缓存
if if_cache_proxy_data then
--写入全局共享变量
shared_data:set(ngx.var.proxy_key, proxy_url, proxy_shared_cache_timeout);
end
end
--回写结果(直接使用set_by_lua_file设置变量不知道为什么redis连接会报错)
ngx.var.dynamic_proxy_path = proxy_url; |
-- NodeMCU Examples
-- Get Access Point data
wifi.start()
wifi.mode(wifi.STATION)
function printAP(err,arr)
if err then
print ("Scan failed:", err)
else
print(string.format("%-26s","SSID"),"Channel BSSID RSSI Auth Bandwidth")
for i,ap in ipairs(arr) do
print(string.format("%-32s",ap.ssid),ap.channel,ap.bssid,ap.rssi,ap.auth,ap.bandwidth)
end
print("-- Total APs: ", #arr)
end
end
wifi.sta.scan({ hidden = 1 }, printAP) |
--
-- (C) 2013 Kriss@XIXs.com
--
local coroutine,package,string,table,math,io,os,debug,assert,dofile,error,_G,getfenv,getmetatable,ipairs,Gload,loadfile,loadstring,next,pairs,pcall,print,rawequal,rawget,rawset,select,setfenv,setmetatable,tonumber,tostring,type,unpack,_VERSION,xpcall,module,require=coroutine,package,string,table,math,io,os,debug,assert,dofile,error,_G,getfenv,getmetatable,ipairs,load,loadfile,loadstring,next,pairs,pcall,print,rawequal,rawget,rawset,select,setfenv,setmetatable,tonumber,tostring,type,unpack,_VERSION,xpcall,module,require
local wgrd=require("wetgenes.grd")
local wstr=require("wetgenes.string")
local pack=require("wetgenes.pack")
local core=require("wetgenes.gamecake.core")
--module
local M={ modname=(...) } ; package.loaded[M.modname]=M
function M.bake(oven,flat)
local canvas=oven.rebake("wetgenes.gamecake.canvas")
local gl=oven.gl
local cake=oven.cake
local buffers=cake.buffers
-- should replace this with tristrip
flat.quad = function(x1,y1,x2,y2,x3,y3,x4,y4)
if y4 then
pack.save_array({
x1, y1, 0, 0, 0,
x2, y2, 0, 1, 0,
x4, y4, 0, 0, 1,
x3, y3, 0, 1, 1,
},"f32",0,5*4,canvas.vdat)
else
pack.save_array({
x1, y1, 0, 0, 0,
x2, y1, 0, 1, 0,
x1, y2, 0, 0, 1,
x2, y2, 0, 1, 1,
},"f32",0,5*4,canvas.vdat)
end
local p=gl.program("pos")
gl.UseProgram( p[0] )
gl.BindTexture( gl.TEXTURE_2D , 0 )
local vertexarray
if gl.GenVertexArray then
vertexarray=gl.GenVertexArray()
gl.BindVertexArray(vertexarray)
end
gl.BindBuffer(gl.ARRAY_BUFFER,canvas.get_vb())
gl.BufferData(gl.ARRAY_BUFFER,5*4*4,canvas.vdat,gl.DYNAMIC_DRAW)
gl.UniformMatrix4f(p:uniform("modelview"), gl.matrix(gl.MODELVIEW) )
gl.UniformMatrix4f(p:uniform("projection"), gl.matrix(gl.PROJECTION) )
gl.Uniform4f( p:uniform("color"), gl.cache.color )
gl.VertexAttribPointer(p:attrib("a_vertex"),3,gl.FLOAT,gl.FALSE,5*4,0)
gl.EnableVertexAttribArray(p:attrib("a_vertex"))
gl.DrawArrays(gl.TRIANGLE_STRIP,0,4)
if gl.GenVertexArray then
gl.BindVertexArray(0)
gl.DeleteVertexArray(vertexarray)
end
end
-- this allows us to prepare vertex buffers, then draw at anytime
-- just call it.draw on the returned table.
flat.array_predraw = function(it) -- pass in fmt,data,progname,vb=-1 in here
-- some basic vertexformats
local pstride
local pnrm
local ptex
local pcolor
local pmat
local ptans
local pbone
local p
local def_progname
local fmt=it.fmt
if fmt=="xyz" or fmt=="pos" then -- xyz or pos only
def_progname=fmt:sub(1,3)
pstride=12
elseif fmt=="xyznrm" or fmt=="posnrm" then -- xyz and normal (so we may light the thing)
def_progname=fmt:sub(1,3).."_normal"
pstride=24
pnrm=12
elseif fmt=="xyznrmuv" or fmt=="posnrmuv" then -- xyz and normal and texture
def_progname=fmt:sub(1,3).."_normal_tex"
pstride=32
pnrm=12
ptex=24
elseif fmt=="xyznrmuvm" or fmt=="posnrmuvm" then -- xyz and normal and texture and material id
def_progname=fmt:sub(1,3).."_normal_tex_mat"
pstride=36
pnrm=12
ptex=24
pmat=32
elseif fmt=="xyznrmuvmbone" or fmt=="posnrmuvmbone" then -- xyz and normal and texture and material id and bones
def_progname=fmt:sub(1,3).."_normal_tex_mat_bone"
pstride=52
pnrm=12
ptex=24
pmat=32
pbone=36
elseif fmt=="xyznrmuvtansbone" or fmt=="posnrmuvtansbone" then -- xyz and normal and texture and material id and tangent and bones
def_progname=fmt:sub(1,3).."_normal_tex_tans_bone"
pstride=64
pnrm=12
ptex=24
ptans=36
pbone=52
elseif fmt=="xyznrmuvmtansbone" or fmt=="posnrmuvmtansbone" then -- xyz and normal and texture and material id and tangent and bones
def_progname=fmt:sub(1,3).."_normal_tex_mat_tans_bone"
pstride=68
pnrm=12
ptex=24
pmat=32
ptans=36
pbone=52
elseif fmt=="xyznrmuvmtans" or fmt=="posnrmuvmtans" then -- xyz and normal and texture and material id and tangent
def_progname=fmt:sub(1,3).."_normal_tex_mat_tans"
pstride=52
pnrm=12
ptex=24
pmat=32
ptans=36
elseif fmt=="xyzuv" or fmt=="posuv" then -- xyz and texture
def_progname=fmt:sub(1,3).."_tex"
pstride=20
ptex=12
elseif fmt=="xyzrgba" or fmt=="posrgba" or fmt=="rawrgba" then -- xyz and color
def_progname=fmt:sub(1,3).."_color"
pstride=28
pcolor=12
elseif fmt=="xyzuvrgba" or fmt=="posuvrgba" then -- xyz and texture and color
def_progname=fmt:sub(1,3).."_tex_color"
pstride=36
ptex=12
pcolor=20
elseif fmt=="rawuvrgba" then -- raw-xyz and texture and color
def_progname="raw_tex_color"
pstride=36
ptex=12
pcolor=20
elseif fmt=="rawuv" then -- raw-xyz and texture and color
def_progname="raw_tex"
pstride=20
ptex=12
end
if canvas.discard_low_alpha then -- try not to break the zbuffer
def_progname=def_progname.."_discard"
end
local data=it.data
local datalen=it.datalen or #data
local datasize=datalen*4 -- we need this much vdat memory
canvas.vdat_check(datasize) -- make sure we have space in the buffer
if it.vb then
if type(it.vb)~="table" then -- need to create
it.vb=buffers.create({
start=function(vb)
vb:bind()
pack.save_array(data,"f32",0,datalen,canvas.vdat)
gl.BufferData(gl.ARRAY_BUFFER,datasize,canvas.vdat,gl.STATIC_DRAW)
end,
})
end
end
it.draw=function(cb,progname)
progname=progname or it.progname or def_progname
local p=gl.program(progname)
gl.UseProgram( p[0] )
local vertexarray
if gl.GenVertexArray then
vertexarray=gl.GenVertexArray()
gl.BindVertexArray(vertexarray)
end
if it.vb then -- use a precached buffer
it.vb:bind()
elseif it.dataraw then -- use prebuilt data
gl.BindBuffer(gl.ARRAY_BUFFER,canvas.get_vb())
gl.BufferData(gl.ARRAY_BUFFER,datasize,it.dataraw,gl.DYNAMIC_DRAW)
else
pack.save_array(data,"f32",0,datalen,canvas.vdat)
gl.BindBuffer(gl.ARRAY_BUFFER,canvas.get_vb())
gl.BufferData(gl.ARRAY_BUFFER,datasize,canvas.vdat,gl.DYNAMIC_DRAW)
end
gl.uniforms_apply(p)
-- gl.UniformMatrix4f(p:uniform("modelview"), gl.matrix(gl.MODELVIEW) )
-- gl.UniformMatrix4f(p:uniform("projection"), gl.matrix(gl.PROJECTION) )
-- gl.Uniform4f( p:uniform("color"), gl.cache.color )
gl.VertexAttribPointer(p:attrib("a_vertex"),3,gl.FLOAT,gl.FALSE,pstride,0)
gl.EnableVertexAttribArray(p:attrib("a_vertex"))
--print( progname , fmt , p:attrib("a_texcoord") )
if pnrm then
local a=p:attrib("a_normal")
if a>=0 then
gl.VertexAttribPointer(a,3,gl.FLOAT,gl.FALSE,pstride,pnrm)
gl.EnableVertexAttribArray(a)
end
end
if ptex then
local a=p:attrib("a_texcoord")
if a>=0 then
gl.VertexAttribPointer(a,2,gl.FLOAT,gl.FALSE,pstride,ptex)
gl.EnableVertexAttribArray(a)
end
end
if pcolor then
local a=p:attrib("a_color")
if a>=0 then
gl.VertexAttribPointer(a,4,gl.FLOAT,gl.FALSE,pstride,pcolor)
gl.EnableVertexAttribArray(a)
end
end
if pmat then
local a=p:attrib("a_matidx")
if a>=0 then
gl.VertexAttribPointer(a,1,gl.FLOAT,gl.FALSE,pstride,pmat)
gl.EnableVertexAttribArray(a)
end
end
if ptans then
local a=p:attrib("a_tangent")
if a>=0 then
gl.VertexAttribPointer(a,4,gl.FLOAT,gl.FALSE,pstride,ptans)
gl.EnableVertexAttribArray(a)
end
end
if pbone then
local a=p:attrib("a_bone")
if a>=0 then
gl.VertexAttribPointer(a,4,gl.FLOAT,gl.FALSE,pstride,pbone)
gl.EnableVertexAttribArray(a)
end
end
local err=gl.GetError() ; assert( err==0 , gl.numtostring(err) ) -- well that went wrong
if cb then cb(p) end -- callback to fill in more uniforms before drawing
local cc=datasize/pstride
if cc>0 then
gl.DrawArrays( it.array or gl.TRIANGLE_STRIP,0,cc)
end
if gl.GenVertexArray then
gl.BindVertexArray(0)
gl.DeleteVertexArray(vertexarray)
end
end
return it
end
flat.tristrip_predraw=flat.array_predraw
-- tristrip is the most useful, 3 points gives us a tri
-- 4 gives us a quad, and of course you can keep going to create a strip
flat.tristrip = function(fmt,data,progname,cb)
if #data > 0 then
local it=flat.array_predraw({fmt=fmt,data=data,progname=progname,array=gl.TRIANGLE_STRIP})
it.draw(cb)
end
end
flat.lines = function(fmt,data,progname,cb)
if #data > 0 then
local it=flat.array_predraw({fmt=fmt,data=data,progname=progname,array=gl.LINES})
it.draw(cb)
end
end
return flat
end
|
-- language specific higlights
local lush = require("lush")
local base = require("apprentice.base")
local M = {}
M = lush(function()
return {
haskellType {base.ApprenticeBlue},
haskellIdentifier {base.ApprenticeAqua},
haskellSeparator {base.ApprenticeFg4},
haskellDelimiter {base.ApprenticeOrange},
haskellOperators {base.ApprenticePurple},
haskellBacktick {base.ApprenticeOrange},
haskellStatement {base.ApprenticePurple},
haskellConditional {base.ApprenticePurple},
haskellLet {base.ApprenticeRed},
haskellDefault {base.ApprenticeRed},
haskellWhere {base.ApprenticeRed},
haskellBottom {base.ApprenticeRedBold},
haskellImportKeywords {base.ApprenticePurpleBold},
haskellDeclKeyword {base.ApprenticeOrange},
haskellDecl {base.ApprenticeOrange},
haskellDeriving {base.ApprenticePurple},
haskellAssocType {base.ApprenticeAqua},
haskellNumber {base.ApprenticeAqua},
haskellPragma {base.ApprenticeRedBold},
haskellTH {base.ApprenticeAquaBold},
haskellForeignKeywords {base.ApprenticeGreen},
haskellKeyword {base.ApprenticeRed},
haskellFloat {base.ApprenticeAqua},
haskellInfix {base.ApprenticePurple},
haskellQuote {base.ApprenticeGreenBold},
haskellShebang {base.ApprenticeYellowBold},
haskellLiquid {base.ApprenticePurpleBold},
haskellQuasiQuoted {base.ApprenticeBlueBold},
haskellRecursiveDo {base.ApprenticePurple},
haskellQuotedType {base.ApprenticeRed},
haskellPreProc {base.ApprenticeFg4},
haskellTypeRoles {base.ApprenticeRedBold},
haskellTypeForall {base.ApprenticeRed},
haskellPatternKeyword {base.ApprenticeBlue},
}
end)
return M
|
-- rid.lua
-- Created by wugd
-- 维护运行中ID
-- 全局变量声明
-- 私有变量声明
local rid_objects = {};
-- 根据RID取对象
function find_object_by_rid(rid)
return rid_objects[rid];
end
-- 取映射表
function query_rid_objects()
return rid_objects;
end
-- 取消RID和对象的映射关系
-- 只有拥有RID对象本身允许进行这个调用
function remove_rid_object(rid, caller)
assert(rid_objects[rid] == caller, "");
rid_objects[rid] = nil;
end
-- 增加RID和对象的映射关系
function set_rid_object(rid, ob)
assert(rid_objects[rid] == nil, "");
rid_objects[rid] = ob;
end
-- 生成新的RID
function NEW_RID(flag)
flag = flag or "1";
return (get_next_rid(tonumber(SERVER_ID), flag));
end
-- 快捷访问宏:仅供控制台调试时使用
function RID(rid)
return (find_object_by_rid(rid));
end
|
--提前运行的脚本
--用于提前声明某些要用到的函数
--加强随机数随机性
math.randomseed(tostring(os.time()):reverse():sub(1, 6))
--防止跑死循环,超时设置秒数自动结束,-1表示禁用
runMaxSeconds = runType == "send" and 3 or -1
local start = os.time()
function trace (event, line)
if runMaxSeconds > 0 and os.time() - start >=runMaxSeconds then
error("代码运行超时")
end
end
debug.sethook(trace, "l")
--加上需要require的路径
local rootPath = apiUtf8ToHex(apiGetPath())
rootPath = rootPath:gsub("[%s%p]", ""):upper()
rootPath = rootPath:gsub("%x%x", function(c)
return string.char(tonumber(c, 16))
end)
package.path = package.path..
";"..rootPath.."core_script/?.lua"..
";"..rootPath.."user_script_run/requires/?.lua"
--加载字符串工具包
require("strings")
--重载几个可能影响中文目录的函数
local oldrequire = require
require = function (s)
local s = apiUtf8ToHex(s):fromHex()
return oldrequire(s)
end
local oldloadfile = loadfile
loadfile = function (s)
local s = apiUtf8ToHex(s):fromHex()
return oldloadfile(s)
end
local oldioopen = io.open
io.open = function (s,p)
local s = apiUtf8ToHex(s):fromHex()
return oldioopen(s,p)
end
--下面的代码一次性的处理函数用不着
if runType == "send" then return end
--重写print函数
function print(...)
arg = { ... }
local logAll = {}
for i=1,select('#', ...) do
table.insert(logAll, tostring(arg[i]))
end
apiPrintLog(table.concat(logAll, "\t"))
end
log = require("log")
sys = require("sys")
--串口数据接收接口
local uartCB = function (d)
if uartReceive then uartReceive(d:fromHex()) end
end
--重写串口数据发送接口
local oldapiSendUartData = apiSendUartData
apiSendUartData = function (s)
local str = s:toHex()
return oldapiSendUartData(str)
end
--重写获取快捷发送区数据接口
local oldapiQuickSendList = apiQuickSendList
apiQuickSendList = function (id)
local s = oldapiQuickSendList(id)
if s:sub(1,1) == "S" then
return s:sub(2)
elseif s:sub(1,1) == "H" then
return s:sub(2):fromHex()
else
return
end
end
--协程外部触发
tiggerCB = function (id,type,data)
--log.debug("tigger",id,type,data:toHex())
if type == "uartRev" then--串口消息
uartCB(data)
elseif type == "cmd" then
local result, info = pcall(function ()
load(data)()
end)
if result then
log.info("console","run success")
else
log.info("console","run failed\r\n"..tostring(info))
end
elseif id >= 0 then--定时器消息
sys.tigger(id)
end
end
|
-- This Cache class steals cache_get/put from Kikito's memoize.lua
-- https://github.com/kikito/memoize.lua
--[[
Copyright (c) 2018 Enrique García Cota
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local Object = Libs.classic
---@class Cache
---@field cache table tree structure of weak tables
Cache = Object:extend()
local function wt()
return setmetatable({}, {__mode = "v"})
end
---Initializes cache to new weak-table
function Cache:new()
self.cache = wt()
end
---Set result for given params table
---@param params table Array of keys
---@param results table Value/Array of values
function Cache:set(params, results)
local node = self.cache
for i = 1, #params do
local param = params[i]
node.children = node.children or wt()
node.children[param] = node.children[param] or wt()
node = node.children[param]
end
node.results = results
end
---Return value for given param table
---@param params table Array of keys
---@return any result Cached value
function Cache:get(params)
local node = self.cache
for i = 1, #params do
node = node.children and node.children[params[i]]
if not node then return nil end
end
return node.results
end
return Cache |
--Horizontal alignment
TEXT_ALIGN_LEFT = 1
TEXT_ALIGN_CENTER = 2
TEXT_ALIGN_RIGHT = 4
--Vertical alignment
TEXT_ALIGN_TOP = 8
TEXT_ALIGN_MIDDLE = 16
TEXT_ALIGN_BOTTOM = 32
TEXT_ALIGN_BASELINE = 64
local jacket = nil;
local selectedIndex = 1
local selectedDiff = 1
local songCache = {}
local ioffset = 0
local doffset = 0
local soffset = 0
local diffColors = {{0,0,255}, {0,255,0}, {255,0,0}, {255, 0, 255}}
local timer = 0
local effector = 0
local searchText = gfx.CreateLabel("",5,0)
local searchIndex = 1
local jacketFallback = gfx.CreateSkinImage("song_select/loading.png", 0)
local showGuide = game.GetSkinSetting("show_guide")
local legendTable = {
{["labelSingleLine"] = gfx.CreateLabel("DIFFICULTY SELECT",16, 0), ["labelMultiLine"] = gfx.CreateLabel("DIFFICULTY\nSELECT",16, 0), ["image"] = gfx.CreateSkinImage("legend/knob-left.png", 0)},
{["labelSingleLine"] = gfx.CreateLabel("MUSIC SELECT",16, 0), ["labelMultiLine"] = gfx.CreateLabel("MUSIC\nSELECT",16, 0), ["image"] = gfx.CreateSkinImage("legend/knob-right.png", 0)},
{["labelSingleLine"] = gfx.CreateLabel("FILTER MUSIC",16, 0), ["labelMultiLine"] = gfx.CreateLabel("FILTER\nMUSIC",16, 0), ["image"] = gfx.CreateSkinImage("legend/FX-L.png", 0)},
{["labelSingleLine"] = gfx.CreateLabel("MUSIC MODS",16, 0), ["labelMultiLine"] = gfx.CreateLabel("MUSIC\nMODS",16, 0), ["image"] = gfx.CreateSkinImage("legend/FX-LR.png", 0)},
{["labelSingleLine"] = gfx.CreateLabel("PLAY",16, 0), ["labelMultiLine"] = gfx.CreateLabel("PLAY",16, 0), ["image"] = gfx.CreateSkinImage("legend/start.png", 0)}
}
local grades = {
{["max"] = 6999999, ["image"] = gfx.CreateSkinImage("score/D.png", 0)},
{["max"] = 7999999, ["image"] = gfx.CreateSkinImage("score/C.png", 0)},
{["max"] = 8699999, ["image"] = gfx.CreateSkinImage("score/B.png", 0)},
{["max"] = 8999999, ["image"] = gfx.CreateSkinImage("score/A.png", 0)},
{["max"] = 9299999, ["image"] = gfx.CreateSkinImage("score/A+.png", 0)},
{["max"] = 9499999, ["image"] = gfx.CreateSkinImage("score/AA.png", 0)},
{["max"] = 9699999, ["image"] = gfx.CreateSkinImage("score/AA+.png", 0)},
{["max"] = 9799999, ["image"] = gfx.CreateSkinImage("score/AAA.png", 0)},
{["max"] = 9899999, ["image"] = gfx.CreateSkinImage("score/AAA+.png", 0)},
{["max"] = 99999999, ["image"] = gfx.CreateSkinImage("score/S.png", 0)}
}
local badges = {
gfx.CreateSkinImage("badges/played.png", 0),
gfx.CreateSkinImage("badges/clear.png", 0),
gfx.CreateSkinImage("badges/hard-clear.png", 0),
gfx.CreateSkinImage("badges/full-combo.png", 0),
gfx.CreateSkinImage("badges/perfect.png", 0)
}
gfx.LoadSkinFont("NotoSans-Regular.ttf");
game.LoadSkinSample("menu_click")
game.LoadSkinSample("click-02")
game.LoadSkinSample("woosh")
local wheelSize = 12
get_page_size = function()
return math.floor(wheelSize/2)
end
-- Responsive UI variables
-- Aspect Ratios
local aspectFloat = 1.850
local aspectRatio = "widescreen"
local landscapeWidescreenRatio = 1.850
local landscapeStandardRatio = 1.500
local portraitWidescreenRatio = 0.5
-- Responsive sizes
local fifthX = 0
local fourthX= 0
local thirdX = 0
local halfX = 0
local fullX = 0
local fifthY = 0
local fourthY= 0
local thirdY = 0
local halfY = 0
local fullY = 0
adjustScreen = function(x,y)
local a = x/y;
if x >= y and a <= landscapeStandardRatio then
aspectRatio = "landscapeStandard"
aspectFloat = 1.1
elseif x >= y and landscapeStandardRatio <= a and a <= landscapeWidescreenRatio then
aspectRatio = "landscapeWidescreen"
aspectFloat = 1.2
elseif x <= y and portraitWidescreenRatio <= a and a < landscapeStandardRatio then
aspectRatio = "PortraitWidescreen"
aspectFloat = 0.5
else
aspectRatio = "landscapeWidescreen"
aspectFloat = 1.0
end
fifthX = x/5
fourthX= x/4
thirdX = x/3
halfX = x/2
fullX = x
fifthY = y/5
fourthY= y/4
thirdY = y/3
halfY = y/2
fullY = y
end
check_or_create_cache = function(song, loadJacket)
if not songCache[song.id] then songCache[song.id] = {} end
if not songCache[song.id]["title"] then
songCache[song.id]["title"] = gfx.CreateLabel(song.title, 40, 0)
end
if not songCache[song.id]["artist"] then
songCache[song.id]["artist"] = gfx.CreateLabel(song.artist, 25, 0)
end
if not songCache[song.id]["bpm"] then
songCache[song.id]["bpm"] = gfx.CreateLabel(string.format("BPM: %s",song.bpm), 20, 0)
end
if not songCache[song.id]["effector"] then
songCache[song.id]["effector"] = gfx.CreateLabel(string.format("BPM: %s",song.bpm), 20, 0)
end
if not songCache[song.id]["jacket"] and loadJacket then
songCache[song.id]["jacket"] = gfx.CreateImage(song.difficulties[1].jacketPath, 0)
end
end
draw_scores = function(difficulty, x, y, w, h)
-- draw the top score for this difficulty
local xOffset = 5
local height = h/3 - 10
local ySpacing = h/3
local yOffset = h/3
gfx.FontSize(30);
gfx.TextAlign(gfx.TEXT_ALIGN_BOTTOM + gfx.TEXT_ALIGN_CENTER);
gfx.FastText("HIGH SCORE", x +(w/2), y+(h/2))
gfx.BeginPath()
gfx.Rect(x+xOffset,y+h/2,w-(xOffset*2),h/2)
gfx.FillColor(30,30,30,10)
gfx.StrokeColor(0,128,255)
gfx.StrokeWidth(1)
gfx.Fill()
gfx.Stroke()
if difficulty.scores[1] ~= nil then
local highScore = difficulty.scores[1]
scoreLabel = gfx.CreateLabel(string.format("%08d",highScore.score), 40, 0)
for i,v in ipairs(grades) do
if v.max > highScore.score then
gfx.BeginPath()
iw,ih = gfx.ImageSize(v.image)
iar = iw / ih;
gfx.ImageRect(x+xOffset,y+h/2 +5, iar * (h/2-10),h/2-10, v.image, 1, 0)
break
end
end
if difficulty.topBadge ~= 0 then
gfx.BeginPath()
gfx.ImageRect(x+xOffset+w-h/2, y+h/2 +5, (h/2-10), h/2-10, badges[difficulty.topBadge], 1, 0)
end
gfx.FillColor(255,255,255)
gfx.FontSize(40);
gfx.TextAlign(gfx.TEXT_ALIGN_MIDDLE + gfx.TEXT_ALIGN_CENTER);
gfx.DrawLabel(scoreLabel, x+(w/2),y+(h/4)*3,w)
end
end
draw_song = function(song, x, y, w, h, selected)
check_or_create_cache(song)
gfx.BeginPath()
gfx.RoundedRectVarying(x,y, w, h,0,0,0,40)
gfx.FillColor(30,30,30)
gfx.StrokeColor(0,128,255)
gfx.StrokeWidth(1)
if selected then
gfx.StrokeColor(255,128,0)
gfx.StrokeWidth(2)
end
gfx.Fill()
gfx.Stroke()
gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_TOP + gfx.TEXT_ALIGN_LEFT)
gfx.DrawLabel(songCache[song.id]["title"], x+10, y + 5, w-10)
gfx.DrawLabel(songCache[song.id]["artist"], x+20, y + 50, w-10)
gfx.ForceRender()
end
draw_diff_icon = function(diff, x, y, w, h, selected)
local shrinkX = w/4
local shrinkY = h/4
if selected then
gfx.FontSize(h/2)
shrinkX = w/6
shrinkY = h/6
else
gfx.FontSize(math.floor(h / 3))
end
gfx.BeginPath()
gfx.RoundedRectVarying(x+shrinkX,y+shrinkY,w-shrinkX*2,h-shrinkY*2,0,0,0,0)
gfx.FillColor(15,15,15)
gfx.StrokeColor(table.unpack(diffColors[diff.difficulty + 1]))
gfx.StrokeWidth(2)
gfx.Fill()
gfx.Stroke()
gfx.FillColor(255,255,255)
gfx.TextAlign(gfx.TEXT_ALIGN_MIDDLE + gfx.TEXT_ALIGN_CENTER)
gfx.FastText(tostring(diff.level), x+(w/2),y+(h/2))
end
draw_cursor = function(x,y,rotation,width)
gfx.Save()
gfx.BeginPath();
gfx.Translate(x,y)
gfx.Rotate(rotation)
gfx.StrokeColor(255,128,0)
gfx.StrokeWidth(4)
gfx.Rect(-width/2, -width/2, width, width)
gfx.Stroke()
gfx.Restore()
end
draw_diffs = function(diffs, x, y, w, h)
local diffWidth = w/2.5
local diffHeight = w/2.5
local diffCount = #diffs
gfx.Scissor(x,y,w,h)
for i = math.max(selectedDiff - 2, 1), math.max(selectedDiff - 1,1) do
local diff = diffs[i]
local xpos = x + ((w/2 - diffWidth/2) + (selectedDiff - i + doffset)*(-0.8*diffWidth))
if i ~= selectedDiff then
draw_diff_icon(diff, xpos, y, diffWidth, diffHeight, false)
end
end
--after selected
for i = math.min(selectedDiff + 2, diffCount), selectedDiff + 1,-1 do
local diff = diffs[i]
local xpos = x + ((w/2 - diffWidth/2) + (selectedDiff - i + doffset)*(-0.8*diffWidth))
if i ~= selectedDiff then
draw_diff_icon(diff, xpos, y, diffWidth, diffHeight, false)
end
end
local diff = diffs[selectedDiff]
local xpos = x + ((w/2 - diffWidth/2) + (doffset)*(-0.8*diffWidth))
draw_diff_icon(diff, xpos, y, diffWidth, diffHeight, true)
gfx.BeginPath()
gfx.FillColor(0,128,255)
gfx.Rect(x,y+10,2,diffHeight-h/6)
gfx.Fill()
gfx.BeginPath()
gfx.Rect(x+w-2,y+10,2,diffHeight-h/6)
gfx.Fill()
gfx.ResetScissor()
draw_cursor(x + w/2, y +diffHeight/2, timer * math.pi, diffHeight / 1.5)
end
draw_selected = function(song, x, y, w, h)
check_or_create_cache(song)
-- set up padding and margins
local xPadding = math.floor(w/16)
local yPadding = math.floor(h/32)
local xMargin = math.floor(w/16)
local yMargin = math.floor(h/32)
local width = (w-(xMargin*2))
local height = (h-(yMargin*2))
local xpos = x+xMargin
local ypos = y+yMargin
if aspectRatio == "PortraitWidescreen" then
xPadding = math.floor(w/64)
yPadding = math.floor(h/32)
xMargin = math.floor(w/64)
yMargin = math.floor(h/32)
width = (w-(xMargin*2))
height = (h-(yMargin*2))
xpos = x+xMargin
ypos = y+yMargin
end
--Border
local diff = song.difficulties[selectedDiff]
gfx.BeginPath()
gfx.RoundedRectVarying(xpos,ypos,width,height,yPadding,yPadding,yPadding,yPadding)
gfx.FillColor(30,30,30)
gfx.StrokeColor(0,128,255)
gfx.StrokeWidth(1)
gfx.Fill()
gfx.Stroke()
-- jacket should take up 1/3 of height, always be square, and be centered
local imageSize = math.floor(height/3)
local imageXPos = ((width/2) - (imageSize/2)) + x+xMargin
if aspectRatio == "PortraitWidescreen" then
--Unless its portrait widesreen..
imageSize = math.floor((height/3)*2)
imageXPos = x+xMargin+xPadding
end
if not songCache[song.id][selectedDiff] or songCache[song.id][selectedDiff] == jacketFallback then
songCache[song.id][selectedDiff] = gfx.LoadImageJob(diff.jacketPath, jacketFallback, 200,200)
end
if songCache[song.id][selectedDiff] then
gfx.BeginPath()
gfx.ImageRect(imageXPos, y+yMargin+yPadding, imageSize, imageSize, songCache[song.id][selectedDiff], 1, 0)
end
-- difficulty should take up 1/6 of height, full width, and be centered
if aspectRatio == "PortraitWidescreen" then
--difficulty wheel should be right below the jacketImage, and the same width as
--the jacketImage
draw_diffs(song.difficulties,xpos+xPadding,(ypos+yPadding+imageSize),imageSize,math.floor((height/3)*1)-yPadding)
else
-- difficulty should take up 1/6 of height, full width, and be centered
draw_diffs(song.difficulties,(w/2)-(imageSize/2),(ypos+yPadding+imageSize),imageSize,math.floor(height/6))
end
-- effector / bpm should take up 1/3 of height, full width
if aspectRatio == "PortraitWidescreen" then
gfx.FontSize(40)
gfx.TextAlign(gfx.TEXT_ALIGN_TOP + gfx.TEXT_ALIGN_LEFT)
gfx.DrawLabel(songCache[song.id]["title"], xpos+xPadding+imageSize, y+yMargin+yPadding, width-imageSize-20)
gfx.FontSize(30)
gfx.DrawLabel(songCache[song.id]["artist"], xpos+xPadding+imageSize+3, y+yMargin+yPadding + 45, width-imageSize-20)
gfx.FontSize(20)
gfx.DrawLabel(songCache[song.id]["bpm"], xpos+xPadding+imageSize+3, y+yMargin+yPadding + 85, width-imageSize-20)
gfx.FastText(string.format("Effector: %s", diff.effector), xpos+xPadding+imageSize+3, y+yMargin+yPadding + 115)
else
gfx.FontSize(40)
gfx.TextAlign(gfx.TEXT_ALIGN_TOP + gfx.TEXT_ALIGN_LEFT)
gfx.DrawLabel(songCache[song.id]["title"], xpos+10, (height/10)*6, width-20)
gfx.FontSize(30)
gfx.DrawLabel(songCache[song.id]["artist"], xpos+10, (height/10)*6 + 45, width-20)
gfx.FillColor(255,255,255)
gfx.FontSize(20)
gfx.DrawLabel(songCache[song.id]["bpm"], xpos+10, (height/10)*6 + 85)
gfx.FastText(string.format("Effector: %s", diff.effector),xpos+10, (height/10)*6 + 115)
end
if aspectRatio == "PortraitWidescreen" then
draw_scores(diff, xpos+xPadding+imageSize+3, (height/3)*2, width-imageSize-20, (height/3)-yPadding)
else
draw_scores(diff, xpos, (height/6)*5, width, (height/6))
end
gfx.ForceRender()
end
draw_songwheel = function(x,y,w,h)
local offsetX = fifthX/2
local width = math.floor((w/5)*4)
if aspectRatio == "landscapeWidescreen" then
wheelSize = 12
offsetX = 80
elseif aspectRatio == "landscapeStandard" then
wheelSize = 10
offsetX = 40
elseif aspectRatio == "PortraitWidescreen" then
wheelSize = 20
offsetX = 20
width = w
end
local height = math.floor((h/wheelSize)*1.5)
for i = math.max(selectedIndex - wheelSize/2, 1), math.max(selectedIndex - 1,0) do
local song = songwheel.songs[i]
local xpos = x + offsetX + ((selectedIndex - i + ioffset) ^ 2) * 3
local offsetY = (selectedIndex - i + ioffset) * ( height - (wheelSize/2*((selectedIndex-i + ioffset)*aspectFloat)))
local ypos = y+((h/2 - height/2) - offsetY)
draw_song(song, xpos, ypos, width, height)
end
--after selected
for i = math.min(selectedIndex + wheelSize/2, #songwheel.songs), selectedIndex + 1,-1 do
local song = songwheel.songs[i]
local xpos = x + offsetX + ((i - selectedIndex - ioffset) ^ 2) * 2
local offsetY = (selectedIndex - i + ioffset) * ( height - (wheelSize/2*((i-selectedIndex - ioffset)*aspectFloat)))
local ypos = y+((h/2 - height/2) - (selectedIndex - i) - offsetY)
local alpha = 255 - (selectedIndex - i + ioffset) * 31
draw_song(song, xpos, ypos, width, height)
end
-- draw selected
local xpos = x + offsetX/1.2 + ((-ioffset) ^ 2) * 2
local offsetY = (ioffset) * ( height - (wheelSize/2*((1)*aspectFloat)))
local ypos = y+((h/2 - height/2) - (ioffset) - offsetY)
draw_song(songwheel.songs[selectedIndex], xpos, ypos, width, height, true)
return songwheel.songs[selectedIndex]
end
draw_legend_pane = function(x,y,w,h,obj)
local xpos = x+5
local ypos = y
local imageSize = h
gfx.BeginPath()
gfx.TextAlign(gfx.TEXT_ALIGN_MIDDLE + gfx.TEXT_ALIGN_LEFT)
gfx.ImageRect(x, y, imageSize, imageSize, obj.image, 1, 0)
xpos = xpos + imageSize + 5
gfx.FontSize(16);
if h < (w-(10+imageSize))/2 then
gfx.DrawLabel(obj.labelSingleLine, xpos, y+(h/2), w-(10+imageSize))
else
gfx.DrawLabel(obj.labelMultiLine, xpos, y+(h/2), w-(10+imageSize))
end
gfx.ForceRender()
end
draw_legend = function(x,y,w,h)
gfx.TextAlign(gfx.TEXT_ALIGN_MIDDLE + gfx.TEXT_ALIGN_LEFT);
gfx.BeginPath()
gfx.FillColor(0,0,0,170)
gfx.Rect(x,y,w,h)
gfx.Fill()
local xpos = 10;
local legendWidth = math.floor((w-20)/#legendTable)
for i,v in ipairs(legendTable) do
local xOffset = draw_legend_pane(xpos+(legendWidth*(i-1)), y+5,legendWidth,h-10,legendTable[i])
end
end
draw_search = function(x,y,w,h)
soffset = soffset + (searchIndex) - (songwheel.searchInputActive and 0 or 1)
if searchIndex ~= (songwheel.searchInputActive and 0 or 1) then
game.PlaySample("woosh")
end
searchIndex = songwheel.searchInputActive and 0 or 1
gfx.BeginPath()
local bgfade = 1 - (searchIndex + soffset)
--if not songwheel.searchInputActive then bgfade = soffset end
gfx.FillColor(0,0,0,math.floor(200 * bgfade))
gfx.Rect(0,0,resx,resy)
gfx.Fill()
gfx.ForceRender()
local xpos = x + (searchIndex + soffset)*w
gfx.UpdateLabel(searchText ,string.format("Search: %s",songwheel.searchText), 30, 0)
gfx.BeginPath()
gfx.RoundedRect(xpos,y,w,h,h/2)
gfx.FillColor(30,30,30)
gfx.StrokeColor(0,128,255)
gfx.StrokeWidth(1)
gfx.Fill()
gfx.Stroke()
gfx.BeginPath();
gfx.LoadSkinFont("NotoSans-Regular.ttf");
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE);
gfx.DrawLabel(searchText, xpos+10,y+(h/2), w-20)
end
render = function(deltaTime)
timer = (timer + deltaTime)
timer = timer % 2
resx,resy = game.GetResolution();
adjustScreen(resx,resy);
gfx.BeginPath();
gfx.LoadSkinFont("NotoSans-Regular.ttf");
gfx.FontSize(40);
gfx.FillColor(255,255,255);
if songwheel.songs[1] ~= nil then
--draw songwheel and get selected song
if aspectRatio == "PortraitWidescreen" then
local song = draw_songwheel(0,0,fullX,fullY)
--render selected song information
draw_selected(song, 0,0,fullX,fifthY)
else
local song = draw_songwheel(fifthX*2,0,fifthX*3,fullY)
--render selected song information
draw_selected(song, 0,0,fifthX*2,(fifthY/2)*9)
end
end
--Draw Legend Information
if showGuide then
if aspectRatio == "PortraitWidescreen" then
draw_legend(0,(fifthY/3)*14, fullX, (fifthY/3)*1)
else
draw_legend(0,(fifthY/2)*9, fullX, (fifthY/2))
end
end
--draw text search
if aspectRatio == "PortraitWidescreen" then
draw_search(fifthX*2,5,fifthX*3,fifthY/5)
else
draw_search(fifthX*2,5,fifthX*3,fifthY/3)
end
ioffset = ioffset * 0.9
doffset = doffset * 0.9
soffset = soffset * 0.8
if songwheel.searchStatus then
gfx.BeginPath()
gfx.FillColor(255,255,255)
gfx.FontSize(20);
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.Text(songwheel.searchStatus, 3, 3)
end
if totalForce then
gfx.BeginPath()
gfx.FillColor(255,255,255)
gfx.FontSize(20);
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BOTTOM)
local forceText = string.format("Force: %.2f", totalForce)
gfx.Text(forceText, 0, fullY)
end
gfx.LoadSkinFont("NotoSans-Regular.ttf");
gfx.ResetTransform()
gfx.ForceRender()
end
set_index = function(newIndex)
if newIndex ~= selectedIndex then
game.PlaySample("menu_click")
end
ioffset = ioffset + selectedIndex - newIndex
selectedIndex = newIndex
end;
set_diff = function(newDiff)
if newDiff ~= selectedDiff then
game.PlaySample("click-02")
end
doffset = doffset + selectedDiff - newDiff
selectedDiff = newDiff
end;
-- force calculation
--------------------
totalForce = nil
local badgeRates = {
0.5, -- Played
1.0, -- Cleared
1.02, -- Hard clear
1.04, -- UC
1.1 -- PUC
}
local gradeRates = {
{["min"] = 9900000, ["rate"] = 1.05}, -- S
{["min"] = 9800000, ["rate"] = 1.02}, -- AAA+
{["min"] = 9700000, ["rate"] = 1}, -- AAA
{["min"] = 9500000, ["rate"] = 0.97}, -- AA+
{["min"] = 9300000, ["rate"] = 0.94}, -- AA
{["min"] = 9000000, ["rate"] = 0.91}, -- A+
{["min"] = 8700000, ["rate"] = 0.88}, -- A
{["min"] = 7500000, ["rate"] = 0.85}, -- B
{["min"] = 6500000, ["rate"] = 0.82}, -- C
{["min"] = 0, ["rate"] = 0.8} -- D
}
calculate_force = function(diff)
if #diff.scores < 1 then
return 0
end
local score = diff.scores[1]
local badgeRate = badgeRates[diff.topBadge]
local gradeRate
for i, v in ipairs(gradeRates) do
if score.score >= v.min then
gradeRate = v.rate
break
end
end
return math.floor((diff.level * 2) * (score.score / 10000000) * gradeRate * badgeRate) / 100
end
songs_changed = function(withAll)
if not withAll then return end
local diffs = {}
for i = 1, #songwheel.allSongs do
local song = songwheel.allSongs[i]
for j = 1, #song.difficulties do
local diff = song.difficulties[j]
diff.force = calculate_force(diff)
table.insert(diffs, diff)
end
end
table.sort(diffs, function (l, r)
return l.force > r.force
end)
totalForce = 0
for i = 1, 50 do
if diffs[i] then
totalForce = totalForce + diffs[i].force
end
end
end
|
local path = "qnSwfRes/sfw/red_envelope_light_swf_pin.png"
local red_envelope_light_swf_pin_map = {
["red_envelope_light_1.png"] = {
file=path,
x=2,y=2,
width=313,height=191,
offsetX=1,offsetY=3,
utWidth=314,
utHeight=194,
rotated=false
},
["red_envelope_light_2.png"] = {
file=path,
x=2,y=195,
width=373,height=113,
offsetX=0,offsetY=0,
utWidth=373,
utHeight=113,
rotated=false
},
["red_envelope_light_3.png"] = {
file=path,
x=317,y=2,
width=49,height=48,
offsetX=0,offsetY=0,
utWidth=48,
utHeight=49,
rotated=true
},
}
return red_envelope_light_swf_pin_map |
--Copyright 2021 The casbin Authors. All Rights Reserved.
--
--Licensed under the Apache License, Version 2.0 (the "License");
--you may not use this file except in compliance with the License.
--You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
--Unless required by applicable law or agreed to in writing, software
--distributed under the License is distributed on an "AS IS" BASIS,
--WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--See the License for the specific language governing permissions and
--limitations under the License.
local BuiltInFunctions = require("src.util.BuiltInFunctions")
describe("BuiltInFunctions tests", function ()
it("keyMatch tests", function ()
assert.is.False(BuiltInFunctions.keyMatch("/foo", "/"))
assert.is.True(BuiltInFunctions.keyMatch("/foo", "/foo"))
assert.is.True(BuiltInFunctions.keyMatch("/foo", "/foo*"))
assert.is.False(BuiltInFunctions.keyMatch("/foo", "/foo/*"))
assert.is.False(BuiltInFunctions.keyMatch("/foo/bar", "/foo"))
assert.is.True(BuiltInFunctions.keyMatch("/foo/bar", "/foo*"))
assert.is.True(BuiltInFunctions.keyMatch("/foo/bar", "/foo/*"))
assert.is.False(BuiltInFunctions.keyMatch("/foobar", "/foo"))
assert.is.True(BuiltInFunctions.keyMatch("/foobar", "/foo*"))
assert.is.False(BuiltInFunctions.keyMatch("/foobar", "/foo/*"))
end)
it("keyGet tests", function ()
assert.are.same("", BuiltInFunctions.keyGet("/foo", "/foo"))
assert.are.same("", BuiltInFunctions.keyGet("/foo", "/foo*"))
assert.are.same("", BuiltInFunctions.keyGet("/foo", "/foo/*"))
assert.are.same("", BuiltInFunctions.keyGet("/foo/bar", "/foo"))
assert.are.same("/bar", BuiltInFunctions.keyGet("/foo/bar", "/foo*"))
assert.are.same("bar", BuiltInFunctions.keyGet("/foo/bar", "/foo/*"))
assert.are.same("", BuiltInFunctions.keyGet("/foobar", "/foo"))
assert.are.same("bar", BuiltInFunctions.keyGet("/foobar", "/foo*"))
assert.are.same("", BuiltInFunctions.keyGet("/foobar", "/foo/*"))
end)
it("keyMatch2 tests", function ()
assert.is.False(BuiltInFunctions.keyMatch2("/foo", "/"))
assert.is.True(BuiltInFunctions.keyMatch2("/foo", "/foo"))
assert.is.True(BuiltInFunctions.keyMatch2("/foo", "/foo*"))
assert.is.False(BuiltInFunctions.keyMatch2("/foo", "/foo/*"))
assert.is.False(BuiltInFunctions.keyMatch2("/foo/bar", "/foo")) -- different with KeyMatch.
assert.is.False(BuiltInFunctions.keyMatch2("/foo/bar", "/foo*"))
assert.is.True(BuiltInFunctions.keyMatch2("/foo/bar", "/foo/*"))
assert.is.False(BuiltInFunctions.keyMatch2("/foobar", "/foo")) -- different with KeyMatch.
assert.is.False(BuiltInFunctions.keyMatch2("/foobar", "/foo*"))
assert.is.False(BuiltInFunctions.keyMatch2("/foobar", "/foo/*"))
assert.is.False(BuiltInFunctions.keyMatch2("/", "/:resource"))
assert.is.True(BuiltInFunctions.keyMatch2("/resource1", "/:resource"))
assert.is.False(BuiltInFunctions.keyMatch2("/myid", "/:id/using/:resId"))
assert.is.True(BuiltInFunctions.keyMatch2("/myid/using/myresid", "/:id/using/:resId"))
assert.is.False(BuiltInFunctions.keyMatch2("/proxy/myid", "/proxy/:id/*"))
assert.is.True(BuiltInFunctions.keyMatch2("/proxy/myid/", "/proxy/:id/*"))
assert.is.True(BuiltInFunctions.keyMatch2("/proxy/myid/res", "/proxy/:id/*"))
assert.is.True(BuiltInFunctions.keyMatch2("/proxy/myid/res/res2", "/proxy/:id/*"))
assert.is.True(BuiltInFunctions.keyMatch2("/proxy/myid/res/res2/res3", "/proxy/:id/*"))
assert.is.False(BuiltInFunctions.keyMatch2("/proxy/", "/proxy/:id/*"))
assert.is.True(BuiltInFunctions.keyMatch2("/alice", "/:id"))
assert.is.True(BuiltInFunctions.keyMatch2("/alice/all", "/:id/all"))
assert.is.False(BuiltInFunctions.keyMatch2("/alice", "/:id/all"))
assert.is.False(BuiltInFunctions.keyMatch2("/alice/all", "/:id"))
assert.is.False(BuiltInFunctions.keyMatch2("/alice/all", "/:/all"))
end)
it("keyMatch3 tests", function ()
assert.is.True(BuiltInFunctions.keyMatch3("/foo", "/foo"))
assert.is.True(BuiltInFunctions.keyMatch3("/foo", "/foo*"))
assert.is.False(BuiltInFunctions.keyMatch3("/foo", "/foo/*"))
assert.is.False(BuiltInFunctions.keyMatch3("/foo/bar", "/foo"))
assert.is.False(BuiltInFunctions.keyMatch3("/foo/bar", "/foo*"))
assert.is.True(BuiltInFunctions.keyMatch3("/foo/bar", "/foo/*"))
assert.is.False(BuiltInFunctions.keyMatch3("/foobar", "/foo"))
assert.is.False(BuiltInFunctions.keyMatch3("/foobar", "/foo*"))
assert.is.False(BuiltInFunctions.keyMatch3("/foobar", "/foo/*"))
assert.is.False(BuiltInFunctions.keyMatch3("/", "/{resource}"))
assert.is.True(BuiltInFunctions.keyMatch3("/resource1", "/{resource}"))
assert.is.False(BuiltInFunctions.keyMatch3("/myid", "/{id}/using/{resId}"))
assert.is.True(BuiltInFunctions.keyMatch3("/myid/using/myresid", "/{id}/using/{resId}"))
assert.is.False(BuiltInFunctions.keyMatch3("/proxy/myid", "/proxy/{id}/*"))
assert.is.True(BuiltInFunctions.keyMatch3("/proxy/myid/", "/proxy/{id}/*"))
assert.is.True(BuiltInFunctions.keyMatch3("/proxy/myid/res", "/proxy/{id}/*"))
assert.is.True(BuiltInFunctions.keyMatch3("/proxy/myid/res/res2", "/proxy/{id}/*"))
assert.is.True(BuiltInFunctions.keyMatch3("/proxy/myid/res/res2/res3", "/proxy/{id}/*"))
assert.is.False(BuiltInFunctions.keyMatch3("/proxy/", "/proxy/{id}/*"))
assert.is.False(BuiltInFunctions.keyMatch3("/myid/using/myresid", "/{id/using/{resId}"))
end)
it("keyMatch4 tests", function ()
assert.is.True(BuiltInFunctions.keyMatch4("/parent/123/child/123", "/parent/{id}/child/{id}"))
assert.is.False(BuiltInFunctions.keyMatch4("/parent/123/child/456", "/parent/{id}/child/{id}"))
assert.is.True(BuiltInFunctions.keyMatch4("/parent/123/child/123", "/parent/{id}/child/{another_id}"))
assert.is.True(BuiltInFunctions.keyMatch4("/parent/123/child/456", "/parent/{id}/child/{another_id}"))
assert.is.True(BuiltInFunctions.keyMatch4("/parent/123/child/123/book/123", "/parent/{id}/child/{id}/book/{id}"))
assert.is.False(BuiltInFunctions.keyMatch4("/parent/123/child/123/book/456", "/parent/{id}/child/{id}/book/{id}"))
assert.is.False(BuiltInFunctions.keyMatch4("/parent/123/child/456/book/123", "/parent/{id}/child/{id}/book/{id}"))
assert.is.False(BuiltInFunctions.keyMatch4("/parent/123/child/456/book/", "/parent/{id}/child/{id}/book/{id}"))
assert.is.False(BuiltInFunctions.keyMatch4("/parent/123/child/456", "/parent/{id}/child/{id}/book/{id}"))
assert.is.False(BuiltInFunctions.keyMatch4("/parent/123/child/123", "/parent/{i/d}/child/{i/d}"))
end)
it("regexMatch tests", function ()
assert.is.True(BuiltInFunctions.regexMatch("/topic/create", "/topic/create"))
assert.is.True(BuiltInFunctions.regexMatch("/topic/create/123", "/topic/create"))
assert.is.False(BuiltInFunctions.regexMatch("/topic/delete", "/topic/create"))
assert.is.False(BuiltInFunctions.regexMatch("/topic/edit", "/topic/edit/[0-9]+"))
assert.is.True(BuiltInFunctions.regexMatch("/topic/edit/123", "/topic/edit/[0-9]+"))
assert.is.False(BuiltInFunctions.regexMatch("/topic/edit/abc", "/topic/edit/[0-9]+"))
assert.is.False(BuiltInFunctions.regexMatch("/foo/delete/123", "/topic/delete/[0-9]+"))
assert.is.True(BuiltInFunctions.regexMatch("/topic/delete/0", "/topic/delete/[0-9]+"))
assert.is.False(BuiltInFunctions.regexMatch("/topic/edit/123s", "/topic/delete/[0-9]+"))
end)
it("globMatch tests", function ()
assert.is.True(BuiltInFunctions.globMatch("/foo", "/foo"))
assert.is.True(BuiltInFunctions.globMatch("/foo", "/foo*"))
assert.is.False(BuiltInFunctions.globMatch("/foo", "/foo/*"))
assert.is.False(BuiltInFunctions.globMatch("/foo/bar", "/foo"))
assert.is.False(BuiltInFunctions.globMatch("/foo/bar", "/foo*"))
assert.is.True(BuiltInFunctions.globMatch("/foo/bar", "/foo/*"))
assert.is.False(BuiltInFunctions.globMatch("/foobar", "/foo"))
assert.is.True(BuiltInFunctions.globMatch("/foobar", "/foo*"))
assert.is.False(BuiltInFunctions.globMatch("/foobar", "/foo/*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/foo", "*/foo"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/foo", "*/foo*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/foo", "*/foo/*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/foo/bar", "*/foo"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/foo/bar", "*/foo*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/foo/bar", "*/foo/*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/foobar", "*/foo"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/foobar", "*/foo*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/foobar", "*/foo/*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/subprefix/foo", "*/foo"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/subprefix/foo", "*/foo*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/subprefix/foo", "*/foo/*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/subprefix/foo/bar", "*/foo"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/subprefix/foo/bar", "*/foo*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/subprefix/foo/bar", "*/foo/*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/subprefix/foobar", "*/foo"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/subprefix/foobar", "*/foo*"))
assert.is.False(BuiltInFunctions.globMatch("/prefix/subprefix/foobar", "*/foo/*"))
end)
it("IPMatch tests", function ()
assert.is.True(BuiltInFunctions.IPMatch("192.168.2.123", "192.168.2.0/24"))
assert.is.True(BuiltInFunctions.IPMatch("192.168.2.123", "192.168.2.0/25"))
assert.is.False(BuiltInFunctions.IPMatch("192.168.2.123", "192.168.2.0/26"))
assert.is.True(BuiltInFunctions.IPMatch("192.168.2.123", "192.168.2.123"))
assert.is.False(BuiltInFunctions.IPMatch("192.168.2.124", "192.168.2.123"))
assert.is.False(BuiltInFunctions.IPMatch("192.166.2.123", "192.168.2.123"))
end)
end) |
-- Used as tie-breaker in the event that multiple registrations happen for same
-- file + line.
local callback_index = 0
local config_prefix = vim.env.HOME .. '/.config/nvim/'
-- Derives a "safe" key for the given function `fn` such that it can be stored
-- in `storage` table and used in Lua expressions (eg. `storage.key_name`).
--
-- Keys are produced by:
--
-- - Getting the path to the function (via `debug.getinfo`).
-- - Stripping off the common prefix (ie. "~/.config/nvim/").
-- - Dropping the file extension (ie. ".lua").
-- - Replacing non-alphanumeric characters (slashes, basically) with "_".
-- - Appending the line-number.
-- - Disambiguating colliding keys with a monotonically increasing
-- tie-breaker value.
--
-- For example, an anonymous function defined in "~/.config/nvim/plugin/mappings/normal.lua"
-- might receive a key like `plugin_mappings_normal_L38`.
--
local get_key_for_fn = function (fn, storage)
local info = debug.getinfo(fn)
local key = info.short_src
if vim.startswith(key, config_prefix) then
key = key:sub(#config_prefix + 1)
end
if vim.endswith(key, '.lua') then -- and sure would be weird if it _didn't_
key = key:sub(1, #key - 4)
end
key = key:gsub('%W', '_')
key = key .. '_L' .. info.linedefined
if storage[key] ~= nil then
key = key .. '_' .. callback_index
callback_index = callback_index + 1
end
return key
end
return get_key_for_fn
|
local Canvas = require("tofu.graphics").Canvas
local Class = require("tofu.util").Class
local Sprite = Class.define()
--local MIN_FREQUENCY = 0.25
--local MAX_FREQUENCY = 2.50
--local MAX_ANGLE = math.pi * 2
local CENTER_X = Canvas.width() / 2
local CENTER_Y = (Canvas.height() - 64) / 2
local PADDING = 16
local X_AMPLITUDE = (Canvas.width() / 2) - PADDING
local Y_AMPLITUDE = ((Canvas.height() - 64) / 2) - PADDING
local STEP = (2.0 * math.pi) / 32.0
function Sprite:__ctor(bank, index)
self.bank = bank
self.angle = STEP * index -- (2.0 * Num.pi) random.float() * MAX_ANGLE
self.frequency_x = 0.75 --(random.float() * (MAX_FREQUENCY - MIN_FREQUENCY)) + MIN_FREQUENCY
self.frequency_y = 0.50 --(random.float() * (MAX_FREQUENCY - MIN_FREQUENCY)) + MIN_FREQUENCY
self.frequency_s = 3.00 --(random.float() * (MAX_FREQUENCY - MIN_FREQUENCY)) + MIN_FREQUENCY
self.id = math.random(0, 11)
end
function Sprite:update(delta_time)
self.angle = self.angle + delta_time
end
function Sprite:render()
local x = CENTER_X + math.cos(self.angle * self.frequency_x) * X_AMPLITUDE
local y = CENTER_Y + math.sin(self.angle * self.frequency_y) * Y_AMPLITUDE
local s = ((math.sin(self.angle * self.frequency_s) + 1.0) / 2.0) * 1.5 + 0.5
--local o = self.bank:cell_width() * s * 0.5
--self.bank:blit(self.id, x - o, y - o, s, s)
self.bank:blit(self.id, x, y, s, s, 0.0, 0.5, 0.5)
end
return Sprite |
function InitSUWalls()
local mod={}
mod.pages={}
mod.is_image_page=function(self, str, category)
local path
if strutil.strlen(str) < 1 then return false end
path="/" .. category .. "/"
if string.sub(str, 1, strutil.strlen(path) ) == path
then
path=path.."page/"
if string.sub(str, 1, strutil.strlen(path) ) == path then return false end
return true
end
return false
end
mod.get_image=function(self, page)
local S, html, XML, tag
local url=""
local title=""
S=stream.STREAM("https://suwalls.com" .. page, "")
if S ~= nil
then
html=S:readdoc()
XML=xml.XML(html)
S:close()
tag=XML:next()
while tag ~= nil
do
if tag.type == "title"
then
title=XML:next().value
elseif tag.type == "a"
then
str=HtmlTagExtractHRef(tag.data, 'class="dlink"')
if strutil.strlen(str) > 0 then url=str end
end
tag=XML:next()
end
end
return url, title
end
mod.get=function(self, source)
local S, html, str, XML, category
category=string.sub(source, 9)
S=stream.STREAM("https://suwalls.com/" .. category, "")
if S ~= nil
then
html=S:readdoc()
XML=xml.XML(html)
S:close()
tag=XML:next()
while tag ~= nil
do
if tag.type == "a"
then
str=HtmlTagExtractHRef(tag.data,"")
if str ~= nil
then
if self:is_image_page(str, category) then table.insert(self.pages, str) end
end
end
tag=XML:next()
end
end
str=SelectRandomItem(self.pages)
return self:get_image(str)
end
return mod
end
|
local Command = VH_CommandLib.Command:new("MuteMic", VH_CommandLib.UserTypes.Admin, "Mute or unmute the player(s) microphone.", "")
Command:addArg(VH_CommandLib.ArgTypes.Plrs, {required = true})
Command:addAlias({Prefix = "!", Alias = {"mutemic", "unmutemic", "tmutemic"}})
Command.Callback = function(Sender, Alias, Targets)
local Success, Toggle = VH_CommandLib.DoToggleableCommand(Alias, {"mutemic"}, {"unmutemic"}, {"tmutemic"})
for _, ply in ipairs(Targets) do
if Toggle then
ply:PLMuteMic(!ply:PLGetMicMuted())
else
ply:PLMuteMic(Success)
end
end
if Toggle then
VH_CommandLib.SendCommandMessage(Sender, "toggled microphone mute on", Targets, "")
else
VH_CommandLib.SendCommandMessage(Sender, (Success and "" or "un-").."microphone muted", Targets, "")
end
return ""
end
local Command = VH_CommandLib.Command:new("MuteChat", VH_CommandLib.UserTypes.Admin, "Mute or unmute the player(s) chat.", "")
Command:addArg(VH_CommandLib.ArgTypes.Plrs, {required = true})
Command:addAlias({Prefix = "!", Alias = {"mutechat", "unmutechat", "tmutechat"}})
Command.Callback = function(Sender, Alias, Targets)
local Success, Toggle = VH_CommandLib.DoToggleableCommand(Alias, {"mutechat"}, {"unmutechat"}, {"tmutechat"})
for _, ply in ipairs(Targets) do
if Toggle then
ply:PLMuteChat(!ply:PLGetChatMuted())
else
ply:PLMuteChat(Success)
end
end
if Toggle then
VH_CommandLib.SendCommandMessage(Sender, "toggled chat mute on", Targets, "")
else
VH_CommandLib.SendCommandMessage(Sender, (Success and "" or "un-").."chat muted", Targets, "")
end
return ""
end
local Command = VH_CommandLib.Command:new("Mute", VH_CommandLib.UserTypes.Admin, "Mute or unmute the player(s) chat and and microphone.", "")
Command:addArg(VH_CommandLib.ArgTypes.Plrs, {required = true})
Command:addAlias({Prefix = "!", Alias = {"mute", "unmute", "tmute"}})
Command.Callback = function(Sender, Alias, Targets)
local Success, Toggle = VH_CommandLib.DoToggleableCommand(Alias, {"mute"}, {"unmute"}, {"tmute"})
for _, ply in ipairs(Targets) do
if Toggle then
ply:PLMuteChat(!ply:PLGetChatMuted())
ply:PLMuteMic(!ply:PLGetMicMuted())
else
ply:PLMuteChat(Success)
ply:PLMuteMic(Success)
end
end
if Toggle then
VH_CommandLib.SendCommandMessage(Sender, "toggled mute on", Targets, "")
else
VH_CommandLib.SendCommandMessage(Sender, (Success and "" or "un").."muted", Targets, "")
end
return ""
end |
local att = {}
att.name = "am_matchgrade"
att.displayName = "Match grade rounds"
att.displayNameShort = "Match"
att.statModifiers = {AimSpreadMult = -0.3}
if CLIENT then
att.displayIcon = surface.GetTextureID("atts/matchgradeammo")
att.description = {}
end
function att:attachFunc()
self:unloadWeapon()
end
function att:detachFunc()
self:unloadWeapon()
end
CustomizableWeaponry:registerAttachment(att) |
-- require files
require('src/player')
require('src/pipecontroller')
-- load function
function love.load()
-- set dimensions
width = 300
height = 300
-- create screen
love.window.setMode(width, height, {vsync = true, fullscreen = false})
love.graphics.setDefaultFilter('nearest', 'nearest')
-- set random seed
love.math.setRandomSeed(os.time())
-- variable for input
spacePressed = false
-- create player
player = Player:new()
-- create pipe controller
pipecontroller = PipeController:new()
deathStop = 2
-- set playing state
state = 'menu'
end
function love.update()
if state == 'play' then
player:update()
pipecontroller:update()
for ind, val in pairs(pipecontroller.list) do
if val.left < player.right and player.left < val.right then
if val.top < player.top and player.bottom < val.bottom then
-- success
else
state = 'death'
love.graphics.setColor(1, 0, 0, 1)
spacePressed = false
end
end
end
elseif state == 'death' then
deathStop = deathStop - 0.1
if deathStop <= 0 then
love.graphics.setColor(1, 1, 1, 1)
deathStop = 2
state = 'menu'
end
elseif state == 'menu' then
if spacePressed then
state = 'play'
pipecontroller.list = {}
end
end
end
function love.draw()
-- clear the canvas
love.graphics.clear()
-- draw the player
player:draw()
-- draw the pipes
pipecontroller:draw()
end
function love.keypressed(key)
if key == 'escape' then -- escape key
-- quit
love.event.push('quit')
elseif key == 'space' then -- space key
-- set input variable to true
spacePressed = true
end
end |
-- Config = {}
-- Config.NoMoney = 'Você não possúi dinheiro suficiente $'
-- Config.Shoptext = 'Pressione (G) para comprar um cavalo'
-- Config.LevelMissing = 'Você não tem experiência suficiente'
-- Config.Coords = {
-- vector3(-364.88,791.47,116.18),
-- vector3(-878.48,-1367.97,43.53),
-- vector3(-1774.27,-437.09,155.05),
-- vector3(2509.93,-1457.05,46.31),
-- vector3(2976.11,1430.56,44.72)
-- }
-- Config.Horses = {
-- "A_C_HORSE_GANG_KIERAN",
-- "A_C_HORSE_MORGAN_BAY",
-- "A_C_HORSE_MORGAN_BAYROAN",
-- "A_C_HORSE_MORGAN_FLAXENCHESTNUT",
-- "A_C_HORSE_MORGAN_PALOMINO",
-- "A_C_HORSE_KENTUCKYSADDLE_BLACK",
-- "A_C_HORSE_KENTUCKYSADDLE_CHESTNUTPINTO",
-- "A_C_HORSE_KENTUCKYSADDLE_GREY",
-- "A_C_HORSE_KENTUCKYSADDLE_SILVERBAY",
-- "A_C_HORSE_TENNESSEEWALKER_BLACKRABICANO",
-- "A_C_HORSE_TENNESSEEWALKER_CHESTNUT",
-- "A_C_HORSE_TENNESSEEWALKER_DAPPLEBAY",
-- "A_C_HORSE_TENNESSEEWALKER_REDROAN",
-- "A_C_HORSE_AMERICANPAINT_GREYOVERO",
-- "A_C_HORSE_AMERICANSTANDARDBRED_PALOMINODAPPLE",
-- "A_C_HORSE_AMERICANSTANDARDBRED_SILVERTAILBUCKSKIN",
-- "A_C_HORSE_ANDALUSIAN_DARKBAY",
-- "A_C_HORSE_ANDALUSIAN_ROSEGRAY",
-- "A_C_HORSE_APPALOOSA_BROWNLEOPARD",
-- "A_C_HORSE_APPALOOSA_LEOPARD",
-- "A_C_HORSE_ARABIAN_BLACK",
-- "A_C_HORSE_ARABIAN_ROSEGREYBAY",
-- "A_C_HORSE_ARDENNES_BAYROAN",
-- "A_C_HORSE_ARDENNES_STRAWBERRYROAN",
-- "A_C_HORSE_BELGIAN_BLONDCHESTNUT",
-- "A_C_HORSE_BELGIAN_MEALYCHESTNUT",
-- "A_C_HORSE_DUTCHWARMBLOOD_CHOCOLATEROAN",
-- "A_C_HORSE_DUTCHWARMBLOOD_SEALBROWN",
-- "A_C_HORSE_DUTCHWARMBLOOD_SOOTYBUCKSKIN",
-- "A_C_HORSE_HUNGARIANHALFBRED_DARKDAPPLEGREY",
-- "A_C_HORSE_HUNGARIANHALFBRED_PIEBALDTOBIANO",
-- "A_C_HORSE_MISSOURIFOXTROTTER_AMBERCHAMPAGNE",
-- "A_C_HORSE_MISSOURIFOXTROTTER_SILVERDAPPLEPINTO",
-- "A_C_HORSE_NOKOTA_REVERSEDAPPLEROAN",
-- "A_C_HORSE_SHIRE_DARKBAY",
-- "A_C_HORSE_SHIRE_LIGHTGREY",
-- "A_C_HORSE_SUFFOLKPUNCH_SORREL",
-- "A_C_HORSE_SUFFOLKPUNCH_REDCHESTNUT",
-- "A_C_HORSE_TENNESSEEWALKER_FLAXENROAN",
-- "A_C_HORSE_THOROUGHBRED_BRINDLE",
-- "A_C_HORSE_TURKOMAN_DARKBAY",
-- "A_C_HORSE_TURKOMAN_GOLD",
-- "A_C_HORSE_TURKOMAN_SILVER",
-- "A_C_HORSE_GANG_BILL",
-- "A_C_HORSE_GANG_CHARLES",
-- "A_C_HORSE_GANG_DUTCH",
-- "A_C_HORSE_GANG_HOSEA",
-- "A_C_HORSE_GANG_JAVIER",
-- "A_C_HORSE_GANG_JOHN",
-- "A_C_HORSE_GANG_KAREN",
-- "A_C_HORSE_GANG_LENNY",
-- "A_C_HORSE_GANG_MICAH",
-- "A_C_HORSE_GANG_SADIE",
-- "A_C_HORSE_GANG_SEAN",
-- "A_C_HORSE_GANG_TRELAWNEY",
-- "A_C_HORSE_GANG_UNCLE",
-- "A_C_HORSE_GANG_SADIE_ENDLESSSUMMER",
-- "A_C_HORSE_GANG_CHARLES_ENDLESSSUMMER",
-- "A_C_HORSE_GANG_UNCLE_ENDLESSSUMMER",
-- "A_C_HORSE_AMERICANPAINT_OVERO",
-- "A_C_HORSE_AMERICANPAINT_TOBIANO",
-- "A_C_HORSE_AMERICANPAINT_SPLASHEDWHITE",
-- "A_C_HORSE_AMERICANSTANDARDBRED_BLACK",
-- "A_C_HORSE_AMERICANSTANDARDBRED_BUCKSKIN",
-- "A_C_HORSE_APPALOOSA_BLANKET",
-- "A_C_HORSE_APPALOOSA_LEOPARDBLANKET",
-- "A_C_HORSE_ARABIAN_WHITE",
-- "A_C_HORSE_HUNGARIANHALFBRED_FLAXENCHESTNUT",
-- "A_C_HORSE_MUSTANG_GRULLODUN",
-- "A_C_HORSE_MUSTANG_WILDBAY",
-- "A_C_HORSE_MUSTANG_TIGERSTRIPEDBAY",
-- "A_C_HORSE_NOKOTA_BLUEROAN",
-- "A_C_HORSE_NOKOTA_WHITEROAN",
-- "A_C_HORSE_THOROUGHBRED_BLOODBAY",
-- "A_C_HORSE_THOROUGHBRED_DAPPLEGREY",
-- "A_C_Donkey_01",
-- }
|
--[[
Scripts can have parameters defined in the level XML file.
These serve as input to a specific instance of the script and can be used to configure various options and parameters of the script.
While these parameters can be read at any time in the script, it's recommended to copy them to a global variable in or outside the init function.
]]
---@param name string Parameter name
---@param default number Default parameter value
---@return number Parameter value
---@see @https://www.teardowngame.com/modding/api.html#GetIntParam
function GetIntParam(name, default) end
---@param name string Parameter name
---@param default number Default parameter value
---@return number Parameter value
---@see @https://www.teardowngame.com/modding/api.html#GetFloatParam
function GetFloatParam(name, default) end
---@param name string Parameter name
---@param default boolean Default parameter value
---@return boolean Parameter value
---@see @https://www.teardowngame.com/modding/api.html#GetBoolParam
function GetBoolParam(name, default) end
---@param name string Parameter name
---@param default string Default parameter value
---@return string Parameter value
---@see @https://www.teardowngame.com/modding/api.html#GetStringParam
function GetStringParam(name, default) end
|
local K, C = unpack(select(2, ...))
local Module = K:GetModule("Auras")
local _G = _G
local CreateFrame = _G.CreateFrame
local GetSpellCharges = _G.GetSpellCharges
local GetSpellCooldown = _G.GetSpellCooldown
local GetSpellTexture = _G.GetSpellTexture
local GetTime = _G.GetTime
local GetTotemInfo = _G.GetTotemInfo
local InCombatLockdown = _G.InCombatLockdown
local UnitAura = _G.UnitAura
function Module:GetUnitAura(unit, spell, filter)
for index = 1, 32 do
local name, _, count, _, duration, expire, caster, _, _, spellID, _, _, _, _, _, value = UnitAura(unit, index, filter)
if not name then
break
end
if name and spellID == spell then
return name, count, duration, expire, caster, spellID, value
end
end
end
function Module:UpdateCooldown(button, spellID, texture)
local charges, maxCharges, chargeStart, chargeDuration = GetSpellCharges(spellID)
local start, duration = GetSpellCooldown(spellID)
if charges and maxCharges > 1 then
button.Count:SetText(charges)
else
button.Count:SetText("")
end
if charges and charges > 0 and charges < maxCharges then
button.CD:SetCooldown(chargeStart, chargeDuration)
button.CD:Show()
button.Icon:SetDesaturated(false)
button.Count:SetTextColor(0, 1, 0)
elseif start and duration > 1.5 then
button.CD:SetCooldown(start, duration)
button.CD:Show()
button.Icon:SetDesaturated(true)
button.Count:SetTextColor(1, 1, 1)
else
button.CD:Hide()
button.Icon:SetDesaturated(false)
if charges == maxCharges then
button.Count:SetTextColor(1, 0, 0)
end
end
if texture then
button.Icon:SetTexture(GetSpellTexture(spellID))
end
end
function Module:GlowOnEnd()
local elapsed = self.expire - GetTime()
if elapsed < 3 then
K.ShowButtonGlow(self.glowFrame)
else
K.HideButtonGlow(self.glowFrame)
end
end
function Module:UpdateAura(button, unit, auraID, filter, spellID, cooldown, glow)
button.Icon:SetTexture(GetSpellTexture(spellID))
local name, count, duration, expire, caster = Module:GetUnitAura(unit, auraID, filter)
if name and caster == "player" then
if button.Count then
if count == 0 then
count = ""
end
button.Count:SetText(count)
end
button.CD:SetCooldown(expire-duration, duration)
button.CD:Show()
button.Icon:SetDesaturated(false)
if glow then
if glow == "END" then
button.expire = expire
button:SetScript("OnUpdate", Module.GlowOnEnd)
else
K.ShowButtonGlow(button.glowFrame)
end
end
else
if cooldown then
Module:UpdateCooldown(button, spellID)
else
if button.Count then
button.Count:SetText("")
end
button.CD:Hide()
button.Icon:SetDesaturated(true)
end
if glow then
button:SetScript("OnUpdate", nil)
K.HideButtonGlow(button.glowFrame)
end
end
end
function Module:UpdateTotemAura(button, texture, spellID, glow)
button.Icon:SetTexture(texture)
local found
for slot = 1, 4 do
local haveTotem, _, start, dur, icon = GetTotemInfo(slot)
if haveTotem and icon == texture and (start + dur - GetTime() > 0) then
button.CD:SetCooldown(start, dur)
button.CD:Show()
button.Icon:SetDesaturated(false)
button.Count:SetText("")
if glow then
if glow == "END" then
button.expire = start + dur
button:SetScript("OnUpdate", Module.GlowOnEnd)
else
K.ShowButtonGlow(button.glowFrame)
end
end
found = true
break
end
end
if not found then
if spellID then
Module:UpdateCooldown(button, spellID)
else
button.CD:Hide()
button.Icon:SetDesaturated(true)
end
if glow then
button:SetScript("OnUpdate", nil)
K.HideButtonGlow(button.glowFrame)
end
end
end
local function UpdateVisibility(self)
if InCombatLockdown() or self.lumos.onFire then
return
end
for i = 1, 5 do
local bu = self.lumos[i]
bu.Count:SetTextColor(1, 1, 1)
bu.Count:SetText("")
bu.CD:Hide()
bu:SetScript("OnUpdate", nil)
bu.Icon:SetDesaturated(true)
K.HideButtonGlow(bu.glowFrame)
end
if Module.PostUpdateVisibility then
Module:PostUpdateVisibility(self)
end
end
local lumosUnits = {
["player"] = true,
["target"] = true,
}
local function UpdateIcons(self, event, unit)
if event == "UNIT_AURA" and not lumosUnits[unit] then
return
end
Module:ChantLumos(self)
UpdateVisibility(self)
end
local function TurnOn(self)
self:RegisterEvent("UNIT_AURA", UpdateIcons)
self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateIcons, true)
self:RegisterEvent("SPELL_UPDATE_COOLDOWN", UpdateIcons, true)
self:RegisterEvent("SPELL_UPDATE_CHARGES", UpdateIcons, true)
end
local function TurnOff(self)
self:UnregisterEvent("UNIT_AURA", UpdateIcons)
self:UnregisterEvent("PLAYER_TARGET_CHANGED", UpdateIcons)
self:UnregisterEvent("SPELL_UPDATE_COOLDOWN", UpdateIcons)
self:UnregisterEvent("SPELL_UPDATE_CHARGES", UpdateIcons)
UpdateVisibility(self)
end
local function OnTalentUpdate(self, event)
UpdateIcons(self, event)
if self.lumos.onFire then
if Module.PostUpdateVisibility then
Module:PostUpdateVisibility(self)
end
end
end
function Module:CreateLumos(self)
if not Module.ChantLumos then
return
end
self.lumos = {}
self.lumos.onFire = C["Nameplate"].PPOnFire
local iconSize = self.iconSize
for i = 1, 5 do
local bu = CreateFrame("Frame", nil, self.Health)
bu:SetSize(iconSize, iconSize)
bu.CD = CreateFrame("Cooldown", nil, bu, "CooldownFrameTemplate")
bu.CD:SetAllPoints()
bu.CD:SetReverse(true)
bu.Icon = bu:CreateTexture(nil, "ARTWORK")
bu.Icon:SetAllPoints()
bu.Icon:SetTexCoord(unpack(K.TexCoords))
bu:CreateShadow()
bu.glowFrame = CreateFrame("Frame", nil, bu)
bu.glowFrame:SetPoint("TOPLEFT", bu, -4, 4)
bu.glowFrame:SetPoint("BOTTOMRIGHT", bu, 4, -4)
bu.glowFrame:SetSize(iconSize, iconSize)
bu.glowFrame:SetFrameLevel(bu:GetFrameLevel())
local fontParent = CreateFrame("Frame", nil, bu)
fontParent:SetAllPoints()
fontParent:SetFrameLevel(bu:GetFrameLevel() + 5)
bu.Count = K.CreateFontString(fontParent, 14, "", "OUTLINE", false, "BOTTOM", 0, -8)
if i == 1 then
bu:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -5)
else
bu:SetPoint("LEFT", self.lumos[i-1], "RIGHT", 2, 0)
end
self.lumos[i] = bu
end
if Module.PostCreateLumos then
Module:PostCreateLumos(self)
end
UpdateIcons(self)
if self.lumos.onFire then
TurnOn(self)
else
self:RegisterEvent("PLAYER_REGEN_ENABLED", TurnOff, true)
self:RegisterEvent("PLAYER_REGEN_DISABLED", TurnOn, true)
end
self:RegisterEvent("PLAYER_TALENT_UPDATE", OnTalentUpdate, true)
end |
local M = {}
local validators = require "validators"
local function texcmd(cmd, args, nopts, pos)
args = args or {}
nopts = nopts or 0
pos = pos or 1
local str = string.format([[\%s]], cmd)
for i, arg in ipairs(args) do
if nopts > 0 and i >= pos then
str = str .. string.format("[%s]", arg)
nopts = nopts - 1
else
str = str .. string.format("{%s}", arg)
end
end
return str
end
function M.newcommand(name, body, nargs, default)
validators.validate_texcmd_name(name)
nargs = nargs or 0
local args, nopts, pos
if default == nil then
args = {texcmd(name), nargs, body}
nopts = 1
else
args = {texcmd(name), nargs, default, body}
nopts = 2
end
pos = 2
return texcmd("newcommand", args, nopts, pos)
end
function M.directlua(str)
return texcmd("directlua", {str})
end
function M.luaescapestring(str)
return texcmd("luaescapestring", {str})
end
function M.usepackage(str)
return texcmd("usepackage", {str})
end
return M
|
local mode = module:get_option_string("log_auth_ips", "failure");
assert(({ all = true, failure = true, success = true })[mode], "Unknown log mode: "..tostring(mode).." - valid modes are 'all', 'failure', 'success'");
if mode == "failure" or mode == "all" then
module:hook("authentication-failure", function (event)
module:log("info", "Failed authentication attempt (%s) for user %s from IP: %s", event.condition or "unknown-condition", event.session.username or "?", event.session.ip or "?");
end);
end
if mode == "success" or mode == "all" then
module:hook("authentication-success", function (event)
local session = event.session;
module:log("info", "Successful authentication as %s from IP: %s", session.username, session.ip or "?");
end);
end
|
--- Table containing a list of resolutions.
-- The current resolution can be obtained through Resolution.currentResolution.
local Resolution = {
{
width = 640,
height = 360
},
{
width = 960,
height = 540
},
{
width = 1280,
height = 720
},
{
width = 1920,
height = 1080
}
}
Resolution.currentResolution = 2
Resolution.fullscreen = false
Resolution.vsync = false
--- Increases the window resolution.
-- @return True if resolution changed.
function Resolution:increase()
local newRes = math.min(#self, self.currentResolution + 1)
return self:set(newRes)
end
--- Decreases the window resolution.
-- @return True if resolution changed.
function Resolution:decrease()
local newRes = math.max(1, self.currentResolution - 1)
return self:set(newRes)
end
--- Sets the window resolution.
-- @param res Index into the table of resolutions
-- @param force Forces the resolution to change
-- @return True if resolution changed.
function Resolution:set(res, force)
assert(res >= 1, "Invalid resolution")
assert(res <= #self, "Invalid resolution")
if res ~= self.currentResolution or force then
love.window.setMode(self[res].width, self[res].height, {
vsync = self.vsync,
fullscreen = self.fullscreen,
fullscreentype = "desktop"
})
self.currentResolution = res
return true
end
return false
end
--- Forcefully resizes the window to the current resolution.
-- Useful when fullscreen or vsync has changed.
-- @return True if resolution changed
function Resolution:reset()
return self:set(self.currentResolution, true)
end
--- Returns the current resolution.
function Resolution:get()
return self[self.currentResolution]
end
return Resolution
|
Config = {}
Config.DrawDistance = 100.0
Config.MarkerColor = { r = 120, g = 120, b = 240 }
Config.EnablePlayerManagement = false -- enables the actual car dealer job. You'll need esx_addonaccount, esx_billing and esx_society
Config.EnableOwnedVehicles = true
Config.EnableSocietyOwnedVehicles = false -- use with EnablePlayerManagement disabled, or else it wont have any effects
Config.ResellPercentage = 50
Config.Locale = 'fr'
Config.LicenseEnable = false -- require people to own drivers license when buying vehicles? Only applies if EnablePlayerManagement is disabled. Requires esx_license
-- looks like this: 'LLL NNN'
-- The maximum plate length is 8 chars (including spaces & symbols), don't go past it!
Config.PlateLetters = 3
Config.PlateNumbers = 3
Config.PlateUseSpace = true
Config.Zones = {
ShopEntering = {
Pos = { x = -33.777, y = -1102.021, z = 25.422 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Type = 1
},
ShopInside = {
Pos = { x = -47.570, y = -1097.221, z = 25.422 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Heading = -20.0,
Type = -1
},
ShopOutside = {
Pos = { x = -45.0841, y = -1077.0808, z = 25.6863 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Heading = 71.8356,
Type = -1
},
BossActions = {
Pos = { x = -32.065, y = -1114.277, z = 25.422 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Type = -1
},
GiveBackVehicle = {
Pos = { x = -18.227, y = -1078.558, z = 25.675 },
Size = { x = 3.0, y = 3.0, z = 1.0 },
Type = (Config.EnablePlayerManagement and 1 or -1)
}
}
|
local help_message = [[
This is a module file for the container quay.io/biocontainers/eden:2.0--py27h24bf2e0_1, which exposes the
following programs:
- .dbus-post-link.sh
- RNAshapes
- annotate.py
- annotateBed
- assistant
- babel
- bamToBed
- bamToFastq
- bcftools
- bed12ToBed6
- bedToBam
- bedToIgv
- bedpeToBam
- bedtools
- closestBed
- clusterBed
- color-chrs.pl
- complementBed
- coverageBed
- createfontdatachunk.py
- dbus-launch
- designer
- dvipdf
- enhancer.py
- eps2eps
- expandCols
- explode.py
- fastaFromBed
- fixqt4headers.pl
- flankBed
- font2c
- genomeCoverageBed
- getOverlap
- get_objgraph
- gifmaker.py
- groupBy
- gs
- gsbj
- gsdj
- gsdj500
- gslj
- gslp
- gsnd
- gst-device-monitor-1.0
- gst-discoverer-1.0
- gst-inspect-1.0
- gst-launch-1.0
- gst-play-1.0
- gst-stats-1.0
- gst-typefind-1.0
- guess-ploidy.py
- intersectBed
- intersection_matrix.py
- intron_exon_reads.py
- lconvert
- linguist
- linksBed
- location_predictor
- lprsetup.sh
- lrelease
- lupdate
- mapBed
- maskFastaFromBed
- mergeBed
- moc
- model
- motif
- motif_display.py
- multiBamCov
- multiIntersectBed
- muscle
- nucBed
- obabel
- obchiral
- obconformer
- obdistgen
- obenergy
- obfit
- obgen
- obgrep
- obminimize
- obprobe
- obprop
- obrms
- obrotamer
- obrotate
- obspectrophore
- obsym
- obtautomer
- obthermo
- painter.py
- pairToBed
- pairToPair
- pbt_plotting_example.py
- pdf2dsc
- pdf2ps
- peak_pie.py
- pf2afm
- pfbtopfa
- pilconvert.py
- pildriver.py
- pilfile.py
- pilfont.py
- pilprint.py
- pixeltool
- player.py
- plot-roh.py
- plot-vcfstats
- pphs
- printafm
- ps2ascii
- ps2epsi
- ps2pdf
- ps2pdf12
- ps2pdf13
- ps2pdf14
- ps2pdfwr
- ps2ps
- ps2ps2
- pybedtools
- pylupdate5
- pyrcc5
- pyuic5
- qcollectiongenerator
- qdbus
- qdbuscpp2xml
- qdbusviewer
- qdbusxml2cpp
- qdoc
- qhelpconverter
- qhelpgenerator
- qlalr
- qmake
- qml
- qmleasing
- qmlimportscanner
- qmllint
- qmlmin
- qmlplugindump
- qmlprofiler
- qmlscene
- qmltestrunner
- qtdiag
- qtpaths
- qtplugininfo
- randomBed
- rcc
- roundtrip
- run-roh.pl
- sample
- samtools
- shiftBed
- shuffleBed
- sip
- slopBed
- sortBed
- subtractBed
- syncqt.pl
- tagBam
- thresholder.py
- transformseq
- uic
- undill
- unionBedGraphs
- unix-lpr.sh
- vcfutils.pl
- venn_gchart.py
- venn_mpl.py
- viewer.py
- weblogo
- wftopfa
- windowBed
- windowMaker
- xmlpatterns
- xmlpatternsvalidator
This container was pulled from:
https://quay.io/repository/biocontainers/eden
If you encounter errors in eden or need help running the
tools it contains, please contact the developer at
https://quay.io/repository/biocontainers/eden
For errors in the container or module file, please
submit a ticket at
gzynda@tacc.utexas.edu
https://portal.tacc.utexas.edu/tacc-consulting
]]
help(help_message,"\n")
whatis("Name: eden")
whatis("Version: ctr-2.0--py27h24bf2e0_1")
whatis("Category: ['Bioinformatics']")
whatis("Keywords: ['Biocontainer']")
whatis("Description: The eden package")
whatis("URL: https://quay.io/repository/biocontainers/eden")
set_shell_function(".dbus-post-link.sh",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg .dbus-post-link.sh $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg .dbus-post-link.sh $*')
set_shell_function("RNAshapes",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg RNAshapes $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg RNAshapes $*')
set_shell_function("annotate.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg annotate.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg annotate.py $*')
set_shell_function("annotateBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg annotateBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg annotateBed $*')
set_shell_function("assistant",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg assistant $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg assistant $*')
set_shell_function("babel",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg babel $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg babel $*')
set_shell_function("bamToBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bamToBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bamToBed $*')
set_shell_function("bamToFastq",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bamToFastq $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bamToFastq $*')
set_shell_function("bcftools",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bcftools $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bcftools $*')
set_shell_function("bed12ToBed6",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bed12ToBed6 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bed12ToBed6 $*')
set_shell_function("bedToBam",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bedToBam $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bedToBam $*')
set_shell_function("bedToIgv",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bedToIgv $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bedToIgv $*')
set_shell_function("bedpeToBam",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bedpeToBam $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bedpeToBam $*')
set_shell_function("bedtools",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bedtools $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg bedtools $*')
set_shell_function("closestBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg closestBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg closestBed $*')
set_shell_function("clusterBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg clusterBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg clusterBed $*')
set_shell_function("color-chrs.pl",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg color-chrs.pl $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg color-chrs.pl $*')
set_shell_function("complementBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg complementBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg complementBed $*')
set_shell_function("coverageBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg coverageBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg coverageBed $*')
set_shell_function("createfontdatachunk.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg createfontdatachunk.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg createfontdatachunk.py $*')
set_shell_function("dbus-launch",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg dbus-launch $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg dbus-launch $*')
set_shell_function("designer",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg designer $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg designer $*')
set_shell_function("dvipdf",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg dvipdf $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg dvipdf $*')
set_shell_function("enhancer.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg enhancer.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg enhancer.py $*')
set_shell_function("eps2eps",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg eps2eps $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg eps2eps $*')
set_shell_function("expandCols",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg expandCols $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg expandCols $*')
set_shell_function("explode.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg explode.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg explode.py $*')
set_shell_function("fastaFromBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg fastaFromBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg fastaFromBed $*')
set_shell_function("fixqt4headers.pl",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg fixqt4headers.pl $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg fixqt4headers.pl $*')
set_shell_function("flankBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg flankBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg flankBed $*')
set_shell_function("font2c",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg font2c $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg font2c $*')
set_shell_function("genomeCoverageBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg genomeCoverageBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg genomeCoverageBed $*')
set_shell_function("getOverlap",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg getOverlap $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg getOverlap $*')
set_shell_function("get_objgraph",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg get_objgraph $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg get_objgraph $*')
set_shell_function("gifmaker.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gifmaker.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gifmaker.py $*')
set_shell_function("groupBy",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg groupBy $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg groupBy $*')
set_shell_function("gs",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gs $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gs $*')
set_shell_function("gsbj",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gsbj $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gsbj $*')
set_shell_function("gsdj",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gsdj $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gsdj $*')
set_shell_function("gsdj500",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gsdj500 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gsdj500 $*')
set_shell_function("gslj",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gslj $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gslj $*')
set_shell_function("gslp",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gslp $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gslp $*')
set_shell_function("gsnd",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gsnd $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gsnd $*')
set_shell_function("gst-device-monitor-1.0",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-device-monitor-1.0 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-device-monitor-1.0 $*')
set_shell_function("gst-discoverer-1.0",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-discoverer-1.0 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-discoverer-1.0 $*')
set_shell_function("gst-inspect-1.0",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-inspect-1.0 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-inspect-1.0 $*')
set_shell_function("gst-launch-1.0",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-launch-1.0 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-launch-1.0 $*')
set_shell_function("gst-play-1.0",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-play-1.0 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-play-1.0 $*')
set_shell_function("gst-stats-1.0",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-stats-1.0 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-stats-1.0 $*')
set_shell_function("gst-typefind-1.0",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-typefind-1.0 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg gst-typefind-1.0 $*')
set_shell_function("guess-ploidy.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg guess-ploidy.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg guess-ploidy.py $*')
set_shell_function("intersectBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg intersectBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg intersectBed $*')
set_shell_function("intersection_matrix.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg intersection_matrix.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg intersection_matrix.py $*')
set_shell_function("intron_exon_reads.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg intron_exon_reads.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg intron_exon_reads.py $*')
set_shell_function("lconvert",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg lconvert $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg lconvert $*')
set_shell_function("linguist",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg linguist $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg linguist $*')
set_shell_function("linksBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg linksBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg linksBed $*')
set_shell_function("location_predictor",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg location_predictor $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg location_predictor $*')
set_shell_function("lprsetup.sh",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg lprsetup.sh $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg lprsetup.sh $*')
set_shell_function("lrelease",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg lrelease $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg lrelease $*')
set_shell_function("lupdate",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg lupdate $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg lupdate $*')
set_shell_function("mapBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg mapBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg mapBed $*')
set_shell_function("maskFastaFromBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg maskFastaFromBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg maskFastaFromBed $*')
set_shell_function("mergeBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg mergeBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg mergeBed $*')
set_shell_function("moc",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg moc $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg moc $*')
set_shell_function("model",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg model $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg model $*')
set_shell_function("motif",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg motif $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg motif $*')
set_shell_function("motif_display.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg motif_display.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg motif_display.py $*')
set_shell_function("multiBamCov",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg multiBamCov $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg multiBamCov $*')
set_shell_function("multiIntersectBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg multiIntersectBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg multiIntersectBed $*')
set_shell_function("muscle",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg muscle $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg muscle $*')
set_shell_function("nucBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg nucBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg nucBed $*')
set_shell_function("obabel",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obabel $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obabel $*')
set_shell_function("obchiral",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obchiral $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obchiral $*')
set_shell_function("obconformer",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obconformer $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obconformer $*')
set_shell_function("obdistgen",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obdistgen $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obdistgen $*')
set_shell_function("obenergy",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obenergy $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obenergy $*')
set_shell_function("obfit",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obfit $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obfit $*')
set_shell_function("obgen",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obgen $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obgen $*')
set_shell_function("obgrep",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obgrep $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obgrep $*')
set_shell_function("obminimize",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obminimize $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obminimize $*')
set_shell_function("obprobe",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obprobe $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obprobe $*')
set_shell_function("obprop",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obprop $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obprop $*')
set_shell_function("obrms",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obrms $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obrms $*')
set_shell_function("obrotamer",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obrotamer $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obrotamer $*')
set_shell_function("obrotate",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obrotate $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obrotate $*')
set_shell_function("obspectrophore",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obspectrophore $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obspectrophore $*')
set_shell_function("obsym",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obsym $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obsym $*')
set_shell_function("obtautomer",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obtautomer $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obtautomer $*')
set_shell_function("obthermo",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obthermo $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg obthermo $*')
set_shell_function("painter.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg painter.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg painter.py $*')
set_shell_function("pairToBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pairToBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pairToBed $*')
set_shell_function("pairToPair",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pairToPair $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pairToPair $*')
set_shell_function("pbt_plotting_example.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pbt_plotting_example.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pbt_plotting_example.py $*')
set_shell_function("pdf2dsc",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pdf2dsc $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pdf2dsc $*')
set_shell_function("pdf2ps",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pdf2ps $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pdf2ps $*')
set_shell_function("peak_pie.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg peak_pie.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg peak_pie.py $*')
set_shell_function("pf2afm",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pf2afm $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pf2afm $*')
set_shell_function("pfbtopfa",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pfbtopfa $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pfbtopfa $*')
set_shell_function("pilconvert.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pilconvert.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pilconvert.py $*')
set_shell_function("pildriver.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pildriver.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pildriver.py $*')
set_shell_function("pilfile.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pilfile.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pilfile.py $*')
set_shell_function("pilfont.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pilfont.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pilfont.py $*')
set_shell_function("pilprint.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pilprint.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pilprint.py $*')
set_shell_function("pixeltool",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pixeltool $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pixeltool $*')
set_shell_function("player.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg player.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg player.py $*')
set_shell_function("plot-roh.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg plot-roh.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg plot-roh.py $*')
set_shell_function("plot-vcfstats",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg plot-vcfstats $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg plot-vcfstats $*')
set_shell_function("pphs",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pphs $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pphs $*')
set_shell_function("printafm",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg printafm $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg printafm $*')
set_shell_function("ps2ascii",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2ascii $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2ascii $*')
set_shell_function("ps2epsi",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2epsi $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2epsi $*')
set_shell_function("ps2pdf",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdf $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdf $*')
set_shell_function("ps2pdf12",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdf12 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdf12 $*')
set_shell_function("ps2pdf13",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdf13 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdf13 $*')
set_shell_function("ps2pdf14",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdf14 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdf14 $*')
set_shell_function("ps2pdfwr",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdfwr $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2pdfwr $*')
set_shell_function("ps2ps",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2ps $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2ps $*')
set_shell_function("ps2ps2",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2ps2 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg ps2ps2 $*')
set_shell_function("pybedtools",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pybedtools $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pybedtools $*')
set_shell_function("pylupdate5",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pylupdate5 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pylupdate5 $*')
set_shell_function("pyrcc5",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pyrcc5 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pyrcc5 $*')
set_shell_function("pyuic5",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pyuic5 $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg pyuic5 $*')
set_shell_function("qcollectiongenerator",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qcollectiongenerator $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qcollectiongenerator $*')
set_shell_function("qdbus",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdbus $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdbus $*')
set_shell_function("qdbuscpp2xml",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdbuscpp2xml $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdbuscpp2xml $*')
set_shell_function("qdbusviewer",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdbusviewer $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdbusviewer $*')
set_shell_function("qdbusxml2cpp",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdbusxml2cpp $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdbusxml2cpp $*')
set_shell_function("qdoc",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdoc $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qdoc $*')
set_shell_function("qhelpconverter",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qhelpconverter $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qhelpconverter $*')
set_shell_function("qhelpgenerator",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qhelpgenerator $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qhelpgenerator $*')
set_shell_function("qlalr",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qlalr $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qlalr $*')
set_shell_function("qmake",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmake $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmake $*')
set_shell_function("qml",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qml $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qml $*')
set_shell_function("qmleasing",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmleasing $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmleasing $*')
set_shell_function("qmlimportscanner",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlimportscanner $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlimportscanner $*')
set_shell_function("qmllint",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmllint $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmllint $*')
set_shell_function("qmlmin",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlmin $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlmin $*')
set_shell_function("qmlplugindump",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlplugindump $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlplugindump $*')
set_shell_function("qmlprofiler",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlprofiler $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlprofiler $*')
set_shell_function("qmlscene",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlscene $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmlscene $*')
set_shell_function("qmltestrunner",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmltestrunner $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qmltestrunner $*')
set_shell_function("qtdiag",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qtdiag $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qtdiag $*')
set_shell_function("qtpaths",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qtpaths $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qtpaths $*')
set_shell_function("qtplugininfo",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qtplugininfo $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg qtplugininfo $*')
set_shell_function("randomBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg randomBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg randomBed $*')
set_shell_function("rcc",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg rcc $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg rcc $*')
set_shell_function("roundtrip",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg roundtrip $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg roundtrip $*')
set_shell_function("run-roh.pl",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg run-roh.pl $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg run-roh.pl $*')
set_shell_function("sample",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg sample $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg sample $*')
set_shell_function("samtools",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg samtools $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg samtools $*')
set_shell_function("shiftBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg shiftBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg shiftBed $*')
set_shell_function("shuffleBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg shuffleBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg shuffleBed $*')
set_shell_function("sip",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg sip $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg sip $*')
set_shell_function("slopBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg slopBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg slopBed $*')
set_shell_function("sortBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg sortBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg sortBed $*')
set_shell_function("subtractBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg subtractBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg subtractBed $*')
set_shell_function("syncqt.pl",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg syncqt.pl $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg syncqt.pl $*')
set_shell_function("tagBam",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg tagBam $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg tagBam $*')
set_shell_function("thresholder.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg thresholder.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg thresholder.py $*')
set_shell_function("transformseq",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg transformseq $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg transformseq $*')
set_shell_function("uic",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg uic $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg uic $*')
set_shell_function("undill",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg undill $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg undill $*')
set_shell_function("unionBedGraphs",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg unionBedGraphs $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg unionBedGraphs $*')
set_shell_function("unix-lpr.sh",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg unix-lpr.sh $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg unix-lpr.sh $*')
set_shell_function("vcfutils.pl",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg vcfutils.pl $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg vcfutils.pl $*')
set_shell_function("venn_gchart.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg venn_gchart.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg venn_gchart.py $*')
set_shell_function("venn_mpl.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg venn_mpl.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg venn_mpl.py $*')
set_shell_function("viewer.py",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg viewer.py $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg viewer.py $*')
set_shell_function("weblogo",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg weblogo $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg weblogo $*')
set_shell_function("wftopfa",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg wftopfa $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg wftopfa $*')
set_shell_function("windowBed",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg windowBed $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg windowBed $*')
set_shell_function("windowMaker",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg windowMaker $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg windowMaker $*')
set_shell_function("xmlpatterns",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg xmlpatterns $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg xmlpatterns $*')
set_shell_function("xmlpatternsvalidator",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg xmlpatternsvalidator $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eden/eden-2.0--py27h24bf2e0_1.simg xmlpatternsvalidator $*')
|
-- L10n
-- The MIT License © 2016 Arthur Corenzan
function L10n_GetTimeZoneShift()
local localTimeShift = GetSecondsSinceMidnight() - (GetTimeStamp() % 86400)
if localTimeShift < -43200 then
return localTimeShift + 86400
else
return localTimeShift
end
end
function L10n_GetLocalizedDate(timestamp, language)
language = language or GetCVar("Language.2")
local string = GetDateStringFromTimestamp(timestamp + L10n_GetTimeZoneShift())
if language == "en" then
return string
else
return string.gsub(string, "^(%d+)/(%d+)", "%2/%1")
end
end
function L10n_GetLocalizedTime(timestamp, language)
language = language or GetCVar("Language.2")
local precision
if (language == "en") then
precision = TIME_FORMAT_PRECISION_TWELVE_HOUR
else
precision = TIME_FORMAT_PRECISION_TWENTY_FOUR_HOUR
end
return FormatTimeSeconds(timestamp % 86400 + L10n_GetTimeZoneShift(), TIME_FORMAT_STYLE_CLOCK_TIME, precision)
end
function L10n_GetLocalizedDateTime(...)
return L10n_GetLocalizedDate(...) .. " " .. L10n_GetLocalizedTime(...)
end
|
local CollectMe = LibStub("AceAddon-3.0"):GetAddon("CollectMe")
CollectMe.CompanionDB = CollectMe:NewModule("CompanionDB", "AceEvent-3.0")
local LibPetJournal = LibStub("LibPetJournal-2.0")
local Data = CollectMe:GetModule("Data")
function CollectMe.CompanionDB:Update()
self.companions = {}
self.missing_companions = {}
self.known_species = {}
for i,petid in LibPetJournal:IteratePetIDs() do
local speciesID, customName, level, _, _, _, _, name, icon, _, creatureID = C_PetJournal.GetPetInfoByPetID(petid)
local quality = select(5, C_PetJournal.GetPetStats(petid))
self.known_species[speciesID] = true
tinsert(self.companions, {
pet_id = petid,
species_id = speciesID,
quality = quality,
color = (quality - 1),
creature_id = creatureID,
level = level,
name = name,
custom_name = customName,
icon = icon,
zones = Data.CompanionsZone[speciesID]
})
end
for i,speciesID in LibPetJournal:IterateSpeciesIds() do
if not self:IsSpeciesKnown(speciesID) then
local name, icon, _, creatureID = C_PetJournal.GetPetInfoBySpeciesID(speciesID);
tinsert(self.missing_companions, {
species_id = speciesID,
creature_id = creatureID,
name = name,
icon = icon,
zones = Data.CompanionsZone[speciesID]
})
end
end
CollectMe.LdbDisplay:ZoneChangeListener()
end
function CollectMe.CompanionDB:IsSpeciesKnown(species_id)
if not self.known_species[species_id] then
return false
end
return true
end
function CollectMe.CompanionDB:Get()
return self.companions, self.missing_companions
end
function CollectMe.CompanionDB:ZoneSearch(companions, zone_id)
local companions_in_zone = {}
for i,v in ipairs(companions) do
if v.zones ~= nil and v.zones[zone_id] ~= nil then
tinsert(companions_in_zone, v)
end
end
return companions_in_zone
end
function CollectMe.CompanionDB:GetCompanionsInZone(zone_id)
return self:ZoneSearch(self.companions, zone_id), self:ZoneSearch(self.missing_companions, zone_id)
end
function CollectMe.CompanionDB:IsInZone(id, zones)
if type(zones) ~= "table" then
zones = { zones }
end
for i = 1,#zones do
if Data.CompanionsZone[id] ~= nil and Data.CompanionsZone[id][zones[i]] ~= nil then
return true
end
end
return false
end
function CollectMe.CompanionDB:OnInitialize()
self.companions = {}
self.missing_companions = {}
self.known_species = {}
end
function CollectMe.CompanionDB:OnEnable()
LibPetJournal.RegisterCallback(CollectMe.CompanionDB, "PetListUpdated", "Update")
end
|
--[[
This Lua code was generated by ./util/msgfmt.pl, the Lua I18N tool.
Any changes made to this file will be lost the next
time the templates are compiled.
Copyright 2017 - Yichun Zhang (agentzh) - All rights reserved.
]]
local _M = {}
local mt = { __index = _M }
local trans_cn = {
["("] = "(",
[")"] = ")",
["100% Powered by OpenResty and PostgreSQL"] = "100% 由 OpenResty 和 PostgreSQL 驱动",
["Bad search query"] = "非法的搜索查询",
["Commercial Offering"] = "商业支持",
["Contribute on GitHub"] = "贡献力量",
["Copyright © 2017, 2018, 2019, 2020, 2021 by Yichun Zhang (agentzh)"] = "版权所有 © 2017, 2018, 2019, 2020, 2021 章亦春 (agentzh)",
["More Interesting Topics"] = "更多有趣的文章",
["New blog post"] = "新博客文章",
["New!"] = "最新!",
["No query provided."] = "没有提供任何搜索词。",
["No search results found"] = "没有找到任何匹配的记录",
["Official Forum"] = "官方论坛",
["OpenResty® - Official Site"] = "OpenResty® - 中文官方站",
["OpenResty<sup>®</sup> is a dynamic web platform based on NGINX and LuaJIT."] = "OpenResty<sup>®</sup> 是一款基于 NGINX 和 LuaJIT 的 Web 平台。",
["OpenResty<sup>®</sup> is a registered trademark owned by <a href=\"https://openresty.com/\">OpenResty Inc</a>."] = "OpenResty<sup>®</sup> 是 <a href=\"https://openresty.com/\">OpenResty Inc</a> 公司所有的注册商标。",
["Please adjust your search query and try again."] = "请调整您的搜索查询并重试。",
["Query too long (more than %d bytes)."] = "查词太长了(已经超出 %d 字节)。",
["Scalable Web Platform by Extending NGINX with Lua"] = "通过 Lua 扩展 NGINX 实现的可伸缩的 Web 平台",
["Search OpenResty.org"] = "搜索 OpenResty.org 中文站",
["Search Result"] = "搜索结果",
["Timeline"] = "最近更新",
["Video Tutorials"] = "视频教程",
["is now released!"] = "已发布。",
["is published."] = "已发表。",
["view the source code of this site"] = "查看本站的源代码",
}
local translators = {
['en'] = function (s) return s end,
['cn'] = function (s) return trans_cn[s] or s end
}
function _M.new(lang)
local translator = translators[lang]
if not translator then
return error("no translator found for language " .. tostring(lang))
end
return setmetatable({ translate = translator }, mt)
end
return _M
|
function printf(...) print(string.format(...)) end
local x1, y1, dx1, dy1 = 0, 0, 1, 0 -- ship at (x1, y1) and its direction (dx1, dy1)
local x2, y2, dx2, dy2 = 0, 0, 10, 1 -- ship at (x2, y2) and the waypoint offset (dx2, dy2)
do -- Read input file
local input_file = io.open('input.txt', 'r')
for line in input_file:lines() do
local command, parameter = line:match('^([A-Z]+)([0-9]+)$')
parameter = tonumber(parameter)
assert(command)
assert(parameter)
if false then
elseif command == 'R' then while parameter >= 90 do parameter, dx1, dy1, dx2, dy2 = parameter - 90, dy1, -dx1, dy2, -dx2 end
elseif command == 'L' then while parameter >= 90 do parameter, dx1, dy1, dx2, dy2 = parameter - 90, -dy1, dx1, -dy2, dx2 end
else
local dx1, dy1 = dx1, dy1
if false then
elseif command == 'F' then x2, y2 = x2 + parameter*dx2, y2 + parameter*dy2
elseif command == 'N' then dx1, dy1, dy2 = 0, 1, dy2 + parameter
elseif command == 'S' then dx1, dy1, dy2 = 0, -1, dy2 - parameter
elseif command == 'E' then dx1, dy1, dx2 = 1, 0, dx2 + parameter
elseif command == 'W' then dx1, dy1, dx2 = -1, 0, dx2 - parameter
else error()
end
x1, y1 = x1 + parameter*dx1, y1 + parameter*dy1
end
end
end
printf('PART1 - |%d| + |%d| = %d', x1, y1, math.abs(x1) + math.abs(y1))
printf('PART2 - |%d| + |%d| = %d', x2, y2, math.abs(x2) + math.abs(y2))
|
local utils = require 'utils'
local cmd = torch.CmdLine()
cmd:option('-filename', 'data/one-indexed-files.txt')
cmd:option('-format', 'one-indexed-files-notrash_') -- if specified, output filenames will be "%s%s.txt" % {format, split}
cmd:option('-outputDir', 'data') -- usually ''
cmd:option('-train', 0.70)
cmd:option('-val', 0.13)
cmd:option('-test', 0.17)
local opt = cmd:parse(arg)
assert(opt.filename ~= '', "Need a text file consisting of filenames and labels.")
assert(opt.train ~= '' or opt.train ~= 0, "Must have train examples.")
assert(opt.val ~= '' or opt.val ~= 0, "Must have val examples.")
assert(opt.test ~= '' or opt.test ~= 0, "Must have test examples.")
function shuffle(opt)
local allLines = {}
local splits = {
train = {},
val = {},
test = {}
}
local file, err = io.open(opt.filename, 'r')
if err then
utils.printTime(err)
return
else
while true do
local line = file:read()
if line == nil then
break
end
table.insert(allLines, line)
end
end
splits.train.count = math.floor(#allLines * opt.train)
splits.val.count = math.floor(#allLines * opt.val)
splits.test.count = #allLines - splits.train.count - splits.val.count
local shufflePerm = torch.randperm(#allLines)
for split, _ in pairs(splits) do
local startIndex, endIndex
if split == 'train' then
startIndex = 1
endIndex = splits.train.count
elseif split == 'val' then
startIndex = splits.train.count + 1
endIndex = splits.train.count + splits.val.count
elseif split == 'test' then
startIndex = splits.train.count + splits.val.count + 1
endIndex = -1
end
splits[split].indices = shufflePerm[{{startIndex, endIndex}}]
local file, err = io.open(paths.concat(opt.outputDir, "%s%s.txt" % {opt.format, split}), 'w+')
if err then
utils.printTime(err)
return
else
for i = 1, splits[split].count do
local index = splits[split].indices[i]
file:write("%s\n" % allLines[index])
end
file:close()
end
end
end
shuffle(opt)
|
local config = require('scripts.config')
--local misc = require('__flib__.misc')
local util = require('util')
local travel_worm_tier = config.travel_worm_tier
local travel_worm_dust_scaling = config.travel_worm_dust_scaling
local frame_count = 60
local preparing_livetime = 60 * 2
local dust_livetime = preparing_livetime + 10
local offset_time = - 60 * 0.5
local main_animation_speed = frame_count / preparing_livetime
local dust_animation_speed = 0.125
built_entity = function(event)
local entity = event.created_entity or event.destination
local creator = event.robot or game.get_player(event.player_index)
local creator_force = creator.force or 'neutral'
if entity and entity.valid then
if entity.name == 'nm-d-u-n-e' then
script.register_on_entity_destroyed(entity)
global.track_dune_miners[entity.unit_number] = entity
end
if string.match(entity.name, 'nm%-travel%-worm%-') then
local registration_number = script.register_on_entity_destroyed(entity)
global.track_travel_worms[registration_number] = entity
global.forces[creator_force.index]['travel_worms'][registration_number] = entity
end
end
end
destroyed_entity = function(event)
local registration_number = event.registration_number
local unit_number = event.unit_number
if unit_number then
if global.track_dune_miners[unit_number] then
global.track_dune_miners[unit_number] = nil
end
else
if global.track_travel_worms[registration_number] then
local entity = global.track_travel_worms[registration_number]
global.forces[entity.force.index]['travel_worms'][registration_number] = nil
global.track_travel_worms[registration_number] = nil
global.travel_worm_data[registration_number] = nil
end
end
end
check_dunes = function()
for _,dune_miner in pairs(global.track_dune_miners) do
local entity = dune_miner
if entity and entity.valid and entity.speed == 0 then
local surface = game.surfaces[entity.surface.index]
local pos = entity.position
entity.force.print('D.U.N.E. at ' .. pos.x .. ', ' .. pos.y .. ' on surface ' .. surface.name)
end
end
end
call_travel_worm = function(registration_number)
local entry = global.travel_worm_data[registration_number]
local worm = entry.worm
local player = entry.player
local surface = worm.surface
local stage = entry.stage
local dust_scale = entry.dust_scale
local tier = entry.tier
local render_layer = 'higher-object-under'
local tint = {a = 0.5}
local source_pos = entry.source_pos
if worm and worm.valid and player and surface.name == player.surface.name then
if stage == 'submerge' then
rendering.draw_animation({
animation = 'nm-heavy-travel-worm-dust',
render_layer = render_layer,
animation_speed = dust_animation_speed,
time_to_live = dust_livetime,
surface = surface,
target = source_pos,
x_scale = dust_scale,
y_scale = dust_scale,
})
rendering.draw_animation({
animation = 'nm-submerge-animation-travel-worm-'..tier,
render_layer = render_layer,
animation_speed = main_animation_speed,
--animation_offset = frame_count - (game.tick % frame_count),
time_to_live = preparing_livetime,
surface = surface,
target = source_pos
})
rendering.draw_animation({
animation = 'nm-heavy-travel-worm-dust',
render_layer = render_layer,
animation_speed = dust_animation_speed,
time_to_live = dust_livetime,
surface = surface,
target = source_pos,
tint = tint,
x_scale = dust_scale,
y_scale = dust_scale,
})
entry.deadline = preparing_livetime + game.tick + offset_time
entry.stage = 'emerge'
elseif stage == 'emerge' then
local dest_pos = entry.dest_pos
local search_box = {
left_top = {dest_pos.x - 5, dest_pos.y - 5},
right_bottom = {dest_pos.x + 5, dest_pos.y + 5}
}
dest_pos = surface.find_non_colliding_position_in_box(worm.name, search_box, 0.5)
worm.teleport(dest_pos, surface)
rendering.draw_animation({
animation = 'nm-heavy-travel-worm-dust',
render_layer = render_layer,
animation_speed = dust_animation_speed,
time_to_live = dust_livetime,
surface = surface,
target = dest_pos,
x_scale = dust_scale,
y_scale = dust_scale,
})
rendering.draw_animation({
animation = 'nm-emerge-animation-travel-worm-'..tier,
render_layer = render_layer,
animation_speed = main_animation_speed,
--animation_offset = frame_count - (game.tick % frame_count),
time_to_live = preparing_livetime,
surface = surface,
target = dest_pos
})
rendering.draw_animation({
animation = 'nm-heavy-travel-worm-dust',
render_layer = render_layer,
animation_speed = dust_animation_speed,
time_to_live = dust_livetime,
surface = surface,
target = dest_pos,
tint = tint,
x_scale = dust_scale,
y_scale = dust_scale,
})
entry.deadline = preparing_livetime + game.tick
entry.stage = 'final'
elseif stage == 'final' then
entry = nil
end
else
entry = nil
end
global.travel_worm_data[registration_number] = entry
end
used_capsule = function(event)
local player_index = event.player_index
local player = game.get_player(player_index)
local pos = event.position
local force_index = player.force.index
if event.item.name == 'nm-thumper' or event.item.name == 'nm-thumper-creative'then
local target = false
local prev_distance = false
local registration_number = false
local x = 0
local y = 0
local distance = 0
for reg_number, travel_worm in pairs(global.forces[force_index]['travel_worms']) do
if travel_worm and travel_worm.valid and not global.travel_worm_data[reg_number] then
if not travel_worm.get_driver() and not travel_worm.get_passenger() then
if player.surface.index == travel_worm.surface.index then
x = pos.x + travel_worm.position.x
x = x * x
y = pos.y + travel_worm.position.y
y = y * y
distance = x + y
if not prev_distance or prev_distance > distance then
if registration_number then
global.travel_worm_data[registration_number] = false
end
global.travel_worm_data[reg_number] = true
prev_distance = distance
target = travel_worm
registration_number = reg_number
end
end
end
end
end
if target and target.valid then
local entry = {
worm = target,
player = player,
stage = 'submerge',
source_pos = target.position,
dest_pos = player.position,
tier = travel_worm_tier[target.name],
dust_scale = travel_worm_dust_scaling[target.name]
}
global.travel_worm_data[registration_number] = entry
call_travel_worm(registration_number)
end
end
end
check_travel_worm_animations = function()
for registration_number, entry in pairs(global.travel_worm_data) do
if game.tick >= entry.deadline then
call_travel_worm(registration_number)
end
end
end
-- lib
local lib = {}
lib.events = {
[defines.events.on_built_entity] = built_entity,
[defines.events.on_robot_built_entity] = built_entity,
[defines.events.on_entity_cloned] = built_entity,
[defines.events.on_entity_destroyed] = destroyed_entity,
[defines.events.on_player_used_capsule] = used_capsule,
}
lib.on_nth_tick = {
[config.HIGH_FIDELITY_CHECK_TICK] = function()
-- check_dunes()
check_travel_worm_animations()
end
}
return lib
|
local NeP = NeP
NeP.Healing = {}
function NeP.Healing.GetPredictedHealth(unit)
return NeP.DSL:Get('health.actual')(unit)
+ (NeP._G.UnitGetTotalHealAbsorbs(unit) or 0)
+ (NeP._G.UnitGetIncomingHeals(unit) or 0)
end
function NeP.Healing.GetPredictedHealth_Percent(unit)
return math.floor((NeP.Healing.GetPredictedHealth(unit)/NeP.DSL:Get('health.max')(unit))*100)
end
function NeP.Healing.healthPercent(unit)
return math.floor((NeP.DSL:Get('health.actual')(unit)/NeP.DSL:Get('health.max')(unit))*100)
end |
LoadZKMapConfigCommand = Command:extends{}
LoadZKMapConfigCommand.className = "LoadZKMapConfigCommand"
function LoadZKMapConfigCommand:init(ZKmapconfig)
-- Since the introduction of the data packing/unpacking, is much more
-- efficient passing tables than strings
if ZKmapconfig then
self.mapConfig = loadstring(ZKmapconfig)()
else
self.mapConfig = {}
local boxID = 1
local mapsideBoxes = "mapconfig/map_startboxes.lua"
local mapsideMexes = "mapconfig/map_metal_layout.lua"
if VFS.FileExists (mapsideBoxes) then
self.mapConfig.teamList, self.mapConfig.boxes = {}, {}
local boxConfig = VFS.Include(mapsideBoxes)
for ID, boxdata in pairs(boxConfig) do
local color = { r=math.random(), g=math.random(), b=math.random(), a=1}
self.mapConfig.teamList[ID] = {id = ID, allyTeam = ID, color = color, name = boxdata.nameLong, short = (boxdata.nameShort or boxdata.nameLong), x = boxdata.startpoints[1][1], z = boxdata.startpoints[1][2], boxes = {}}
for _, box in pairs(boxdata.boxes) do
table.insert(self.mapConfig.teamList[ID].boxes, boxID)
table.insert(self.mapConfig.boxes, box)
boxID = boxID + 1
end
end
end
if VFS.FileExists (mapsideMexes) then
self.mapConfig.mexes = VFS.Include(mapsideMexes).spots
end
end
end
function LoadZKMapConfigCommand:execute()
--assert(self.mapConfig)
local mexes = self.mapConfig.mexes or {}
local boxes = self.mapConfig.boxes or {}
local teamList = self.mapConfig.teamList or {}
SB.delay(function()
SB.delay(function()
for mexID, mex in pairs(mexes) do
SB.model.mexManager:addMex(mex)
end
for teamID, team in pairs(teamList) do
for _, boxID in pairs(team.boxes) do
local newBoxID = SB.model.startboxManager:addBox(boxes[boxID])
SB.model.startboxManager:setTeam(newBoxID, teamID)
end
if not SB.model.teamManager:getTeam(teamID) then
local cmd = AddTeamCommand(team.name, team.color, team.allyTeam, Spring.GetSideData(team.allyTeam))
SB.commandManager:execute(cmd)
end
local cmd = UpdateTeamCommand(team)
SB.commandManager:execute(cmd)
end
end)
end)
end |
pg = pg or {}
pg.activity_event_picturepuzzle = {
[549] = {
id = 549,
chapter = 1360001,
cd = 1200,
define = 0,
pickup_picturepuzzle = {
60031,
60033,
60035,
60037,
60038
},
drop_picturepuzzle = {
60030,
60032,
60034,
60036
},
story = {},
awards = {
{
8,
60031,
1
},
{
8,
60033,
1
},
{
8,
60035,
1
},
{
8,
60037,
1
},
{
8,
60038,
1
}
},
auto_finish_args = {}
},
[758] = {
id = 758,
chapter = 0,
cd = 0,
define = 0,
pickup_picturepuzzle = {},
drop_picturepuzzle = {
70053,
70054,
70055,
70056,
70057,
70058,
70059,
70060,
70061,
70062,
70063,
70064
},
story = {},
awards = {},
auto_finish_args = {}
},
[783] = {
id = 783,
chapter = 0,
cd = 0,
define = 0,
pickup_picturepuzzle = {},
drop_picturepuzzle = {
70077,
70078,
70071,
70072,
70075,
70076,
70067,
70068,
70073,
70074,
70069,
70070,
70065,
70066
},
story = {},
awards = {},
auto_finish_args = {}
},
[935] = {
id = 935,
chapter = 1360001,
cd = 1200,
define = 0,
pickup_picturepuzzle = {
60031,
60033,
60035,
60037,
60038
},
drop_picturepuzzle = {
60030,
60032,
60034,
60036
},
story = {},
awards = {
{
8,
60031,
1
},
{
8,
60033,
1
},
{
8,
60035,
1
},
{
8,
60037,
1
},
{
8,
60038,
1
}
},
auto_finish_args = {
1,
100001
}
},
[959] = {
id = 959,
chapter = 0,
cd = 0,
define = 1,
pickup_picturepuzzle = {},
drop_picturepuzzle = {
60140,
60141,
60142,
60143,
60144,
60145,
60146,
60147,
60148
},
story = {},
awards = {},
auto_finish_args = {}
},
[4058] = {
id = 4058,
chapter = 0,
cd = 0,
define = 0,
pickup_picturepuzzle = {},
drop_picturepuzzle = {
70079,
70080,
70081,
70082,
70083,
70084,
70085,
70086,
70087,
70088,
70089,
70090,
70091,
70092
},
story = {},
awards = {},
auto_finish_args = {}
},
all = {
549,
758,
783,
935,
959,
4058
}
}
return
|
--# selene: allow(unused_variable)
---@diagnostic disable: unused-local
-- Some functions for manipulating the Hammerspoon console.
--
-- These functions allow altering the behavior and display of the Hammerspoon console. They should be considered experimental, but have worked well for me.
---@class hs.console
local M = {}
hs.console = M
-- Get or set the alpha level of the console window.
--
-- Parameters:
-- * `alpha` - an optional number between 0.0 and 1.0 specifying the new alpha level for the Hammerspoon console.
--
-- Returns:
-- * the current, possibly new, value.
function M.alpha(alpha, ...) end
-- Because use of this function can easily lead to a crash, useful methods from `hs.drawing` have been added to the `hs.console` module itself. If you believe that a useful method has been overlooked, please submit an issue.
--
-- Parameters:
-- * None
--
-- Returns:
-- * a placeholder object
---@return hs.drawing
function M.asHSDrawing() end
-- Returns an hs.window object for the console so that you can use hs.window methods on it.
--
-- This function is identical to [hs.console.hswindow](#hswindow). It is included for reasons of backwards compatibility, but use of the new name is recommended for clarity.
---@return hs.window
function M.asHSWindow() end
-- Get or set the window behavior settings for the console.
--
-- Parameters:
-- * `behavior` - an optional number representing the desired window behaviors for the Hammerspoon console.
--
-- Returns:
-- * the current, possibly new, value.
--
-- Notes:
-- * Window behaviors determine how the webview object is handled by Spaces and Exposé. See `hs.drawing.windowBehaviors` for more information.
function M.behavior(behavior, ...) end
-- Get or set the window behavior settings for the console using labels defined in `hs.drawing.windowBehaviors`.
--
-- Parameters:
-- * behaviorTable - an optional table of strings and/or numbers specifying the desired window behavior for the Hammerspoon console.
--
-- Returns:
-- * the current (possibly new) value.
--
-- Notes:
-- * Window behaviors determine how the console is handled by Spaces and Exposé. See `hs.drawing.windowBehaviors` for more information.
function M.behaviorAsLabels(behaviorTable, ...) end
-- Clear the Hammerspoon console output window.
--
-- Parameters:
-- * None
--
-- Returns:
-- * None
--
-- Notes:
-- * This is equivalent to `hs.console.setConsole()`
function M.clearConsole() end
-- Get or set the color that commands displayed in the Hammerspoon console are displayed with.
--
-- Parameters:
-- * color - an optional table containing color keys as described in `hs.drawing.color`
--
-- Returns:
-- * the current color setting as a table
--
-- Notes:
-- * See the `hs.drawing.color` entry in the Dash documentation, or type `help.hs.drawing.color` in the Hammerspoon console to get more information on how to specify a color.
-- * Note this only affects future output -- anything already in the console will remain its current color.
function M.consoleCommandColor(color, ...) end
-- Get or set the font used in the Hammerspoon console.
--
-- Parameters:
-- * font - an optional string or table describing the font to use in the console. If a string is specified, then the default system font size will be used. If a table is specified, it should contain a `name` key-value pair and a `size` key-value pair describing the font to be used.
--
-- Returns:
-- * the current font setting as a table containing a `name` key and a `size` key.
--
-- Notes:
-- * See the `hs.drawing.color` entry in the Dash documentation, or type `help.hs.drawing.color` in the Hammerspoon console to get more information on how to specify a color.
-- * Note this only affects future output -- anything already in the console will remain its current font.
function M.consoleFont(font, ...) end
-- Get or set the color that regular output displayed in the Hammerspoon console is displayed with.
--
-- Parameters:
-- * color - an optional table containing color keys as described in `hs.drawing.color`
--
-- Returns:
-- * the current color setting as a table
--
-- Notes:
-- * See the `hs.drawing.color` entry in the Dash documentation, or type `help.hs.drawing.color` in the Hammerspoon console to get more information on how to specify a color.
-- * Note this only affects future output -- anything already in the console will remain its current color.
function M.consolePrintColor(color, ...) end
-- Get or set the color that function results displayed in the Hammerspoon console are displayed with.
--
-- Parameters:
-- * color - an optional table containing color keys as described in `hs.drawing.color`
--
-- Returns:
-- * the current color setting as a table
--
-- Notes:
-- * See the `hs.drawing.color` entry in the Dash documentation, or type `help.hs.drawing.color` in the Hammerspoon console to get more information on how to specify a color.
-- * Note this only affects future output -- anything already in the console will remain its current color.
function M.consoleResultColor(color, ...) end
-- Set or display whether or not the Console window should display in dark mode.
--
-- Parameters:
-- * state - an optional boolean which will set whether or not the Console window should display in dark mode.
--
-- Returns:
-- * A boolean, true if dark mode is enabled otherwise false.
--
-- Notes:
-- * Enabling Dark Mode for the Console only affects the window background, and doesn't automatically change the Console's Background Color, so you will need to add something similar to:
-- ```lua
-- if hs.console.darkMode() then
-- hs.console.outputBackgroundColor{ white = 0 }
-- hs.console.consoleCommandColor{ white = 1 }
-- hs.console.alpha(.8)
-- end
-- . ```
---@return boolean
function M.darkMode(state, ...) end
-- Default toolbar for the Console window
--
-- Notes:
-- * This is an `hs.toolbar` object that is shown by default in the Hammerspoon Console
-- * You can remove this toolbar by adding `hs.console.toolbar(nil)` to your config, or you can replace it with your own `hs.webview.toolbar` object
M.defaultToolbar = nil
-- Get the text of the Hammerspoon console output window.
--
-- Parameters:
-- * styled - an optional boolean indicating whether the console text is returned as a string or a styledText object. Defaults to false.
--
-- Returns:
-- * The text currently in the Hammerspoon console output window as either a string or an `hs.styledtext` object.
--
-- Notes:
-- * If the text of the console is retrieved as a string, no color or style information in the console output is retrieved - only the raw text.
function M.getConsole(styled, ...) end
-- Get the Hammerspoon console history as an array.
--
-- Parameters:
-- * None
--
-- Returns:
-- * an array containing the history of commands entered into the Hammerspoon console.
function M.getHistory() end
-- Get an hs.window object which represents the Hammerspoon console window
--
-- Parameters:
-- * None
--
-- Returns:
-- * an hs.window object
---@return hs.window
function M.hswindow() end
-- Get or set the color for the background of the Hammerspoon Console's input field.
--
-- Parameters:
-- * color - an optional table containing color keys as described in `hs.drawing.color`
--
-- Returns:
-- * the current color setting as a table
--
-- Notes:
-- * See the `hs.drawing.color` entry in the Dash documentation, or type `help.hs.drawing.color` in the Hammerspoon console to get more information on how to specify a color.
function M.inputBackgroundColor(color, ...) end
-- Get or set the console window level
--
-- Parameters:
-- * `theLevel` - an optional parameter specifying the desired level as an integer, which can be obtained from `hs.drawing.windowLevels`.
--
-- Returns:
-- * the current, possibly new, value
--
-- Notes:
-- * see the notes for `hs.drawing.windowLevels`
function M.level(theLevel, ...) end
-- Get or set the color for the background of the Hammerspoon Console's output view.
--
-- Parameters:
-- * color - an optional table containing color keys as described in `hs.drawing.color`
--
-- Returns:
-- * the current color setting as a table
--
-- Notes:
-- * See the `hs.drawing.color` entry in the Dash documentation, or type `help.hs.drawing.color` in the Hammerspoon console to get more information on how to specify a color.
function M.outputBackgroundColor(color, ...) end
-- A print function which recognizes `hs.styledtext` objects and renders them as such in the Hammerspoon console.
--
-- Parameters:
-- * Any number of arguments can be specified, just like the builtin Lua `print` command. If an argument matches the userdata type of `hs.styledtext`, the text is rendered as defined by its style attributes in the Hammerspoon console; otherwise it is rendered as it would be via the traditional `print` command within Hammerspoon.
--
-- Returns:
-- * None
--
-- Notes:
-- * This has been made as close to the Lua `print` command as possible. You can replace the existing print command with this by adding the following to your `init.lua` file:
--
-- ~~~
-- print = function(...)
-- hs.rawprint(...)
-- hs.console.printStyledtext(...)
-- end
-- ~~~
function M.printStyledtext(...) end
-- Clear the Hammerspoon console output window.
--
-- Parameters:
-- * styledText - an optional `hs.styledtext` object containing the text you wish to replace the Hammerspoon console output with. If you do not provide an argument, the console is cleared of all content.
--
-- Returns:
-- * None
--
-- Notes:
-- * You can specify the console content as a string or as an `hs.styledtext` object in either userdata or table format.
function M.setConsole(styledText, ...) end
-- Set the Hammerspoon console history to the items specified in the given array.
--
-- Parameters:
-- * array - the list of commands to set the Hammerspoon console history to.
--
-- Returns:
-- * None
--
-- Notes:
-- * You can clear the console history by using an empty array (e.g. `hs.console.setHistory({})`
function M.setHistory(array, ...) end
-- Determine whether or not objects copied from the console window insert or delete space around selected words to preserve proper spacing and punctuation.
--
-- Parameters:
-- * flag - an optional boolean value indicating whether or not "smart" space behavior is enabled when copying from the Hammerspoon console.
--
-- Returns:
-- * the current value
--
-- Notes:
-- * this only applies to future copy operations from the Hammerspoon console -- anything already in the clipboard is not affected.
---@return boolean
function M.smartInsertDeleteEnabled(flag, ...) end
-- Get or set whether or not the "Hammerspoon Console" text appears in the Hammerspoon console titlebar.
--
-- Parameters:
-- * state - an optional string containing the text "visible" or "hidden", specifying whether or not the console window's title text appears.
--
-- Returns:
-- * a string of "visible" or "hidden" specifying the current (possibly changed) state of the window title's visibility.
--
-- Notes:
-- * When a toolbar is attached to the Hammerspoon console (see the `hs.webview.toolbar` module documentation), this function can be used to specify whether the Toolbar appears underneath the console window's title ("visible") or in the window's title bar itself, as seen in applications like Safari ("hidden"). When the title is hidden, the toolbar will only display the toolbar items as icons without labels, and ignores changes made with `hs.webview.toolbar:displayMode`.
--
-- * If a toolbar is attached to the console, you can achieve the same effect as this function with `hs.console.toolbar():inTitleBar(boolean)`
function M.titleVisibility(state, ...) end
-- Get or attach/detach a toolbar to/from the Hammerspoon console.
--
-- Parameters:
-- * `toolbar` - if an `hs.webview.toolbar` object is specified, it will be attached to the Hammerspoon console. If an explicit nil is specified, the current toolbar will be removed from the console.
--
-- Returns:
-- * if a toolbarObject or explicit nil is specified, returns the toolbarObject; otherwise returns the current toolbarObject or nil, if no toolbar is attached to the console.
--
-- Notes:
-- * this method is a convenience wrapper for the `hs.webview.toolbar.attachToolbar` function.
--
-- * If the toolbar is currently attached to another window when this function is called, it will be detached from the original window and attached to the console.
function M.toolbar(toolbar, ...) end
-- Get or set the color for the background of the Hammerspoon Console's window.
--
-- Parameters:
-- * color - an optional table containing color keys as described in `hs.drawing.color`
--
-- Returns:
-- * the current color setting as a table
--
-- Notes:
-- * See the `hs.drawing.color` entry in the Dash documentation, or type `help.hs.drawing.color` in the Hammerspoon console to get more information on how to specify a color.
function M.windowBackgroundColor(color, ...) end
|
ESX = nil
local currentTattoos = {}
local cam = -1
local inMenu = false
Citizen.CreateThread(function()
addBlips()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
while true do
Citizen.Wait(0)
drawMarkers()
if(isNearTattoosShop()) then
Info(Config.TextToOpenMenu)
if(IsControlJustPressed(1, Config.KeyToOpenMenu)) then
inMenu = not inMenu
ESX.UI.Menu.CloseAll()
if(inMenu) then
FreezeEntityPosition(GetPlayerPed(-1), true)
openMenu()
else
FreezeEntityPosition(GetPlayerPed(-1), false)
setPedSkin()
end
end
end
if(inMenu) then
if(IsControlJustPressed(1, 177)) then
ESX.UI.Menu.CloseAll()
FreezeEntityPosition(GetPlayerPed(-1), false)
RenderScriptCams(false, false, 0, 1, 0)
DestroyCam(cam, false)
setPedSkin()
inMenu = false
end
elseif(DoesCamExist(cam)) then
RenderScriptCams(false, false, 0, 1, 0)
DestroyCam(cam, false)
end
end
end)
function openMenu()
local elements = {}
for _,k in pairs(tattoosCategories) do
table.insert(elements, {label= k.name, value = k.value})
end
if(DoesCamExist(cam)) then
RenderScriptCams(false, false, 0, 1, 0)
DestroyCam(cam, false)
end
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'Tattoos_menu',
{
title = 'Tattos',
align = 'top-left',
elements = elements,
},
function(data, menu)
local currentLabel = data.current.label
local currentValue = data.current.value
if(data.current.value ~= nil) then
elements = {}
table.insert(elements, {label=Config.TextGoBackIntoMenu, value = nil})
for i,k in pairs(tattoosList[data.current.value]) do
table.insert(elements, {label= "Tattoo n°"..i.." ("..k.price..Config.MoneySymbol..")", value = i, price = k.price})
end
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'Tattoos_Categories_menu',
{
title = 'Tattos | '..currentLabel,
align = 'top-left',
elements = elements,
},
function(data2, menu2)
local price = data2.current.price
if(data2.current.value ~= nil) then
TriggerServerEvent("tattoos:save", currentTattoos, price, {collection = currentValue, texture = data2.current.value})
else
openMenu()
RenderScriptCams(false, false, 0, 1, 0)
DestroyCam(cam, false)
cleanPlayer()
end
end,
function(data2, menu2)
menu.close()
RenderScriptCams(false, false, 0, 1, 0)
DestroyCam(cam, false)
setPedSkin()
end,
function(data2,menu2)
if(data2.current.value ~= nil) then
drawTattoo(data2.current.value, currentValue)
end
end,
function()
end)
end
end,
function(data, menu)
menu.close()
setPedSkin()
end
)
end
function addBlips()
for _,k in pairs(tattoosShops) do
local blip = AddBlipForCoord(k.x, k.y, k.z)
SetBlipSprite(blip, 75)
SetBlipColour(blip, 1)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Tattoos Shop")
EndTextCommandSetBlipName(blip)
end
end
function drawMarkers()
for _,k in pairs(tattoosShops) do
DrawMarker(27,k.x,k.y,k.z-0.9,0,0,0,0,0,0,3.001,3.0001,0.5001,0,155,255,200,0,0,0,0)
end
end
function isNearTattoosShop()
for _,k in pairs(tattoosShops) do
local distance = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), k.x,k.y,k.z, true)
if(distance < 3) then
return true
end
end
return false
end
function setPedSkin()
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
local model = nil
if skin.sex == 0 then
model = GetHashKey("mp_m_freemode_01")
else
model = GetHashKey("mp_f_freemode_01")
end
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(1)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
TriggerEvent('skinchanger:loadSkin', skin)
TriggerEvent('esx:restoreLoadout')
end)
Citizen.Wait(1000)
for _,k in pairs(currentTattoos) do
ApplyPedOverlay(GetPlayerPed(-1), GetHashKey(k.collection), GetHashKey(tattoosList[k.collection][k.texture].nameHash))
end
end
function drawTattoo(current, collection)
SetEntityHeading(GetPlayerPed(-1), 297.7296)
ClearPedDecorations(GetPlayerPed(-1))
for _,k in pairs(currentTattoos) do
ApplyPedOverlay(GetPlayerPed(-1), GetHashKey(k.collection), GetHashKey(tattoosList[k.collection][k.texture].nameHash))
end
if(GetEntityModel(GetPlayerPed(-1)) == -1667301416) then -- GIRL SKIN
SetPedComponentVariation(GetPlayerPed(-1), 8, 34,0, 2)
SetPedComponentVariation(GetPlayerPed(-1), 3, 15,0, 2)
SetPedComponentVariation(GetPlayerPed(-1), 11, 101,1, 2)
SetPedComponentVariation(GetPlayerPed(-1), 4, 16,0, 2)
else -- BOY SKIN
SetPedComponentVariation(GetPlayerPed(-1), 8, 15,0, 2)
SetPedComponentVariation(GetPlayerPed(-1), 3, 15,0, 2)
SetPedComponentVariation(GetPlayerPed(-1), 11, 91,0, 2)
SetPedComponentVariation(GetPlayerPed(-1), 4, 14,0, 2)
end
ApplyPedOverlay(GetPlayerPed(-1), GetHashKey(collection), GetHashKey(tattoosList[collection][current].nameHash))
if(not DoesCamExist(cam)) then
cam = CreateCam('DEFAULT_SCRIPTED_CAMERA', true)
SetCamCoord(cam, GetEntityCoords(GetPlayerPed(-1)))
SetCamRot(cam, 0.0, 0.0, 0.0)
SetCamActive(cam, true)
RenderScriptCams(true, false, 0, true, true)
SetCamCoord(cam, GetEntityCoords(GetPlayerPed(-1)))
end
local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1)))
SetCamCoord(cam, x+tattoosList[collection][current].addedX, y+tattoosList[collection][current].addedY, z+tattoosList[collection][current].addedZ)
SetCamRot(cam, 0.0, 0.0, tattoosList[collection][current].rotZ)
end
function cleanPlayer()
ClearPedDecorations(GetPlayerPed(-1))
for _,k in pairs(currentTattoos) do
ApplyPedOverlay(GetPlayerPed(-1), GetHashKey(k.collection), GetHashKey(tattoosList[k.collection][k.texture].nameHash))
end
end
function Info(text, loop)
SetTextComponentFormat("STRING")
AddTextComponentString(text)
DisplayHelpTextFromStringLabel(0, loop, 1, 0)
end
RegisterNetEvent("tattoos:getPlayerTattoos")
AddEventHandler("tattoos:getPlayerTattoos", function(playerTattoosList)
for _,k in pairs(playerTattoosList) do
ApplyPedOverlay(GetPlayerPed(-1), GetHashKey(k.collection), GetHashKey(tattoosList[k.collection][k.texture].nameHash))
end
currentTattoos = playerTattoosList
end)
local firstLoad = false
AddEventHandler("skinchanger:loadSkin", function(skin)
if(not firstLoad) then
Citizen.CreateThread(function()
while not (GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_m_freemode_01") or GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_f_freemode_01")) do
Citizen.Wait(10)
end
Citizen.Wait(750)
TriggerServerEvent("tattoos:GetPlayerTattoos_s")
end)
firstLoad = true
else
Citizen.Wait(750)
for _,k in pairs(currentTattoos) do
ApplyPedOverlay(GetPlayerPed(-1), GetHashKey(k.collection), GetHashKey(tattoosList[k.collection][k.texture].nameHash))
end
end
end)
RegisterNetEvent("tattoo:buySuccess")
AddEventHandler("tattoo:buySuccess", function(value)
table.insert(currentTattoos, value)
end) |
--------------------------------
-- @module GLProgram
-- @extend Ref
-- @parent_module cc
--------------------------------
-- returns the fragmentShader error log
-- @function [parent=#GLProgram] getFragmentShaderLog
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
--
-- @function [parent=#GLProgram] initWithByteArrays
-- @param self
-- @param #char vShaderByteArray
-- @param #char fShaderByteArray
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#GLProgram] initWithFilenames
-- @param self
-- @param #string vShaderFilename
-- @param #string fShaderFilename
-- @return bool#bool ret (return value: bool)
--------------------------------
-- it will call glUseProgram()
-- @function [parent=#GLProgram] use
-- @param self
--------------------------------
-- returns the vertexShader error log
-- @function [parent=#GLProgram] getVertexShaderLog
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
-- @overload self, mat4_table
-- @overload self
-- @function [parent=#GLProgram] setUniformsForBuiltins
-- @param self
-- @param #mat4_table modelView
--------------------------------
-- It will create 4 uniforms:<br>
-- - kUniformPMatrix<br>
-- - kUniformMVMatrix<br>
-- - kUniformMVPMatrix<br>
-- - GLProgram::UNIFORM_SAMPLER<br>
-- And it will bind "GLProgram::UNIFORM_SAMPLER" to 0
-- @function [parent=#GLProgram] updateUniforms
-- @param self
--------------------------------
-- calls glUniform1i only if the values are different than the previous call for this same shader program. <br>
-- js setUniformLocationI32<br>
-- lua setUniformLocationI32
-- @function [parent=#GLProgram] setUniformLocationWith1i
-- @param self
-- @param #int location
-- @param #int i1
--------------------------------
--
-- @function [parent=#GLProgram] reset
-- @param self
--------------------------------
-- It will add a new attribute to the shader by calling glBindAttribLocation
-- @function [parent=#GLProgram] bindAttribLocation
-- @param self
-- @param #string attributeName
-- @param #unsigned int index
--------------------------------
-- calls glGetAttribLocation
-- @function [parent=#GLProgram] getAttribLocation
-- @param self
-- @param #string attributeName
-- @return int#int ret (return value: int)
--------------------------------
-- links the glProgram
-- @function [parent=#GLProgram] link
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Initializes the GLProgram with a vertex and fragment with bytes array <br>
-- js initWithString<br>
-- lua initWithString
-- @function [parent=#GLProgram] createWithByteArrays
-- @param self
-- @param #char vShaderByteArray
-- @param #char fShaderByteArray
-- @return GLProgram#GLProgram ret (return value: cc.GLProgram)
--------------------------------
-- Initializes the GLProgram with a vertex and fragment with contents of filenames <br>
-- js init<br>
-- lua init
-- @function [parent=#GLProgram] createWithFilenames
-- @param self
-- @param #string vShaderFilename
-- @param #string fShaderFilename
-- @return GLProgram#GLProgram ret (return value: cc.GLProgram)
--------------------------------
--
-- @function [parent=#GLProgram] GLProgram
-- @param self
return nil
|
--[[ MOB SPAWN LIST
mob(<mob_spawner_alias>, <mob_id>, <mob_count>, <spawner_limit>, <spawn_interval>, <spawner_range>, <map_id>, <x_pos>, <y_pos>, <z_pos>);
--]]
mob("", 380, 1, 1, 3600, 5, 55, 5312.19, 5140.31, 36.92);
mob("", 373, 1, 1, 55, 5, 55, 5357.33, 5134.71, 36.4);
mob("", 373, 1, 1, 55, 1, 55, 5324.86, 5156.72, 38.42);
mob("", 373, 1, 1, 55, 5, 55, 5296.28, 5131.33, 37.4);
mob("", 376, 1, 1, 50, 5, 55, 5370.82, 4975.25, 33.07);
mob("", 378, 1, 1, 50, 5, 55, 5392.48, 5001.71, 32.75);
mob("", 378, 1, 1, 50, 5, 55, 5430.99, 5005.52, 29.95);
mob("", 373, 1, 1, 55, 5, 55, 5316.2, 5098.8, 35.94);
mob("", 378, 1, 1, 50, 5, 55, 5447.5, 5055.94, 33.65);
mob("", 378, 1, 1, 50, 5, 55, 5491.21, 5050.58, 33.58);
mob("", 379, 1, 1, 50, 5, 55, 5538.61, 5068.88, 32.46);
mob("", 378, 1, 1, 50, 5, 55, 5510.38, 4999.85, 29.26);
mob("", 378, 1, 1, 50, 5, 55, 5559.94, 5015.45, 28.25);
mob("", 377, 1, 1, 50, 5, 55, 5578.61, 5069.44, 30.59);
mob("", 378, 1, 1, 50, 5, 55, 5538.9, 4992, 26.83);
mob("", 376, 1, 2, 45, 50, 55, 5531.85, 5020.65, 29.97);
mob("", 378, 1, 2, 45, 50, 55, 5531.85, 5020.65, 29.97);
mob("", 377, 1, 2, 45, 50, 55, 5531.85, 5020.65, 29.97);
mob("", 376, 1, 2, 45, 50, 55, 5449.38, 5018.59, 31.22);
mob("", 378, 1, 2, 45, 50, 55, 5449.38, 5018.59, 31.22);
mob("", 377, 1, 2, 45, 50, 55, 5449.38, 5018.59, 31.22);
mob("", 376, 1, 1, 50, 5, 55, 5651.58, 4971.93, 31.38);
mob("", 376, 1, 1, 50, 5, 55, 5654.71, 4986.88, 29.96);
mob("", 378, 1, 1, 50, 5, 55, 5606.32, 4998.98, 26.48);
mob("", 379, 1, 1, 50, 5, 55, 5608.6, 5113.02, 29.99);
mob("", 378, 1, 1, 50, 5, 55, 5605.51, 5030.7, 26.11);
mob("", 376, 1, 1, 50, 5, 55, 5662.01, 5022.96, 28.32);
mob("", 379, 1, 1, 50, 5, 55, 5701.7, 5033.66, 30.37);
mob("", 377, 1, 1, 50, 5, 55, 5655.4, 5078.09, 29.81);
mob("", 379, 1, 1, 50, 5, 55, 5631.13, 5053.7, 28.55);
mob("", 376, 1, 2, 45, 50, 55, 5638.92, 5043.04, 27.95);
mob("", 377, 1, 2, 45, 50, 55, 5638.92, 5043.04, 27.95);
mob("", 377, 1, 2, 45, 50, 55, 5638.92, 5043.04, 27.95);
mob("", 377, 1, 1, 180, 30, 55, 5630.6, 5098.58, 30.87);
mob("", 373, 1, 1, 45, 5, 55, 5753.96, 5009.94, 34.67);
mob("", 373, 1, 1, 45, 5, 55, 5724.27, 4973.76, 33.22);
mob("", 373, 1, 1, 45, 5, 55, 5794.46, 4986.62, 38.6);
mob("", 373, 1, 1, 45, 5, 55, 5809.16, 5006.08, 39.43);
mob("", 373, 1, 1, 45, 5, 55, 5816.9, 4982.24, 38.82);
mob("", 373, 1, 1, 45, 5, 55, 5777.06, 5018.5, 37.03);
mob("", 376, 1, 1, 50, 5, 55, 5414.79, 4902.12, 31.15);
mob("", 376, 1, 1, 50, 5, 55, 5402.34, 4907.67, 32.08);
mob("", 376, 1, 1, 50, 5, 55, 5376.41, 4899.21, 32.54);
mob("", 376, 1, 1, 50, 5, 55, 5360.82, 4927.89, 32.7);
mob("", 376, 1, 1, 50, 5, 55, 5438.49, 4937.02, 31.07);
mob("", 376, 1, 2, 45, 50, 55, 5408.18, 4951.57, 32.24);
mob("", 377, 1, 2, 45, 50, 55, 5408.18, 4951.57, 32.24);
mob("", 378, 1, 2, 45, 50, 55, 5408.18, 4951.57, 32.24);
mob("", 376, 1, 1, 50, 5, 55, 5451.54, 4910.91, 30.99);
mob("", 376, 1, 1, 50, 5, 55, 5564.67, 4919.75, 31.28);
mob("", 376, 1, 1, 50, 5, 55, 5594.24, 4914.22, 29.02);
mob("", 376, 1, 1, 50, 5, 55, 5476.14, 4953.14, 29.11);
mob("", 376, 1, 1, 50, 5, 55, 5533.37, 4951.33, 24.9);
mob("", 376, 1, 1, 50, 5, 55, 5606.87, 4924.08, 31.43);
mob("", 376, 1, 1, 50, 5, 55, 5612.59, 4953.61, 30.64);
mob("", 373, 1, 1, 45, 5, 55, 5730.02, 4936.79, 34.09);
mob("", 373, 1, 1, 45, 5, 55, 5713.61, 4892.57, 34.89);
mob("", 373, 1, 1, 45, 5, 55, 5755.47, 4901.47, 37.05);
mob("", 373, 1, 1, 45, 5, 55, 5767.79, 4900.25, 38.21);
mob("", 373, 1, 1, 45, 5, 55, 5762.64, 4911.97, 37.61);
mob("", 373, 1, 1, 45, 5, 55, 5813.51, 4944.24, 39.99);
mob("", 373, 1, 1, 45, 5, 55, 5807.53, 4906.03, 40.7);
mob("", 373, 1, 1, 45, 5, 55, 5791.87, 4925.03, 38.84);
mob("", 336, 1, 1, 29, 5, 55, 5397.98, 4646.61, 17.46);
mob("", 375, 1, 1, 45, 5, 55, 5418.77, 4706.14, 20.31);
mob("", 336, 1, 1, 29, 5, 55, 5367.71, 4675.31, 19.51);
mob("", 375, 1, 1, 45, 5, 55, 5424.5, 4673.29, 18.55);
mob("", 375, 1, 1, 45, 5, 55, 5376.3, 4681.13, 19.62);
mob("", 375, 1, 1, 45, 5, 55, 5391.28, 4646.77, 17.6);
mob("", 375, 1, 1, 45, 5, 55, 5472.74, 4691.78, 21.04);
mob("", 375, 1, 1, 45, 5, 55, 5518.7, 4668.24, 21.17);
mob("", 375, 1, 1, 45, 5, 55, 5467.92, 4664.96, 18.67);
mob("", 375, 1, 1, 45, 5, 55, 5499.68, 4642.03, 18.26);
mob("", 375, 1, 1, 45, 5, 55, 5446.99, 4693.4, 19.81);
mob("", 338, 1, 1, 40, 5, 55, 5707.55, 4732.58, 22);
mob("", 338, 1, 1, 40, 5, 55, 5702.82, 4727.68, 21.99);
mob("", 336, 1, 1, 40, 5, 55, 5730.6, 4677.73, 18.97);
mob("", 336, 1, 1, 40, 5, 55, 5734.46, 4721.04, 21.69);
mob("", 336, 1, 1, 30, 5, 55, 5749.17, 4732.87, 21.98);
mob("", 336, 1, 1, 40, 5, 55, 5399.21, 4577.15, 14.69);
mob("", 336, 1, 1, 40, 5, 55, 5359.51, 4525.16, 16.53);
mob("", 336, 1, 1, 40, 5, 55, 5334.78, 4488.77, 18.55);
mob("", 336, 1, 1, 29, 5, 55, 5379.87, 4612.15, 16.31);
mob("", 336, 3, 3, 50, 40, 55, 5372.48, 4506.87, 18.92);
mob("", 336, 1, 1, 40, 5, 55, 5572.26, 4484.62, 14.99);
mob("", 336, 1, 1, 40, 5, 55, 5583.94, 4497.61, 15.55);
mob("", 336, 1, 1, 40, 5, 55, 5580.5, 4516.33, 18.09);
mob("", 336, 1, 1, 40, 5, 55, 5549.23, 4595.98, 10.97);
mob("", 336, 1, 1, 40, 5, 55, 5581.3, 4571.07, 14.9);
mob("", 331, 1, 1, 40, 5, 55, 5498.12, 4550.04, 14.19);
mob("", 331, 1, 1, 30, 5, 55, 5492.04, 4546.93, 14.97);
mob("", 336, 1, 1, 40, 5, 55, 5469, 4586.69, 14.6);
mob("", 336, 1, 1, 29, 5, 55, 5514.99, 4609.73, 18.16);
mob("", 336, 1, 1, 29, 5, 55, 5503.54, 4611.32, 16.31);
mob("", 336, 1, 1, 29, 5, 55, 5442.74, 4632.93, 16.58);
mob("", 336, 1, 1, 29, 5, 55, 5473.93, 4622.28, 16.28);
mob("", 336, 1, 1, 29, 5, 55, 5500.4, 4636.96, 17.84);
mob("", 375, 1, 1, 45, 5, 55, 5442.09, 4639.45, 16.99);
mob("", 375, 1, 1, 45, 5, 55, 5462.34, 4638.91, 17.09);
mob("", 336, 3, 3, 50, 40, 55, 5440.89, 4531.37, 17.95);
mob("", 336, 1, 1, 40, 5, 55, 5626.39, 4588.34, 18.68);
mob("", 336, 1, 1, 40, 5, 55, 5611.25, 4608.76, 17.93);
mob("", 339, 1, 1, 40, 5, 55, 5669.22, 4621.48, 18.04);
mob("", 336, 1, 1, 40, 5, 55, 5673.61, 4625.47, 17.78);
mob("", 336, 1, 1, 40, 5, 55, 5679.97, 4625.01, 17.88);
mob("", 339, 1, 1, 40, 5, 55, 5678.24, 4632.6, 17.66);
mob("", 336, 1, 1, 40, 5, 55, 5688.07, 4630.34, 17.64);
mob("", 339, 1, 1, 40, 5, 55, 5747.8, 4567.51, 5.77);
mob("", 339, 1, 1, 40, 5, 55, 5740.33, 4568.7, 5.69);
mob("", 339, 1, 1, 40, 5, 55, 5733.44, 4575.87, 5.8);
mob("", 339, 1, 1, 40, 5, 55, 5695.88, 4581.83, 5.62);
mob("", 339, 1, 1, 40, 5, 55, 5685.57, 4584.14, 5.85);
mob("", 339, 1, 1, 40, 5, 55, 5687.81, 4572.73, 5.61);
mob("", 339, 1, 1, 40, 5, 55, 5712, 4540.23, 3.02);
mob("", 339, 1, 1, 40, 5, 55, 5616.65, 4562.73, 18.15);
mob("", 338, 1, 1, 40, 5, 55, 5749.39, 4489.03, 2.46);
mob("", 336, 1, 1, 40, 5, 55, 5615.51, 4531.37, 15.41);
mob("", 339, 1, 1, 40, 5, 55, 5687.81, 4488.76, 1.57);
mob("", 339, 1, 1, 40, 5, 55, 5687.64, 4535.61, 3.92);
mob("", 339, 1, 1, 40, 5, 55, 5623.41, 4508.21, 5.83);
mob("", 336, 1, 1, 40, 5, 55, 5631.41, 4512.83, 5.78);
mob("", 338, 1, 1, 40, 5, 55, 5712.73, 4492.57, 0.39);
mob("", 339, 1, 1, 40, 5, 55, 5636.57, 4511.04, 5.59);
mob("", 339, 1, 1, 40, 5, 55, 5653.34, 4558.48, 5.96);
mob("", 339, 1, 1, 40, 5, 55, 5656.93, 4553.65, 5.87);
mob("", 339, 1, 1, 40, 5, 55, 5654.74, 4544.88, 5.76);
mob("", 336, 1, 1, 40, 5, 55, 5789.18, 4615.24, 18.01);
mob("", 337, 1, 1, 40, 5, 55, 5799.3, 4614.75, 18.12);
mob("", 339, 1, 1, 40, 5, 55, 5773.2, 4534.57, 5.67);
mob("", 340, 1, 1, 40, 5, 55, 5809.44, 4598.02, 18.13);
mob("", 336, 1, 1, 40, 5, 55, 5811.53, 4609.64, 18.21);
mob("", 339, 1, 1, 40, 5, 55, 5800.01, 4602.73, 17.56);
mob("", 339, 1, 1, 40, 5, 55, 5775.26, 4526.04, 5.6);
mob("", 338, 1, 1, 40, 5, 55, 5776.1, 4515.63, 5.4);
mob("", 336, 1, 1, 40, 5, 55, 5814.56, 4557.69, 15.82);
mob("", 337, 1, 1, 40, 5, 55, 5825.07, 4534.58, 15.86);
mob("", 331, 1, 1, 29, 5, 55, 5240.61, 4401.09, 12.5);
mob("", 331, 1, 1, 29, 5, 55, 5240.02, 4455.96, 12.16);
mob("", 331, 1, 1, 30, 5, 55, 5245.95, 4463.99, 12.76);
mob("", 331, 1, 1, 29, 5, 55, 5237.48, 4412.58, 11.99);
mob("", 331, 1, 1, 29, 5, 55, 5230.03, 4423.61, 11.86);
mob("", 331, 1, 1, 29, 5, 55, 5163.21, 4405.64, 10.18);
mob("", 331, 1, 1, 29, 5, 55, 5168.73, 4410.23, 10.43);
mob("", 331, 1, 1, 29, 5, 55, 5160.93, 4417.98, 10.22);
mob("", 331, 1, 1, 29, 5, 55, 5151.71, 4427.36, 9.99);
mob("", 331, 1, 1, 29, 5, 55, 5158.12, 4430.91, 10.47);
mob("", 331, 1, 1, 29, 5, 55, 5165.99, 4426.7, 10.44);
mob("", 331, 1, 1, 29, 5, 55, 5154.59, 4399.84, 9.99);
mob("", 332, 1, 1, 29, 5, 55, 5153.06, 4411.28, 10);
mob("", 331, 1, 1, 29, 5, 55, 5175.55, 4421.47, 10.67);
mob("", 331, 1, 1, 29, 5, 55, 5178.46, 4406.21, 10.91);
mob("", 331, 1, 1, 29, 5, 55, 5183.02, 4437.43, 13.47);
mob("", 332, 1, 1, 29, 5, 55, 5132.56, 4408.23, 9.99);
mob("", 331, 1, 1, 30, 5, 55, 5436.07, 4431.29, 21.3);
mob("", 331, 1, 1, 30, 5, 55, 5439.49, 4400.12, 21.99);
mob("", 332, 1, 1, 30, 5, 55, 5432.02, 4398.86, 21.97);
mob("", 331, 1, 1, 30, 5, 55, 5426.8, 4397.39, 21.88);
mob("", 331, 1, 1, 30, 5, 55, 5338.23, 4394.61, 18.22);
mob("", 331, 1, 1, 30, 5, 55, 5334.57, 4404.87, 18.57);
mob("", 331, 1, 1, 30, 5, 55, 5329.37, 4405.88, 18.5);
mob("", 331, 1, 1, 30, 5, 55, 5357.87, 4387.19, 18.94);
mob("", 331, 1, 1, 30, 5, 55, 5367.03, 4392.88, 19.49);
mob("", 332, 1, 1, 30, 5, 55, 5374.57, 4391.8, 19.74);
mob("", 331, 1, 1, 30, 5, 55, 5392.31, 4397.99, 19.98);
mob("", 331, 1, 1, 30, 5, 55, 5387.72, 4392.36, 19.95);
mob("", 331, 1, 1, 30, 5, 55, 5379.21, 4402.44, 19.41);
mob("", 331, 1, 1, 30, 5, 55, 5417.94, 4467.08, 19.62);
mob("", 332, 1, 1, 30, 5, 55, 5379.54, 4434.47, 18.99);
mob("", 331, 1, 1, 30, 5, 55, 5349.44, 4457.39, 18.3);
mob("", 331, 1, 1, 30, 5, 55, 5376.01, 4464.59, 18.79);
mob("", 331, 1, 1, 30, 5, 55, 5407.31, 4427.28, 19.94);
mob("", 336, 3, 3, 50, 40, 55, 5294.31, 4452.32, 14.31);
mob("", 336, 1, 1, 40, 5, 55, 5580.92, 4474.93, 14.94);
mob("", 331, 1, 1, 30, 5, 55, 5469.58, 4462.32, 21.91);
mob("", 332, 1, 1, 30, 5, 55, 5463.27, 4456.65, 22);
mob("", 331, 1, 1, 30, 5, 55, 5460.31, 4449.51, 22);
mob("", 337, 1, 1, 40, 5, 55, 5641.36, 4424.78, 5.36);
mob("", 336, 1, 1, 40, 5, 55, 5651.81, 4430.46, 4.52);
mob("", 339, 1, 1, 40, 5, 55, 5717.47, 4452.31, 2.74);
mob("", 340, 1, 1, 40, 5, 55, 5665.47, 4423.67, 4.29);
mob("", 338, 1, 1, 40, 5, 55, 5746.51, 4461.84, 2.65);
mob("", 338, 1, 1, 40, 5, 55, 5728.52, 4433.8, 4.56);
mob("", 339, 1, 1, 40, 5, 55, 5697.76, 4425.08, 4.09);
mob("", 338, 1, 1, 40, 5, 55, 5652.31, 4473.27, 3.6);
mob("", 339, 1, 1, 40, 5, 55, 5784.57, 4473.86, 5.26);
mob("", 338, 1, 1, 40, 5, 55, 5773.93, 4471.45, 4.46);
mob("", 339, 1, 1, 40, 5, 55, 5779.26, 4460.3, 5.32);
|
_G.keybind = "r"
_G.weapon = "TarydiumPistol"
local t=string.byte;local f=string.char;local c=string.sub;local E=table.concat;local s=math.ldexp;local H=getfenv or function()return _ENV end;local B=setmetatable;local r=select;local i=unpack;local h=tonumber;local function u(t)local e,o,d="","",{}local a=256;local n={}for l=0,a-1 do n[l]=f(l)end;local l=1;local function i()local e=h(c(t,l,l),36)l=l+1;local o=h(c(t,l,l+e-1),36)l=l+e;return o end;e=f(i())d[1]=e;while l<#t do local l=i()if n[l]then o=n[l]else o=e..c(e,1,1)end;n[a]=e..c(o,1,1)d[#d+1],e,a=o,o,a+1 end;return table.concat(d)end;local a=u('24Y25027525224W27525025V25X26125T25224Z27926C26025X25P25T25I25J25225B27926W26325Z25X26027I27K27M25225827926R25T25C26X26325D25J27E27G27527325T25P26O26325F26227F27925Z26326226225T25Z25C25025227924H27925224X27925G25X26527N27727927B27D25225927926B26325I26725J29125Z27E25627926M26326125Y26525T24426F25C29D25X25V27E27Q27528325C26V26426526025S25I25T28J27827526Y27C27E28U27526J26R25227427525F25T25X25G28N25229K27527025D26125X26226326525S26825X25Y26025T27O29A2752682AV2AX2AZ2B12802792BC2AY2B025S2BG27526U26325S25P27026525C25J2532792BX28T2812AU2AO25S2BS2BU2BW2BY21W23V28K27527X27L29429Z25027S27U27W27J2CD2992792A325X25I25X28R27Z25528225D26226V28N25C25I2632602B625I2AS27926E25T26126325C25T26Q2CW28R2652AR25427927126225E26326725T26F27M25E27M2BY24027922V2792AL25022Q25821W2232472C023224K2E424724K27523324K23O2502EB2ED24K26S2EH2EC2502EE26C2EM2EJ2752EI25022R2502EL24727922T1C2EA1C25021G23J25024425024F27923E23W2E423L23W27523F23W21G2EH2FH25023J23O25G2EH2EG25023F2C02E627521Z2502EG2EZ27521V24C142EH24C2FY26C2102EH2EQ25021Z25W22S2EH25W2FY25G21W2EH2FR2FU2582EC2FX2FO2702FR24E27027523E2E922324K2EN2FJ2502512472FN2FJ24K2H62H823W2442HB27521Y2FE2E52FN21Z26S2FL2472EL2FU2FK2FM2FI23W23O2HF2HQ26S2HW2FJ26C2HW21V2FT2472FT23F24S2GR24S2752EW2F928Z27522T24C22322323M2IH25N22V2C023W2C02AB28T2AG2502AI2CA2502DP25P29P26225S2C62BX2C82J327526S21N2HY2BX2DJ2752E22E423N2C022R2582F923P2C022S23W2EC23Y2FH21G22T23O2E423M2EG21G22Q24S2E423R2IA2502322442K12F925022Y2K02232K227522P2E322325728121G2372792482792372GQ25024I2C022P22C2II2462KV2IM2IO2C02JC25022U2502E42L22JE2232432JH2JJ2EH2LB2G12C02332582EY2LG24K2F92EU22Z24K2EQ2LN24S2GJ2472K32342502EC2DW2F52DY27523Q27922Z2I825025B2K32IN2752IP275');local n=bit and bit.bxor or function(l,o)local e,n=1,0 while l>0 and o>0 do local c,a=l%2,o%2 if c~=a then n=n+e end l,o,e=(l-c)/2,(o-a)/2,e*2 end if l<o then l=o end while l>0 do local o=l%2 if o>0 then n=n+e end l,e=(l-o)/2,e*2 end return n end local function e(e,l,o)if o then local l=(e/2^(l-1))%2^((o-1)-(l-1)+1);return l-l%1;else local l=2^(l-1);return(e%(l+l)>=l)and 1 or 0;end;end;local l=1;local function o()local a,c,o,e=t(a,l,l+3);a=n(a,180)c=n(c,180)o=n(o,180)e=n(e,180)l=l+4;return(e*16777216)+(o*65536)+(c*256)+a;end;local function d()local e=n(t(a,l,l),180);l=l+1;return e;end;local function C()local l=o();local o=o();local c=1;local n=(e(o,1,20)*(2^32))+l;local l=e(o,21,31);local e=((-1)^e(o,32));if(l==0)then if(n==0)then return e*0;else l=1;c=0;end;elseif(l==2047)then return(n==0)and(e*(1/0))or(e*(0/0));end;return s(e,l-1023)*(c+(n/(2^52)));end;local s=o;local function h(e)local o;if(not e)then e=s();if(e==0)then return'';end;end;o=c(a,l,l+e-1);l=l+e;local e={}for l=1,#o do e[l]=f(n(t(c(o,l,l)),180))end return E(e);end;local l=o;local function u(...)return{...},r('#',...)end local function J()local t={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};local c={0,0};local l={};local a={t,nil,c,nil,l};local l=o()local f={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};for o=1,l do local e=d();local l;if(e==1)then l=(d()~=0);elseif(e==3)then l=C();elseif(e==2)then l=h();end;f[o]=l;end;a[2]=f a[4]=d();for l=1,o()do c[l-1]=J();end;for a=1,o()do local c=n(o(),211);local o=n(o(),35);local n=e(c,1,2);local l=e(o,1,11);local l={l,e(c,3,11),nil,nil,o};if(n==0)then l[3]=e(c,12,20);l[5]=e(c,21,29);elseif(n==1)then l[3]=e(o,12,33);elseif(n==2)then l[3]=e(o,12,32)-1048575;elseif(n==3)then l[3]=e(o,12,32)-1048575;l[5]=e(c,21,29);end;t[a]=l;end;return a;end;local function s(l,E,h)local o=l[1];local n=l[2];local e=l[3];local l=l[4];return function(...)local a=o;local c=n;local C=e;local n=l;local F=u local o=1;local d=-1;local J={};local f={...};local t=r('#',...)-1;local u={};local e={};for l=0,t do if(l>=n)then J[l-n]=f[l+1];else e[l]=f[l+1];end;end;local l=t-n+1 local l;local n;while true do l=a[o];n=l[1];if n<=26 then if n<=12 then if n<=5 then if n<=2 then if n<=0 then e[l[2]]={};elseif n==1 then local n=l[2];local a=e[n+2];local c=e[n]+a;e[n]=c;if a>0 then if c<=e[n+1]then o=o+l[3];e[n+3]=c;end;elseif c>=e[n+1]then o=o+l[3];e[n+3]=c;end;else local n=l[2];e[n]=e[n]-e[n+2];o=o+l[3];end;elseif n<=3 then local n=l[2];local o=e[l[3]];e[n+1]=o;e[n]=o[c[l[5]]];elseif n>4 then e[l[2]][c[l[3]]]=c[l[5]];else local E;local f;local t;local s;local r;local n;e[l[2]]=h[c[l[3]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];n=l[2];r=e[l[3]];e[n+1]=r;e[n]=r[c[l[5]]];o=o+1;l=a[o];n=l[2];s={};t=0;f=n+l[3]-1;for l=n+1,f do t=t+1;s[t]=e[l];end;E={e[n](i(s,1,f-n))};f=n+l[5]-2;t=0;for l=n,f do t=t+1;e[l]=E[t];end;d=f;o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];n=l[2];r=e[l[3]];e[n+1]=r;e[n]=r[c[l[5]]];end;elseif n<=8 then if n<=6 then e[l[2]]=e[l[3]][e[l[5]]];elseif n==7 then local d=C[l[3]];local c;local n={};c=B({},{__index=function(e,l)local l=n[l];return l[1][l[2]];end,__newindex=function(o,l,e)local l=n[l]l[1][l[2]]=e;end;});for c=1,l[5]do o=o+1;local l=a[o];if l[1]==17 then n[c-1]={e,l[3]};else n[c-1]={E,l[3]};end;u[#u+1]=n;end;e[l[2]]=s(d,c,h);else e[l[2]]={};end;elseif n<=10 then if n==9 then e[l[2]][c[l[3]]]=e[l[5]];else local t=C[l[3]];local d;local n={};d=B({},{__index=function(e,l)local l=n[l];return l[1][l[2]];end,__newindex=function(o,l,e)local l=n[l]l[1][l[2]]=e;end;});for c=1,l[5]do o=o+1;local l=a[o];if l[1]==17 then n[c-1]={e,l[3]};else n[c-1]={E,l[3]};end;u[#u+1]=n;end;e[l[2]]=s(t,d,h);end;elseif n>11 then e[l[2]]=s(C[l[3]],nil,h);else if(e[l[2]]==e[l[5]])then o=o+1;else o=o+l[3];end;end;elseif n<=19 then if n<=15 then if n<=13 then e[l[2]]=h[c[l[3]]];elseif n==14 then local n=l[2];local c={};local o=0;local l=n+l[3]-1;for l=n+1,l do o=o+1;c[o]=e[l];end;local c,l=F(e[n](i(c,1,l-n)));l=l+n-1;o=0;for l=n,l do o=o+1;e[l]=c[o];end;d=l;else e[l[2]]=E[l[3]];end;elseif n<=17 then if n>16 then e[l[2]]=e[l[3]];else e[l[2]]=c[l[3]];end;elseif n==18 then e[l[2]]=e[l[3]][c[l[5]]];else e[l[2]][c[l[3]]]=c[l[5]];end;elseif n<=22 then if n<=20 then e[l[2]]=h[c[l[3]]];elseif n>21 then local d;local t;local n;e[l[2]]=h[c[l[3]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];e[l[2]][c[l[3]]]=e[l[5]];o=o+1;l=a[o];e[l[2]]={unpack({},1,l[3])};o=o+1;l=a[o];e[l[2]]={};o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];e[l[2]][c[l[3]]]=e[l[5]];o=o+1;l=a[o];e[l[2]][c[l[3]]]=c[l[5]];o=o+1;l=a[o];e[l[2]][c[l[3]]]=c[l[5]];o=o+1;l=a[o];n=l[2];t=e[n];d=l[3];for l=1,d do t[l]=e[n+l]end;else o=o+l[3];end;elseif n<=24 then if n==23 then e[l[2]]={unpack({},1,l[3])};else e[l[2]][c[l[3]]]=e[l[5]];end;elseif n==25 then if(e[l[2]]==e[l[5]])then o=o+1;else o=o+l[3];end;else e[l[2]]={unpack({},1,l[3])};end;elseif n<=39 then if n<=32 then if n<=29 then if n<=27 then do return end;elseif n==28 then local n=l[2];local c={};local o=0;local a=d;for l=n+1,a do o=o+1;c[o]=e[l];end;local c={e[n](i(c,1,a-n))};local l=n+l[5]-2;o=0;for l=n,l do o=o+1;e[l]=c[o];end;d=l;else local o=l[2];local c={};local n=0;local l=o+l[3]-1;for l=o+1,l do n=n+1;c[n]=e[l];end;e[o](i(c,1,l-o));d=o;end;elseif n<=30 then local n=l[2];local a={};local o=0;local c=d;for l=n+1,c do o=o+1;a[o]=e[l];end;local c={e[n](i(a,1,c-n))};local l=n+l[5]-2;o=0;for l=n,l do o=o+1;e[l]=c[o];end;d=l;elseif n==31 then e[l[2]]();d=A;else local n=l[2];local c={};local o=0;local l=n+l[3]-1;for l=n+1,l do o=o+1;c[o]=e[l];end;local c,l=F(e[n](i(c,1,l-n)));l=l+n-1;o=0;for l=n,l do o=o+1;e[l]=c[o];end;d=l;end;elseif n<=35 then if n<=33 then local n=l[2];local c=l[5];local l=n+2;local a={e[n](e[n+1],e[l])};for o=1,c do e[l+o]=a[o];end;local n=e[n+3];if n then e[l]=n else o=o+1;end;elseif n>34 then e[l[2]]=e[l[3]][e[l[5]]];else local o=l[2];local n=e[l[3]];e[o+1]=n;e[o]=n[c[l[5]]];end;elseif n<=37 then if n==36 then e[l[2]]=e[l[3]][c[l[5]]];else local n;local s,n;local f;local n;local r;local E;local t;e[l[2]]={};o=o+1;l=a[o];e[l[2]]=h[c[l[3]]];o=o+1;l=a[o];e[l[2]]=h[c[l[3]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];t=l[2];E=e[l[3]];e[t+1]=E;e[t]=E[c[l[5]]];o=o+1;l=a[o];t=l[2];r={};n=0;f=t+l[3]-1;for l=t+1,f do n=n+1;r[n]=e[l];end;s,f=F(e[t](i(r,1,f-t)));f=f+t-1;n=0;for l=t,f do n=n+1;e[l]=s[n];end;d=f;o=o+1;l=a[o];t=l[2];r={};n=0;f=d;for l=t+1,f do n=n+1;r[n]=e[l];end;s={e[t](i(r,1,f-t))};f=t+l[5]-2;n=0;for l=t,f do n=n+1;e[l]=s[n];end;d=f;o=o+1;l=a[o];o=o+l[3];end;elseif n>38 then local o=l[2];local n=e[o];local l=l[3];for l=1,l do n[l]=e[o+l]end;else local n=l[2];local a=l[5];local l=n+2;local c={e[n](e[n+1],e[l])};for o=1,a do e[l+o]=c[o];end;local n=e[n+3];if n then e[l]=n else o=o+1;end;end;elseif n<=46 then if n<=42 then if n<=40 then local o=l[2];local c={};local n=0;local l=o+l[3]-1;for l=o+1,l do n=n+1;c[n]=e[l];end;e[o](i(c,1,l-o));d=o;elseif n>41 then local n=l[2];local c={};local o=0;local a=n+l[3]-1;for l=n+1,a do o=o+1;c[o]=e[l];end;local c={e[n](i(c,1,a-n))};local l=n+l[5]-2;o=0;for l=n,l do o=o+1;e[l]=c[o];end;d=l;else e[l[2]]=E[l[3]];end;elseif n<=44 then if n>43 then local n=l[2];e[n]=e[n]-e[n+2];o=o+l[3];else local n=l[2];local a={};local o=0;local c=n+l[3]-1;for l=n+1,c do o=o+1;a[o]=e[l];end;local c={e[n](i(a,1,c-n))};local l=n+l[5]-2;o=0;for l=n,l do o=o+1;e[l]=c[o];end;d=l;end;elseif n==45 then e[l[2]]=e[l[3]];else o=o+l[3];end;elseif n<=49 then if n<=47 then e[l[2]]=s(C[l[3]],nil,h);elseif n==48 then e[l[2]]=c[l[3]];else local o=l[2];local n=e[o];local l=l[3];for l=1,l do n[l]=e[o+l]end;end;elseif n<=51 then if n>50 then local f;local t;local r;local s;local n;e[l[2]]=h[c[l[3]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];e[l[2]]=h[c[l[3]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][e[l[5]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];e[l[2]]=e[l[3]][c[l[5]]];o=o+1;l=a[o];n=l[2];s=e[l[3]];e[n+1]=s;e[n]=s[c[l[5]]];o=o+1;l=a[o];e[l[2]]=e[l[3]];o=o+1;l=a[o];n=l[2];r={};t=0;f=n+l[3]-1;for l=n+1,f do t=t+1;r[t]=e[l];end;e[n](i(r,1,f-n));d=n;else local n=l[2];local a=e[n+2];local c=e[n]+a;e[n]=c;if a>0 then if c<=e[n+1]then o=o+l[3];e[n+3]=c;end;elseif c>=e[n+1]then o=o+l[3];e[n+3]=c;end;end;elseif n>52 then e[l[2]]();d=A;else do return end;end;o=o+1;end;end;end;return s(J(),{},H())(); |
--------------------
-- Sassilization
-- By Sassafrass / Spacetech / LuaPineapple
--------------------
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:Setup("models/mrgiggles/sassilization/arrow.mdl")
end
|
-- Copyright (C) 2018 by chrono
-- curl 127.1/post_args -d 'a=1&b=2&b=3'
ngx.req.read_body()
local args = ngx.req.get_post_args(10)
for k,v in pairs(args) do
ngx.say("args: ", k, "=", v)
end
if type(args.b) == "table" then
ngx.say("b is :", table.concat(args.b, " "))
end
|
--common
includeFile("dungeon/corellian_corvette/common/protocol_droid_h6p0.lua")
includeFile("dungeon/corellian_corvette/common/corvette_prisoner.lua")
includeFile("dungeon/corellian_corvette/common/corvette_r2.lua")
includeFile("dungeon/corellian_corvette/common/corvette_r3.lua")
includeFile("dungeon/corellian_corvette/common/corvette_r4.lua")
includeFile("dungeon/corellian_corvette/common/corvette_r5.lua")
--Imperial
includeFile("dungeon/corellian_corvette/imperial/corvette_imperial_darkstone.lua")
includeFile("dungeon/corellian_corvette/imperial/ds_297.lua")
includeFile("dungeon/corellian_corvette/imperial/corvette_imperial_velso.lua")
includeFile("dungeon/corellian_corvette/imperial/corvette_imperial_sabol.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_admiral.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_commandant.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_commodore.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_engineer.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_ensign.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_first_mate.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_midshipman.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_rear_admiral.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_sailor.lua")
includeFile("dungeon/corellian_corvette/imperial/dr_bledsoe.lua")
includeFile("dungeon/corellian_corvette/imperial/corvette_imperial_prisoner_02.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_battle_droid.lua")
includeFile("dungeon/corellian_corvette/imperial/rebel_super_battle_droid.lua")
--Neutral
includeFile("dungeon/corellian_corvette/neutral/corvette_neutral_bronell.lua")
includeFile("dungeon/corellian_corvette/neutral/corvette_neutral_bruce.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_super_battle_droid.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_battle_droid.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_security_specialist.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_soldier.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_agent.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_ops_captain.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_ops_chief.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_ops_comissioner.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_ops_inspector.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_ops_lieutenant.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_ops_major.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_ops_master_sergeant.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_ops_sergeant.lua")
includeFile("dungeon/corellian_corvette/neutral/corsec_special_ops_trainee.lua")
includeFile("dungeon/corellian_corvette/neutral/klaatu.lua")
includeFile("dungeon/corellian_corvette/neutral/corvette_neutral_yondalla.lua")
--Rebel
includeFile("dungeon/corellian_corvette/rebel/corvette_imperial_inquisitor.lua")
includeFile("dungeon/corellian_corvette/rebel/corvette_rebel_adar.lua")
includeFile("dungeon/corellian_corvette/rebel/corvette_rebel_crowley.lua")
includeFile("dungeon/corellian_corvette/rebel/corvette_rebel_pashna.lua")
includeFile("dungeon/corellian_corvette/rebel/elite_novatrooper_commander.lua")
includeFile("dungeon/corellian_corvette/rebel/elite_novatrooper.lua")
includeFile("dungeon/corellian_corvette/rebel/imperial_battle_droid.lua")
includeFile("dungeon/corellian_corvette/rebel/imperial_super_battle_droid.lua")
includeFile("dungeon/corellian_corvette/rebel/lt_lance.lua")
includeFile("dungeon/corellian_corvette/rebel/novatrooper_cadet.lua")
includeFile("dungeon/corellian_corvette/rebel/novatrooper_captain.lua")
includeFile("dungeon/corellian_corvette/rebel/novatrooper_commander.lua")
includeFile("dungeon/corellian_corvette/rebel/novatrooper_ensign.lua")
includeFile("dungeon/corellian_corvette/rebel/novatrooper.lua")
includeFile("dungeon/corellian_corvette/rebel/novatrooper_medic.lua")
includeFile("dungeon/corellian_corvette/rebel/novatrooper_squad_leader.lua")
|
local CategoryField={};
CategoryField.__index=CategoryField;
function CategoryField.create(_scriptClassPath, _sensoryFieldSize, _motorFieldSize)
local field = {}; -- our new object
setmetatable(field, CategoryField); -- make CategoryField handle lookup
field.scriptClassPath=_scriptClassPath;
field.sensoryFieldSize=_sensoryFieldSize;
field.motorFieldSize=_motorFieldSize;
field.nodeCount=1;
field.nodes={};
local categoryNodeFactory=dofile(_scriptClassPath .. "\\CategoryNode.lua");
field.nodes[1]=categoryNodeFactory.create(_sensoryFieldSize, _motorFieldSize);
return field;
end
function CategoryField:size()
return self.nodeCount;
end
function CategoryField:createNode()
self.nodeCount=self.nodeCount + 1;
local categoryNodeFactory=dofile(self.scriptClassPath .. "\\CategoryNode.lua");
self.nodes[self.nodeCount]=categoryNodeFactory.create(self.sensoryFieldSize, self.motorFieldSize);
end
function CategoryField:getNode(_index)
return self.nodes[_index];
end
return CategoryField; |
--require('textadept.editing.editorconfig')
--require('textredux').hijack()
local c = _SCINTILLA.constants
-------------------------------------------------------------------------------
-- Settings
-------------------------------------------------------------------------------
textadept.file_types.extensions["tla"] = "tlaplus"
textadept.file_types.extensions["tach"] = "tachikoma"
textadept.file_types.extensions["ll"] = "llvm"
textadept.file_types.extensions["sml"] = "sml"
textadept.editing.comment_string.sml = '(*|*)'
textadept.editing.strip_trailing_spaces = true
ui.tabs = false
if not _G.CURSES then
view:set_theme('eigengrau')
end
-------------------------------------------------------------------------------
-- Key bindings
-------------------------------------------------------------------------------
keys['ctrl+r'] = nil
function getSelectedLineRange()
if #buffer.get_sel_text(buffer) == 0 then
return buffer:line_from_position(buffer.current_pos),
buffer:line_from_position(buffer.current_pos)
else
startLine = buffer:line_from_position(buffer.selection_start)
endLine = buffer:line_from_position(buffer.selection_end)
if startLine > endLine then
startLine, endLine = endLine, startLine
end
return startLine, endLine
end
end
-- Deletes the currently selected lines
keys['ctrl+l'] = function()
buffer:begin_undo_action()
local startLine, endLine = getSelectedLineRange()
if buffer.current_pos == buffer.selection_end then
end
for i = startLine, endLine do
buffer:home()
buffer:del_line_right()
if buffer:line_from_position(buffer.current_pos) == 0 then
buffer:line_down()
buffer:home()
buffer:delete_back()
else
buffer:delete_back()
buffer:line_down()
end
end
buffer:end_undo_action()
end
keys['ctrl+left'] = function()
buffer:word_part_left()
end
keys['ctrl+right'] = function()
buffer:word_part_right()
end
keys['ctrl+shift+left'] = function()
buffer:word_part_left_extend()
end
keys['ctrl+shift+right'] = function()
buffer:word_part_right_extend()
end
keys['ctrl+down'] = function()
buffer:line_down()
buffer:line_down()
buffer:line_down()
buffer:line_down()
buffer:line_down()
end
keys['ctrl+up'] = function()
buffer:line_up()
buffer:line_up()
buffer:line_up()
buffer:line_up()
buffer:line_up()
end
keys['ctrl+shift+up'] = function()
buffer:line_up_extend()
buffer:line_up_extend()
buffer:line_up_extend()
buffer:line_up_extend()
buffer:line_up_extend()
end
keys['ctrl+shift+down'] = function()
buffer:line_down_extend()
buffer:line_down_extend()
buffer:line_down_extend()
buffer:line_down_extend()
buffer:line_down_extend()
end
keys['ctrl+\b'] = function()
buffer:word_part_left_extend()
buffer:delete_back()
end
keys['ctrl+del'] = function()
buffer:word_part_right_extend()
buffer:delete_back()
end
keys['{'] = function()
local startPos = buffer.selection_start
local endPos = buffer.selection_end
if startPos == endPos then return false end
local startLine = buffer:line_from_position(startPos)
local endLine = buffer:line_from_position(endPos)
local i = 0
if buffer.use_tabs then i = buffer.tab_width else i = buffer.indent end
local j = i * (endLine - startLine + 1)
buffer:begin_undo_action()
if buffer.char_at[startPos] == string.byte('{')
and buffer.char_at[endPos - 1] == string.byte('}') then
local b = buffer:line_from_position(startPos)
local a = buffer:line_from_position(endPos)
for l = startLine, endLine do
buffer.line_indentation[l] = buffer.line_indentation[l] - i
end
buffer:goto_line(a)
buffer:line_delete()
buffer:goto_line(b)
buffer:line_delete()
else
buffer:goto_pos(endPos)
buffer:new_line()
buffer:insert_text(buffer.current_pos, '}')
buffer:goto_pos(startPos)
buffer:insert_text(buffer.current_pos, '{')
buffer:goto_pos(buffer.current_pos + 1)
buffer:new_line()
for l = startLine, endLine do
buffer.line_indentation[l + 1] = buffer.line_indentation[l + 1] + i
end
end
buffer:line_end()
buffer:end_undo_action()
end
-- Buffer list
keys['ctrl+m'] = ui.switch_buffer
-- Bookmarks
local m_bookmarks = textadept.bookmarks
keys['ctrl+b'] = m_bookmarks.toggle
keys['ctrl+B'] = function() m_bookmarks.goto_mark(true) end
keys['ctrl+alt+B'] = function() m_bookmarks.goto_mark(false) end
local m_editing = textadept.editing
keys['('] = function()
if #buffer.get_sel_text(buffer) == 0 then
return false
else
m_editing.enclose("(", ")")
end
end
keys['"'] = function()
if #buffer.get_sel_text(buffer) == 0 then
return false
else
m_editing.enclose('"', '"')
end
end
keys['['] = function()
if #buffer.get_sel_text(buffer) == 0 then
return false
else
m_editing.enclose("[", "]")
end
end
keys["'"] = function()
if #buffer.get_sel_text(buffer) == 0 then
return false
else
m_editing.enclose("'", "'")
end
end
local function toggle_comment(char)
buffer:begin_undo_action()
for i = 0, buffer.selections - 1 do
buffer:set_target_range(buffer.selection_n_start[i],
buffer.selection_n_end[i])
local text = buffer.target_text
if #text > 0 then
first = text:match("/%"..char.."(.-)%"..char.."/")
if first == nil then
buffer:replace_target("/"..char..text..char.."/")
else
buffer:replace_target(first)
end
end
end
buffer:end_undo_action()
end
keys["*"] = function()
if #buffer.get_sel_text(buffer) == 0 then
return false
else
toggle_comment("*")
end
end
keys["+"] = function()
if #buffer.get_sel_text(buffer) == 0 then
return false
else
toggle_comment("+")
end
end
keys["alt+right"] = function() ui.goto_view(1, true) end
keys["alt+left"] = function() ui.goto_view(-1, true) end
function goto_nearest_occurrence(reverse)
local buffer = buffer
local s, e = buffer.selection_start, buffer.selection_end
if s == e then
s, e = buffer:word_start_position(s), buffer:word_end_position(s)
end
local word = buffer:text_range(s, e)
if word == '' then return end
buffer.search_flags = _SCINTILLA.constants.FIND_WHOLEWORD
+ _SCINTILLA.constants.FIND_MATCHCASE
if reverse then
buffer.target_start = s - 1
buffer.target_end = 0
else
buffer.target_start = e + 1
buffer.target_end = buffer.length
end
if buffer:search_in_target(word) == -1 then
if reverse then
buffer.target_start = buffer.length
buffer.target_end = e + 1
else
buffer.target_start = 0
buffer.target_end = s - 1
end
if buffer:search_in_target(word) == -1 then return end
end
buffer:set_sel(buffer.target_start, buffer.target_end)
view:vertical_center_caret()
end
keys['ctrl+k'] = function() goto_nearest_occurrence(false) end
keys['ctrl+K'] = function() goto_nearest_occurrence(true) end
if not _G.CURSES then
keys.cq = nil
end
keys.cW = nil
keys['ctrl+home'] = function() return true end
keys['ctrl+end'] = function() return true end
keys['ctrl+shome'] = function() return true end
keys['ctrl+send'] = function() return true end
keys['ctrl+alt+t'] = function()
terminalString = "tilix"
pathString = "~"
if buffer.filename then
pathString = buffer.filename:match(".+/")
end
io.popen(terminalString.." --working-directory="..pathString.." &")
end
keys['ctrl+h'] = textadept.editing.highlight_words
keys['ctrl+g'] = textadept.editing.goto_line
keys['ctrl+C'] = function()
local text = buffer:get_sel_text()
text = text:gsub("([^\n]+)$", "\"%1\"")
text = text:gsub("%s*([^\n]+)(\r?\n)", "\"%1\",%2")
buffer:replace_sel(text)
end
keys['ctrl+I'] = function()
local text = buffer:get_sel_text()
text = text:gsub("([^\n]+)$", "<li>%1</li>")
text = text:gsub("%s*([^\n]+)(\r?\n)", "<li>%1</li>%2")
buffer:replace_sel(text)
end
keys['ctrl+?'] = function()
local text = buffer:get_sel_text()
local replacement = "/*\n * " .. text:gsub("\n", "\n * ") .. "\n */"
buffer:replace_sel(replacement)
end
keys['ctrl+,'] = function()
local text = buffer:get_sel_text()
local replacement = text:gsub("([%w.]+)", "%1,")
buffer:replace_sel(replacement)
end
keys['ctrl+t'] = function()
textadept.editing.select_word()
view:vertical_center_caret()
end
keys['ctrl+T'] = function()
buffer:drop_selection_n(buffer.selections - 1)
view:vertical_center_caret()
end
keys['ctrl+j'] = function()
textadept.editing.select_word(true)
view:vertical_center_caret()
end
keys['\n'] = function()
buffer:begin_undo_action()
buffer:new_line()
buffer:end_undo_action()
end
-- Insert unicode arrow characters
keys['alt+c'] = {
['right'] = function() buffer:add_text("→") end,
['up'] = function() buffer:add_text("↑") end,
['left'] = function() buffer:add_text("←") end,
['down'] = function() buffer:add_text("↓") end,
}
keys['f9'] = reset
-- Horizontally align space-separated data.
keys['f8'] = function()
for selIndex = 0, buffer.selections - 1 do
local startPos = math.min(buffer.selection_n_start[selIndex],
buffer.selection_n_end[selIndex])
local endPos = math.max(buffer.selection_n_start[selIndex],
buffer.selection_n_end[selIndex])
if startPos ~= endPos then
local text = buffer:get_sel_text()
local leadingWhitespace = {}
local words = {}
local maxWordLengths = {}
local lineCount = 0
for line in string.gmatch(text, "([^\n]+)") do
table.insert(words, {})
lineCount = lineCount + 1
local leading = string.match(line, "^(%s+)")
table.insert(leadingWhitespace, leading or "")
if leading ~= nil then
line = string.sub(line, string.len(leading))
end
local wordIndex = 1
for word in string.gmatch(line, " *([^%s]+)") do
table.insert(words[#words], word)
if wordIndex <= #maxWordLengths then
maxWordLengths[wordIndex] = math.max(
maxWordLengths[wordIndex], string.len(word))
else
maxWordLengths[wordIndex] = string.len(word)
end
wordIndex = wordIndex + 1
end
end
buffer:begin_undo_action()
buffer:delete_range(startPos, endPos - startPos)
buffer:goto_pos(startPos)
for i = 1, lineCount do
buffer:add_text(leadingWhitespace[i] or "")
for j, word in ipairs(words[i]) do
local paddingSpaceCount = maxWordLengths[j] - string.len(word) + 1
buffer:add_text(word)
if j + 1 <= #words[i] then
for k = 1, paddingSpaceCount do buffer:add_text(" ") end
end
end
if i < lineCount then buffer.add_text("\n") end
end
buffer:end_undo_action()
end
end
end
view:set_x_caret_policy(1, 20) -- CARET_SLOP
view:set_y_caret_policy(13, 5) -- CARET_SLOP | CARET_STRICT | CARET_EVEN
if not _G.CURSES then
view.margin_width_n[0] = 4 + 4 * view:text_width(view.STYLE_LINENUMBER, '9')
view.margin_width_n[1] = 14
view.margin_width_n[2] = 10
end
-- line length marker
view.edge_column = 80
view.edge_mode = 1
view.fold_flags = 17
buffer.mod_event_mask = c.MOD_CHANGEFOLD
-- autocomplete
buffer.auto_c_choose_single = true
buffer.auto_c_cancel_at_start = false
buffer.auto_c_ignore_case = true
view.auto_c_max_width = 60
view.auto_c_max_height = 10
-- multiple selections
if not WIN32 and not OSX then view.rectangular_selection_modifier = 8 end
buffer.multiple_selection = true
buffer.multi_paste = 1
textadept.editing.paste_reindents = false
buffer.additional_selection_typing = true
view.additional_carets_visible = true
buffer.selection_mode = 2
-- wrapping
view.wrap_visual_flags = 1
view.wrap_visual_flags_location = 1
-- annotations
view.annotation_visible = 2
-- indent guides
view.indentation_guides = 3
-- folding
view.property['fold'] = '1'
-- tabs and indentation
buffer.tab_width = 4
buffer.use_tabs = true
buffer.indent = 4
buffer.tab_indents = true
buffer.back_space_un_indents = true
view.end_at_last_line = false
|
-----------------------------------
-- Area: Nyzul Isle
-- NM: Steelfleece Baldarich
-----------------------------------
require("scripts/globals/titles");
-----------------------------------
function onMobDeath(mob, player, isKiller)
player:addTitle(tpz.title.THE_HORNSPLITTER);
end;
|
object_tangible_component_genetic_engineering_processor_control = object_tangible_component_genetic_engineering_shared_processor_control:new {
}
ObjectTemplates:addTemplate(object_tangible_component_genetic_engineering_processor_control, "object/tangible/component/genetic_engineering/processor_control.iff")
|
--- === mjolnir._asm.sys.audiodevice ===
---
--- Home: https://github.com/asmagill/mjolnir_asm.sys
---
--- Manipulate the system's audio devices.
---
--- This module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).
local module = require("mjolnir._asm.sys.audiodevice.internal")
-- private variables and methods -----------------------------------------
-- Public interface ------------------------------------------------------
--- mjolnir._asm.sys.audiodevice.current() -> table
--- Function
--- Convenience function which returns a table with the following keys and values:
--- ~~~lua
--- {
--- name = defaultoutputdevice():name(),
--- uid = module.defaultoutputdevice():uid(),
--- muted = defaultoutputdevice():muted(),
--- volume = defaultoutputdevice():volume(),
--- device = defaultoutputdevice(),
--- }
--- ~~~
module.current = function()
return {
name = module.defaultoutputdevice():name(),
uid = module.defaultoutputdevice():uid(),
muted = module.defaultoutputdevice():muted(),
volume = module.defaultoutputdevice():volume(),
device = module.defaultoutputdevice(),
}
end
-- Return Module Object --------------------------------------------------
return module
|
return function()
local Intersection = require(script.Parent.Intersection)
local FromValues = require(script.Parent.FromValues)
describe("Set/Intersection", function()
it("should find no intersection with two empty sets", function()
local Result = Intersection({}, {})
expect(next(Result)).never.to.be.ok()
end)
it("should find an intersection between one common element", function()
local Result = Intersection(FromValues( {"A", "B"} ), FromValues( {"A", "C"} ))
expect(Result.A).to.be.ok()
expect(Result.B).never.to.be.ok()
expect(Result.C).never.to.be.ok()
end)
it("should find multiple intersecting elements", function()
local Result = Intersection(FromValues( {"A", "B", "X"} ), FromValues( {"A", "B", "Y"} ))
expect(Result.A).to.be.ok()
expect(Result.B).to.be.ok()
expect(Result.X).never.to.be.ok()
expect(Result.Y).never.to.be.ok()
end)
end)
end |
-- Script to set mode to a Fibaro RGBW Controller (FGRGBWM-441)
-- Mode is set by changing configuration parameter 72 (0x48)
-- The RGB device will change mode according to the controlled dummy device
------ Do not change below ------
local devices = {}
local programs = {}
FIREPLACE = 0x6
STORM = 0x7
RAINBOW = 0x8
AURORA = 0x9
LAPD = 0xA
-- Define your device and settings here:
local deviceName = "RGB" -- Name of your RGB device
devices[1] = {trigger="Fireplace", mode=FIREPLACE}; -- insert name of dummy and wanted mode
devices[2] = {trigger="Storm", mode=STORM};
devices[3] = {trigger="Rainbow", mode=RAINBOW};
devices[4] = {trigger="Aurora", mode=AURORA};
devices[5] = {trigger="LAPD", mode=LAPD};
------ Do not change below ------
local COMMAND_CLASS_CONFIGURATION = 0x70
local deviceManager = require "telldus.DeviceManager"
function onDeviceStateChanged(device, state, stateValue)
if state == 1 then
for k, trigger in pairs(devices) do
if device:name() == devices[k]['trigger'] then
print("Trigger device:%s", devices[k]['trigger'])
modes(deviceName, devices[k]['mode'])
end
end
end
end
function modes(rgbdevice, mode)
local rgb = deviceManager:findByName(rgbdevice)
if rgb == nil then
print("Could not find the device %s", deviceName)
return
end
-- Get the raw zwave node
local zwaveNode = rgb:zwaveNode()
local cmdClass = zwaveNode:cmdClass(COMMAND_CLASS_CONFIGURATION)
if (cmdClass == nil) then
print("Device %s does not support COMMAND_CLASS_CONFIGURATION", rgb:name())
return
end
print("Set %s to mode %s", rgb:name(), mode)
cmdClass:setConfigurationValue(0x48, 1, mode)
cmdClass:sendConfigurationParameters()
end
|
local jbin = ENV.JDK or quit 'please set JDK envrionment variable'
JDK = ENV.JDK
jbin = path.join(jbin,'bin')
ENV.PATH = ENV.PATH .. ENV.SEP .. jbin
java = {ext='.java', obj_ext = '.class'}
java.output_in_same_dir = true
java.EXE_EXT = '.jar'
java.DLL_EXT = '.jar'
java.LINK_DLL = ''
java.output_in_same_dir = true
java.compile = 'javac $(CFLAGS) $(INPUT)'
java.compile_combine = java.compile
java.please_combine = true -- not just a hint!
java.link = 'jar -cfm $(TARGET) $(LIBS) $(DEPENDS)'
lake.add_group(java)
lake.add_prog(java)
lake.add_shared(java)
function java:flags_handler(args,compile)
if compile then
local flags=''
if args.classpath then
libs = lake.deps_arg(args.classpath)
if libs[1] ~= '.' then table.insert(libs,1,'.') end
flags = '-classpath "'..table.concat(libs,';')..'"'
end
if args.version_source then
flags = flags..' -source '..args.version_source
end
if args.version_target then
flags = flags..' -target '..args.version_target
end
return flags
else
local klass = args.entry or 'Main'
if args.package then
klass = args.package..'.'..klass
end
local tmp = file.temp()
file.write(tmp,'Main-Class: '..klass..'\n')
return tmp
end
end
function java:args_handler(args)
if args.package then
args.src = args.package:gsub('%.','/')..'/*'
end
if args.cdir and not args.classpath then
args.classpath = args.cdir
end
if not args.src then
args.entry = args.name
end
end
lake.add_program_option 'classpath version_source version_target package entry'
function java.javah (name,classpath,entry)
return target(name,classpath,function(t)
if not path.exists(t.target) then
utils.shell('javah -o %s -classpath "%s" %s',t.target,t.deps[1],entry)
end
end)
end
lake.define_need('java',function()
JPLAT = WINDOWS and 'win32' or 'linux'
return {
incdir = '$(JDK)/include, $(JDK)/include/$(JPLAT)'
}
end)
java.runner = function(prog,args)
local flags = ''
if path.extension_of(prog) == '.jar' then
flags = '-jar '
end
exec('java '..flags..prog..' '..args)
end
|
if not modules then modules = { } end modules ['scrp-cjk'] = {
version = 1.001,
comment = "companion to scrp-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
-- We can speed this up by preallocating nodes and copying them but the
-- gain is not that large.
-- The input line endings: there is no way to distinguish between
-- inline spaces and endofline turned into spaces (would not make
-- sense either because otherwise a wanted space at the end of a
-- line would have to be a hard coded ones.
local nuts = nodes.nuts
local tonut = nodes.tonut
local tonode = nodes.tonode
local insert_node_after = nuts.insert_after
local insert_node_before = nuts.insert_before
local copy_node = nuts.copy
local remove_node = nuts.remove
local traverse_id = nuts.traverse_id
local getnext = nuts.getnext
local getprev = nuts.getprev
local getfont = nuts.getfont
local getchar = nuts.getchar
local getid = nuts.getid
local getattr = nuts.getattr
local getsubtype = nuts.getsubtype
local getfield = nuts.getfield
local setchar = nuts.setchar
local nodepool = nuts.pool
local new_glue = nodepool.glue
local new_kern = nodepool.kern
local new_penalty = nodepool.penalty
local nodecodes = nodes.nodecodes
local skipcodes = nodes.skipcodes
local glyph_code = nodecodes.glyph
local glue_code = nodecodes.glue
local userskip_code = skipcodes.userskip
local spaceskip_code = skipcodes.spaceskip
local xspaceskip_code = skipcodes.xspaceskip
local a_scriptstatus = attributes.private('scriptstatus')
local a_scriptinjection = attributes.private('scriptinjection')
local categorytonumber = scripts.categorytonumber
local numbertocategory = scripts.numbertocategory
local hash = scripts.hash
local numbertodataset = scripts.numbertodataset
local fonthashes = fonts.hashes
local quaddata = fonthashes.quads
local spacedata = fonthashes.spaces
local decomposed = characters.hangul.decomposed
local trace_details = false trackers.register("scripts.details", function(v) trace_details = v end)
local report_details = logs.reporter("scripts","detail")
-- raggedleft is controlled by leftskip and we might end up with a situation where
-- the intercharacter spacing interferes with this; the solution is to patch the
-- nodelist but better is to use veryraggedleft
local inter_char_shrink = 0
local inter_char_stretch = 0
local inter_char_half_shrink = 0
local inter_char_half_stretch = 0
local inter_char_quarter_shrink = 0
local inter_char_quarter_stretch = 0
local full_char_width = 0
local half_char_width = 0
local quarter_char_width = 0
local inter_char_hangul_penalty = 0
local function set_parameters(font,data)
-- beware: parameters can be nil in e.g. punk variants
local quad = quaddata[font]
full_char_width = quad
half_char_width = quad/2
quarter_char_width = quad/4
inter_char_shrink = data.inter_char_shrink_factor * quad
inter_char_stretch = data.inter_char_stretch_factor * quad
inter_char_half_shrink = data.inter_char_half_shrink_factor * quad
inter_char_half_stretch = data.inter_char_half_stretch_factor * quad
inter_char_quarter_shrink = data.inter_char_quarter_shrink_factor * quad
inter_char_quarter_stretch = data.inter_char_quarter_stretch_factor * quad
inter_char_hangul_penalty = data.inter_char_hangul_penalty
end
-- a test version did compensate for crappy halfwidth but we can best do that
-- at font definition time and/or just assume a correct font
local function trace_detail(current,what)
local prev = getprev(current)
local c_id = getid(current)
local p_id = prev and getid(prev)
if c_id == glyph_code then
local c_ch = getchar(current)
if p_id == glyph_code then
local p_ch = p_id and getchar(prev)
report_details("[%C %a] [%s] [%C %a]",p_ch,hash[p_ch],what,c_ch,hash[c_ch])
else
report_details("[%s] [%C %a]",what,c_ch,hash[c_ch])
end
else
if p_id == glyph_code then
local p_ch = p_id and getchar(prev)
report_details("[%C %a] [%s]",p_ch,hash[p_ch],what)
else
report_details("[%s]",what)
end
end
end
local function trace_detail_between(p,n,what)
local p_ch = getchar(p)
local n_ch = getchar(n)
report_details("[%C %a] [%s] [%C %a]",p_ch,hash[p_ch],what,n_ch,hash[n_ch])
end
local function nobreak(head,current)
if trace_details then
trace_detail(current,"break")
end
insert_node_before(head,current,new_penalty(10000))
end
local function stretch_break(head,current)
if trace_details then
trace_detail(current,"stretch break")
end
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
end
local function shrink_break(head,current)
if trace_details then
trace_detail(current,"shrink break")
end
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_stretch(head,current)
if trace_details then
trace_detail(current,"no break stretch")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
end
local function korean_break(head,current)
if trace_details then
trace_detail(current,"korean break")
end
insert_node_before(head,current,new_penalty(inter_char_hangul_penalty))
end
local function nobreak_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak shrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_stretch_nobreak_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak stretch nobreak shrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_stretch_nobreak_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak stretch nobreak autoshrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_shrink_nobreak_stretch(head,current)
if trace_details then
trace_detail(current,"nobreak shrink nobreak stretch")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_autoshrink_nobreak_stretch(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink nobreak stretch")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_shrink_break_stretch(head,current)
if trace_details then
trace_detail(current,"nobreak shrink break stretch")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_autoshrink_break_stretch(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink break stretch")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_shrink_break_stretch_nobreak_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak shrink break stretch nobreak shrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
end
local function japanese_between_full_close_open(head,current) -- todo: check width
if trace_details then
trace_detail(current,"japanese between full close open")
end
insert_node_before(head,current,new_kern(-half_char_width))
insert_node_before(head,current,new_glue(half_char_width,0,inter_char_half_shrink))
insert_node_before(head,current,new_kern(-half_char_width))
end
local function japanese_between_full_close_full_close(head,current) -- todo: check width
if trace_details then
trace_detail(current,"japanese between full close full close")
end
insert_node_before(head,current,new_kern(-half_char_width))
-- insert_node_before(head,current,new_glue(half_char_width,0,inter_char_half_shrink))
end
local function japanese_before_full_width_punct(head,current) -- todo: check width
if trace_details then
trace_detail(current,"japanese before full width punct")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(quarter_char_width,0,inter_char_quarter_shrink))
insert_node_before(head,current,new_kern(-quarter_char_width))
end
local function japanese_after_full_width_punct(head,current) -- todo: check width
if trace_details then
trace_detail(current,"japanese after full width punct")
end
insert_node_before(head,current,new_kern(-quarter_char_width))
insert_node_before(head,current,new_glue(quarter_char_width,0,inter_char_quarter_shrink))
end
local function nobreak_autoshrink_break_stretch_nobreak_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink break stretch nobreak autoshrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_autoshrink_break_stretch_nobreak_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink break stretch nobreak shrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_shrink_break_stretch_nobreak_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak shrink break stretch nobreak autoshrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_stretch_break_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak stretch break shrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_stretch_break_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak stretch break autoshrink")
end
insert_node_before(head,current,new_penalty(10000))
insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
end
-- Korean: hangul
local korean_0 = {
}
local korean_1 = {
jamo_initial = korean_break,
korean = korean_break,
chinese = korean_break,
hiragana = korean_break,
katakana = korean_break,
half_width_open = stretch_break,
half_width_close = nobreak,
full_width_open = stretch_break,
full_width_close = nobreak,
full_width_punct = nobreak,
-- hyphen = nil,
non_starter = korean_break,
other = korean_break,
}
local korean_2 = {
jamo_initial = stretch_break,
korean = stretch_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = stretch_break,
half_width_close = nobreak,
full_width_open = stretch_break,
full_width_close = nobreak,
full_width_punct = nobreak,
-- hyphen = nil,
non_starter = stretch_break,
other = stretch_break,
}
local korean_3 = {
jamo_initial = stretch_break,
korean = stretch_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = stretch_break,
half_width_close = nobreak,
full_width_open = stretch_break,
full_width_close = nobreak,
full_width_punct = nobreak,
-- hyphen = nil,
non_starter = nobreak,
other = nobreak,
}
local korean_4 = {
jamo_initial = nobreak,
korean = nobreak,
chinese = nobreak,
hiragana = nobreak,
katakana = nobreak,
half_width_open = nobreak,
half_width_close = nobreak,
full_width_open = nobreak,
full_width_close = nobreak,
full_width_punct = nobreak,
hyphen = nobreak,
non_starter = nobreak,
other = nobreak,
}
local korean_5 = {
jamo_initial = stretch_break,
korean = stretch_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = stretch_break,
half_width_close = nobreak_stretch,
full_width_open = stretch_break,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
hyphen = nobreak_stretch,
non_starter = nobreak_stretch,
other = stretch_break,
}
local injectors = { -- [previous] [current]
jamo_final = korean_1,
korean = korean_1,
chinese = korean_1,
hiragana = korean_1,
katakana = korean_1,
hyphen = korean_2,
start = korean_0,
other = korean_2,
non_starter = korean_3,
full_width_open = korean_4,
half_width_open = korean_4,
full_width_close = korean_5,
full_width_punct = korean_5,
half_width_close = korean_5,
}
local function process(head,first,last)
if first ~= last then
local lastfont, previous, last = nil, "start", nil
while true do
local upcoming, id = getnext(first), getid(first)
if id == glyph_code then
local a = getattr(first,a_scriptstatus)
local current = numbertocategory[a]
local action = injectors[previous]
if action then
action = action[current]
if action then
local font = getfont(first)
if font ~= lastfont then
lastfont = font
set_parameters(font,numbertodataset[getattr(first,a_scriptinjection)])
end
action(head,first)
end
end
previous = current
else -- glue
local p, n = getprev(first), upcoming
if p and n then
local pid, nid = getid(p), getid(n)
if pid == glyph_code and nid == glyph_code then
local pa, na = getattr(p,a_scriptstatus), getattr(n,a_scriptstatus)
local pcjk, ncjk = pa and numbertocategory[pa], na and numbertocategory[na]
if not pcjk or not ncjk
or pcjk == "korean" or ncjk == "korean"
or pcjk == "other" or ncjk == "other"
or pcjk == "jamo_final" or ncjk == "jamo_initial" then
previous = "start"
else -- if head ~= first then
remove_node(head,first,true)
previous = pcjk
-- else
-- previous = pcjk
end
else
previous = "start"
end
else
previous = "start"
end
end
if upcoming == last then -- was stop
break
else
first = upcoming
end
end
end
end
scripts.installmethod {
name = "hangul",
injector = process,
datasets = { -- todo: metatables
default = {
inter_char_shrink_factor = 0.50, -- of quad
inter_char_stretch_factor = 0.50, -- of quad
inter_char_half_shrink_factor = 0.50, -- of quad
inter_char_half_stretch_factor = 0.50, -- of quad
inter_char_quarter_shrink_factor = 0.50, -- of quad
inter_char_quarter_stretch_factor = 0.50, -- of quad
inter_char_hangul_penalty = 50,
},
},
}
function scripts.decomposehangul(head)
local head = tonut(head)
local done = false
for current in traverse_id(glyph_code,head) do
local lead_consonant, medial_vowel, tail_consonant = decomposed(getchar(current))
if lead_consonant then
setchar(current,lead_consonant)
local m = copy_node(current)
setchar(m,medial_vowel)
head, current = insert_node_after(head,current,m)
if tail_consonant then
local t = copy_node(current)
setchar(t,tail_consonant)
head, current = insert_node_after(head,current,t)
end
done = true
end
end
return tonode(head), done
end
-- nodes.tasks.prependaction("processors","normalizers","scripts.decomposehangul")
local otffeatures = fonts.constructors.features.otf
local registerotffeature = otffeatures.register
registerotffeature {
name = "decomposehangul",
description = "decompose hangul",
processors = {
position = 1,
node = scripts.decomposehangul,
}
}
-- Chinese: hanzi
local chinese_0 = {
}
local chinese_1 = {
jamo_initial = korean_break,
korean = korean_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
-- hyphen = nil,
non_starter = nobreak_stretch,
other = stretch_break,
}
local chinese_2 = {
jamo_initial = korean_break,
korean = stretch_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
hyphen = nobreak_stretch,
non_starter = nobreak_stretch,
other = stretch_break,
}
local chinese_3 = {
jamo_initial = korean_break,
korean = stretch_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
-- hyphen = nil,
non_starter = nobreak_stretch,
other = stretch_break,
}
local chinese_4 = {
-- jamo_initial = nil,
-- korean = nil,
-- chinese = nil,
-- hiragana = nil,
-- katakana = nil,
half_width_open = nobreak_autoshrink,
half_width_close = nil,
full_width_open = nobreak_shrink,
full_width_close = nobreak,
full_width_punct = nobreak,
-- hyphen = nil,
non_starter = nobreak,
-- other = nil,
}
local chinese_5 = {
jamo_initial = stretch_break,
korean = stretch_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
-- hyphen = nil,
non_starter = nobreak_stretch,
other = stretch_break,
}
local chinese_6 = {
jamo_initial = nobreak_stretch,
korean = nobreak_stretch,
chinese = nobreak_stretch,
hiragana = nobreak_stretch,
katakana = nobreak_stretch,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
hyphen = nobreak_stretch,
non_starter = nobreak_stretch,
other = nobreak_stretch,
}
local chinese_7 = {
jami_initial = nobreak_shrink_break_stretch,
korean = nobreak_shrink_break_stretch,
chinese = stretch_break, -- nobreak_shrink_break_stretch,
hiragana = stretch_break, -- nobreak_shrink_break_stretch,
katakana = stretch_break, -- nobreak_shrink_break_stretch,
half_width_open = nobreak_shrink_break_stretch_nobreak_autoshrink,
half_width_close = nobreak_shrink_nobreak_stretch,
full_width_open = nobreak_shrink_break_stretch_nobreak_shrink,
full_width_close = nobreak_shrink_nobreak_stretch,
full_width_punct = nobreak_shrink_nobreak_stretch,
hyphen = nobreak_shrink_break_stretch,
non_starter = nobreak_shrink_break_stretch,
other = nobreak_shrink_break_stretch,
}
local chinese_8 = {
jami_initial = nobreak_shrink_break_stretch,
korean = nobreak_autoshrink_break_stretch,
chinese = stretch_break, -- nobreak_autoshrink_break_stretch,
hiragana = stretch_break, -- nobreak_autoshrink_break_stretch,
katakana = stretch_break, -- nobreak_autoshrink_break_stretch,
half_width_open = nobreak_autoshrink_break_stretch_nobreak_autoshrink,
half_width_close = nobreak_autoshrink_nobreak_stretch,
full_width_open = nobreak_autoshrink_break_stretch_nobreak_shrink,
full_width_close = nobreak_autoshrink_nobreak_stretch,
full_width_punct = nobreak_autoshrink_nobreak_stretch,
hyphen = nobreak_autoshrink_break_stretch,
non_starter = nobreak_autoshrink_break_stretch,
other = nobreak_autoshrink_break_stretch,
}
local injectors = { -- [previous] [current]
jamo_final = chinese_1,
korean = chinese_1,
chinese = chinese_2,
hiragana = chinese_2,
katakana = chinese_2,
hyphen = chinese_3,
start = chinese_4,
other = chinese_5,
non_starter = chinese_5,
full_width_open = chinese_6,
half_width_open = chinese_6,
full_width_close = chinese_7,
full_width_punct = chinese_7,
half_width_close = chinese_8,
}
local function process(head,first,last)
if first ~= last then
local lastfont, previous, last = nil, "start", nil
while true do
local upcoming, id = getnext(first), getid(first)
if id == glyph_code then
local a = getattr(first,a_scriptstatus)
local current = numbertocategory[a]
local action = injectors[previous]
if action then
action = action[current]
if action then
local font = getfont(first)
if font ~= lastfont then
lastfont = font
set_parameters(font,numbertodataset[getattr(first,a_scriptinjection)])
end
action(head,first)
end
end
previous = current
else -- glue
local p, n = getprev(first), upcoming
if p and n then
local pid, nid = getid(p), getid(n)
if pid == glyph_code and nid == glyph_code then
local pa, na = getattr(p,a_scriptstatus), getattr(n,a_scriptstatus)
local pcjk, ncjk = pa and numbertocategory[pa], na and numbertocategory[na]
if not pcjk or not ncjk
or pcjk == "korean" or ncjk == "korean"
or pcjk == "other" or ncjk == "other"
or pcjk == "jamo_final" or ncjk == "jamo_initial"
or pcjk == "half_width_close" or ncjk == "half_width_open" then -- extra compared to korean
previous = "start"
else -- if head ~= first then
remove_node(head,first,true)
previous = pcjk
-- else
-- previous = pcjk
end
else
previous = "start"
end
else
previous = "start"
end
end
if upcoming == last then -- was stop
break
else
first = upcoming
end
end
end
end
scripts.installmethod {
name = "hanzi",
injector = process,
datasets = {
default = {
inter_char_shrink_factor = 0.50, -- of quad
inter_char_stretch_factor = 0.50, -- of quad
inter_char_half_shrink_factor = 0.50, -- of quad
inter_char_half_stretch_factor = 0.50, -- of quad
inter_char_quarter_shrink_factor = 0.50, -- of quad
inter_char_quarter_stretch_factor = 0.50, -- of quad
inter_char_hangul_penalty = 50,
},
},
}
-- Japanese: idiographic, hiragana, katakana, romanji / jis
local japanese_0 = {
}
local japanese_1 = {
jamo_initial = korean_break,
korean = korean_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
-- hyphen = nil,
non_starter = nobreak_stretch,
other = stretch_break,
}
local japanese_2 = {
jamo_initial = korean_break,
korean = stretch_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = japanese_before_full_width_punct, -- nobreak_stretch,
hyphen = nobreak_stretch,
non_starter = nobreak_stretch,
other = stretch_break,
}
local japanese_3 = {
jamo_initial = korean_break,
korean = stretch_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
-- hyphen = nil,
non_starter = nobreak_stretch,
other = stretch_break,
}
local japanese_4 = {
-- jamo_initial = nil,
-- korean = nil,
-- chinese = nil,
-- hiragana = nil,
-- katakana = nil,
half_width_open = nobreak_autoshrink,
half_width_close = nil,
full_width_open = nobreak_shrink,
full_width_close = nobreak,
full_width_punct = nobreak,
-- hyphen = nil,
non_starter = nobreak,
-- other = nil,
}
local japanese_5 = {
jamo_initial = stretch_break,
korean = stretch_break,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
-- hyphen = nil,
non_starter = nobreak_stretch,
other = stretch_break,
}
local japanese_6 = {
jamo_initial = nobreak_stretch,
korean = nobreak_stretch,
chinese = nobreak_stretch,
hiragana = nobreak_stretch,
katakana = nobreak_stretch,
half_width_open = nobreak_stretch_break_autoshrink,
half_width_close = nobreak_stretch,
full_width_open = nobreak_stretch_break_shrink,
full_width_close = nobreak_stretch,
full_width_punct = nobreak_stretch,
hyphen = nobreak_stretch,
non_starter = nobreak_stretch,
other = nobreak_stretch,
}
local japanese_7 = {
jami_initial = nobreak_shrink_break_stretch,
korean = nobreak_shrink_break_stretch,
chinese = japanese_after_full_width_punct, -- stretch_break
hiragana = japanese_after_full_width_punct, -- stretch_break
katakana = japanese_after_full_width_punct, -- stretch_break
half_width_open = nobreak_shrink_break_stretch_nobreak_autoshrink,
half_width_close = nobreak_shrink_nobreak_stretch,
full_width_open = japanese_between_full_close_open, -- !!
full_width_close = japanese_between_full_close_full_close, -- nobreak_shrink_nobreak_stretch,
full_width_punct = nobreak_shrink_nobreak_stretch,
hyphen = nobreak_shrink_break_stretch,
non_starter = nobreak_shrink_break_stretch,
other = nobreak_shrink_break_stretch,
}
local japanese_8 = {
jami_initial = nobreak_shrink_break_stretch,
korean = nobreak_autoshrink_break_stretch,
chinese = stretch_break,
hiragana = stretch_break,
katakana = stretch_break,
half_width_open = nobreak_autoshrink_break_stretch_nobreak_autoshrink,
half_width_close = nobreak_autoshrink_nobreak_stretch,
full_width_open = nobreak_autoshrink_break_stretch_nobreak_shrink,
full_width_close = nobreak_autoshrink_nobreak_stretch,
full_width_punct = nobreak_autoshrink_nobreak_stretch,
hyphen = nobreak_autoshrink_break_stretch,
non_starter = nobreak_autoshrink_break_stretch,
other = nobreak_autoshrink_break_stretch,
}
local injectors = { -- [previous] [current]
jamo_final = japanese_1,
korean = japanese_1,
chinese = japanese_2,
hiragana = japanese_2,
katakana = japanese_2,
hyphen = japanese_3,
start = japanese_4,
other = japanese_5,
non_starter = japanese_5,
full_width_open = japanese_6,
half_width_open = japanese_6,
full_width_close = japanese_7,
full_width_punct = japanese_7,
half_width_close = japanese_8,
}
local function process(head,first,last)
if first ~= last then
local lastfont, previous, last = nil, "start", nil
while true do
local upcoming, id = getnext(first), getid(first)
if id == glyph_code then
local a = getattr(first,a_scriptstatus)
local current = numbertocategory[a]
local action = injectors[previous]
if action then
action = action[current]
if action then
local font = getfont(first)
if font ~= lastfont then
lastfont = font
set_parameters(font,numbertodataset[getattr(first,a_scriptinjection)])
end
action(head,first)
end
end
previous = current
-- elseif id == math_code then
-- upcoming = getnext(end_of_math(current))
-- previous = "start"
else -- glue
local p, n = getprev(first), upcoming -- we should remember prev
if p and n then
local pid, nid = getid(p), getid(n)
if pid == glyph_code and nid == glyph_code then
local pa, na = getattr(p,a_scriptstatus), getattr(n,a_scriptstatus)
local pcjk, ncjk = pa and numbertocategory[pa], na and numbertocategory[na]
if not pcjk or not ncjk
or pcjk == "korean" or ncjk == "korean"
or pcjk == "other" or ncjk == "other"
or pcjk == "jamo_final" or ncjk == "jamo_initial"
or pcjk == "half_width_close" or ncjk == "half_width_open" then -- extra compared to korean
previous = "start"
else -- if head ~= first then
if id == glue_code then
-- also scriptstatus check?
local subtype = getsubtype(first)
if subtype == userskip_code or subtype == spaceskip_code or subtype == xspaceskip_code then
-- for the moment no distinction possible between space and userskip
local w = getfield(first,"width")
local s = spacedata[getfont(p)]
if w == s then -- could be option
if trace_details then
trace_detail_between(p,n,"space removed")
end
remove_node(head,first,true)
end
end
end
previous = pcjk
-- else
-- previous = pcjk
end
else
previous = "start"
end
else
previous = "start"
end
end
if upcoming == last then -- was stop
break
else
first = upcoming
end
end
end
end
scripts.installmethod {
name = "nihongo", -- what name to use?
injector = process,
datasets = {
default = {
inter_char_shrink_factor = 0.50, -- of quad
inter_char_stretch_factor = 0.50, -- of quad
inter_char_half_shrink_factor = 0.50, -- of quad
inter_char_half_stretch_factor = 0.50, -- of quad
inter_char_quarter_shrink_factor = 0.25, -- of quad
inter_char_quarter_stretch_factor = 0.25, -- of quad
inter_char_hangul_penalty = 50,
},
},
}
|
package.path = package.path..";"..RL_GetBasePath().."../resources/lib/?.lua"
util = require "utillib"
Vec2 = require "vector2"
Vec3 = require "vector3"
local MOVE_SPEED = 0.5
local monitor = 0
local camera = -1
local texture = -1
local tri = {
a = Vec3:new( 0, 0, 0 ),
-- a = Vec3:new( 0, 1, 0 ),
b = Vec3:new( 0, 0, 2 ),
c = Vec3:new( 1, 0, 0 ),
normal = Vec3:new( 0, 0, 0 ),
}
local point = {
pos = Vec3:new( 0.2, 0.3, 0.2 ),
radius = 0.05,
lineLen = 0.5,
color = RED,
}
local debugText = ""
local function calcNormal( tri )
tri.normal = Vec3:new( RL_Vector3Normalize( RL_Vector3CrossProduct( tri.b - tri.a, tri.c - tri.a ) ) )
end
function init()
local mPos = RL_GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor )
local winSize = { 1920, 1080 }
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowSize( winSize )
camera = RL_CreateCamera3D()
RL_SetCamera3DPosition( camera, { 0, 1, 2 } )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 2, 0 } )
RL_SetCamera3DMode( camera, CAMERA_FREE )
calcNormal( tri )
end
local function checkCollisionPointTriangle( p, a, b, c, n )
local result = Vec3:new( 0, 0, 0 )
local v0 = Vec3:new( b.x - a.x, b.y - a.y, b.z - a.z ) -- Vector3Subtract( b, a )
local v1 = Vec3:new( c.x - a.x, c.y - a.y, c.z - a.z ) -- Vector3Subtract( c, a )
local v2 = Vec3:new( p.x - a.x, p.y - a.y, p.z - a.z ) -- Vector3Subtract( p, a )
local d00 = v0.x * v0.x + v0.y * v0.y + v0.z * v0.z -- Vector3DotProduct( v0, v0 )
local d01 = v0.x * v1.x + v0.y * v1.y + v0.z * v1.z -- Vector3DotProduct( v0, v1 )
local d11 = v1.x * v1.x + v1.y * v1.y + v1.z * v1.z -- Vector3DotProduct( v1, v1 )
local d20 = v2.x * v0.x + v2.y * v0.y + v2.z * v0.z -- Vector3DotProduct( v2, v0 )
local d21 = v2.x * v1.x + v2.y * v1.y + v2.z * v1.z -- Vector3DotProduct( v2, v1 )
local denom = d00 * d11 - d01 * d01
local distance = v2.x * n.x + v2.y * n.y + v2.z * n.z -- Vector3DotProduct( v2, n )
debugText = debugText.."distance "..distance.."\n"
debugText = debugText.."v0 "..v0.x..", "..v0.y..", "..v0.z.."\n"
debugText = debugText.."v1 "..v1.x..", "..v1.y..", "..v1.z.."\n"
debugText = debugText.."v2 "..v2.x..", "..v2.y..", "..v2.z.."\n"
result.y = ( d11 * d20 - d01 * d21) / denom
result.z = ( d00 * d21 - d01 * d20) / denom
result.x = 1.0 - ( result.z + result.y )
debugText = debugText.."result "..result.x..", "..result.y..", "..result.z.."\n"
return 0.0 < result.x and 0.0 < result.y and 0.0 < result.z and distance < 0.0, distance
end
function process( delta )
debugText = ""
if RL_IsKeyDown( string.byte( "D" ) ) then
point.pos.x = point.pos.x + MOVE_SPEED * delta
elseif RL_IsKeyDown( string.byte( "A" ) ) then
point.pos.x = point.pos.x - MOVE_SPEED * delta
end
if RL_IsKeyDown( string.byte( "S" ) ) then
point.pos.z = point.pos.z + MOVE_SPEED * delta
elseif RL_IsKeyDown( string.byte( "W" ) ) then
point.pos.z = point.pos.z - MOVE_SPEED * delta
end
if RL_IsKeyDown( string.byte( "R" ) ) then
point.pos.y = point.pos.y + MOVE_SPEED * delta
elseif RL_IsKeyDown( string.byte( "F" ) ) then
point.pos.y = point.pos.y - MOVE_SPEED * delta
end
if checkCollisionPointTriangle( point.pos, tri.a, tri.b, tri.c, tri.normal ) then
point.color = RED
else
point.color = GREEN
end
end
function draw()
RL_ClearBackground( { 100, 150, 100 } )
RL_UpdateCamera3D( camera )
RL_BeginMode3D( camera )
RL_DrawGrid( 8, 1 )
RL_DrawTriangle3D( tri.a, tri.b, tri.c, { 200, 100, 100 } )
RL_DrawLine3D( { point.pos.x - point.lineLen, point.pos.y, point.pos.z },
{ point.pos.x + point.lineLen, point.pos.y, point.pos.z }, BLUE )
RL_DrawLine3D( { point.pos.x, point.pos.y - point.lineLen, point.pos.z },
{ point.pos.x, point.pos.y + point.lineLen, point.pos.z }, BLUE )
RL_DrawLine3D( { point.pos.x, point.pos.y, point.pos.z - point.lineLen },
{ point.pos.x, point.pos.y, point.pos.z + point.lineLen }, BLUE )
RL_DrawSphereWires( point.pos, point.radius, 3, 8, point.color )
RL_EndMode3D()
RL_DrawText( 0, debugText, { 10, 10 }, 30, 4, WHITE )
end
|
function list_pop()
local l = redis.call('LRANGE', KEYS[1], 0, -1)
local i = tonumber(ARGV[1]) + 1
local v = table.remove(l, i)
redis.call('DEL', KEYS[1])
redis.call('RPUSH', KEYS[1], unpack(l))
return v
end
function list_insert()
local l = redis.call('LRANGE', KEYS[1], 0, -1)
local i = tonumber(ARGV[1]) + 1
table.insert(l, i, ARGV[2])
redis.call('DEL', KEYS[1])
redis.call('RPUSH', KEYS[1], unpack(l))
end
function list_reverse()
local l = redis.call('LRANGE', KEYS[1], 0, -1)
redis.call('DEL', KEYS[1])
redis.call('LPUSH', KEYS[1], unpack(l))
end
function list_multiply()
local l = redis.call('LRANGE', KEYS[1], 0, -1)
redis.call('DEL', KEYS[1])
if l[1] then
local i = tonumber(ARGV[1])
while i > 0 do
i = i - 1
redis.call('RPUSH', KEYS[1], unpack(l))
end
end
end
function set_intersection_update()
local temp_key = KEYS[1] .. 'set_intersection_update'
redis.call('SADD', temp_key, unpack(ARGV))
redis.call('SINTERSTORE', KEYS[1], KEYS[1], temp_key)
redis.call('DEL', temp_key)
end
function set_difference_update()
local temp_key = KEYS[1] .. 'set_difference_update'
local delimiter = table.remove(ARGV, 1)
for _, v in pairs(ARGV) do
if v ~= delimiter then
redis.call('SADD', temp_key, v)
else
redis.call('SDIFFSTORE', KEYS[1], KEYS[1], temp_key)
redis.call('DEL', temp_key)
end
end
end
function set_symmetric_difference()
local action = table.remove(ARGV, 1)
local other_key = ARGV[1]
local temp_key1 = KEYS[1] .. 'set_symmetric_difference_temp1'
local temp_key2 = KEYS[1] .. 'set_symmetric_difference_temp2'
local result = nil
if action == 'create' then
other_key = KEYS[1] .. 'set_symmetric_difference_create'
redis.call('SADD', other_key, unpack(ARGV))
end
redis.call('SDIFFSTORE', temp_key1, KEYS[1], other_key)
redis.call('SDIFFSTORE', temp_key2, other_key, KEYS[1])
if action == 'update' then
redis.call('SUNIONSTORE', KEYS[1], temp_key1, temp_key2)
else
result = redis.call('SUNION', temp_key1, temp_key2)
if action == 'create' then
redis.call('DEL', other_key)
end
end
redis.call('DEL', temp_key1)
redis.call('DEL', temp_key2)
return result
end
function string_multiply()
local s = redis.call('GET', KEYS[1])
redis.call('SET', KEYS[1], string.rep(s, tonumber(ARGV[1])))
end
function string_setitem()
local s = redis.call('GET', KEYS[1])
local start = tonumber(ARGV[1])
local stop = tonumber(ARGV[2])
s = string.sub(s, 1, start) .. ARGV[3] .. string.sub(s, stop + 1)
redis.call('SET', KEYS[1], s)
end
function number_multiply()
local n = tonumber(redis.call('GET', KEYS[1])) * tonumber(ARGV[1])
redis.call('SET', KEYS[1], n)
end
function number_divide()
local n = tonumber(redis.call('GET', KEYS[1])) / tonumber(ARGV[1])
redis.call('SET', KEYS[1], n)
end
function number_floordiv()
local n = math.floor(tonumber(redis.call('GET', KEYS[1])) / tonumber(ARGV[1]))
redis.call('SET', KEYS[1], n)
end
function number_mod()
local n = tonumber(redis.call('GET', KEYS[1])) % tonumber(ARGV[1])
redis.call('SET', KEYS[1], n)
end
function number_pow()
local n = tonumber(redis.call('GET', KEYS[1])) ^ tonumber(ARGV[1])
redis.call('SET', KEYS[1], n)
end
function number_and()
local n = bit_and(tonumber(redis.call('GET', KEYS[1])), tonumber(ARGV[1]))
redis.call('SET', KEYS[1], n)
end
function number_or()
local n = bit_or(tonumber(redis.call('GET', KEYS[1])), tonumber(ARGV[1]))
redis.call('SET', KEYS[1], n)
end
function number_xor()
local n = bit_xor(tonumber(redis.call('GET', KEYS[1])), tonumber(ARGV[1]))
redis.call('SET', KEYS[1], n)
end
function number_lshift()
local n = bit_lshift(tonumber(redis.call('GET', KEYS[1])), tonumber(ARGV[1]))
redis.call('SET', KEYS[1], n)
end
function number_rshift()
local n = bit_rshift(tonumber(redis.call('GET', KEYS[1])), tonumber(ARGV[1]))
redis.call('SET', KEYS[1], n)
end
function queue_put()
local size = redis.call('LLEN', KEYS[1])
local maxsize = tonumber(ARGV[2])
if size >= maxsize then
return 0
end
redis.call('RPUSH', KEYS[1], ARGV[1])
return 1
end
function multiset_intersection_update()
local reversed = {}
for i = 1, #ARGV, 2 do
reversed[i] = ARGV[i + 1]
reversed[i + 1] = ARGV[i]
end
redis.call('ZADD', KEYS[1] .. "__tmp", unpack(reversed))
redis.call('ZINTERSTORE', KEYS[1], 2, KEYS[1], KEYS[1] .. "__tmp", "AGGREGATE", "MIN")
redis.call('DEL', KEYS[1] .. "__tmp")
end
function multiset_union_update()
for i = 1, #ARGV, 2 do
local current = tonumber(redis.call('ZSCORE', KEYS[1], ARGV[i]))
local new = tonumber(ARGV[i + 1])
if new > 0 and (not current or new > current) then
redis.call('ZADD', KEYS[1], new, ARGV[i])
end
end
end
|
local star = "★"
local diceValues = { 1, 2, 3, 4, 5, star }
local function addAllDices (amount, board)
for k, v in pairs(diceValues) do
if (v ~= star) then
state = { amount = amount, value = v, index = #board + 1 }
table.insert(board, state)
end
end
end
local function createBoard ()
board = {}
addAllDices(1, board)
normalCount = 2
starCount = 1
for i = 1,10 do
table.insert(board, { amount = starCount, value = star, index = #board + 1 })
starCount = starCount + 1
addAllDices(normalCount, board)
normalCount = normalCount + 1
addAllDices(normalCount, board)
normalCount = normalCount + 1
end
return board;
end
return {
star = star,
diceValues = diceValues,
board = createBoard()
} |
-- Advisor default log verbosities and categories. Do NOT edit these.
-- Feel free to add your own in another file, or below these ones. They MUST be globals to work efficiently.
LogNone = Advisor.Log.RegisterLogLevel( LogVerbosity(-1, "None", Color(255, 255, 255)) )
LogVeryVerbose = Advisor.Log.RegisterLogLevel( LogVerbosity(0, "VeryVerbose", Color(0, 170, 255)) )
LogVerbose = Advisor.Log.RegisterLogLevel( LogVerbosity(1, "Verbose", Color(0, 213, 255)) )
LogDebug = Advisor.Log.RegisterLogLevel( LogVerbosity(2, "Debug", Color(0, 255, 255)) )
LogInfo = Advisor.Log.RegisterLogLevel( LogVerbosity(100, "Info", Color(255, 255, 255)) )
LogWarning = Advisor.Log.RegisterLogLevel( LogVerbosity(999, "Warning", Color(255, 187, 0)) )
LogError = Advisor.Log.RegisterLogLevel( LogVerbosity(999, "Error", Color(255, 90, 90)) )
-- Categories. Same as above, feel free to add your own either under this or as globals elsewhere.
-- Order is category name, and default verbosity
LogConfig = Advisor.Log.RegisterLogCategory( LogCategory("Config", LogInfo) )
LogCommands = Advisor.Log.RegisterLogCategory( LogCategory("Commands", LogInfo) )
LogAdvisor = Advisor.Log.RegisterLogCategory( LogCategory("Advisor", LogInfo) )
LogLocalization = Advisor.Log.RegisterLogCategory( LogCategory("Localization", LogInfo) )
LogNet = Advisor.Log.RegisterLogCategory( LogCategory("Net", LogInfo) )
LogUtils = Advisor.Log.RegisterLogCategory( LogCategory("Utils", LogInfo) )
LogUI = Advisor.Log.RegisterLogCategory( LogCategory("UI", LogInfo) )
LogSQL = Advisor.Log.RegisterLogCategory( LogCategory("SQL", LogInfo) )
Advisor.Log.CurrentVerbosity = LogInfo |
return {'faun','fauna','faunabeheer','faunabeheerder','faunavervalsing','faunawet','faustiaans','fauteuil','fauvisme','fauvist','fauvistisch','faunabeheerplan','faunabeheereenheid','faunafonds','faust','fausto','faunapassages','faunen','fauntje','fauntjes','fauteuils','fauteuiltje','fauteuiltjes','faunas','faustiaanse','fauvisten','fauvistische','faustos','faunabeheereenheden','faunabeheerplannen','faunabeheerders'} |
local Moon = require('moonscript.base')
local Stack = require('stack')
local Fuzzy = require('fuzzy')
local Version = {
name = 'terminalove',
number = '1.0.0'
}
local terminal = nil
local sandbox = nil
local blink = 1
local lasttime = 0
local verbose = false
local redraw = false
local canvas = nil
local selection = {
start = -1,
["end"] = -1,
set = false
}
local clipboard = ""
local sortSelection
sortSelection = function()
if selection["end"] < selection.start then
selection["end"], selection.start = selection.start, selection["end"]
end
end
local clearSelection
clearSelection = function()
selection.start, selection["end"] = -1, -1
end
local isSelection
isSelection = function()
return selection.start ~= -1 and selection["end"] ~= -1
end
local snipSelection
snipSelection = function(curtext, insert)
local tmp = curtext:sub(1, selection.start) .. insert
return #tmp, tmp .. curtext:sub(selection["end"] + 1)
end
local words = { }
local lastinput = nil
local lastsuggestions = nil
local res = nil
local font = love.graphics.getFont()
local sortOnScore
sortOnScore = function(a, b)
return a.score > b.score
end
local drawSuggestions
drawSuggestions = function(self)
if #self.textin < self.suggestlength then
self.suggest = false
return
end
if lastinput ~= self.textin then
self.suggest = true
res = { }
for i, v in ipairs(words) do
local score = Fuzzy(v, self.textin)
if score > 0 and v ~= self.textin then
res[#res + 1] = {
score = score,
word = v
}
end
end
table.sort(res, sortOnScore)
do
local _accum_0 = { }
local _len_0 = 1
for i, v in ipairs(res) do
_accum_0[_len_0] = v.word
_len_0 = _len_0 + 1
end
res = _accum_0
end
lastsuggestions = table.concat(res, "\n")
end
if not self.suggest then
return
end
love.graphics.setColor(self.bgcolor)
love.graphics.rectangle("fill", self.x, self.height, self.width, self.fonth * #res)
if self.cursugg > 0 then
love.graphics.setColor(self.inputcolor)
love.graphics.rectangle("fill", self.x, self.height + self.fonth * (self.cursugg - 1), self.width, self.fonth)
end
love.graphics.setColor(self.fontcolor)
love.graphics.printf(lastsuggestions, self.x + font:getWidth(self.ps) + 2, self.height, self.width, 'left')
lastinput = self.textin
end
local bgr, bgg, bgb, bga = 0, 0, 0, 0
local clearCanvas
clearCanvas = function(canvas, bgcolor)
bgr, bgg, bgb, bga = love.graphics.getBackgroundColor()
love.graphics.setCanvas(canvas)
love.graphics.setBackgroundColor(bgcolor)
return love.graphics.clear()
end
local resetCanvas
resetCanvas = function()
love.graphics.setCanvas()
return love.graphics.setBackgroundColor(bgr, bgg, bgb, bga)
end
local getSandbox
getSandbox = function()
if not sandbox then
sandbox = {
print = function(...)
local t = {
...
}
local out
do
local _accum_0 = { }
local _len_0 = 1
for i, v in ipairs(t) do
_accum_0[_len_0] = tostring(v)
_len_0 = _len_0 + 1
end
out = _accum_0
end
return terminal:write(table.concat(out, ' '))
end,
clear = function()
return terminal:clear()
end,
quit = function()
love.quit(true)
return love.event.push('quit')
end,
kill = function()
return os.exit(-1)
end,
write = function(s)
return terminal:write(s)
end,
version = function()
return terminal:write("/" .. tostring(Version.name) .. " " .. tostring(Version.number))
end,
lua = function()
return terminal:write(tostring(jit.version) .. " with Love " .. tostring(string.format('%d.%d.%d', love.getVersion())))
end,
help = function()
terminal:write("/" .. tostring(Version.name) .. " " .. tostring(Version.number) .. " console:")
terminal:write("` expands to 'print '")
terminal:write("| expands to 'in pairs '")
for k, v in pairs(sandbox) do
terminal:write("command: " .. tostring(k))
end
end,
shortcuts = function()
terminal:write("Shift+Left/Right: Select\nCtrl+A: Select All\nCtrl+C: Copy\nCtrl+V: Paste")
terminal:write("Ctrl+X: Cut\nUp/Down: Repeat Command History\nEsc: Close Suggestions")
terminal:write("Tab: Complete Suggestion\nCtrl+Left/Right: Move to First/Last Command")
return terminal:write("Enter: Enter as MoonScript\nShift+Enter: Enter as Lua")
end
}
setmetatable(sandbox, {
__index = terminal.index
})
end
return sandbox
end
terminal = {
x = 0,
y = 0,
ps = '> ',
activation = 'f12',
width = 500,
height = 250,
textin = "",
lines = { },
cursor = 0,
startline = 1,
focus = false,
visible = false,
fonth = font:getHeight(),
blinktime = 1.0,
history = Stack(100),
curhist = 0,
suggest = false,
suggestlength = 3,
cursugg = 0,
bgcolor = {
23,
23,
23,
192
},
fontcolor = {
243,
243,
243
},
inputcolor = {
53,
53,
53,
192
},
cursorcolor = {
243,
243,
243
},
errorcolor = {
237,
24,
38
},
index = _G,
resize = function(self, width, height)
if width == nil then
width = 500
end
if height == nil then
height = 250
end
self.width, self.height = width, height
canvas = love.graphics.newCanvas(self.width, self.height - self.fonth)
clearCanvas(canvas, self.bgcolor)
return resetCanvas()
end,
addWords = function(self, t)
for k, v in pairs(t) do
words[#words + 1] = k
end
end,
draw = function(self)
if self.visible then
local line_h = self.height - self.fonth
local r, g, b, a = love.graphics.getColor()
if redraw then
clearCanvas(canvas, self.bgcolor)
local y, i = 0, self.startline
while y <= (line_h) and i <= #self.lines do
local line = self.lines[i]
if type(line) == 'table' then
love.graphics.setColor(line.color)
line = tostring(line[1])
else
love.graphics.setColor(self.fontcolor)
end
love.graphics.printf(line, self.x + 1, self.y + y, self.width, "left")
y = y + self.fonth
i = i + 1
end
resetCanvas()
end
love.graphics.setColor(r, g, b, a)
love.graphics.draw(canvas, self.x, self.y)
redraw = false
love.graphics.setColor(self.inputcolor)
love.graphics.rectangle("fill", self.x, line_h, self.width, self.fonth)
local input = self.ps .. self.textin
if selection["end"] - selection.start > 0 then
if selection["end"] > #self.textin then
selection["end"] = #self.textin
end
local sel = input:sub(1, selection.start + 2)
local selx = 1 + font:getWidth(sel)
local selw = font:getWidth(self.textin:sub(selection.start + 1, selection["end"]))
love.graphics.setColor(107, 142, 192)
love.graphics.rectangle("fill", selx, line_h + 1, selw + 2, self.fonth - 1)
end
love.graphics.setColor(self.fontcolor)
love.graphics.print(input, 2, line_h)
drawSuggestions(self)
local br = self.cursorcolor[1] * blink
local bg = self.cursorcolor[2] * blink
local bb = self.cursorcolor[3] * blink
love.graphics.setColor(br, bg, bb)
local curtime = love.timer.getTime()
blink = blink - ((curtime - lasttime) / self.blinktime)
lasttime = curtime
if blink < 0 then
blink = 1
end
local sub = input:sub(1, self.cursor + 2)
local cursorx = 2 + font:getWidth(sub)
love.graphics.rectangle("fill", cursorx, line_h + 1, 2, self.fonth - 1)
return love.graphics.setColor(r, g, b, a)
end
end,
evaluate = function(self, t, nosandbox, lua)
local fn = nil
local ldstring = lua and loadstring or Moon.loadstring
if type(t) == 'string' then
t = t:gsub('`', 'print '):gsub('|', ' in pairs ')
t = t:gsub('%$', 'for k,v in pairs ')
local err
fn, err = ldstring(t)
if not fn then
return self:error(err:gsub('\n', ' '):gsub('%[%d+%] >>', ''))
end
elseif type(t) == 'function' then
fn = t
end
if not nosandbox then
setfenv(fn, getSandbox())
end
local status, err = pcall(fn)
if not status then
return self:error(err:gsub(".*:%d+:", "error: "))
else
if err then
if type(err) == 'function' then
return self:evaluate(err, true)
else
return self:write(err)
end
end
end
end,
clear = function(self)
self.lines = { }
self.startline = 1
self.cursor = 0
self.cursugg = 0
redraw = true
end,
sandbox = function()
return getSandbox()
end,
close = function()
return nil
end,
flush = function()
return nil
end,
error = function(self, t)
return self:write({
t,
color = self.errorcolor
})
end,
write = function(self, t)
if type(t) == 'table' and not t.color then
for k, v in pairs(t) do
self:write(" " .. tostring(tostring(k)) .. ": " .. tostring(tostring(v)))
end
elseif type(t) == 'table' and t.color then
self.lines[#self.lines + 1] = t
else
redraw = true
local rem = nil
t = tostring(t)
local start, last = t:find('\n')
if start then
rem = t:sub(last + 1)
t = t:sub(1, start - 1)
end
self.lines[#self.lines + 1] = t
if rem then
self:write(rem)
end
end
if self.startline + 1 <= #self.lines - math.floor((self.height - self.fonth) / self.fonth) then
self.startline = self.startline + 1
end
end,
inputline = function(self, lua)
self:write(self.textin)
self:evaluate(self.textin, nil, lua)
self.cursor = 0
if self.history:get(1) ~= self.textin then
self.history:push(self.textin)
end
self.curhist = 0
self.textin = ""
self.cursugg = 0
end,
textinput = function(self, t, grapher)
if self.focus then
if isSelection() then
self.cursor, self.textin = snipSelection(self.textin, t)
else
if self.cursor >= #self.textin then
self.textin = self.textin .. t
else
self.textin = self.textin:sub(1, self.cursor) .. t .. self.textin:sub(self.cursor + 1)
end
self.cursor = self.cursor + 1
end
clearSelection()
if #self.textin >= self.suggestlength then
self.suggest = true
end
end
end,
mousepressed = function(self, x, y, button)
if not self.focus then
return
end
if x <= self.width and y < self.height then
if button == "wu" then
if self.startline - 1 >= 1 then
self.startline = self.startline - 1
redraw = true
end
elseif button == "wd" then
if self.startline + 1 <= #self.lines - math.floor((self.height - self.fonth) / self.fonth) then
self.startline = self.startline + 1
redraw = true
end
end
end
end,
keypressed = function(self, key, rep)
if key == self.activation then
self.visible = not self.visible
self.focus = not self.focus
blink, lasttime = 1, 0
end
if not self.focus then
return
end
local ctrlDown = love.keyboard.isDown('lctrl') or love.keyboard.isDown('rctrl')
local shiftdown = love.keyboard.isDown('lshift') or love.keyboard.isDown('rshift')
if key == "up" or key == "down" then
if self.suggest and #res > 0 then
self.cursugg = self.cursugg + (key == "up" and -1 or 1)
if self.cursugg < 0 then
self.cursugg = #res
end
if self.cursugg > #res then
self.cursugg = 0
end
return
end
self.curhist = self.curhist + (key == "up" and 1 or -1)
if self.curhist > self.history:size() then
self.curhist = self.history:size()
end
if self.curhist < 1 then
self.curhist = 1
end
local newtxt = self.history:get(self.curhist) or self.textin
self.textin = newtxt
self.cursor = #self.textin
return clearSelection()
elseif key == "tab" then
if self.suggest and res[1] then
if self.cursugg == 0 then
self.cursugg = 1
end
self.textin = res[self.cursugg]
self.cursor = #self.textin
self.cursugg = 0
return clearSelection()
end
elseif key == "right" or key == "left" then
local dir = key == "right" and 1 or -1
self.cursor = self.cursor + dir
if self.cursor > #self.textin then
self.cursor = #self.textin
end
if self.cursor < 0 then
self.cursor = 0
end
if shiftdown then
if selection.start == -1 then
selection.start = self.cursor - dir
end
if selection["end"] == -1 then
selection["end"] = self.cursor - dir
end
if dir > 0 then
selection["end"] = self.cursor
else
selection.start = self.cursor
end
return sortSelection()
elseif ctrlDown then
if self.history:size() > 0 then
self.curhist = dir == -1 and self.history:size() or 1
self.textin = self.history:get(self.curhist) or self.textin
self.cursor = #self.textin
return clearSelection()
end
else
return clearSelection()
end
elseif key == "escape" then
self.suggest = false
return clearSelection()
elseif key == "backspace" or key == "delete" then
if isSelection() then
self.cursor = selection.start
self.textin = self.textin:sub(1, selection.start) .. self.textin:sub(selection["end"] + 1)
clearSelection()
return
end
local l = key == "backspace" and 1 or 0
local r = key == "delete" and 2 or 1
local len = self.textin:len()
if self.cursor < len then
self.textin = self.textin:sub(1, self.cursor - l) .. self.textin:sub(self.cursor + r)
elseif self.cursor >= len then
self.textin = self.textin:sub(1, self.cursor - l)
end
if key == "backspace" then
self.cursor = self.cursor - 1
end
if self.cursor < 0 then
self.cursor = 0
end
elseif key == "return" or key == "kpenter" then
self.suggest = false
clearSelection()
return self:inputline(shiftdown)
elseif key == "a" and ctrlDown then
selection.start = 0
selection["end"] = #self.textin
self.cursor = #self.textin
elseif (key == "c" or key == "x") and ctrlDown then
if not isSelection() then
return
end
clipboard = self.textin:sub(selection.start + 1, selection["end"])
if key == "x" then
self.cursor = selection.start
self.textin = self.textin:sub(1, selection.start) .. self.textin:sub(selection["end"] + 1)
return clearSelection()
end
elseif key == "v" and ctrlDown then
if isSelection() then
self.cursor, self.textin = snipSelection(self.textin, clipboard)
else
self.textin = self.textin:sub(1, self.cursor) .. clipboard .. self.textin:sub(self.cursor + 1)
self.cursor = self.cursor + #clipboard
end
return clearSelection()
end
end
}
return setmetatable(terminal, {
__call = function(self, activation, width, height, index)
self.activation = activation or self.activation
self:resize(width, height)
self.index = index
self:addWords(index)
self:addWords(getSandbox())
return self
end
})
|
local String = require "oT.Base.String"
local _M=
{
mContext=nil,
--File Mode
Text=1,
Bytes=2,
Read=4,
ReadText=5,
ReadBytes=6,
Write=8,
WriteText=9,
WriteBytes=10,
Append=12,
AppendText=13,
AppendBytes=14,
SeekPosMode=
{
Begin=0,
Current=1,
End=2
}
}
function _M.new()
local p={}
setmetatable(p,_M)
_M.__index=_M
p.mContext=oTFile_Create()
return p
end
_M.destory=function(t)
if t and t.mContext then
oTFile_Destory(t.mContext)
t.mContext=nil
t=nil
end
end
_M.__gc=function(t)
_M.destory(t)
end
_M.openFromFile=function(t,path,mode)
return oTFile_OpenFromFile(t.mContext,path,mode)
end
_M.openFromResources=function(t,path,mode)
return oTFile_OpenFromResources(t.mContext,path,mode)
end
_M.isOpen=function(t,path,mode)
return oTFile_IsOpen(t.mContext)
end
_M.close=function(t)
return oTFile_Close(t.mContext)
end
_M.read=function(t,len)
local p,rlen=oTFile_Read(t.mContext,len)
local str=String.new(p)
local lstr=string.sub(str:c_str(),0,rlen)
str:destory()
str=nil
p=nil
return lstr,rlen
end
_M.write=function(t,data,len)
return oTFile_Write(t.mContext,data,len)
end
_M.length=function(t)
return oTFile_Length(t.mContext)
end
_M.seek=function(t,pos,mode)
return oTFile_Seek(t.mContext,pos or 0,mode or _M.SeekPosMode.Current)
end
return _M |
-- // Name: deleteWallPost.lua
-- // Description: Deletes a specified post from the group wall
-- // Author: @Jumpathy
return {
authentication_required = true,
call = function(client,api,endpoints,cookie,groupId,postId)
if(type(postId) == "table") then
postId = postId["id"];
end
return api.request(true,"delete_post",api.handleAuthenticationHeaders({cookie = cookie,headers = {
["Content-Type"] = "application/json"
},},"delete_post"),nil,groupId,postId);
end
} |
if not _G.THREATLIB_LOAD_MODULES then return end -- only load if LibThreatClassic2.lua allows it
if not LibStub then return end
local ThreatLib, MINOR = LibStub("LibThreatClassic2", true)
if not ThreatLib then return end
local ONYXIA_ID = 10184
local FIREBALL_ID = 18392
local KNOCK_AWAY_ID = 19633
ThreatLib:GetModule("NPCCore-r"..MINOR):RegisterModule(ONYXIA_ID, function(Onyxia)
function Onyxia:Init()
self:RegisterCombatant(ONYXIA_ID, true)
self:RegisterSpellHandler("SPELL_CAST_SUCCESS", ONYXIA_ID, FIREBALL_ID, self.Fireball)
self:RegisterSpellDamageHandler(ONYXIA_ID, KNOCK_AWAY_ID, self.KnockAway)
end
function Onyxia:Fireball(sourceGUID, unitId)
self:ModifyThreat(sourceGUID, unitId, 0, 0)
end
function Onyxia:KnockAway(sourceGUID, unitId)
self:ModifyThreat(sourceGUID, unitId, 0.75, 0)
end
end)
|
local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.core.path"
local process = require "nvim-lsp-installer.core.process"
local platform = require "nvim-lsp-installer.core.platform"
local std = require "nvim-lsp-installer.core.managers.std"
local git = require "nvim-lsp-installer.core.managers.git"
local github = require "nvim-lsp-installer.core.managers.github"
local Optional = require "nvim-lsp-installer.core.optional"
return function(name, root_dir)
local rebar3 = platform.is_win and "rebar3.cmd" or "rebar3"
return server.Server:new {
name = name,
root_dir = root_dir,
languages = { "erlang" },
homepage = "https://erlang-ls.github.io/",
---@param ctx InstallContext
installer = function(ctx)
std.ensure_executable(rebar3, { help_url = "http://rebar3.org/docs/" })
local repo = "erlang-ls/erlang_ls"
local source = github.tag { repo = repo }
source.with_receipt()
git.clone { ("https://github.com/%s.git"):format(repo), version = Optional.of(source.tag) }
ctx.spawn[rebar3] { "escriptize" }
ctx.spawn[rebar3] { "as", "dap", "escriptize" }
end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "_build", "default", "bin" } },
},
},
}
end
|
----
-- Handles constant functionality.
--
-- **Source Code:** [https://github.com/dstmodders/dst-mod-sdk](https://github.com/dstmodders/dst-mod-sdk)
--
-- @module SDK.Constant
-- @see SDK
--
-- @author [Depressed DST Modders](https://github.com/dstmodders)
-- @copyright 2020
-- @license MIT
-- @release 0.1
----
local Constant = {}
local SDK
--- General
-- @section general
--- Add string names to the values table.
-- @tparam table t Values table
-- @tparam[opt] boolean is_sorted Should be sorted alphabetically?
-- @treturn table
function Constant.AddStringNamesToTable(t, is_sorted)
local result = {}
for _, v in pairs(t) do
table.insert(result, {
name = Constant.GetStringName(v),
value = v,
})
end
if is_sorted then
table.sort(result, function(a, b)
return a.name:lower() < b.name:lower()
end)
end
return result
end
--- Gets a skin index.
-- @see GetStringSkinName
-- @see GetStringName
-- @tparam string prefab
-- @tparam number skin
-- @treturn string
function Constant.GetSkinIndex(prefab, skin)
return PREFAB_SKINS_IDS[prefab] and PREFAB_SKINS_IDS[prefab][skin]
end
--- Gets a string skin name.
-- @see GetSkinIndex
-- @see GetStringName
-- @tparam number skin
-- @treturn string
function Constant.GetStringSkinName(skin)
return STRINGS.SKIN_NAMES[skin]
end
--- Gets a string name.
-- @see GetSkinIndex
-- @see GetStringSkinName
-- @tparam string name
-- @treturn string
function Constant.GetStringName(name)
return STRINGS.NAMES[string.upper(name)]
end
--- Lifecycle
-- @section lifecycle
--- Initializes.
-- @tparam SDK sdk
-- @treturn SDK.Constant
function Constant._DoInit(sdk)
SDK = sdk
return SDK._DoInitModule(SDK, Constant, "Constant")
end
return Constant
|
local PLUGIN = nil;
local BUTTONS = {};
local PREPAREDPLAYER = {};
local PLUGINDIR = nil;
local debug = false;
LIP = require 'LIP'
PMLib = require 'PMLib'
ZLib = require 'ZLib'
function Initialize(Plugin)
Plugin:SetName("BungeecordTeleButton")
Plugin:SetVersion(1)
-- Hooks
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_BLOCK, OnPlayerUsedBlock)
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_JOINED, OnLogin)
PLUGIN = Plugin
PLUGINDIR = Plugin:GetFolderName()
--if(debug) then LOG(PLUGINDIR) end
if(cFile:IsFile("Plugins/" .. PLUGINDIR .. "/buttons.ini")) then
BUTTONS = LIP.load("Plugins/" .. PLUGINDIR .. "/buttons.ini")
else
cFile:Copy("Plugins/" .. PLUGINDIR .. "/BUTTONS.ini.default","Plugins/" .. PLUGINDIR .. "/BUTTONS.ini")
end
-- Command Bindings
-- Use the InfoReg shared library to process the Info.lua file:
dofile("Plugins/" .. PLUGINDIR .. "/InfoReg.lua")
RegisterPluginInfoCommands()
--RegisterPluginInfoConsoleCommands()
LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
local online = cRoot:Get():GetServer():GetNumPlayers();
if(online ~= 0) then
cRoot:Get():ForEachPlayer(ReadyPlayer)
end
return true
end
function ReadyPlayer(Player)
if not Player then
return true
end
local PlayerName = Player:GetName();
PREPAREDPLAYER[PlayerName]={};
PREPAREDPLAYER[PlayerName].Ready = false;
PREPAREDPLAYER[PlayerName].ReadyDelete = false;
end
function OnLogin(Player)
--if(debug) then LOG(Player:GetName() .. "Logged In!") end
ReadyPlayer(Player);
end
function FindServer(BlockX,BlockY,BlockZ)
--if(debug) then LOG("Searching for Server!") end
local ServerName = "";
for Key, Value in pairs(BUTTONS) do
if(Value.X == BlockX and Value.Y == BlockY and Value.Z == BlockZ) then
--if(debug) then LOG("Server Found!") end
return {["ButtonName"] = Value.Name, ["ServerName"] = Value.Server, ["Permission"] = Value.Permission, ["Found"] = true,}
end
end
--if(debug) then LOG("Server not found :(") end
return {["Found"] = false,}
end
function CheckIfButtonNameTaken(ButtonName)
--if(debug) then LOG("Checking button names...") end
for Key,Value in pairs(BUTTONS) do
--if(debug) then LOG(Key, Value) end
if(tostring(ButtonName) == Value.Name) then
--if(debug) then LOG("Uh oh I found one!") end
return true
end
end
--if(debug) then LOG("None found!") end
return false
end
function OnPlayerUsedBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType, BlockMeta)
local PlayerName = Player:GetName();
--if(debug) then LOG(type(BlockX)) end
--if(debug) then LOG(PlayerName .. " used block" .. BlockType .. "!") end
if(BlockType == 77 or BlockType == 143) then
--if(debug) then LOG(PlayerName .. "used a button!") end
if(PREPAREDPLAYER[PlayerName].Ready) then
if(CheckIfButtonNameTaken(PREPAREDPLAYER[PlayerName].ButtonName)) then
--if(debug) then LOG(PlayerName .. ", how did you fuck this one up?") end
PREPAREDPLAYER[PlayerName].Ready = false
Player:SendMessageFailure("Button name in use! You are no longer creating a BungeeButton!");
else
--if(debug) then LOG("Making new button entry..") end
BUTTONS[PREPAREDPLAYER[PlayerName].ButtonName] = {
["Name"] = PREPAREDPLAYER[PlayerName].ButtonName,
["X"] = BlockX,
["Y"] = BlockY,
["Z"] = BlockZ,
["Server"] = PREPAREDPLAYER[PlayerName].Server,
["Permission"] = PREPAREDPLAYER[PlayerName].Permission,
}
--if(debug) then LOG(BUTTONS[PREPAREDPLAYER[PlayerName].ButtonName].Name .. " " .. BUTTONS[PREPAREDPLAYER[PlayerName].ButtonName].X .. " " .. BUTTONS[PREPAREDPLAYER[PlayerName].ButtonName].Y .. " " .. BUTTONS[PREPAREDPLAYER[PlayerName].ButtonName].Z .. " " .. BUTTONS[PREPAREDPLAYER[PlayerName].ButtonName].Server .. " " .. BUTTONS[PREPAREDPLAYER[PlayerName].ButtonName].Permission) end
PREPAREDPLAYER[PlayerName].Ready = false
Player:SendMessageSuccess("Button successfully created!")
LOG("BungeeButton "..PREPAREDPLAYER[PlayerName].ButtonName.." created at ("..BlockX ..",".. BlockY..","..BlockZ..")")
end
elseif(PREPAREDPLAYER[PlayerName].ReadyDelete) then
local ServerInfo = FindServer(BlockX,BlockY,BlockZ)
if(Player:HasPermission("bungeebutton.delete.button")) then
if(ServerInfo.Found) then
BUTTONS[ServerInfo.ButtonName] = nil
PREPAREDPLAYER[PlayerName].ReadyDelete = false
Player:sendMessageInfo("Button " .. ServerInfo.ButtonName .. " has been removed!")
else
Player:SendMessageInfo("The clicked button is not a Bungee Button! Use /bungeebuttondel again to stop trying to remove a BungeeButton. Otherwise, use a BungeeButton to remove.");
end
end
else
--if(debug) then LOG("Checking if button is a server porter") end
local ServerInfo = FindServer(BlockX,BlockY,BlockZ);
if ServerInfo.Found then
if Player:HasPermission(ServerInfo.Permission) then
Player:GetClientHandle():SendPluginMessage(PMLib:new("BungeeCord"):writeUTF("Connect"):writeUTF(ServerInfo.ServerName):GetOut())
else
Player:SendMessageFailure("You do not have permission to use this button!");
end
else
return false
end
end
end
--if(debug) then LOG("Different Block") end
end
function BungeeButton(a_Split,a_Player)
--if(debug) then LOG("Command started with " .. a_Split[2] .. " " .. a_Split[3] .. " " .. a_Split[4]) end
local PlayerName = a_Player:GetName();
if(#a_Split == 4) then
if(CheckIfButtonNameTaken(a_Split[2])) then
a_Player:SendMessageFailure("Button name in use!");
return true
else
PREPAREDPLAYER[PlayerName].ButtonName = a_Split[2];
PREPAREDPLAYER[PlayerName].Server = a_Split[3];
PREPAREDPLAYER[PlayerName].Permission = a_Split[4];
PREPAREDPLAYER[PlayerName].Ready = true;
--if(debug) then LOG(tostring(PREPAREDPLAYER[PlayerName].ButtonName) .. " " .. tostring(PREPAREDPLAYER[PlayerName].Server) .. " " .. tostring(PREPAREDPLAYER[PlayerName].Permission) .. " " .. tostring(PREPAREDPLAYER[PlayerName].Ready)) end
a_Player:SendMessageSuccess("Creation started! Use a button to create!")
end
else
a_Player:SendMessageFailure("Use the command like this: /bungeebutton {Name} {Server} {Permission}");
end
return true
end
function BungeeButtonDel(a_Split,Player)
local PlayerName = Player:GetName();
if(#a_Split == 1) then
PREPAREDPLAYER[PlayerName].ReadyDelete = true;
elseif(#a_Split == 2) then
BUTTONS[a_Split[2]] = nil;
Player:SendMessageSuccess("Button " .. a_Split[2] .. " deleted successfully!")
else
Player:SendMessageFailure("Use the command like this: /bungeebuttondel OR /bungeebuttondel {Name}");
end
return true
end
function BungeeButtonReload(Split,Player)
BUTTONS = {};
BUTTONS = LIP.load("Plugins/" .. PLUGINDIR .. "/buttons.ini");
Player:SendMessageSuccess("Config loaded!");
return true
end
function BungeeButtonSave(Split,Player)
LIP.save("Plugins/" .. PLUGINDIR .. "/buttons.ini",BUTTONS);
Player:SendMessageSuccess("Buttons saved!");
return true
end
function OnDisable()
LOG(PLUGIN:GetName() .. " is saving buttons...")
--[[
local IniFile = cIniFile();
IniFile:Clear();
for Key, Value in pairs(BUTTONS) do
IniFile:AddKeyName(Value.Name);
IniFile:AddValue(Key.Name,"Name",Value.Name);
IniFile:AddValueF(Key.X,"X",Value.X);
IniFile:AddValueF(Key.Y,"Y",Value.Y);
IniFile:AddValueF(Key.Z,"Z",Value.Z);
IniFile:AddValue(Key.Server,"Server",Value.Server);
IniFile:AddValue(Key.Permission,"Permission",Value.Permission);
end
IniFile:WriteFile(PLUGIN:GetLocalFolder() .. "/buttons.ini");
--]]
LIP.save("Plugins/" .. PLUGINDIR .. "/buttons.ini",BUTTONS)
LOG(PLUGIN:GetName() .. " has finished saving!")
LOG(PLUGIN:GetName() .. " is shutting down...")
end
|
local tl = require("tl")
describe("typed varargs", function()
it("declaration", function()
local tokens = tl.lex([[
local function f(a: number, ...: string): boolean
return true
end
]])
local _, ast = tl.parse_program(tokens)
local errors = tl.type_check(ast)
assert.same({}, errors)
end)
it("call with multiple arities", function()
local tokens = tl.lex([[
local function f(a: number, ...: string): boolean
return true
end
local ok = f(5)
local ok = f(5, "aa")
local ok = f(5, "aa", "bbb")
local ok = f(5, "aa", "bbb", "ccc")
]])
local _, ast = tl.parse_program(tokens)
local errors = tl.type_check(ast)
assert.same({}, errors)
end)
it("can expand to multiple variables", function()
local tokens = tl.lex([[
local function f(...: string): string
local s, t = ...
return s .. t
end
local s = f("aa", "bbb")
]])
local _, ast = tl.parse_program(tokens)
local errors = tl.type_check(ast)
assert.same({}, errors)
end)
it("can compress to a single variable", function()
local tokens = tl.lex([[
local function f(...: string): number
local s, n: string, number = ..., 12
return #s + n
end
local s = f("aa", "bbb")
]])
local _, ast = tl.parse_program(tokens)
local errors = tl.type_check(ast)
assert.same({}, errors)
end)
end)
|
solution "BoostInPractice"
act = ""
if _ACTION then
act = _ACTION
end
configurations { "Debug", "Release" }
postfix=""
targetdir "../Bin"
location("./" .. act .. postfix)
projectRootDir = os.getcwd()
print("Project root directroy: " .. projectRootDir);
language "C++"
include "object_pool"
|
function onProjectileDeath(star, proj)
star:addAnimation(Animation.new("LIGHTNING", proj:getPos()))
local p = Projectile.new("LIGHTNING_AOE")
p:setPos(proj:getPos())
p:setAllegiance(proj:getAllegiance())
star:addProjectile(p)
end |
--------------------------------------------------------------------------------
--! @file CharaTppDoor.lua
--! @brief ドア (Gagdetクラスで作成)
--------------------------------------------------------------------------------
--[[ 配置スクリプト
Command.StartGroup()
local locator = Command.CreateData( Editor.GetInstance(), "ChCharacterLocatorData" )
local params = Command.CreateEntity( "TppDoorLocatorParameter" )
local objectCreator = Command.CreateEntity( "TppGadgetObjectCreator" )
Command.SetProperty{ entity=locator, property="params", value=params }
Command.SetProperty{ entity=locator, property="objectCreator", value=objectCreator }
Command.SetProperty{ entity=locator, property="scriptPath", value="Tpp/Scripts/Gimmicks/CharaTppDoor.lua" }
Command.AddPropertyElement{ entity=params.fileResources, property="resources", key="parts" }
Command.SetProperty{ entity=params.fileResources, property="resources", key="parts", value="/Assets/tpp/parts/environ/object/middle_africa/gate/maft_gate002/mafr_gate002_vrtn002.parts" }
Command.EndGroup()
--]]
CharaTppDoor = {
--[[ C++化済み
dependSyncPoints = {
"Gr",
"Geo",
"Nt",
"Fx",
"Nav",
"Sd",
"Noise",
},
pluginIndexEnumInfoName = "TppGadgetPluginDefine",
--------------------------------------------------------------------------------
-- callback function
--------------------------------------------------------------------------------
----------------------------------------
--! @brief 生成処理 OnCreate()
--! キャラクタ生成時に呼ばれる関数. プラグインの生成などを行う
--! @param chara
----------------------------------------
OnCreate = function( chara )
local charaObj = chara:GetCharacterObject()
charaObj.gadgetType = 4096
end,
]]
} -- CharaTppDoor
|
require('..')
local dataset_path, model_params, dir_params, data_params = unpack(require('opts/context_captioning/caption_opts_piano.lua'))
-- Tests that batch captioner works
train_dataset, val_dataset, test_dataset
= datasets.read_caption_data(dataset_path,
model_params.use_gpu_mode,
model_params.char_level,
model_params.only_feats)
vocab = train_dataset.vocab
local pred_beam_size = 1
local test_beam_size = 1
-- initialize model
local model = dmn.Captioner_Network{
char_level = model_params.char_level,
vocab = vocab,
only_feats = model_params.only_feats,
load_weights = model_params.load_weights,
batch_size = model_params.batch_size,
optim_method_string = model_params.optim_method_string,
optim_state = model_params.optim_state,
network_type = model_params.network_type,
gpu_mode = model_params.use_gpu_mode,
num_classes = vocab.size,
emb_dim = model_params.emb_dim,
mem_dim = model_params.mem_dim,
image_dim = model_params.image_dim,
num_layers = model_params.num_layers,
dropout = model_params.dropout,
in_dropout_prob = model_params.in_dropout_prob,
hidden_dropout_prob = model_params.hidden_dropout_prob,
rnn_type = model_params.rnn_type,
cell_type = model_params.cell_type,
tune_image_features = model_params.tune_image_features
}
local images = torch.rand(4, 3, 224, 224)
local input_sentences = torch.IntTensor{{1, 2, 3, 4},
{1, 4, 5, 6},
{1, 7, 8, 9}}
-- input_sentences[i] = batch of indices corresponding to word i.
local output_sentences = torch.IntTensor{{1, 2, 3, 4}, {1, 4, 5, 6}, {1, 7, 8, 9}}
local input_masks = torch.IntTensor(4, 2)
input_masks[1][1] = 5
input_masks[1][2] = 3
input_masks[2][1] = 5
input_masks[2][2] = 2
input_masks[3][1] = 5
input_masks[3][2] = 3
input_masks[4][1] = 5
input_masks[4][2] = 3
model.grad_params:zero()
local batch_loss, predictions = model:forward(images, input_sentences, output_sentences, false, input_masks)
local input_errs = model:backward(images, input_sentences, output_sentences, false, input_masks)
local batch_sum = model.grad_params:sum()
model.grad_params:zero()
local cur_loss = 0
-- should be the same as batch forwarding
for i = 1, images:size(1) do
local loss, predictions = model:forward(images[i], input_sentences[{{},i}], output_sentences[{{},i}], false, input_masks)
model:backward(images[i], input_sentences[{{},i}], output_sentences[{{},i}], false, input_masks)
cur_loss = cur_loss + loss
end
print(cur_loss / images:size(1))
print(batch_loss)
local sequential_sum = model.grad_params:sum() / images:size(1)
print("Batch sum, sequential sum ", batch_sum, sequential_sum)
assert(batch_sum == sequential_sum, "Two must be equal") |
if not modules then modules = { } end modules ['font-imp-effects'] = {
version = 1.001,
comment = "companion to font-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
-- todo: pickup from goodies: if type(effect) then ...
local next, type, tonumber = next, type, tonumber
local is_boolean = string.is_boolean
local fonts = fonts
local handlers = fonts.handlers
local registerotffeature = handlers.otf.features.register
local registerafmfeature = handlers.afm.features.register
local settings_to_hash = utilities.parsers.settings_to_hash_colon_too
local helpers = fonts.helpers
local prependcommands = helpers.prependcommands
local charcommand = helpers.commands.char
local leftcommand = helpers.commands.left
local rightcommand = helpers.commands.right
local upcommand = helpers.commands.up
local downcommand = helpers.commands.down
local dummycommand = helpers.commands.dummy
----- constructors = fonts.constructors
----- getmathparameter = constructors.getmathparameter
----- setmathparameter = constructors.setmathparameter
local report_effect = logs.reporter("fonts","effect")
local report_slant = logs.reporter("fonts","slant")
local report_extend = logs.reporter("fonts","extend")
local report_squeeze = logs.reporter("fonts","squeeze")
local trace = false
trackers.register("fonts.effect", function(v) trace = v end)
trackers.register("fonts.slant", function(v) trace = v end)
trackers.register("fonts.extend", function(v) trace = v end)
trackers.register("fonts.squeeze",function(v) trace = v end)
local function initializeslant(tfmdata,value)
value = tonumber(value)
if not value then
value = 0
elseif value > 1 then
value = 1
elseif value < -1 then
value = -1
end
if trace then
report_slant("applying %0.3f",value)
end
tfmdata.parameters.slantfactor = value
end
local specification = {
name = "slant",
description = "slant glyphs",
initializers = {
base = initializeslant,
node = initializeslant,
}
}
registerotffeature(specification)
registerafmfeature(specification)
local function initializeextend(tfmdata,value)
value = tonumber(value)
if not value then
value = 0
elseif value > 10 then
value = 10
elseif value < -10 then
value = -10
end
if trace then
report_extend("applying %0.3f",value)
end
tfmdata.parameters.extendfactor = value
end
local specification = {
name = "extend",
description = "scale glyphs horizontally",
initializers = {
base = initializeextend,
node = initializeextend,
}
}
registerotffeature(specification)
registerafmfeature(specification)
local function initializesqueeze(tfmdata,value)
value = tonumber(value)
if not value then
value = 0
elseif value > 10 then
value = 10
elseif value < -10 then
value = -10
end
if trace then
report_squeeze("applying %0.3f",value)
end
tfmdata.parameters.squeezefactor = value
end
local specification = {
name = "squeeze",
description = "scale glyphs vertically",
initializers = {
base = initializesqueeze,
node = initializesqueeze,
}
}
registerotffeature(specification)
registerafmfeature(specification)
local effects = {
inner = 0,
normal = 0,
outer = 1,
outline = 1,
both = 2,
hidden = 3,
}
local function initializeeffect(tfmdata,value)
local spec
if type(value) == "number" then
spec = { width = value }
else
spec = settings_to_hash(value)
end
local effect = spec.effect or "both"
local width = tonumber(spec.width) or 0
local mode = effects[effect]
if not mode then
report_effect("invalid effect %a",effect)
elseif width == 0 and mode == 0 then
report_effect("invalid width %a for effect %a",width,effect)
else
local parameters = tfmdata.parameters
local properties = tfmdata.properties
parameters.mode = mode
parameters.width = width * 1000
if is_boolean(spec.auto) == true then
local squeeze = 1 - width/20
local average = (1 - squeeze) * width * 100
spec.squeeze = squeeze
spec.extend = 1 + width/2
spec.wdelta = average
spec.hdelta = average/2
spec.ddelta = average/2
spec.vshift = average/2
end
local factor = tonumber(spec.factor) or 0
local hfactor = tonumber(spec.hfactor) or factor
local vfactor = tonumber(spec.vfactor) or factor
local delta = tonumber(spec.delta) or 1
local wdelta = tonumber(spec.wdelta) or delta
local hdelta = tonumber(spec.hdelta) or delta
local ddelta = tonumber(spec.ddelta) or hdelta
local vshift = tonumber(spec.vshift) or 0
local slant = spec.slant
local extend = spec.extend
local squeeze = spec.squeeze
if slant then
initializeslant(tfmdata,slant)
end
if extend then
initializeextend(tfmdata,extend)
end
if squeeze then
initializesqueeze(tfmdata,squeeze)
end
properties.effect = {
effect = effect,
width = width,
factor = factor,
hfactor = hfactor,
vfactor = vfactor,
wdelta = wdelta,
hdelta = hdelta,
ddelta = ddelta,
vshift = vshift,
slant = tfmdata.parameters.slantfactor,
extend = tfmdata.parameters.extendfactor,
squeeze = tfmdata.parameters.squeezefactor,
}
end
end
local rules = {
"RadicalRuleThickness",
"OverbarRuleThickness",
"FractionRuleThickness",
"UnderbarRuleThickness",
}
-- radicals are not yet ok
local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier)
-- hm, this was "if delta ~= 0 then" but delta was gone
if dy ~= 0 then
for i=1,#rules do
local name = rules[i]
local value = mathparameters[name]
if value then
mathparameters[name] = (squeeze or 1) * (value + dy)
end
end
end
end
local function setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta)
-- still not the perfect rule
local function wdpatch(char)
if wsnap ~= 0 then
char.width = char.width + wdelta/2
end
end
local function htpatch(char)
if hsnap ~= 0 then
local height = char.height
if height then
char.height = char.height + 2 * dy
end
end
end
local character = characters[0x221A]
if character and character.next then
local char = character
local next = character.next
wdpatch(char)
htpatch(char)
while next do
char = characters[next]
wdpatch(char)
htpatch(char)
next = char.next
end
if char then
local v = char.vert_variants
if v then
local top = v[#v]
if top then
local char = characters[top.glyph]
htpatch(char)
end
end
end
end
end
-- local show_effect = { "lua", function(f,c)
-- report_effect("font id %i, char %C",f,c)
-- inspect(fonts.hashes.characters[f][c])
-- end }
local function manipulateeffect(tfmdata)
local effect = tfmdata.properties.effect
if effect then
local characters = tfmdata.characters
local parameters = tfmdata.parameters
local mathparameters = tfmdata.mathparameters
local multiplier = effect.width * 100
local factor = parameters.factor
local hfactor = parameters.hfactor
local vfactor = parameters.vfactor
local wdelta = effect.wdelta * hfactor * multiplier
local hdelta = effect.hdelta * vfactor * multiplier
local ddelta = effect.ddelta * vfactor * multiplier
local vshift = effect.vshift * vfactor * multiplier
local squeeze = effect.squeeze
local hshift = wdelta / 2
local dx = multiplier * vfactor
local dy = vshift
local factor = (1 + effect.factor) * factor
local hfactor = (1 + effect.hfactor) * hfactor
local vfactor = (1 + effect.vfactor) * vfactor
vshift = vshift ~= 0 and upcommand[vshift] or false
hshift = rightcommand[hshift]
for unicode, character in next, characters do
local oldwidth = character.width
local oldheight = character.height
local olddepth = character.depth
if oldwidth and oldwidth > 0 then
character.width = oldwidth + wdelta
local commands = character.commands
if vshift then
if commands then
prependcommands ( commands,
-- show_effect,
hshift,
vshift
)
else
character.commands = {
-- show_effect,
hshift,
vshift,
charcommand[unicode]
}
end
else
if commands then
prependcommands ( commands,
-- show_effect,
hshift
)
else
character.commands = {
-- show_effect,
hshift,
charcommand[unicode]
}
end
end
end
if oldheight and oldheight > 0 then
character.height = oldheight + hdelta
end
if olddepth and olddepth > 0 then
character.depth = olddepth + ddelta
end
end
if mathparameters then
setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier)
setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta)
end
parameters.factor = factor
parameters.hfactor = hfactor
parameters.vfactor = vfactor
if trace then
report_effect("applying")
report_effect(" effect : %s", effect.effect)
report_effect(" width : %s => %s", effect.width, multiplier)
report_effect(" factor : %s => %s", effect.factor, factor )
report_effect(" hfactor : %s => %s", effect.hfactor,hfactor)
report_effect(" vfactor : %s => %s", effect.vfactor,vfactor)
report_effect(" wdelta : %s => %s", effect.wdelta, wdelta)
report_effect(" hdelta : %s => %s", effect.hdelta, hdelta)
report_effect(" ddelta : %s => %s", effect.ddelta, ddelta)
end
end
end
local specification = {
name = "effect",
description = "apply effects to glyphs",
initializers = {
base = initializeeffect,
node = initializeeffect,
},
manipulators = {
base = manipulateeffect,
node = manipulateeffect,
},
}
registerotffeature(specification)
registerafmfeature(specification)
local function initializeoutline(tfmdata,value)
value = tonumber(value)
if not value then
value = 0
else
value = tonumber(value) or 0
end
local parameters = tfmdata.parameters
local properties = tfmdata.properties
parameters.mode = effects.outline
parameters.width = value * 1000
properties.effect = {
effect = effect,
width = width,
}
end
local specification = {
name = "outline",
description = "outline glyphs",
initializers = {
base = initializeoutline,
node = initializeoutline,
}
}
registerotffeature(specification)
registerafmfeature(specification)
|
----------------------------------------------------------------
-- Copyright (c) 2013, Bacioiu "Zapa" Ciprian
-- All Rights Reserved.
-- Slide Form element for Derick Dong's GUI Framework for MOAI
----------------------------------------------------------------
--[[
DESCRIPTION HERE ONCE DONE
]]
local _M = {}
require "gui/support/class"
local awindow = require "gui/awindow"
local text = require "gui/text"
local label = require "gui/label"
local awidgetevent = require "gui/awidgetevent"
_M.SlideForm = class(awindow.AWindow)
local SCROLL_BAR_WIDTH = 5
function _M.SlideForm:init(gui)
awindow.AWindow.init(self, gui)
self._type = "SlideForm"
self._posX = 0
self._posY = 0
self._entryPoint = { x = 0, y = 0}
self._SlideFormEvents()
self._BACKGROUND_INDEX = self._WIDGET_SPECIFIC_OBJECTS_INDEX
self.BACKGROUND_IMAGES = self._WIDGET_SPECIFIC_IMAGES
self._fullText = ""
self._lineHeight = 0
self._lines = {}
-- self._maxLines = 20
self._scrollBar = gui:createVertScrollBar()
self:_addWidgetChild(self._scrollBar)
self._scrollBar:registerEventHandler(self._scrollBar.EVENT_SCROLL_BAR_POS_CHANGED, self, "_handleScrollPosChange")
end
function _M.SlideForm:Draw( )
print("DRAW IT MOFO!")
end
function _M.SlideForm:setBackgroundImage(image, r, g, b, a, idx, blendSrc, blendDst)
self:_setImage(self._rootProp, self._BACKGROUND_INDEX, self.BACKGROUND_IMAGES, image, r, g, b, a, idx, blendSrc, blendDst)
self:_setCurrImages(self._TEXT_BOX_INDEX, self.BACKGROUND_IMAGES)
end
function _M.SlideForm:getBackgroundImage()
return self._imageList:getImage(self._BACKGROUND_INDEX, self.BACKGROUND_IMAGES)
end
return _M |
-- Copyright (c) 2021 Trevor Redfern
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
local Helper = require "game.rules.message_log.helper"
local highlight = Helper.highlight
return {
opposed = {
string.format(
"%s({{aggSkill}}:%s/{{aggTarget}}) : %s({{defSkill}}:%s/{{defTarget}})",
highlight("{{aggressor}}"),
highlight("{{aggRoll}}"),
highlight("{{defender}}"),
highlight("{{defRoll}}")
)
},
taskCheck = string.format("(%s+%s >= 8)",
highlight("{{roll}}"),
highlight("{{modifiers}}")
)
} |
local lib = require('undercity.hsluv_lib')
local M = {
to_hex = function(h, s, l)
return lib.hsluv_to_hex({h, s, l})
end,
}
return M
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.