content stringlengths 5 1.05M |
|---|
--
-- An epigraph package for SILE
-- 2021, Didier Willis
-- License: MIT
--
SILE.require("packages/rules")
local styles = SILE.require("packages/styles").exports
SILE.require("packages/omikhleia-utils")
SILE.settings.declare({
parameter = "epigraph.beforeskipamount",
type = "vglue",
default = SILE.settings.get("plain.medskipamount"),
help = "Vertical offset before an epigraph (defaults to a medium skip)."
})
SILE.settings.declare({
parameter = "epigraph.afterskipamount",
type = "vglue",
default = SILE.settings.get("plain.bigskipamount"),
help = "Vertical offset after an epigraph (defaults to a big skip)."
})
SILE.settings.declare({
parameter = "epigraph.sourceskipamount",
type = "vglue",
default = SILE.settings.get("plain.smallskipamount"),
help = "Vertical offset betwen an epigraph text and its source (defaults to a small skip)."
})
SILE.settings.declare({
parameter = "epigraph.parindent",
type = "glue",
default = SILE.settings.get("document.parindent"),
help = "Paragraph identation in an epigraph (defaults to document paragraph indentation)."
})
SILE.settings.declare({
parameter = "epigraph.width",
type = "length",
default = SILE.length("60%lw"),
help = "Width of an epigraph (defaults to 60% of the current line width)."
})
SILE.settings.declare({
parameter = "epigraph.rule",
type = "length",
default = SILE.length("0"),
help = "Thickness of the rule drawn below an epigraph text (defaults to 0, meaning no rule)."
})
SILE.settings.declare({
parameter = "epigraph.align",
type = "string",
default = "right",
help = "Position of an epigraph in the frame (right or left, defaults to right)."
})
SILE.settings.declare({
parameter = "epigraph.ragged",
type = "boolean",
default = false,
help = "Whether an epigraph is ragged (defaults to false)."
})
SILE.settings.declare({
parameter = "epigraph.margin",
type = "length",
default = SILE.length("0"),
help = "Margin (indent) for an epigraph (defaults to 0)."
})
styles.defineStyle("epigraph:style", {}, { font = { size = -1 } })
styles.defineStyle("epigraph:source:style", {}, { font = { style="italic" } })
SILE.registerCommand("epigraph:font", function (_, _)
SILE.call("font", { size = SILE.settings.get("font.size") - 1 })
end, "Font used for an epigraph")
SILE.registerCommand("epigraph:source:font", function (_, _)
SILE.call("font", { style = "italic" })
end, "Font used for the epigraph source, if present.")
SILE.registerCommand("epigraph", function (options, content)
SILE.settings.temporarily(function ()
local beforeskipamount =
options.beforeskipamount ~= nil and SU.cast("vglue", options.beforeskipamount)
or SILE.settings.get("epigraph.beforeskipamount")
local afterskipamount =
options.afterskipamount ~= nil and SU.cast("vglue", options.afterskipamount)
or SILE.settings.get("epigraph.afterskipamount")
local sourceskipamount =
options.sourceskipamount ~= nil and SU.cast("vglue", options.sourceskipamount)
or SILE.settings.get("epigraph.sourceskipamount")
local parindent =
options.parindent ~= nil and SU.cast("glue", options.parindent)
or SILE.settings.get("epigraph.parindent")
local width =
options.width ~= nil and SU.cast("length", options.width)
or SILE.settings.get("epigraph.width")
local rule =
options.rule ~= nil and SU.cast("length", options.rule)
or SILE.settings.get("epigraph.rule")
local align =
options.align ~= nil and SU.cast("string", options.align)
or SILE.settings.get("epigraph.align")
local ragged =
options.ragged ~= nil and SU.cast("boolean", options.ragged)
or SILE.settings.get("epigraph.ragged")
local margin =
options.margin ~= nil and SU.cast("length", options.margin)
or SILE.settings.get("epigraph.margin")
local framew = SILE.typesetter.frame:width()
local epigraphw = width:absolute()
local skip = framew - epigraphw - margin
local source = omikhleia.extractFromTree(content, "source")
SILE.typesetter:leaveHmode()
SILE.typesetter:leaveHmode()
SILE.typesetter:pushVglue(beforeskipamount)
local l = ragged
and SILE.length(skip, 1e10) -- some real huge strech
or SILE.length({ length = skip })
local glue = SILE.nodefactory.glue({ width = l })
if align == "left" then
SILE.settings.set("document.rskip", glue)
SILE.settings.set("document.lskip", margin)
else
SILE.settings.set("document.lskip", glue)
SILE.settings.set("document.rskip", margin)
end
SILE.settings.set("document.parindent", parindent)
SILE.call("style:apply", { name = "epigraph:style" }, function()
SILE.process(content)
if rule:tonumber() ~= 0 then
SILE.typesetter:leaveHmode()
SILE.call("noindent")
SILE.call("raise", { height = "0.5ex" }, function ()
SILE.call("hrule", {width = epigraphw, height = rule })
end)
end
if source then
SILE.typesetter:leaveHmode(1)
if rule:tonumber() == 0 then
SILE.typesetter:pushVglue(sourceskipamount)
end
SILE.call("style:apply", { name = "epigraph:source:style" }, function()
SILE.call("raggedleft", {}, source)
end)
end
end)
SILE.typesetter:leaveHmode()
SILE.typesetter:pushVglue(afterskipamount)
end)
end, "Displays an epigraph.")
return {
documentation = [[\begin{document}
\script[src=packages/lorem]
%\script[src=packages/footnotes]
\script[src=packages/autodoc-extras]
\define[command=randomtext]{\lorem[words=18].}
\define[command=randomsource]{The Lorem Ipsum Book.}
The \doc:keyword{epigraph} package for SILE can be used to typeset a relevant quotation or
saying as an epigraph, usually at either the start or end of
a section. Various handles are provided to tweak the appearance.\footnote{This is
very loosely inspired from the LaTeX package by the same name.}
The \doc:keyword{epigraph} environment typesets an epigraph using the provided text.
An optional source (author, book name, etc.) can also be defined, with
the \doc:keyword{\\source} command in the text block.
By default the epigraph is placed at the right hand side of the text block,
and the source is typeset at the bottom right of the block.
\begin{epigraph}
\randomtext
\source{\randomsource}
\end{epigraph}
Without source:
\begin{epigraph}
\randomtext
\end{epigraph}
The default width for the epigraph block is \doc:keyword{epigraph.width}.
A \doc:keyword{width} option is also provided to override it on a single
epigraph\footnote{Basically, all global settings are also available as
command options (or reciprocally!), with the same name but the namespace left
out. For the sake of brevity, we will therefore omit the namespace from this
point onward.}.
It may be set to a relative value, e.g. 80 percents the current line
width:
\begin[width=80%lw]{epigraph}
\randomtext
\end{epigraph}
Or, pretty obviously, with a fixed value, e.g. \doc:keyword{8cm}.
\begin[width=8cm]{epigraph}
\randomtext
\end{epigraph}
The vertical skips are controlled by \doc:keyword{beforeskipamount},
\doc:keyword{afterskipamount}, \doc:keyword{sourceskipamount}. The latter is
only applied if there is a source specified and the epigraph doesn’t
show a rule (see further below).
In the following example, the two first options are set to
\doc:keyword{0.5cm} and the source skip is set to \doc:keyword{0}.
\begin[beforeskipamount=0.5cm, afterskipamount=0.5cm, sourceskipamount=0]{epigraph}
\randomtext
\source{\randomsource}
\end{epigraph}
By default, paragraph indentation is inherited from the document. It can be tuned
with \doc:keyword{parindent}, e.g. \doc:keyword{1em}.
\begin[parindent=1em]{epigraph}
\randomtext
\randomtext
\end{epigraph}
A rule may be shown below the epigraph text (and above the source, if
present — in that case, the vertical source skip amount does not
apply). Its thickness is controlled with \doc:keyword{rule} being set
to a non-null value, e.g. \doc:keyword{0.4pt}.
\begin[rule=0.4pt]{epigraph}
\randomtext
\source{\randomsource}
\end{epigraph}
Likewise, without source:
\begin[rule=0.4pt]{epigraph}
\randomtext
\end{epigraph}
By default, the epigraph text is justified. This may be changed setting
\doc:keyword{ragged} to \doc:keyword{true}.
The text is then ragged on the opposite side to the epigraph block,
so on the left for a right-aligned block.
\begin[ragged=true]{epigraph}
\randomtext
\source{\randomsource}
\end{epigraph}
It would be ragged on the right for a left-aligned epigraph block.
\begin[align=left, ragged=true]{epigraph}
\randomtext
\source{\randomsource}
\end{epigraph}
Here, we introduced the \doc:keyword{align} option, set to \doc:keyword{left}.
All the settings previously mentioned also apply to left-aligned
epigraphs, so we can of course tweak them at convenience.
\begin[align=left, rule=0.4pt, parindent=0, width=45%lw]{epigraph}
\randomtext
\source{\randomsource}
\end{epigraph}
It is also possible to offset the epigraph from the side (left or right) it is attached to, with the
\doc:keyword{margin} option, e.g. \doc:keyword{0.5cm}:
\begin[margin=0.5cm, rule=0.4pt]{epigraph}
\randomtext
\source{\randomsource}
\end{epigraph}
If you want to specify what styling the epigraph environment should use, you
can redefine the \doc:keyword{epigraph:style} style. By default it will be the same
as the surrounding document, just smaller.
The epigraph source is typeset in italic by default. It can be modified too,
by redefining \doc:keyword{epigraph:source:style}.\footnote{Refer to our
\doc:keyword{styles} package for details on how to set and configure style specifications.}
\style:redefine[name=epigraph:style, as=saved:epigraph:style]{\font[style=italic]}
\style:redefine[name=epigraph:source:style, as=saved:epigraph:source:style]{\font[style=normal]}
\begin{epigraph}
\randomtext
\source{\randomsource}
\end{epigraph}
\style:redefine[name=epigraph:style, from=saved:epigraph:style]
\style:redefine[name=epigraph:source:style, from=saved:epigraph:source:style]
As final notes, the epigraph source is intended to be short by nature, therefore
no specific effort has been made to correctly handle sources longer than
the epigraph block or even spanning on multiple lines.
Before anyone asks, the alignment options for an epigraph are to the left or to the right
of the frame only; notably, there is no intention to support centering. This author does not
think centered epigraphs are typographically sound.
For the curious-minded, it turns out that nested epigraphs do work somewhat as intended.
Your mileage may vary depending on the combination of settings.
This is not expected to be a highly requested feature and has not been thoroughly tested.
\begin[rule=0.4pt, width=80%lw]{epigraph}
\randomtext
\begin[width=80%lw]{epigraph}
Words — so innocent and powerless as they are, as standing in a dictionary,
how potent for good and evil they become in the hands of one who knows how to combine them.
\source{Nathaniel Hawthorne}
\end{epigraph}
\randomtext
\source{\randomsource}
\end{epigraph}
\end{document}]]
}
|
--[[
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
]]--
require 'torch'
local zmq = require 'lzmq'
-- A simple example of a learner class in Torch
local TorchLearner = torch.class('TorchLearner')
function TorchLearner:__init(port, rf, f)
self.port, self.t = port or 5556, 0
-- closures to execute upon reward and received bit
self.rf, self.f = rf, f
self.ctx = zmq.context()
self.skt = self.ctx:socket{zmq.PAIR,connect = 'tcp://localhost:'..self.port}
return self
end
function TorchLearner:run()
self.skt:send('hello')
while not self._stop do
local reward, err = self.skt:recv()
if err then error(err) end
self:rf(reward)
local m_in, err = self.skt:recv()
if err then error(err) end
self.skt:send(self:f(m_in))
self.t = self.t + 1
end
end
function TorchLearner:close()
self.skt:close()
self.ctx:term()
end
-- Test Learner
local message = '00101110'
local tl = TorchLearner.new(
tonumber(arg[1]),
function(self, r) end,
function(self, i)
local msg_out = self.t % 7 == 0 and math.random(0, 1) or 1
msg_out = self.t % 2 == 0 and message[self.t % 8] or msg_out
return msg_out
end
)
-- Go!
pcall(tl.run, tl)
tl:close()
|
class 'AttributeBoost' extends 'ActiveRecord::Base'
AttributeBoost:belongs_to 'Attribute'
|
--thanks to diriel, blert2112 and taikedz
local tamed_dragons = {}
--items and tools
minetest.register_craftitem("dmobs:dragon_gem_lightning", {
description = "Lightning Gem",
inventory_image = "dmobs_gem_lightning.png"
})
minetest.register_craftitem("dmobs:dragon_gem_ice", {
description = "Ice Gem",
inventory_image = "dmobs_gem_ice.png"
})
minetest.register_craftitem("dmobs:dragon_gem_fire", {
description = "Fire Gem",
inventory_image = "dmobs_gem_fire.png"
})
minetest.register_craftitem("dmobs:dragon_gem_poison", {
description = "Poison Gem",
inventory_image = "dmobs_gem_poison.png"
})
minetest.register_craftitem("dmobs:dragon_gem", {
description = "Dragon Gem",
inventory_image = "dmobs_gem.png"
})
----------
-- Eggs --
----------
-- Wild dragons
mobs:register_egg("dmobs:dragon", "Minor Dragon", "default_apple.png", 1)
mobs:register_egg("dmobs:dragon1", "Wild Fire Dragon", "default_apple.png", 1)
mobs:register_egg("dmobs:dragon2", "Wild Lightning Dragon", "dmobs_lightning.png", 1)
mobs:register_egg("dmobs:dragon3", "Wild Poison Dragon", "dmobs_poison.png", 1)
mobs:register_egg("dmobs:dragon4", "Wild Ice Dragon", "default_ice.png", 1)
mobs:register_egg("dmobs:dragon_great", "Boss Dragon", "dmobs_egg1.png", 1)
mobs:register_egg("dmobs:waterdragon", "Boss Waterdragon", "dmobs_egg4.png", 1)
mobs:register_egg("dmobs:wyvern", "Boss Wyvern", "dmobs_egg3.png", 1)
-- Tamed dragons
mobs:register_egg("dmobs:dragon_red", "Tamed Fire Dragon", "default_apple.png", 1)
mobs:register_egg("dmobs:dragon_black", "Tamed Lightning Dragon", "dmobs_lightning.png", 1)
mobs:register_egg("dmobs:dragon_green", "Tamed Poison Dragon", "dmobs_poison.png", 1)
mobs:register_egg("dmobs:dragon_blue", "Tamed Ice Dragon", "default_ice.png", 1)
mobs:register_egg("dmobs:dragon_great_tame", "Tamed Great Dragon",
"default_lava_source_animated.png", 1)
|
AddCSLuaFile()
DEFINE_BASECLASS( "gmod_wire_plug" )
ENT.PrintName = "Wire Plug"
ENT.WireDebugName = "DataPlug"
function ENT:GetSocketClass()
return "gmod_wire_datasocket"
end
if CLIENT then
function ENT:DrawEntityOutline() end -- never draw outline
return
end -- No more client
function ENT:Initialize()
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self.Memory = nil
self.Inputs = WireLib.CreateInputs(self, { "Memory" })
self.Outputs = WireLib.CreateOutputs(self, { "Connected" })
WireLib.TriggerOutput(self, "Connected", 0)
end
-- Override some functions from gmod_wire_plug
function ENT:Setup() end
function ENT:ResendValues() WireLib.TriggerOutput(self,"Connected",1) end
function ENT:ResetValues() WireLib.TriggerOutput(self,"Connected",0) end
function ENT:ReadCell( Address, infloop )
infloop = infloop or 0
if infloop > 50 then return end
Address = math.floor(Address)
if IsValid(self.Socket) and self.Socket.OwnMemory and self.Socket.OwnMemory.ReadCell then
return self.Socket.OwnMemory:ReadCell( Address, infloop + 1 )
end
return nil
end
function ENT:WriteCell( Address, value, infloop )
infloop = infloop or 0
if infloop > 50 then return end
Address = math.floor(Address)
if IsValid(self.Socket) and self.Socket.OwnMemory and self.Socket.OwnMemory.WriteCell then
return self.Socket.OwnMemory:WriteCell( Address, value, infloop + 1 )
end
return false
end
function ENT:TriggerInput(iname, value, iter)
if (iname == "Memory") then
self.Memory = self.Inputs.Memory.Src
if IsValid(self.Socket) then
self.Socket:SetMemory(self.Memory)
end
end
end
duplicator.RegisterEntityClass("gmod_wire_dataplug", WireLib.MakeWireEnt, "Data")
|
-- Point
Point = {}
function Point.new( x, y )
local self = setmetatable( {}, { __index = Point } )
self.x = x
self.y = y
return self
end
function Point:set( x, y )
self.x = x
self.y = y
end
function Point:getX()
return self.x
end
function Point:getY()
return self.y
end
function Point:toString()
str = string.format( "[%i, %i]", self.x, self.y )
return str
end |
return [[vac
vacancies
vacancy
vacant
vacantly
vacantness
vacate
vacated
vacates
vacating
vacation
vacationer
vacations
vacatur
vacaturs
vaccinal
vaccinate
vaccinated
vaccinates
vaccinator
vaccine
vaccines
vaccinia
vaccinial
vaccinium
vacciniums
vacherin
vacherins
vacillant
vacillate
vacillated
vacillates
vacked
vacking
vacs
vacua
vacuate
vacuated
vacuates
vacuating
vacuation
vacuations
vacuist
vacuists
vacuities
vacuity
vacuolar
vacuolate
vacuolated
vacuole
vacuoles
vacuous
vacuously
vacuum
vacuumed
vacuuming
vacuums
vade
vadose
vagabond
vagabonded
vagabonds
vagal
vagaries
vagarious
vagarish
vagary
vagi
vagile
vagility
vagina
vaginae
vaginal
vaginally
vaginant
vaginas
vaginate
vaginated
vaginismus
vaginitis
vaginula
vaginulae
vaginule
vaginules
vagitus
vagrancy
vagrant
vagrants
vagrom
vague
vagued
vagueing
vaguely
vagueness
vaguer
vagues
vaguest
vagus
vahine
vahines
vail
vailed
vailing
vails
vain
vainer
vainest
vainglory
vainly
vainness
vair
vairs
vairy
vaivode
vaivodes
vakass
vakasses
vakeel
vakeels
vakil
vakils
valance
valanced
valances
vale
valence
valences
valencies
valency
valent
valentine
valentines
valerian
valerianic
valerians
vales
valet
valeta
valetas
valete
valeted
valeting
valetings
valets
valgus
vali
valiance
valiances
valiancies
valiancy
valiant
valiantly
valid
validate
validated
validates
validating
validation
validity
validly
validness
valine
valis
valise
valises
vallar
vallary
vallecula
valleculae
vallecular
valley
valleys
vallum
vallums
valonia
valonias
valor
valorise
valorised
valorises
valorising
valorize
valorized
valorizes
valorizing
valorous
valorously
valour
valse
valsed
valses
valsing
valuable
valuables
valuably
valuate
valuated
valuates
valuating
valuation
valuations
valuator
valuators
value
valued
valueless
valuer
valuers
values
valuing
valuta
valutas
valval
valvar
valvate
valve
valved
valveless
valvelet
valvelets
valves
valvula
valvulae
valvular
valvule
valvules
valvulitis
vambrace
vambraced
vambraces
vamoose
vamoosed
vamooses
vamoosing
vamose
vamosed
vamoses
vamosing
vamp
vamped
vamper
vampers
vamping
vampings
vampire
vampired
vampires
vampiric
vampiring
vampirise
vampirised
vampirises
vampirism
vampirisms
vampirize
vampirized
vampirizes
vampish
vamplate
vamplates
vamps
van
vanadate
vanadates
vanadic
vanadinite
vanadium
vanadous
vandal
vandalise
vandalised
vandalises
vandalism
vandalize
vandalized
vandalizes
vandals
vandyked
vane
vaned
vaneless
vanes
vanessa
vanessas
vang
vangs
vanguard
vanguards
vanilla
vanillas
vanillin
vanish
vanished
vanisher
vanishers
vanishes
vanishing
vanishings
vanishment
vanitas
vanities
vanitories
vanitory
vanity
vanned
vanner
vanners
vanning
vannings
vanquish
vanquished
vanquisher
vanquishes
vans
vant
vantage
vantages
vantbrace
vantbraces
vanward
vapid
vapidity
vapidly
vapidness
vapor
vaporable
vapored
vaporetti
vaporetto
vaporettos
vaporific
vaporiform
vaporing
vaporise
vaporised
vaporiser
vaporisers
vaporises
vaporising
vaporize
vaporized
vaporizer
vaporizers
vaporizes
vaporizing
vaporosity
vaporous
vaporously
vapors
vaporware
vapour
vapoured
vapourer
vapourers
vapouring
vapourings
vapourish
vapours
vapourware
vapoury
vapulate
vapulated
vapulates
vapulating
vapulation
vaquero
vaqueros
vara
varactor
varactors
varan
varans
varas
vardies
vardy
vare
varec
varecs
vares
vareuse
vareuses
vargueÒo
vargueÒos
variable
variables
variably
variance
variances
variant
variants
variate
variated
variates
variating
variation
variations
variative
varicella
varicellar
varices
varicocele
varicose
varicosity
varicotomy
varied
variedly
variegate
variegated
variegates
variegator
varier
variers
varies
varietal
varietally
varieties
variety
varifocal
varifocals
variform
variola
variolar
variolas
variolate
variolated
variolates
variole
varioles
variolite
variolitic
varioloid
variolous
variometer
variorum
variorums
various
variously
variscite
varistor
varistors
varitypist
varix
varlet
varletess
varletry
varlets
varletto
varment
varments
varmint
varmints
varna
varnas
varnish
varnished
varnisher
varnishers
varnishes
varnishing
varsal
varsities
varsity
vartabed
vartabeds
varus
varuses
varve
varved
varvel
varvelled
varvels
varves
vary
varying
vas
vasa
vasal
vascula
vascular
vascularly
vasculum
vasculums
vase
vasectomy
vases
vasiform
vasoactive
vasomotor
vassal
vassalage
vassalages
vassaled
vassaless
vassaling
vassalry
vassals
vast
vaster
vastest
vastidity
vastier
vastiest
vastitude
vastitudes
vastity
vastly
vastness
vastnesses
vasts
vasty
vat
vatable
vatful
vatfuls
vatic
vaticide
vaticides
vaticinal
vaticinate
vats
vatted
vatter
vatting
vatu
vatus
vau
vaudeville
vaudoux
vaudouxed
vaudouxes
vaudouxing
vault
vaultage
vaulted
vaulter
vaulters
vaulting
vaultings
vaults
vaulty
vaunt
vauntage
vaunted
vaunter
vaunteries
vaunters
vauntery
vauntful
vaunting
vauntingly
vauntings
vaunts
vaunty
vaurien
vavasories
vavasory
vavasour
vavasours
vaward
veal
vealer
vealers
vealier
vealiest
veals
vealy
vectograph
vector
vectored
vectorial
vectoring
vectors
vedalia
vedalias
vedette
vedettes
veduta
vedute
vee
veena
veenas
veep
veeps
veer
veered
veeries
veering
veeringly
veerings
veers
veery
vees
veg
vega
vegan
veganism
vegans
vegas
vegeburger
veges
vegetable
vegetables
vegetably
vegetal
vegetals
vegetant
vegetarian
vegetate
vegetated
vegetates
vegetating
vegetation
vegetative
vegete
vegetive
veggie
veggies
vegie
vegies
vehemence
vehemency
vehement
vehemently
vehicle
vehicles
vehicular
veil
veiled
veiling
veilings
veilless
veils
veily
vein
veined
veinier
veiniest
veining
veinings
veinlet
veinlets
veinous
veins
veinstone
veinstuff
veiny
vela
velamen
velamina
velar
velaria
velaric
velarise
velarised
velarises
velarising
velarium
velariums
velarize
velarized
velarizes
velarizing
velars
velate
velated
velatura
veld
velds
veldschoen
veldskoen
veldt
veldts
veleta
veletas
veliger
veligers
velitation
vell
velleity
vellicate
vellicated
vellicates
vellon
vellons
vells
vellum
vellums
veloce
velocipede
velocities
velocity
velodrome
velodromes
velour
velours
veloutine
veloutines
velskoen
velum
velure
velutinous
velveret
velvet
velveted
velveteen
velveteens
velveting
velvetings
velvets
velvety
vena
venae
venal
venality
venally
venatic
venatical
venation
venational
venator
venatorial
venators
vend
vendace
vendaces
vended
vendee
vendees
vender
venders
vendetta
vendettas
vendeuse
vendeuses
vendible
vendibly
vending
vendition
venditions
vendor
vendors
vends
vendue
veneer
veneered
veneerer
veneerers
veneering
veneerings
veneers
venefic
venefical
veneficous
venerable
venerably
venerate
venerated
venerates
venerating
veneration
venerator
venerators
venereal
venerean
venereous
venerer
venerers
venery
venewe
venewes
veney
veneys
venge
vengeable
vengeance
vengeances
venged
vengeful
vengefully
venger
venges
venging
venial
veniality
venially
venin
venins
venire
venireman
venires
venison
venite
vennel
vennels
venography
venom
venomed
venomous
venomously
venoms
venose
venosity
venous
vent
ventage
ventages
ventail
ventails
vented
venter
venters
ventiduct
ventiducts
ventifact
ventifacts
ventil
ventilable
ventilate
ventilated
ventilates
ventilator
ventils
venting
ventings
ventose
ventosity
ventral
ventrally
ventrals
ventricle
ventricles
ventricose
ventricous
ventriculi
vents
venture
ventured
venturer
venturers
ventures
venturi
venturing
venturings
venturis
venturous
venue
venues
venule
venules
venus
venuses
venville
veracious
veracities
veracity
veranda
verandah
verandahed
verandahs
verandas
veratrin
veratrine
veratrum
veratrums
verb
verbal
verbalise
verbalised
verbalises
verbalism
verbalisms
verbalist
verbalists
verbality
verbalize
verbalized
verbalizes
verballed
verballing
verbally
verbals
verbarian
verbarians
verbatim
verbena
verbenas
verberate
verberated
verberates
verbiage
verbicide
verbicides
verbid
verbids
verbified
verbifies
verbify
verbifying
verbless
verbose
verbosely
verbosity
verboten
verbs
verdancy
verdant
verdantly
verdelho
verderer
verderers
verderor
verderors
verdet
verdict
verdicts
verdigris
verdin
verdins
verdit
verditer
verdits
verdoy
verdure
verdured
verdurous
verecund
verge
verged
vergence
vergencies
vergency
verger
vergers
vergership
verges
verging
verglas
verglases
veridical
veridicous
verier
veriest
verifiable
verified
verifier
verifiers
verifies
verify
verifying
verily
verism
verismo
verist
veristic
verists
veritable
veritably
verities
verity
verjuice
verjuiced
verjuices
verkramp
verkrampte
verligte
verligtes
vermal
vermeil
vermeiled
vermeiling
vermeils
vermes
vermian
vermicelli
vermicidal
vermicide
vermicides
vermicular
vermicule
vermicules
vermiform
vermifugal
vermifuge
vermifuges
vermilion
vermilions
vermin
verminate
verminated
verminates
verminous
verminy
vermis
vermises
vermouth
vermouths
vernacular
vernal
vernalise
vernalised
vernalises
vernality
vernalize
vernalized
vernalizes
vernally
vernant
vernation
vernations
vernicle
vernicles
vernier
verniers
vernissage
veronica
veronicas
verrel
verrels
verrey
verruca
verrucae
verrucas
verrucose
verrucous
verruga
verrugas
verry
vers
versal
versant
versatile
verse
versed
verselet
verselets
verser
versers
verses
verset
versets
versicle
versicles
versicular
versified
versifier
versifiers
versifies
versiform
versify
versifying
versin
versine
versines
versing
versings
versins
version
versional
versioner
versioners
versionist
versions
verso
versos
verst
versts
versus
versute
vert
vertebra
vertebrae
vertebral
vertebras
vertebrate
verted
vertex
vertexes
vertical
vertically
verticals
vertices
verticil
verticity
vertigines
vertigo
vertigoes
vertigos
verting
verts
vertu
vertus
vervain
vervains
verve
vervel
vervels
verves
vervet
vervets
very
vesica
vesicae
vesical
vesicant
vesicants
vesicate
vesicated
vesicates
vesicating
vesication
vesicatory
vesicle
vesicles
vesicula
vesiculae
vesicular
vesiculate
vesiculose
vespa
vespas
vesper
vesperal
vespers
vespertine
vespiaries
vespiary
vespine
vespoid
vessel
vessels
vest
vesta
vestal
vestals
vestas
vested
vestiaries
vestiary
vestibular
vestibule
vestibules
vestibulum
vestige
vestiges
vestigia
vestigial
vestigium
vestiment
vesting
vestings
vestiture
vestitures
vestment
vestmental
vestmented
vestments
vestral
vestries
vestry
vestryman
vestrymen
vests
vestural
vesture
vestured
vesturer
vesturers
vestures
vesturing
vesuvians
vet
vetch
vetches
vetchling
vetchlings
vetchy
veteran
veterans
veterinary
vetiver
veto
vetoed
vetoes
vetoing
vets
vetted
vetting
vettura
vetturas
vetturini
vetturino
vex
vexation
vexations
vexatious
vexatory
vexed
vexedly
vexedness
vexer
vexers
vexes
vexilla
vexillary
vexillum
vexing
vexingly
vexingness
vexings
vext
via
viability
viable
viaduct
viaducts
vial
vialful
vialfuls
vialled
vials
viameter
viameters
viand
viands
viatica
viaticum
viaticums
viator
viatorial
viators
vibe
vibes
vibex
vibices
vibist
vibists
vibracula
vibraculum
vibraharp
vibraharps
vibrancy
vibrant
vibrantly
vibraphone
vibrate
vibrated
vibrates
vibratile
vibrating
vibration
vibrations
vibrative
vibrato
vibrator
vibrators
vibratory
vibratos
vibrio
vibrios
vibriosis
vibrissa
vibrissae
vibrograph
vibrometer
vibronic
vibs
viburnum
viburnums
vicar
vicarage
vicarages
vicarate
vicaress
vicaresses
vicarial
vicariate
vicariates
vicarious
vicars
vicarship
vicarships
vicary
vice
viced
vicegerent
viceless
vicenary
vicennial
viceregent
vicereine
vicereines
viceroy
viceroys
vices
vicesimal
vicinage
vicinages
vicinal
vicing
vicinities
vicinity
viciosity
vicious
viciously
vicomte
vicomtes
vicomtesse
victim
victimise
victimised
victimiser
victimises
victimize
victimized
victimizer
victimizes
victimless
victims
victor
victoria
victorias
victories
victorine
victorines
victorious
victors
victory
victress
victresses
victrix
victrixes
victual
victualled
victualler
victuals
vicuÒa
vicuÒas
vid
vidame
vidames
vide
videlicet
videnda
videndum
video
videodisc
videodiscs
videodisk
videodisks
videoed
videofit
videofits
videoing
videophone
videos
videotape
videotaped
videotapes
videotex
videotexes
videotext
vidette
videttes
vidimus
vidimuses
vids
viduage
vidual
viduity
viduous
vie
vied
vielle
vielles
vier
viers
vies
view
viewable
viewed
viewer
viewers
viewership
viewfinder
viewier
viewiest
viewiness
viewing
viewings
viewless
viewlessly
viewly
viewphone
viewphones
viewpoint
viewpoints
views
viewy
vifda
vifdas
vigesimal
vigia
vigias
vigil
vigilance
vigilant
vigilante
vigilantes
vigilantly
vigils
vigneron
vignerons
vignette
vignetted
vignetter
vignetters
vignettes
vignetting
vignettist
vigor
vigorish
vigoro
vigorous
vigorously
vigour
vihara
viharas
vihuela
vihuelas
viking
vikingism
vikings
vilayet
vilayets
vild
vile
vilely
vileness
viler
vilest
viliaco
vilified
vilifier
vilifiers
vilifies
vilify
vilifying
vilipend
vilipended
vilipends
vill
villa
villadom
village
villager
villagers
villagery
villages
villain
villainage
villainess
villainies
villainous
villains
villainy
villan
villanage
villanages
villanelle
villanous
villans
villar
villas
villatic
villein
villeinage
villeins
villenage
villenages
villi
villiform
villose
villosity
villous
vills
villus
vim
vimana
vimanas
vimineous
vims
vin
vina
vinaceous
vinal
vinas
vinasse
vincible
vincula
vinculum
vindaloo
vindaloos
vindemial
vindemiate
vindicable
vindicate
vindicated
vindicates
vindicator
vindictive
vine
vined
vinegar
vinegared
vinegaring
vinegarish
vinegars
vinegary
viner
vineries
viners
vinery
vines
vineyard
vineyards
vinier
viniest
vining
vino
vinolent
vinologist
vinology
vinos
vinosity
vinous
vins
vint
vintage
vintaged
vintager
vintagers
vintages
vintaging
vintagings
vinted
vinting
vintner
vintners
vintries
vintry
vints
viny
vinyl
vinylidene
viol
viola
violable
violably
violaceous
violas
violate
violated
violater
violaters
violates
violating
violation
violations
violative
violator
violators
violence
violences
violent
violently
violer
violers
violet
violets
violin
violinist
violinists
violins
violist
violists
violone
violones
viols
viper
viperiform
viperine
viperish
viperous
viperously
vipers
viraginian
viraginous
virago
viragoes
viragoish
viragos
viral
vire
vired
virelay
virelays
virement
virements
virent
vireo
vireos
vires
virescence
virescent
virga
virgate
virgates
virge
virger
virgers
virgin
virginal
virginally
virginals
virginity
virginium
virginly
virgins
virgulate
virgule
virgules
viricidal
viricide
viricides
virid
viridian
viridite
viridity
virile
virilism
virility
viring
virino
virinos
virion
virions
virl
virls
viroid
virologist
virology
virose
viroses
virosis
virous
virtu
virtual
virtualism
virtualist
virtuality
virtually
virtue
virtueless
virtues
virtuosa
virtuose
virtuosi
virtuosic
virtuosity
virtuoso
virtuosos
virtuous
virtuously
virtus
virucidal
virucide
virucides
virulence
virulency
virulent
virulently
virus
viruses
vis
visa
visaed
visage
visaged
visages
visagiste
visagistes
visaing
visas
viscacha
viscachas
viscera
visceral
viscerate
viscerated
viscerates
viscid
viscidity
viscin
viscometer
viscometry
viscose
viscosity
viscount
viscountcy
viscounts
viscounty
viscous
viscum
viscus
vise
vised
viseing
vises
visibility
visible
visibly
visie
visies
visile
visiles
vising
vision
visional
visionally
visionary
visioned
visioner
visioners
visioning
visionings
visionist
visionists
visionless
visions
visit
visitable
visitant
visitants
visitation
visitative
visitator
visitators
visite
visited
visitee
visitees
visiter
visiters
visites
visiting
visitings
visitor
visitorial
visitors
visitress
visits
visive
visne
visnes
visnomy
vison
visons
visor
visored
visoring
visors
vista
vistaed
vistaing
vistal
vistaless
vistas
visto
vistos
visual
visualise
visualised
visualiser
visualises
visualist
visualists
visuality
visualize
visualized
visualizer
visualizes
visually
visuals
vita
vitae
vital
vitalise
vitalised
vitaliser
vitalisers
vitalises
vitalising
vitalism
vitalist
vitalistic
vitalists
vitalities
vitality
vitalize
vitalized
vitalizer
vitalizers
vitalizes
vitalizing
vitally
vitals
vitamin
vitamine
vitamines
vitaminise
vitaminize
vitamins
vitascope
vitascopes
vite
vitellary
vitelli
vitellicle
vitellin
vitelline
vitellines
vitellus
vitiable
vitiate
vitiated
vitiates
vitiating
vitiation
vitiations
vitiator
vitiators
viticetum
vitiferous
vitiligo
vitiosity
vitrage
vitrages
vitrail
vitrain
vitraux
vitreosity
vitreous
vitrescent
vitreum
vitric
vitrics
vitrified
vitrifies
vitriform
vitrify
vitrifying
vitrine
vitrines
vitriol
vitriolate
vitriolic
vitriolise
vitriolize
vitriols
vitta
vittae
vittate
vittle
vittles
vitular
vituline
vituperate
viva
vivace
vivacious
vivacities
vivacity
vivaed
vivaing
vivandier
vivandiËre
vivandiers
vivaria
vivaries
vivarium
vivariums
vivary
vivas
vivat
vivda
vivdas
vive
vively
vivency
viver
viverrine
vivers
vives
vivianite
vivid
vivider
vividest
vividity
vividly
vividness
vivific
vivified
vivifier
vivifiers
vivifies
vivify
vivifying
viviparism
viviparity
viviparous
vivipary
vivisect
vivisected
vivisector
vivisects
vivo
vivres
vixen
vixenish
vixenly
vixens
viz
vizament
vizard
vizarded
vizards
vizcacha
vizcachas
vizier
vizierate
vizierates
vizierial
viziers
viziership
vizir
vizirate
vizirates
vizirial
vizirs
vizor
vizored
vizoring
vizors
vizsla
vizslas
vlei
vleis
voar
voars
vocab
vocable
vocables
vocabular
vocabulary
vocabulist
vocal
vocalese
vocalic
vocalion
vocalions
vocalise
vocalised
vocaliser
vocalisers
vocalises
vocalising
vocalism
vocalisms
vocalist
vocalists
vocality
vocalize
vocalized
vocalizer
vocalizers
vocalizes
vocalizing
vocally
vocalness
vocals
vocation
vocational
vocations
vocative
vocatives
voces
vociferant
vociferate
vociferous
vocoder
vocoders
vocular
vocule
vocules
vodka
vodkas
voe
voes
voetganger
voetstoots
vogie
vogue
vogued
vogueing
voguer
voguers
vogues
voguey
voguing
voguish
voice
voiced
voiceful
voiceless
voicer
voicers
voices
voicing
voicings
void
voidable
voidance
voidances
voided
voidee
voidees
voider
voiders
voiding
voidings
voidness
voidnesses
voids
voil‡
voile
voiles
voiture
voiturier
voituriers
voivode
voivodes
vol
vola
volable
volae
volage
volant
volante
volar
volaries
volary
volas
volatic
volatile
volatiles
volatilise
volatility
volatilize
volcanian
volcanic
volcanise
volcanised
volcanises
volcanism
volcanist
volcanists
volcanize
volcanized
volcanizes
volcano
volcanoes
vole
voled
voleries
volery
voles
volet
volets
voling
volitant
volitate
volitated
volitates
volitating
volitation
volitient
volition
volitional
volitive
volitives
volitorial
volk
volksraad
volksraads
volley
volleyed
volleyer
volleyers
volleying
volleys
volost
volosts
volplane
volplaned
volplanes
volplaning
vols
volt
volta
voltage
voltages
voltaic
voltaism
voltameter
volte
voltes
voltigeur
voltigeurs
voltinism
voltmeter
voltmeters
volts
volubility
voluble
volubly
volucrine
volume
volumed
volumes
volumeter
volumeters
volumetric
voluminal
voluming
voluminous
volumist
volumists
voluntary
volunteer
volunteers
voluptuary
voluptuous
vˆluspa
vˆluspas
volutation
volute
voluted
volutes
volutin
volution
volutions
volutoid
volva
volvas
volvate
volvulus
volvuluses
vomer
vomerine
vomers
vomica
vomicas
vomit
vomited
vomiting
vomitings
vomitive
vomito
vomitories
vomitorium
vomitory
vomits
vomitus
vomituses
voodoo
voodooed
voodooing
voodooism
voodooist
voodooists
voodoos
voracious
voracities
voracity
voraginous
vorago
voragoes
vorant
vorpal
vortex
vortexes
vortical
vortically
vorticella
vortices
vorticism
vorticist
vorticists
vorticity
vorticose
vorticular
votaress
votaresses
votaries
votarist
votarists
votary
vote
voted
voteen
voteless
voter
voters
votes
voting
votive
votress
votresses
vouch
vouched
vouchee
vouchees
voucher
vouchers
vouches
vouching
vouchsafe
vouchsafed
vouchsafes
vouge
vouges
voulu
voussoir
voussoired
voussoirs
vow
vowed
vowel
vowelise
vowelised
vowelises
vowelising
vowelize
vowelized
vowelizes
vowelizing
vowelled
vowelless
vowelling
vowels
vower
vowers
vowess
vowesses
vowing
vows
vox
voyage
voyageable
voyaged
voyager
voyagers
voyages
voyageur
voyageurs
voyaging
voyeur
voyeurism
voyeurs
vraic
vraicker
vraickers
vraicking
vraickings
vraics
vril
vroom
vroomed
vrooming
vrooms
vrouw
vrouws
vrow
vrows
vug
vuggy
vugs
vulcan
vulcanian
vulcanic
vulcanise
vulcanised
vulcanises
vulcanism
vulcanist
vulcanists
vulcanite
vulcanize
vulcanized
vulcanizes
vulcans
vulgar
vulgarian
vulgarians
vulgarise
vulgarised
vulgarises
vulgarism
vulgarisms
vulgarity
vulgarize
vulgarized
vulgarizes
vulgarly
vulgars
vulgate
vulgates
vulgo
vulgus
vulguses
vuln
vulned
vulnerable
vulnerary
vulnerate
vulning
vulns
vulpicide
vulpicides
vulpine
vulpinism
vulpinite
vulsella
vulsellae
vulsellum
vulture
vultures
vulturine
vulturish
vulturism
vulturn
vulturns
vulturous
vulva
vulval
vulvar
vulvas
vulvate
vulviform
vulvitis
vum
vying
vyingly]] |
--[[
/////// //////////////////
/////// PROJECT: MTA iLife - German Fun Reallife Gamemode
/////// VERSION: 1.7.2
/////// DEVELOPERS: See DEVELOPERS.md in the top folder
/////// LICENSE: See LICENSE.md in the top folder
/////// /////////////////
]]
local QuestID = 1
local Quest = Quests[QuestID]
Quest.Texts = {
["Accepted"] = "Erf\\uelle die Quest!",
["Finished"] = "Gebe die Quest ab!"
}
Quest.playerReachedRequirements =
function(thePlayer, bOutput)
-- This quest can not be accepted!
return false
end
Quest.getTaskPosition =
function()
--Should return int, dim, x, y, z
return 0,0,0,0,0
end
Quest.onAccept =
function(thePlayer)
return true
end
Quest.onProgress =
function(thePlayer)
return true
end
Quest.onResume =
function(thePlayer)
return true
end
Quest.onFinish =
function(thePlayer)
return true
end
Quest.onAbort =
function(thePlayer)
return true
end
----outputDebugString("Loaded Questscript: server/Classes/Quest/Scripts/"..tostring(QuestID)..".lua") |
local THIS_DIR = (... or ''):match("(.-)[^%.]+$") or '.'
function pixelTextStubbed(x, y, text, color)
-- noop for running from terminal
end
function drawPixelStubbed(x, y, color)
-- noop for running from terminal
end
function drawLineStubbed(x, y, x2, y2, color)
-- noop for running from terminal
end
function drawBoxStubbed(x, y, x2, y2, line, background)
-- noop for running from terminal
end
function RGBA_bizhawk(red, green, blue, alpha)
return (
bit.band(blue, 0xFF) +
bit.lshift(bit.band(green, 0xFF), 8) +
bit.lshift(bit.band(red, 0xFF), 16) +
bit.lshift(bit.band(alpha, 0xFF), 24))
end
function RGBA_snes9x(red, green, blue, alpha)
return (
bit.band(alpha, 0xFF) +
bit.lshift(bit.band(blue, 0xFF), 8) +
bit.lshift(bit.band(green, 0xFF), 16) +
bit.lshift(bit.band(red, 0xFF), 24))
end
if gui then
-- good enough check; bizhawk only function
if gui.pixelText then
running_in = 'bizhawk'
gui.defaultTextBackground(nil)
pixelText = gui.pixelText
drawPixel = gui.drawPixel
drawLine = gui.drawLine
drawBox = gui.drawBox
RGBA = RGBA_bizhawk
else
running_in = 'snes9x' -- assumption
pixelText = gui.text
drawPixel = gui.pixel
drawLine = gui.line
drawBox = gui.rect
RGBA = RGBA_snes9x
end
else
-- terminal?
running_in = 'unknown'
pixeltext = pixelTextStubbed
drawPixel = drawPixelStubbed
drawLine = drawLineStubbed
drawBox = drawBoxStubbed
RGBA = RGBA_snes9x
end
function is_bizhawk()
return (running_in == 'bizhawk')
end
function is_snes9x()
return (running_in == 'snes9x')
end
function file_line_iterator(file)
if is_bizhawk() then
-- bizhawk gives unknown lua error after using file:lines/io.lines
-- so avoid it by using an intermediary string
local data = file:read('*all')
if data:sub(-1) ~= '\n' then
data = data .. '\n'
end
return data:gmatch("(.-)\n")
else
return file:lines()
end
end
function pretty_string(table)
-- build a string otherwise
local result = nil
if type(table) == 'table' then
local result = ''
for i, value in ipairs(table) do
result = result .. pretty_string(value) .. ', '
end
for key, value in pairs(table) do
if type(key) ~= 'number' then
result = result .. key .. '=' .. pretty_string(value) .. ', '
end
end
if result ~= '' then
result = result:sub(1, -3)
end
return '{' .. result .. '}'
end
-- fallback; not a table
return tostring(table)
end
function Set (list)
local set = {}
for _, l in ipairs(list) do
set[l] = true
end
return set
end
function draw_text(base_x, base_y, lines)
for i, line in pairs(lines) do
local y = base_y + (8 * (i - 1))
-- color arg ignored in 9x.. but no black outline in bizhawk
pixelText(base_x, y, line, 'yellow')
end
end
function draw_text_above(base_x, base_y, lines)
draw_text(base_x, base_y - (8 * #lines), lines)
end
function tohex(str)
local result = {}
local CHARSET='0123456789ABCDEF'
for i = 1,#str do
local value = str:byte(i)
local high = bit.rshift(value, 4) + 1 -- stupid lua
local low = bit.band(value, 0x0F) + 1 -- stupid lua
local highnib = CHARSET:sub(high,high):byte()
local lownib = CHARSET:sub(low,low):byte()
table.insert(result, CHARSET:sub(high,high):byte())
table.insert(result, CHARSET:sub(low,low):byte())
end
return string.char(unpack(result))
end
return {
pretty_string = pretty_string,
Set = Set,
draw_text = draw_text,
draw_text_above = draw_text_above,
file_line_iterator = file_line_iterator,
running_in = running_in,
is_bizhawk = is_bizhawk,
is_snes9x = is_snes9x,
pixelText = pixelText,
drawPixel = drawPixel,
drawLine = drawLine,
drawBox = drawBox,
RGBA = RGBA,
}
|
--====================================================================--
--== Hex Color File
--====================================================================--
local data = {
["Alice Blue"] = "#F0F8FF",
["Antique White"] = "#FAEBD7",
["Aqua"] = "#00FFFF",
["Aquamarine"] = "#7FFFD4",
["Azure"] = "#F0FFFF",
["Beige"] = "#F5F5DC",
["Bisque"] = "#FFE4C4",
["Black"] = "#000000",
["Blanched Almond"] = "#FFEBCD",
["Blue"] = "#0000FF",
["Blue Violet"] = "#8A2BE2",
["Brown"] = "#A52A2A",
["Burlywood"] = "#DEB887",
["Cadet Blue"] = "#5F9EA0",
["Chartreuse"] = "#7FFF00",
["Chocolate"] = "#D2691E",
["Coral"] = "#5F9EA0",
["Cornflower"] = "#6495ED",
["Cornsilk"] = "#FFF8DC",
["Crimson"] = "#DC143C",
["Cyan"] = "#00FFFF",
["Dark Blue"] = "#00008B",
["Dark Cyan"] = "#008B8B",
["Dark Goldenrod"] = "#B8860B",
["Dark Gray"] = "#A9A9A9",
["Dark Green"] = "#006400",
["Dark Khaki"] = "#BDB76B",
["Dark Magenta"] = "#8B008B",
["Dark Olive Green"] = "#556B2F",
["Dark Orange"] = "#FF8C00",
["Dark Orchid"] = "#9932CC",
["Dark Red"] = "#8B0000",
["Dark Salmon"] = "#E9967A",
["Dark Sea Green"] = "#8FBC8F",
["Dark Slate Blue"] = "#483D8B",
["Dark Slate Gray"] = "#2F4F4F",
["Dark Turquoise"] = "#00CED1",
["Dark Violet"] = "#9400D3",
["Deep Pink"] = "#FF1493",
["Deep Sky Blue"] = "#00BFFF",
["Dim Gray"] = "#696969",
["Dodger Blue"] = "#1E90FF",
["Firebrick"] = "#B22222",
["Floral White"] = "#FFFAF0",
["Forest Green"] = "#228B22",
["Fuchsia"] = "#FF00FF",
["Gainsboro"] = "#DCDCDC",
["Ghost White"] = "#F8F8FF",
["Gold"] = "#FFD700",
["Goldenrod"] = "#DAA520",
["Gray"] = "#BEBEBE",
["Gray-X11"] = "#BEBEBE",
["Gray-W3C"] = "#808080",
["Green-X11"] = "#00FF00",
["Green-W3C"] = "#008000",
["Green Yellow"] = "#ADFF2F",
["Honeydew"] = "#F0FFF0",
["Hot Pink"] = "#FF69B4",
["Indian Red"] = "#CD5C5C",
["Indigo"] = "#4B0082",
["Ivory"] = "#FFFFF0",
["Khaki"] = "#F0E68C",
["Lavender"] = "#E6E6FA",
["Lavender Blush"] = "#FFF0F5",
["Lawn Green"] = "#7CFC00",
["Lemon Chiffon"] = "#FFFACD",
["Light Blue"] = "#ADD8E6",
["Light Coral"] = "#F08080",
["Light Cyan"] = "#E0FFFF",
["Light Goldenrod"] = "#FAFAD2",
["Light Gray"] = "#D3D3D3",
["Light Green"] = "#90EE90",
["Light Pink"] = "#FFB6C1",
["Light Salmon"] = "#FFA07A",
["Light Sea Green"] = "#20B2AA",
["Light Sky Blue"] = "#87CEFA",
["Light Slate Gray"] = "#778899",
["Light Steel Blue"] = "#B0C4DE",
["Light Yellow"] = "#FFFFE0",
["Lime-W3C"] = "#00FF00",
["Lime Green"] = "#32CD32",
["Linen"] = "#FAF0E6",
["Magenta"] = "#FF00FF",
["Maroon-X11"] = "#B03060",
["Maroon-W3C"] = "#7F0000",
["Medium Aquamarine"] = "#66CDAA",
["Medium Blue"] = "#0000CD",
["Medium Orchid"] = "#BA55D3",
["Medium Purple"] = "#9370DB",
["Medium Sea Green"] = "#3CB371",
["Medium Slate Blue"] = "#7B68EE",
["Medium Spring Green"] = "#00FA9A",
["Medium Turquoise"] = "#48D1CC",
["Medium Violet Red"] = "#C71585",
["Midnight Blue"] = "#191970",
["Mint Cream"] = "#F5FFFA",
["Misty Rose"] = "#FFE4E1",
["Moccasin"] = "#FFE4B5",
["Navajo White"] = "#FFDEAD",
["Navy"] = "#000080",
["Old Lace"] = "#FDF5E6",
["Olive"] = "#808000",
["Olive Drab"] = "#6B8E23",
["Orange"] = "#FFA500",
["Orchid"] = "#DA70D6",
["Pale Goldenrod"] = "#EEE8AA",
["Pale Green"] = "#98FB98",
["Pale Turquoise"] = "#AFEEEE",
["Pale Violet Red"] = "#DB7093",
["Papaya Whip"] = "#FFEFD5",
["Peach Puff"] = "#FFDAB9",
["Peru"] = "#CD853F",
["Pink"] = "#FFC0CB",
["Plum"] = "#DDA0DD",
["Powder Blue"] = "#B0E0E6",
["Purple-X11"] = "#A020F0",
["Purple-W3C"] = "#7F007F",
["Red"] = "#FF0000",
["Rosy Brown"] = "#BC8F8F",
["Royal Blue"] = "#4169E1",
["Saddle Brown"] = "#8B4513",
["Salmon"] = "#FA8072",
["Sandy Brown"] = "#F4A460",
["Sea Green"] = "#2E8B57",
["Seashell"] = "#FFF5EE",
["Sienna"] = "#A0522D",
["Silver-W3C"] = "#C0C0C0",
["Sky Blue"] = "#87CEEB",
["Slate Blue"] = "#6A5ACD",
["Slate Gray"] = "#708090",
["Snow"] = "#FFFAFA",
["Spring Green"] = "#00FF7F",
["Steel Blue"] = "#4682B4",
["Tan"] = "#D2B48C",
["Teal"] = "#008080",
["Thistle"] = "#D8BFD8",
["Tomato"] = "#FF6347",
["Turquoise"] = "#40E0D0",
["Violet"] = "#EE82EE",
["Wheat"] = "#F5DEB3",
["White"] = "#FFFFFF",
["White Smoke"] = "#F5F5F5",
["Yellow"] = "#FFFF00",
["Yellow Green"] = "#9ACD32",
["Dark Red"] = "#8B0000",
["Dark Red"] = "#8B0000"
}
--====================================================================--
--== Color File Setup
--====================================================================--
local function initializeColors( Kolor )
Kolor.addColors( data, {format=Kolor.dRGBA} )
end
return {
initialize=initializeColors
} |
sniper_second_attack = class({})
sniper_ex_second_attack = class({})
function sniper_second_attack:GetCastAnimationCustom()
if self:GetLevel() >= 2 then
return ACT_DOTA_DIE
end
return ACT_DOTA_CAST_ABILITY_1
end
function sniper_second_attack:GetAnimationTranslate()
if self:GetLevel() >= 2 then
return "overkilled"
end
return
end
function sniper_second_attack:GetPlaybackRateOverride()
if self:GetLevel() >= 2 then
return 0.8
end
return 0.5
end
function sniper_second_attack:GetCastPointSpeed()
if self:GetLevel() >= 2 then
return 60
end
return 0
end
function sniper_second_attack:GetCastPoint()
if IsServer() then
if self:GetCaster():FindModifierByName('modifier_upgrade_sniper_snipe_cast_fast') then
return 0.3
end
return self.BaseClass.GetCastPoint(self)
end
end
function sniper_second_attack:OnAbilityPhaseStart()
EmitGlobalSound("Ability.AssassinateLoad")
self.efx = ParticleManager:CreateParticle('particles/econ/items/wisp/wisp_relocate_channel_ti7.vpcf', PATTACH_ABSORIGIN_FOLLOW, self:GetCaster())
ParticleManager:SetParticleControlEnt(self.efx, 1, self:GetCaster(), PATTACH_ABSORIGIN_FOLLOW, 'attach_hitloc', self:GetCaster():GetAbsOrigin(), false)
return true
end
function sniper_second_attack:OnAbilityPhaseInterrupted()
DEFX(self.efx, true)
end
function sniper_second_attack:OnSpellStart()
if self.efx then
DEFX(self.efx, false)
end
local caster = self:GetCaster()
local origin = caster:GetOrigin()
local point = CustomAbilitiesLegacy:GetCursorPosition(self)
local damage = self:GetSpecialValueFor("ability_damage")
local projectile_direction = Direction2D(origin, point)
local projectile_speed = self:GetSpecialValueFor("projectile_speed")
local stun_duration = self:GetSpecialValueFor("stun_duration")
local mana_gain_pct = self:GetSpecialValueFor("mana_gain_pct")
local reduction_per_hit = self:GetSpecialValueFor("reduction_per_hit")/100
local min_damage = self:GetSpecialValueFor("min_damage")
local damage_table = {
damage_type = DAMAGE_TYPE_MAGICAL,
}
CustomEntitiesLegacy:ProjectileAttack(caster, {
tProjectile = {
EffectName = "particles/sniper/sniper_second_attack.vpcf",
vSpawnOrigin = origin + Vector(projectile_direction.x * 45, projectile_direction.y * 45, 96),
fDistance = self:GetSpecialValueFor("projectile_distance") ~= 0 and self:GetSpecialValueFor("projectile_distance") or self:GetCastRange(Vector(0,0,0), nil),
fStartRadius = self:GetSpecialValueFor("hitbox"),
Source = caster,
vVelocity = projectile_direction * projectile_speed,
UnitBehavior = PROJECTILES_NOTHING,
TreeBehavior = PROJECTILES_NOTHING,
WallBehavior = PROJECTILES_DESTROY,
GroundBehavior = PROJECTILES_NOTHING,
fGroundOffset = 0,
UnitTest = function(_self, unit) return unit:GetUnitName() ~= "npc_dummy_unit" and not CustomEntitiesLegacy:Allies(_self.Source, unit) end,
OnUnitHit = function(_self, unit)
-- Count targets
local counter = -1
for k, v in pairs(_self.tHitLog) do
counter = counter + 1
end
local final_damage = damage * (1 - (counter * reduction_per_hit))
if final_damage < min_damage then
final_damage = min_damage
end
damage_table.victim = unit
damage_table.attacker = _self.Source
damage_table.damage = final_damage
if counter < 1 and _self.Source == caster then
if CustomEntitiesLegacy:ProvidesMana(unit) then
CustomEntitiesLegacy:GiveManaAndEnergyPercent(caster, mana_gain_pct, true)
end
end
ApplyDamage(damage_table)
unit:AddNewModifier(_self.Source, self , "modifier_generic_stunned", { duration = stun_duration})
self:PlayEffectsOnHit(unit)
end,
OnFinish = function(_self, pos)
self:PlayEffectsOnFinish(pos, 'particles/units/heroes/hero_sniper/sniper_assassinate_impact_sparks.vpcf')
end,
}
})
if self:GetLevel() >= 2 then
EFX('particles/econ/items/phantom_lancer/phantom_lancer_fall20_immortal/phantom_lancer_fall20_immortal_doppelganger_aoe_gold_bits.vpcf', PATTACH_ABSORIGIN_FOLLOW, caster, {
cp1 = origin,
release = true
})
else
EFX('particles/sniper/sniper_second_attack_endcap_model.vpcf', PATTACH_ABSORIGIN_FOLLOW, caster, {
cp1 = origin + projectile_direction * 100,
cp1f = caster:GetForwardVector(),
release = true
})
end
self:PlayEffectsOnCast()
caster:StartGestureWithPlaybackRate(ACT_DOTA_ATTACK, 3.0)
LinkAbilityCooldowns(caster, 'sniper_ex_second_attack')
end
function sniper_second_attack:PlayEffectsOnCast()
EmitSoundOn("Ability.Assassinate", self:GetCaster())
end
function sniper_second_attack:PlayEffectsOnFinish(pos, particle_cast)
local caster = self:GetCaster()
EmitSoundOnLocationWithCaster(pos, "Hero_Sniper.AssassinateDamage", caster)
local effect_cast = ParticleManager:CreateParticle(particle_cast, PATTACH_ABSORIGIN, caster)
ParticleManager:SetParticleControl(effect_cast, 0, pos)
ParticleManager:SetParticleControl(effect_cast, 1, pos)
ParticleManager:SetParticleControl(effect_cast, 3, pos)
ParticleManager:ReleaseParticleIndex(effect_cast)
end
function sniper_second_attack:PlayEffectsOnHit(hTarget)
local caster = self:GetCaster()
EmitSoundOn("Hero_Sniper.AssassinateDamage", caster)
local particle_cast = "particles/units/heroes/hero_sniper/sniper_assassinate_impact_blood.vpcf"
local effect_cast = ParticleManager:CreateParticle(particle_cast, PATTACH_ABSORIGIN_FOLLOW, hTarget)
ParticleManager:SetParticleControl(effect_cast, 0, hTarget:GetOrigin())
ParticleManager:SetParticleControl(effect_cast, 1, hTarget:GetOrigin())
ParticleManager:ReleaseParticleIndex(effect_cast)
end
function sniper_ex_second_attack:GetCastAnimationCustom()
return ACT_DOTA_CAST_ABILITY_1
end
function sniper_ex_second_attack:GetPlaybackRateOverride()
return 0.5
end
function sniper_ex_second_attack:GetCastPointSpeed()
return 0
end
sniper_ex_second_attack.PlayEffectsOnCast = sniper_second_attack.PlayEffectsOnCast
sniper_ex_second_attack.PlayEffectsOnFinish = sniper_second_attack.PlayEffectsOnFinish
sniper_ex_second_attack.PlayEffectsOnHit = sniper_second_attack.PlayEffectsOnHit
function sniper_ex_second_attack:OnSpellStart()
local caster = self:GetCaster()
local origin = caster:GetOrigin()
local point = CustomAbilitiesLegacy:GetCursorPosition(self)
local projectile_direction = Direction2D(origin, point)
local projectile_origin = origin + Vector(projectile_direction.x * 45, projectile_direction.y * 45, 96),
self:ThrowProjectile(origin + Vector(0, 0, 96), projectile_direction, true, caster)
self:PlayEffectsOnCast()
caster:StartGestureWithPlaybackRate(ACT_DOTA_ATTACK, 1.5)
LinkAbilityCooldowns(caster, 'sniper_second_attack')
end
function sniper_ex_second_attack:ThrowProjectile(vOrigin, vDirection, bFirstTime, hSource)
local damage = self:GetSpecialValueFor("ability_damage")
local projectile_speed = self:GetSpecialValueFor("projectile_speed")
local root_duration = self:GetSpecialValueFor("root_duration")
local reduction_per_hit = self:GetSpecialValueFor("reduction_per_hit")/100
local min_damage = self:GetSpecialValueFor("min_damage")
local damage_table = {
damage_type = DAMAGE_TYPE_MAGICAL,
}
CustomEntitiesLegacy:ProjectileAttack(caster, {
tProjectile = {
EffectName = "particles/sniper/sniper_ex_second_attack_new.vpcf",
vSpawnOrigin = vOrigin,
fDistance = self:GetSpecialValueFor("projectile_distance") ~= 0 and self:GetSpecialValueFor("projectile_distance") or self:GetCastRange(Vector(0,0,0), nil),
fStartRadius = self:GetSpecialValueFor("hitbox"),
Source = hSource,
vVelocity = vDirection * projectile_speed,
UnitBehavior = PROJECTILES_NOTHING,
TreeBehavior = PROJECTILES_NOTHING,
WallBehavior = PROJECTILES_DESTROY,
GroundBehavior = PROJECTILES_NOTHING,
fGroundOffset = 0,
UnitTest = function(_self, unit) return unit:GetUnitName() ~= "npc_dummy_unit" and not CustomEntitiesLegacy:Allies(_self.Source, unit) end,
OnUnitHit = function(_self, unit)
-- Count targets
local counter = -1
for k, v in pairs(_self.tHitLog) do
counter = counter + 1
end
local final_damage = damage * (1 - (counter * reduction_per_hit))
if final_damage < min_damage then
final_damage = min_damage
end
damage_table.victim = unit
damage_table.attacker = _self.Source
damage_table.damage = final_damage
ApplyDamage(damage_table)
unit:AddNewModifier(_self.Source, self , "modifier_generic_root", { duration = root_duration})
self:PlayEffectsOnHit(unit)
end,
OnFinish = function(_self, pos)
if self:GetLevel() >= 2 and bFirstTime then
local new_direction = ((_self.Source:GetAbsOrigin() + Vector(0, 0, 96)) - pos):Normalized()
local projectile_origin = pos + Vector(new_direction.x * 45, new_direction.y * 45, 0)
self:ThrowProjectile(projectile_origin, new_direction, false, _self.Source)
end
self:PlayEffectsOnFinish(pos, 'particles/econ/items/sniper/sniper_fall20_immortal/sniper_fall20_immortal_base_attack_impact.vpcf')
end,
}
})
end
if IsClient() then require("wrappers/abilities") end
Abilities.Castpoint(sniper_second_attack)
Abilities.Castpoint(sniper_ex_second_attack) |
-- Localize globals
local Settings, assert, minetest, modlib, next, pairs, ipairs, string, setmetatable, table, type, unpack
= Settings, assert, minetest, modlib, next, pairs, ipairs, string, setmetatable, table, type, unpack
-- Set environment
local _ENV = ...
setfenv(1, _ENV)
max_wear = 2 ^ 16 - 1
function override(function_name, function_builder)
local func = minetest[function_name]
minetest["original_" .. function_name] = func
minetest[function_name] = function_builder(func)
end
local jobs = modlib.heap.new(function(a, b)
return a.time < b.time
end)
local job_metatable = {
__index = {
cancel = function(self)
self.cancelled = true
end
}
}
local time = 0
function after(seconds, func, ...)
local job = setmetatable({
time = time + seconds,
func = func,
...
}, job_metatable)
jobs:push(job)
return job
end
minetest.register_globalstep(function(dtime)
time = time + dtime
local job = jobs[1]
while job and job.time <= time do
if not job.cancelled then
job.func(unpack(job))
end
jobs:pop()
job = jobs[1]
end
end)
function register_globalstep(interval, callback)
if type(callback) ~= "function" then
return
end
local time = 0
minetest.register_globalstep(function(dtime)
time = time + dtime
if time >= interval then
callback(time)
-- TODO ensure this breaks nothing
time = time % interval
end
end)
end
form_listeners = {}
function register_form_listener(formname, func)
local current_listeners = form_listeners[formname] or {}
table.insert(current_listeners, func)
form_listeners[formname] = current_listeners
end
local icall = modlib.table.icall
minetest.register_on_player_receive_fields(function(player, formname, fields)
icall(form_listeners[formname] or {}, player, fields)
end)
function texture_modifier_inventorycube(face_1, face_2, face_3)
return "[inventorycube{" .. string.gsub(face_1, "%^", "&")
.. "{" .. string.gsub(face_2, "%^", "&")
.. "{" .. string.gsub(face_3, "%^", "&")
end
function get_node_inventory_image(nodename)
local n = minetest.registered_nodes[nodename]
if not n then
return
end
local tiles = {}
for l, tile in pairs(n.tiles or {}) do
tiles[l] = (type(tile) == "string" and tile) or tile.name
end
local chosen_tiles = { tiles[1], tiles[3], tiles[5] }
if #chosen_tiles == 0 then
return false
end
if not chosen_tiles[2] then
chosen_tiles[2] = chosen_tiles[1]
end
if not chosen_tiles[3] then
chosen_tiles[3] = chosen_tiles[2]
end
local img = minetest.registered_items[nodename].inventory_image
if string.len(img) == 0 then
img = nil
end
return img or texture_modifier_inventorycube(chosen_tiles[1], chosen_tiles[2], chosen_tiles[3])
end
function check_player_privs(playername, privtable)
local privs=minetest.get_player_privs(playername)
local missing_privs={}
local to_lose_privs={}
for priv, expected_value in pairs(privtable) do
local actual_value=privs[priv]
if expected_value then
if not actual_value then
table.insert(missing_privs, priv)
end
else
if actual_value then
table.insert(to_lose_privs, priv)
end
end
end
return missing_privs, to_lose_privs
end
--+ Improved base64 decode removing valid padding
function decode_base64(base64)
local len = base64:len()
local padding_char = base64:sub(len, len) == "="
if padding_char then
if len % 4 ~= 0 then
return
end
if base64:sub(len-1, len-1) == "=" then
base64 = base64:sub(1, len-2)
else
base64 = base64:sub(1, len-1)
end
end
return minetest.decode_base64(base64)
end
local object_refs = minetest.object_refs
--+ Objects inside radius iterator. Uses a linear search.
function objects_inside_radius(pos, radius)
radius = radius^2
local id, object, object_pos
return function()
repeat
id, object = next(object_refs, id)
object_pos = object:get_pos()
until (not object) or ((pos.x-object_pos.x)^2 + (pos.y-object_pos.y)^2 + (pos.z-object_pos.z)^2) <= radius
return object
end
end
--+ Objects inside area iterator. Uses a linear search.
function objects_inside_area(min, max)
local id, object, object_pos
return function()
repeat
id, object = next(object_refs, id)
object_pos = object:get_pos()
until (not object) or (
(min.x <= object_pos.x and min.y <= object_pos.y and min.z <= object_pos.z)
and
(max.y >= object_pos.x and max.y >= object_pos.y and max.z >= object_pos.z)
)
return object
end
end
--: node_or_groupname "modname:nodename", "group:groupname[,groupname]"
--> function(nodename) -> whether node matches
function nodename_matcher(node_or_groupname)
if modlib.text.starts_with(node_or_groupname, "group:") then
local groups = modlib.text.split(node_or_groupname:sub(("group:"):len() + 1), ",")
return function(nodename)
for _, groupname in pairs(groups) do
if minetest.get_item_group(nodename, groupname) == 0 then
return false
end
end
return true
end
else
return function(nodename)
return nodename == node_or_groupname
end
end
end
do
local default_create, default_free = function() return {} end, modlib.func.no_op
local metatable = {__index = function(self, player)
if type(player) == "userdata" then
return self[player:get_player_name()]
end
end}
function playerdata(create, free)
create = create or default_create
free = free or default_free
local data = {}
minetest.register_on_joinplayer(function(player)
data[player:get_player_name()] = create(player)
end)
minetest.register_on_leaveplayer(function(player)
data[player:get_player_name()] = free(player)
end)
setmetatable(data, metatable)
return data
end
end
function connected_players()
-- TODO cache connected players
local connected_players = minetest.get_connected_players()
local index = 0
return function()
index = index + 1
return connected_players[index]
end
end
function set_privs(name, priv_updates)
local privs = minetest.get_player_privs(name)
for priv, grant in pairs(priv_updates) do
if grant then
privs[priv] = true
else
-- May not be set to false; Minetest treats false as truthy in this instance
privs[priv] = nil
end
end
return minetest.set_player_privs(name, privs)
end
function register_on_leaveplayer(func)
return minetest["register_on_" .. (minetest.is_singleplayer() and "shutdown" or "leaveplayer")](func)
end
--! experimental
function get_mod_info()
-- TODO validate modnames
local modnames = minetest.get_modnames()
local mod_info = {}
for _, mod in pairs(modnames) do
local info
local function read_file(filename)
return modlib.file.read(modlib.mod.get_resource(mod, filename))
end
local mod_conf = Settings(modlib.mod.get_resource(mod, "mod.conf"))
if mod_conf then
info = {}
mod_conf = mod_conf:to_table()
local function read_depends(field)
local depends = {}
for depend in (mod_conf[field] or ""):gmatch"[^,]+" do
depends[depend:match"^%s*(.-)%s*$"] = true
end
info[field] = depends
end
read_depends"depends"
read_depends"optional_depends"
else
info = {
description = read_file"description.txt",
depends = {},
optional_depends = {}
}
local depends_txt = read_file"depends.txt"
if depends_txt then
for _, dependency in ipairs(modlib.table.map(modlib.text.split(depends_txt or "", "\n"), modlib.text.trim_spacing)) do
local modname, is_optional = dependency:match"(.+)(%??)"
table.insert(is_optional == "" and info.depends or info.optional_depends, modname)
end
end
end
if info.name == nil then
info.name = mod
end
mod_info[mod] = info
end
return mod_info
end
--! experimental
function get_mod_load_order()
local mod_info = get_mod_info()
local mod_load_order = {}
-- If there are circular soft dependencies, it is possible that a mod is loaded, but not in the right order
-- TODO somehow maximize the number of soft dependencies fulfilled in case of circular soft dependencies
local function load(mod)
if mod.status == "loaded" then
return true
end
if mod.status == "loading" then
return false
end
-- TODO soft/vs hard loading status, reset?
mod.status = "loading"
-- Try hard dependencies first. These must be fulfilled.
for depend in pairs(mod.depends) do
if not load(mod_info[depend]) then
return false
end
end
-- Now, try soft dependencies.
for depend in pairs(mod.optional_depends) do
-- Mod may not exist
if mod_info[depend] then
load(mod_info[depend])
end
end
mod.status = "loaded"
table.insert(mod_load_order, mod)
return true
end
for _, mod in pairs(mod_info) do
assert(load(mod))
end
return mod_load_order
end
|
return {
version = "1.4",
luaversion = "5.1",
tiledversion = "1.4.3",
orientation = "orthogonal",
renderorder = "right-down",
width = 32,
height = 22,
tilewidth = 8,
tileheight = 8,
nextlayerid = 8,
nextobjectid = 570,
properties = {},
tilesets = {
{
name = "dungeon_tileset",
firstgid = 1,
filename = "../../../../../tiled/new_tilesets/dungeon_tileset.tsx",
tilewidth = 8,
tileheight = 8,
spacing = 0,
margin = 0,
columns = 64,
image = "../../graphics/dungeon_tilesets.png",
imagewidth = 512,
imageheight = 128,
objectalignment = "unspecified",
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 8,
height = 8
},
properties = {},
terrains = {},
tilecount = 1024,
tiles = {}
},
{
name = "collide8",
firstgid = 1025,
filename = "../../../../../tiled/new_tilesets/collide8.tsx",
tilewidth = 8,
tileheight = 8,
spacing = 0,
margin = 0,
columns = 1,
image = "../../graphics/collider8.png",
imagewidth = 8,
imageheight = 8,
objectalignment = "unspecified",
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 8,
height = 8
},
properties = {},
terrains = {},
tilecount = 1,
tiles = {}
}
},
layers = {
{
type = "tilelayer",
x = 0,
y = 0,
width = 32,
height = 22,
id = 1,
name = "Ground_layer",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 0, 0, 0, 0,
0, 0, 0, 0, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 0, 0, 0, 0,
0, 0, 0, 0, 427, 428, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 427, 428, 0, 0, 0, 0,
0, 0, 0, 0, 491, 492, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 491, 492, 0, 0, 0, 0,
0, 0, 0, 0, 427, 428, 0, 0, 427, 428, 427, 428, 0, 0, 427, 428, 427, 428, 0, 0, 427, 428, 427, 428, 0, 0, 427, 428, 0, 0, 0, 0,
0, 0, 0, 0, 491, 492, 0, 0, 491, 492, 491, 492, 0, 0, 491, 492, 491, 492, 0, 0, 491, 492, 491, 492, 0, 0, 491, 492, 0, 0, 0, 0,
0, 0, 0, 0, 427, 428, 0, 0, 427, 428, 0, 0, 427, 428, 427, 428, 427, 428, 427, 428, 0, 0, 427, 428, 0, 0, 427, 428, 0, 0, 0, 0,
0, 0, 0, 0, 491, 492, 0, 0, 491, 492, 0, 0, 491, 492, 491, 492, 491, 492, 491, 492, 0, 0, 491, 492, 0, 0, 491, 492, 0, 0, 0, 0,
0, 0, 0, 0, 427, 428, 0, 0, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 0, 0, 427, 428, 0, 0, 0, 0,
0, 0, 0, 0, 491, 492, 0, 0, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 0, 0, 491, 492, 0, 0, 0, 0,
0, 0, 0, 0, 427, 428, 0, 0, 0, 0, 0, 0, 0, 0, 427, 428, 427, 428, 0, 0, 0, 0, 0, 0, 0, 0, 427, 428, 0, 0, 0, 0,
0, 0, 0, 0, 491, 492, 0, 0, 0, 0, 0, 0, 0, 0, 491, 492, 491, 492, 0, 0, 0, 0, 0, 0, 0, 0, 491, 492, 0, 0, 0, 0,
0, 0, 0, 0, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 427, 428, 0, 0, 0, 0,
0, 0, 0, 0, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 491, 492, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
},
{
type = "tilelayer",
x = 0,
y = 0,
width = 32,
height = 22,
id = 3,
name = "Collision_layer",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 803, 815, 815, 809, 815, 815, 807, 815, 809, 815, 815, 807, 815, 815, 815, 815, 872, 815, 815, 874, 815, 872, 815, 815, 874, 815, 815, 868, 0, 0,
0, 0, 816, 803, 815, 815, 807, 815, 809, 815, 815, 807, 815, 809, 815, 815, 815, 815, 874, 815, 872, 815, 815, 874, 815, 872, 815, 815, 868, 880, 0, 0,
0, 0, 816, 816, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 880, 880, 0, 0,
0, 0, 687, 805, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 870, 752, 0, 0,
0, 0, 805, 816, 0, 0, 681, 682, 681, 682, 681, 682, 681, 682, 681, 682, 681, 682, 681, 682, 681, 682, 681, 682, 681, 682, 0, 0, 880, 870, 0, 0,
0, 0, 816, 687, 0, 0, 745, 746, 745, 746, 745, 746, 745, 746, 745, 746, 745, 746, 745, 746, 745, 746, 745, 746, 745, 746, 0, 0, 752, 880, 0, 0,
0, 0, 687, 805, 0, 0, 681, 682, 0, 0, 0, 0, 555, 556, 0, 0, 0, 0, 683, 684, 0, 0, 0, 0, 681, 682, 0, 0, 870, 752, 0, 0,
0, 0, 610, 611, 0, 0, 745, 746, 0, 0, 0, 0, 619, 620, 0, 0, 0, 0, 747, 748, 0, 0, 0, 0, 745, 746, 0, 0, 880, 880, 0, 0,
0, 0, 417, 428, 0, 0, 681, 682, 0, 0, 555, 556, 0, 0, 0, 0, 0, 0, 0, 0, 683, 684, 0, 0, 681, 682, 0, 0, 880, 880, 0, 0,
0, 0, 417, 492, 0, 0, 745, 746, 0, 0, 619, 620, 0, 0, 0, 0, 0, 0, 0, 0, 747, 748, 0, 0, 745, 746, 0, 0, 880, 880, 0, 0,
0, 0, 547, 548, 0, 0, 681, 682, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 681, 682, 0, 0, 880, 880, 0, 0,
0, 0, 751, 869, 0, 0, 745, 746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 745, 746, 0, 0, 806, 688, 0, 0,
0, 0, 816, 751, 0, 0, 681, 682, 681, 682, 681, 682, 681, 682, 0, 0, 0, 0, 681, 682, 681, 682, 681, 682, 681, 682, 0, 0, 688, 880, 0, 0,
0, 0, 869, 816, 0, 0, 745, 746, 745, 746, 745, 746, 745, 746, 0, 0, 0, 0, 745, 746, 745, 746, 745, 746, 745, 746, 0, 0, 880, 806, 0, 0,
0, 0, 751, 869, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 806, 688, 0, 0,
0, 0, 816, 816, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 880, 880, 0, 0,
0, 0, 816, 867, 879, 879, 871, 879, 873, 879, 879, 871, 879, 873, 879, 879, 879, 879, 810, 879, 808, 879, 879, 810, 879, 808, 879, 879, 804, 880, 0, 0,
0, 0, 867, 879, 879, 873, 879, 879, 871, 879, 873, 879, 879, 871, 879, 879, 879, 879, 808, 879, 879, 810, 879, 808, 879, 879, 810, 879, 879, 804, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
},
{
type = "tilelayer",
x = 0,
y = 0,
width = 32,
height = 22,
id = 5,
name = "Wall_layer",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
940, 929, 164, 164, 164, 801, 164, 164, 164, 164, 801, 164, 164, 813, 164, 164, 164, 164, 878, 164, 164, 866, 164, 164, 164, 164, 866, 164, 164, 164, 993, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 685, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 750, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 811, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 876, 940,
940, 546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 875, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 812, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 749, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 686, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 940,
940, 993, 164, 164, 164, 865, 164, 164, 164, 164, 865, 164, 164, 877, 164, 164, 164, 164, 814, 164, 164, 802, 164, 164, 164, 164, 802, 164, 164, 164, 929, 940,
940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940, 940
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 6,
name = "Collide",
visible = false,
opacity = 0.5,
offsetx = 0,
offsety = 0,
properties = {},
objects = {
{
id = 181,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 182,
name = "",
type = "",
shape = "rectangle",
x = 32,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 183,
name = "",
type = "",
shape = "rectangle",
x = 40,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 184,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 185,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 186,
name = "",
type = "",
shape = "rectangle",
x = 64,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 187,
name = "",
type = "",
shape = "rectangle",
x = 72,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 188,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 189,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 190,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 191,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 207,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 208,
name = "",
type = "",
shape = "rectangle",
x = 32,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 209,
name = "",
type = "",
shape = "rectangle",
x = 40,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 210,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 211,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 212,
name = "",
type = "",
shape = "rectangle",
x = 64,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 213,
name = "",
type = "",
shape = "rectangle",
x = 72,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 214,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 215,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 216,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 217,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 218,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 221,
name = "",
type = "",
shape = "rectangle",
x = 136,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 233,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 40,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 234,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 48,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 235,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 236,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 237,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 238,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 241,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 242,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 112,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 243,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 244,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 245,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 136,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 246,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 144,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 288,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 289,
name = "",
type = "",
shape = "rectangle",
x = 128,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 386,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 387,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 388,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 389,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 390,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 391,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 392,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 393,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 394,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 395,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 396,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 400,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 40,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 401,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 48,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 402,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 403,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 404,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 405,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 406,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 407,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 112,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 408,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 409,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 410,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 136,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 411,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 144,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 412,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 413,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 414,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 415,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 416,
name = "",
type = "",
shape = "rectangle",
x = 128,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 417,
name = "",
type = "",
shape = "rectangle",
x = 136,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 418,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 419,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 420,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 421,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 422,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 423,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 424,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 425,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 426,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 427,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 428,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 434,
name = "",
type = "",
shape = "rectangle",
x = 16,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 435,
name = "",
type = "",
shape = "rectangle",
x = 8,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 436,
name = "",
type = "",
shape = "rectangle",
x = 0,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 437,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 438,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 439,
name = "",
type = "",
shape = "rectangle",
x = 16,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 440,
name = "",
type = "",
shape = "rectangle",
x = 0,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 441,
name = "",
type = "",
shape = "rectangle",
x = 8,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 442,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 443,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 444,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 445,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 446,
name = "",
type = "",
shape = "rectangle",
x = 64,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 447,
name = "",
type = "",
shape = "rectangle",
x = 72,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 448,
name = "",
type = "",
shape = "rectangle",
x = 64,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 449,
name = "",
type = "",
shape = "rectangle",
x = 72,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 450,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 451,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 452,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 453,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 454,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 455,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 456,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 457,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 458,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 459,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 460,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 461,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 462,
name = "",
type = "",
shape = "rectangle",
x = 128,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 463,
name = "",
type = "",
shape = "rectangle",
x = 136,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 464,
name = "",
type = "",
shape = "rectangle",
x = 128,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 465,
name = "",
type = "",
shape = "rectangle",
x = 136,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 466,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 467,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 468,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 469,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 470,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 471,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 472,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 473,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 474,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 475,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 476,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 477,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 478,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 479,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 480,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 481,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 490,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 491,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 492,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 493,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 494,
name = "",
type = "",
shape = "rectangle",
x = 64,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 495,
name = "",
type = "",
shape = "rectangle",
x = 72,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 496,
name = "",
type = "",
shape = "rectangle",
x = 64,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 497,
name = "",
type = "",
shape = "rectangle",
x = 72,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 498,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 499,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 500,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 501,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 502,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 503,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 504,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 505,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 514,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 515,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 516,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 517,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 518,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 519,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 520,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 521,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 522,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 523,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 524,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 525,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 526,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 527,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 528,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 529,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 530,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 531,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 532,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 533,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 534,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 535,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 536,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 537,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 538,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 539,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 540,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 112,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 541,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 112,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 542,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 543,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 544,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 545,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 546,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 547,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 548,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 549,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 550,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 551,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 552,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 112,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 553,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 112,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 554,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 555,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 556,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 557,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 558,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 559,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 560,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 561,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 562,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 563,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 564,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 565,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 566,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 567,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 568,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
},
{
id = 569,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 1025,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 7,
name = "Door",
visible = false,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
objects = {
{
id = 316,
name = "left",
type = "",
shape = "rectangle",
x = 16,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 411,
visible = true,
properties = {}
}
}
}
}
}
|
-- QUATRON CUBE OBJECT --
-- Create the Quatron Cube base Object --
QC = {
ent = nil,
player = "",
MF = nil,
entID = 0,
spriteID = 0,
consumption = 0,
updateTick = 60,
lastUpdate = 0,
dataNetwork = nil,
energyLevel = 1
}
-- Constructor --
function QC:new(object)
if object == nil then return end
local t = {}
local mt = {}
setmetatable(t, mt)
mt.__index = QC
t.ent = object
if object.last_user == nil then return end
t.player = object.last_user.name
t.MF = getMF(t.player)
t.entID = object.unit_number
-- Draw the Sprite --
UpSys.addObj(t)
return t
end
-- Reconstructor --
function QC:rebuild(object)
if object == nil then return end
local mt = {}
mt.__index = QC
setmetatable(object, mt)
end
-- Destructor --
function QC:remove()
-- Destroy the Sprite --
rendering.destroy(self.spriteID)
-- Remove from the Update System --
UpSys.removeObj(self)
-- Remove from the Data Network --
if self.dataNetwork ~= nil and getmetatable(self.dataNetwork) ~= nil then
self.dataNetwork:removeObject(self)
end
end
-- Is valid --
function QC:valid()
if self.ent ~= nil and self.ent.valid then return true end
return false
end
-- Item Tags to Content --
function QC:itemTagsToContent(tags)
self.ent.energy = tags.energy or 0
self.energyLevel = tags.purity or 1
end
-- Content to Item Tags --
function QC:contentToItemTags(tags)
if EI.energy(self) <= 0 then return end
tags.set_tag("Infos", {energy=self.ent.energy, purity=EI.energyLevel(self)})
tags.custom_description = {"", tags.prototype.localised_description, {"item-description.QuatronCubeC", math.floor(self.ent.energy), string.format("%.3f", EI.energyLevel(self))}}
end
-- Update --
function QC:update()
-- Set the lastUpdate variable --
self.lastUpdate = game.tick
-- Check the Validity --
if valid(self) == false then
self:remove()
return
end
-- Update the Sprite --
local spriteNumber = math.ceil(EI.energy(self)/EI.maxEnergy(self)*16)
rendering.destroy(self.spriteID)
self.spriteID = rendering.draw_sprite{sprite="CubeChargeSprite" .. spriteNumber, x_scale=1/7, y_scale=1/7, target=self.ent, surface=self.ent.surface, target_offset={0, -0.3}, render_layer=131}
-- Balance the Quatron with neighboring Quatron Users --
EI.shareEnergy(self)
end
-- Tooltip Infos --
function QC:getTooltipInfos(GUITable, mainFrame, justCreated)
if justCreated == true then
-- Set the GUI Title --
GUITable.vars.GUITitle.caption = {"gui-description.QuatronCube"}
-- Set the Main Frame Height --
-- mainFrame.style.height = 100
-- Create the Information Frame --
local infoFrame = GAPI.addFrame(GUITable, "InformationFrame", mainFrame, "vertical", true)
infoFrame.style = "MFFrame1"
infoFrame.style.vertically_stretchable = true
infoFrame.style.minimal_width = 200
infoFrame.style.left_margin = 3
infoFrame.style.left_padding = 3
infoFrame.style.right_padding = 3
end
-- Get the Frame --
local infoFrame = GUITable.vars.InformationFrame
-- Clear the Frame --
infoFrame.clear()
-- Create the Tite --
GAPI.addSubtitle(GUITable, "", infoFrame, {"gui-description.Information"})
-- Add the Quatron Charge --
GAPI.addLabel(GUITable, "", infoFrame, {"gui-description.QuatronCharge", Util.toRNumber(EI.energy(self))}, _mfOrange)
GAPI.addProgressBar(GUITable, "", infoFrame, "", EI.energy(self) .. "/" .. EI.maxEnergy(self), false, _mfPurple, EI.energy(self)/EI.maxEnergy(self), 100)
-- Create the Quatron Purity --
GAPI.addLabel(GUITable, "", infoFrame, {"gui-description.Quatronlevel", string.format("%.3f", EI.energyLevel(self))}, _mfOrange)
GAPI.addProgressBar(GUITable, "", infoFrame, "", "", false, _mfPurple, EI.energyLevel(self)/20, 100)
-- Add the Input/Output Speed Label --
local inputLabel = GAPI.addLabel(GUITable, "", infoFrame, {"gui-description.QuatronInputSpeed", Util.toRNumber(EI.speed(self))}, _mfOrange)
inputLabel.style.top_margin = 10
GAPI.addLabel(GUITable, "", infoFrame, {"gui-description.QuatronOutputSpeed", Util.toRNumber(EI.speed(self))}, _mfOrange)
end |
local key = KEYS[1]
local interval_milliseconds = tonumber(ARGV[1]) or 0
local limit = tonumber(ARGV[2]) or 0
if interval_milliseconds == 0 then
return {false, 0}
end
redis.replicate_commands()
redis.call('set', KEYS[1], 0, 'PX', interval_milliseconds, 'NX')
local usage = redis.call('incr', KEYS[1])
if usage > limit then
return {true, usage}
end
return {false, usage} |
local SubStruct = require "roomgen.SubStruct"
local SSVending = Class.create("SSVending", SubStruct)
function SSVending:makeStructure()
local xOffset = 2
if self.x + xOffset + 2> self.maxX then return end
-- self.room:addRectangleObj("lvl.ObjVending",self.x,self.y - 1,2,2,nil)
end
return SSVending |
local Slot = require('motras_slot')
local t = require('motras_types')
local AssetBlueprint = require('motras_asset_blueprint')
local Blueprint = {}
function Blueprint:new(o)
o = o or {}
o.tpf2Template = o.tpf2Template or {}
o.platformDecorationFunc = function () end
o.trackDecorationFunc = function () end
setmetatable(o, self)
self.__index = self
return o
end
function Blueprint:addModuleToTemplate(slotId, moduleName)
self.tpf2Template[slotId] = moduleName
return self
end
function Blueprint:createStation(pattern)
local startY, endY = pattern:getVerticalRange()
for iY = startY, endY do
local startX, endX = pattern:getHorizontalRange(iY)
for iX = startX, endX do
local slotType, moduleName, options = pattern:getTypeAndModule(iX, iY)
self:addModuleToTemplate(Slot.makeId{type = slotType, gridX = iX, gridY = iY}, moduleName)
local assetBlueprint = AssetBlueprint:new{
blueprint = self,
gridX = iX,
gridStartX = startX,
gridEndX = endX,
gridY = iY,
gridStartY = startY,
gridEndY = endY,
options = options or {}
}
if Slot.getGridTypeFromSlotType(slotType) == t.GRID_TRACK then
self.trackDecorationFunc(assetBlueprint)
end
if Slot.getGridTypeFromSlotType(slotType) == t.GRID_PLATFORM then
self.platformDecorationFunc(assetBlueprint)
end
end
end
return self
end
function Blueprint:decorateEachPlatform(platformDecorationFunc)
self.platformDecorationFunc = platformDecorationFunc
return self
end
function Blueprint:decorateEachTrack(trackDecorationFunc)
self.trackDecorationFunc = trackDecorationFunc
return self
end
function Blueprint:toTpf2Template()
return self.tpf2Template
end
return Blueprint |
add_requires("fmt >=8.1.1", "lyra >=1.6")
add_rules("mode.debug", "mode.release")
set_languages("c++20")
target("wtf-sorter")
set_kind("binary")
add_files("src/*.cpp")
add_headerfiles("src/*.h")
add_packages("fmt", "lyra")
|
local Test=import('SluaTestCase');
local t=Test();
local mm = {t:GetMap(), slua.Map(EPropertyClass.Int, EPropertyClass.Str)}
local function test()
for i,v in ipairs(mm) do
local map = v
map:Add(5,"500")
print("map:Get(5)", map:Get(5))
map:Add(1,"100")
map:Add(2,"200")
print("map num", map:Num())
map:Add(8,"800")
map:Add(9,"900")
print("map num", map:Num())
print("map get(1)", map:Get(1))
print("map get(2)", map:Get(2))
print("map remove(1)", map:Remove(1))
print("map num", map:Num())
print("map:Get(8)", map:Get(8))
print("map:Get(9)", map:Get(9))
local v,r = map:Get(100)
print("map:Get(100)", v, r)
print("map num", map:Num())
print("foreach begin...")
for k,v in map:Pairs() do
print(k,v)
end
print("foreach end...")
print("foreach begin...")
for k,v in pairs(map) do
print(k,v)
end
print("foreach end...")
map:Clear()
assert(map:Num()==0)
end
local mm = t.maps
mm:Add("name","bill")
mm:Add("age","12")
assert(t.maps:Num()==2)
assert(t.maps:Get("name")=="bill")
assert(t.maps:Get("age")=="12")
mm:Clear()
assert(t.maps:Num()==0)
end
TestMap={}
function TestMap.update()
test()
end
return TestMap |
sArenaMixin = {};
sArenaFrameMixin = {};
sArenaMixin.layouts = {};
sArenaMixin.portraitClassIcon = true;
sArenaMixin.portraitSpecIcon = true;
sArenaMixin.defaultSettings = {
profile = {
currentLayout = "BlizzArena",
classColors = true,
showNames = true,
statusText = {
usePercentage = false,
alwaysShow = true,
},
drCategories = {
Stun = true,
Incapacitate = true,
Disorient = true,
Silence = true,
Root = true,
},
layoutSettings = {},
},
};
local db;
local auraList;
local interruptList;
local drList;
local drTime = 18.5;
local severityColor = {
[1] = { 0, 1, 0, 1},
[2] = { 1, 1, 0, 1},
[3] = { 1, 0, 0, 1},
};
local drCategories = {
"Stun",
"Incapacitate",
"Disorient",
"Silence",
"Root",
};
local classIcons = {
["DRUID"] = 625999,
["HUNTER"] = 626000,
["MAGE"] = 626001,
["MONK"] = 626002,
["PALADIN"] = 626003,
["PRIEST"] = 626004,
["ROGUE"] = 626005,
["SHAMAN"] = 626006,
["WARLOCK"] = 626007,
["WARRIOR"] = 626008,
["DEATHKNIGHT"] = 135771,
["DEMONHUNTER"] = 1260827,
};
local emptyLayoutOptionsTable = {
notice = {
name = "The selected layout doesn't appear to have any settings.",
type = "description",
},
};
local blizzFrame;
local FEIGN_DEATH = GetSpellInfo(5384); -- Localized name for Feign Death
-- make local vars of globals that are used with high frequency
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo;
local UnitGUID = UnitGUID;
local UnitChannelInfo = UnitChannelInfo;
local GetTime = GetTime;
local After = C_Timer.After;
local UnitAura = UnitAura;
local SetPortraitToTexture = SetPortraitToTexture; -- not called often, but had problems in the past
local UnitHealthMax = UnitHealthMax;
local UnitHealth = UnitHealth;
local UnitPowerMax = UnitPowerMax;
local UnitPower = UnitPower;
local UnitPowerType = UnitPowerType;
local UnitIsDeadOrGhost = UnitIsDeadOrGhost;
local FindAuraByName = AuraUtil.FindAuraByName;
local ceil = ceil;
local AbbreviateLargeNumbers = AbbreviateLargeNumbers;
local UnitFrameHealPredictionBars_Update = UnitFrameHealPredictionBars_Update;
local function UpdateBlizzVisibility(instanceType)
-- if blizz arena frames are disabled or hidden, ARENA_CROWD_CONTROL_SPELL_UPDATE will not fire
-- just move the frames off screen
if ( InCombatLockdown() ) then return end
if ( not blizzFrame ) then
blizzFrame = CreateFrame("Frame", nil, UIParent);
blizzFrame:SetSize(1, 1);
blizzFrame:SetPoint("RIGHT", UIParent, "RIGHT", 500, 0);
blizzFrame:Show();
end
for i = 1, 5 do
local arenaFrame = _G["ArenaEnemyFrame"..i];
local prepFrame = _G["ArenaPrepFrame"..i];
arenaFrame:ClearAllPoints();
prepFrame:ClearAllPoints();
-- frames should be visible in battlegrounds
if ( instanceType == "arena" ) then
arenaFrame:SetParent(blizzFrame);
arenaFrame:SetPoint("CENTER", blizzFrame, "CENTER");
prepFrame:SetParent(blizzFrame);
prepFrame:SetPoint("CENTER", blizzFrame, "CENTER");
else
arenaFrame:SetParent("ArenaEnemyFrames");
prepFrame:SetParent("ArenaPrepFrames");
if ( i == 1 ) then
arenaFrame:SetPoint("TOP", arenaFrame:GetParent(), "TOP");
prepFrame:SetPoint("TOP", prepFrame:GetParent(), "TOP");
else
arenaFrame:SetPoint("TOP", "ArenaEnemyFrame"..i-1, "BOTTOM", 0, -20);
prepFrame:SetPoint("TOP", "ArenaPrepFrame"..i-1, "BOTTOM", 0, -20);
end
end
end
end
-- Parent Frame
function sArenaMixin:OnLoad()
auraList = self.auraList;
interruptList = self.interruptList;
drList = self.drList;
self:RegisterEvent("PLAYER_LOGIN");
self:RegisterEvent("PLAYER_ENTERING_WORLD");
end
function sArenaMixin:OnEvent(event)
if ( event == "PLAYER_LOGIN" ) then
self:Initialize();
self:UnregisterEvent("PLAYER_LOGIN");
elseif ( event == "PLAYER_ENTERING_WORLD" ) then
local _, instanceType = IsInInstance();
UpdateBlizzVisibility(instanceType);
self:SetMouseState(true);
if ( instanceType == "arena" ) then
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
else
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
end
elseif ( event == "COMBAT_LOG_EVENT_UNFILTERED" ) then
local _, combatEvent, _, _, _, _, _, destGUID, _, _, _, spellID, _, _, auraType = CombatLogGetCurrentEventInfo();
for i = 1, 3 do
if destGUID == UnitGUID("arena"..i) then
self["arena"..i]:FindInterrupt(combatEvent, spellID);
if ( auraType == "DEBUFF" ) then
self["arena"..i]:FindDR(combatEvent, spellID);
end
return;
end
end
end
end
local function ChatCommand(input)
if not input or input:trim() == "" then
LibStub("AceConfigDialog-3.0"):Open("sArena");
else
LibStub("AceConfigCmd-3.0").HandleCommand("sArena", "sarena", "sArena", input);
end
end
function sArenaMixin:Initialize()
if ( db ) then return end
self.db = LibStub("AceDB-3.0"):New("sArena3DB", self.defaultSettings, true)
db = self.db;
db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig")
db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig")
db.RegisterCallback(self, "OnProfileReset", "RefreshConfig")
self.optionsTable.handler = self;
self.optionsTable.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(db)
LibStub("AceConfig-3.0"):RegisterOptionsTable("sArena", self.optionsTable);
LibStub("AceConfigDialog-3.0"):AddToBlizOptions("sArena");
LibStub("AceConsole-3.0"):RegisterChatCommand("sarena", ChatCommand);
self:SetLayout(nil, db.profile.currentLayout);
SetCVar("showArenaEnemyFrames", 1);
end
function sArenaMixin:RefreshConfig()
self:SetLayout(nil, db.profile.currentLayout);
end
function sArenaMixin:SetLayout(_, layout)
if ( InCombatLockdown() ) then return end
layout = sArenaMixin.layouts[layout] and layout or "BlizzArena";
db.profile.currentLayout = layout;
self.layoutdb = self.db.profile.layoutSettings[layout];
for i = 1, 3 do
local frame = self["arena"..i];
frame:ResetLayout();
self.layouts[layout]:Initialize(frame);
frame:UpdatePlayer();
end
self.optionsTable.args.layoutSettingsGroup.args = self.layouts[layout].optionsTable and self.layouts[layout].optionsTable or emptyLayoutOptionsTable;
LibStub("AceConfigRegistry-3.0"):NotifyChange("sArena");
local _, instanceType = IsInInstance();
if ( instanceType ~= "arena" and self.arena1:IsShown() ) then
self:Test();
end
end
function sArenaMixin:SetupDrag(frameToClick, frameToMove, settingsTable, updateMethod)
frameToClick:HookScript("OnMouseDown", function()
if ( InCombatLockdown() ) then return end
if ( IsShiftKeyDown() and IsControlKeyDown() and not frameToMove.isMoving ) then
frameToMove:StartMoving();
frameToMove.isMoving = true;
end
end);
frameToClick:HookScript("OnMouseUp", function()
if ( InCombatLockdown() ) then return end
if ( frameToMove.isMoving ) then
frameToMove:StopMovingOrSizing();
frameToMove.isMoving = false;
local settings = db.profile.layoutSettings[db.profile.currentLayout];
if ( settingsTable ) then
settings = settings[settingsTable];
end
local parentX, parentY = frameToMove:GetParent():GetCenter();
local frameX, frameY = frameToMove:GetCenter();
local scale = frameToMove:GetScale();
frameX = ((frameX * scale) - parentX) / scale;
frameY = ((frameY * scale) - parentY) / scale;
-- round to 1 decimal place
frameX = floor(frameX * 10 + 0.5 ) / 10;
frameY = floor(frameY * 10 + 0.5 ) / 10;
settings.posX, settings.posY = frameX, frameY;
self[updateMethod](self, settings);
LibStub("AceConfigRegistry-3.0"):NotifyChange("sArena");
end
end);
end
function sArenaMixin:SetMouseState(state)
for i = 1, 3 do
local frame = self["arena"..i];
frame.CastBar:EnableMouse(state);
frame.Stun:EnableMouse(state);
frame.SpecIcon:EnableMouse(state);
frame.Trinket:EnableMouse(state);
end
end
-- Arena Frames
local function ResetTexture(texturePool, t)
if ( texturePool ) then
t:SetParent(texturePool.parent);
end
t:SetTexture(nil);
t:SetColorTexture(0, 0, 0, 0);
t:SetVertexColor(1, 1, 1, 1);
t:SetDesaturated();
t:SetTexCoord(0, 1, 0, 1);
t:ClearAllPoints();
t:SetSize(0, 0);
t:Hide();
end
function sArenaFrameMixin:OnLoad()
local unit = "arena"..self:GetID();
self.parent = self:GetParent();
self:RegisterEvent("PLAYER_LOGIN");
self:RegisterEvent("PLAYER_ENTERING_WORLD");
self:RegisterEvent("UNIT_NAME_UPDATE");
self:RegisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS");
self:RegisterEvent("ARENA_OPPONENT_UPDATE");
self:RegisterEvent("ARENA_COOLDOWNS_UPDATE");
self:RegisterEvent("ARENA_CROWD_CONTROL_SPELL_UPDATE");
self:RegisterUnitEvent("UNIT_HEALTH", unit);
self:RegisterUnitEvent("UNIT_MAXHEALTH", unit);
self:RegisterUnitEvent("UNIT_POWER_UPDATE", unit);
self:RegisterUnitEvent("UNIT_MAXPOWER", unit);
self:RegisterUnitEvent("UNIT_DISPLAYPOWER", unit);
self:RegisterUnitEvent("UNIT_AURA", unit);
self:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", unit);
self:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", unit);
self:RegisterForClicks("AnyUp");
self:SetAttribute("*type1", "target");
self:SetAttribute("*type2", "focus");
self:SetAttribute("unit", unit);
self.unit = unit;
CastingBarFrame_SetUnit(self.CastBar, unit, false, true);
self.healthbar = self.HealthBar;
self.myHealPredictionBar:ClearAllPoints();
self.otherHealPredictionBar:ClearAllPoints();
self.totalAbsorbBar:ClearAllPoints();
self.overAbsorbGlow:ClearAllPoints();
self.healAbsorbBar:ClearAllPoints();
self.overHealAbsorbGlow:ClearAllPoints();
self.healAbsorbBarLeftShadow:ClearAllPoints();
self.healAbsorbBarRightShadow:ClearAllPoints();
self.totalAbsorbBar.overlay = self.totalAbsorbBarOverlay;
self.totalAbsorbBarOverlay:SetAllPoints(self.totalAbsorbBar);
self.totalAbsorbBarOverlay.tileSize = 32;
self.overAbsorbGlow:SetPoint("TOPLEFT", self.healthbar, "TOPRIGHT", -7, 0);
self.overAbsorbGlow:SetPoint("BOTTOMLEFT", self.healthbar, "BOTTOMRIGHT", -7, 0);
self.healAbsorbBar:SetTexture("Interface\\RaidFrame\\Absorb-Fill", true, true);
self.overHealAbsorbGlow:SetPoint("BOTTOMRIGHT", self.healthbar, "BOTTOMLEFT", 7, 0);
self.overHealAbsorbGlow:SetPoint("TOPRIGHT", self.healthbar, "TOPLEFT", 7, 0);
self.AuraText:SetPoint("CENTER", self.ClassIcon, "CENTER");
self.TexturePool = CreateTexturePool(self, "ARTWORK", nil, nil, ResetTexture);
end
function sArenaFrameMixin:OnEvent(event, eventUnit, arg1)
local unit = self.unit;
if ( eventUnit and eventUnit == unit ) then
if ( event == "UNIT_NAME_UPDATE" ) then
self.Name:SetText(GetUnitName(unit));
elseif ( event == "ARENA_OPPONENT_UPDATE" ) then
-- arg1 == unitEvent ("seen", "unseen", etc)
self:UpdateVisible();
self:UpdatePlayer(arg1);
elseif ( event == "ARENA_COOLDOWNS_UPDATE" ) then
self:UpdateTrinket();
elseif ( event == "ARENA_CROWD_CONTROL_SPELL_UPDATE" ) then
-- arg1 == spellID
if (arg1 ~= self.Trinket.spellID) then
local _, spellTextureNoOverride = GetSpellTexture(arg1);
self.Trinket.spellID = arg1;
self.Trinket.Texture:SetTexture(spellTextureNoOverride);
end
elseif ( event == "UNIT_AURA" ) then
self:FindAura();
elseif ( event == "UNIT_HEALTH" ) then
self:SetLifeState();
self:SetStatusText();
local currHp = UnitHealth(unit);
if ( currHp ~= self.currHp ) then
self.HealthBar:SetValue(currHp);
UnitFrameHealPredictionBars_Update(self);
self.currHp = currHp;
end
elseif ( event == "UNIT_MAXHEALTH" ) then
self.HealthBar:SetMinMaxValues(0, UnitHealthMax(unit));
self.HealthBar:SetValue(UnitHealth(unit));
UnitFrameHealPredictionBars_Update(self);
elseif ( event == "UNIT_POWER_UPDATE" ) then
self:SetStatusText();
self.PowerBar:SetValue(UnitPower(unit));
elseif ( event == "UNIT_MAXPOWER" ) then
self.PowerBar:SetMinMaxValues(0, UnitPowerMax(unit));
self.PowerBar:SetValue(UnitPower(unit));
elseif ( event == "UNIT_DISPLAYPOWER" ) then
local _, powerType = UnitPowerType(unit);
self:SetPowerType(powerType);
elseif ( event == "UNIT_ABSORB_AMOUNT_CHANGED" ) then
UnitFrameHealPredictionBars_Update(self);
elseif ( event == "UNIT_HEAL_ABSORB_AMOUNT_CHANGED" ) then
UnitFrameHealPredictionBars_Update(self);
end
elseif ( event == "PLAYER_LOGIN" ) then
self:UnregisterEvent("PLAYER_LOGIN");
if ( not db ) then
self.parent:Initialize();
end
self:Initialize();
elseif ( event == "PLAYER_ENTERING_WORLD" ) then
self.Name:SetText("");
self.CastBar:Hide();
self.specTexture = nil;
self.class = nil;
self.currentClassTexture = nil;
self:UpdateVisible();
self:UpdatePlayer();
self:ResetTrinket();
self:ResetDR();
UnitFrameHealPredictionBars_Update(self);
elseif ( event == "ARENA_PREP_OPPONENT_SPECIALIZATIONS" ) then
self:UpdateVisible();
self:UpdatePlayer();
end
end
function sArenaFrameMixin:Initialize()
self:SetMysteryPlayer();
self.parent:SetupDrag(self, self.parent, nil, "UpdateFrameSettings");
self.parent:SetupDrag(self.CastBar, self.CastBar, "castBar", "UpdateCastBarSettings");
self.parent:SetupDrag(self.Stun, self.Stun, "dr", "UpdateDRSettings");
self.parent:SetupDrag(self.SpecIcon, self.SpecIcon, "specIcon", "UpdateSpecIconSettings");
self.parent:SetupDrag(self.Trinket, self.Trinket, "trinket", "UpdateTrinketSettings");
end
function sArenaFrameMixin:OnEnter()
UnitFrame_OnEnter(self);
self.HealthText:Show();
self.PowerText:Show();
end
function sArenaFrameMixin:OnLeave()
UnitFrame_OnLeave(self);
self:UpdateStatusTextVisible();
end
function sArenaFrameMixin:OnUpdate()
if ( self.currentAuraSpellID ) then
local now = GetTime();
local timeLeft = self.currentAuraExpirationTime - now;
if ( timeLeft > 30 ) then
self.AuraText:SetText("");
elseif ( timeLeft >= 5 ) then
self.AuraText:SetFormattedText("%i", timeLeft);
elseif (timeLeft > 0 ) then
self.AuraText:SetFormattedText("%.1f", timeLeft);
end
end
end
function sArenaFrameMixin:UpdateVisible()
if ( InCombatLockdown() ) then return end
local _, instanceType = IsInInstance();
local id = self:GetID();
if ( instanceType == "arena" and ( GetNumArenaOpponentSpecs() >= id or GetNumArenaOpponents() >= id ) ) then
self:Show();
else
self:Hide();
end
end
function sArenaFrameMixin:UpdatePlayer(unitEvent)
local unit = self.unit;
self:GetClassAndSpec();
self:FindAura();
if ( ( unitEvent and unitEvent ~= "seen" ) or not UnitExists(unit) ) then
self:SetMysteryPlayer();
return;
end
-- prevent castbar and other frames from intercepting mouse clicks during a match
if ( unitEvent == "seen" ) then
self.parent:SetMouseState(false);
end
self.hideStatusText = false;
self.Name:SetText(GetUnitName(unit));
self.Name:SetShown(db.profile.showNames);
self:UpdateStatusTextVisible();
self:SetStatusText();
self:OnEvent("UNIT_MAXHEALTH", unit);
self:OnEvent("UNIT_HEALTH", unit);
self:OnEvent("UNIT_MAXPOWER", unit);
self:OnEvent("UNIT_POWER_UPDATE", unit);
self:OnEvent("UNIT_DISPLAYPOWER", unit);
local color = RAID_CLASS_COLORS[select(2, UnitClass(unit))];
if ( color and db.profile.classColors ) then
self.HealthBar:SetStatusBarColor(color.r, color.g, color.b, 1.0);
else
self.HealthBar:SetStatusBarColor(0, 1.0, 0, 1.0);
end
end
function sArenaFrameMixin:SetMysteryPlayer()
local f = self.HealthBar;
f:SetMinMaxValues(0,100);
f:SetValue(100);
f:SetStatusBarColor(0.5, 0.5, 0.5);
f = self.PowerBar;
f:SetMinMaxValues(0,100);
f:SetValue(100);
f:SetStatusBarColor(0.5, 0.5, 0.5);
self.hideStatusText = true;
self:SetStatusText();
self.DeathIcon:Hide();
end
function sArenaFrameMixin:GetClassAndSpec()
local _, instanceType = IsInInstance();
if ( instanceType ~= "arena" ) then
self.specTexture = nil;
self.class = nil;
self.SpecIcon:Hide();
elseif ( not self.specTexture or not self.class ) then
local id = self:GetID();
if ( GetNumArenaOpponentSpecs() >= id ) then
local specID = GetArenaOpponentSpec(id);
if ( specID > 0 ) then
self.SpecIcon:Show();
self.specTexture = select(4, GetSpecializationInfoByID(specID));
if ( self.parent.portraitSpecIcon ) then
SetPortraitToTexture(self.SpecIcon.Texture, self.specTexture);
else
self.SpecIcon.Texture:SetTexture(self.specTexture);
end
self.class = select(6, GetSpecializationInfoByID(specID));
end
end
if ( not self.class and UnitExists(self.unit) ) then
_, self.class = UnitClass(self.unit);
end
end
if ( not self.specTexture ) then
self.SpecIcon:Hide();
end
end
function sArenaFrameMixin:UpdateClassIcon()
local texture = self.currentAuraSpellID and self.currentAuraTexture or self.class and "class" or 134400;
if ( self.currentClassTexture == texture ) then return end
self.currentClassTexture = texture;
self.ClassIcon:SetTexCoord(0, 1, 0, 1);
if ( self.parent.portraitClassIcon ) then
if ( texture == "class" ) then
self.ClassIcon:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles");
self.ClassIcon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[self.class]));
else
SetPortraitToTexture(self.ClassIcon, texture);
end
else
if ( texture == "class" ) then
texture = classIcons[self.class];
end
self.ClassIcon:SetTexture(texture);
end
end
function sArenaFrameMixin:UpdateTrinket()
local spellID, startTime, duration = C_PvP.GetArenaCrowdControlInfo(self.unit);
if ( spellID ) then
if ( spellID ~= self.Trinket.spellID ) then
local _, spellTextureNoOverride = GetSpellTexture(spellID);
self.Trinket.spellID = spellID;
self.Trinket.Texture:SetTexture(spellTextureNoOverride);
end
if ( startTime ~= 0 and duration ~= 0 ) then
self.Trinket.Cooldown:SetCooldown(startTime/1000.0, duration/1000.0);
else
self.Trinket.Cooldown:Clear();
end
end
end
function sArenaFrameMixin:ResetTrinket()
self.Trinket.spellID = nil;
self.Trinket.Texture:SetTexture(134400);
self.Trinket.Cooldown:Clear();
self:UpdateTrinket();
end
local function ResetStatusBar(f)
f:SetStatusBarTexture(nil);
f:ClearAllPoints();
f:SetSize(0, 0);
f:SetScale(1);
end
local function ResetFontString(f)
f:SetDrawLayer("OVERLAY", 1);
f:SetJustifyH("CENTER");
f:SetJustifyV("MIDDLE");
f:SetTextColor(1, 0.82, 0, 1);
f:SetShadowColor(0, 0, 0, 1);
f:SetShadowOffset(1, -1);
f:ClearAllPoints();
f:Hide();
end
function sArenaFrameMixin:ResetLayout()
self.currentClassTexture = nil;
ResetTexture(nil, self.ClassIcon);
ResetStatusBar(self.HealthBar);
ResetStatusBar(self.PowerBar);
ResetStatusBar(self.CastBar);
self.CastBar:SetHeight(16);
local f = self.Trinket;
f:ClearAllPoints();
f:SetSize(0, 0);
f.Texture:SetTexCoord(0, 1, 0, 1);
f = self.SpecIcon;
f:ClearAllPoints();
f:SetSize(0, 0);
f:SetScale(1);
f = self.Name;
ResetFontString(f);
f:SetDrawLayer("ARTWORK", 2);
f:SetFontObject("SystemFont_Shadow_Small2");
f = self.AuraText;
ResetFontString(f);
f:SetFontObject("SystemFont_Shadow_Large_Outline");
f:SetTextColor(1, 1, 1, 1);
f = self.HealthText;
ResetFontString(f);
f:SetDrawLayer("ARTWORK", 2);
f:SetFontObject("Game10Font_o1");
f:SetTextColor(1, 1, 1, 1);
f = self.PowerText;
ResetFontString(f);
f:SetDrawLayer("ARTWORK", 2);
f:SetFontObject("Game10Font_o1");
f:SetTextColor(1, 1, 1, 1);
self.TexturePool:ReleaseAll();
end
function sArenaFrameMixin:SetPowerType(powerType)
local color = PowerBarColor[powerType];
if color then
self.PowerBar:SetStatusBarColor(color.r, color.g, color.b);
end
end
function sArenaFrameMixin:FindAura()
local unit = self.unit;
local currentSpellID, currentExpirationTime, currentTexture = nil, 0, nil;
if ( self.currentInterruptSpellID ) then
currentSpellID = self.currentInterruptSpellID;
currentExpirationTime = self.currentInterruptExpirationTime;
currentTexture = self.currentInterruptTexture;
end
for i = 1, 2 do
local filter = (i == 1 and "HELPFUL" or "HARMFUL");
for n = 1, 30 do
local _, texture, _, _, _, expirationTime, _, _, _, spellID = UnitAura(unit, n, filter);
if ( not spellID ) then break end
if ( auraList[spellID] ) then
if ( not currentSpellID or auraList[spellID] < auraList[currentSpellID] ) then
currentSpellID = spellID;
currentExpirationTime = expirationTime;
currentTexture = texture;
end
end
end
end
if ( currentSpellID ) then
self.currentAuraSpellID = currentSpellID;
self.currentAuraExpirationTime = currentExpirationTime;
self.currentAuraTexture = currentTexture;
else
self.currentAuraSpellID = nil;
self.currentAuraExpirationTime = 0;
self.currentAuraTexture = nil;
end
if ( self.currentAuraExpirationTime == 0 ) then
self.AuraText:SetText("");
end
self:UpdateClassIcon();
end
function sArenaFrameMixin:FindInterrupt(event, spellID)
local interruptDuration = interruptList[spellID];
if ( not interruptDuration ) then return end
if ( event ~= "SPELL_INTERRUPT" and event ~= "SPELL_CAST_SUCCESS" ) then return end
local unit = self.unit;
local _, _, _, _, _, _, notInterruptable = UnitChannelInfo(unit);
if ( event == "SPELL_INTERRUPT" or notInterruptable == false ) then
self.currentInterruptSpellID = spellID;
self.currentInterruptExpirationTime = GetTime() + interruptDuration;
self.currentInterruptTexture = GetSpellTexture(spellID);
self:FindAura();
After(interruptDuration, function()
self.currentInterruptSpellID = nil;
self.currentInterruptExpirationTime = 0;
self.currentInterruptTexture = nil;
self:FindAura();
end);
end
end
function sArenaFrameMixin:SetLifeState()
local unit = self.unit;
self.DeathIcon:SetShown(UnitIsDeadOrGhost(unit) and not FindAuraByName(FEIGN_DEATH, unit, "HELPFUL"));
self.hideStatusText = self.DeathIcon:IsShown();
end
function sArenaFrameMixin:SetStatusText(unit)
if ( self.hideStatusText ) then
self.HealthText:SetText("");
self.PowerText:SetText("");
return;
end
if ( not unit ) then
unit = self.unit;
end
local hp = UnitHealth(unit);
local hpMax = UnitHealthMax(unit);
local pp = UnitPower(unit);
local ppMax = UnitPowerMax(unit);
if ( db.profile.statusText.usePercentage ) then
self.HealthText:SetText(ceil((hp / hpMax) * 100) .. "%");
self.PowerText:SetText(ceil((pp / ppMax) * 100) .. "%");
else
self.HealthText:SetText(AbbreviateLargeNumbers(hp));
self.PowerText:SetText(AbbreviateLargeNumbers(pp));
end
end
function sArenaFrameMixin:UpdateStatusTextVisible()
self.HealthText:SetShown(db.profile.statusText.alwaysShow);
self.PowerText:SetShown(db.profile.statusText.alwaysShow);
end
function sArenaFrameMixin:FindDR(combatEvent, spellID)
local category = drList[spellID];
if ( not category ) then return end
if ( not db.profile.drCategories[category] ) then return end
local frame = self[category];
local currTime = GetTime();
if ( combatEvent == "SPELL_AURA_REMOVED" or combatEvent == "SPELL_AURA_BROKEN" ) then
local startTime, startDuration = frame.Cooldown:GetCooldownTimes();
startTime, startDuration = startTime/1000, startDuration/1000;
local newDuration = drTime / (1 - ((currTime - startTime) / startDuration));
local newStartTime = drTime + currTime - newDuration;
frame:Show();
frame.Cooldown:SetCooldown(newStartTime, newDuration);
return;
elseif ( combatEvent == "SPELL_AURA_APPLIED" or combatEvent == "SPELL_AURA_REFRESH" ) then
local unit = self.unit;
for i = 1, 30 do
local _, _, _, _, duration, _, _, _, _, _spellID = UnitAura(unit, i, "HARMFUL");
if ( not _spellID ) then break end
if ( duration and spellID == _spellID ) then
frame:Show();
frame.Cooldown:SetCooldown(currTime, duration + drTime);
break;
end
end
end
frame.Icon:SetTexture(GetSpellTexture(spellID));
frame.Border:SetVertexColor(unpack(severityColor[frame.severity]));
frame.severity = frame.severity + 1;
if frame.severity > 3 then
frame.severity = 3;
end
end
function sArenaFrameMixin:UpdateDRPositions()
local layoutdb = self.parent.layoutdb;
local numActive = 0;
local frame, prevFrame;
local spacing = layoutdb.dr.spacing;
local growthDirection = layoutdb.dr.growthDirection;
for i = 1, #drCategories do
frame = self[drCategories[i]];
if ( frame:IsShown() ) then
frame:ClearAllPoints();
if ( numActive == 0 ) then
frame:SetPoint("CENTER", self, "CENTER", layoutdb.dr.posX, layoutdb.dr.posY);
else
if ( growthDirection == 4 ) then frame:SetPoint("RIGHT", prevFrame, "LEFT", -spacing, 0);
elseif ( growthDirection == 3 ) then frame:SetPoint("LEFT", prevFrame, "RIGHT", spacing, 0);
elseif ( growthDirection == 1 ) then frame:SetPoint("TOP", prevFrame, "BOTTOM", 0, -spacing);
elseif ( growthDirection == 2 ) then frame:SetPoint("BOTTOM", prevFrame, "TOP", 0, spacing);
end
end
numActive = numActive + 1;
prevFrame = frame;
end
end
end
function sArenaFrameMixin:ResetDR()
for i = 1, #drCategories do
self[drCategories[i]].Cooldown:SetCooldown(0, 0);
end
end
function sArenaMixin:Test()
if ( InCombatLockdown() ) then return end
local currTime = GetTime();
for i = 1,3 do
local frame = self["arena"..i];
frame:Show();
if ( frame.parent.portraitClassIcon ) then
SetPortraitToTexture(frame.ClassIcon, 626001);
else
frame.ClassIcon:SetTexture(626001);
end
frame.SpecIcon:Show();
if ( frame.parent.portraitSpecIcon ) then
SetPortraitToTexture(frame.SpecIcon.Texture, 135846);
else
frame.SpecIcon.Texture:SetTexture(135846);
end
frame.AuraText:SetText("5.3");
frame.Name:SetText("arena"..i);
frame.Name:SetShown(db.profile.showNames)
frame.Trinket.Texture:SetTexture(1322720);
frame.Trinket.Cooldown:SetCooldown(currTime, math.random(20, 60));
for n = 1, #drCategories do
local drFrame = frame[drCategories[n]];
drFrame.Icon:SetTexture(136071);
drFrame:Show();
drFrame.Cooldown:SetCooldown(currTime, n == 1 and 60 or math.random(20, 50));
if ( n == 1 ) then
drFrame.Border:SetVertexColor(1, 0, 0, 1);
else
drFrame.Border:SetVertexColor(0, 1, 0, 1);
end
end
frame.CastBar.fadeOut = nil;
frame.CastBar:Show();
frame.CastBar:SetAlpha(1);
frame.CastBar.Icon:SetTexture(136071);
frame.CastBar.Text:SetText("Polymorph");
frame.CastBar:SetStatusBarColor(1, 0.7, 0, 1);
frame.hideStatusText = false;
frame:SetStatusText("player");
frame:UpdateStatusTextVisible();
end
end
|
local matrice = require("matrice_object")
local function createIdentity()
return matrice.create(4,4,
1,1,1,1,
1,1,1,1,
1,1,1,1,
1,1,1,1
)
end
local function createScale3D(scale)
return matrice.create(4,4,
scale.x,0,0,0,
1,scale.y,0,0,
0,0,scale.z,0,
0,0,0,1
)
end
local function createScale(factor)
return matrice.create(4,4,
factor,0,0,0,
0,factor,0,0,
0,0,factor,0,
0,0,0,1
)
end |
local peds = {}
function close (skin,x,y,z)
peds[source] = createPed(skin,x,y,z)
warpPedIntoVehicle(peds[source],getPedOccupiedVehicle(source),1)
end
addEvent("warpPed", true)
addEventHandler("warpPed", getRootElement(), close)
function cleanPedsFromServer()
if peds[source] then
if isElement(peds[source]) then destroyElement(peds[source]) end
end
end
addEvent("cleanPedsFromServer", true)
addEventHandler("cleanPedsFromServer", getRootElement(), cleanPedsFromServer)
function giveTaxiMoney(money)
totalMoney = math.floor(money)
---givePlayerMoney(source,totalMoney)
exports.AURpayments:addMoney(source,totalMoney,"Custom","Taxi Driver",0,"AURtaxi by bot")
exports.CSGranks:addStat(source,1)
exports.CSGscore:givePlayerScore(source,1)
exports.NGCdxmsg:createNewDxMessage(source,"You have earned $"..totalMoney.." and 1 score point",0,255,0)
end
addEvent("giveTaxiMoney", true)
addEventHandler("giveTaxiMoney", getRootElement(), giveTaxiMoney)
function cleanPedsFromServer2()
if peds[source] then
if isElement(peds[source]) then destroyElement(peds[source]) end
end
end
addEventHandler("onPlayerQuit", getRootElement(), cleanPedsFromServer2)
taxiIDs = { [420]=true, [438]=true }
local blips = {}
local timers = {}
addEvent( "onPhoneCallService", true )
function onPhoneCallService ( theOccupation, theTeam )
if theOccupation == "Taxi Driver" then
for k,v in ipairs(getElementsByType("player")) do
if getElementData(v,"Occupation") == theOccupation then
if v ~= source then
exports.killMessages:outputMessage(getPlayerName(source).." has requested a taxi ( "..getZoneName(getElementPosition(source)).." Street )",v,255,255,0,"default-bold")
exports.NGCdxmsg:createNewDxMessage(v,"Taxi passenger blip will be disappear within 1 minute.",0,255,0)
if isElement(blips[source]) then destroyElement(blips[source]) end
blips[source] = createBlipAttachedTo(source,58)
setElementVisibleTo ( blips[source], root, false )
setElementVisibleTo ( blips[source], v, true )
if isTimer(timers[source]) then killTimer(timers[source]) end
timers[source] = setTimer(function(plr)
if isElement(blips[plr]) then destroyElement(blips[plr]) end
blips[plr] = nil
end,60000,1,source)
end
end
end
end
end
addEventHandler( "onPhoneCallService", root, onPhoneCallService )
addEventHandler("onPlayerQuit",root,function()
if blips[source] then
if isElement(blips[source]) then destroyElement(blips[source]) end
blips[source] = nil
end
if timers[source] then
if isTimer(timers[source]) then killTimer(timers[source]) end
timers[source] = nil
end
end)
function taxiLightFunc ( thePlayer )
if ( isPedInVehicle ( thePlayer ) ) then
if ( taxiIDs[getElementModel(getPedOccupiedVehicle(thePlayer))] ) and ( getPedOccupiedVehicleSeat ( thePlayer ) == 0 ) then
setVehicleTaxiLightOn ( getPedOccupiedVehicle ( thePlayer ), not isVehicleTaxiLightOn ( getPedOccupiedVehicle ( thePlayer ) ) )
if isVehicleTaxiLightOn(getPedOccupiedVehicle(thePlayer)) then
triggerClientEvent(thePlayer,"NGCtaxi.togLight",thePlayer,true)
else
triggerClientEvent(thePlayer,"NGCtaxi.togLight",thePlayer,false)
end
end
end
end
function checkTaxiDriver ( thePlayer, seat, jacked )
if ( taxiIDs[getElementModel(source)] ) and ( seat == 0 ) then
if ( getElementData ( thePlayer, "Occupation" ) ~= 6 and getElementData ( thePlayer, "Occupation" ) == "Taxi Driver" ) then
bindKey ( thePlayer, "2", "down", taxiLightFunc )
exports.NGCdxmsg:createNewDxMessage (thePlayer,"Press the 2 button to start or stop your service for players",0,255,0 )
setVehicleTaxiLightOn (source,true)
triggerClientEvent(thePlayer,"NGCtaxi.togLight",thePlayer,true)
end
elseif ( taxiIDs[getElementModel(source)] ) and ( seat >= 1 ) then
if ( isVehicleTaxiLightOn ( source ) ) then
local taxidriver = getVehicleOccupant ( source, 0 )
if isElement(taxidriver) and getElementData ( taxidriver, "Occupation" ) == "Taxi Driver" then
setTimer ( payTaxiFunc, 10000, 1, taxidriver, thePlayer )
end
end
end
end
addEventHandler ( "onVehicleEnter", getRootElement(), checkTaxiDriver )
function payTaxiFunc ( taxidriver, customer )
if getElementType(customer) == "player" and getElementType(taxidriver) == "player" then
if ( isPedInVehicle ( customer ) ) then
if ( taxiIDs[getElementModel(getPedOccupiedVehicle(customer))] ) then
if ( getPlayerName ( taxidriver ) == getPlayerName ( getVehicleOccupant ( getPedOccupiedVehicle ( customer ), 0 ) ) ) then
if ( isVehicleTaxiLightOn ( getPedOccupiedVehicle ( customer ) ) ) then
if ( getPlayerMoney ( customer ) >= 20 ) then
sx, sy, sz = getElementVelocity ((getVehicleOccupant ( getPedOccupiedVehicle (taxidriver),0)))
speed = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180)
if speed >= 50 then
if getTeamName(getPlayerTeam(customer)) == "Staff" then return false end
local money = math.random(20,40)
----takePlayerMoney ( customer, money )
---givePlayerMoney ( taxidriver, money )
exports.AURpayments:takeMoney(customer,money,"AURtaxi")
exports.AURpayments:addMoney(taxidriver,money,"Custom","Taxi Driver",0,"AURtaxi")
exports.NGCdxmsg:createNewDxMessage(customer,"You have paid $"..money.." for taxi service",0,255,0)
if not getElementData(taxidriver,"taxi2") then setElementData(taxidriver,"taxi2",0) end
if not getElementData(taxidriver,"taxi") then setElementData(taxidriver,"taxi",0) end
setElementData(taxidriver,"taxi2",getElementData(taxidriver,"taxi2")+money)
setElementData(taxidriver,"taxi",money)
setTimer ( payTaxiFunc, 10000, 1, taxidriver, customer )
else
exports.NGCdxmsg:createNewDxMessage(taxidriver,"You are driving under the required speed, speed up!",255,0,0)
setTimer ( payTaxiFunc, 10000, 1, taxidriver, customer )
return end
else
removePedFromVehicle ( customer )
local x,y,z = getElementPosition((getVehicleOccupant ( getPedOccupiedVehicle (taxidriver),0)))
setElementPosition(customer,x+5,y+10,z)
exports.NGCdxmsg:createNewDxMessage(customer, "You do not have enough money!",255,0,0)
end
end
end
end
end
end
end
|
if vim.g.vscode then
-- stylua: ignore start
vim.keymap.set('n', '<Leader>zz', '<Cmd >call VSCodeNotify("workbench.action.toggleZenMode")<CR>')
vim.keymap.set('n', '<Leader><Leader>z', '<Cmd >call VSCodeNotify("workbench.action.toggleZenMode")<CR>')
-- stylua: ignore end
return
end
if not pcall(require, 'twilight') then
return
end
if not pcall(require, 'zen-mode') then
return
end
require('twilight').setup()
local zen = require('zen-mode')
zen.setup({
window = {
backdrop = 0.999,
height = 0.9,
width = 80,
options = {
number = false,
relativenumber = false,
},
},
})
vim.keymap.set('n', '<Leader><Leader>z', function()
zen.toggle({
window = {
width = 120,
},
})
end)
vim.keymap.set('n', '<Leader>zz', function()
zen.toggle()
end)
|
--[[
Title: my school page
Author(s): big
CreateDate: 2019.09.11
ModifyDate: 2021.07.28
Place: Foshan
Desc: set user school.
use the lib:
------------------------------------------------------------
local MySchool = NPL.load('(gl)Mod/WorldShare/cellar/MySchool/MySchool.lua')
MySchool:Show()
MySchool:ShowJoinSchool()
------------------------------------------------------------
]]
-- libs
local StringUtil = commonlib.gettable('mathlib.StringUtil')
local Screen = commonlib.gettable('System.Windows.Screen')
-- service
local KeepworkService = NPL.load("(gl)Mod/WorldShare/service/KeepworkService.lua")
local KeepworkServiceSchoolAndOrg = NPL.load("(gl)Mod/WorldShare/service/KeepworkService/SchoolAndOrg.lua")
local KeepworkServiceSession = NPL.load("(gl)Mod/WorldShare/service/KeepworkService/Session.lua")
-- database
local SessionsData = NPL.load("(gl)Mod/WorldShare/database/SessionsData.lua")
local MySchool = NPL.export()
function MySchool:Show(callback)
self.hasJoined = false
self.hasSchoolJoined = false
self.schoolData = {}
self.orgData = {}
self.allData = {}
self.callback = callback
self.searchText = ""
Mod.WorldShare.MsgBox:Show(L"请稍候...", nil, nil, nil, nil, 6)
local params = Mod.WorldShare.Utils.ShowWindow(600, 380, "(ws)Theme/MySchool/MySchool.html", "Mod.WorldShare.MySchool")
KeepworkServiceSchoolAndOrg:GetUserAllOrgs(function(orgData)
Mod.WorldShare.MsgBox:Close()
self.hasJoined = false
if type(orgData) == "table" and #orgData > 0 then
self.hasJoined = true
for key, item in ipairs(orgData) do
if item and not item.fullname then
item.fullname = ''
end
end
for key, item in ipairs(orgData) do
if item and item.type == 4 then
self.hasSchoolJoined = true
break
end
end
end
for key, item in ipairs(orgData) do
if item.type ~= 4 then
-- org data
self.orgData[#self.orgData + 1] = item
end
if item.type == 4 then
-- school data
item.originName = item.name
item.name = (item.schoolId or '') .. ' ' .. item.name
self.schoolData[#self.schoolData + 1] = item
end
end
if self.schoolData and #self.schoolData > 0 then
self.allData[#self.allData + 1] = {
element_type = 1,
title = 'Texture/Aries/Creator/keepwork/my_school_32bits.png#6 31 85 18'
}
for key, item in ipairs(self.schoolData) do
item.element_type = 2
self.allData[#self.allData + 1] = item
end
end
if self.orgData and #self.orgData > 0 then
self.allData[#self.allData + 1] = {
element_type = 1,
title = 'Texture/Aries/Creator/keepwork/my_school_32bits.png#6 7 85 18'
}
for key, item in ipairs(self.orgData) do
item.element_type = 2
self.allData[#self.allData + 1] = item
end
end
params._page:Refresh(0.01)
end)
end
function MySchool:ShowJoinSchool(callback)
self.provinces = {
{
text = L"省",
value = 0,
selected = true,
}
}
self.cities = {
{
text = L"市",
value = 0,
selected = true,
}
}
self.areas = {
{
text = L"区(县、镇、街道)",
value = 0,
selected = true,
}
}
self.kinds = {
{
text = L"学校类型",
value = 0,
selected = true,
},
{
text = L"小学",
value = L"小学"
},
{
text = L"中学",
value = L"中学"
},
{
text = L"大学",
value = L"大学",
},
{
text = L"综合",
value = L"综合",
}
}
self:SetResult({})
self.curId = 0
self.kind = nil
self.joinSchoolCallback = callback
self.SetDefaul = true
local params = Mod.WorldShare.Utils.ShowWindow(
{
url = '(ws)MySchool/JoinSchool.html',
name = 'Mod.WorldShare.JoinSchool',
isShowTitleBar = false,
DestroyOnClose = true, -- prevent many ViewProfile pages staying in memory
style = CommonCtrl.WindowFrame.ContainerStyle,
zorder = 1,
allowDrag = false,
bShow = nil,
directPosition = true,
align = "_fi",
x = 0,
y = 0,
width = 0,
height = 0,
cancelShowAnimation = true,
bToggleShowHide = true,
DesignResolutionWidth = 1280,
DesignResolutionHeight = 720,
}
)
local resultPage = Mod.WorldShare.Store:Get('page/Mod.WorldShare.JoinSchool.Result')
params._page:CallMethod('province_list_datasource', 'SetDataSource', self.provinces)
params._page:CallMethod('province_list_datasource', 'DataBind')
self:GetProvinces(function(data)
if type(data) ~= "table" then
return false
end
self.provinces = data
params._page:CallMethod('province_list_datasource', 'SetDataSource', self.provinces)
params._page:CallMethod('province_list_datasource', 'DataBind')
local region = Mod.WorldShare.Store:Get('user/region')
if region and type(region) == 'table' and region.info then
-- set privince field
if self.provinces and type(self.provinces) == 'table' then
for key, item in ipairs(self.provinces) do
item.selected = nil
if item.id == region.info.state.id then
item.selected = true
params._page:SetUIValue('province', item.text)
end
end
end
-- set city field
self:GetCities(region.info.state.id, function(data)
self.cities = data
params._page:CallMethod('city_list_datasource', 'SetDataSource', self.cities)
params._page:CallMethod('city_list_datasource', 'DataBind')
if self.cities and
type(self.cities) == 'table' and
region.info.city and
region.info.city.id then
for key, item in ipairs(self.cities) do
item.selected = nil
if item.id == region.info.city.id then
item.selected = true
params._page:SetUIValue('city', item.text)
end
end
end
self:GetAreas(region.info.city.id, function(data)
self.areas = data
params._page:CallMethod('area_list_datasource', 'SetDataSource', self.areas)
params._page:CallMethod('area_list_datasource', 'DataBind')
self.curId = region.info.city.id
self.lastCityId = region.info.city.id
local lastSchoolId = SessionsData:GetAnonymousInfo().lastSchoolId or 0
if lastSchoolId and type(lastSchoolId) == 'number' and lastSchoolId ~= 0 then
params._page:SetValue('search_text', lastSchoolId)
self.searchText = tostring(lastSchoolId)
self:GetSearchSchoolResultByName(self.searchText, function()
resultPage:GetNode('school_list'):SetUIAttribute('DataSource', self.result)
end)
else
self:GetSearchSchoolResult(region.info.city.id, nil, function()
resultPage:GetNode('school_list'):SetUIAttribute('DataSource', self.result)
end)
end
end)
end)
end
end)
if resultPage then
resultPage:GetNode('school_list'):SetUIAttribute('DataSource', {})
end
Screen:Connect("sizeChanged", MySchool, MySchool.OnScreenSizeChange, "UniqueConnection")
params._page.OnClose = function()
Screen:Disconnect("sizeChanged", MySchool, MySchool.OnScreenSizeChange)
end
end
function MySchool.OnScreenSizeChange()
local joinSchoolPage = Mod.WorldShare.Store:Get('page/Mod.WorldShare.JoinSchool')
if joinSchoolPage then
joinSchoolPage:CloseWindow()
end
MySchool:ShowJoinSchool()
end
function MySchool:ShowJoinSchoolAfterRegister(callback)
self.provinces = {
{
text = L"省",
value = 0,
selected = true,
}
}
self.cities = {
{
text = L"市",
value = 0,
selected = true,
}
}
self.areas = {
{
text = L"区(县、镇、街道)",
value = 0,
selected = true,
}
}
self.kinds = {
{
text = L"学校类型",
value = 0,
selected = true,
},
{
text = L"小学",
value = L"小学"
},
{
text = L"中学",
value = L"中学"
},
{
text = L"大学",
value = L"大学",
},
{
text = L"综合",
value = L"综合",
}
}
self:SetResult({})
self.curId = 0
self.kind = nil
self.joinSchoolCallback = callback
local params1 = Mod.WorldShare.Utils.ShowWindow(600, 420, "(ws)Theme/MySchool/JoinSchoolAfterRegister.html", "Mod.WorldShare.JoinSchoolAfterRegister", nil, nil, nil, false, 1)
local params2 = Mod.WorldShare.Utils.ShowWindow(442, 100, "(ws)Theme/MySchool/JoinSchoolResult.html", "Mod.WorldShare.JoinSchoolResult", nil, 20, nil, false, 2)
self:GetProvinces(function(data)
if type(data) ~= "table" then
return false
end
self.provinces = data
self:RefreshJoinSchool()
end)
params1._page.OnClose = function()
if params2._page then
params2._page:CloseWindow()
end
end
end
function MySchool:RefreshJoinSchool()
local JoinSchoolPage = Mod.WorldShare.Store:Get("page/Mod.WorldShare.JoinSchool")
local JoinSchoolAfterRegisterPage = Mod.WorldShare.Store:Get('page/Mod.WorldShare.JoinSchoolAfterRegister')
if JoinSchoolPage then
JoinSchoolPage:Refresh(0.01)
local JoinSchoolResultPage = Mod.WorldShare.Store:Get("page/Mod.WorldShare.JoinSchoolResult")
if JoinSchoolResultPage then
JoinSchoolResultPage:Refresh(0.01)
end
end
if JoinSchoolAfterRegisterPage then
JoinSchoolAfterRegisterPage:Refresh(0.01)
local JoinSchoolResultPage = Mod.WorldShare.Store:Get("page/Mod.WorldShare.JoinSchoolResult")
if JoinSchoolResultPage then
JoinSchoolResultPage:Refresh(0.01)
end
end
end
function MySchool:ShowJoinInstitute()
local params = Mod.WorldShare.Utils.ShowWindow(600, 200, "(ws)Theme/MySchool/JoinInstitute.html", "Mod.WorldShare.JoinInstitute")
end
function MySchool:ShowRecordSchool()
self.provinces = {
{
text = L"省",
value = 0,
selected = true,
}
}
self.cities = {
{
text = L"市",
value = 0,
selected = true,
}
}
self.areas = {
{
text = L"区(县、镇、街道)",
value = 0,
selected = true,
}
}
self.kinds = {
{
text = L"学校类型",
value = 0,
selected = true,
},
{
text = L"小学",
value = L"小学"
},
{
text = L"中学",
value = L"中学"
},
{
text = L"大学",
value = L"大学",
},
{
text = L"综合",
value = L"综合",
}
}
self.curId = 0
self.kind = nil
local params = Mod.WorldShare.Utils.ShowWindow(600, 300, "(ws)Theme/MySchool/RecordSchool.html", "Mod.WorldShare.RecordSchool")
self:GetProvinces(function(data)
if type(data) ~= "table" then
return false
end
self.provinces = data
params._page:Refresh(0.01)
end)
end
function MySchool:GetProvinces(callback)
KeepworkServiceSchoolAndOrg:GetSchoolRegion("province", nil, function(data)
if type(data) ~= "table" then
return false
end
if type(callback) == "function" then
for key, item in ipairs(data) do
item.text = item.name
item.value = item.id
end
data[#data + 1] = {
text = L'省',
value = 0,
selected = true,
}
callback(data)
end
end)
end
function MySchool:GetCities(id, callback)
KeepworkServiceSchoolAndOrg:GetSchoolRegion("city", id, function(data)
if type(data) ~= "table" then
return false
end
if type(callback) == "function" then
for key, item in ipairs(data) do
item.text = item.name
item.value = item.id
end
data[#data + 1] = {
text = L'市',
value = 0,
selected = true,
}
callback(data)
end
end)
end
function MySchool:GetAreas(id, callback)
KeepworkServiceSchoolAndOrg:GetSchoolRegion('area', id, function(data)
if type(data) ~= "table" then
return false
end
if type(callback) == "function" then
for key, item in ipairs(data) do
item.text = item.name
item.value = item.id
end
data[#data + 1] = {
text = L'区(县、镇、街道)',
value = 0,
selected = true,
}
callback(data)
end
end)
end
function MySchool:GetSearchSchoolResult(id, kind, callback)
KeepworkServiceSchoolAndOrg:SearchSchool(id, kind, function(data)
self:SetResult(data)
for key, item in ipairs(self.result) do
item.text = item.name
item.value = item.id
end
if callback and type(callback) == "function" then
callback(self.result)
end
end)
end
function MySchool:GetSearchSchoolResultByName(name, callback)
if not name or type(name) ~= "string" or #name == 0 then
if callback and type(callback) == "function" then
self:SetResult({})
callback()
end
return false
end
-- trim white space
name = StringUtil.trim(name)
if type(tonumber(name)) == 'number' then
KeepworkServiceSchoolAndOrg:SearchSchoolBySchoolId(tonumber(name), function(data)
self:SetResult(data)
for key, item in ipairs(self.result) do
item.text = item.name or ""
item.value = item.id
end
if callback and type(callback) == "function" then
callback(self.result)
end
end)
return
end
KeepworkServiceSchoolAndOrg:SearchSchoolByName(name, self.curId, self.kind, function(data)
self:SetResult(data)
for key, item in ipairs(self.result) do
item.text = item.name or ""
item.value = item.id
end
if callback and type(callback) == "function" then
callback(self.result)
end
end)
end
function MySchool:ChangeSchool(schoolId, callback)
KeepworkServiceSchoolAndOrg:ChangeSchool(schoolId, callback)
end
function MySchool:JoinInstitute(code, callback)
KeepworkServiceSchoolAndOrg:JoinInstitute(code, callback)
end
function MySchool:RecordSchool(schoolType, regionId, schoolName, callback)
KeepworkServiceSchoolAndOrg:SchoolRegister(schoolType, regionId, schoolName, callback)
end
function MySchool:SetResult(data)
self.result = data
if self.result and type(self.result) == 'table' then
-- find out same school name
for aKey, aItem in ipairs(self.result) do
local sameName = false
for bKey, bItem in ipairs(self.result) do
if aItem.id ~= bItem.id and aItem.name == bItem.name then
sameName = true
break
end
end
if sameName then
aItem.sameName = true
end
end
for key, item in ipairs(self.result) do
if item and item.name then
item.originName = item.name
if item and item.status and item.status == 0 then
item.name = item.name .. L"(审核中)"
end
end
if item and item.region and item.sameName then
local regionString = ''
-- if item.region.country and item.region.country.name then
-- regionString = regionString .. item.region.country.name
-- end
if item.region.state and item.region.state.name then
regionString = regionString .. item.region.state.name
end
if item.region.city and item.region.city.name then
regionString = regionString .. item.region.city.name
end
if item.region.county and item.region.county.name then
regionString = regionString .. item.region.county.name
end
regionString = '(' .. regionString .. ')'
item.name = item.name .. regionString
end
-- add id
if item and item.id and item.name then
item.name = item.id .. ' ' .. item.name
end
end
end
end
function MySchool:OpenTeachingPlanCenter(orgUrl)
if not orgUrl or type(orgUrl) ~= 'string' then
return false
end
KeepworkServiceSession:SetUserLevels(nil, function()
local userType = Mod.WorldShare.Store:Get('user/userType')
if not userType or type(userType) ~= 'table' then
return false
end
if userType.orgAdmin then
local url = '/org/' .. orgUrl .. '/admin/packages'
Mod.WorldShare.Utils.OpenKeepworkUrlByToken(url)
return
end
if userType.teacher then
local url = '/org/' .. orgUrl .. '/teacher/teach'
Mod.WorldShare.Utils.OpenKeepworkUrlByToken(url)
return
end
if userType.student or userType.freeStudent then
local url = '/org/' .. orgUrl .. '/student'
Mod.WorldShare.Utils.OpenKeepworkUrlByToken(url)
return
end
end)
end
|
--PUT THE TOOLS INTO THE TEAM
function teamFromColor(color)
for _,t in pairs(game:GetService("Teams"):GetChildren()) do
if t.TeamColor==color then return t end
end
return nil
end
function onSpawned(plr)
local tools = teamFromColor(plr.TeamColor):GetChildren()
for _,c in pairs(tools) do
c:Clone().Parent = plr.Backpack
end
end
function onChanged(prop,plr)
if prop=="Character" then
onSpawned(plr)
end
end
function onAdded(plr)
plr.Changed:connect(function(prop)
onChanged(prop,plr)
end)
end
game.Players.PlayerAdded:connect(onAdded)
--By naschemaa.
|
--[[ Copyright 2014 Sergej Nisin
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.
]]
GAMEVERSION = "2.1-8"
-- Managers
ButtonManager = require("lua.ButtonManager")
StateManager = require("lua.StateManager")
BackgroundManager = require("lua.BackgroundManager")
ScrollManager = require("lua.ScrollManager")
SoundManager = require("lua.SoundManager")
SaveManager = require("lua.SaveManager")
RessourceManager = require("lua.RessourceManager")
DownloadManager = require("lua.DownloadManager")
LevelManager = require("lua.LevelManager")
ErrorManager = require("lua.ErrorManager")
-- Libraries
Tween = require("libs.tween")
require("libs.Tserial")
-- Gamestates
require("states.MenuState")
require("states.GameState")
require("states.WonState")
require("states.LostState")
require("states.EditorState")
require("states.SelWorldState")
require("states.SelLevelState")
require("states.CreditsState")
require("states.CustomLevelState")
require("states.DownloadState")
require("states.MyWorldsState")
require("states.SelectionState")
local AllState = {}
function AllState.load()
io.stdout:setvbuf("no")
love.filesystem.setIdentity("EggBattle")
SaveManager.loadGame()
-- Images / Sounds
RessourceManager.load()
-- Sounds
SoundManager.load(SaveManager.save.mute)
SoundManager.playMusic("menu", true)
-- Variables
OS = love.system.getOS()
timet = 0
pixelscale = love.window.getPixelScale()
font = love.graphics.newFont("gfx/font.ttf",math.floor(20*pixelscale))
smallfont = love.graphics.newFont("gfx/font.ttf",math.floor(13*pixelscale))
game = {}
game.worldselected = 1
love.graphics.setFont(font)
love.graphics.setLineWidth(pixelscale)
love.graphics.setBackgroundColor(44, 209, 255)
LevelManager.load()
updateGraphics()
BackgroundManager.load()
end
function AllState.update( dt )
SoundManager.update(dt)
BackgroundManager.update(dt)
if game.state then
error("game.state changed to " .. game.state)
end
end
function AllState.draw()
BackgroundManager.draw()
love.graphics.setColor(255, 255, 255, 255)
--love.graphics.print("Size: "..love.graphics.getWidth().."x"..love.graphics.getHeight(), 0, 0)
end
function AllState.mousepressed( mx, my, button )
end
function AllState.keypressed(k)
end
function AllState.mousereleased(x, y, button)
end
function AllState.resize( w, h )
BackgroundManager.resize()
updateGraphics()
end
function updateGraphics()
local eggs = RessourceManager.images.eggs
game.offY = 50*pixelscale
game.width=love.graphics.getWidth()
game.height=love.graphics.getHeight()-game.offY
game.tilew=game.width/5
game.tileh=game.height/6
game.scaleX = (game.tilew-10)/eggs[1]:getWidth()
game.scaleY = (game.tileh-10)/eggs[1]:getHeight()
game.scale = math.min(game.scaleX, game.scaleY)
game.eggofX = (game.tilew-eggs[1]:getWidth()*game.scale)/2
game.eggofY = (game.tileh-eggs[1]:getHeight()*game.scale)/2
end
function table.copy(t, deep, seen)
seen = seen or {}
if t == nil then return nil end
if seen[t] then return seen[t] end
local nt = {}
for k, v in pairs(t) do
if deep and type(v) == 'table' then
nt[k] = table.copy(v, deep, seen)
else
nt[k] = v
end
end
setmetatable(nt, table.copy(getmetatable(t), deep, seen))
seen[t] = nt
return nt
end
function table.merge(t1, t2)
for k,v in pairs(t2) do
if type(v) == "table" then
if type(t1[k] or false) == "table" then
table.merge(t1[k] or {}, t2[k] or {})
else
t1[k] = v
end
else
t1[k] = v
end
end
return t1
end
StateManager.registerState("allstate", AllState)
StateManager.setAlwaysState("allstate")
StateManager.setState("menu")
StateManager.registerCallbacks() |
----------------------------------------------------------------
-- File : Assets\BIZ_Scr\Core\audiomanager.lua
-- Author : www.loywong.com
-- COPYRIGHT : (C)
-- Date : 2019/12/26
-- Description : ⾳效播放模块(Lua) 主要为了处理分不同bundle来打包 ⼤厅和不同玩法的音效 优化热更包体大小
-- !!!所有关卡通⽤的⾳效也属于Asset_0的⾳效
----------------------------------------
-- 需要确定bundle⽂件的接⼝
-- AudioPoolManager.Instance:Play2D
-- AudioPoolManager.Instance:Play2DLoop
-- AudioPoolManager.Instance:PlayMusic
-- AudioPoolManager.Instance:PlayBGAudio
-- AudioPoolManager.Instance:Play3D(暂时不⽤)
-- !!!要考虑C#层的调⽤,特别是AudioInAnim组件的应⽤需要指定参数:isOnlyInLevel
----------------------------------------
-- Version : 1.0
-- Maintain : //[date] desc
----------------------------------------------------------------
audiomanager = {}
local this = audiomanager
--2D⾳效默认⾳量
this.volumn2DDefault = 1
--玩法专属于每⼀ 个关卡内部的⾳效(不包括所有关卡通⽤的)
function this.Play2D_Battle(soundtype)
if not gamecontroller.IsBattle() then
logError('不在玩法场景,不能调⽤此接⼝ audiomanager.Play2D_Battle()')
return
end
AudioPoolManager.Instance:Play2D(soundtype,this.volumn2DDefault,fn_map.curLevel.assetType,true)
end
function this.Play2DLoop_Battle(soundtype)
AudioPoolManager.Instance:Play2DLoop(soundtype,this.volumn2DDefault,fn_map.curLevel.assetType,true)
end
function this.PlayBGAudio_Battle(bgm)
AudioPoolManager.Instance:PlayBGAudio(bgm,fn_map.curLevel.assetType,true)
end
-- 通⽤⾳效
function this.Play2D(soundtype)
AudioPoolManager.Instance:Play2D(soundtype,this.volumn2DDefault,0)
end
function this.Play2DLoop(soundtype)
AudioPoolManager.Instance:Play2DLoop(soundtype,this.volumn2DDefault,0)
end
function this.End2D(sname)
AudioPoolManager.Instance:End2D(sname)
end
function this.SetMusicVolume(v)
AudioPoolManager.Instance:SetMusicVolume(v)
end
function this.PlayMusic(mname)
AudioPoolManager.Instance:PlayMusic(mname)
end
function this.PauseMusic()
AudioPoolManager.Instance:PauseMusic()
end
function this.UnPauseMusic()
AudioPoolManager.Instance:UnPauseMusic()
end
function this.PlayBGAudio(bgm)
AudioPoolManager.Instance:PlayBGAudio(bgm)
end
function this.StopMusic()
AudioPoolManager.Instance:StopMusic()
end
-- //通常切换场景的时候调⽤
function this.ClearMusic()
AudioPoolManager.Instance:ClearMusic()
AudioPoolManager.Instance:Clear2DSpec()
end
-- 切后台 ------------------------------------------------- begin
function this.OnGameShow()
AudioPoolManager.Instance:OnGameShow()
--⾳乐
--this.UnPauseMusic()
--⾳效⽆需要恢复
end
function this.OnGameHide()
AudioPoolManager.Instance:OnGameHide()
-- --⾳乐
-- this.PauseMusic()
-- -- ⾳效
-- AudioPoolManager.Instance:Clear Al12D()
end
-- 切后台 ------------------------------------------------- end
-- 设置特殊的播放模式 mode模式 volumerate⾳量系数 ---------------------------------- begin
-- 1,//弹出ui界⾯的模式
function this.Set2DSpec_On(volumeRate)
AudioPoolManager.Instance:Play2DSpec_On(volumeRate)
end
--关闭特殊的播放模式
function this.Set2DSpec_Off()
AudioPoolManager.Instance:Play2DSpec_Off()
end
function this.Play2D_Spec(soundtype)
AudioPoolManager.Instance:Play2D_Spec(soundtype,this.volumn2DDefault,0)
end
function this.Play2DLoop_Spec(soundtype)
AudioPoolManager.Instance:Play2DLoop_Spec(soundtype,this.volumn2DDefault,0)
end
------------------------------------------------------------------------------------ end
--播放通⽤的⽆效⾳效
-- function this.PlayAudio_Invalid()
-- log_Orange("audio","PlayAudio_Invalid() 暂时不⽤")
-- do return end
-- this.Play2D("page_audio_sfx_board_fail")
-- end
--播放通⽤的成功⾳效
-- function this.PlayAudio_Success()
-- log_Orange("audio","PlayAudio_Success() 暂时不⽤")
-- do return end
-- this.Play2D("page_audio_sfx_board_show")
-- --this.Play2D("page_audio_sfx_btn_click")
-- end
-- 请等待 需要⼀点激情
function this.PlayAudio_ComingSoon()
this.Play2D("page_audio_sfx_btn_positive")
end
-- 已完成事件
function this.PlayAudio_HasComplete()
this.Play2D("page_audio_sfx_btn_negative")
end
--条件不满⾜
function this.PlayAudio_Invalid()
this.Play2D("page_audio_sfx_btn_negative")
end
-- 2020/06/08wangliangIMP ------------------------------- begin
-- 被中断或者提前结束
local hasOver = false
--是否播放过⾳频
local hasPlayedNumberAudio = false
--TO DO存储事件类型对应的Tween ID--mT we enID暂时使⽤hasOver来控制,只⽀持同时播放⼀个该种类型的⾳效
--播放数字跳动得⾳效传⼊播放得时间
function this.PlayNumberAnimAudio(times)
--logError("TEST!!!flow audiomanager.PlayNumberAnim Audio() times:"..tostring(times) ..'/CurTimeSpan:'..tostring(timehelper.CurTimeSpan) )
--log_Stack()
hasOver=false
this.Play2DLoop("numberanim_loop")
hasPlayedNumberAudio=true
--0.08是结束⾳效得⻓度
DOVirtual.DelayedCall(
times - 0.08,
function()
if not hasOver then
this.EndNumberAnimAudio()
end
end
)
end
function this.EndNumberAnimAudio()
-- 2020/07/08 wangliang TST -------------------------------- begin
-- logError('audiomanager.EndNumberAnimAudio()')
-- log_Stack()
-- 新机制制作的机台这⾥有明显的延时!!!
log_Orange("flow","audiomanager.EndNumberAnimAudio()")
--------------------------------------------------------- end
if hasPlayedNumberAudio then
hasOver=true
this.End2D("numberanim_loop")
this.Play2D("numberanim_end")
-- logError('TEST!!!flow audiomanager.EndNumberAnimAudio() CurTimeSpan:'..tostring(timehelper.CurTimeSpan) )
hasPlayedNumberAudio=false
end
end
-- 2020/06/08wangliangIMP ------------------------------- end |
-- Integration of ambox with sockets.
--
function asock_module(socket)
socket = socket or require("socket")
select = socket.select
local tinsert = table.insert
local aself = ambox.self_addr
local asend = ambox.send_later
local arecv = ambox.recv
local reading = {} -- Array of reading sockets for next select().
local writing = {} -- Array of writing sockets for next select().
local reverse_r = {} -- Reverse lookup socket to reading index.
local reverse_w = {} -- Reverse lookup socket to writing index.
local waiting_actor = {} -- Key is socket, value is actor addr.
local SKT = 0x000050CE4 -- For ambox message filter_skt().
local tot_send = 0
local tot_send_wait = 0
local tot_recv = 0
local tot_recv_wait = 0
local tot_recv_timeout = 0
------------------------------------------
local function skt_unwait(skt, sockets, reverse)
waiting_actor[skt] = nil
local cur = reverse[skt]
if cur then
reverse[skt] = nil
local num = #sockets
local top = sockets[num]
assert(cur >= 1 and cur <= num)
sockets[num] = nil
if cur < num then
sockets[cur] = top
reverse[top] = cur
end
end
end
local function skt_wait(skt, sockets, reverse, actor_addr)
assert(not waiting_actor[skt])
assert(not reverse[skt])
waiting_actor[skt] = actor_addr
tinsert(sockets, skt)
reverse[skt] = #sockets
end
------------------------------------------
local function awake_actor(skt)
assert(skt)
local actor_addr = waiting_actor[skt]
skt_unwait(skt, reading, reverse_r)
skt_unwait(skt, writing, reverse_w)
if actor_addr then
asend(actor_addr, SKT, skt)
end
end
local function process_ready(ready, name)
for i = 1, #ready do
awake_actor(ready[i])
end
end
local function step(timeout)
if #reading <= 0 and #writing <= 0 and not timeout then
return nil
end
local readable, writable, err = select(reading, writing, timeout)
process_ready(writable, "w")
process_ready(readable, "r")
return err
end
-- A filter for ambox.recv(), where we only want awake_actor() calls.
--
local function filter_skt(s, skt)
return ((s == SKT) and skt) or (s == 'timeout')
end
------------------------------------------
local function recv(actor_addr, skt, pattern, part, partial_ok, opt_timeout)
tot_recv = tot_recv + 1
local s, err, skt_recv
repeat
s, err, part = skt:receive(pattern, part)
if s or err ~= "timeout" then
return s, err, part
end
if partial_ok and
part ~= "" and
part ~= nil and
type(pattern) == "number" then
return s, err, part
end
tot_recv_wait = tot_recv_wait + 1
skt_wait(skt, reading, reverse_r, actor_addr)
s, skt_recv = arecv(filter_skt, opt_timeout)
if s == 'timeout' then
tot_recv_timeout = tot_recv_timeout + 1
skt_unwait(skt, reading, reverse_r)
skt_unwait(skt, writing, reverse_w)
return nil, 'timeout', part
end
assert(skt == skt_recv)
until false
end
local function send(actor_addr, skt, data, from, to)
tot_send = tot_send + 1
local lastIndex = (from or 1) - 1
local s, err, skt_recv
repeat
s, err, lastIndex = skt:send(data, lastIndex + 1, to)
if s or err ~= "timeout" then
return s, err, lastIndex
end
tot_send_wait = tot_send_wait + 1
skt_wait(skt, writing, reverse_w, actor_addr)
s, skt_recv = arecv(filter_skt)
assert(skt == skt_recv)
until false
end
local function loop_accept(actor_addr, skt, handler, timeout)
skt:settimeout(timeout or 0)
repeat
local client_skt, err = skt:accept()
if client_skt then
handler(client_skt)
end
skt_wait(skt, reading, reverse_r, actor_addr)
local s, skt_recv = arecv(filter_skt)
assert(skt == skt_recv)
until false
end
local wrap_mt = {
__index = {
send = function(self, data, from, to)
return send(aself(), self[1], data, from, to)
end,
receive = function(self, pattern, part)
return recv(aself(), self[1], pattern, part)
end,
flush = function(self) return self[1]:flush() end,
close = function(self) return self[1]:close() end,
shutdown = function(self) return self[1]:shutdown() end,
setoption = function(self, option, value)
return self[1]:setoption(option, value)
end,
settimeout = function(self, time, mode)
return self[1]:settimeout(time, mode)
end,
getpeername = function(self) return self[1]:getpeername() end,
getsockname = function(self) return self[1]:getsockname() end,
getstats = function(self) return self[1]:getstats() end,
}
}
local function wrap(skt)
return setmetatable({ skt }, wrap_mt)
end
local function stats()
return { tot_send = tot_send,
tot_send_wait = tot_send_wait,
tot_recv = tot_recv,
tot_recv_wait = tot_recv_wait,
tot_recv_timeout = tot_recv_timeout }
end
------------------------------------------
return { step = step,
recv = recv,
send = send,
wrap = wrap,
loop_accept = loop_accept,
stats = stats }
end
return asock_module()
|
me = game.Players.luxulux
char = me.Character
place = 1
trapdist = 10
modes = {"jail","trap"}
mode = modes[place]
function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
part.Parent = parent
part.formFactor = form
part.CanCollide = collide
part.Transparency = tran
part.Reflectance = ref
part.Size = Vector3.new(x,y,z)
part.BrickColor = BrickColor.new(color)
part.TopSurface = 0
part.BottomSurface = 0
part.Anchored = anchor
part.Locked = true
part:BreakJoints()
end
function gettorsos(path,object)
local torsos = {}
for _,v in pairs(path:children()) do
for _,k in pairs(v:children()) do
if k.Parent:findFirstChild("Humanoid") ~= nil and k.Name == "Torso" then
if (k.Position - object.Position).magnitude < trapdist then
table.insert(torsos,k)
end
end
end
end
return torsos
end
trail = Instance.new("Part")
prop(trail,nil,false,0.4,0.05,0.3,0.3,1,"Bright red",true,"Custom")
trailmesh = Instance.new("BlockMesh",trail)
point = Instance.new("Part")
prop(point,nil,false,0.3,0.05,1.2,0.3,1.2,"Bright violet",true,"Custom")
local pm = Instance.new("SpecialMesh",point)
pm.MeshType = "Sphere"
function jail(pos)
local cf = CFrame.new(pos) * CFrame.new(0,3,0) * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
local mod = Instance.new("Model",workspace)
mod.Name = "Jail, xS"
for i=1, 360, 90 do
local p = Instance.new("Part")
prop(p,mod,true,1,0.1,11,11,0.2,"Bright blue",true,"Custom")
p.CFrame = cf * CFrame.Angles(math.rad(i),0,0) * CFrame.new(0,0,-5.5)
p.Name = "Window"
end
local lol = cf * CFrame.Angles(0,math.rad(90),0)
for i=0, 180, 180 do
local p = Instance.new("Part")
prop(p,mod,true,1,0.1,11,11,0.2,"Bright blue",true,"Custom")
p.CFrame = lol * CFrame.Angles(math.rad(i),0,0) * CFrame.new(0,0,-5.5)
p.Name = "Window"
end
for i=1, 360, 90 do
local p = Instance.new("Part")
prop(p,mod,true,1,0.1,1.5,12.5,1.5,"Medium grey",true,"Custom")
p.CFrame = cf * CFrame.Angles(math.rad(i),0,0) * CFrame.new(-5.5,0,-5.5)
local o = Instance.new("Part")
prop(o,mod,true,1,0.1,1.5,12.5,1.5,"Medium grey",true,"Custom")
o.CFrame = cf * CFrame.Angles(math.rad(i),0,0) * CFrame.new(5.5,0,-5.5)
end
for i=0, 180, 180 do
local p = Instance.new("Part")
prop(p,mod,true,1,0.1,1.5,1.5,12.5,"Medium grey",true,"Custom")
p.CFrame = lol * CFrame.Angles(math.rad(i),0,0) * CFrame.new(-5.5,-5.5,0)
local o = Instance.new("Part")
prop(o,mod,true,1,0.1,1.5,1.5,12.5,"Medium grey",true,"Custom")
o.CFrame = lol * CFrame.Angles(math.rad(i),0,0) * CFrame.new(5.5,5.5,0)
end
for _,v in pairs(mod:children()) do
coroutine.resume(coroutine.create(function()
for i=1, 0, -0.05 do
wait()
if v.Name == "Window" then
v.Transparency = i + 0.4
else
v.Transparency = i
end
end
end))
wait()
end
end
function trap(pos)
local mod = Instance.new("Model",workspace)
mod.Name = "Trap, xS"
local y = 0.3
for i=12.5,6,-1.5 do
local p = Instance.new("Part")
prop(p,mod,true,1,0.06,i,1,i,"Black",true,"Custom")
p.CFrame = CFrame.new(pos) * CFrame.new(0,y,0)
Instance.new("CylinderMesh",p)
y = y + i/30
end
local p = Instance.new("Part")
prop(p,mod,true,1,0.1,5,0.2,5,"Lime green",true,"Custom")
p.CFrame = CFrame.new(pos) * CFrame.new(0,y+0.2,0)
Instance.new("CylinderMesh",p)
local trapped = false
coroutine.resume(coroutine.create(function()
while mod.Parent ~= nil do
local objs = gettorsos(workspace,p)
if trapped then break end
for _,v in pairs(objs) do
if trapped then break end
trapped = true
local bp = Instance.new("BodyPosition",v)
bp.position = p.Position + Vector3.new(0,6,0)
bp.P = 6000
bp.maxForce = Vector3.new(math.huge,math.huge,math.huge)
local bav = Instance.new("BodyAngularVelocity",v)
bav.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
bav.P = 7000
bav.angularvelocity = Vector3.new(0,30,0)
local o = Instance.new("Part")
prop(o,mod,false,0.6,0.1,1,1,1,"Lime green",true,"Custom")
local mo = Instance.new("SpecialMesh",o)
mo.MeshType = "Sphere"
mo.Scale = Vector3.new(5.2,8,5.2)
o.CFrame = p.CFrame * CFrame.new(0,-5,0)
for i=-5,6,0.25 do
wait()
o.CFrame = p.CFrame * CFrame.new(0,i,0)
end
wait(5)
local ex = Instance.new("Explosion",mod)
ex.BlastRadius = 2
ex.BlastPressure = 50000
ex.Position = v.Position
ex.Hit:connect(function(p)
p:breakJoints()
end)
o:remove()
for _,j in pairs(mod:children()) do
coroutine.resume(coroutine.create(function()
for i=0, 1, 0.1 do
wait()
j.Transparency = i
end
j:remove()
end))
wait(0.04)
end
mod:remove()
bav:remove()
bp:remove()
end
wait(0.08)
end
end))
for _,v in pairs(mod:children()) do
coroutine.resume(coroutine.create(function()
for i=1, 0, -0.05 do
wait()
v.Transparency = i
end
v.Transparency = 0
end))
wait()
end
end
if script.Parent.className ~= "HopperBin" then
h = Instance.new("HopperBin",me.Backpack)
h.Name = "Lol?"
script.Parent = h
end
bin = script.Parent
sel = false
bin.Selected:connect(function(mouse)
sel = true
trail.Parent = char
point.Parent = char
coroutine.resume(coroutine.create(function()
while sel do
local dis = (me.Character.Torso.Position - mouse.Hit.p).magnitude
trailmesh.Scale = Vector3.new(1,1,dis)
trail.CFrame = CFrame.new(me.Character.Torso.Position, mouse.Hit.p) * CFrame.new(0,0,-dis/2)
point.CFrame = CFrame.new(mouse.Hit.p)
wait()
end
end))
mouse.Button1Down:connect(function()
if mode == "jail" then
jail(mouse.Hit.p)
elseif mode == "trap" then
trap(mouse.Hit.p)
end
for i=0.3,1,0.1 do
pm.Scale = pm.Scale + Vector3.new(0.6,4,0.6)
point.Transparency = i
wait()
end
point.Transparency = 0.3
pm.Scale = Vector3.new(1,1,1)
end)
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "q" then
place = place - 1
if place < 1 then
place = #modes
end
mode = modes[place]
elseif key == "e" then
place = place + 1
if place > #modes then
place = 1
end
mode = modes[place]
end
end)
end)
bin.Deselected:connect(function()
sel = false
trail.Parent = nil
point.Parent = nil
end)
|
local plyrs = game:GetService("Players")
local wkrsp = game:GetService("Workspace")
local game = game
local hull = 500
local pilot = false
local alive = true
local cannon = true
local colors = {"Dark red", "Reddish brown"}
local color = nil
local pos = 5
local forward = false
local back = false
local turn = false
local up = false
local down = false
local speed = 100
if cannon == true then
color = colors[1]
else
color = colors[2]
end
pcall(function() wkrsp.Base.Morala:remove() end)
local model = Instance.new("Model", wkrsp.Base)
model.Name = "Morala"
local base = Instance.new("Part", model)
base.formFactor = "Custom"
base.BrickColor = BrickColor.new(color)
base.Size = Vector3.new(25, 1, 50)
base.CFrame = CFrame.new(75, 1, 0)
base.CanCollide = true
local basem = Instance.new("BlockMesh", base)
basem.Bevel = 0.075
basem.Scale = Vector3.new(1, 1, 1)
base:BreakJoints()
local basep = Instance.new("BodyPosition", base)
basep.position = Vector3.new(75, pos, 0)
basep.maxForce = Vector3.new(math.huge, math.huge, math.huge)
local baseg = Instance.new("BodyGyro", base)
baseg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
local base2 = Instance.new("Part", model)
base2.formFactor = "Custom"
base2.BrickColor = BrickColor.new(color)
base2.Size = Vector3.new(25, 1, 50)
base2.CFrame = CFrame.new(75, 1, 0)
base2.CanCollide = true
local base2m = Instance.new("BlockMesh", base2)
base2m.Bevel = 0.075
base2m.Scale = Vector3.new(1, 1, 1)
base2:BreakJoints()
local base2w = Instance.new("Weld", base2)
base2w.Part0 = base2
base2w.Part1 = base
base2w.C0 = CFrame.new(-2.5, 0.005, 27) * CFrame.Angles(0, 0.75, 0)
local base3 = Instance.new("Part", model)
base3.formFactor = "Custom"
base3.BrickColor = BrickColor.new(color)
base3.Size = Vector3.new(25, 1, 50)
base3.CFrame = CFrame.new(75, 1, 0)
base3.CanCollide = true
local base3m = Instance.new("BlockMesh", base3)
base3m.Bevel = 0.075
base3m.Scale = Vector3.new(1, 1, 1)
base3:BreakJoints()
local base3w = Instance.new("Weld", base3)
base3w.Part0 = base3
base3w.Part1 = base
base3w.C0 = CFrame.new(2.5, 0.005, 27) * CFrame.Angles(0, -0.75, 0)
local base4 = Instance.new("Part", model)
base4.formFactor = "Custom"
base4.BrickColor = BrickColor.new(color)
base4.Size = Vector3.new(20, 3, 1)
base4.CFrame = CFrame.new(75, 1, 0)
base4.CanCollide = true
local base4m = Instance.new("BlockMesh", base4)
base4m.Bevel = 0.075
base4m.Scale = Vector3.new(1, 1, 1)
base4:BreakJoints()
local base4w = Instance.new("Weld", base4)
base4w.Part0 = base4
base4w.Part1 = base
base4w.C0 = CFrame.new(0, -1.5, 24.5) * CFrame.Angles(0, 0, 0)
local base5 = Instance.new("Part", model)
base5.formFactor = "Custom"
base5.BrickColor = BrickColor.new("Bright blue")
base5.Transparency = 0.5
base5.Size = Vector3.new(20, 6, 1)
base5.CFrame = CFrame.new(75, 1, 0)
base5.CanCollide = true
local base5m = Instance.new("BlockMesh", base5)
base5m.Bevel = 0.075
base5m.Scale = Vector3.new(0.9999, 1, 0.75)
base5:BreakJoints()
local base5w = Instance.new("Weld", base5)
base5w.Part0 = base5
base5w.Part1 = base
base5w.C0 = CFrame.new(0, -4, 24.5) * CFrame.Angles(0, 0, 0)
local base6 = Instance.new("Part", model)
base6.formFactor = "Custom"
base6.BrickColor = BrickColor.new(color)
base6.Size = Vector3.new(20, 3, 1)
base6.CFrame = CFrame.new(75, 1, 0)
base6.CanCollide = true
local base6m = Instance.new("BlockMesh", base6)
base6m.Bevel = 0.075
base6m.Scale = Vector3.new(1, 1, 1)
base6:BreakJoints()
local base6w = Instance.new("Weld", base6)
base6w.Part0 = base6
base6w.Part1 = base
base6w.C0 = CFrame.new(0, -8, 24.5) * CFrame.Angles(0, 0, 0)
local base7 = Instance.new("Part", model)
base7.formFactor = "Custom"
base7.BrickColor = BrickColor.new(color)
base7.Size = Vector3.new(27.5, 3, 1)
base7.CFrame = CFrame.new(75, 1, 0)
base7.CanCollide = true
local base7m = Instance.new("BlockMesh", base7)
base7m.Bevel = 0.075
base7m.Scale = Vector3.new(1, 1, 1)
base7:BreakJoints()
local base7w = Instance.new("Weld", base7)
base7w.Part0 = base7
base7w.Part1 = base
base7w.C0 = CFrame.new(-38.25, -1.5, 9.5) * CFrame.Angles(0, -0.825, 0)
local base8 = Instance.new("Part", model)
base8.formFactor = "Custom"
base8.Transparency = 0.5
base8.BrickColor = BrickColor.new("Bright blue")
base8.Size = Vector3.new(27.5, 6, 1)
base8.CFrame = CFrame.new(75, 1, 0)
base8.CanCollide = true
local base8m = Instance.new("BlockMesh", base8)
base8m.Bevel = 0.075
base8m.Scale = Vector3.new(0.9999, 1, 0.75)
base8:BreakJoints()
local base8w = Instance.new("Weld", base8)
base8w.Part0 = base8
base8w.Part1 = base
base8w.C0 = CFrame.new(-38.25, -4, 9.5) * CFrame.Angles(0, -0.825, 0)
local base9 = Instance.new("Part", model)
base9.formFactor = "Custom"
base9.BrickColor = BrickColor.new(color)
base9.Size = Vector3.new(27.5, 3, 1)
base9.CFrame = CFrame.new(75, 1, 0)
base9.CanCollide = true
local base9m = Instance.new("BlockMesh", base9)
base9m.Bevel = 0.075
base9m.Scale = Vector3.new(1, 1, 1)
base9:BreakJoints()
local base9w = Instance.new("Weld", base9)
base9w.Part0 = base9
base9w.Part1 = base
base9w.C0 = CFrame.new(-38.25, -8, 9.5) * CFrame.Angles(0, -0.825, 0)
local base10 = Instance.new("Part", model)
base10.formFactor = "Custom"
base10.BrickColor = BrickColor.new(color)
base10.Size = Vector3.new(27.5, 3, 1)
base10.CFrame = CFrame.new(75, 1, 0)
base10.CanCollide = true
local base10m = Instance.new("BlockMesh", base10)
base10m.Bevel = 0.075
base10m.Scale = Vector3.new(1, 1, 1)
base10:BreakJoints()
local base10w = Instance.new("Weld", base10)
base10w.Part0 = base10
base10w.Part1 = base
base10w.C0 = CFrame.new(38.25, -1.5, 9.5) * CFrame.Angles(0, 0.825, 0)
local base11 = Instance.new("Part", model)
base11.formFactor = "Custom"
base11.Transparency = 0.5
base11.BrickColor = BrickColor.new("Bright blue")
base11.Size = Vector3.new(27.5, 6, 1)
base11.CFrame = CFrame.new(75, 1, 0)
base11.CanCollide = true
local base11m = Instance.new("BlockMesh", base11)
base11m.Bevel = 0.075
base11m.Scale = Vector3.new(0.9999, 1, 0.75)
base11:BreakJoints()
local base11w = Instance.new("Weld", base11)
base11w.Part0 = base11
base11w.Part1 = base
base11w.C0 = CFrame.new(38.25, -4, 9.5) * CFrame.Angles(0, 0.825, 0)
local base12 = Instance.new("Part", model)
base12.formFactor = "Custom"
base12.BrickColor = BrickColor.new(color)
base12.Size = Vector3.new(27.5, 3, 1)
base12.CFrame = CFrame.new(75, 1, 0)
base12.CanCollide = true
local base12m = Instance.new("BlockMesh", base12)
base12m.Bevel = 0.075
base12m.Scale = Vector3.new(1, 1, 1)
base12:BreakJoints()
local base12w = Instance.new("Weld", base12)
base12w.Part0 = base12
base12w.Part1 = base
base12w.C0 = CFrame.new(38.25, -8, 9.5) * CFrame.Angles(0, 0.825, 0)
local base13 = Instance.new("Part", model)
base13.formFactor = "Custom"
base13.BrickColor = BrickColor.new(color)
base13.Size = Vector3.new(25, 10, 1)
base13.CFrame = CFrame.new(75, 1, 0)
base13.CanCollide = true
local base13m = Instance.new("BlockMesh", base13)
base13m.Bevel = 0.075
base13m.Scale = Vector3.new(1, 1, 1)
base13:BreakJoints()
local base13w = Instance.new("Weld", base13)
base13w.Part0 = base13
base13w.Part1 = base2
base13w.C0 = CFrame.new(0, -4.5, 25) * CFrame.Angles(0, 0, 0)
local base14 = Instance.new("Part", model)
base14.formFactor = "Custom"
base14.BrickColor = BrickColor.new(color)
base14.Size = Vector3.new(25, 10, 1)
base14.CFrame = CFrame.new(75, 1, 0)
base14.CanCollide = true
local base14m = Instance.new("BlockMesh", base14)
base14m.Bevel = 0.075
base14m.Scale = Vector3.new(1, 1, 1)
base14:BreakJoints()
local base14w = Instance.new("Weld", base14)
base14w.Part0 = base14
base14w.Part1 = base3
base14w.C0 = CFrame.new(0, -4.5, 25) * CFrame.Angles(0, 0, 0)
local base15 = Instance.new("Part", model)
base15.formFactor = "Custom"
base15.BrickColor = BrickColor.new(color)
base15.Size = Vector3.new(25, 10, 1)
base15.CFrame = CFrame.new(75, 1, 0)
base15.CanCollide = true
local base15m = Instance.new("BlockMesh", base15)
base15m.Bevel = 0.075
base15m.Scale = Vector3.new(1, 1, 1)
base15:BreakJoints()
local base15w = Instance.new("Weld", base15)
base15w.Part0 = base15
base15w.Part1 = base
base15w.C0 = CFrame.new(0, -4.5, -25) * CFrame.Angles(0, 0, 0)
local base16 = Instance.new("Part", model)
base16.formFactor = "Custom"
base16.BrickColor = BrickColor.new(color)
base16.Size = Vector3.new(1, 10, 50)
base16.CFrame = CFrame.new(75, 1, 0)
base16.CanCollide = true
local base16m = Instance.new("BlockMesh", base16)
base16m.Bevel = 0.075
base16m.Scale = Vector3.new(1, 1, 1)
base16:BreakJoints()
local base16w = Instance.new("Weld", base16)
base16w.Part0 = base16
base16w.Part1 = base2
base16w.C0 = CFrame.new(-12.5, -4.5, 0) * CFrame.Angles(0, 0, 0)
local base17 = Instance.new("Part", model)
base17.formFactor = "Custom"
base17.BrickColor = BrickColor.new(color)
base17.Size = Vector3.new(1, 10, 50)
base17.CFrame = CFrame.new(75, 1, 0)
base17.CanCollide = true
local base17m = Instance.new("BlockMesh", base17)
base17m.Bevel = 0.075
base17m.Scale = Vector3.new(1, 1, 1)
base17:BreakJoints()
local base17w = Instance.new("Weld", base17)
base17w.Part0 = base17
base17w.Part1 = base3
base17w.C0 = CFrame.new(12.5, -4.5, 0) * CFrame.Angles(0, 0, 0)
local base18 = Instance.new("Part", model)
base18.formFactor = "Custom"
base18.BrickColor = BrickColor.new(color)
base18.Size = Vector3.new(15, 1, 25)
base18.CFrame = CFrame.new(75, 1, 0)
base18.CanCollide = true
local base18m = Instance.new("BlockMesh", base18)
base18m.Bevel = 0.075
base18m.Scale = Vector3.new(1, 1, 1)
base18:BreakJoints()
local base18w = Instance.new("Weld", base18)
base18w.Part0 = base18
base18w.Part1 = base
base18w.C0 = CFrame.new(7.5, 0.005, -27) * CFrame.Angles(0, -1, 0)
local base19 = Instance.new("Part", model)
base19.formFactor = "Custom"
base19.BrickColor = BrickColor.new(color)
base19.Size = Vector3.new(15, 1, 25)
base19.CFrame = CFrame.new(75, 1, 0)
base19.CanCollide = true
local base19m = Instance.new("BlockMesh", base19)
base19m.Bevel = 0.075
base19m.Scale = Vector3.new(1, 1, 1)
base19:BreakJoints()
local base19w = Instance.new("Weld", base19)
base19w.Part0 = base19
base19w.Part1 = base
base19w.C0 = CFrame.new(-7.5, 0.005, -27) * CFrame.Angles(0, 1, 0)
local base20 = Instance.new("Part", model)
base20.formFactor = "Custom"
base20.BrickColor = BrickColor.new(color)
base20.Size = Vector3.new(15, 1, 25)
base20.CFrame = CFrame.new(75, 1, 0)
base20.CanCollide = true
local base20m = Instance.new("BlockMesh", base20)
base20m.Bevel = 0.075
base20m.Scale = Vector3.new(1, 1, 1)
base20:BreakJoints()
local base20w = Instance.new("Weld", base20)
base20w.Part0 = base20
base20w.Part1 = base19
base20w.C0 = CFrame.new(5.05, 0.0025, -19.75) * CFrame.Angles(0, -0.5, 0)
local base21 = Instance.new("Part", model)
base21.formFactor = "Custom"
base21.BrickColor = BrickColor.new(color)
base21.Size = Vector3.new(15, 1, 25)
base21.CFrame = CFrame.new(75, 1, 0)
base21.CanCollide = true
local base21m = Instance.new("BlockMesh", base21)
base21m.Bevel = 0.075
base21m.Scale = Vector3.new(1, 1, 1)
base21:BreakJoints()
local base21w = Instance.new("Weld", base21)
base21w.Part0 = base21
base21w.Part1 = base18
base21w.C0 = CFrame.new(-5.05, 0.0025, -19.75) * CFrame.Angles(0, 0.5, 0)
local base22 = Instance.new("Part", model)
base22.formFactor = "Custom"
base22.BrickColor = BrickColor.new(color)
base22.Size = Vector3.new(15, 1, 65)
base22.CFrame = CFrame.new(75, 1, 0)
base22.CanCollide = true
local base22m = Instance.new("BlockMesh", base22)
base22m.Bevel = 0.075
base22m.Scale = Vector3.new(1, 1, 1)
base22:BreakJoints()
local base22w = Instance.new("Weld", base22)
base22w.Part0 = base22
base22w.Part1 = base21
base22w.C0 = CFrame.new(-5.05, -0.0025, -39.75) * CFrame.Angles(0, 0.5, 0)
local base23 = Instance.new("Part", model)
base23.formFactor = "Custom"
base23.BrickColor = BrickColor.new(color)
base23.Size = Vector3.new(15, 1, 65)
base23.CFrame = CFrame.new(75, 1, 0)
base23.CanCollide = true
local base23m = Instance.new("BlockMesh", base23)
base23m.Bevel = 0.075
base23m.Scale = Vector3.new(1, 1, 1)
base23:BreakJoints()
local base23w = Instance.new("Weld", base23)
base23w.Part0 = base23
base23w.Part1 = base20
base23w.C0 = CFrame.new(5.05, -0.0025, -39.75) * CFrame.Angles(0, -0.5, 0)
local base24 = Instance.new("Part", model)
base24.formFactor = "Custom"
base24.BrickColor = BrickColor.new(color)
base24.Size = Vector3.new(15, 1, 25)
base24.CFrame = CFrame.new(75, 1, 0)
base24.CanCollide = true
local base24m = Instance.new("BlockMesh", base24)
base24m.Bevel = 0.075
base24m.Scale = Vector3.new(1, 1, 1)
base24:BreakJoints()
local base24w = Instance.new("Weld", base24)
base24w.Part0 = base24
base24w.Part1 = base23
base24w.C0 = CFrame.new(14.6, 0.0025, -37.25) * CFrame.Angles(0, -0.5, 0)
local base25 = Instance.new("Part", model)
base25.formFactor = "Custom"
base25.BrickColor = BrickColor.new(color)
base25.Size = Vector3.new(15, 1, 25)
base25.CFrame = CFrame.new(75, 1, 0)
base25.CanCollide = true
local base25m = Instance.new("BlockMesh", base25)
base25m.Bevel = 0.075
base25m.Scale = Vector3.new(1, 1, 1)
base25:BreakJoints()
local base25w = Instance.new("Weld", base25)
base25w.Part0 = base25
base25w.Part1 = base22
base25w.C0 = CFrame.new(-14.6, 0.0025, -37.25) * CFrame.Angles(0, 0.5, 0)
local base26 = Instance.new("Part", model)
base26.formFactor = "Custom"
base26.BrickColor = BrickColor.new(color)
base26.Size = Vector3.new(15, 1, 25)
base26.CFrame = CFrame.new(75, 1, 0)
base26.CanCollide = true
local base26m = Instance.new("BlockMesh", base26)
base26m.Bevel = 0.075
base26m.Scale = Vector3.new(1, 1, 1)
base26:BreakJoints()
local base26w = Instance.new("Weld", base26)
base26w.Part0 = base26
base26w.Part1 = base25
base26w.C0 = CFrame.new(-5.05, -0.005, -19.75) * CFrame.Angles(0, 0.5, 0)
local base27 = Instance.new("Part", model)
base27.formFactor = "Custom"
base27.BrickColor = BrickColor.new(color)
base27.Size = Vector3.new(15, 1, 25)
base27.CFrame = CFrame.new(75, 1, 0)
base27.CanCollide = true
local base27m = Instance.new("BlockMesh", base27)
base27m.Bevel = 0.075
base27m.Scale = Vector3.new(1, 1, 1)
base27:BreakJoints()
local base27w = Instance.new("Weld", base27)
base27w.Part0 = base27
base27w.Part1 = base24
base27w.C0 = CFrame.new(5.05, -0.005, -19.75) * CFrame.Angles(0, -0.5, 0)
local base28 = Instance.new("Part", model)
base28.formFactor = "Custom"
base28.BrickColor = BrickColor.new(color)
base28.Size = Vector3.new(15, 1, 25)
base28.CFrame = CFrame.new(75, 1, 0)
base28.CanCollide = true
local base28m = Instance.new("BlockMesh", base28)
base28m.Bevel = 0.075
base28m.Scale = Vector3.new(1, 1, 1)
base28:BreakJoints()
local base28w = Instance.new("Weld", base28)
base28w.Part0 = base28
base28w.Part1 = base27
base28w.C0 = CFrame.new(5.55, -0.005, -18.75) * CFrame.Angles(0, -0.575, 0)
local base29 = Instance.new("Part", model)
base29.formFactor = "Custom"
base29.BrickColor = BrickColor.new(color)
base29.Size = Vector3.new(65, 1, 108)
base29.CFrame = CFrame.new(75, 1, 0)
base29.CanCollide = true
local base29m = Instance.new("BlockMesh", base29)
base29m.Bevel = 0.075
base29m.Scale = Vector3.new(1, 1, 1)
base29:BreakJoints()
local base29w = Instance.new("Weld", base29)
base29w.Part0 = base29
base29w.Part1 = base
base29w.C0 = CFrame.new(0, 0.025, -75) * CFrame.Angles(0, 0, 0)
--most of walls
local times = 0
for i = 1, 9 do
times = times + 1
local wall1 = Instance.new("Part", model)
wall1.formFactor = "Custom"
wall1.BrickColor = BrickColor.new(color)
wall1.Size = Vector3.new(1, 10, 25)
wall1.CFrame = CFrame.new(75, 1, 0)
wall1.CanCollide = true
local wall1m = Instance.new("BlockMesh", wall1)
wall1m.Bevel = 0.075
wall1m.Scale = Vector3.new(1, 1, 1)
wall1:BreakJoints()
local wall1w = Instance.new("Weld", wall1)
wall1w.Part0 = wall1
if times == 1 then
wall1w.Part1 = base28
wall1w.C0 = CFrame.new(7.05, -5, 0) * CFrame.Angles(0, 0, 0)
end
if times == 2 then
wall1w.Part1 = base27
wall1w.C0 = CFrame.new(7.05, -5, 0) * CFrame.Angles(0, 0, 0)
end
if times == 3 then
wall1w.Part1 = base26
wall1w.C0 = CFrame.new(-7.05, -5, 0) * CFrame.Angles(0, 0, 0)
end
if times == 4 then
wall1w.Part1 = base25
wall1w.C0 = CFrame.new(-7.05, -5, 0) * CFrame.Angles(0, 0, 0)
end
if times == 5 then
wall1w.Part1 = base24
wall1w.C0 = CFrame.new(7.05, -5, 0) * CFrame.Angles(0, 0, 0)
end
if times == 6 then
wall1w.Part1 = base21
wall1w.C0 = CFrame.new(-7.05, -5, 0) * CFrame.Angles(0, 0, 0)
end
if times == 7 then
wall1w.Part1 = base20
wall1w.C0 = CFrame.new(7.05, -5, 0) * CFrame.Angles(0, 0, 0)
end
if times == 8 then
wall1w.Part1 = base19
wall1w.C0 = CFrame.new(7.05, -5, 0) * CFrame.Angles(0, 0, 0)
end
if times == 9 then
wall1w.Part1 = base18
wall1w.C0 = CFrame.new(-7.05, -5, 0) * CFrame.Angles(0, 0, 0)
end
wait()
end
local wall2 = Instance.new("Part", model)
wall2.formFactor = "Custom"
wall2.BrickColor = BrickColor.new(color)
wall2.Size = Vector3.new(1, 10, 16.5)
wall2.CFrame = CFrame.new(75, 1, 0)
wall2.CanCollide = true
local wall2m = Instance.new("BlockMesh", wall2)
wall2m.Bevel = 0.075
wall2m.Scale = Vector3.new(1, 1, 1)
wall2:BreakJoints()
local wall2w = Instance.new("Weld", wall2)
wall2w.Part0 = wall2
wall2w.Part1 = base28
wall2w.C0 = CFrame.new(-7.05, -5, 0) * CFrame.Angles(0, 0, 0)
local wall3 = Instance.new("Part", model)
wall3.formFactor = "Custom"
wall3.BrickColor = BrickColor.new(color)
wall3.Size = Vector3.new(1, 10, 17)
wall3.CFrame = CFrame.new(75, 1, 0)
wall3.CanCollide = true
local wall3m = Instance.new("BlockMesh", wall3)
wall3m.Bevel = 0.075
wall3m.Scale = Vector3.new(1, 1, 1)
wall3:BreakJoints()
local wall3w = Instance.new("Weld", wall3)
wall3w.Part0 = wall3
wall3w.Part1 = base27
wall3w.C0 = CFrame.new(-7.05, -5, 0) * CFrame.Angles(0, 0, 0)
local wall4 = Instance.new("Part", model)
wall4.formFactor = "Custom"
wall4.BrickColor = BrickColor.new(color)
wall4.Size = Vector3.new(1, 10, 17)
wall4.CFrame = CFrame.new(75, 1, 0)
wall4.CanCollide = true
local wall4m = Instance.new("BlockMesh", wall4)
wall4m.Bevel = 0.075
wall4m.Scale = Vector3.new(1, 1, 1)
wall4:BreakJoints()
local wall4w = Instance.new("Weld", wall4)
wall4w.Part0 = wall4
wall4w.Part1 = base26
wall4w.C0 = CFrame.new(7.05, -5, 0) * CFrame.Angles(0, 0, 0)
local wall5 = Instance.new("Part", model)
wall5.formFactor = "Custom"
wall5.BrickColor = BrickColor.new(color)
wall5.Size = Vector3.new(1, 10, 18.5)
wall5.CFrame = CFrame.new(75, 1, 0)
wall5.CanCollide = true
local wall5m = Instance.new("BlockMesh", wall5)
wall5m.Bevel = 0.075
wall5m.Scale = Vector3.new(1, 1, 1)
wall5:BreakJoints()
local wall5w = Instance.new("Weld", wall5)
wall5w.Part0 = wall5
wall5w.Part1 = base25
wall5w.C0 = CFrame.new(7.25, -5, 0) * CFrame.Angles(0, 0, 0)
local wall6 = Instance.new("Part", model)
wall6.formFactor = "Custom"
wall6.BrickColor = BrickColor.new(color)
wall6.Size = Vector3.new(1, 10, 18.5)
wall6.CFrame = CFrame.new(75, 1, 0)
wall6.CanCollide = true
local wall6m = Instance.new("BlockMesh", wall6)
wall6m.Bevel = 0.075
wall6m.Scale = Vector3.new(1, 1, 1)
wall6:BreakJoints()
local wall6w = Instance.new("Weld", wall6)
wall6w.Part0 = wall6
wall6w.Part1 = base24
wall6w.C0 = CFrame.new(-7.25, -5, 0) * CFrame.Angles(0, 0, 0)
local wall7 = Instance.new("Part", model)
wall7.formFactor = "Custom"
wall7.BrickColor = BrickColor.new(color)
wall7.Size = Vector3.new(1, 10, 12)
wall7.CFrame = CFrame.new(75, 1, 0)
wall7.CanCollide = true
local wall7m = Instance.new("BlockMesh", wall7)
wall7m.Bevel = 0.075
wall7m.Scale = Vector3.new(1, 1, 1)
wall7:BreakJoints()
local wall7w = Instance.new("Weld", wall7)
wall7w.Part0 = wall7
wall7w.Part1 = base19
wall7w.C0 = CFrame.new(-6.95, -5, -2.85) * CFrame.Angles(0, 0, 0)
local wall8 = Instance.new("Part", model)
wall8.formFactor = "Custom"
wall8.BrickColor = BrickColor.new(color)
wall8.Size = Vector3.new(1, 10, 12)
wall8.CFrame = CFrame.new(75, 1, 0)
wall8.CanCollide = true
local wall8m = Instance.new("BlockMesh", wall8)
wall8m.Bevel = 0.075
wall8m.Scale = Vector3.new(1, 1, 1)
wall8:BreakJoints()
local wall8w = Instance.new("Weld", wall8)
wall8w.Part0 = wall8
wall8w.Part1 = base18
wall8w.C0 = CFrame.new(6.95, -5, -2.85) * CFrame.Angles(0, 0, 0)
local wall9 = Instance.new("Part", model)
wall9.formFactor = "Custom"
wall9.BrickColor = BrickColor.new(color)
wall9.Size = Vector3.new(1, 10, 18)
wall9.CFrame = CFrame.new(75, 1, 0)
wall9.CanCollide = true
local wall9m = Instance.new("BlockMesh", wall9)
wall9m.Bevel = 0.075
wall9m.Scale = Vector3.new(1, 1, 1)
wall9:BreakJoints()
local wall9w = Instance.new("Weld", wall9)
wall9w.Part0 = wall9
wall9w.Part1 = base20
wall9w.C0 = CFrame.new(-6.95, -5, 0) * CFrame.Angles(0, 0, 0)
local wall10 = Instance.new("Part", model)
wall10.formFactor = "Custom"
wall10.BrickColor = BrickColor.new(color)
wall10.Size = Vector3.new(1, 10, 18)
wall10.CFrame = CFrame.new(75, 1, 0)
wall10.CanCollide = true
local wall10m = Instance.new("BlockMesh", wall10)
wall10m.Bevel = 0.075
wall10m.Scale = Vector3.new(1, 1, 1)
wall10:BreakJoints()
local wall10w = Instance.new("Weld", wall10)
wall10w.Part0 = wall10
wall10w.Part1 = base21
wall10w.C0 = CFrame.new(6.95, -5, 0) * CFrame.Angles(0, 0, 0)
local wall11 = Instance.new("Part", model)
wall11.formFactor = "Custom"
wall11.BrickColor = BrickColor.new(color)
wall11.Size = Vector3.new(1, 10, 57)
wall11.CFrame = CFrame.new(75, 1, 0)
wall11.CanCollide = true
local wall11m = Instance.new("BlockMesh", wall11)
wall11m.Bevel = 0.075
wall11m.Scale = Vector3.new(1, 1, 1)
wall11:BreakJoints()
local wall11w = Instance.new("Weld", wall11)
wall11w.Part0 = wall11
wall11w.Part1 = base22
wall11w.C0 = CFrame.new(7.05, -5, 0) * CFrame.Angles(0, 0, 0)
local wall12 = Instance.new("Part", model)
wall12.formFactor = "Custom"
wall12.BrickColor = BrickColor.new(color)
wall12.Size = Vector3.new(1, 10, 65)
wall12.CFrame = CFrame.new(75, 1, 0)
wall12.CanCollide = true
local wall12m = Instance.new("BlockMesh", wall12)
wall12m.Bevel = 0.075
wall12m.Scale = Vector3.new(1, 1, 1)
wall12:BreakJoints()
local wall12w = Instance.new("Weld", wall12)
wall12w.Part0 = wall12
wall12w.Part1 = base22
wall12w.C0 = CFrame.new(-7.05, -5, 0) * CFrame.Angles(0, 0, 0)
local wall13 = Instance.new("Part", model)
wall13.formFactor = "Custom"
wall13.BrickColor = BrickColor.new(color)
wall13.Size = Vector3.new(1, 10, 15.5)
wall13.CFrame = CFrame.new(75, 1, 0)
wall13.CanCollide = true
local wall13m = Instance.new("BlockMesh", wall13)
wall13m.Bevel = 0.075
wall13m.Scale = Vector3.new(1, 1, 1)
wall13:BreakJoints()
local wall13w = Instance.new("Weld", wall13)
wall13w.Part0 = wall13
wall13w.Part1 = base23
wall13w.C0 = CFrame.new(-6.95, -5, 21.25) * CFrame.Angles(0, 0, 0)
local wall14 = Instance.new("Part", model)
wall14.formFactor = "Custom"
wall14.BrickColor = BrickColor.new(color)
wall14.Size = Vector3.new(1, 10, 15.5)
wall14.CFrame = CFrame.new(75, 1, 0)
wall14.CanCollide = true
local wall14m = Instance.new("BlockMesh", wall14)
wall14m.Bevel = 0.075
wall14m.Scale = Vector3.new(1, 1, 1)
wall14:BreakJoints()
local wall14w = Instance.new("Weld", wall14)
wall14w.Part0 = wall14
wall14w.Part1 = base23
wall14w.C0 = CFrame.new(-6.95, -5, -21.25) * CFrame.Angles(0, 0, 0)
--cannon
if cannon == true then
local gun1 = Instance.new("Part", model)
gun1.formFactor = "Custom"
gun1.Name = "gun1s"
gun1.BrickColor = BrickColor.new(color)
gun1.Size = Vector3.new(4, 25, 4)
gun1.CFrame = CFrame.new(75, 1, 0)
gun1.CanCollide = false
local gun1m = Instance.new("CylinderMesh", gun1)
gun1m.Bevel = 0.075
gun1m.Scale = Vector3.new(1, 1, 1)
gun1:BreakJoints()
local gun1w = Instance.new("Weld", gun1)
gun1w.Part0 = gun1
gun1w.Part1 = base
gun1w.C0 = CFrame.new(8, -15, 1.75) * CFrame.Angles(1.6, 0, 0)
local gun2 = Instance.new("Part", model)
gun2.formFactor = "Custom"
gun2.BrickColor = BrickColor.new(color)
gun2.Size = Vector3.new(4, 25, 4)
gun2.Name = "gun2s"
gun2.CFrame = CFrame.new(75, 1, 0)
gun2.CanCollide = false
local gun2m = Instance.new("CylinderMesh", gun2)
gun2m.Bevel = 0.075
gun2m.Scale = Vector3.new(1, 1, 1)
gun2:BreakJoints()
local gun2w = Instance.new("Weld", gun2)
gun2w.Part0 = gun2
gun2w.Part1 = base
gun2w.C0 = CFrame.new(-8, -15, 1.75) * CFrame.Angles(1.6, 0, 0)
end
--
while wait() do
local choice = math.random(1, 6)
if choice == 1 and forward == false then
forward = true
for i = 0, 1, 0.1 do
basep.position = basep.position + Vector3.new(0, 0, math.random(1, 2))
wait(0.15)
end
forward = false
end
if choice == 2 and back == false then
back = true
for i = 0, 1, 0.1 do
basep.position = basep.position - Vector3.new(0, 0, math.random(1, 2))
wait(0.15)
end
back = false
end
if choice == 3 then
end
if choice == 4 then
mis1 = gun1:clone()
mis2 = gun2:clone()
mis1:BreakJoints()
mis2:BreakJoints()
mis1.CFrame = gun1.CFrame
mis2.CFrame = gun2.CFrame
mis1.Velocity = gun1.CFrame.lookVector * 250
mis2.Velocity = gun2.CFrame.lookVector * 250
end
if choice == 5 then
end
if choice == 6 then
end
end |
local AddonName, AddonTable = ...
AddonTable.deadmines = {
1951, -- Blackwater Cutlass
-- Glubtok
2169, -- Buzzer Blade
5444, -- Miner's Cape
5195, -- Gold-Flecked Gloves
-- Helix Gearbreaker
5200, -- Impaling Harpoon
5191, -- Cruel Barb
5443, -- Gold-Plated Buckler
151062, -- Armbands of Exiled Architects
151063, -- Gear-Marked Gauntlets
132556, -- Smelter's Britches
5199, -- Smelting Pants
-- Foe Reaper 5000
5201, -- Emberstone Staff
5187, -- Foe Reaper
1937, -- Buzz Saw
151066, -- Missing Diplomat's Pauldrons
151064, -- Vest of the Curious Visitor
151065, -- Old Friend's Gloves
-- Admiral Ripsnarl
872, -- Rockslicer
5196, -- Smite's Reaver
1156, -- Lavishly Jeweled Ring
-- "Captain" Cookie
5197, -- Cookie's Tenderizer
5192, -- Thief's Blade
5198, -- Cookie's Stirring Rod
5193, -- Cape of the Brotherhood
5202, -- Corsair's Overshirt
-- Quest Rewards
--- The Defias Kingpin (27790)
65935, -- Cookie's Meat Mallet
65959, -- Cookie's Stirring Stick
65983, -- Cookie's Table Cloth
}
|
function plugin:load( builder )
print "Hello from plugin `print`!"
end
function plugin.directives.print()
end
|
input = {}
for i=1,rho do
table.insert(input, torch.Tensor(batchSize):random(1,nIndex))
end
output = rnn:forward(input)
assert(#output == #input) |
--[[
MIT License
Copyright (c) 2019 Michael Wiesendanger
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 mod = gm
local me = {}
mod.addonOptions = me
me.tag = "AddonOptions"
--[[
Saved addon variable
]]--
GearMenuOptions = {
--[[
Whether to lock gearmenu window preventing from moving the window
]]--
["windowLocked"] = true,
--[[
Whether to show keybindings on the itemslots
]]--
["showKeyBindings"] = true,
--[[
Whether to show cooldowns on the itemslots
]]--
["showCooldowns"] = true,
--[[
Whether to disable tooltips
]]--
["disableTooltips"] = false,
--[[
Whether to use small tooltips. Small tooltips will only display the name of the item
nothing more
]]--
["smallTooltips"] = false,
--[[
Whether to disable drag and drop between and onto GearMenu itemslots
]]--
["disableDragAndDrop"] = false,
--[[
Itemquality to filter items by their quality. Everything that is below the settings value
will not be considered a valid item to display when building the itemcontextmenu.
By default all items are allowed
0 Poor (gray)
1 Common (white)
2 Uncommon (green)
3 Rare (blue)
4 Epic (purple)
5 Legendary (orange)
]]--
["filterItemQuality"] = 0,
["slots"] = {
["mainHand"] = 1,
["offHand"] = 2,
["waist"] = 3,
["feet"] = 4,
["head"] = 5,
["upperTrinket"] = 6,
["lowerTrinket"] = 7,
["neck"] = nil,
["shoulder"] = nil,
["chest"] = nil,
["legs"] = nil,
["wrist"] = nil,
["hands"] = nil,
["upper_finger"] = nil,
["lower_finger"] = nil,
["cloak"] = nil
},
--[[
example
{
["slotId"] = {13, 14},
["changeFromName"] = "Earthstrike",
["changeFromId"] = 21180,
["changeToName"] = "Drake Fang Talisman",
["changeToId"] = 19406,
["changeDelay"] = 20 -- delay in seconds
}
]]--
["QuickChangeRules"] = {}
}
--[[
Set default values if property is nil. This might happen after an addon upgrade
]]--
function me.SetupConfiguration()
if GearMenuOptions.windowLocked == nil then
mod.logger.LogInfo(me.tag, "windowLocked has unexpected nil value")
GearMenuOptions.windowLocked = true
end
if GearMenuOptions.showKeyBindings == nil then
mod.logger.LogInfo(me.tag, "showKeyBindings has unexpected nil value")
GearMenuOptions.showKeyBindings = true
end
if GearMenuOptions.showCooldowns == nil then
mod.logger.LogInfo(me.tag, "showCooldowns has unexpected nil value")
GearMenuOptions.showCooldowns = true
end
if GearMenuOptions.disableTooltips == nil then
mod.logger.LogInfo(me.tag, "disableTooltips has unexpected nil value")
GearMenuOptions.disableTooltips = false
end
if GearMenuOptions.smallTooltips == nil then
mod.logger.LogInfo(me.tag, "smallTooltips has unexpected nil value")
GearMenuOptions.smallTooltips = false
end
if GearMenuOptions.disableDragAndDrop == nil then
mod.logger.LogInfo(me.tag, "disableDragAndDrop has unexpected nil value")
GearMenuOptions.disableDragAndDrop = false
end
if GearMenuOptions.filterItemQuality == nil then
mod.logger.LogInfo(me.tag, "filterItemQuality has unexpected nil value")
GearMenuOptions.filterItemQuality = 0
end
if GearMenuOptions.slots == nil then
mod.logger.LogInfo(me.tag, "slots has unexpected nil value")
GearMenuOptions.slots = {
["mainHand"] = 1,
["offHand"] = 2,
["waist"] = 3,
["feet"] = 4,
["head"] = 5,
["upperTrinket"] = 6,
["lowerTrinket"] = 7,
["neck"] = nil,
["shoulder"] = nil,
["chest"] = nil,
["legs"] = nil,
["wrist"] = nil,
["hands"] = nil,
["upper_finger"] = nil,
["lower_finger"] = nil,
["cloak"] = nil
}
end
if GearMenuOptions.QuickChangeRules == nil then
mod.logger.LogInfo(me.tag, "QuickChangeRules has unexpected nil value")
GearMenuOptions.QuickChangeRules = {}
end
--[[
Set saved variables with addon version. This can be used later to determine whether
a migration path applies to the current saved variables or not
]]--
me.SetAddonVersion()
end
--[[
Set addon version on addon options. Before setting a new version make sure
to run through migration paths.
]]--
function me.SetAddonVersion()
-- if no version set so far make sure to set the current one
if GearMenuOptions.addonVersion == nil then
GearMenuOptions.addonVersion = GM_ENVIRONMENT.ADDON_VERSION
end
me.MigrationPath()
-- migration done update addon version to current
GearMenuOptions.addonVersion = GM_ENVIRONMENT.ADDON_VERSION
end
--[[
Migration path for older version to newest version. For now this migration path
is running each time the addon starts. Later versions should consider the save addon
version before running a migration path
]]--
function me.MigrationPath()
if GearMenuOptions.addonVersion == "1.0.3" then
me.Pre110Migration()
end
if GearMenuOptions.addonVersion == "1.1.0" then
me.Pre120Migration()
end
end
--[[
Migration path for pre 1.1.0 versions
Update quick change rules to new format
]]--
function me.Pre110Migration()
mod.logger.LogDebug(me.tag, "Running pre 110 migration")
for i = 1, table.getn(GearMenuOptions.QuickChangeRules) do
local rule = GearMenuOptions.QuickChangeRules[i]
if rule.slotID then
rule.slotId = rule.slotID
rule.slotID = nil
end
if rule.changeFromID then
rule.changeFromId = rule.changeFromID
rule.changeFromID = nil
end
if rule.changeToID then
rule.changeToId = rule.changeToID
rule.changeToID = nil
end
end
mod.logger.LogDebug(me.tag, "Done running pre 110 migration")
end
--[[
Migration path for pre 1.2.0 versions
Rename modules options to slots
Initialize new slots
]]--
function me.Pre120Migration()
mod.logger.LogDebug(me.tag, "Running pre 120 migration")
GearMenuOptions.slots = mod.common.Clone(GearMenuOptions.modules)
GearMenuOptions.modules = nil
GearMenuOptions.slots["neck"] = nil
GearMenuOptions.slots["shoulder"] = nil
GearMenuOptions.slots["chest"] = nil
GearMenuOptions.slots["legs"] = nil
GearMenuOptions.slots["wrist"] = nil
GearMenuOptions.slots["hands"] = nil
GearMenuOptions.slots["upper_finger"] = nil
GearMenuOptions.slots["lower_finger"] = nil
GearMenuOptions.slots["cloak"] = nil
mod.logger.LogDebug(me.tag, "Done running pre 120 migration")
end
--[[
Enable moving of GearMenu window
]]--
function me.DisableWindowLocked()
GearMenuOptions.windowLocked = false
mod.opt.ReflectLockState(false)
end
--[[
Disable moving of GearMenu window
]]--
function me.EnableWindowLocked()
GearMenuOptions.windowLocked = true
mod.opt.ReflectLockState(true)
end
--[[
@return {boolean}
true - if the window is locked and cannot be moved
false - if the window is not locked and can be moved
]]--
function me.IsWindowLocked()
return GearMenuOptions.windowLocked
end
--[[
Disable showing of cooldowns on GearMenu itemslots
]]--
function me.DisableShowCooldowns()
GearMenuOptions.showCooldowns = false
mod.gui.HideCooldowns()
end
--[[
Enable showing of cooldowns on GearMenu itemslots
]]--
function me.EnableShowCooldowns()
GearMenuOptions.showCooldowns = true
mod.gui.ShowCooldowns()
end
--[[
@return {boolean}
true - if showing of cooldowns is enabled
false - if showing of cooldowns is disabled
]]--
function me.IsShowCooldownsEnabled()
return GearMenuOptions.showCooldowns
end
--[[
Disable showing of keybindings on GearMenu itemslots
]]--
function me.DisableShowKeyBindings()
GearMenuOptions.showKeyBindings = false
mod.gui.HideKeyBindings()
end
--[[
Enable showing of keybindings on GearMenu itemslots
]]--
function me.EnableShowKeyBindings()
GearMenuOptions.showKeyBindings = true
mod.gui.ShowKeyBindings()
end
--[[
@return {boolean}
true - if showing of keybindings is enabled
false - if showing of keybindings is disabled
]]--
function me.IsShowKeyBindingsEnabled()
return GearMenuOptions.showKeyBindings
end
--[[
Disable showing of tooltips
]]--
function me.DisableTooltips()
GearMenuOptions.disableTooltips = true
end
--[[
Enable showing of tooltips
]]--
function me.EnableTooltips()
GearMenuOptions.disableTooltips = false
end
--[[
@return {boolean}
true - if showing of tooltips is disabled
false - if showing of tooltips is enabled
]]--
function me.IsTooltipsDisabled()
return GearMenuOptions.disableTooltips
end
--[[
Disable small tooltips
]]--
function me.DisableSmallTooltips()
GearMenuOptions.smallTooltips = false
end
--[[
Enable small tooltips
]]--
function me.EnableSmallTooltips()
GearMenuOptions.smallTooltips = true
end
--[[
@return {boolean}
true - if small tooltips are enabled
false - if small tooltips are disabled
]]--
function me.IsSmallTooltipsEnabled()
return GearMenuOptions.smallTooltips
end
--[[
Disable drag and drop on GearMenu itemslots
]]--
function me.DisableDragAndDrop()
GearMenuOptions.disableDragAndDrop = true
end
--[[
Enable drag and drop on GearMenu itemslots
]]--
function me.EnableDragAndDrop()
GearMenuOptions.disableDragAndDrop = false
end
--[[
@return {boolean}
true - if drag and drop on GearMenu itemslots is disabled
false - if drag and drop on GearMenu itemslots is enabled
]]--
function me.IsDragAndDropDisabled()
return GearMenuOptions.disableDragAndDrop
end
--[[
Save itemquality to filter for when building the GearMenu menu on hover
@param {number} itemQuality
]]--
function me.SetFilterItemQuality(itemQuality)
assert(type(itemQuality) == "number",
string.format("bad argument #1 to `SetFilterItemQuality` (expected number got %s)", type(itemQuality)))
GearMenuOptions.filterItemQuality = itemQuality
end
--[[
Get the itemquality to filter for when building the GearMenu menu on hover
@return {number}
]]--
function me.GetFilterItemQuality()
return GearMenuOptions.filterItemQuality
end
--[[
@param {string} itemName
]]--
function me.DisableItem(itemName)
GearMenuOptions.slots[itemName] = nil
end
--[[
@param {string} itemName
@param {number} slotPosition
]]--
function me.EnableItem(itemName, slotPosition)
GearMenuOptions.slots[itemName] = slotPosition
end
--[[
@param {string} itemName
@return {boolean}
true if the item is disabled
false if the item is enabled
]]--
function me.IsItemDisabled(itemName)
if GearMenuOptions.slots[itemName] == nil then
return true
end
return false
end
--[[
@param {string} itemName
@return {number}
]]--
function me.GetItemSlotPosition(itemName)
return GearMenuOptions.slots[itemName]
end
--[[
@return {table}
]]--
function me.GetQuickChangeRules()
return GearMenuOptions.QuickChangeRules
end
--[[
@param {table} quickChangeRule
]]--
function me.AddQuickChangeRule(quickChangeRule)
table.insert(GearMenuOptions.QuickChangeRules, quickChangeRule)
end
--[[
@param {number} position
]]--
function me.RemoveQuickChangeRule(position)
table.remove(GearMenuOptions.QuickChangeRules, position)
end
|
-- require "keys"
--------
-- Pomodoro module
local pom_work_period_sec = 25 * 60
local pom_rest_period_sec = 5 * 60
local pom_work_count = 0
local pom_curr_active_type = "work" -- {"work", "rest"}
local pom_is_active = false
local pom_time_left = pom_work_period_sec
local pom_disable_count = 0
-- update display
local function pom_update_display()
local time_min = math.floor( (pom_time_left / 60))
local time_sec = pom_time_left - (time_min * 60)
local str = string.format ("[%s|%02d:%02d|#%02d]", pom_curr_active_type, time_min, time_sec, pom_work_count)
pom_menu:setTitle(str)
end
-- stop the clock
local function pom_disable()
-- disabling pomodoro twice will reset the countdown
local pom_was_active = pom_is_active
pom_is_active = false
if (pom_disable_count == 0) then
if (pom_was_active) then
pom_timer:stop()
end
elseif (pom_disable_count == 1) then
pom_time_left = pom_work_period_sec
pom_update_display()
elseif (pom_disable_count >= 2) then
if pom_menu == nil then
pom_disable_count = 2
return
end
pom_menu:delete()
pom_menu = nil
pom_timer:stop()
pom_timer = nil
end
pom_disable_count = pom_disable_count + 1
end
-- update pomodoro timer
local function pom_update_time()
if pom_is_active == false then
return
else
pom_time_left = pom_time_left - 1
if (pom_time_left <= 0 ) then
pom_disable()
if pom_curr_active_type == "work" then
displayAlert("Work Complete!", 2)
pom_work_count = pom_work_count + 1
pom_curr_active_type = "rest"
pom_time_left = pom_rest_period_sec
else
displayAlert("Done resting",2)
pom_curr_active_type = "work"
pom_time_left = pom_work_period_sec
end
end
end
end
-- update menu display
local function pom_update_menu()
pom_update_time()
pom_update_display()
end
local function pom_create_menu(pom_origin)
if pom_menu == nil then
pom_menu = hs.menubar.new()
end
end
local function pom_enable()
pom_disable_count = 0;
if (pom_is_active) then
return
elseif pom_timer == nil then
pom_create_menu()
pom_timer = hs.timer.new(1, pom_update_menu)
end
pom_is_active = true
pom_timer:start()
end
-- init pomodoro
-- pom_create_menu()
-- pom_update_menu()
hs.hotkey.bind(mash.utils, '9', pom_enable)
hs.hotkey.bind(mash.utils, '0', pom_disable) |
return function()
local Packages = script.Parent.Parent
local Roact = require(Packages.Roact)
local forwardRef = require(script.Parent.forwardRef)
local createSpy = require(script.Parent.Test.createSpy)
it("should provide a valid ref to the given function when none is passed in", function()
local internalComponentSpy = createSpy(function(props, ref)
return nil
end)
local Component = forwardRef(internalComponentSpy.value)
expect(internalComponentSpy.callCount).to.equal(0)
local tree = Roact.mount(Roact.createElement(Component, {
text = "Hello",
}), nil)
expect(internalComponentSpy.callCount).to.equal(1)
local args = internalComponentSpy:captureValues("props", "ref")
expect(args.props.text).to.equal("Hello")
expect(args.ref).to.be.ok()
expect(typeof(args.ref.getValue)).to.equal("function")
Roact.unmount(tree)
end)
it("should forward a provided ref if present", function()
local internalComponentSpy = createSpy(function(props, ref)
return nil
end)
local Component = forwardRef(internalComponentSpy.value)
expect(internalComponentSpy.callCount).to.equal(0)
local providedRef = Roact.createRef()
local tree = Roact.mount(Roact.createElement(Component, {
text = "Hello",
[Roact.Ref] = providedRef,
}), nil)
expect(internalComponentSpy.callCount).to.equal(1)
local args = internalComponentSpy:captureValues("props", "ref")
expect(args.props.text).to.equal("Hello")
expect(args.ref).to.equal(providedRef)
Roact.unmount(tree)
end)
end |
Game = {
Version = "1.0"
}
Window = {
width = 1280,
height = 720
}
love.window.setMode(0, 0)
Screen = {
width = love.graphics.getWidth(),
height = love.graphics.getHeight()
}
sounds = {
['main'] = love.audio.newSource('assets/sounds/main.wav', 'static'),
['play'] = love.audio.newSource('assets/sounds/play.wav', 'static'),
['clack'] = love.audio.newSource('assets/sounds/clack.wav', 'static')
}
sounds['main']:setLooping(true)
sounds['play']:setLooping(true)
NetworkSmoother = 100000
fixedDT = 0.016666666666666
BallColors = {{0.99, 0.85, 0}, {0.65, 0.23, 0.22}, {0.59, 0.75, 0.2}, {0.29, 0.7, 0.3}, {0.29, 0.3, 0.7},
{0.29, 0.6, 0.7}, {0.57, 0.38, 0.6}, {24 / 255, 139 / 255, 133 / 255}, {113 / 255, 170 / 255, 153 / 255},
{255 / 255, 231 / 255, 175 / 255}, {255 / 255, 181 / 255, 142 / 255}, {242 / 255, 139 / 255, 96 / 255},
{254 / 255, 116 / 255, 75 / 255}, {219 / 255, 87 / 255, 33 / 255}}
DefaultDate = {
BallTrail = true,
BallColor = BallColors[1],
FullScreen = false,
music = true,
SFX = true,
musicValue = 1,
SFXValue = 1,
}
ALPHABET = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z'}
|
--[[
Clashing Countries Configuration File (config.lua)
]]
-- Video Settings
screen_width=1024
screen_height=768
fullscreen=false -- if set to true then screen_width and screen_height are ignored and the resolution of the primary monitor is used |
--
-- Created by IntelliJ IDEA.
-- User: apatterson
-- Date: 6/28/18
-- Time: 9:39 PM
-- To change this template use File | Settings | File Templates.
--
local tableUtil = require("../util/table")
local module = {}
function module.hashModifiersAndKey(modifiers, key)
local tab = tableUtil.copy(modifiers);
table.sort(tab);
table.insert(tab, key);
local hash = ""
tableUtil.forEachDo(tab, function(key, value)
hash = hash .. value.."_"
end)
return hash:sub(1, hash:len()-1)
end
function module.parseModifiersAndKeyHash(hash)
local modifiers = {}
for modifier in string.gmatch(hash,"[^_]*") do
table.insert(modifiers, modifier)
end
return modifiers
end
function module.bind(hardwardBinder, appBindingMaps, defaultBindingMap)
hardwardBinder.bind(function(modifiers, key)
print(hs.inspect.inspect(modifiers))
print(key)
local application = hs.application.frontmostApplication()
local appName = application:name()
local modifierKeyHash = module.hashModifiersAndKey(modifiers, key)
if appBindingMaps[appName] and appBindingMaps[appName][modifierKeyHash] then
appBindingMaps[appName][modifierKeyHash](application)
elseif defaultBindingMap and defaultBindingMap[modifierKeyHash] then
defaultBindingMap[modifierKeyHash](application)
end
end)
end
return module;
|
workspace "sdbf"
configurations {"Release", "Debug"}
project "sdbf"
kind "ConsoleApp"
language "C++"
targetdir "bin/%{cfg.buildcfg}"
includedirs {"src/", "include/"}
files {"src/**.cpp", "src/**.c", "include/**.cpp", "include/**.c", "src/**.h", "src/**.hpp", "include/**.h", "include/**.hpp"}
filter "configurations:Debug"
defines {"DEBUG"}
symbols "On"
filter "configurations:Release"
defines {"NDEBUG"}
optimize "On"
filter "system:windows"
defines {"SDBF_WINDOWS"}
buildoptions "/std:c++latest"
filter "system:linux"
defines {"SDBF_LINUX"}
buildoptions "--std=c++20" |
local present, telescope = pcall(require, "telescope")
if not present then
error "This plugin requires telescope.nvim (https://github.com/nvim-telescope/telescope.nvim)"
end
local utils = require "telescope.utils"
local defaulter = utils.make_default_callable
local actions = require "telescope.actions"
local action_state = require "telescope.actions.state"
local finders = require "telescope.finders"
local pickers = require "telescope.pickers"
local previewers = require "telescope.previewers"
local conf = require("telescope.config").values
local M = {}
local filetypes = {}
local find_cmd = ""
local on_enter
local offsets = {}
local sizes = {}
M.base_directory = ""
M.media_preview = defaulter(function(opts)
return previewers.new_termopen_previewer {
get_command = opts.get_command or function(entry)
local tmp_table = vim.split(entry.value, "\t")
local preview = opts.get_preview_window()
if vim.tbl_isempty(tmp_table) then
return { "echo", "" }
end
return {
M.base_directory .. "/scripts/vimg.bash",
string.format([[%s]], tmp_table[1]),
preview.col + offsets.x,
preview.line + offsets.y,
preview.width + sizes.width,
preview.height + sizes.height,
}
end,
}
end, {})
function M.media_files(opts, custom_on_enter)
local find_commands = {
find = {
"find",
".",
"-iregex",
[[.*\.\(]] .. table.concat(filetypes, "\\|") .. [[\)$]],
},
fd = {
"fd",
"--type",
"f",
"--regex",
[[.*.(]] .. table.concat(filetypes, "|") .. [[)$]],
".",
},
fdfind = {
"fdfind",
"--type",
"f",
"--regex",
[[.*.(]] .. table.concat(filetypes, "|") .. [[)$]],
".",
},
rg = {
"rg",
"--files",
"--glob",
[[*.{]] .. table.concat(filetypes, ",") .. [[}]],
".",
},
}
if not vim.fn.executable(find_cmd) then
error("You don't have " .. find_cmd .. "! Install it first or use other finder.")
return
end
if not find_commands[find_cmd] then
error(find_cmd .. " is not supported!")
return
end
local sourced_file = require("plenary.debug_utils").sourced_filepath()
M.base_directory = vim.fn.fnamemodify(sourced_file, ":h:h:h:h")
opts = opts or {}
opts.attach_mappings = function(prompt_bufnr, map)
actions.select_default:replace(function()
local entry = action_state.get_selected_entry()
actions.close(prompt_bufnr)
if entry[1] then
local filepath = entry[1]
custom_on_enter = custom_on_enter or on_enter
custom_on_enter(filepath)
end
end)
return true
end
opts.path_display = { "shorten" }
local popup_opts = {}
opts.get_preview_window = function()
return popup_opts.preview
end
local picker = pickers.new(opts, {
prompt_title = "Media Files",
finder = finders.new_oneshot_job(find_commands[find_cmd], opts),
previewer = M.media_preview.new(opts),
sorter = conf.file_sorter(opts),
})
local line_count = vim.o.lines - vim.o.cmdheight
if vim.o.laststatus ~= 0 then
line_count = line_count - 1
end
popup_opts = picker:get_window_options(vim.o.columns, line_count)
picker:find()
end
return require("telescope").register_extension {
setup = function(ext_config)
filetypes = ext_config.filetypes or { "png", "jpg", "gif", "mp4", "webm", "pdf" }
find_cmd = ext_config.find_cmd or "fd"
offsets = ext_config.offsets or { x = 1, y = 1 }
sizes = ext_config.sizes or { width = 1, height = 1 }
on_enter = ext_config.on_enter
or function(filepath)
vim.fn.setreg(vim.v.register, filepath)
vim.notify "The image path has been copied!"
end
end,
exports = {
media_files = M.media_files,
},
}
|
-- taken from https://github.com/wate/clink_completion/blob/master/win.lua
local pscp_parser = clink.arg.new_parser()
pscp_parser:set_flags(
"-ls",
"-p",
"-q",
"-r",
"-batch",
"-sftp", "-scp"
)
clink.arg.register_parser("pscp", pscp_parser)
local psftp_parser = clink.arg.new_parser()
psftp_parser:set_flags(
"-b",
"-bc",
"-be",
"-batch"
)
clink.arg.register_parser("psftp", psftp_parser)
local plink_parser = clink.arg.new_parser()
plink_parser:set_flags(
"-V",
"-pgpfp",
"-v",
"-load",
"-ssh", "-telnet", "-rlogin", "-raw", "-serial",
"-P",
"-l",
"-batch",
"-pw",
"-D",
"-L",
"-R",
"-X", "-x",
"-A", "-a",
"-t", "-T",
"-1", "-2",
"-4", "-6",
"-C",
"-i",
"-noagent",
"-agent",
"-m",
"-s",
"-N",
"-nc",
"-sercfg"
)
clink.arg.register_parser("plink", plink_parser)
clink.arg.register_parser("putty", plink_parser)
local whoami_parser = clink.arg.new_parser()
whoami_parser:set_flags(
"-UPN",
"-FQDN",
"-USER",
"-GROUPS",
"-PRIV",
"-LOGONID",
"-ALL",
"-FO",
"-NH"
)
clink.arg.register_parser("whoami", whoami_parser)
local ipconfig_parser = clink.arg.new_parser()
ipconfig_parser:set_flags(
"-all",
"-release",
"-release6",
"-renew",
"-renew6",
"-flushdns",
"-registerdns",
"-displaydns",
"-showclassid",
"-setclassid",
"-showclassid6",
"-setclassid6"
)
clink.arg.register_parser("ipconfig", ipconfig_parser)
|
--[[
This Lua code was generated by Lemplate, the Lua
Template Toolkit. Any changes made to this file will be lost the next
time the templates are compiled.
Copyright 2016 - Yichun Zhang (agentzh) - All rights reserved.
Copyright 2006-2014 - Ingy döt Net - All rights reserved.
]]
local gsub = ngx.re.gsub
local concat = table.concat
local type = type
local math_floor = math.floor
local table_maxn = table.maxn
local _M = {
version = '0.07'
}
local template_map = {}
local function tt2_true(v)
return v and v ~= 0 and v ~= "" and v ~= '0'
end
local function tt2_not(v)
return not v or v == 0 or v == "" or v == '0'
end
local context_meta = {}
function context_meta.plugin(context, name, args)
if name == "iterator" then
local list = args[1]
local count = table_maxn(list)
return { list = list, count = 1, max = count - 1, index = 0, size = count, first = true, last = false, prev = "" }
else
return error("unknown iterator: " .. name)
end
end
function context_meta.process(context, file)
local f = template_map[file]
if not f then
return error("file error - " .. file .. ": not found")
end
return f(context)
end
function context_meta.include(context, file)
local f = template_map[file]
if not f then
return error("file error - " .. file .. ": not found")
end
return f(context)
end
context_meta = { __index = context_meta }
-- XXX debugging function:
-- local function xxx(data)
-- io.stderr:write("\n" .. require("cjson").encode(data) .. "\n")
-- end
local function stash_get(stash, expr)
local result
if type(expr) ~= "table" then
result = stash[expr]
if type(result) == "function" then
return result()
end
return result or ''
end
result = stash
for i = 1, #expr, 2 do
local key = expr[i]
if type(key) == "number" and key == math_floor(key) and key >= 0 then
key = key + 1
end
local val = result[key]
local args = expr[i + 1]
if args == 0 then
args = {}
end
if val == nil then
if not _M.vmethods[key] then
if type(expr[i + 1]) == "table" then
return error("virtual method " .. key .. " not supported")
end
return ''
end
val = _M.vmethods[key]
args = {result, unpack(args)}
end
if type(val) == "function" then
val = val(unpack(args))
end
result = val
end
return result
end
local function stash_set(stash, k, v, default)
if default then
local old = stash[k]
if old == nil then
stash[k] = v
end
else
stash[k] = v
end
end
_M.vmethods = {
join = function (list, delim)
delim = delim or ' '
local out = {}
local size = #list
for i = 1, size, 1 do
out[i * 2 - 1] = list[i]
if i ~= size then
out[i * 2] = delim
end
end
return concat(out)
end,
first = function (list)
return list[1]
end,
keys = function (list)
local out = {}
i = 1
for key in pairs(list) do
out[i] = key
i = i + 1
end
return out
end,
last = function (list)
return list[#list]
end,
push = function(list, ...)
local n = select("#", ...)
local m = #list
for i = 1, n do
list[m + i] = select(i, ...)
end
return ''
end,
size = function (list)
if type(list) == "table" then
return #list
else
return 1
end
end,
sort = function (list)
local out = { unpack(list) }
table.sort(out)
return out
end,
split = function (str, delim)
delim = delim or ' '
local out = {}
local start = 1
local sub = string.sub
local find = string.find
local sstart, send = find(str, delim, start)
local i = 1
while sstart do
out[i] = sub(str, start, sstart-1)
i = i + 1
start = send + 1
sstart, send = find(str, delim, start)
end
out[i] = sub(str, start)
return out
end,
}
_M.filters = {
html = function (s, args)
s = gsub(s, "&", '&', "jo")
s = gsub(s, "<", '<', "jo");
s = gsub(s, ">", '>', "jo");
s = gsub(s, '"', '"', "jo"); -- " end quote for emacs
return s
end,
lower = function (s, args)
return string.lower(s)
end,
upper = function (s, args)
return string.upper(s)
end,
}
function _M.process(file, params)
local stash = params
local context = {
stash = stash,
filter = function (bits, name, params)
local s = concat(bits)
local f = _M.filters[name]
if f then
return f(s, params)
end
return error("filter '" .. name .. "' not found")
end
}
context = setmetatable(context, context_meta)
local f = template_map[file]
if not f then
return error("file error - " .. file .. ": not found")
end
return f(context)
end
-- footer.tt2
template_map['footer.tt2'] = function (context)
if not context then
return error("Lemplate function called without context\n")
end
local stash = context.stash
local output = {}
local i = 0
i = i + 1 output[i] = '<div class="content-footer">\n<!-- <hr class="footer-sep"/> -->\n<div class="footer">\n <p>'
-- line 4 "footer.tt2"
i = i + 1 output[i] = 'Copyright © 2016, 2017 Yichun Zhang (agentzh)'
i = i + 1 output[i] = '</p>\n <p>'
-- line 5 "footer.tt2"
i = i + 1 output[i] = '100% Powered by OpenResty and PostgreSQL'
i = i + 1 output[i] = '\n '
-- line 6 "footer.tt2"
i = i + 1 output[i] = '('
i = i + 1 output[i] = '<a href="https://github.com/openresty/opm/">\n '
-- line 7 "footer.tt2"
i = i + 1 output[i] = 'view the source code of this site'
i = i + 1 output[i] = '</a>'
-- line 7 "footer.tt2"
i = i + 1 output[i] = ')'
i = i + 1 output[i] = '</p>\n <p>京ICP备16021991号</p>\n</div>\n</div>\n'
return output
end
-- index.tt2
template_map['index.tt2'] = function (context)
if not context then
return error("Lemplate function called without context\n")
end
local stash = context.stash
local output = {}
local i = 0
i = i + 1 output[i] = '<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="utf-8">\n <title>OPM - OpenResty Package Manager</title>\n <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes">\n <link rel="stylesheet" type="text/css" href="/css/main.css">\n</head>\n<body>\n<h1>\n <span>\n <a href="https://openresty.org"><img src="https://openresty.org/images/logo.png" width="64"></a>\n </span>\n OPM - OpenResty Package Manager</h1>\n<div>\n <h2>How to Use</h2>\n <p>Please read the <a href="https://github.com/openresty/opm#readme">opm documentation</a> for more details.</p>\n <h2>Recent Uploads</h2>\n <p>We already have '
-- line 19 "index.tt2"
i = i + 1 output[i] = stash_get(stash, 'total_uploads')
i = i + 1 output[i] = ' successful uploads\n across '
-- line 20 "index.tt2"
i = i + 1 output[i] = stash_get(stash, 'package_count')
i = i + 1 output[i] = ' distinct package names from '
-- line 20 "index.tt2"
i = i + 1 output[i] = stash_get(stash, 'uploader_count')
i = i + 1 output[i] = '\n contributors. Come on, OPM authors!</p>\n <table class="recent">\n <tbody>'
-- line 56 "index.tt2"
-- FOREACH
do
local list = stash_get(stash, 'recent_uploads')
local iterator
if list.list then
iterator = list
list = list.list
end
local oldloop = stash_get(stash, 'loop')
local count
if not iterator then
count = table_maxn(list)
iterator = { count = 1, max = count - 1, index = 0, size = count, first = true, last = false, prev = "" }
else
count = iterator.size
end
stash.loop = iterator
for idx, value in ipairs(list) do
if idx == count then
iterator.last = true
end
iterator.index = idx - 1
iterator.count = idx
iterator.next = list[idx + 1]
stash['row'] = value
i = i + 1 output[i] = '\n <tr>\n '
-- line 26 "index.tt2"
stash_set(stash, 'uploader', stash_get(stash, {'row', 0, 'uploader_name', 0}));
-- line 26 "index.tt2"
stash_set(stash, 'org', stash_get(stash, {'row', 0, 'org_name', 0}));
-- line 26 "index.tt2"
stash_set(stash, 'account', stash_get(stash, 'uploader'));
-- line 26 "index.tt2"
if tt2_true(stash_get(stash, 'org')) then
-- line 26 "index.tt2"
stash_set(stash, 'account', stash_get(stash, 'org'));
end
i = i + 1 output[i] = '\n <td>'
-- line 39 "index.tt2"
if tt2_true(stash_get(stash, {'row', 0, 'indexed', 0})) then
i = i + 1 output[i] = '\n <span class="indexed">Indexed</span>'
elseif tt2_true(stash_get(stash, {'row', 0, 'failed', 0})) then
i = i + 1 output[i] = '\n <span class="failed">Failed</span>'
else
i = i + 1 output[i] = '\n <span class="pending">Pending</span>'
end
i = i + 1 output[i] = '\n </td>\n\n <td>\n <a href="'
-- line 43 "index.tt2"
i = i + 1 output[i] = stash_get(stash, {'row', 0, 'repo_link', 0})
i = i + 1 output[i] = '">\n '
-- line 44 "index.tt2"
-- FILTER
local value
do
local output = {}
local i = 0
i = i + 1 output[i] = stash_get(stash, 'account') .. '/' .. stash_get(stash, {'row', 0, 'package_name', 0})
value = context.filter(output, 'html', {})
end
i = i + 1 output[i] = value
i = i + 1 output[i] = '\n </a>\n </td>\n <td>v'
-- line 47 "index.tt2"
-- FILTER
local value
do
local output = {}
local i = 0
i = i + 1 output[i] = stash_get(stash, {'row', 0, 'version_s', 0})
value = context.filter(output, 'html', {})
end
i = i + 1 output[i] = value
i = i + 1 output[i] = '</td>\n <td>'
-- line 48 "index.tt2"
-- FILTER
local value
do
local output = {}
local i = 0
i = i + 1 output[i] = stash_get(stash, {'row', 0, 'abstract', 0})
value = context.filter(output, 'html', {})
end
i = i + 1 output[i] = value
i = i + 1 output[i] = '</td>\n <td>\n <a href="https://github.com/'
-- line 50 "index.tt2"
-- FILTER
local value
do
local output = {}
local i = 0
i = i + 1 output[i] = stash_get(stash, 'uploader')
value = context.filter(output, 'html', {})
end
i = i + 1 output[i] = value
i = i + 1 output[i] = '/">\n '
-- line 51 "index.tt2"
-- FILTER
local value
do
local output = {}
local i = 0
i = i + 1 output[i] = stash_get(stash, 'uploader')
value = context.filter(output, 'html', {})
end
i = i + 1 output[i] = value
i = i + 1 output[i] = '\n </a>\n </td>\n <td>'
-- line 54 "index.tt2"
-- FILTER
local value
do
local output = {}
local i = 0
i = i + 1 output[i] = stash_get(stash, {'row', 0, 'created_at', 0})
value = context.filter(output, 'html', {})
end
i = i + 1 output[i] = value
i = i + 1 output[i] = '</td>\n </tr>'
iterator.first = false
iterator.prev = value
end
stash_set(stash, 'loop', oldloop)
end
i = i + 1 output[i] = '\n </tbody>\n </table>\n</div>\n'
-- line 60 "index.tt2"
i = i + 1 output[i] = context.process(context, 'footer.tt2')
i = i + 1 output[i] = '\n</body>\n<script>\nvar ga_func = function () {\n (function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,\'script\',\'https://www.google-analytics.com/analytics.js\',\'ga\');\n\n ga(\'create\', \'UA-24724965-2\', \'auto\');\n ga(\'send\', \'pageview\');\n}\nsetTimeout(ga_func, 0);\n</script>\n</html>\n'
return output
end
return _M
|
local redis = require "resty.redis"
local redisex = require "resty.redisex"
local log = require "resty.log"
local _M = {}
function _M.get()
local red = redis:new()
red:set_timeout(1000) -- 1 sec
-- or connect to a unix domain socket file listened
-- local ok, err = red:connect("unix:/path/to/redis.sock")
local ok, err = red:connect(CONF.redis.host, CONF.redis.port)
if not ok then
ngx.log(ngx.ERR, "failed to connect redis",err)
return
end
return red
end
function _M.keepalive(red)
if nil == red then return end
local ok, err = red:set_keepalive(10000, 100)
if not ok then
log.error( "failed to keepalive redis",err)
return
end
end
function _M.with(cb)
local red = _M.get()
local e,r = xpcall(cb,function(e) log.error(debug.traceback()) end, redisex:new(red , 3600))
_M.keepalive(red)
return r
end
return _M |
--[[
TheNexusAvenger
Stores and parses the configuration.
--]]
local NexusObject = require(script.Parent.Parent:WaitForChild("NexusInstance"):WaitForChild("NexusObject"))
local Configuration = NexusObject:Extend()
Configuration:SetClassName("Configuration")
--[[
Creates the configuration.
--]]
function Configuration:__new(ConfigurationTable)
self:InitializeSuper()
ConfigurationTable = ConfigurationTable or {}
--Store the values.
self.Version = "Version 2.1.6"
self.VersionNumberId = 2.1
self.CmdrVersion = "Version 1.8.4"
self.RawConfiguration = ConfigurationTable
self.CommandPrefix = ConfigurationTable.CommandPrefix or ":"
self.DefaultAdminLevel = ConfigurationTable.DefaultAdminLevel or -1
self.AdministrativeLevel = ConfigurationTable.AdministrativeLevel or 1
self.BuildUtilityLevel = ConfigurationTable.BuildUtilityLevel or 1
self.BasicCommandsLevel = ConfigurationTable.BasicCommandsLevel or 1
self.UsefulFunCommandsLevel = ConfigurationTable.UsefulFunCommandsLevel or 2
self.FunCommandsLevel = ConfigurationTable.FunCommandsLevel or 3
self.PersistentCommandsLevel = ConfigurationTable.PersistentCommandsLevel or ConfigurationTable.PersistentCommands or 4
self.Admins = ConfigurationTable.Admins or {}
self.AdminNames = ConfigurationTable.AdminNames or {
[-1] = "Non-Admin", --Basic commands, like !help and !quote
[0] = "Debug Admin", --Only debug commands
[1] = "Moderator", --Some commands, can't kick, no "fun" commands
[2] = "Admin", --Most commands, can't ban or shutdown
[3] = "Super Admin",--All commands, can be kicked by full admin
[4] = "Owner Admin", --All commands, except :admin
[5] = "Creator Admin", --All commands, including :admin
}
self.GroupAdminLevels = ConfigurationTable.GroupAdminLevels or {}
self.BannedUsers = ConfigurationTable.BannedUsers or {}
self.CommandLevelOverrides = ConfigurationTable.CommandLevelOverrides or {}
self.FeatureFlagOverrides = ConfigurationTable.FeatureFlagOverrides or {}
--Correct the administrative commands (V.2.0.0 and newer).
if ConfigurationTable.CommandLevelOverrides and not ConfigurationTable.CommandLevelOverrides.Administrative then
ConfigurationTable.CommandLevelOverrides.Administrative = {
admin = 5,
unadmin = 5,
ban = 3,
unban = 3,
kick = 2,
slock = 2,
keybind = -1,
unkeybind = -1,
keybinds = -1,
alias = -1,
cmds = -1,
cmdbar = -1,
debug = 0,
logs = 0,
admins = 0,
bans = nil,
usage = -1,
featureflag = nil,
}
end
end
--[[
Raw configuration used table. This is intended for custom
configuration entries used for custom deployments.
--]]
function Configuration:GetRaw()
return self.RawConfiguration
end
--[[
Returns the admin level to use for an integrated command.
--]]
function Configuration:GetCommandAdminLevel(Category,Command)
--Get the category default.
local CategoryDefault = self[Category.."Level"]
if not CategoryDefault then
error("\""..Category.."\" is not a category supported by the configuration.")
end
--Return the override or the default.
if self.CommandLevelOverrides[Category] and self.CommandLevelOverrides[Category][Command] then
return self.CommandLevelOverrides[Category][Command]
else
return CategoryDefault
end
end
return Configuration |
local perlin_buffers = {}
mapgen_helper.register_perlin = function(name, perlin_params)
perlin_buffers[name] = perlin_buffers[name] or {}
if perlin_buffers[name].perlin_params then
minetest.log("error", "mapgen_helper.register_perlin3d called for " .. name .. " when perlin parameters were already registered.")
return
end
perlin_buffers[name].perlin_params = perlin_params
end
local get_buffer = function(name, sidelen, perlin_params)
perlin_buffers[name] = perlin_buffers[name] or {}
local buffer = perlin_buffers[name]
if buffer.sidelen ~= nil and buffer.sidelen ~= sidelen then
buffer.nobj_perlin = nil -- parameter changed, force regenerate of object
end
buffer.sidelen = sidelen
if perlin_params then
if buffer.perlin_params then
for k, v in pairs(buffer.perlin_params) do
if perlin_params[k] ~= v then
buffer.nobj_perlin = nil -- parameter changed, force regenerate of object
end
end
end
buffer.perlin_params = perlin_params -- record provided parameters
elseif buffer.perlin_params == nil then
minetest.log("error", "mapgen_helper.register_perlin3d called for " .. name .. " with no registered or provided perlin parameters.")
return
else
perlin_params = buffer.perlin_params -- retrieve recorded parameters
end
buffer.last_used = minetest.get_gametime()
return buffer, perlin_params
end
mapgen_helper.perlin3d = function(name, minp, maxp, perlin_params)
local minx = minp.x
local minz = minp.z
local sidelen = maxp.x - minp.x + 1 --length of a mapblock
local chunk_lengths = {x = sidelen, y = sidelen, z = sidelen} --table of chunk edges
local buffer, perlin_params = get_buffer(name, sidelen, perlin_params)
buffer.nvals_perlin_buffer = buffer.nvals_perlin_buffer or {}
buffer.nobj_perlin = buffer.nobj_perlin or minetest.get_perlin_map(perlin_params, chunk_lengths)
if buffer.nobj_perlin.get_3d_map_flat then
return buffer.nobj_perlin:get_3d_map_flat(minp, buffer.nvals_perlin_buffer), VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
else
return buffer.nobj_perlin:get3dMap_flat(minp, buffer.nvals_perlin_buffer), VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
end
end
mapgen_helper.perlin2d = function(name, minp, maxp, perlin_params)
local minx = minp.x
local minz = minp.z
local sidelen = maxp.x - minp.x + 1 --length of a mapblock
local chunk_lengths = {x = sidelen, y = sidelen, z = sidelen} --table of chunk edges
local buffer, perlin_params = get_buffer(name, sidelen, perlin_params)
buffer.nvals_perlin_buffer = perlin_buffers[name].nvals_perlin_buffer or {}
buffer.nobj_perlin = perlin_buffers[name].nobj_perlin or minetest.get_perlin_map(perlin_params, chunk_lengths)
if buffer.nobj_perlin.get_2d_map_flat then
return buffer.nobj_perlin:get_2d_map_flat({x=minp.x, y=minp.z}, perlin_buffers[name].nvals_perlin_buffer)
else
return buffer.nobj_perlin:get2dMap_flat({x=minp.x, y=minp.z}, perlin_buffers[name].nvals_perlin_buffer)
end
end
mapgen_helper.index2d = function(minp, maxp, x, z)
return x - minp.x +
(maxp.x - minp.x + 1) -- sidelen
*(z - minp.z)
+ 1
end
mapgen_helper.index2dp = function(minp, maxp, pos)
return mapgen_helper.index2d(minp, maxp, pos.x, pos.z)
end
-- Takes an index into a 3D area and returns the corresponding 2D index
-- assumes equal edge lengths
mapgen_helper.index2di = function(minp, maxp, area, vi)
local MinEdge = area.MinEdge
local zstride = area.zstride
local minpx = minp.x
local i = vi - 1
local z = math.floor(i / zstride) + MinEdge.z
local x = math.floor((i % zstride) % area.ystride) + MinEdge.x
return x - minpx +
(maxp.x - minpx + 1) -- sidelen
*(z - minp.z)
+ 1
end
-- If a noise buffer hasn't been used in 60 seconds, let garbage collection take it.
local time_elapsed = 0
minetest.register_globalstep(function(dtime)
time_elapsed = time_elapsed + dtime
if time_elapsed > 60 then
local current_time = minetest.get_gametime()
time_elapsed = 0
for _, buffer in pairs(perlin_buffers) do
if current_time - buffer.last_used > 60 then
buffer.nvals_perlin_buffer = nil
end
end
end
end) |
function EFFECT:Init( data )
if LocalPlayer():Team() == TEAM_STALKER then return end
local pos = data:GetOrigin()
local emitter = ParticleEmitter( pos )
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( 0.5 )
particle:SetStartAlpha( 200 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 5 )
particle:SetEndSize( math.Rand( 25, 50 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 120, 100, 0 )
emitter:Finish()
end
function EFFECT:Think( )
return false
end
function EFFECT:Render()
end
|
local Bot={};
Bot.classifier=nil;
Bot.records=nil;
Bot.classAttribute=nil;
function Bot.initialize(agent)
if Bot.classifier == nil then
Bot.classifier=Bot.createNaiveBayseClassifier(agent:getScriptClassPath());
end
agent:setWalkSpeed(40);
agent:setSenseRange(250);
agent:setLife(300);
local agentId=agent:getAgentId();
Bot[agentId]={};
Bot[agentId].brain=Bot.classifier;
end
function Bot.createNaiveBayseClassifier(scriptClassPath)
local nbcFactory=dofile(scriptClassPath .. "\\NaiveBayseClassifier.lua");
local brain=nbcFactory.create();
local attributeFactory=dofile(scriptClassPath .. "\\Attribute.lua");
Bot.classAttribute=attributeFactory.create("my action");
Bot.classAttribute:addValue(GameAgentAction.ATTACK);
Bot.classAttribute:addValue(GameAgentAction.IDLE);
Bot.classAttribute:addValue(GameAgentAction.APPROACH);
Bot.classAttribute:addValue(GameAgentAction.WANDER);
Bot.classAttribute:addValue(GameAgentAction.ESCAPE);
local data=dofile(scriptClassPath .. "\\data.lua");
--build records
Bot.records={};
for recordIndex=1, (# data) do
Bot.records[recordIndex]=Bot.createRecord(scriptClassPath, data[recordIndex]); -- check inside this function
end
return brain;
end
function Bot.train(agent)
alert("Naive Bayse Classifier does not require training", "Training Not Required");
end
function Bot.createRecord(scriptClassPath, entity)
local recordFactory=dofile(scriptClassPath .. "\\Record.lua");
local record=recordFactory.create();
record:setAttribute("my action", entity:getCurrentAction());
if entity:getSightedAttackerCount() >= 1 then
record:setAttribute("I am under attack", true);
else
record:setAttribute("I am under attack", false);
end
if entity:getSightedTargetCount() >= 1 then
record:setAttribute("I see enemy", true);
else
record:setAttribute("I see enemy", false);
end
if entity:getSightedAllyCount() >= 1 then
record:setAttribute("I see ally", true);
else
record:setAttribute("I see ally", false);
end
if entity:getLife() >= 50 then
record:setAttribute("my health", "good");
elseif entity:getLife() >= 30 then
record:setAttribute("my health", "medium");
else
record:setAttribute("my health", "bad");
end
if entity:getSenseRange() >= 100 then
record:setAttribute("my eye sight", "good");
else
record:setAttribute("my eye sight", "bad");
end
if entity:getGun():getBulletCount() >= 1 then
record:setAttribute("my weapon is loaded", true);
else
record:setAttribute("my weapon is loaded", false);
end
if entity:getGun():getWeaponChargingRate() > 10 then
record:setAttribute("I can fast load weapon", true);
else
record:setAttribute("I can fast load weapon", false);
end
local currentTarget=entity:getCurrentTarget();
if currentTarget == nil then
record:setAttribute("my target enemy's health", "NA");
record:setAttribute("my target enemy's eye sight", "NA");
record:setAttribute("my target enemy's action", "NA");
record:setAttribute("my target enemy is attacking me", "NA");
record:setAttribute("my target enemy's weapon is loaded", "NA");
record:setAttribute("my target enemy can fast load weapon", "NA");
else
if currentTarget:getLife() > 50 then
record:setAttribute("my target enemy's health", "good");
elseif currentTarget:getLife() > 30 then
record:setAttribute("my target enemy's health", "medium");
else
record:setAttribute("my target enemy's health", "bad");
end
if currentTarget:getSenseRange() > 100 then
record:setAttribute("my target enemy's eye sight", "good");
else
record:setAttribute("my target enemy's eye sight", "bad");
end
record:setAttribute("my target enemy's action", currentTarget:getCurrentAction());
record:setAttribute("my target enemy is attacking me", currentTarget:isAttacking(entity));
if currentTarget:getGun():getBulletCount() >=1 then
record:setAttribute("my target enemy's weapon is loaded", true);
else
record:setAttribute("my target enemy's weapon is loaded", false);
end
if currentTarget:getGun():getWeaponChargingRate() > 10 then
record:setAttribute("my target enemy can fast load weapon", true);
else
record:setAttribute("my target enemy can fast load weapon", false);
end
end
return record;
end
function Bot.think(agent)
local agentId=agent:getAgentId();
local brain=Bot[agentId].brain;
--apply inputs to the neural network
local record=Bot.createRecord(agent:getScriptClassPath(), agent);
local action=brain:predict(record, Bot.records, Bot.classAttribute);
if action==GameAgentAction.ATTACK then
agent:attack();
elseif action==GameAgentAction.APPROACH then
agent:approach();
elseif action==GameAgentAction.ESCAPE then
agent:escape();
elseif action==GameAgentAction.WANDER then
agent:wander();
elseif action==GameAgentAction.IDLE then
agent:idle();
end
end
return Bot;
|
local Persistent = require 'projects.persistent'
local utils = require 'projects.utils'
local extension_man = require('projects.extension_manager'):new()
local Config = require 'projects.config'
-- ****************************************************************************
--
-- ****************************************************************************
local current_project = nil
local config = {}
local function default_config()
return {
project_dir = '~/.config/nvim/projects/',
silent = false,
extensions = {},
}
end
-- ****************************************************************************
-- Utilities
-- ****************************************************************************
local function ensure_projects_dir()
return utils.ensure_dir(config.project_dir)
end
local function project_path(project)
return vim.fn.expand(config.project_dir .. project .. '.lua')
end
local function project_persistent_path(project_name)
return config.project_dir .. '/' .. project_name .. '.json'
end
local function empty(string)
return string == nil or string == ''
end
-- ****************************************************************************
-- Project management
-- ****************************************************************************
local function project_list()
local dir = ensure_projects_dir()
local projects = {}
local scan = vim.loop.fs_scandir(dir)
while true do
local name, typ = vim.loop.fs_scandir_next(scan)
if name == nil then
break
end
if typ == 'file' then
local striped_name = name:match '(.+)%.lua$'
if striped_name and striped_name ~= '' then
projects[#projects + 1] = striped_name
end
end
end
return projects
end
local function is_project_root_ok(project)
local is_ok = true
if project.root_dir then
if not vim.loop.fs_access(vim.fn.expand(project.root_dir), 'r') then
vim.notify('root_dir is not accessible: ' .. project.root_dir)
is_ok = false
end
else
vim.notify 'root_dir must be set !'
is_ok = false
end
return is_ok
end
local function activate_project(project, host)
-- 1. assign the current project.
current_project = project
-- 2. cd to the project root.
vim.cmd("execute 'cd " .. vim.fn.expand(project.root_dir) .. "'")
-- 3. register the project as an extension
project._ext_priority = 1
extension_man:register_extension(project, host)
-- 4. call extensions on load.
extension_man:call_extensions('on_project_open', current_project)
end
local function project_close_current()
if current_project then
-- 1. call extensions on close.
extension_man:call_extensions('on_project_close', current_project)
-- 2. unregister the current project as a extension.
extension_man:unregister_extension(current_project.name)
-- 3. unassign the current project.
current_project = nil
end
end
local function load_project_from_file(project_name)
ensure_projects_dir()
if empty(project_name) then
return nil
end
local file_path = project_path(project_name)
local ok, project_data = pcall(dofile, file_path)
if ok == false then
return nil
end
if project_data then
local project = Config:new(project_data)
-- set some defaults
project.name = project_name
project.persistent = Persistent:create(project_persistent_path(project_name))
if not project.extensions then
project.extensions = {}
end
-- print(vim.inspect(project))
if is_project_root_ok(project) then
return project
end
end
return nil
end
local project_template = [[
local M = {
root_dir = 'This is mandatory.',
-- silent = false,
-- session_name = 'defaults to project name.'
extensions = {
%s
},
}
function M.on_project_open()
vim.opt.makeprg = 'make'
end
function M.on_project_close()
print('Goodbye then.')
end
return M
]]
local function render_project_template()
local str = ''
local templates = extension_man:call_extensions 'config_example'
local indent = ' '
for _, conf_str in pairs(templates) do
-- str = str .. '-- ' .. source_name .. '\n'
for line in utils.lines(conf_str) do
if line ~= '' then
str = str .. indent .. line .. '\n'
else
str = str .. line .. '\n'
end
end
end
return string.format(project_template, str)
end
local function register_commands()
vim.cmd 'command! -nargs=* -complete=custom,ProjectsComplete PEdit lua require("projects").project_edit(vim.fn.expand("<args>"))'
vim.cmd 'command! -nargs=* -complete=custom,ProjectsComplete POpen lua require("projects").project_open(vim.fn.expand("<args>"))'
vim.cmd 'command! -nargs=* -complete=custom,ProjectsComplete PDelete lua require("projects").project_delete(vim.fn.expand("<args>"))'
vim.cmd 'command! -nargs=* PClose lua require("projects").project_close()'
vim.cmd [[
fun ProjectsComplete(A,L,P)
return luaeval('require("projects").projects_complete(A, L, P)')
endfun
]]
end
-- ****************************************************************************
-- Public API
-- ****************************************************************************
local M = {
-- M being the extension host can provide unified user interaction,
-- this could perhaps be overridden to use a telescope picker.
prompt_selection = utils.prompt_selection,
prompt_yes_no = utils.prompt_yes_no,
}
function M.setup(opts)
config = utils.merge_first_level(default_config(), opts)
config.persistent = Persistent:create(config.project_dir .. '/__projects__.json')
register_commands()
end
function M.register_extension(extension)
extension_man:register_extension(extension, M)
end
function M.global_config()
return Config:new(config)
end
function M.current_project_config()
return Config:new(current_project)
end
function M.print_project_template()
print(render_project_template())
end
function M.project_open(project_name)
local projects = project_list()
if not utils.is_in_list(projects, project_name) then
project_name = M.prompt_selection(projects)
end
if empty(project_name) then
return
end
if current_project then
M.project_close()
end
local project = load_project_from_file(project_name)
if project then
activate_project(project, M)
config.persistent:set('last_loaded_project', project_name)
-- notify the user
if config.silent == false then
vim.defer_fn(function()
vim.notify('[project-config] - ' .. project.name)
end, 100)
end
else
vim.notify('Unable to load project: ' .. project_name)
end
end
function M.project_close()
if not current_project then
return
end
if not config.silent then
vim.notify('closing: ' .. current_project.name)
end
project_close_current()
end
function M.project_delete(project_name)
local projects = project_list()
if not utils.is_in_list(projects, project_name) then
vim.notify('no project named: ' .. project_name)
end
if empty(project_name) then
return
end
if M.prompt_yes_no('Really delete ' .. project_name) then
-- close project if currently open
if current_project.name == project_name then
M.project_close()
end
local project = load_project_from_file(project_name)
local file_path = project_path(project_name)
if vim.fn.delete(file_path) == 0 then
-- delete project json file
local persistent_path = project_persistent_path(project_name)
vim.fn.delete(persistent_path)
if project then
-- notify extensions
extension_man:call_extensions('on_project_delete', project)
vim.notify('Deleted ' .. project.name)
end
else
vim.notify 'Deletion failed!'
end
end
end
function M.project_edit(project_name)
if not project_name or project_name == '' then
project_name = current_project.name
end
local projects = project_list()
if empty(project_name) then
project_name = M.prompt_selection(projects)
end
local is_new = not utils.is_in_list(projects, project_name)
if project_name and project_name ~= '' then
ensure_projects_dir()
local projectfile = project_path(project_name)
vim.cmd('edit ' .. projectfile)
if is_new then
local buf = vim.api.nvim_get_current_buf()
vim.api.nvim_buf_set_lines(buf, 0, -1, false, utils.split_newlines(render_project_template()))
end
end
end
function M.projects_complete(_, _, _)
return utils.join(project_list(), '\n')
end
function M.show_current_project()
print(vim.inspect(current_project))
end
function M.projects_startify_list()
local list = {}
for i, project in ipairs(project_list()) do
list[i] = {
line = project,
cmd = "lua require'projects'.project_open('" .. project .. "')",
}
end
return list
end
return M
|
function scripts.utils.bind_functional(command, silent, remove_on_new_location)
scripts.utils.functional_key = command
if not silent then
cecho("\n\n<" .. scripts.ui:get_bind_color_backward_compatible() .. ">bind <yellow>" .. scripts.keybind:keybind_tostring("functional_key") .. "<" .. scripts.ui:get_bind_color_backward_compatible() .. ">: " .. command .. "\n\n")
end
if remove_on_new_location then
scripts.utils.requested_removal_functional_key = true
end
end
function scripts.utils.bind_functional_call(func, text, remove_on_new_location)
scripts.utils.functional_key = func
if text then
cecho("\n\n<" .. scripts.ui:get_bind_color_backward_compatible() .. ">bind <yellow>" .. scripts.keybind:keybind_tostring("functional_key") .. "<" .. scripts.ui:get_bind_color_backward_compatible() .. ">: " .. text .. "\n\n")
end
if remove_on_new_location then
scripts.utils.requested_removal_functional_key = true
end
end
function scripts.utils.remove_functional_if_requested()
if scripts.utils.requested_removal_functional_key then
scripts.utils.functional_key = nil
scripts.utils.requested_removal_functional_key = false
end
end
function scripts.utils.execute_functional()
if scripts.utils.functional_key then
if type(scripts.utils.functional_key) == "function" then
scripts.utils.functional_key()
scripts.utils.bind_functional(function() send("stan") end, true)
else
local sep = string.split(scripts.utils.functional_key, "[;#]")
for k, v in pairs(sep) do
expandAlias(v, true)
end
scripts.utils.functional_key = "stan"
end
end
end
function scripts.utils.bind_functional_team_follow(line, command, delay, silent)
if ateam.special_follow_bind_mode == 0 then
-- it's disabled
return
end
-- check whether the line contains the team leader name
if not line or ateam.special_follow_bind_mode == 2 then
scripts.utils.bind_functional(command, silent)
raiseEvent("ateamTeamFollowBind")
return
end
for k, v in pairs(ateam.team) do
if type(k) == "number" then
if ateam and ateam.objs and ateam.objs[k]["team_leader"] and ateam.objs[k]["desc"] ~= nil and string.find(line, ateam.objs[k]["desc"]) then
scripts.utils.bind_functional(command, silent)
raiseEvent("ateamTeamFollowBind")
end
end
end
end
registerAnonymousEventHandler("amapNewLocation", scripts.utils.remove_functional_if_requested)
|
minetest.register_node('ruins:old_skeleton', {
description = 'Old Skeleton',
drawtype = 'mesh',
mesh = 'decoblocks_old_skeleton.obj',
tiles = {name='decoblocks_old_skeleton.png'},
visual_scale = 0.5,
groups = {cracky=2, oddly_breakable_by_hand=5},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.0, 0.3}
},
collision_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.0, 0.3}
},
})
minetest.register_node('ruins:old_skeleton2', {
description = 'Old Skeleton',
drawtype = 'mesh',
mesh = 'decoblocks_old_skeleton2.obj',
tiles = {name='decoblocks_old_skeleton.png'},
visual_scale = 0.5,
groups = {cracky=2, oddly_breakable_by_hand=5},
paramtype = 'light',
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.0, 0.3}
},
collision_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.0, 0.3}
},
})
minetest.register_node('ruins:concrete', {
description = 'Concrete',
tiles = {name='ws_concrete.png'},
groups = {cracky=3},
paramtype = 'light',
paramtype2 = 'facedir',
})
minetest.register_node("ruins:human_skull", {
description = "Human Skull",
drawtype = "mesh",
mesh = "human_skull.obj",
tiles = {
"human_skull.png",
},
visual_scale = 0.5,
wield_image = "skeleton_head_item.png",
wield_scale = {x=1.0, y=1.0, z=1.0},
paramtype = "light",
paramtype2 = "facedir",
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.0, 0.3}
},
collision_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.0, 0.3}
},
inventory_image = "skeleton_head_item.png",
groups = {choppy = 1, oddly_breakable_by_hand = 1},
}) |
require 'image'
require 'nn'
require 'nngraph'
require 'cunn'
require 'cudnn'
require 'cutorch'
require 'lfs'
require 'stn'
util = paths.dofile('util.lua')
torch.setdefaulttensortype('torch.FloatTensor')
local alphabet = "abcdefghijklmnopqrstuvwxyz0123456789-,;.!?:'\"/\\|_@#$%^&*~`+-=<>()[]{} "
local dict = {}
for i = 1,#alphabet do
dict[alphabet:sub(i,i)] = i
end
ivocab = {}
for k,v in pairs(dict) do
ivocab[v] = k
end
opt = {
dataset = 'cub',
doc_length = 201,
prefix = 'move',
batchSize = 16, -- number of samples to produce
noisetype = 'normal', -- type of noise distribution (uniform / normal).
imsize = 1, -- used to produce larger images. 1 = 64px. 2 = 80px, 3 = 96px, ...
noisemode = 'random', -- random / line / linefull1d / linefull
gpu = 1, -- gpu mode. 0 = CPU, 1 = GPU
display = 0, -- Display image: 0 = false, 1 = true
nz = 100,
net_gen = '/',
net_txt = '',
loadSize = 150,
fineSize = 128,
txtSize = 1024,
data_root = '/mnt/brain3/datasets/txt2img/cub_ex_part',
img_dir = '/mnt/brain1/scratch/reedscot/nx/reedscot/data/gutenbirds/CUB_200_2011/images',
demo = 'keypoints_given',
num_elt = 15,
nsample = 20,
keypoint_dim = 16,
}
dofile('data/donkey_folder_cub_keypoint.lua')
-- demo = 'trans' -- trans|stretch|shrink
for k,v in pairs(opt) do opt[k] = tonumber(os.getenv(k)) or os.getenv(k) or opt[k] end
print(opt)
if opt.display == 0 then opt.display = false end
assert(opt.net_gen ~= '')
assert(opt.net_txt ~= '')
assert(opt.net_kp ~= '')
if opt.gpu > 0 then
ok, cunn = pcall(require, 'cunn')
ok2, cutorch = pcall(require, 'cutorch')
cutorch.setDevice(opt.gpu)
end
net_gen = torch.load(opt.net_gen)
net_txt = torch.load(opt.net_txt).protos.enc_doc
net_gen:evaluate()
net_txt:evaluate()
function decode(txt)
local str = ''
for w_ix = 1,txt:size(1) do
local ch_ix = txt[w_ix]
local ch = ivocab[ch_ix]
if (ch ~= nil) then
str = str .. ch
end
end
return str
end
local html = '<html><body><h1>Generated Images</h1><table border="1" style="width=100%"><tr><td>Caption</td><td>Image</td></tr>'
local cur_files = dir.getfiles(opt.data_root)
local ix_file = torch.randperm(#cur_files)
for n = 1,opt.nsample do
local info = torch.load(cur_files[ix_file[n]])
local img_file = opt.img_dir .. '/' .. info.img
_, locs, _ = trainHook(img_file, info.parts:clone():double())
-- prepare text
local query = decode(info.char[{{},1}])
print(string.format('sample %d of %d: [%s]', n, opt.nsample, query))
-- Take unseen text embedding.
local fea_txt = info.txt[10]:clone()
fea_txt = torch.repeatTensor(fea_txt, opt.batchSize, 1):cuda()
-- prepare noise
noise = torch.Tensor(opt.batchSize, opt.nz)
if opt.noisetype == 'uniform' then
noise:uniform(-1, 1)
elseif opt.noisetype == 'normal' then
noise:normal(0, 1)
end
noise = noise:cuda()
-- prepare keypoints
local fea_loc = torch.zeros(1, opt.num_elt, opt.keypoint_dim, opt.keypoint_dim)
for s = 1,opt.num_elt do
local point = locs[s]
if point[3] > 0.1 then
local x = math.min(opt.keypoint_dim,
math.max(1,torch.round(point[1] * opt.keypoint_dim)))
local y = math.min(opt.keypoint_dim,
math.max(1,torch.round(point[2] * opt.keypoint_dim)))
fea_loc[{1,s,y,x}] = 1
end
end
fea_loc = torch.repeatTensor(fea_loc, opt.batchSize, 1, 1, 1)
fea_loc = fea_loc:cuda()
local images = net_gen:forward({ { noise, fea_txt }, fea_loc }):clone()
images:add(1):mul(0.5)
local locs_tmp = locs:clone()
locs_tmp:narrow(2,1,2):mul(opt.fineSize)
images = torch.repeatTensor(images, 2, 1, 1, 1)
for b = 1,opt.batchSize do
images[b] = util.draw_keypoints(images[b], locs_tmp, 0.06, 1)
end
images = images:narrow(1,1,3)
lfs.mkdir('results')
local visdir = 'results/cub_kp_given'
lfs.mkdir(visdir)
local fname = string.format('%s/cub_%s_%d', visdir, opt.demo, n)
local fname_png = fname .. '.png'
image.save(fname_png, image.toDisplayTensor(images, 4, 3))
fname = string.format('cub_kp_given/cub_%s_%d', opt.demo, n)
local fname_rel = fname .. '.png'
html = html .. string.format('\n<tr><td>%s</td><td><img src=\"%s\"></td></tr>',
query, fname_rel)
end
html = html .. '</html>'
fname_html = string.format('results/%s_%s.html', opt.dataset, opt.demo)
os.execute(string.format('echo "%s" > %s', html, fname_html))
|
local META = ix.squad.meta or ix.middleclass("ix_squad")
META.__index = META
META.name = META.name or "ERROR"
META.members = META.members or {}
function META:__tostring()
return "squad["..self.owner.."]["..self.name.."]"
end
function META:Initialize(owner, name)
self.owner = owner
self.name = name
self.members = {}
end
function META:GetReceivers()
local receivers = {}
for _, v in ipairs(player.GetHumans()) do
if (IsValid(v) and self.members[v:SteamID64()]) then
receivers[#receivers + 1] = v
end
end
return receivers
end
function META:GetRank(client)
return self.members[client:SteamID64()]
end
function META:IsLeader(client)
return self.owner == client:SteamID64()
end
if (SERVER) then
function META:CollectData()
return {
owner = self.owner,
name = self.name,
members = self.members,
color = self.color,
logo = self.logo,
description = self.description
}
end
function META:Sync(client, bSetColor)
local receivers
if (IsValid(client)) then
receivers = {client}
else
receivers = self:GetReceivers()
if (#receivers == 0) then
receivers = nil
end
end
if (!receivers) then return end
if (bSetColor and (self.hasColor or ix.util.IsColor(self.color))) then
self.hasColor = true
for _, v in ipairs(receivers) do
if (v:Alive()) then
v:SetPlayerColor(Vector(self.color.r / 255, self.color.g / 255, self.color.b / 255))
end
end
end
net.Start("ixSquadSync")
net.WriteTable(self:CollectData())
net.Send(receivers)
end
end
ix.squad.meta = META |
-- Copyright (c) 2022 Emmanuel Arias
local ROOT = "../../../../"
project "OpenFBX"
kind "StaticLib"
language "C"
staticruntime "off"
targetdir (ROOT .. TARGET_FOLDER)
objdir (ROOT .. INTERMEDIATE_FOLDER)
files {
"src/miniz.c",
"src/miniz.h",
"src/ofbx.cpp",
"src/ofbx.h"
}
filter "system:windows"
disablewarnings "4018"
filter "configurations:Debug"
runtime "Debug"
symbols "on"
filter "configurations:Release"
runtime "Release"
optimize "on"
|
local ospath = require 'ospath'
module('cppcodebase', package.seeall)
function SetDir(dir)
if not ospath.exists(dir) then
ospath.mkdir(dir .. '/')
end
ospath.chdir(dir)
end
function lib_name(i)
return "lib_" .. i
end
function CreateHeader(lib, name)
local filename = name .. ".h"
local handle = io.open(filename, "w")
local guard = lib .. '_' .. name .. '_h_'
handle:write ('#ifndef ' .. guard .. '\n')
handle:write ('#define ' .. guard .. '\n\n')
local class = lib .. '_' .. name
handle:write ('class ' .. class .. ' {\n')
handle:write ('public:\n')
handle:write (' ' .. class .. '();\n')
handle:write (' ~' .. class .. '();\n')
handle:write ('};\n\n')
handle:write ('#endif\n')
end
function lotto(count, range)
function PositiveIntegers() return setmetatable({}, { __index = function(self, k) return k end }) end
function permute(tab, n, count)
n = n or #tab
for i = 1, count or n do
local j = math.random(i, n)
tab[i], tab[j] = tab[j], tab[i]
end
return tab
end
return {unpack(
permute(PositiveIntegers(), range, count),
1, count)
}
end
function CreateCPP(lib, name, lib_number, classes_per_lib, internal_includes, external_includes)
local filename = name .. ".cpp"
local handle = io.open(filename, "w" )
local header= name .. ".h"
handle:write ('#include "' .. header .. '"\n')
local includes = lotto(internal_includes, classes_per_lib - 1)
for _, i in ipairs(includes) do
handle:write ('#include "class_' .. i .. '.h"\n')
end
if lib_number > 0 then
includes = lotto(external_includes, classes_per_lib - 1)
for _, i in ipairs(includes) do
libname = 'lib_' .. math.random(0, lib_number)
handle:write ('#include <' .. libname .. '/' .. 'class_' .. i .. '.h>\n')
end
end
handle:write ('\n')
local class = lib .. '_' .. name
handle:write (class .. '::' .. class .. '() {}\n')
handle:write (class .. '::~' .. class .. '() {}\n')
end
function CreateLibrary(lib_number, classes, internal_includes, external_includes)
local lib = lib_name(lib_number)
SetDir(lib)
print('-> Writing ' .. lib .. '...')
for i = 0, classes - 1 do
classname = "class_" .. i
CreateHeader(lib, classname)
CreateCPP(lib, classname, lib_number, classes, internal_includes, external_includes)
end
ospath.chdir("..")
end
function CreateSetOfLibraries(libs, classes, internal_includes, external_includes, myfunction)
math.randomseed(12345)
for i = 0, libs - 1 do
CreateLibrary(i, classes, internal_includes, external_includes)
myfunction(i, classes)
end
end
|
module("luci.controller.agentx1-gui", package.seeall)
function index()
entry({"admin", "network", "agentx1"}, cbi("agentx1-gui/agentx1-gui"), _("agentx1"))
end |
-----------------------------------
-- PET: Automaton
-----------------------------------
require("scripts/globals/status")
require("scripts/globals/pets")
function onMobSpawn(mob)
mob:setLocalVar("MANEUVER_DURATION", 60)
mob:addListener("EFFECTS_TICK", "MANEUVER_DURATION", function(automaton)
if (automaton:getTarget()) then
local dur = automaton:getLocalVar("MANEUVER_DURATION")
automaton:setLocalVar("MANEUVER_DURATION", math.min(dur+3, 300))
end
end)
end
function onMobDeath(mob)
mob:removeListener("MANEUVER_DURATION")
end
|
---@class CS.FairyEditor.Component.InputElement : CS.System.ValueType
---@field public name string
---@field public type string
---@field public prop string
---@field public dummy boolean
---@field public extData CS.System.Object
---@field public min CS.FairyEditor.Component.InputElement.OptionalValue_CS.System.Single
---@field public max CS.FairyEditor.Component.InputElement.OptionalValue_CS.System.Single
---@field public step CS.FairyEditor.Component.InputElement.OptionalValue_CS.System.Single
---@field public precision CS.FairyEditor.Component.InputElement.OptionalValue_CS.System.Int32
---@field public items String[]
---@field public values String[]
---@field public isIndex boolean
---@field public inverted boolean
---@field public showAlpha boolean
---@field public filter String[]
---@field public pages string
---@field public includeChildren boolean
---@field public prompt string
---@field public readonly boolean
---@field public disableIME boolean
---@field public trim boolean
---@type CS.FairyEditor.Component.InputElement
CS.FairyEditor.Component.InputElement = { }
|
require("win32") |
local function factorial(n)
if n == 0 then
return 1
else
return factorial(n - 1) * n
end
end
print(factorial(10))
|
local Aye = Aye;
-- create radar
--
-- @noparam
-- @noreturn
Aye.modules.Nameplates.radar.init = function()
Aye.modules.Nameplates.radar.background = CreateFrame("Frame", nil, UIParent);
Aye.modules.Nameplates.radar.background:SetBackdrop({
bgFile = "Interface\\Buttons\\WHITE8X8",
edgeFile = "Interface\\Buttons\\WHITE8X8",
tile = false, tileSize = 0, edgeSize = 1,
insets = {left = 0, right = 0, top = 0, bottom = 0},
});
Aye.modules.Nameplates.radar.background:SetBackdropColor(unpack(Aye.db.global.Nameplates.backgroundColor));
Aye.modules.Nameplates.radar.background:SetBackdropBorderColor(unpack(Aye.db.global.Nameplates.backgroundBorderColor));
Aye.modules.Nameplates.radar.background:ClearAllPoints();
Aye.modules.Nameplates.radar.background:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 330, 260);
Aye.modules.Nameplates.radar.background:SetWidth(UIParent:GetHeight() *Aye.db.global.Nameplates.radarSize /100);
Aye.modules.Nameplates.radar.background:SetHeight(UIParent:GetHeight() *Aye.db.global.Nameplates.radarSize /100);
end;
-- add "player" unit to radar
--
-- @noparam
-- @noreturn
Aye.modules.Nameplates.radar.addPlayer = function()
if not Aye.modules.Nameplates.radar.markers.player then
Aye.modules.Nameplates.radar.markers.player = CreateFrame("Frame", nil, Aye.modules.Nameplates.radar.background);
Aye.modules.Nameplates.radar.markers.player:ClearAllPoints();
Aye.modules.Nameplates.radar.markers.player:SetPoint("CENTER", Aye.modules.Nameplates.radar.background, "CENTER");
Aye.modules.Nameplates.radar.markers.player.icon = Aye.modules.Nameplates.radar.markers.player:CreateTexture();
Aye.modules.Nameplates.radar.markers.player.icon:SetAllPoints();
Aye.modules.Nameplates.radar.markers.player.icon:SetBlendMode("BLEND");
Aye.modules.Nameplates.radar.markers.player.icon:SetDesaturated(true);
end;
Aye.modules.Nameplates.radar.markers.player:SetAlpha(Aye.db.global.Nameplates.enable and Aye.db.global.Nameplates.playerIconEnable and 1 or 0);
Aye.modules.Nameplates.radar.markers.player:SetWidth(Aye.db.global.Nameplates.playerIconSize);
Aye.modules.Nameplates.radar.markers.player:SetHeight(Aye.db.global.Nameplates.playerIconSize);
if type(Aye.modules.Nameplates.TEXTURES[Aye.db.global.Nameplates.playerIcon]) == "table"
then Aye.modules.Nameplates.radar.markers.player.icon:SetAtlas(Aye.modules.Nameplates.TEXTURES[Aye.db.global.Nameplates.playerIcon][1]);
else Aye.modules.Nameplates.radar.markers.player.icon:SetTexture(Aye.modules.Nameplates.TEXTURES[Aye.db.global.Nameplates.playerIcon]);
end;
Aye.modules.Nameplates.radar.markers.player.icon:SetVertexColor(unpack(Aye.db.global.Nameplates.playerIconColor));
Aye.modules.Nameplates.radar.markers.player.icon:SetDrawLayer(string.sub(Aye.db.global.Nameplates.layer, 2), Aye.db.global.Nameplates.playerIconPriority -8);
end;
-- add not "player" unit to radar
--
-- @param unitID {"nameplate" ..uint} unit to add to radar
-- @noreturn
Aye.modules.Nameplates.radar.addUnit = function(unitID)
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID, true);
-- create new marker
if not Aye.modules.Nameplates.radar.markers.units[unitID] then
Aye.modules.Nameplates.radar.markers.units[unitID] = CreateFrame("Frame", nil, Aye.modules.Nameplates.radar.background);
Aye.modules.Nameplates.radar.markers.units[unitID].icon = Aye.modules.Nameplates.radar.markers.units[unitID]:CreateTexture();
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetAllPoints();
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetBlendMode("BLEND");
Aye.modules.Nameplates.radar.markers.units[unitID].targetingFrame = CreateFrame("Frame", nil, Aye.modules.Nameplates.radar.markers.units[unitID]);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon = Aye.modules.Nameplates.radar.markers.units[unitID].targetingFrame:CreateTexture();
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetAllPoints();
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetBlendMode("ADD");
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetTexture(Aye.modules.Nameplates.TARGETING_TEXTURES[Aye.db.global.Nameplates.targetIcon]);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetDesaturated(false);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetVertexColor(0, 0, 0, 0);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetDrawLayer(string.sub(Aye.db.global.Nameplates.layer, 2), 1);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingFrame:SetWidth(24);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingFrame:SetHeight(24);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingFrame:ClearAllPoints();
Aye.modules.Nameplates.radar.markers.units[unitID].targetingFrame:SetPoint("CENTER", Aye.modules.Nameplates.radar.markers.units[unitID], "CENTER", 0, 0);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingFrame = CreateFrame("Frame", nil, Aye.modules.Nameplates.radar.markers.units[unitID]);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon = Aye.modules.Nameplates.radar.markers.units[unitID].focusingFrame:CreateTexture();
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetAllPoints();
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetBlendMode("ADD");
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetTexture(Aye.modules.Nameplates.TARGETING_TEXTURES[Aye.db.global.Nameplates.focusIcon]);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetDesaturated(false);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetVertexColor(0, 0, 0, 0);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetDrawLayer(string.sub(Aye.db.global.Nameplates.layer, 2), 1);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingFrame:SetWidth(24);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingFrame:SetHeight(24);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingFrame:ClearAllPoints();
Aye.modules.Nameplates.radar.markers.units[unitID].focusingFrame:SetPoint("CENTER", Aye.modules.Nameplates.radar.markers.units[unitID], "CENTER", 0, 0);
end;
-- marker
local markerID = GetRaidTargetIndex(unitID);
-- nameplate unit type
local unitType = "friendly";
if UnitCanAttack("player", unitID) then unitType = "enemy" end;
if UnitIsPlayer(unitID) then
unitType = unitType .."Player";
else
unitType = unitType .."NPC";
local classification = UnitClassification(unitID);
if UnitIsUnit(unitID, "boss1")
or UnitIsUnit(unitID, "boss2")
or UnitIsUnit(unitID, "boss3")
or UnitIsUnit(unitID, "boss4")
or UnitIsUnit(unitID, "boss5")
or classification == "worldboss" then unitType = unitType .."Boss";
elseif classification == "rareelite" then unitType = unitType .."RareElite";
elseif classification == "rare" then unitType = unitType .."Rare";
elseif classification == "elite" then unitType = unitType .."Elite";
elseif classification == "minus" then unitType = unitType .."Minus";
elseif classification == "trivial" then unitType = unitType .."Trivial";
else unitType = unitType .."Normal";
end;
end;
if
(
markerID
and Aye.db.global.Nameplates.markerIconEnable
)
or (
-- filter out friendly NPC
not string.match(unitType, "^friendlyNPC")
-- don't show icon if disabled
and Aye.db.global.Nameplates[unitType .."IconEnable"]
)
then
if
markerID
and Aye.db.global.Nameplates.markerIconEnable
then
-- marker icon
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetTexture("Interface\\TARGETINGFRAME\\UI-RaidTargetingIcon_" ..markerID);
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetDesaturated(false);
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetVertexColor(1, 1, 1, 1);
Aye.modules.Nameplates.radar.markers.units[unitID]:SetWidth(Aye.db.global.Nameplates.markerIconSize);
Aye.modules.Nameplates.radar.markers.units[unitID]:SetHeight(Aye.db.global.Nameplates.markerIconSize);
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetDrawLayer(string.sub(Aye.db.global.Nameplates.layer, 2), Aye.db.global.Nameplates.markerIconPriority -8);
else
-- icon
if type(Aye.modules.Nameplates.TEXTURES[Aye.db.global.Nameplates[unitType .."Icon"]]) == "table"
then Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetAtlas(Aye.modules.Nameplates.TEXTURES[Aye.db.global.Nameplates[unitType .."Icon"]][1]);
else Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetTexture(Aye.modules.Nameplates.TEXTURES[Aye.db.global.Nameplates[unitType .."Icon"]]);
end;
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetDesaturated(true);
-- color
if string.match(unitType, "Player$") then
-- Player
if Aye.db.global.Nameplates[unitType .."IconColorConstant"] then
-- constant color
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetVertexColor(Aye.db.global.Nameplates[unitType .."IconColor"]);
else
-- class color
local _, class = UnitClass(unitID);
local color = RAID_CLASS_COLORS[class];
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetVertexColor(color.r, color.g, color.b, 1);
end;
else
-- NPC
if Aye.db.global.Nameplates[unitType .."IconColorCustom"] then
-- custom color
local r, g, b = UnitSelectionColor(unitID);
local threatStatus = UnitThreatSituation("player", unitID);
local combatState = "Neutral";
if
r > .4 and r < .6
and g > .4 and g < .6
and b > .4 and b < .6
then
-- Tapped
combatState = "Tapped";
elseif
threatStatus
and threatStatus >1
then
-- Tanked
combatState = "Tanked";
elseif UnitAffectingCombat(unitID) then
-- Aggroed
combatState = "Aggroed";
elseif
r > .9
and g < .1
and b < .1
then
-- Hostile
combatState = "Hostile";
end;
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetVertexColor(unpack(Aye.db.global.Nameplates[unitType .."IconColor" ..combatState]));
else
-- blizzard color
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetVertexColor(unpack(UnitSelectionColor(unitID)));
end;
end;
-- size
Aye.modules.Nameplates.radar.markers.units[unitID]:SetWidth(Aye.db.global.Nameplates[unitType .."IconSize"]);
Aye.modules.Nameplates.radar.markers.units[unitID]:SetHeight(Aye.db.global.Nameplates[unitType .."IconSize"]);
-- ptiority
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetDrawLayer(string.sub(Aye.db.global.Nameplates.layer, 2), Aye.db.global.Nameplates[unitType .."IconPriority"] -8);
end;
-- set position of icon on radar
Aye.modules.Nameplates.radar.markers.units[unitID]:ClearAllPoints();
Aye.modules.Nameplates.radar.markers.units[unitID]:SetPoint(
"CENTER",
Aye.modules.Nameplates.radar.background,
"BOTTOMLEFT",
(
(nameplate:GetLeft() +nameplate:GetWidth() /2)
* Aye.db.global.Nameplates.radarSize /100
* Aye.modules.Nameplates.__TARGET_REVERSE_SCALING(unitID)
* UIParent:GetWidth() /WorldFrame:GetWidth()
* WorldFrame:GetHeight() /WorldFrame:GetWidth()
), (
(nameplate:GetBottom() +nameplate:GetHeight() /2)
* Aye.db.global.Nameplates.radarSize /100
* Aye.modules.Nameplates.__TARGET_REVERSE_SCALING(unitID)
* UIParent:GetHeight() /WorldFrame:GetHeight()
)
);
-- focusing mark
if
Aye.db.global.Nameplates.focusEnable
and UnitIsUnit(unitID, "focus")
then
-- override focus priority
if Aye.db.global.Nameplates.focusLayerOverride then
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetDrawLayer(string.sub(Aye.db.global.Nameplates.layer, 2), Aye.db.global.Nameplates.focusLayerPriority -8);
end;
-- set and adjust focusing mark
Aye.modules.Nameplates.radar.markers.units[unitID].focusingFrame:SetWidth(Aye.modules.Nameplates.radar.markers.units[unitID]:GetWidth() *1.5);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingFrame:SetHeight(Aye.modules.Nameplates.radar.markers.units[unitID]:GetHeight() *1.5);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetTexture(Aye.modules.Nameplates.TARGETING_TEXTURES[Aye.db.global.Nameplates.focusIcon]);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetDrawLayer(Aye.modules.Nameplates.radar.markers.units[unitID].icon:GetDrawLayer());
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetVertexColor(1, 1, 1, 1);
else
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetVertexColor(0, 0, 0, 0);
end;
-- targeting mark
if
Aye.db.global.Nameplates.targetEnable
and UnitIsUnit(unitID, "target")
then
-- override target priority
if Aye.db.global.Nameplates.targetLayerOverride then
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetDrawLayer(string.sub(Aye.db.global.Nameplates.layer, 2), Aye.db.global.Nameplates.targetLayerPriority -8);
end;
-- set and adjust targeting mark
Aye.modules.Nameplates.radar.markers.units[unitID].targetingFrame:SetWidth(Aye.modules.Nameplates.radar.markers.units[unitID]:GetWidth() *1.5);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingFrame:SetHeight(Aye.modules.Nameplates.radar.markers.units[unitID]:GetHeight() *1.5);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetTexture(Aye.modules.Nameplates.TARGETING_TEXTURES[Aye.db.global.Nameplates.targetIcon]);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetDrawLayer(Aye.modules.Nameplates.radar.markers.units[unitID].icon:GetDrawLayer());
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetVertexColor(1, 1, 1, 1);
else
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetVertexColor(0, 0, 0, 0);
end;
else
-- hide icon
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetVertexColor(0, 0, 0, 0);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetVertexColor(0, 0, 0, 0);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetVertexColor(0, 0, 0, 0);
end;
end;
-- remove not "player" unit from radar
--
-- @param unitID {"nameplate" ..uint} unit to remove from radar
-- @noreturn
Aye.modules.Nameplates.radar.removeUnit = function(unitID)
if Aye.modules.Nameplates.radar.markers.units[unitID] then
Aye.modules.Nameplates.radar.markers.units[unitID].icon:SetVertexColor(0, 0, 0, 0);
Aye.modules.Nameplates.radar.markers.units[unitID].targetingIcon:SetVertexColor(0, 0, 0, 0);
Aye.modules.Nameplates.radar.markers.units[unitID].focusingIcon:SetVertexColor(0, 0, 0, 0);
end;
end;
-- update all units on radar
--
-- @noparam
-- @noreturn
Aye.modules.Nameplates.updateAll = function()
if Aye.modules.Nameplates.updateTimer then Aye.modules.Nameplates.updateTimer:Cancel() end;
for _, frame in pairs(C_NamePlate.GetNamePlates(true)) do
if UnitExists(frame.namePlateUnitToken) then
Aye.modules.Nameplates.radar.addUnit(frame.namePlateUnitToken);
end;
end;
if Aye.db.global.Nameplates.enable then
Aye.modules.Nameplates.updateTimer = C_Timer.NewTimer(Aye.db.global.Nameplates.updateInterval, function()
Aye.modules.Nameplates.updateAll();
end);
end;
end; |
if getgenv().building == true then
warn(string.format('already building, type %s%s%s in the chat to stop building.', "'", getgenv().stop_command, "'"))
return
end
local lplayer = game.Players.LocalPlayer
local mouse = lplayer:GetMouse()
local transparency_table = {}
local clicked = false
getgenv().building = false
local count = 0
local old_model = game:GetObjects(string.format('http://www.roblox.com/asset/?id=%s', tostring(getgenv().model_id)))[1]
if old_model:IsA('BasePart') then
local temp_model = Instance.new('Model', workspace)
temp_model.Name = old_model.Name
old_model.Parent = temp_model
old_model = temp_model
end
old_model.Parent = workspace
for i, v in pairs(old_model:GetDescendants()) do
if v:IsA('BasePart') then
if v.Transparency > 0 then
local inserting_table = {
v,
v.Transparency,
v.Color,
v.Material,
}
table.insert(transparency_table, inserting_table)
end
count = count + 1
v.Anchored = true
v.Transparency = .7
if old_model.PrimaryPart == nil then
old_model.PrimaryPart = v
end
end
end
local camera = workspace.CurrentCamera
local uis = game:GetService('UserInputService')
mouse.TargetFilter = old_model
local cloud = lplayer.Character:FindFirstChild('PompousTheCloud')
if not cloud then
cloud = lplayer.Backpack:FindFirstChild('PompousTheCloud')
end
if cloud then
cloud.Parent = lplayer.Character
end
cloud:WaitForChild('LocalScript').Disabled = true
local model = nil
workspace.GuiEvent:FireServer('building_model')
local cloud_remote = cloud:WaitForChild('ServerControl')
model = lplayer.Character:WaitForChild('building_model')
model:ClearAllChildren()
cloud_remote:InvokeServer('SetProperty', {Value = old_model.Name, Property = 'Name', Object = model})
cloud_remote:InvokeServer('SetProperty', {Value = workspace, Property = 'Parent', Object = model})
print(count)
if model == nil then
warn('error while trying to create model')
return
end
local gui = Instance.new('ScreenGui', lplayer.PlayerGui)
gui.Name = 'part_counter'
local text = Instance.new('TextLabel', gui)
text.Size = UDim2.new(.5, 0, .1, 0)
text.AnchorPoint = Vector2.new(.5, .5)
text.Position = UDim2.new(.5, 0, .85, 0)
text.TextColor3 = Color3.fromRGB(255, 255, 255)
text.Font = 'GothamBlack'
text.TextScaled = true
text.BackgroundTransparency = 1
for i = 1, count do
text.Text = string.format('%s/%s', i, count)
workspace.GuiEvent:FireServer('part_model')
lplayer.Character.ChildAdded:Wait()
local part_model = lplayer.Character:WaitForChild('part_model')
local head_part = part_model:WaitForChild('Head')
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = false, Property = 'CanCollide', Object = head_part}) end)
cloud_remote:InvokeServer('SetProperty', {Value = lplayer.Character.Humanoid, Property = 'Parent', Object = head_part})
end
text.Text = ''
local function build(part)
local cloud = lplayer.Character:FindFirstChild('PompousTheCloud')
local current_transpareny = 0
for i, v in pairs(transparency_table) do
if transparency_table[i][1] == part then
warn('part is transparent')
current_transpareny = transparency_table[i][2]
part.Transparency = 1
end
end
if not cloud then
cloud = lplayer.Backpack:FindFirstChild('PompousTheCloud')
end
if cloud then
cloud.Parent = lplayer.Character
end
if part:IsA('Humanoid') then
local cloud_remote = cloud:WaitForChild('ServerControl')
local humanoid = lplayer.Character:FindFirstChildOfClass('Model'):FindFirstChildOfClass('Humanoid')
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.Name, Property = 'Name', Object = humanoid}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.MaxHealth, Property = 'MaxHealth', Object = humanoid}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.HealthDisplayType, Property = 'HealthDisplayType', Object = humanoid}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.DisplayDistanceType, Property = 'DisplayDistanceType', Object = humanoid}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.Health, Property = 'Health', Object = humanoid}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.NameDisplayDistance, Property = 'NameDisplayDistance', Object = humanoid}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.NameDisplayDistance, Property = 'NameDisplayDistance', Object = humanoid}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = model, Property = 'Parent', Object = humanoid}) end)
local char_head = lplayer.Character:FindFirstChild('Head')
if char_head.Transparency > 0 then
cloud_remote:InvokeServer('SetProperty', {Value = 0, Property = 'Transparency', Object = head})
end
return
end
local found_mesh = false
local cloud_remote = cloud:WaitForChild('ServerControl')
local head_part = lplayer.Character.Humanoid:FindFirstChildOfClass('Part')
local part_mesh = part:FindFirstChildOfClass('SpecialMesh')
if part_mesh or part:IsA('MeshPart') then
found_mesh = true
for i, v in pairs(head_part:GetChildren()) do
if v.ClassName ~= 'SpecialMesh' then
v:Destroy()
end
end
else
head_part:ClearAllChildren()
end
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = true, Property = 'Anchored', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.CanCollide, Property = 'CanCollide', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.Velocity, Property = 'Velocity', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.RotVelocity, Property = 'RotVelocity', Object = head_part}) end)
spawn(function()
if part.ClassName ~= 'MeshPart' then
cloud_remote:InvokeServer('SetProperty', {Value = part.Shape, Property = 'Shape', Object = head_part})
end
end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.Color, Property = 'Color', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.CFrame, Property = 'CFrame', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.Size, Property = 'Size', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.Material, Property = 'Material', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.BackSurface, Property = 'BackSurface', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.BottomSurface, Property = 'BottomSurface', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.FrontSurface, Property = 'FrontSurface', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.LeftSurface, Property = 'BackSurface', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.RightSurface, Property = 'BackSurface', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.TopSurface, Property = 'TopSurface', Object = head_part}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = current_transpareny, Property = 'Transparency', Object = head_part}) end)
if found_mesh == true and part.ClassName ~= 'MeshPart' then
warn('mesh found, proceeding to modifying the mesh.')
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part_mesh.MeshId, Property = 'MeshId', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part_mesh.TextureId, Property = 'TextureId', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part_mesh.Scale, Property = 'Scale', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part_mesh.VertexColor, Property = 'VertexColor', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part_mesh.Offset, Property = 'Offset', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part_mesh.MeshType, Property = 'MeshType', Object = head_part.Mesh}) end)
elseif part:IsA('MeshPart') then
warn('meshpart found, modying the meshpart.')
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.MeshId, Property = 'MeshId', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = part.TextureID, Property = 'TextureId', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = Vector3.new(4, 4, 4), Property = 'Scale', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = Color3.fromRGB(1, 1, 1), Property = 'VertexColor', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = Vector3.new(0, 0, 0), Property = 'Offset', Object = head_part.Mesh}) end)
spawn(function() cloud_remote:InvokeServer('SetProperty', {Value = Enum.MeshType.FileMesh, Property = 'MeshType', Object = head_part.Mesh}) end)
end
cloud_remote:InvokeServer('SetProperty', {Value = part.Name, Property = 'Name', Object = head_part})
cloud_remote:InvokeServer('SetProperty', {Value = model, Property = 'Parent', Object = head_part})
-- cloud_remote:InvokeServer('Fly', {['Flying'] = false})
end
getgenv().move = nil
getgenv().move = mouse.Move:Connect(function()
if clicked == false then
if isa_part == true then
old_model.Position = mouse.Hit.p
return
end
old_model:MoveTo(mouse.Hit.p)
end
end)
mouse.Button1Up:Connect(function()
if clicked == true then
return
end
clicked = true
getgenv().building = true
local safety_count = 0
if getgenv().move ~= nil then
getgenv().move:Disconnect()
getgenv().move = nil
end
for i, v in pairs(old_model:GetDescendants()) do
if v:IsA('BasePart') then
v.Anchored = true
v.Transparency = .3
end
end
for i, v in ipairs(old_model:GetDescendants()) do
if getgenv().building == false then
break
end
if v:IsA('Part') or v:IsA('Humanoid') then
build(v)
text.Text = string.format('%s/%s', i, count)
end
end
old_model:Destroy()
getgenv().building = false
text.Text = 'Build Completed.'
local tween = game:GetService('TweenService'):Create(text, TweenInfo.new(.25), {TextColor3 = Color3.fromRGB(0, 255, 0)})
tween:Play()
tween.Completed:Connect(function()
wait(.5)
gui:Destroy()
end)
end)
lplayer.Chatted:Connect(function(msg)
if msg == getgenv().stop_command then
getgenv().building = false
end
end)
uis.InputBegan:Connect(function(key, gameProcessed)
if gameProcessed then
return -- player is typing in a textbox / chatting
end
if key.KeyCode == Enum.KeyCode.R and clicked == false then
if old_model ~= nil then
old_model:SetPrimaryPartCFrame(old_model:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(90), 0))
end
elseif key.KeyCode == Enum.KeyCode.T and clicked == false then
if old_model ~= nil then
old_model:SetPrimaryPartCFrame(old_model:GetPrimaryPartCFrame() * CFrame.Angles(math.rad(90), 0, 0))
end
elseif key.KeyCode == Enum.KeyCode.Y and clicked == false then
if old_model ~= nil then
old_model:SetPrimaryPartCFrame(old_model:GetPrimaryPartCFrame() * CFrame.Angles(0, 0, math.rad(90)))
end
end
end)
|
-- Admin Open Player Inventory Soft Module
-- Displays a table of all players with and button to open their inventory
-- Uses locale __modulename__.cfg
-- @usage require('modules/dddgamer/admin/admin-open-player-inventory')
-- ------------------------------------------------------- --
-- @author Denis Zholob (DDDGamer)
-- github: https://github.com/deniszholob/factorio-softmod-pack
-- ======================================================= --
-- Dependencies --
-- ======================================================= --
local mod_gui = require("mod-gui") -- From `Factorio\data\core\lualib`
local GUI = require("stdlib/GUI")
local Colors = require("util/Colors")
local Sprites = require("util/Sprites")
local Position = require("stdlib/area/position")
local find_patch = require('addons/find_patch')
local tools = require("addons/tools")
-- Constants --
-- ======================================================= --
local MENU_BTN_NAME = 'btn_menu_admin_menu'
local MASTER_FRAME_NAME = 'frame_admin_menu'
local LABEL_FIND_ORE = 'label_find_ore'
local LABEL_MAKE = 'label_make'
local BTN_FIND_IRON = 'btn_find_iron'
local BTN_FIND_COPPER = 'btn_find_copper'
local BTN_FIND_STONE = 'btn_find_stone'
local BTN_FIND_COAL = 'btn_find_coal'
local BTN_FIND_URANIUM = 'btn_find_uranium'
local BTN_FIND_OIL = 'btn_find_oil'
local BTN_MAKE_BELT_IN = 'btn_make_belt_in'
local BTN_MAKE_BELT_OUT = 'btn_make_belt_out'
local BTN_MAKE_LINK = 'btn_make_link'
local OWNER = 'hidden_relic'
local OWNER_ONLY = true
local SPRITE_NAMES = {
menu = Sprites.laser_turret,
find_iron = Sprites.iron_ore,
find_copper = Sprites.copper_ore,
find_stone = Sprites.stone,
find_coal = Sprites.coal,
find_uranium = Sprites.uranium_ore,
find_oil = Sprites.crude_oil,
make_belt = Sprites.linked_belt,
make_link = Sprites.fluid_indication_arrow_both_ways
}
local range = 1000
local admin_menu = {}
-- Local Functions --
-- ======================================================= --
-- Event Functions --
-- ======================================================= --
-- When new player joins add a btn to their button_flow
-- Redraw this softmod's frame
-- Only happens for admins/owner depending on OWNER_ONLY flag
-- @param event on_player_joined_game
function admin_menu.on_player_joined(event)
local player = game.players[event.player_index]
if (OWNER_ONLY) then
if (player.name == OWNER) then
draw_menu_btn(player)
draw_master_frame(player)
GUI.toggle_element(mod_gui.get_frame_flow(player)[MASTER_FRAME_NAME])
end
elseif (player.admin == true) then
draw_menu_btn(player)
draw_master_frame(player)
end
end
-- When a player leaves clean up their GUI in case this mod gets removed next time
-- @param event on_player_left_game
function admin_menu.on_player_left_game(event)
local player = game.players[event.player_index]
GUI.destroy_element(mod_gui.get_button_flow(player)[MENU_BTN_NAME])
GUI.destroy_element(mod_gui.get_frame_flow(player)[MASTER_FRAME_NAME])
end
-- Toggle playerlist is called if gui element is playerlist button
-- @param event on_gui_click
function admin_menu.on_gui_click(event)
local player = game.players[event.player_index]
local el_name = event.element.name
-- Window toggle
if el_name == MENU_BTN_NAME then
GUI.toggle_element(mod_gui.get_frame_flow(player)[MASTER_FRAME_NAME])
end
if (el_name == BTN_FIND_IRON) then
find_patch.findPatch("iron-ore", range, player)
end
if (el_name == BTN_FIND_COPPER) then
find_patch.findPatch("copper-ore", range, player)
end
if (el_name == BTN_FIND_STONE) then
find_patch.findPatch("stone", range, player)
end
if (el_name == BTN_FIND_COAL) then
find_patch.findPatch("coal", range, player)
end
if (el_name == BTN_FIND_URANIUM) then
find_patch.findPatch("uranium-ore", range, player)
end
if (el_name == BTN_FIND_OIL) then
find_patch.findPatch("crude-oil", range, player)
end
if (el_name == BTN_MAKE_BELT_IN) then tools.make(player, "belt", "in") end
if (el_name == BTN_MAKE_BELT_OUT) then tools.make(player, "belt", "out") end
if (el_name == BTN_MAKE_LINK) then tools.make(player, "link") end
end
-- Event Registration --
-- ======================================================= --
Event.register(defines.events.on_player_joined_game, admin_menu.on_player_joined)
Event.register(defines.events.on_player_left_game,
admin_menu.on_player_left_game)
Event.register(defines.events.on_gui_click, admin_menu.on_gui_click)
-- Helper Functions --
-- ======================================================= --
--
-- @param player LuaPlayer
function admin_menu.draw_menu_btn(player)
if mod_gui.get_button_flow(player)[MENU_BTN_NAME] == nil then
mod_gui.get_button_flow(player).add({
type = "sprite-button",
name = MENU_BTN_NAME,
sprite = SPRITE_NAMES.menu,
tooltip = "Admin Tools"
})
end
end
--
-- @param player LuaPlayer
function admin_menu.draw_master_frame(player)
local master_frame = mod_gui.get_frame_flow(player)[MASTER_FRAME_NAME]
-- Draw the vertical frame on the left if its not drawn already
if master_frame == nil then
master_frame = mod_gui.get_frame_flow(player).add({
type = 'frame',
name = MASTER_FRAME_NAME,
direction = 'vertical'
})
end
-- Clear and repopulate player list
GUI.clear_element(master_frame)
-- Flow
local flow_header = master_frame.add({
type = 'flow',
direction = 'horizontal'
})
flow_header.style.horizontal_spacing = 20
-- Draw Header text
flow_header.add({
type = 'label',
name = LABEL_FIND_ORE,
caption = {'admin_panel.find_ore_header_caption'}
-- tooltip = {'player_list.checkbox_tooltip'},
-- state = Player_List.getConfig(player).show_offline_players or false
})
-- Add scrollable section to content frame
local find_ore_button_flow = master_frame.add({
type = 'flow',
direction = 'vertical'
})
local find_ore_button_group_1 = find_ore_button_flow.add({
type = 'flow',
direction = 'horizontal'
})
local find_iron_ore_btn = find_ore_button_group_1.add({
type = "sprite-button",
name = BTN_FIND_IRON,
sprite = SPRITE_NAMES.find_iron,
tooltip = {'admin_panel.find_iron_tooltip'}
})
local find_copper_ore_btn = find_ore_button_group_1.add({
type = "sprite-button",
name = BTN_FIND_COPPER,
sprite = SPRITE_NAMES.find_copper,
tooltip = {'admin_panel.find_copper_tooltip'}
})
local find_stone_btn = find_ore_button_group_1.add({
type = "sprite-button",
name = BTN_FIND_STONE,
sprite = SPRITE_NAMES.find_stone,
tooltip = {'admin_panel.find_stone_tooltip'}
})
local find_ore_button_group_2 = find_ore_button_flow.add({
type = 'flow',
direction = 'horizontal'
})
local find_coal_btn = find_ore_button_group_2.add({
type = "sprite-button",
name = BTN_FIND_COAL,
sprite = SPRITE_NAMES.find_coal,
tooltip = {'admin_panel.find_coal_tooltip'}
})
local find_uranium_ore_btn = find_ore_button_group_2.add({
type = "sprite-button",
name = BTN_FIND_URANIUM,
sprite = SPRITE_NAMES.find_uranium,
tooltip = {'admin_panel.find_uranium_tooltip'}
})
local find_oil_btn = find_ore_button_group_2.add({
type = "sprite-button",
name = BTN_FIND_OIL,
sprite = SPRITE_NAMES.find_oil,
tooltip = {'admin_panel.find_oil_tooltip'}
})
local flow_header2 = master_frame.add({
type = 'flow',
direction = 'horizontal'
})
flow_header2.style.horizontal_spacing = 20
-- Draw Header text
flow_header2.add({
type = 'label',
name = LABEL_MAKE,
caption = {'admin_panel.make_header_caption'}
-- tooltip = {'player_list.checkbox_tooltip'},
-- state = Player_List.getConfig(player).show_offline_players or false
})
-- Add scrollable section to content frame
local make_button_flow = master_frame.add({
type = 'flow',
direction = 'vertical'
})
local make_button_group_1 = make_button_flow.add({
type = 'flow',
direction = 'horizontal'
})
local make_belt_in_btn = make_button_group_1.add({
type = "sprite-button",
name = BTN_MAKE_BELT_IN,
sprite = SPRITE_NAMES.make_belt,
tooltip = {'admin_panel.make_belt_in_tooltip'}
})
local make_belt_out_btn = make_button_group_1.add({
type = "sprite-button",
name = BTN_MAKE_BELT_OUT,
sprite = SPRITE_NAMES.make_belt,
tooltip = {'admin_panel.make_belt_out_tooltip'}
})
local make_link_btn = make_button_group_1.add({
type = "sprite-button",
name = BTN_MAKE_LINK,
sprite = SPRITE_NAMES.make_link,
tooltip = {'admin_panel.make_link_tooltip'}
})
end
--
function function_name() end
--
function function_name() end
--
function function_name() end
|
local function QuickNPC(Name, PrintName, SpawnName, Race, Distance, Model)
local NPC = {}
NPC.Name = Name
NPC.PrintName = PrintName
NPC.SpawnName = SpawnName
NPC.Race = Race
NPC.DistanceRetreat = Distance
NPC.Model = Model
return NPC
end
local function AddBool(Table, IsFrozen, IsInvincible, IsIdle)
Table.Frozen = IsFrozen
Table.Invincible = IsInvincible
Table.Idle = IsIdle
return Table
end
local function AddMultiplier(Table, Health, Damage)
Table.HealthPerLevel = Health
Table.DamagePerLevel = Damage
return Table
end
local function AddDrop(Table, Name, Chance, Min, Max,strDefaultChance)
Table.Drops = Table.Drops or {}
Table.Drops[Name] = {Chance = Chance, Min = Min, Max = Max}
return Table
end
local NPC = QuickNPC("rebel_smg", "Rebel Guard", "npc_combine_s", "human", 50, "models/Humans/Group03/Male_02.mdl")
NPC = AddBool(NPC, false, true, false)
NPC = AddMultiplier(NPC, 100, 7)
NPC.Weapon = "weapon_smg1"
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("human_turret(f)", "Human Turret(Floor)", "npc_turret_floor", "human")
NPC = AddMultiplier(NPC, 20, 3)
NPC = AddBool(NPC, true, false, false)
NPC.Accuracy = WEAPON_PROFICIENCY_POOR
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("shop_general", "Jay", "npc_eli", "human")
NPC = AddBool(NPC, false, true, true)
NPC.Shop = "shop_general"
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("shop_ranged", "Becky", "npc_breen", "human", nil, "models/Humans/Group03/Female_06.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Shop = "shop_ranged"
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("shop_melee", "Patrick", "npc_breen", "human", nil, "models/Humans/Group03/Male_05.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Shop = "shop_melee"
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("shop_armor", "Crystal", "npc_breen", "human", nil, "models/Humans/Group03/Female_04.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Shop = "shop_armor"
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("bank_npc", "Egmont", "npc_citizen", "human", nil, "models/Humans/Group03/Male_01.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Bank = true
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("appearance_npc", "Faith", "npc_breen", "human", nil, "models/alyx.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Appearance = true
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("npc_auctionhouse", "Camron", "npc_citizen", "human", nil, "models/Humans/Group03/Male_05.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Auction = true
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("shop_books", "Richard", "npc_citizen", "human", nil, "models/Humans/Group03/Male_02.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Shop = "shop_books"
NPC.Deathdistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("quest_Odessa", "Odessa", "npc_breen", "human", nil, "models/odessa.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Quest = {"quest_killantlionboss"}
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("quest_Adam", "Adam", "npc_breen", "human", nil, "models/Humans/Group03/Male_02.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Quest = {"quest_killzombies", "quest_monkeybusiness", "quest_killantlion",
"quest_zombieblood", "quest_beer", "quest_killelite", "quest_killzombine",
"quest_cooking"}
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("quest_kleiner", "Dr. Kleiner", "npc_kleiner", "human")
NPC = AddBool(NPC, false, true, true)
NPC.Quest = {"quest_killcombinethumper", "quest_arsenalupgrade", "quest_killcombine",
"quest_toolwrench", "quest_revolver", "quest_armorupgrade","quest_missionthors",
"quest_fortification","quest_oil", "quest_crafting",}
NPC.DeathDistance = 14
Register.NPC(NPC)
local NPC = QuickNPC("quest_charple", "Some Burnt Guy", "npc_citizen", "human", nil, "models/player/charple.mdl")
NPC = AddBool(NPC, false, true, true)
NPC.Quest = { "quest_cquest1", "quest_cquest2", "quest_detergentq"}
NPC.Deathdistance = 14
Register.NPC(NPC)
|
-- =======================================================================
-- ======================== EXTRA FUNCTIONALITY ==========================
-- =======================================================================
-- ============================ Admin Tools ==============================
-- =======================================================================
FSACExtrasAdminTools = {}
FSACExtrasAdminTools.on_click_handler = function(event, superadmin)
if event.element.name == "ex_at_demote_all" then
for _, player in pairs(game.players) do
player.admin = false
end
elseif event.element.name == "ex_at_promote_all" then
for _, player in pairs(game.players) do
player.admin = true
end
elseif event.element.name == "ex_at_promote" then
if game.players[superadmin.extras.admin_tools.player_name] ~= nil then
game.players[superadmin.extras.admin_tools.player_name].admin = true
end
elseif event.element.name == "ex_at_demote" then
if game.players[superadmin.extras.admin_tools.player_name] ~= nil then
game.players[superadmin.extras.admin_tools.player_name].admin = false
end
elseif event.element.name == "ex_at_supress" then
if global.exat_console_suppressed == nil then
global.exat_console_suppressed = false
end
if global.exat_console_suppressed == false then
global.exat_console_suppressed = true
event.element.caption = "Stop Supression"
game.permissions.create_group("extras_admin_tools_supress_group")
for _, permission_group in ipairs(game.permissions.groups) do
permission_group.set_allows_action(defines.input_action.write_to_console, false)
end
for _, player in pairs(game.players) do
if player.permission_group == nil then
player.permission_group = game.permissions.get_group("extras_admin_tools_supress_group")
end
end
global.exat_permission_groups = {}
for _, admin in ipairs(FSACSuperAdminManager.get_all()) do
global.exat_permission_groups[admin.name] = admin:get_player().permission_group
admin:get_player().permission_group = nil
end
else
global.exat_console_suppressed = false
event.element.caption = "Start Supression"
for _, permission_group in ipairs(game.permissions.groups) do
permission_group.set_allows_action(defines.input_action.write_to_console, true)
end
for _, player in pairs(game.players) do
if player.permission_group ~= nil then
if player.permission_group.name == "extras_admin_tools_supress_group" then
player.permission_group = nil
end
end
end
game.permissions.get_group("extras_admin_tools_supress_group").destroy()
for _, admin in ipairs(FSACSuperAdminManager.get_all()) do
if global.exat_permission_groups[admin.name] ~= nil then
admin:get_player().permission_group = global.exat_permission_groups[admin.name]
end
end
end
elseif event.element.name == "ex_at_kill_all_p" then
for _, player in pairs(game.players) do
if not FSACSuperAdminManager.is_superadmin(player.name) then
if player.character ~= nil then
player.character.die(player.force)
end
end
end
elseif event.element.name == "ex_at_res_all_p" then
for _, player in pairs(game.players) do
if player.character == nil then
player.ticks_to_respawn = 1
end
end
elseif event.element.name == "ex_at_kill_all_e" then
local admin_player = superadmin:get_player()
local surface = admin_player.surface
local x = admin_player.position.x
local y = admin_player.position.y
for key, entity in pairs(surface.find_entities_filtered({area = {{x - 25, y - 25}, {x + 25, y + 25}}, force="enemy"})) do
entity.destroy()
end
elseif event.element.name == "ex_at_super_promote" then
if game.players[superadmin.extras.admin_tools.superadmin_name] ~= nil then
FSACSuperAdminManager.promote(superadmin.extras.admin_tools.superadmin_name)
end
elseif event.element.name == "ex_at_super_demote" then
if game.players[superadmin.extras.admin_tools.superadmin_name] ~= nil then
if superadmin.extras.admin_tools.superadmin_name ~= global.player_name then
local is_admin, index = FSACSuperAdminManager.is_superadmin(superadmin.extras.admin_tools.superadmin_name)
if is_admin then
FSACSuperAdminManager.demote(superadmin.extras.admin_tools.superadmin_name)
end
else
FSACSuperAdminManager.print("Cannot demote core SuperAdmin", superadmin.name)
end
end
end
end
FSACExtrasAdminTools.on_select_handler = function(event, superadmin)
if event.element.name == "ex_at_dropdown" then
superadmin.extras.admin_tools.player_name = event.element.items[event.element.selected_index]
elseif event.element.name == "ex_at_dropdown_super" then
superadmin.extras.admin_tools.superadmin_name = event.element.items[event.element.selected_index]
end
end
-- =======================================================================
-- ============================= GUI SCRIPT ==============================
-- =======================================================================
FSACExtrasAdminTools.draw = function(frame, superadmin)
if superadmin.extras.admin_tools == nil then
superadmin.extras.admin_tools = {}
end
frame.add{type = "flow", name="ex_at_flow_1", direction="horizontal"}
KMinimalistStyling.apply_style(frame.ex_at_flow_1, "fsac_extra_flow", { top_margin = 10})
frame.ex_at_flow_1.add{type = "label", name="ex_at_all_label", caption = "[font=default-semibold]Operations on all players:[/font]"}
KMinimalistStyling.apply_style(frame.ex_at_flow_1.ex_at_all_label, "fsac_extra_label", { width_f = 454 })
frame.ex_at_flow_1.add{type = "button", name="ex_at_demote_all", caption = "Demote everyone", mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style(frame.ex_at_flow_1.ex_at_demote_all, "fsac_extra_btn")
frame.ex_at_flow_1.add{type = "button", name="ex_at_promote_all", caption = "Promote everyone", mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style(frame.ex_at_flow_1.ex_at_promote_all, "fsac_extra_btn")
frame.add{type = "flow", name="ex_at_flow_2", direction="horizontal"}
KMinimalistStyling.apply_style(frame.ex_at_flow_2, "fsac_extra_flow")
frame.ex_at_flow_2.add{type = "label", name="ex_at_label", caption = "[font=default-semibold]Individual operations: [/font]"}
KMinimalistStyling.apply_style(frame.ex_at_flow_2.ex_at_label, "fsac_extra_label", { width_f = 246 })
local players_names = FSACMainScript.get_player_names()
frame.ex_at_flow_2.add{type = "drop-down", name = "ex_at_dropdown", selected_index = 1, items = players_names}
KMinimalistStyling.apply_style(frame.ex_at_flow_2.ex_at_dropdown, "fsac_extra_drdwn")
superadmin.extras.admin_tools.player_name = players_names[1]
frame.ex_at_flow_2.add{type = "button", name="ex_at_promote", caption = "Promote player", mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style(frame.ex_at_flow_2.ex_at_promote, "fsac_extra_btn")
frame.ex_at_flow_2.add{type = "button", name="ex_at_demote", caption = "Demote player", mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style(frame.ex_at_flow_2.ex_at_demote, "fsac_extra_btn")
frame.add{type = "flow", name="ex_at_flow_3", direction="horizontal"}
KMinimalistStyling.apply_style(frame.ex_at_flow_3, "fsac_extra_flow")
frame.ex_at_flow_3.add{type = "label", name="ex_at_label", caption = "[font=default-semibold]Console (and chat) suppression: [/font]"}
KMinimalistStyling.apply_style(frame.ex_at_flow_3.ex_at_label, "fsac_extra_label", { width_f = 597 })
local supr_caption = "Start Supression"
if global.exat_console_suppressed == true then
supr_caption = "Stop Supression"
end
frame.ex_at_flow_3.add{type = "button", name = "ex_at_supress", caption = supr_caption, mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style( frame.ex_at_flow_3.ex_at_supress, "fsac_extra_btn")
frame.add{type = "flow", name="ex_at_flow_4", direction="horizontal"}
KMinimalistStyling.apply_style(frame.ex_at_flow_4, "fsac_extra_flow", { top_margin = 30 })
frame.ex_at_flow_4.add{type = "label", name="ex_at_label", caption = "[font=default-semibold][color=255,190,75]All player manipulation:[/color][/font]"}
KMinimalistStyling.apply_style(frame.ex_at_flow_4.ex_at_label, "fsac_extra_label", { width_f = 311 })
frame.ex_at_flow_4.add{type = "button", name = "ex_at_kill_all_p", caption = "Kill All Players", mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style(frame.ex_at_flow_4.ex_at_kill_all_p, "fsac_extra_btn")
frame.ex_at_flow_4.add{type = "button", name = "ex_at_res_all_p", caption = "Res All Players", mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style(frame.ex_at_flow_4.ex_at_res_all_p, "fsac_extra_btn")
frame.ex_at_flow_4.add{type = "button", name = "ex_at_kill_all_e", caption = "Kill Nearby Enemies", mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style(frame.ex_at_flow_4.ex_at_kill_all_e, "fsac_extra_btn")
frame.add{type = "flow", name="ex_at_flow_5", direction="horizontal"}
KMinimalistStyling.apply_style(frame.ex_at_flow_5, "fsac_extra_flow", { bottom_margin = 10 })
frame.ex_at_flow_5.add{type = "label", name="ex_at_label", caption = "[font=default-semibold][color=255,115,75]SuperAdmin manipulation[/color][/font]"}
KMinimalistStyling.apply_style(frame.ex_at_flow_5.ex_at_label, "fsac_extra_label", { width_f = 246 })
local players_names = FSACMainScript.get_player_names()
frame.ex_at_flow_5.add{type = "drop-down", name = "ex_at_dropdown_super", selected_index = 1, items = players_names}
KMinimalistStyling.apply_style(frame.ex_at_flow_5.ex_at_dropdown_super, "fsac_extra_drdwn")
superadmin.extras.admin_tools.superadmin_name = players_names[1]
frame.ex_at_flow_5.add{type = "button", name="ex_at_super_promote", caption = "Promote player", mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style(frame.ex_at_flow_5.ex_at_super_promote, "fsac_extra_btn")
frame.ex_at_flow_5.add{type = "button", name="ex_at_super_demote", caption = "Demote player", mouse_button_filter = {"left"}}
KMinimalistStyling.apply_style(frame.ex_at_flow_5.ex_at_super_demote, "fsac_extra_btn")
end
-- =======================================================================
-- ============================ REGISTRATION =============================
-- =======================================================================
FSACExtra.static_register(
"admin_tools",
"Admin Tools",
FSACExtrasAdminTools.draw,
{
on_click = FSACExtrasAdminTools.on_click_handler,
on_selected = FSACExtrasAdminTools.on_select_handler
}
) |
return {'chileen','chileens','chili','china','chinees','chinese','chinezen','chiro','chirojeugd','chirojongen','chiromeisje','chianti','chiasma','chiasme','chic','chicane','chicaneren','chicaneur','chick','chicst','chiffon','chiffonniere','chignon','chihuahua','chijl','chikwadraattoets','chili','chiliasme','chilipeper','chilipoeder','chilisalpeter','chilisaus','chillen','chimaera','chimp','chimpansee','chimere','chinaklei','chinchilla','chinees','chinezen','chinoiserie','chinook','chintz','chip','chipcard','chipfabriek','chipfabrikant','chipgigant','chipindustrie','chipkaart','chipknip','chipmachinefabrikant','chipmachinemaker','chipmarkt','chipolata','chipolatapudding','chipper','chipproducent','chipproductie','chips','chipsector','chipset','chipsfabriek','chipsfabrikant','chipsindustrie','chiptechnologie','chipverpakker','chique','chiquer','chirograaf','chirologie','chiromantie','chiropodist','chiropracticus','chiropraxie','chirurg','chirurgie','chirurgijn','chirurgisch','chimerisch','chipsmarkt','chippen','chiropractor','chineesrestaurantsyndroom','chiinau','chinezenbuurt','chisinau','chirac','chiquita','chi','chiara','chico','chiel','chimene','ching','chinook','chiu','chiang','chirino','chileense','chilenen','chirojongens','chicaneerde','chicaneert','chicanes','chicaneurs','chicste','chiefs','chiffonnieres','chignons','chihuahuas','chilipepers','chimpansees','chimpanseetje','chimpanseetjes','chimeres','chinchillas','chineesde','chineest','chipmachines','chipolatas','chiquere','chirurgen','chirurgische','chipknips','chipknippen','chipkaartje','chicks','chimps','chipcards','chipkaarten','chipolatapuddingen','chirurgijns','chiromeisjes','chinoiserieen','chirografen','chikwadraattoetsen','chimaeras','chimerische','chinoiseries','chinooks','chiropodisten','chirurgieen','chinas','chipje','chis','chiaras','chicos','chiels','chimenes','chings','chinooks','chipjes','chipsfabrikanten','chipsets'} |
--[[
author: jie123108@163.com
date: 20151120
comment: create collection index。
]]
local mongo_dao = require("resty.stats.mongo_dao")
local util = require("resty.stats.util")
local t_ordered = require("resty.stats.orderedtable")
local _M = {}
-- created indexes
_M.exist_indexes = {}
-- create index if not exist!
function _M.create_coll_index(mongo_cfg, collection, index_keys, index_options)
if _M.exist_indexes[collection] then
return true, "idx-exist"
end
local dao = mongo_dao:new(mongo_cfg, collection)
local ok, err = nil
local keys = t_ordered({})
for _, key in ipairs(index_keys) do
keys[key] = 1
end
local options = {unique=true}
if index_options then
for k, v in pairs(index_options) do
options[k] = v
end
end
ok, err, idx_name = dao:ensure_index(keys,options)
if ok then
ngx.log(ngx.INFO, "create index [",tostring(idx_name), "] for [", collection, "] success! ")
else
local err = tostring(err)
if(string.find(err, "already exists")) then
ok = true
end
ngx.log(ngx.ERR, "create index [",tostring(idx_name), "] for [", collection, "] failed! err:", err)
end
-- dao:uninit()
if ok then
_M.exist_indexes[collection] = true
return ok , "OK"
else
return ok, err
end
end
return _M |
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
--[[
ALL CREDIT FOR wav.lua GOES TO THE ORIGINAL CREATOR (their name is at the top of that file!)
HOW TO USE:
Put this lua and the wav.lua into the same folder as the .wav file you want to convert to a table
Modify the below variables to your liking
Run this lua file (I did it in command line with `lua wav_to_table.lua`)
The output will be a table of tables. Each 1D table will look like the following:
{timestamp (ms), frequency_1, frequency_2, ... , frequency_[output_count]}
]]--
local wav_file_name = "hold you back.wav" -- the name of the wav file
local output_count = 200 -- the number of frequencies you want per unit of time (i.e. i made this for an audio visualizer: 40 means i would be able to make a visualizer with 40 bars)
local trim_before = 100 -- these two variables are for if you want to cut off some bars from the low or high ends of the table
local trim_after = 10 -- Example: output_count = 50, trim_before = 15, trim_after = 5, there will be 30 values from what would have been value 15 to 45
local samples_per_second = 20 -- the number of samples per second (duh)
local bias = 1.1 -- this value changes how logarithmic the scale is. between 1.05 and 1.2 is probably ideal, but you start getting repeated samples at values greater than 1.15-ish. 1 is linear.
local output_file = "output.lua" -- the output of the program. will just be a table.
local omit_repeats = true -- this will get rid of repeated values. however, it'll make it so that the number of outputs is not what you put in above. also it'll make trimming weird.
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
function map(input, i1, i2, o1, o2)
slope = (o2 - o1) / (i2 - i1)
return o1 + slope * (input - i1)
end
dofile("wav.lua")
-- Read audio file
local reader = wav.create_context(wav_file_name, "r")
--[[
print("Filename: " .. reader.get_filename())
print("Mode: " .. reader.get_mode())
print("File size: " .. reader.get_file_size())
print("Channels: " .. reader.get_channels_number())
print("Sample rate: " .. reader.get_sample_rate())
print("Byte rate: " .. reader.get_byte_rate())
print("Block align: " .. reader.get_block_align())
print("Bitdepth: " .. reader.get_bits_per_sample())
print("Samples per channel: " .. reader.get_samples_per_channel())
print("Sample at 500ms: " .. reader.get_sample_from_ms(500))
print("Milliseconds from 3rd sample: " .. reader.get_ms_from_sample(3))
print(string.format("Min- & maximal amplitude: %d <-> %d", reader.get_min_max_amplitude()))
reader.set_position(256)
print("Sample 256, channel 2: " .. reader.get_samples(1)[2][1])
]]
-- all the above stuff and some of the below stuff is from the base test.lua file that came with the wav.lua, I'm keeping it for documentation's sake
-- get song length:
local song_length_ms = (reader.get_samples_per_channel() / reader.get_sample_rate()) * 1000
print("Song length (ms): " .. song_length_ms)
local ms_spacing = 1000/samples_per_second
local output = io.open(output_file, "w")
io.output(output)
io.write("{")
for ms=0, song_length_ms - ms_spacing, ms_spacing do
if math.floor(ms) < reader.get_samples_per_channel() then
io.write(string.format("{%.4f,", ms/1000))
reader.set_position(math.floor(reader.get_sample_from_ms(math.floor(ms)))) -- double math.floor because thanks wav
local samples = reader.get_samples(16384)[1] -- if you're using a low bias value (1.1 or less) feel free to lower this number to like 1024 to make things faster
for i=1, samples.n do
samples[i] = samples[i] / 32768
end
local analyzer = wav.create_frequency_analyzer(samples, reader.get_sample_rate())
local frequencies = analyzer.get_frequencies()
local num_frequencies = #frequencies
for i=trim_before + 1, output_count - trim_after do
-- map this value from 0, output_count to 0, num_frequencies
local freqnum = math.floor(map(bias^i, 1, bias^output_count, 1, num_frequencies+1))
if ((omit_repeats and freqnum ~= math.floor(map(bias^(i+1), 1, bias^output_count, 1, num_frequencies+1))) or not omit_repeats) and frequencies[freqnum] then
--print(i .. ' ' .. freqnum .. ' ' .. frequencies[freqnum].freq)
io.write(string.format("%.4f,", (frequencies[freqnum].weight)))
end
end
--[[
local splice = math.log(num_frequencies) / (output_count-1)
for i, frequency in ipairs(analyzer.get_frequencies()) do
if i/splice >= trim_before and i/splice <= (output_count-trim_after) and i % splice <= 1 then
io.write(string.format("%.4f,", frequency.weight))
--print(string.format("%.2f: %f", frequency.freq, frequency.weight))
end
end
]]
io.write("},\n")
print(string.format("%.2f", 100*ms/song_length_ms).."% done")
end
end
io.write("}")
io.close(output)
print("Output to " .. output_file) |
local app = require "app"
--/ import
local ngx = require("ngx")
local app_helpers = require("lapis.application")
local respond_to = require("lapis.application").respond_to
local json_params = require("lapis.application").json_params
local jwt = require ("resty.jwt")
local Model = require("lapis.db.model").Model
--\ import
local capture_errors, capture_errors_json, yield_error, assert_error = app_helpers.capture_errors, app_helpers.capture_errors_json, app_helpers.yield_error, app_helpers.assert_error
local Threads = Model:extend("threads", {
timestamp = true,
relations = {
{"created_by", belongs_to = "users", key = "uuid"}
}
})
local Users = Model:extend("users", { primary_key = "uuid" })
app:match("threads", "/threads(/:id[%d])", respond_to({
GET = capture_errors_json(json_params(function(self)
local id = self.params.id or false
if id == false then
local threads = Threads:select()
return app:jsonResponse(ngx.HTTP_OK, threads)
else
local thread = Threads:find(id)
if thread == nil then
return app:jsonResponse(ngx.HTTP_NOT_FOUND, "No thread found with id " .. id)
end
return app:jsonResponse(ngx.HTTP_OK, thread)
end
end)),
POST = capture_errors_json(json_params(function(self)
app.session:open()
local jwt_obj = jwt:load_jwt(app.session.data.jwt)
local name = self.params.name or false
local created_by = jwt_obj.payload.uuid
if name == false then
return app:jsonResponse(ngx.HTTP_BAD_REQUEST, "Missing parameter 'name'")
end
local thread = nil
local status, result = pcall(function()
thread = Threads:create({
name = name,
created_by = created_by
})
end)
if status == false or thread == nil then
return app:jsonResponse(ngx.HTTP_CONFLICT, result)
end
return app:jsonResponse(ngx.HTTP_CREATED, thread["id"])
end)),
PUT = capture_errors_json(json_params(function(self)
app.session:open()
local jwt_obj = jwt:load_jwt(app.session.data.jwt)
local id = self.params.id or false
local name = self.params.name or false
local created_by = jwt_obj.payload.uuid
if name == false then
return app:jsonResponse(ngx.HTTP_BAD_REQUEST, "Missing parameter 'name'")
end
local thread = nil
if id ~= false then
thread = Threads:find(id)
end
if thread == nil then
local status, result = pcall(function()
thread = Threads:create({
name = name,
created_by = created_by
})
end)
if status == false or thread == nil then
return app:jsonResponse(ngx.HTTP_CONFLICT, result)
end
return app:jsonResponse(ngx.HTTP_CREATED, thread["id"])
-- return 403 if the uuid of the requestee is not same as the uuid registered as a creator of the thread, user cannot change other user's threads
else
if thread["created_by"] ~= created_by then
return app:jsonResponse(ngx.HTTP_FORBIDDEN, "You don't have permission to update this thread")
end
thread:update({
name = name
})
end
return app:jsonResponse(ngx.HTTP_OK, thread["id"])
end)),
DELETE = capture_errors_json(json_params(function(self)
app.session:open()
local id = self.params.id or false
if id == false then
return app:jsonResponse(ngx.HTTP_BAD_REQUEST, "Missing parameter 'id'")
end
local thread = Threads:find(id)
if thread == nil then
return app:jsonResponse(ngx.HTTP_NOT_FOUND, "No thread found with id " .. id)
end
local jwt_obj = jwt:load_jwt(app.session.data.jwt)
if thread["created_by"] ~= jwt_obj.payload.uuid then
return app:jsonResponse(ngx.HTTP_FORBIDDEN, "You don't have permission to delete this thread")
end
local status, result = pcall(function()
thread:delete()
end)
if status == false or thread == nil then
return app:jsonResponse(ngx.HTTP_CONFLICT, result)
end
return app:jsonResponse(ngx.HTTP_OK)
end))
})) |
-- don't accumulate indentation after the expression
a =
{
}
b =
{
}
a = {
table_elt_indented
}
a = a +
5 +
10
this_should_be_unindented()
-- here foobar should be indented as simple continuation statement
a = a +
dosmth(
) +
foobar
a =
do_smth(
do_smth_arg
)
b =
{
table_elt0_indented,
table_elt1_indented
}
this_should_be_unindented_too =
{
}
this_should_be_unindented_three = etc
|
local intro = {
"In the wake of an asteroid strike, food supplies are",
"running low. Desperate to feed the colony until the new",
"hydroponics systems come online, you enter the deadly",
"asteroid Endor in search of a legendary root vegetable..."
}
local endings = {
{
food = -1,
"You died in the depths of Endor, dooming the colony to a",
"painful death."
},
{
food = 0,
"You return nearly empty-handed, helpless to stop the",
"colony's demise."
},
{
food = 300,
"Though you found the Yam of Endor, you only managed to bring",
"back a paltry %food pounds of it. So despite your desperate",
"venture, %n people died, and the rest are quite emaciated."
},
{
food = 700,
"You brought back %food pounds of the legendary Yam of Endor.",
"Though the colonists are a bit emaciated, and no-one ever wants",
"to see another sweet potato, everyone survived thanks to you."
},
{
food = 1500,
"You returned with %food pounds of the legendary Yam of Endor.",
"Though no-one ever wants to see another sweet potato, they are",
"all alive and in good health thanks to your daring and skill."
}
}
return { intro = intro, endings = endings }
|
--
-- Loads optional plugins from our config package that contain
-- platform specific support
--
local cmd = vim.cmd
local fn = vim.fn
local function setup()
if fn.has('unix') == 1 then
cmd('packadd platform-unix')
end
if fn.exists('g:vscode') == 1 then
cmd('packadd host-vscode')
else
cmd('packadd host-nvim')
end
end
return { setup = setup }
|
object_ship_jedi_starfighter_tier1 = object_ship_shared_jedi_starfighter_tier1:new {
}
ObjectTemplates:addTemplate(object_ship_jedi_starfighter_tier1, "object/ship/jedi_starfighter_tier1.iff")
|
function get_stalactite_point()
local num_stalactites = get_battle_data_size("stalactite") / 6
local num = rand(num_stalactites)
local tip_x = get_battle_data("stalactite", num*6)
local tip_y = get_battle_data("stalactite", num*6+1)
local side = rand(2)
local end_x = get_battle_data("stalactite", num*6+2+side*2)
local end_y = get_battle_data("stalactite", num*6+2+side*2+1)
local x = (tip_x - end_x) * 0.75 + end_x
local y = (tip_y - end_y) * 0.75 + end_y
return x, y
end
function set_dir(move_x, move_y)
if (move_x == 0) then
if (move_y < 0) then
set_entity_animation(id, "fly-up")
else
set_entity_animation(id, "fly-down")
end
elseif (move_y == 0) then
set_entity_animation(id, "fly")
if (move_x < 0) then
set_entity_right(id, false)
else
set_entity_right(id, true)
end
else
if (move_x < 0) then
set_entity_right(id, false)
else
set_entity_right(id, true)
end
if (move_x > move_y) then
set_entity_animation(id, "fly")
else
if (move_y < 0) then
set_entity_animation(id, "fly-up")
else
set_entity_animation(id, "fly-down")
end
end
end
end
local STEP = 25
local SITTING = 0
local GOING_IN = 1
local GOING_OUT = 2
local stage
local sit_time
local sit_start
local played_sample = false
local attacking = 0
local old_player_x
local old_player_y
function next_sit()
stage = SITTING
sit_time = (rand(1000)/1000) * 2.5 + 2.5
sit_start = get_time()
set_entity_animation(id, "battle-idle")
played_sample = false
end
function start(this_id)
id = this_id
local x, y = get_stalactite_point()
set_entity_position(id, x, y)
set_battle_entity_flying(id, true)
set_battle_entity_layer(id, 1)
local right = rand(2)
if (right == 1) then
set_entity_right(id, true)
else
set_entity_right(id, false)
end
set_hp(id, 1)
set_battle_entity_attack(id, 5)
load_sample("sfx/flap.ogg", false)
load_sample("sfx/magic_drain.ogg", false)
next_sit()
end
function get_attack_sound()
return ""
end
function decide()
if (stage == SITTING) then
local now = get_time()
if (now >= sit_start+sit_time) then
stage = GOING_IN
attacking_player = ai_get(id, "A_PLAYER")
old_player_x = -1
old_player_y = -1
play_sample("sfx/flap.ogg", 1, 0, 1)
end
elseif (stage == GOING_IN) then
local x, y = get_entity_position(id)
local px, py = get_entity_position(attacking_player)
py = py - 5
local player_pos_changed
if (not (px == old_player_x) or not (py == old_player_y)) then
player_pos_changed = true
else
player_pos_changed = false
end
old_player_x = px
old_player_y = py
local dx = px - x
local dy = py - y
local dist = math.sqrt(dx*dx + dy*dy)
local burrowing = is_burrowing(attacking_player)
if (dist < 3 or burrowing) then
stage = GOING_OUT
going_to_x, going_to_y = get_stalactite_point()
set_dir(going_to_x - x, going_to_y - y)
play_sample("sfx/flap.ogg", 1, 0, 1)
set_battle_entity_attacking(id, true)
attacking = 2
else
local angle = math.atan2(dy, dx)
local s
if (STEP > dist) then
s = dist
else
s = STEP
end
local old_x = x
local old_y = y
x = x + math.cos(angle) * s
y = y + math.sin(angle) * s
set_dir(x - old_x, y - old_y)
return "direct_move " .. x .. " " .. y .. " nostop"
end
else
local x, y = get_entity_position(id)
local dx = going_to_x - x
local dy = going_to_y - y
local dist = math.sqrt(dx*dx + dy*dy)
if (dist < 3) then
set_entity_position(id, going_to_x, going_to_y)
next_sit()
else
local angle = math.atan2(dy, dx)
local s
if (STEP > dist) then
s = dist
else
s = STEP
end
x = x + math.cos(angle) * s
y = y + math.sin(angle) * s
return "direct_move " .. x .. " " .. y .. " nostop"
end
end
return "rest 0.01 nostop"
end
function get_should_auto_attack()
return false
end
function die()
if (rand(3) == 0) then
local coin = add_battle_enemy("coin1")
local x, y = get_entity_position(id)
set_entity_position(coin, x, y-5)
end
end
function stop()
destroy_sample("sfx/flap.ogg")
destroy_sample("sfx/magic_drain.ogg")
end
function logic()
if (attacking > 0) then
attacking = attacking - 1
if (attacking == 0) then
set_battle_entity_attacking(id, false)
end
end
end
function collide(with, me)
if (not played_sample) then
played_sample = true
play_sample("sfx/magic_drain.ogg", 1, 0, 1)
drain_magic(with, 5)
end
end
|
top_background_color = Color.Black
bottom_background_color = ThemeColor.White
particle_color = ThemeColor.White
local t = Def.ActorFrame {}
t[#t+1] = LoadActor(THEME:GetPathB("", "_Background"), {})
t[#t+1] = Def.Sprite {
InitCommand = function(self)
self:LoadFromCurrentSongBackground()
end,
OnCommand = function(self)
local brightness = PREFSMAN:GetPreference("BGBrightness")
self:CropTo(SCREEN_WIDTH, SCREEN_HEIGHT)
:x(SCREEN_CENTER_X)
:y(SCREEN_CENTER_Y)
:diffusealpha(0.2)
:sleep(1.5)
:linear(1)
:diffuse(Brightness(Color.Black, brightness))
:diffusealpha(1)
end
}
return t
|
-- Copyright 2004-present Facebook. All Rights Reserved.
require('fb.luaunit')
require 'cunn'
require('fbcunn')
local num_tries = 2
local jacobian = nn.Jacobian
local precision = 4e-3
local batch_max = 3
local feature_max = 100
local dim1_max = 3
local dim2_max = 3
local function pickPow()
local num = torch.random(4)
if num == 1 then
return 1
else
return (num - 1) * 2.0
end
end
local function runFPropTest(dims, width, stride, pow, batch_mode)
local pool = nn.FeatureLPPooling(width, stride, pow, batch_mode):cuda()
local num_batch = torch.random(batch_max)
local num_features = (torch.random(feature_max) - 1) * stride + width
local num_dim1 = torch.random(dim1_max)
local num_dim2 = torch.random(dim2_max)
print('test on dim ' .. dims ..
' features ' .. num_features ..
' width ' .. width .. ' stride ' .. stride ..
' p ' .. pow .. ' bm ' .. (batch_mode and 1 or 0))
local input = nil
if dims == 1 then
if batch_mode then
input = torch.FloatTensor(num_batch, num_features)
for i = 1, num_batch do
for f = 1, num_features do
input[i][f] = f - 1
end
end
else
input = torch.FloatTensor(num_features)
for f = 1, num_features do
input[f] = f - 1
end
end
elseif dims == 2 then
if batch_mode then
input = torch.FloatTensor(num_batch, num_features, num_dim1)
for i = 1, num_batch do
for f = 1, num_features do
for j = 1, num_dim1 do
input[i][f][j] = f - 1
end
end
end
else
input = torch.FloatTensor(num_features, num_dim1)
for f = 1, num_features do
for j = 1, num_dim1 do
input[f][j] = f - 1
end
end
end
elseif dims == 3 then
if batch_mode then
input = torch.FloatTensor(num_batch, num_features, num_dim1, num_dim2)
for i = 1, num_batch do
for f = 1, num_features do
for j = 1, num_dim1 do
for k = 1, num_dim2 do
input[i][f][j][k] = f - 1
end
end
end
end
else
input = torch.FloatTensor(num_features, num_dim1, num_dim2)
for f = 1, num_features do
for j = 1, num_dim1 do
for k = 1, num_dim2 do
input[f][j][k] = f - 1
end
end
end
end
end
input = input:cuda()
local output = pool:forward(input):clone():float()
-- Each output feature o(k) (k zero based) for L1 is:
-- sum(i((k - 1) * s), i((k - 1) * s + 1), ..., i((k - 1) * s + w - 1))
-- if i(x) = x, then: o(k) = w * (k - 1) * s + w * (w - 1) / 2
-- For Lp (p != 1), just evaluate ourselves and compare
local function verifyFeature(val, k, width, stride, pow)
local sum_input = 0
if pow == 1 then
sum_input = width * (k - 1) * stride + width * (width - 1) / 2
else
for w = 0, width - 1 do
sum_input = sum_input + math.pow((k - 1) * stride + w, pow)
end
sum_input = math.pow(sum_input, 1 / pow)
end
local diff = math.abs(val - sum_input)
if (diff >= 1e-3) then
print('failed on ' .. val .. ' ' .. sum_input)
assertTrue(math.abs(val - sum_input) < 1e-3)
end
end
if dims == 1 then
if batch_mode then
for i = 1, output:size(1) do
for f = 1, output:size(2) do
verifyFeature(output[i][f], f, width, stride, pow)
end
end
else
for f = 1, output:size(1) do
verifyFeature(output[f], f, width, stride, pow)
end
end
elseif dims == 2 then
if batch_mode then
for i = 1, output:size(1) do
for f = 1, output:size(2) do
for j = 1, output:size(3) do
verifyFeature(output[i][f][j], f, width, stride, pow)
end
end
end
else
for f = 1, output:size(1) do
for j = 1, output:size(2) do
verifyFeature(output[f][j], f, width, stride, pow)
end
end
end
elseif dims == 3 then
if batch_mode then
for i = 1, output:size(1) do
for f = 1, output:size(2) do
for j = 1, output:size(3) do
for k = 1, output:size(4) do
verifyFeature(output[i][f][j][k], f, width, stride, pow)
end
end
end
end
else
for f = 1, output:size(1) do
for j = 1, output:size(2) do
for k = 1, output:size(3) do
verifyFeature(output[f][j][k], f, width, stride, pow)
end
end
end
end
end
end
local function runBPropTest(dims, width, stride, pow, batch_mode)
local pool = nn.FeatureLPPooling(width, stride, pow, batch_mode):cuda()
local num_batch = torch.random(batch_max)
local num_features = (torch.random(feature_max) - 1) * stride + width
local num_dim1 = torch.random(dim1_max)
local num_dim2 = torch.random(dim2_max)
local input = nil
if dims == 1 then
if batch_mode then
input = torch.CudaTensor(num_batch, num_features)
else
input = torch.CudaTensor(num_features)
end
elseif dims == 2 then
if batch_mode then
input = torch.CudaTensor(num_batch, num_features, num_dim1)
else
input = torch.CudaTensor(num_features, num_dim1)
end
elseif dims == 3 then
if batch_mode then
input = torch.CudaTensor(num_batch, num_features, num_dim1, num_dim2)
else
input = torch.CudaTensor(num_features, num_dim1, num_dim2)
end
end
local err = jacobian.testJacobian(pool, input, -2, -2, 5e-4)
print('test on dim ' .. dims ..
' features ' .. num_features ..
' width ' .. width .. ' stride ' .. stride ..
' p ' .. pow .. ' err ' .. err)
assertTrue(err < precision)
end
function testForwardLp()
for i = 1, num_tries do
for stride = 1, 4 do
for idx, batch_mode in ipairs({true, false}) do
for dims = 1, 3 do
runFPropTest(dims, 1 + torch.random(15),
stride, pickPow(), batch_mode)
end
end
end
end
end
function testJacobian1dNoBatch()
for i = 1, num_tries do
for stride = 1, 4 do
runBPropTest(1, 1 + torch.random(15), stride, pickPow(), false)
end
end
end
function testJacobian1dBatch()
for i = 1, num_tries do
for stride = 1, 4 do
runBPropTest(1, 1 + torch.random(15), stride, pickPow(), true)
end
end
end
function testJacobian2dNoBatch()
for i = 1, num_tries do
for stride = 1, 4 do
runBPropTest(2, 1 + torch.random(15), stride, pickPow(), false)
end
end
end
function testJacobian2dBatch()
for i = 1, num_tries do
for stride = 1, 4 do
runBPropTest(2, 1 + torch.random(15), stride, pickPow(), true)
end
end
end
function testJacobian3dNoBatch()
for i = 1, num_tries do
for stride = 1, 4 do
runBPropTest(3, 1 + torch.random(15), stride, pickPow(), false)
end
end
end
function testJacobian3dBatch()
for i = 1, num_tries do
for stride = 1, 4 do
runBPropTest(3, 1 + torch.random(15), stride, pickPow(), true)
end
end
end
LuaUnit:main()
|
function eventLoop(tc, tr)
Timer.process()
end |
local matHover = Material( "vgui/spawnmenu/hover" )
local PANEL = {}
AccessorFunc( PANEL, "m_iIconSize", "IconSize" )
/*---------------------------------------------------------
Name: Paint
---------------------------------------------------------*/
function PANEL:Init()
self.Icon = vgui.Create( "ModelImage", self )
self.Icon:SetMouseInputEnabled( false )
self.Icon:SetKeyboardInputEnabled( false )
self.animPress = Derma_Anim( "Press", self, self.PressedAnim )
self:SetIconSize( 64 ) // Todo: Cookie!
end
/*---------------------------------------------------------
Name: OnMousePressed
---------------------------------------------------------*/
function PANEL:OnMousePressed( mcode )
if ( mcode == MOUSE_LEFT ) then
self:DoClick()
self.animPress:Start( 0.2 )
end
if ( mcode == MOUSE_RIGHT ) then
self:OpenMenu()
end
end
function PANEL:OnMouseReleased()
end
/*---------------------------------------------------------
Name: DoClick
---------------------------------------------------------*/
function PANEL:DoClick()
end
/*---------------------------------------------------------
Name: OpenMenu
---------------------------------------------------------*/
function PANEL:OpenMenu()
end
/*---------------------------------------------------------
Name: OnMouseReleased
---------------------------------------------------------*/
function PANEL:OnCursorEntered()
self.PaintOverOld = self.PaintOver
self.PaintOver = self.PaintOverHovered
end
/*---------------------------------------------------------
Name: OnMouseReleased
---------------------------------------------------------*/
function PANEL:OnCursorExited()
if ( self.PaintOver == self.PaintOverHovered ) then
self.PaintOver = self.PaintOverOld
end
end
/*---------------------------------------------------------
Name: PaintOverHovered
---------------------------------------------------------*/
function PANEL:PaintOverHovered()
if ( self.animPress:Active() ) then return end
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( matHover )
self:DrawTexturedRect()
end
/*---------------------------------------------------------
Name: OnMouseReleased
---------------------------------------------------------*/
function PANEL:PerformLayout()
self:SetSize( self.m_iIconSize, self.m_iIconSize )
self.Icon:StretchToParent( 0, 0, 0, 0 )
end
/*---------------------------------------------------------
Name: PressedAnim
---------------------------------------------------------*/
function PANEL:SetModel( mdl, iSkin )
if (!mdl) then debug.Trace() return end
self.Icon:SetModel( mdl, iSkin )
if ( iSkin && iSkin > 0 ) then
self:SetToolTip( Format( "%s (Skin %i)", mdl, iSkin+1 ) )
else
self:SetToolTip( Format( "%s", mdl ) )
end
end
/*---------------------------------------------------------
Name: Think
---------------------------------------------------------*/
function PANEL:Think()
self.animPress:Run()
end
/*---------------------------------------------------------
Name: PressedAnim
---------------------------------------------------------*/
function PANEL:PressedAnim( anim, delta, data )
if ( anim.Started ) then
end
if ( anim.Finished ) then
self.Icon:StretchToParent( 0, 0, 0, 0 )
return end
local border = math.sin( delta * math.pi ) * ( self.m_iIconSize * 0.1 )
self.Icon:StretchToParent( border, border, border, border )
end
/*---------------------------------------------------------
Name: RebuildSpawnIcon
---------------------------------------------------------*/
function PANEL:RebuildSpawnIcon()
self.Icon:RebuildSpawnIcon()
end
vgui.Register( "SpawnIcon", PANEL, "Panel" )
|
module(..., package.seeall)
ABOUT = {
NAME = "mqtt_shelly",
VERSION = "2021.04.26",
DESCRIPTION = "Shelly MQTT bridge",
AUTHOR = "@akbooer",
COPYRIGHT = "(c) 2020-2021 AKBooer",
DOCUMENTATION = "",
LICENSE = [[
Copyright 2013-2021 AK Booer
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.
]]
}
-- 2021.02.01 original Shelly Bridge
-- 2021.02.17 add LastUpdate time to individual devices
-- 2021.03.01 don't start Shelly bridge until first "shellies/..." MQTT message
-- 2021.03.28 add Shelly 1/1PM
-- 2021.03.29 use "input_event" topic for scenes to denote long push, etc.
-- 2021.03.30 use DEV and SID definitions from openLuup.servertables
-- 2021.03.31 put button press processing into generic() function (works for ix3, sw1, sw2.5, ...)
-- 2021.04.02 make separate L_ShellyBridge file
-- 2021.04.17 use openLuup device variable virtualizer, fix SetTarget for Shelly-1 (thanks @Elcid)
-- 2021.04.25 add Shelly SHPLG2-1 (thanks @ArcherS)
local json = require "openLuup.json"
local luup = require "openLuup.luup"
local chdev = require "openLuup.chdev" -- to create new bridge devices
local tables = require "openLuup.servertables" -- for standard DEV and SID definitions
local DEV = tables.DEV {
shelly = "D_GenericShellyDevice.xml",
}
local SID = tables.SID {
sBridge = "urn:akbooer-com:serviceId:ShellyBridge1",
shellies = "shellies",
}
local openLuup = luup.openLuup
--------------------------------------------------
--
-- Shelly MQTT Bridge - CONTROL
--
-- this part runs as a standard device
-- it is a control API only (ie. action requests)
--
local devNo -- bridge device number (set on startup)
local function SetTarget (dno, args)
local id = luup.attr_get ("altid", dno)
local shelly, relay = id: match "^([^/]+)/(%d)$" -- expecting "shellyxxxx/n"
if shelly then
local val = tonumber (args.newTargetValue)
openLuup[dno].switch.Target = val
local on_off = val == 1 and "on" or "off"
shelly = table.concat {"shellies/", shelly, '/relay/', relay, "/command"}
openLuup.mqtt.publish (shelly, on_off)
else
return false
end
end
local function ToggleState (dno)
local val = openLuup[dno].switch.Status
SetTarget (dno, {newTargetValue = val == '0' and '1' or '0'})
end
local function generic_action (serviceId, action)
local function noop(lul_device)
local message = "service/action not implemented: %d.%s.%s"
luup.log (message: format (lul_device, serviceId, action))
return false
end
local SRV = {
[SID.switch] = {SetTarget = SetTarget},
[SID.hadevice] = {ToggleState = ToggleState},
}
local service = SRV[serviceId] or {}
local act = service [action] or noop
if type(act) == "function" then act = {run = act} end
return act
end
function init (lul_device) -- Shelly Bridge device entry point
devNo = tonumber (lul_device)
luup.devices[devNo].action_callback (generic_action) -- catch all undefined action calls
luup.set_failure (0)
return true, "OK", "ShellyBridge"
end
--
-- end of Luup device file
--
--------------------------------------------------
--------------------------------------------------
--
-- Shelly MQTT Bridge - MODEL and VIEW
--
-- this part runs as a system module and can create a bridge device
-- as well as subsequent child devices, and update their variables
--
local devices = {} -- gets filled with device info on MQTT connection
local devNo -- bridge device number (set on startup)
----------------------
--
-- device specific variable updaters
--
-- NB: only called if variable has CHANGED value
--
--[[
for switch in "momentary" mode:
input_event is {"event":"S","event_cnt":57}
added to the switch number 0/1/2/...
--]]
local push_event = {
S = 10, -- shortpush
L = 20, -- longpush
SS = 30, -- double shortpush
SSS = 40, -- triple shortpush
SL = 50, -- shortpush + longpush
LS = 60, -- longpush + shortpush
}
-- generic actions for all devices
local function generic (dno, var, value)
-- button pushes behave as scene controller
-- look for change of value of input/n [n = 0,1,2]
local button = var: match "^input_event/(%d)"
if button then
local input = json.decode (value)
local push = input and push_event[input.event]
if push then
local scene = button + push
local S = openLuup[dno].scene
S.sl_SceneActivated = scene
S.LastSceneTime = os.time()
end
end
end
local function ix3 ()
-- all the work done in generic actions above
-- luup.log ("ix3 - update: " .. var)
end
local function sw2_5(dno, var, value)
-- luup.log ("sw2.5 - update: " .. var)
local action, child, attr = var: match "^(%a+)/(%d)/?(.*)"
if child then
local altid = luup.attr_get ("altid", dno)
local cdno = openLuup.find_device {altid = table.concat {altid, '/', child} }
if cdno then
local D = openLuup[cdno]
if action == "relay" then
if attr == '' then
D.switch.Status = value == "on" and '1' or '0'
elseif attr == "power" then
D.energy.Watts = value
elseif attr == "energy" then
D.energy.KWH = math.floor (value / 60) / 1000 -- convert Wmin to kWh
end
elseif action == "input" then
-- possibly set the input as a security/tamper switch
end
end
end
end
----------------------
local function model_info (upnp, updater, children)
return {upnp = upnp, updater = updater, children = children}
end
local unknown_model = model_info (DEV.shelly, generic)
local models = setmetatable (
{
["SHSW-1"] = model_info (DEV.shelly, sw2_5, {DEV.light}),
["SHSW-PM"] = model_info (DEV.shelly, sw2_5, {DEV.light}),
["SHIX3-1"] = model_info (DEV.controller, ix3),
["SHSW-25"] = model_info (DEV.shelly, sw2_5, {DEV.light, DEV.light}), -- two child devices
["SHPLG-S"] = model_info (DEV.shelly, sw2_5, {DEV.light}),
["SHPLG2-1"] = model_info (DEV.shelly, sw2_5, {DEV.light}),
},{
__index = function () return unknown_model end
})
local function _log (msg)
luup.log (msg, "luup.shelly")
end
local function create_device(info)
local room = luup.rooms.create "Shellies" -- create new device in Shellies room
local offset = luup.devices[devNo][SID.sBridge].Offset
if not offset then
offset = openLuup.bridge.nextIdBlock()
openLuup[devNo][SID.sBridge].Offset = offset
end
local dno = openLuup.bridge.nextIdInBlock(offset, 0) -- assign next device number in block
local name, altid, ip = info.id, info.id, info.ip
local _, s = luup.inet.wget ("http://" .. ip .. "/settings")
if s then
s = json.decode (s)
if s then name = s.name or name end
else
_log "no Shelly settings name found"
end
local upnp_file = models[info.model].upnp
local dev = chdev.create {
devNo = dno,
internal_id = altid,
description = name,
upnp_file = upnp_file,
-- json_file = json_file,
parent = devNo,
room = room,
ip = info.ip, -- include ip address of Shelly device
mac = info.mac, -- ditto mac
manufacturer = "Allterco Robotics",
}
dev.handle_children = true -- ensure that any child devices are handled
luup.devices[dno] = dev -- add to Luup devices
-- create extra child devices if required
local children = models[info.model].children or {}
local childID = "%s/%s"
for i, upnp_file2 in ipairs (children) do
local cdno = openLuup.bridge.nextIdInBlock(offset, 0) -- assign next device number in block
local cdev = chdev.create {
devNo = cdno,
internal_id = childID: format (altid, i-1),
description = childID: format (name, i-1),
upnp_file = upnp_file2,
-- json_file = json_file,
parent = dno,
room = room,
}
luup.devices[cdno] = cdev -- add to Luup devices
end
return dno
end
local function init_device (info)
local altid = info.id
if devices[info.id] then return end -- device already registered
_log ("New Shelly announced: " .. altid)
local dno = openLuup.find_device {altid = altid}
or
create_device (info)
luup.devices[dno].handle_children = true -- ensure that it handles child requests
devices[altid] = dno -- save the device number, indexed by id
-- update info, it may have changed
-- info = {"id":"xxx","model":"SHSW-25","mac":"hhh","ip":"...","new_fw":false,"fw_ver":"..."}
luup.ip_set (info.ip, dno)
luup.mac_set (info.mac, dno)
luup.attr_set ("model", info.model, dno)
luup.attr_set ("firmware", info.fw_ver, dno)
end
-- the bridge is a standard Luup plugin
local function create_ShellyBridge()
local internal_id, ip, mac, hidden, invisible, parent, room, pluginnum
local statevariables
return luup.create_device (
"ShellyBridge", -- device_type
internal_id,
"Shelly", -- description
"D_ShellyBridge.xml", -- upnp_file
"I_ShellyBridge.xml", -- upnp_impl
ip, mac, hidden, invisible, parent, room, pluginnum,
statevariables)
end
-----
--
-- MQTT callbacks
--
function _G.Shelly_MQTT_Handler (topic, message)
local shellies = topic: match "^shellies/(.+)"
if not shellies then return end
devNo = devNo -- ensure that ShellyBridge device exists
or
openLuup.find_device {device_type = "ShellyBridge"}
or
create_ShellyBridge ()
if shellies == "announce" then
local info, err = json.decode (message)
if not info then _log ("Announce JSON error: " .. (err or '?')) return end
init_device (info)
end
local timenow = os.time()
openLuup[devNo].hadevice.LastUpdate = timenow
local shelly, var = shellies: match "^(.-)/(.+)"
local child = devices[shelly]
if not child then return end
local D = openLuup[child]
D.hadevice.LastUpdate = timenow
local S = D[shelly]
local old = S[var]
if message ~= old then
S[var] = message -- save the raw message
generic (child, var, message) -- perform generic update actions
local model = luup.attr_get ("model", child)
models[model].updater (child, var, message) -- perform device specific update actions
end
end
luup.register_handler ("Shelly_MQTT_Handler", "mqtt:shellies/#") -- * * * MQTT wildcard subscription * * *
-----
|
local ffi = require("ffi")
require("lj2zydis.ffi.DecoderTypes")
require("lj2zydis.ffi.Status")
require("lj2zydis.ffi.String")
ffi.cdef[[
typedef ZydisU8 ZydisFormatterStyle;
enum ZydisFormatterStyles
{
ZYDIS_FORMATTER_STYLE_INTEL,
ZYDIS_FORMATTER_STYLE_MAX_VALUE = ZYDIS_FORMATTER_STYLE_INTEL
};
]]
ffi.cdef[[
typedef ZydisU8 ZydisFormatterProperty;
enum ZydisFormatterProperties
{
ZYDIS_FORMATTER_PROP_UPPERCASE,
ZYDIS_FORMATTER_PROP_FORCE_MEMSEG,
ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE,
ZYDIS_FORMATTER_PROP_ADDR_FORMAT,
ZYDIS_FORMATTER_PROP_DISP_FORMAT,
ZYDIS_FORMATTER_PROP_IMM_FORMAT,
ZYDIS_FORMATTER_PROP_HEX_UPPERCASE,
ZYDIS_FORMATTER_PROP_HEX_PREFIX,
ZYDIS_FORMATTER_PROP_HEX_SUFFIX,
ZYDIS_FORMATTER_PROP_HEX_PADDING_ADDR,
ZYDIS_FORMATTER_PROP_HEX_PADDING_DISP,
ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM,
ZYDIS_FORMATTER_PROP_MAX_VALUE = ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM
};
]]
ffi.cdef[[
enum ZydisAddressFormat
{
ZYDIS_ADDR_FORMAT_ABSOLUTE,
ZYDIS_ADDR_FORMAT_RELATIVE_SIGNED,
ZYDIS_ADDR_FORMAT_RELATIVE_UNSIGNED,
ZYDIS_ADDR_FORMAT_MAX_VALUE = ZYDIS_ADDR_FORMAT_RELATIVE_UNSIGNED
};
]]
ffi.cdef[[
enum ZydisDisplacementFormat
{
ZYDIS_DISP_FORMAT_HEX_SIGNED,
ZYDIS_DISP_FORMAT_HEX_UNSIGNED,
ZYDIS_DISP_FORMAT_MAX_VALUE = ZYDIS_DISP_FORMAT_HEX_UNSIGNED
};
]]
ffi.cdef[[
enum ZydisImmediateFormat
{
ZYDIS_IMM_FORMAT_HEX_AUTO,
ZYDIS_IMM_FORMAT_HEX_SIGNED,
ZYDIS_IMM_FORMAT_HEX_UNSIGNED,
ZYDIS_IMM_FORMAT_MAX_VALUE = ZYDIS_IMM_FORMAT_HEX_UNSIGNED
};
]]
ffi.cdef[[
typedef ZydisU8 ZydisFormatterHookType;
enum ZydisFormatterHookTypes
{
ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION,
ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION,
ZYDIS_FORMATTER_HOOK_PRE_OPERAND,
ZYDIS_FORMATTER_HOOK_POST_OPERAND,
ZYDIS_FORMATTER_HOOK_FORMAT_INSTRUCTION,
ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_REG,
ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_MEM,
ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_PTR,
ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM,
ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC,
ZYDIS_FORMATTER_HOOK_PRINT_REGISTER,
ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS,
ZYDIS_FORMATTER_HOOK_PRINT_DISP,
ZYDIS_FORMATTER_HOOK_PRINT_IMM,
ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE,
ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES,
ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR,
ZYDIS_FORMATTER_HOOK_MAX_VALUE = ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR
};
]]
ffi.cdef[[
typedef ZydisU8 ZydisDecoratorType;
enum ZydisDecoratorTypes
{
ZYDIS_DECORATOR_TYPE_INVALID,
ZYDIS_DECORATOR_TYPE_MASK,
ZYDIS_DECORATOR_TYPE_BC,
ZYDIS_DECORATOR_TYPE_RC,
ZYDIS_DECORATOR_TYPE_SAE,
ZYDIS_DECORATOR_TYPE_SWIZZLE,
ZYDIS_DECORATOR_TYPE_CONVERSION,
ZYDIS_DECORATOR_TYPE_EH,
ZYDIS_DECORATOR_TYPE_MAX_VALUE = ZYDIS_DECORATOR_TYPE_EH
};
]]
ffi.cdef[[
typedef struct ZydisFormatter_ ZydisFormatter;
typedef ZydisStatus (*ZydisFormatterFunc)(const ZydisFormatter* formatter,
ZydisString* string, const ZydisDecodedInstruction* instruction, void* userData);
typedef ZydisStatus (*ZydisFormatterOperandFunc)(const ZydisFormatter* formatter,
ZydisString* string, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData);
typedef ZydisStatus (*ZydisFormatterRegisterFunc)(const ZydisFormatter* formatter,
ZydisString* string, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, ZydisRegister reg, void* userData);
typedef ZydisStatus (*ZydisFormatterAddressFunc)(const ZydisFormatter* formatter,
ZydisString* string, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, ZydisU64 address, void* userData);
typedef ZydisStatus (*ZydisFormatterDecoratorFunc)(const ZydisFormatter* formatter,
ZydisString* string, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, ZydisDecoratorType decorator, void* userData);
]]
ffi.cdef[[
struct ZydisFormatter_
{
ZydisLetterCase letterCase;
ZydisBool forceMemorySegment;
ZydisBool forceMemorySize;
ZydisU8 formatAddress;
ZydisU8 formatDisp;
ZydisU8 formatImm;
ZydisBool hexUppercase;
ZydisString* hexPrefix;
ZydisString hexPrefixData;
ZydisString* hexSuffix;
ZydisString hexSuffixData;
ZydisU8 hexPaddingAddress;
ZydisU8 hexPaddingDisp;
ZydisU8 hexPaddingImm;
ZydisFormatterFunc funcPreInstruction;
ZydisFormatterFunc funcPostInstruction;
ZydisFormatterOperandFunc funcPreOperand;
ZydisFormatterOperandFunc funcPostOperand;
ZydisFormatterFunc funcFormatInstruction;
ZydisFormatterOperandFunc funcFormatOperandReg;
ZydisFormatterOperandFunc funcFormatOperandMem;
ZydisFormatterOperandFunc funcFormatOperandPtr;
ZydisFormatterOperandFunc funcFormatOperandImm;
ZydisFormatterFunc funcPrintMnemonic;
ZydisFormatterRegisterFunc funcPrintRegister;
ZydisFormatterAddressFunc funcPrintAddress;
ZydisFormatterOperandFunc funcPrintDisp;
ZydisFormatterOperandFunc funcPrintImm;
ZydisFormatterOperandFunc funcPrintMemSize;
ZydisFormatterFunc funcPrintPrefixes;
ZydisFormatterDecoratorFunc funcPrintDecorator;
};
]]
ffi.cdef[[
ZydisStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle style);
ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
ZydisFormatterProperty property, ZydisUPointer value);
ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
ZydisFormatterHookType hook, const void** callback);
ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen);
ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen, void* userData);
ZydisStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZydisU8 index, char* buffer, ZydisUSize bufferLen);
ZydisStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZydisU8 index, char* buffer, ZydisUSize bufferLen,
void* userData);
]]
|
#!/usr/bin/env tarantool
test = require("sqltester")
test:plan(4)
--!./tcltestrunner.lua
-- 2008 October 20
--
-- The author disclaims copyright to this source code. In place of
-- a legal notice, here is a blessing:
--
-- May you do good and not evil.
-- May you find forgiveness for yourself and forgive others.
-- May you share freely, never taking more than you give.
--
-------------------------------------------------------------------------
-- This file implements regression tests for sql library.
--
-- This file implements tests to verify that ticket #3442 has been
-- fixed.
--
--
-- $Id: tkt3442.test,v 1.2 2009/06/05 17:09:12 drh Exp $
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
-- Create a schema with some indexes.
--
test:do_execsql_test(
"tkt3442-1.1",
[[
CREATE TABLE listhash(
key INTEGER PRIMARY KEY,
id TEXT,
node INTEGER
);
CREATE UNIQUE INDEX ididx ON listhash(id);
]], {
-- <tkt3442-1.1>
-- </tkt3442-1.1>
})
-- Explain Query Plan
--
local function EQP(sql)
return test:execsql("EXPLAIN QUERY PLAN "..sql)
end
-- These tests perform an EXPLAIN QUERY PLAN on both versions of
-- SELECT: with string literal and numeric constant and verify
-- that the query plans are different.
--
test:do_test(
"tkt3442-1.2",
function()
return EQP(" SELECT node FROM listhash WHERE id='5000' LIMIT 1; ")
end, {
-- <tkt3442-1.2>
0, 0, 0, "SEARCH TABLE LISTHASH USING COVERING INDEX IDIDX (ID=?)"
-- </tkt3442-1.2>
})
test:do_test(
"tkt3442-1.3",
function()
return EQP([[ SELECT node FROM listhash WHERE id=5000 LIMIT 1; ]])
end, {
-- <tkt3442-1.3>
0, 0, 0, "SCAN TABLE LISTHASH"
-- </tkt3442-1.3>
})
test:do_catchsql_test(
"tkt3442-1.4",
[[
SELECT node FROM listhash WHERE id="5000" LIMIT 1;
]], {
-- <tkt3442-1.5>
1, "Can’t resolve field '5000'"
-- </tkt3442-1.5>
})
test:finish_test()
|
local objects =
{
-- Maxime
createObject(18030,2138.0996094,-1625.7998047,391.1000061,0.0000000,0.0000000,0.0000000, 2), --object(gap, 2), (1, 2),
createObject(2774,2150.7197266,-1631.3475342,399.7000122,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (9, 2),
createObject(2774,2150.7128906,-1629.7998047,399.7000122,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (11, 2),
createObject(2774,2150.7128906,-1628.1630859,399.7000122,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (12, 2),
createObject(3051,2149.3603516,-1626.8059082,390.1000061,0.0000000,0.0000000,46.2414551, 2), --object(lift_dr, 2), (11, 2),
createObject(3051,2149.3574219,-1628.0036621,390.1000061,0.0000000,0.0000000,46.4831543, 2), --object(lift_dr, 2), (12, 2),
createObject(1649,2144.6992188,-1630.1992188,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (3, 2),
createObject(1649,2141.0000000,-1630.1999512,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (4, 2),
createObject(1649,2136.5996094,-1630.2158203,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2134.3920898,-1632.4499512,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (6, 2),
createObject(1649,2134.4101562,-1636.8095703,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (7, 2),
createObject(1569,2134.3999023,-1639.3000488,388.7200012,0.0000000,0.0000000,180.0000000, 2), --object(adam_v_door, 2), (1, 2),
createObject(1649,2142.8000488,-1632.1999512,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1649,2142.8193359,-1636.5791016,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (15, 2),
createObject(1569,2140.6000977,-1630.1999512,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(adam_v_door, 2), (3, 2),
createObject(1649,2129.1000977,-1630.3000488,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2124.6999512,-1630.3199463,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2120.3000488,-1630.3380127,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2115.8999023,-1630.3599854,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2131.3300781,-1632.5159912,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (6, 2),
createObject(1649,2131.3500977,-1636.9000244,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (6, 2),
createObject(1569,2131.3999023,-1639.3000488,388.7200012,0.0000000,0.0000000,359.9945068, 2), --object(adam_v_door, 2), (1, 2),
createObject(1649,2134.4299316,-1641.1999512,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (7, 2),
createObject(1649,2123.3000488,-1632.5000000,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1649,2123.3200684,-1636.9000244,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1569,2123.8000488,-1630.3000488,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(adam_v_door, 2), (2, 2),
createObject(1569,2116.3000488,-1630.4000244,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(adam_v_door, 2), (2, 2),
createObject(1649,2123.3999023,-1625.0999756,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1649,2123.3798828,-1620.6999512,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1649,2123.3601074,-1616.3000488,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1649,2123.3449707,-1611.9000244,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1649,2121.1823730,-1627.3260498,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2149.1000977,-1630.1800537,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (3, 2),
createObject(1569,2143.6000977,-1630.1999512,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(adam_v_door, 2), (2, 2),
createObject(3051,2149.3574219,-1624.5430908,390.1000061,0.0000000,0.0000000,46.2414551, 2), --object(lift_dr, 2), (11, 2),
createObject(3051,2149.3544922,-1623.3470459,390.1000061,0.0000000,0.0000000,46.4914551, 2), --object(lift_dr, 2), (11, 2),
createObject(1649,2116.8200684,-1627.3499756,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2121.1530762,-1620.0989990,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2116.8000488,-1620.1199951,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1569,2123.3999023,-1625.4000244,388.7000122,0.0000000,0.0000000,269.7500000, 2), --object(adam_v_door, 2), (2, 2),
createObject(1569,2123.3999023,-1617.0999756,388.7000122,0.0000000,0.0000000,269.7473145, 2), --object(adam_v_door, 2), (2, 2),
createObject(1649,2128.6000977,-1621.0000000,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2132.8999023,-1620.9820557,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2137.1999512,-1620.9630127,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2141.6000977,-1620.9420166,390.3999939,0.0000000,0.0000000,0.2471924, 2), --object(wglasssmash, 2), (5, 2),
createObject(1649,2126.3750000,-1618.7910156,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1649,2126.3569336,-1614.4000244,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(2774,2126.3999023,-1611.6999512,399.7000122,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (11, 2),
createObject(1649,2143.8139648,-1618.7130127,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1649,2143.7958984,-1614.3000488,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(2774,2143.8994141,-1611.7656250,399.7000122,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (11, 2),
createObject(1649,2135.0000000,-1618.7541504,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1649,2134.9799805,-1614.4000244,390.3999939,0.0000000,0.0000000,90.2471924, 2), --object(wglasssmash, 2), (14, 2),
createObject(1569,2127.5000000,-1621.0000000,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(adam_v_door, 2), (2, 2),
createObject(1569,2140.8999023,-1620.9000244,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(adam_v_door, 2), (2, 2),
createObject(1569,2124.0000000,-1611.8000488,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(adam_v_door, 2), (2, 2),
createObject(1714,2146.3999023,-1635.5999756,388.7000122,0.0000000,0.0000000,173.5000000, 2), --object(kb_swivelchair1, 2), (6, 2),
createObject(1703,2146.6000977,-1630.8000488,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(kb_couch02, 2), (12, 2),
createObject(2165,2146.1999512,-1634.4000244,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(med_office_desk_1, 2), (2, 2),
createObject(2166,2144.3000488,-1635.4000244,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(med_office_desk_2, 2), (2, 2),
createObject(2164,2146.3000488,-1638.9000244,388.7000122,0.0000000,0.0000000,180.0000000, 2), --object(med_office_unit_5, 2), (2, 2),
createObject(2174,2149.3999023,-1636.3000488,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(med_office4_desk_2, 2), (2, 2),
createObject(1720,2148.6999512,-1637.0999756,388.7000122,0.0000000,0.0000000,90.0000000, 2), --object(rest_chair, 2), (1, 2),
createObject(1808,2144.1999512,-1638.3000488,388.7000122,0.0000000,0.0000000,178.2500000, 2), --object(cj_watercooler2, 2), (3, 2),
createObject(2166,2136.3000488,-1635.5999756,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(med_office_desk_2, 2), (3, 2),
createObject(2165,2138.1999512,-1634.5999756,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(med_office_desk_1, 2), (4, 2),
createObject(1714,2138.5000000,-1635.8000488,388.7000122,0.0000000,0.0000000,173.4960938, 2), --object(kb_swivelchair1, 2), (7, 2),
createObject(2164,2139.1999512,-1638.9000244,388.7000122,0.0000000,0.0000000,179.9945068, 2), --object(med_office_unit_5, 2), (3, 2),
createObject(1808,2137.0000000,-1638.3000488,388.7000122,0.0000000,0.0000000,178.2476807, 2), --object(cj_watercooler2, 2), (4, 2),
createObject(2174,2142.3000488,-1636.3000488,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(med_office4_desk_2, 2), (3, 2),
createObject(1720,2141.3999023,-1637.0999756,388.7000122,0.0000000,0.0000000,90.0000000, 2), --object(rest_chair, 2), (2, 2),
createObject(1703,2137.1000977,-1631.0000000,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(kb_couch02, 2), (13, 2),
createObject(15038,2136.1999512,-1630.9000244,389.3999939,0.0000000,0.0000000,0.0000000, 2), --object(plant_pot_3_sv, 2), (1, 2),
createObject(2166,2124.8000488,-1635.5999756,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(med_office_desk_2, 2), (4, 2),
createObject(2165,2126.6999512,-1634.5999756,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(med_office_desk_1, 2), (5, 2),
createObject(1703,2127.3999023,-1631.0000000,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(kb_couch02, 2), (14, 2),
createObject(1714,2127.0000000,-1635.6999512,388.7000122,0.0000000,0.0000000,173.4960938, 2), --object(kb_swivelchair1, 2), (8, 2),
createObject(2164,2127.3999023,-1638.9000244,388.7000122,0.0000000,0.0000000,179.9945068, 2), --object(med_office_unit_5, 2), (4, 2),
createObject(1808,2125.3000488,-1638.3000488,388.7000122,0.0000000,0.0000000,178.2476807, 2), --object(cj_watercooler2, 2), (5, 2),
createObject(2174,2130.8000488,-1636.1999512,388.7000122,0.0000000,0.0000000,270.2500000, 2), --object(med_office4_desk_2, 2), (4, 2),
createObject(1720,2130.1000977,-1637.0000000,388.7000122,0.0000000,0.0000000,90.0000000, 2), --object(rest_chair, 2), (3, 2),
createObject(15038,2126.3000488,-1630.9000244,389.3999939,0.0000000,0.0000000,0.0000000, 2), --object(plant_pot_3_sv, 2), (2, 2),
createObject(2166,2117.5000000,-1635.5000000,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(med_office_desk_2, 2), (5, 2),
createObject(2165,2119.3999023,-1634.5000000,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(med_office_desk_1, 2), (6, 2),
createObject(2164,2119.6000977,-1638.9000244,388.7000122,0.0000000,0.0000000,179.9945068, 2), --object(med_office_unit_5, 2), (5, 2),
createObject(1808,2117.6000977,-1638.3000488,388.7000122,0.0000000,0.0000000,178.2476807, 2), --object(cj_watercooler2, 2), (6, 2),
createObject(2174,2122.8000488,-1636.6999512,388.7000122,0.0000000,0.0000000,270.2471924, 2), --object(med_office4_desk_2, 2), (5, 2),
createObject(1720,2122.1000977,-1637.4000244,388.7000122,0.0000000,0.0000000,90.0000000, 2), --object(rest_chair, 2), (4, 2),
createObject(1703,2119.1999512,-1631.3000488,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(kb_couch02, 2), (15, 2),
createObject(1714,2119.5000000,-1635.8000488,388.7000122,0.0000000,0.0000000,173.4960938, 2), --object(kb_swivelchair1, 2), (9, 2),
createObject(2166,2118.6999512,-1621.6999512,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(med_office_desk_2, 2), (6, 2),
createObject(2165,2119.6999512,-1623.5999756,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(med_office_desk_1, 2), (7, 2),
createObject(1714,2118.3999023,-1624.1999512,388.7000122,0.0000000,0.0000000,93.4960938, 2), --object(kb_swivelchair1, 2), (10, 2),
createObject(2164,2116.3000488,-1623.8000488,388.7000122,0.0000000,0.0000000,89.9945068, 2), --object(med_office_unit_5, 2), (6, 2),
createObject(1808,2116.5000000,-1621.8000488,388.7000122,0.0000000,0.0000000,88.2476807, 2), --object(cj_watercooler2, 2), (7, 2),
createObject(2174,2118.3999023,-1626.8000488,388.7000122,0.0000000,0.0000000,180.2471924, 2), --object(med_office4_desk_2, 2), (6, 2),
createObject(1720,2117.6000977,-1626.0999756,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(rest_chair, 2), (5, 2),
createObject(1703,2122.6000977,-1622.0999756,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(kb_couch02, 2), (16, 2),
createObject(2166,2118.6999512,-1614.0000000,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(med_office_desk_2, 2), (7, 2),
createObject(2165,2119.6999512,-1615.9000244,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(med_office_desk_1, 2), (8, 2),
createObject(1714,2118.5000000,-1616.4000244,388.7000122,0.0000000,0.0000000,93.4936523, 2), --object(kb_swivelchair1, 2), (11, 2),
createObject(2164,2116.3000488,-1616.0000000,388.7000122,0.0000000,0.0000000,89.9945068, 2), --object(med_office_unit_5, 2), (7, 2),
createObject(1808,2116.5000000,-1613.6999512,388.7000122,0.0000000,0.0000000,88.2421875, 2), --object(cj_watercooler2, 2), (8, 2),
createObject(2174,2118.6000977,-1619.5999756,388.7000122,0.0000000,0.0000000,180.2416992, 2), --object(med_office4_desk_2, 2), (7, 2),
createObject(1720,2117.8999023,-1618.8000488,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(rest_chair, 2), (6, 2),
createObject(2166,2132.8000488,-1615.5000000,388.7000122,0.0000000,0.0000000,180.0000000, 2), --object(med_office_desk_2, 2), (8, 2),
createObject(2165,2130.8999023,-1616.5000000,388.7000122,0.0000000,0.0000000,180.0000000, 2), --object(med_office_desk_1, 2), (9, 2),
createObject(1714,2130.3000488,-1615.1999512,388.7000122,0.0000000,0.0000000,13.4936523, 2), --object(kb_swivelchair1, 2), (12, 2),
createObject(2164,2129.3000488,-1612.0000000,388.7000122,0.0000000,0.0000000,359.9945068, 2), --object(med_office_unit_5, 2), (8, 2),
createObject(1808,2131.6999512,-1612.3000488,388.7000122,0.0000000,0.0000000,0.2421875, 2), --object(cj_watercooler2, 2), (9, 2),
createObject(1703,2122.6000977,-1614.0000000,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(kb_couch02, 2), (17, 2),
createObject(1703,2132.6999512,-1619.9000244,388.7000122,0.0000000,0.0000000,180.0000000, 2), --object(kb_couch02, 2), (18, 2),
createObject(2174,2126.8999023,-1615.5000000,388.7000122,0.0000000,0.0000000,90.2416992, 2), --object(med_office4_desk_2, 2), (8, 2),
createObject(1720,2127.6000977,-1614.8000488,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(rest_chair, 2), (7, 2),
createObject(2166,2141.3999023,-1615.5999756,388.7000122,0.0000000,0.0000000,179.9945068, 2), --object(med_office_desk_2, 2), (9, 2),
createObject(2165,2139.5000000,-1616.5999756,388.7000122,0.0000000,0.0000000,179.9945068, 2), --object(med_office_desk_1, 2), (10, 2),
createObject(1714,2139.0000000,-1615.5000000,388.7000122,0.0000000,0.0000000,13.4912109, 2), --object(kb_swivelchair1, 2), (13, 2),
createObject(2164,2138.6000977,-1611.9000244,388.7000122,0.0000000,0.0000000,359.9890137, 2), --object(med_office_unit_5, 2), (9, 2),
createObject(1808,2140.6999512,-1612.0999756,388.7000122,0.0000000,0.0000000,0.2416992, 2), --object(cj_watercooler2, 2), (10, 2),
createObject(2174,2135.5000000,-1614.8000488,388.7000122,0.0000000,0.0000000,90.2362061, 2), --object(med_office4_desk_2, 2), (9, 2),
createObject(1720,2136.1999512,-1614.0999756,388.7000122,0.0000000,0.0000000,270.0000000, 2), --object(rest_chair, 2), (8, 2),
createObject(1703,2139.5000000,-1620.0000000,388.7000122,0.0000000,0.0000000,179.9945068, 2), --object(kb_couch02, 2), (19, 2),
createObject(16151,2148.8994141,-1617.3994141,389.1000061,0.0000000,0.0000000,0.0000000, 2), --object(ufo_bar, 2), (3, 2),
createObject(1825,2145.1000977,-1619.4000244,388.7000122,0.0000000,0.0000000,0.0000000, 2), --object(kb_table_chairs1, 2), (8, 2),
createObject(2257,2147.2470703,-1611.8872070,391.1954041,0.0000000,0.0000000,0.0000000, 2), --object(frame_clip_4, 2), (1, 2),
createObject(2289,2136.8713379,-1611.8771973,391.3843994,0.0000000,0.0000000,0.0000000, 2), --object(frame_2, 2), (1, 2),
createObject(2254,2133.0605469,-1611.9729004,391.1000671,0.0000000,0.0000000,0.0000000, 2), --object(frame_clip_1, 2), (1, 2),
createObject(2255,2116.6975098,-1625.6601562,390.6877747,0.0000000,0.0000000,90.0000000, 2), --object(frame_clip_2, 2), (1, 2),
createObject(2256,2149.8837891,-1633.2393799,390.9230347,0.0000000,0.0000000,270.0000000, 2), --object(frame_clip_3, 2), (1, 2),
createObject(2258,2119.6591797,-1611.8710938,391.0509949,0.0000000,0.0000000,0.0000000, 2), --object(frame_clip_5, 2), (1, 2),
createObject(2259,2129.5324707,-1638.9281006,390.4765930,0.0000000,0.0000000,180.2500000, 2), --object(frame_clip_6, 2), (1, 2),
createObject(2261,2140.8527832,-1638.8963623,390.4391785,0.0000000,0.0000000,180.0000000, 2), --object(frame_slim_2, 2), (1, 2),
createObject(2262,2116.7060547,-1634.5278320,390.8099670,0.0000000,0.0000000,90.0000000, 2), --object(frame_slim_3, 2), (1, 2),
createObject(2186,2129.7878418,-1629.6367188,388.7328186,0.0000000,0.0000000,180.0000000, 2), --object(photocopier_1, 2), (1, 2),
createObject(2186,2135.9274902,-1621.6285400,388.7328186,0.0000000,0.0000000,0.0000000, 2), --object(photocopier_1, 2), (2, 2),
createObject(5113,1976.1923828,-2446.7832031,58.1701584,270.0000000,180.0000000,271.5051880, 2), --object(blockaa_las2, 2), (1, 2),
createObject(5113,1949.3242188,-2408.2236328,21.0423279,270.0000000,179.9945068,0.0000000, 2), --object(blockaa_las2, 2), (2, 2),
createObject(5113,1925.9101562,-2461.6486816,22.8518066,0.0000000,179.9945068,351.9914551, 2), --object(blockaa_las2, 2), (4, 2),
createObject(5113,2011.8365479,-2460.7561035,22.8276863,90.0000000,180.0000000,2.9907837, 2), --object(blockaa_las2, 2), (5, 2),
createObject(7313,1970.6827393,-2443.8234863,22.3535347,0.0000000,0.0000000,90.0000000, 2), --object(vgsn_scrollsgn01, 2), (1, 2),
createObject(6965,1985.6191406,-2398.1279297,18.1107788,0.0000000,0.0000000,3.9990234, 2), --object(venefountain02, 2), (1, 2),
createObject(9833,1980.8554688,-2402.2685547,17.8677292,0.0000000,0.0000000,341.7407227, 2), --object(fountain_sfw, 2), (1, 2),
createObject(2774,1983.2890625,-2444.5380859,8.5963001,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (5, 2),
createObject(16773,1933.0893555,-2400.5937500,18.5292988,0.0000000,0.0000000,178.7445068, 2), --object(door_savhangr1, 2), (1, 2),
createObject(2774,2150.1826172,-1628.1533203,381.5579529,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (12, 2),
createObject(2774,2150.1904297,-1626.6708984,381.5635681,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (12, 2),
createObject(2774,2150.1833496,-1623.1910400,381.5657043,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (12, 2),
createObject(2774,2150.1835938,-1624.6766357,381.5675354,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (12, 2),
createObject(10781,1950.4160156,-2310.8623047,16.3280029,0.0000000,0.0000000,270.0000000, 2), --object(aircarpark_08_sfse, 2), (1, 2),
createObject(8948,1924.1031494,-2339.7763672,14.5116310,0.0000000,179.9945068,270.2500000, 2), --object(lckupgrgdoor_lvs, 2), (3, 2),
createObject(8168,1917.1118164,-2335.6179199,14.6554565,0.0000000,0.0000000,106.4959717, 2), --object(vgs_guardhouse01, 2), (1, 2),
createObject(8948,1900.0078125,-2294.4169922,14.5289612,0.0000000,179.9945068,179.9971924, 2), --object(lckupgrgdoor_lvs, 2), (5, 2),
createObject(8168,1915.8145752,-2287.5051270,14.7056580,0.0000000,0.0000000,16.4959717, 2), --object(vgs_guardhouse01, 2), (3, 2),
createObject(1622,1912.1395264,-2298.8615723,19.5437012,0.0000000,0.0000000,180.0000000, 2), --object(nt_securecam2_01, 2), (2, 2),
createObject(1622,1928.9404297,-2339.2600098,19.3679504,0.0000000,0.0000000,271.9995117, 2), --object(nt_securecam2_01, 2), (3, 2),
createObject(3051,1956.3118896,-2314.1125488,14.4774475,0.0000000,0.0000000,136.2491455, 2), --object(lift_dr, 2), (1, 2),
createObject(3051,1957.4976807,-2314.1083984,14.4774475,0.0000000,0.0000000,316.2414551, 2), --object(lift_dr, 2), (2, 2),
createObject(3051,1957.5152588,-2307.6279297,14.4695377,0.0000000,0.0000000,136.2359619, 2), --object(lift_dr, 2), (3, 2),
createObject(3051,1956.3164062,-2307.6269531,14.4741554,0.0000000,0.0000000,136.2386475, 2), --object(lift_dr, 2), (4, 2),
createObject(5720,1884.1867676,-2292.9370117,14.7961121,0.0000000,0.0000000,180.0000000, 2), --object(holbuild02_law, 2), (2, 2),
createObject(5720,1924.4824219,-2355.5700684,15.6547241,0.0000000,0.0000000,270.2390137, 2), --object(holbuild02_law, 2), (3, 2),
createObject(14826,1942.6446533,-2311.0637207,13.8580017,0.0000000,0.0000000,90.0000000, 2), --object(int_kbsgarage2, 2), (1, 2),
createObject(6102,1937.0781250,-2460.0029297,26.8917484,0.0000000,0.0000000,90.0000000, 2), --object(gaz4_law, 2), (1, 2),
createObject(16773,1918.5490723,-2465.5888672,16.9174023,0.0000000,0.0000000,269.9920654, 2), --object(door_savhangr1, 2), (1, 2),
createObject(2774,1983.2880859,-2442.8906250,8.5975456,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (5, 2),
createObject(3051,1982.4564209,-2444.3439941,17.3477020,0.0000000,0.0000000,46.0000000, 2), --object(lift_dr, 2), (5, 2),
createObject(3051,1982.4599609,-2443.1464844,17.3477020,0.0000000,0.0000000,46.2469482, 2), --object(lift_dr, 2), (6, 2),
createObject(11489,1969.8287354,-2443.9165039,17.3147774,0.0000000,0.0000000,90.0000000, 2), --object(dam_statues, 2), (1, 2),
createObject(6965,1984.2929688,-2473.2802734,18.1097240,0.0000000,0.0000000,3.9935303, 2), --object(venefountain02, 2), (1, 2),
createObject(9833,1979.9108887,-2467.9890137,17.8677292,0.0000000,0.0000000,345.7407227, 2), --object(fountain_sfw, 2), (1, 2),
createObject(6964,1984.8828125,-2398.9257812,14.1818695,0.0000000,0.0000000,3.9990234, 2), --object(venefountwat02, 2), (2, 2),
createObject(6964,1984.0732422,-2473.0029297,14.1998711,0.0000000,0.0000000,3.9935303, 2), --object(venefountwat02, 2), (3, 2),
createObject(3920,1969.6948242,-2407.8247070,21.4028835,0.0000000,0.0000000,0.0000000, 2), --object(lib_veg3, 2), (1, 2),
createObject(3920,1975.8721924,-2413.9121094,21.4194012,0.0000000,0.0000000,270.0000000, 2), --object(lib_veg3, 2), (2, 2),
createObject(3920,1975.9335938,-2470.9248047,21.4035358,0.0000000,0.0000000,270.0000000, 2), --object(lib_veg3, 2), (3, 2),
createObject(2774,1948.1616211,-2400.6555176,7.1437201,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (5, 2),
createObject(2774,1949.8186035,-2400.6550293,7.1444325,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (5, 2),
createObject(3051,1949.5499268,-2401.4714355,16.0273895,0.0000000,0.0000000,316.2469482, 2), --object(lift_dr, 2), (6, 2),
createObject(3051,1948.3496094,-2401.4658203,16.0273895,0.0000000,0.0000000,316.2469482, 2), --object(lift_dr, 2), (6, 2),
createObject(2774,1953.8808594,-2417.5556641,7.6212263,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (5, 2),
createObject(2774,1952.2185059,-2417.5556641,7.6213374,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (5, 2),
createObject(2774,1949.5697021,-2417.5524902,7.6200385,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (5, 2),
createObject(2774,1947.9089355,-2417.5534668,7.6216393,0.0000000,0.0000000,0.0000000, 2), --object(cj_airp_pillars, 2), (5, 2),
createObject(3051,1953.6173096,-2418.3708496,16.0273895,0.0000000,0.0000000,316.2500000, 2), --object(lift_dr, 2), (9, 2),
createObject(3051,1952.4200439,-2418.3679199,16.0262184,0.0000000,0.0000000,316.2469482, 2), --object(lift_dr, 2), (10, 2),
createObject(3051,1949.3013916,-2418.3642578,16.0322189,0.0000000,0.0000000,316.2469482, 2), --object(lift_dr, 2), (13, 2),
createObject(3051,1948.1081543,-2418.3662109,16.0322189,0.0000000,0.0000000,316.2469482, 2), --object(lift_dr, 2), (14, 2),
createObject(646,1946.5229492,-2401.5283203,16.0817108,0.0000000,0.0000000,298.0000000, 2), --object(veg_palmkb14, 2), (1, 2),
createObject(646,1951.4244385,-2401.6145020,16.0817108,0.0000000,0.0000000,4.0000000, 2), --object(veg_palmkb14, 2), (2, 2),
createObject(3439,1977.0595703,-2437.9592285,18.7785358,0.0000000,0.0000000,132.0000000, 2), --object(aprtree01_lvs, 2), (1, 2),
createObject(3439,1977.0876465,-2449.2365723,18.7785358,0.0000000,0.0000000,211.9952393, 2), --object(aprtree01_lvs, 2), (2, 2),
createObject(3660,1977.3911133,-2426.7209473,16.3513451,0.0000000,0.0000000,270.0000000, 2), --object(lasairfbed_las, 2), (1, 2),
createObject(3660,1976.8345947,-2459.5783691,16.3483448,0.0000000,0.0000000,90.0000000, 2), --object(lasairfbed_las, 2), (2, 2),
createObject(3660,1952.9985352,-2406.8439941,16.3543453,0.0000000,0.0000000,180.0000000, 2), --object(lasairfbed_las, 2), (3, 2),
createObject(3660,1964.2557373,-2406.8405762,16.3453445,0.0000000,0.0000000,179.9945068, 2), --object(lasairfbed_las, 2), (4, 2),
createObject(3660,1976.8526611,-2419.9487305,16.3573456,0.0000000,0.0000000,89.9945068, 2), --object(lasairfbed_las, 2), (5, 2),
createObject(1886,1943.6254883,-2416.3540039,28.5426083,0.0000000,0.0000000,110.0000000, 2), --object(shop_sec_cam, 2), (1, 2),
createObject(14461,1972.5446777,-2422.8579102,22.3995113,0.0000000,0.0000000,180.0000000, 2), --object(gs_piccies, 2), (1, 2),
createObject(14461,1960.6485596,-2414.8132324,22.3821297,0.0000000,0.0000000,269.9945068, 2), --object(gs_piccies, 2), (2, 2),
createObject(14804,1974.6873779,-2409.2258301,21.8265839,0.0000000,0.0000000,342.0000000, 2), --object(bdups_plant, 2), (1, 2),
createObject(14902,1954.9836426,-2415.9431152,15.1397381,0.0000000,0.0000000,359.5000000, 2), --object(veg_pol_window, 2), (1, 2),
createObject(14902,1968.0644531,-2411.6064453,15.1829987,0.0000000,0.0000000,269.7446289, 2), --object(veg_pol_window, 2), (2, 2),
createObject(2178,1976.7160645,-2443.4208984,28.1774368,0.0000000,0.0000000,0.0000000, 2), --object(casino_light2, 2), (1, 2),
createObject(18075,1976.7947998,-2430.5493164,28.4318714,0.0000000,0.0000000,0.0000000, 2), --object(lightd, 2), (1, 2),
createObject(18075,1976.7930908,-2443.2670898,28.4350090,0.0000000,0.0000000,0.0000000, 2), --object(lightd, 2), (2, 2),
createObject(18075,1976.7960205,-2455.8676758,28.4350758,0.0000000,0.0000000,0.0000000, 2), --object(lightd, 2), (3, 2),
createObject(18075,1976.7961426,-2469.1599121,28.4244404,0.0000000,0.0000000,0.0000000, 2), --object(lightd, 2), (4, 2),
createObject(18075,1976.8023682,-2418.2673340,28.4008808,0.0000000,0.0000000,0.0000000, 2), --object(lightd, 2), (5, 2),
createObject(18075,1976.8018799,-2405.7841797,28.4301376,0.0000000,0.0000000,0.0000000, 2), --object(lightd, 2), (6, 2),
createObject(18075,1964.9001465,-2408.0332031,28.4232044,0.0000000,0.0000000,270.0000000, 2), --object(lightd, 2), (7, 2),
createObject(18075,1951.8555908,-2408.0336914,28.4297981,0.0000000,0.0000000,270.0000000, 2), --object(lightd, 2), (8, 2),
createObject(14902,1968.0029297,-2455.0112305,15.2011185,0.0000000,0.0000000,269.9918213, 2), --object(veg_pol_window, 2), (3, 2),
createObject(2010,1946.4899902,-2418.4924316,14.6723557,0.0000000,0.0000000,320.0000000, 2), --object(nu_plant3_ofc, 2), (2, 2),
createObject(2010,1955.2817383,-2418.5839844,14.6602631,0.0000000,0.0000000,312.0000000, 2), --object(nu_plant3_ofc, 2), (3, 2),
createObject(3430,1923.9725342,-2457.4528809,14.2021303,0.0000000,0.0000000,0.0000000, 2), --object(vegasbooth01, 2), (1, 2),
createObject(3440,1950.9289551,-2417.8310547,17.0465088,0.0000000,0.0000000,0.0000000, 2), --object(arptpillar01_lvs, 2), (1, 2),
createObject(3440,2149.5537109,-1625.6591797,391.1093140,0.0000000,0.0000000,0.0000000, 2), --object(arptpillar01_lvs, 2), (2, 2),
createObject(3440,2142.7785645,-1630.0373535,391.1093140,0.0000000,0.0000000,250.0000000, 2), --object(arptpillar01_lvs, 2), (3, 2),
createObject(3440,2135.0288086,-1630.0288086,391.1093140,0.0000000,0.0000000,249.9993591, 2), --object(arptpillar01_lvs, 2), (4, 2),
createObject(3440,2131.0749512,-1630.0251465,391.1093140,0.0000000,0.0000000,249.9993591, 2), --object(arptpillar01_lvs, 2), (5, 2),
createObject(3440,2123.3415527,-1630.0316162,391.1093140,0.0000000,0.0000000,249.9993591, 2), --object(arptpillar01_lvs, 2), (6, 2),
createObject(3440,2123.5820312,-1620.9069824,391.1093140,0.0000000,0.0000000,171.4993896, 2), --object(arptpillar01_lvs, 2), (7, 2),
createObject(3440,2131.0837402,-1621.1466064,391.1093140,0.0000000,0.0000000,61.4965820, 2), --object(arptpillar01_lvs, 2), (8, 2),
createObject(3440,2135.0371094,-1621.1444092,391.1093140,0.0000000,0.0000000,61.4959717, 2), --object(arptpillar01_lvs, 2), (9, 2),
createObject(3440,2142.7863770,-1621.1209717,391.1093140,0.0000000,0.0000000,61.4959717, 2), --object(arptpillar01_lvs, 2), (10, 2),
createObject(2657,2149.1801758,-1625.9490967,390.1817932,0.0000000,0.0000000,335.5000000, 2), --object(cj_banner03, 2), (1, 2),
createObject(2656,2149.1909180,-1625.3438721,390.1791687,0.0000000,0.0000000,203.0000000, 2), --object(cj_banner02, 2), (1, 2),
createObject(2661,2132.9172363,-1639.2767334,391.6018066,0.0000000,0.0000000,180.0000000, 2), --object(cj_banner07, 2), (2, 2),
createObject(11453,1933.2629395,-2415.8666992,21.3001957,0.0000000,180.0000000,0.0000000, 2), --object(des_sherrifsgn1, 2), (1, 2),
createObject(11455,1918.9257812,-2465.6413574,20.8609390,0.0000000,180.0000000,90.0000000, 2), --object(des_medcensgn01, 2), (1, 2),
createObject(2735,1956.8834229,-2314.6374512,16.5344982,0.0000000,0.0000000,0.0000000, 2), --object(cj_zip_post_4, 2), (1, 2),
createObject(2734,1956.9058838,-2307.1074219,16.5406876,0.0000000,0.0000000,180.0000000, 2), --object(cj_zip_post_3, 2), (1, 2),
createObject(2886,1958.3956299,-2314.4277344,14.5625772,0.0000000,0.0000000,0.0000000, 2) --object(sec_keypad) (2)
}
--[[
local col = createColSphere(2151.3837890625, -1399.1201171875, 223.6902923584, 99999999999999999)
local function watchChanges( )
if getElementDimension( getLocalPlayer( ) ) > 0 and getElementDimension( getLocalPlayer( ) ) ~= getElementDimension( objects[1] ) and getElementInterior( getLocalPlayer( ) ) == getElementInterior( objects[1] ) then
for key, value in pairs( objects ) do
setElementDimension( value, getElementDimension( getLocalPlayer( ) ) )
end
elseif getElementDimension( getLocalPlayer( ) ) == 0 and getElementDimension( objects[1] ) ~= 65535 then
for key, value in pairs( objects ) do
setElementDimension( value, 65535 )
end
end
end
addEventHandler( "onClientColShapeHit", col,
function( element )
if element == getLocalPlayer( ) then
addEventHandler( "onClientRender", root, watchChanges )
end
end
)
addEventHandler( "onClientColShapeLeave", col,
function( element )
if element == getLocalPlayer( ) then
removeEventHandler( "onClientRender", root, watchChanges )
end
end
)]]
-- Put them standby for now.
for key, value in pairs( objects ) do
--setElementDimension( value, 65535 )
--setElementAlpha( value, 0 )
setElementDoubleSided ( value, true )
setElementCollisionsEnabled ( value, true )
end |
--
-- scenetemplate.lua
--
----------------------------------------------------------------------------------
local composer = require( "composer" )
local scene = composer.newScene()
local function returnFunc( event )
if event.phase == "began" then
print("오버레이 종료")
composer.hideOverlay(false, "zoomOutInFade", 200)
end
end
---------------------------------------------------------------------------------
function scene:create( event )
local sceneGroup = self.view
background = display.newImage(sceneGroup, "image/배경.png", display.contentCenterX, display.contentCenterY)
creditText = display.newText(sceneGroup, "Created by 한재희 in", display.contentCenterX, display.contentCenterY -30)
creditText:setFillColor(0, 0, 0)
credimage = display.newImage(sceneGroup, "image/제작자.png", display.contentCenterX, display.contentCenterY + 30)
returnImage = display.newImage(sceneGroup, "image/뒤로가기.png", display.contentWidth - 50, display.contentHeight - 50)
returnImage:addEventListener("touch", returnFunc)
-- Called when the scene's view does not exist.
--
-- INSERT code here to initialize the scene
-- e.g. add display objects to 'sceneGroup', add touch listeners, etc.
end
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if phase == "will" then
-- Called when the scene is still off screen and is about to move on screen
elseif phase == "did" then
-- Called when the scene is now on screen
--
-- INSERT code here to make the scene come alive
-- e.g. start timers, begin animation, play audio, etc.
end
end
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if event.phase == "will" then
-- Called when the scene is on screen and is about to move off screen
--
-- INSERT code here to pause the scene
-- e.g. stop timers, stop animation, unload sounds, etc.)
elseif phase == "did" then
-- Called when the scene is now off screen
end
end
function scene:destroy( event )
local sceneGroup = self.view
-- Called prior to the removal of scene's "view" (sceneGroup)
--
-- INSERT code here to cleanup the scene
-- e.g. remove display objects, remove touch listeners, save state, etc.
end
---------------------------------------------------------------------------------
-- Listener setup
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )
---------------------------------------------------------------------------------
return scene
|
--[[
Virtual machine for Postscript
This object represents the Postscript "machine",
which is the execution model for the Postscript interpreter.
The machine is the organization point for things like the
various stacks, dictionaries, graphics connection
and whatnot.
You should be able to program against the VM directly
and not just by going through the interpreter. The
interpreter simply uses a scanner and transforms the
text of a postscript program into calls against this
virtual machine.
]]
local ps_common = require("lj2ps.ps_common")
local TokenType = ps_common.TokenType
local Token = ps_common.Token
local ops = require("lj2ps.ps_operators")
local gops = require("lj2ps.ps_graph_operators")
local fops = require("lj2ps.ps_operators_file")
local Stack = require("lj2ps.ps_stack")
local DictionaryStack = require("lj2ps.ps_dictstack")
local Blend2DDriver = require("lj2ps.b2ddriver")
local Scanner = require("lj2ps.ps_scanner")
local octetstream = require("lj2ps.octetstream")
local PSVM = {}
setmetatable(PSVM, {
__call = function(self, ...)
return self:new(...)
end;
})
local PSVM_mt = {
__index = function(self, name)
--print("PSVM.__index: ", self, name)
-- First, if it's one of our object methods
-- use the PSVM defined methods
if PSVM[name] then
-- do the rawset so next time around, there won't be
-- this indirection lookup. This allows an object
-- to absorb the function calls that it actually uses
-- over time
rawset(self, name, PSVM[name])
return PSVM[name]
end
---[[
-- endArray
-- Next, use the DictionaryStack to determine the name of
-- something
if ops[name] then
local func = function() return ops[name](self) end
return func
end
--]]
end;
}
function PSVM.new(self, obj)
obj = obj or {
OperandStack = Stack();
ExecutionStack = Stack();
DictionaryStack = DictionaryStack();
GraphicsStack = Stack();
ClippingPathStack = Stack();
-- Internal stuff
buildProcDepth = 0;
}
obj.buildProcDepth = 0
obj.OperandStack = obj.OperandStack or Stack()
obj.ExecutionStack = obj.ExecutionStack or Stack()
obj.DictionaryStack = obj.DictionaryStack or DictionaryStack()
obj.GraphicsStack = obj.GraphicsStack or Stack()
obj.ClippingPathStack = obj.ClippingPathStack or Stack()
obj.Driver = obj.Driver or Blend2DDriver({dpi=obj.dpi or 192, VM = obj})
setmetatable(obj, PSVM_mt)
-- setup system dictionary
ops["true"] = true
ops["false"] = false
ops["QUIET"] = true
-- obj.systemdict = {}
-- stuff all the operators into the systemdict
obj.DictionaryStack:pushDictionary(ops) -- systemdict, should contain system operators
obj.DictionaryStack:pushDictionary(gops) -- graphics operators
obj.DictionaryStack:pushDictionary(fops) -- file operators
obj.userdict = {}
obj.globaldict = {}
obj.DictionaryStack:pushDictionary(obj.globaldict) -- globaldict
obj.DictionaryStack:pushDictionary(obj.userdict) -- userdict
-- Mark the dictionary stack so that if we do a clear
-- we can stop at the mark
obj.DictionaryStack:mark()
return obj
end
--[[
Built-in functions, NOT operators
]]
function PSVM.beginProc(self)
self.OperandStack:push(ps_common.MARK)
self.buildProcDepth = self.buildProcDepth + 1
end
function PSVM.endProc(self)
--self:pstack()
self:endArray()
local arr = self.OperandStack:pop()
arr.isExecutable = true;
self.buildProcDepth = self.buildProcDepth - 1
return arr
end
function PSVM.isBuildingProc(self)
return self.buildProcDepth > 0
end
function PSVM.execName(self, name)
-- lookup the name
local op = self.DictionaryStack:load(name)
local otype = type(op)
--print("PSVM.execName: ", name, op, otype)
--print("PSVM.execName: ", name, op)
--print("PSVM.execName: ", name)
-- op can either be one of the literal types
-- bool, number, string, null
-- or it's a table or function
-- if it's a table, we need to check whether it's a procedure
-- or an array
if op ~= nil then
if otype == "boolean" or
otype == "number" or
otype == "string" then
self.OperandStack:push(op)
elseif otype == "cdata" then
self.OperandStack:push(op)
elseif otype == "function" then
-- it's a function operator, so execute it
op(self)
elseif type(op) == "table" then
if op.isExecutable then
-- it's a procedure, so run the procedure
self:execArray(op)
else
-- it's just a normal array, or dictionary, so put it on the stack
--print("REGULAR ARRAY")
self.OperandStack:push(op)
end
else
print("UNKNOWN EXECUTABLE TYPE: ", name, otype)
--print("PUSH EXECUTABLE_NAME: ", token.value, op)
--self.Vm.OperandStack:push(op)
end
else
print("UNKNOWN EXECUTABLE_NAME: ", name)
end
return true
end
--[[
Given an executable array, go through and start executing
the elements of that array.
The elements within the array are the same as they were
when the procedure was constructed. All elements are
token objects.
]]
function PSVM.execArray(self, arr)
--print("== EXEC EXECUTABLE ARRAY: ==", arr, #arr)
--print("--- stack ---")
--self:pstack()
--print("----")
-- The array should be filled with tokens
for i=0,#arr-1 do
local value = arr[i]
--print(" ARR: ", value, type(value))
if value.kind then
--print("KIND: ", TokenType[value.kind], value.value)
if value.kind == TokenType.BOOLEAN or
value.kind == TokenType.NUMBER or
value.kind == TokenType.STRING or
value.kind == TokenType.HEXSTRING then
-- BOOLEAN
-- NUMBER
-- STRING
-- HEXSTRING
self.OperandStack:push(value.value)
elseif value.kind == TokenType.OPERATOR then
-- it's a function pointer, so execute it
value.value(self)
elseif value.kind == TokenType.LITERAL_NAME then
-- LITERAL_NAME
self.OperandStack:push(value.value)
elseif value.kind == TokenType.EXECUTABLE_NAME then
-- EXECUTABLE_NAME
self:execName(value.value)
elseif value.kind == TokenType.LITERAL_ARRAY then
-- LITERAL_ARRAY
self.OperandStack:push(value.value)
elseif value.kind == TokenType.PROCEDURE then
-- PROCEDURE
self.OperandStack:push(value.value)
else
print("execArray, UNKNOWN VALUE KIND: ", value.kind, value.value)
end
end
end
end
-- binding an array, basically reconstructing a
-- procedure binding ops to their actual functions
function PSVM.bindArray(self, arr)
--print("BIND EXECUTABLE ARRAY: ", #arr)
--print("--- stack ---")
--self.Vm:pstack()
--print("----")
for i=0,#arr-1 do
local tok = arr[i]
--print(" PSVM.bindArray; ARR: ", type(tok), tok)
if tok.kind then
--print("bindArray, KIND: ", TokenType[tok.kind], tok.value)
if tok.kind == TokenType.BOOLEAN or
tok.kind == TokenType.NUMBER or
tok.kind == TokenType.STRING or
tok.kind == TokenType.HEXSTRING then
-- BOOLEAN
-- NUMBER
-- STRING
-- HEXSTRING
-- For these literals, just push the token back
-- on the operand stack
self.OperandStack:push(tok)
elseif tok.kind == TokenType.LITERAL_NAME then
-- LITERAL_NAME
self.OperandStack:push(tok)
elseif tok.kind == TokenType.EXECUTABLE_NAME then
-- lookup the executable thing and put that on the stack
local op = self.DictionaryStack:load(tok.value)
if op and type(op) == "function" then
local functok = Token{kind = TokenType.OPERATOR, value=op}
self.OperandStack:push(functok)
else
-- it's not a function, so just put the
-- name back on the stack for later lookup
self.OperandStack:push(tok)
end
elseif tok.kind == TokenType.LITERAL_ARRAY then
-- LITERAL_ARRAY
self.OperandStack:push(tok)
elseif tok.kind == TokenType.PROCEDURE then
-- PROCEDURE
-- put the procedure back on the stack
self.OperandStack:push(tok)
else
print("BIND UNKNOWN VALUE KIND: ", value.kind, value.value)
end
end
end
end
--[[
Bind is more than just a simple optimization. It
allows you to lock in an implementation of an operator
before the user introduces their own version of it.
So, for example, when you have the following
/bdef {bind def} bind def
You are creating a procedure "bdef", and in this case,
we want to lock in the implementation of the 'bind' and 'def'
operators within the procedure body.
bind(), will replace the names 'bind' and 'def' with pointers
to the actual operators. This will do two things.
1) Save on the lookup of the executable name when the
procedure is actually executed
2) Ensure we are using the base implementation of the operator
rather than anything the user might replace it with later
Functionally, we essentially create a new procedure body by
enumerating all the elements in the procedure that's on the top
of the stack. Then we put that new procedure on the top of the
stack, ready for usage, typically a 'def' to save it in a variable.
]]
function PSVM.bind(self)
--print("PSVM.BIND")
-- pop executable array off of stack
local arr = self.OperandStack:pop()
self:beginProc()
-- hand it to bind array
self:bindArray(arr)
-- put it back on the stack
arr = self:endProc()
self.OperandStack:push(arr)
end
function PSVM.runStream(self, bs)
local scnr = Scanner(self, bs)
-- Iterate through tokens
for _, token in scnr:tokens(bs) do
--print("INTERP: ", token.kind, token.value)
if TokenType[token.kind] == nil then
-- it's some other literal value type
print("INTERP, UNKNOWN Token Kind: ", token.kind)
--print("INTERP, push: ", TokenType[token.kind], token.value)
--self.OperandStack:push(token.value)
elseif token.kind == TokenType.EXECUTABLE_NAME then
--print(" PSVM.runstream(self.Vm:execName): ", token.value)
self:execName(token.value)
else
self.OperandStack:push(token.value)
end
end
end
function PSVM.eval(self, bs)
if type(bs) == "string" then
bs = octetstream(bs)
end
return self:runStream(bs)
end
function PSVM.runFile(self, filename)
local f = io.open(filename, "r")
if not f then
error("PSVM.runFile, error: ", f, filename)
--return nil, "file not opened: "..filename
end
local bytes = f:read("*a")
f:close()
local bs = octetstream(bytes)
self.CurrentFile = bs
return self:runStream(bs)
end
return PSVM
|
local socket = require("socket")
local function read(net, size)
return net.conn:receive(size)
end
local function write(net, data)
return net.conn:send(data)
end
local function close(net)
return net.conn:close()
end
local function settimeout(net, v)
net.conn:settimeout(v)
end
local meta = {
__index = {
read = read,
write = write,
close = close,
settimeout = settimeout
}
}
local function open(host, port)
local conn = socket.tcp()
local succ, msg = conn:connect(host, port)
if not succ then
return nil, msg
end
conn:settimeout(1000)
local net = { conn = conn }
return setmetatable(net, meta)
end
--------------------------------------------------------------------------------
-- Module
return { open = open }
|
ARC.kMoveSpeed = 1.2 -- was 2.0
ARC.kCombatMoveSpeed = 0.4 -- was 0.8
function ARC:GetIsSighted()
return true
end
if Server then
local oldOnUpdate = ARC.OnUpdate
local function findTarget(targets, arcOrigin, targetSearching, distToTarget, target)
if targetSearching then
for _, enemy in ipairs (targets) do
if enemy:GetIsAlive() and (enemy:GetIsSighted() or GetIsTargetDetected(enemy)) then
local distToTargetSub = (enemy:GetOrigin() - arcOrigin):GetLengthXZ()
if (distToTargetSub < distToTarget) then
target = enemy
distToTarget = distToTargetSub
targetSearching = false
break
end
end
end
end
return targetSearching, distToTarget, target
end
function ARC:OnUpdate(deltaTime)
oldOnUpdate(self, deltaTime)
if not self.parasited then
-- todo: Do something less hacky
self:SetParasited()
end
if self.deployMode == ARC.kDeployMode.Undeployed or self.deployMode == ARC.kDeployMode.Deployed then
local teamNumber = GetEnemyTeamNumber(self:GetTeamNumber())
local arcOrigin = self:GetOrigin()
-- prio: hive, shade, crag, entrance, whip
local enemyCCs = GetEntitiesForTeam("CommandStructure", teamNumber)
local distToTarget = math.huge
local target
-- find nearest hive
for _, enemy in ipairs (enemyCCs) do
if enemy:GetIsAlive() then
local distToTargetSub = (enemy:GetOrigin() - arcOrigin):GetLengthXZ()
if (distToTargetSub < distToTarget) then
target = enemy
distToTarget = distToTargetSub
break
end
end
end
local targetSearching = true
-- find nearest shade
local enemyGSs = GetEntitiesForTeam("GorgeShade", teamNumber, arcOrigin, kARCRangeDetection)
targetSearching, distToTarget, target = findTarget(enemyGSs, arcOrigin, targetSearching, distToTarget, target)
-- find nearest crag
if targetSearching then
local enemyGCs = GetEntitiesForTeam("GorgeCrag", teamNumber, arcOrigin, kARCRangeDetection)
targetSearching, distToTarget, target = findTarget(enemyGCs, arcOrigin, targetSearching, distToTarget, target)
end
-- find nearest tunnel
if targetSearching then
local entrances = GetEntitiesForTeam("TunnelEntrance", teamNumber, arcOrigin, kARCRangeDetection)
targetSearching, distToTarget, target = findTarget(entrances, arcOrigin, targetSearching, distToTarget, target)
end
-- find nearest Whip
if targetSearching then
local enemyGWs = GetEntitiesForTeam("GorgeWhip", teamNumber, arcOrigin, kARCRangeDetection)
targetSearching, distToTarget, target = findTarget(enemyGWs, arcOrigin, targetSearching, distToTarget, target)
end
if distToTarget < kARCRange - 2 then
if self.deployMode == ARC.kDeployMode.Undeployed then
self:GiveOrder(kTechId.ARCDeploy, self:GetId(), arcOrigin, nil, true, true)
end
else -- if self:GetCurrentOrder() == nil or self:GetCurrentOrder():GetType() ~= kTechId.Move then
if self.deployMode == ARC.kDeployMode.Undeployed then
if target then
self:GiveOrder(kTechId.Move, target:GetId(), target:GetOrigin(), nil, true, true)
end
else
self:PerformActivation(kTechId.ARCUndeploy, nil, nil, nil)
end
end
end
end
end |
local telescope = require('telescope')
telescope.setup {defaults = {file_ignore_patterns = {"node_modules"}}}
|
-- Yes, I'm American. --
local tokenize = function(sep, ...) -- String, and the separator to look for in said string
local words = table.new()
local str = table.concat({...}, sep)
for word in str:gmatch("[^" .. sep .. "]+") do
words:insert(word)
end
return words
end
return tokenize
|
-- see readme.md
-- @author Quenty
--[[
Update August 16th, 2014
- Any module with the name "Server" in it is not replicated, to prevent people from stealing
nevermore's complete source.
]]
local NevermoreEngine = {}
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local TestService = game:GetService("TestService")
local StarterGui = game:GetService("StarterGui")
local RunService = game:GetService("RunService")
local ContentProvider = game:GetService("ContentProvider")
local ServerStorage
local ServerScriptService
-- local RbxUtility = LoadLibrary("RbxUtility")
local Configuration = {
ClientName = "NevermoreClient";
ReplicatedPackageName = "NevermoreResources";
DataSteamName = "NevermoreDataStream";
NevermoreRequestPrefix = "NevermoreEngineRequest"; -- For network requests, what should it prefix it as?
IsClient = script.Parent ~= nil;
SoloTestMode = game:FindService("NetworkServer") == nil and game:FindService("NetworkClient") == nil;
Blacklist = ""; -- Ban list
CustomCharacters = false; -- When enabled, allows the client to set Player.Character itself. Untested!
SplashScreen = true; -- Should a splashscreen be rendered?
CharacterRespawnTime = 0.5; -- How long does it take for characters to respawn? Only kept updated on the server-side.
ResetPlayerGuiOnSpawn = false; -- Set StarterGui.ResetPlayerGuiOnSpawn --- NOTE the client script must reparent itself to the PlayerGui
}
Configuration.IsServer = not Configuration.IsClient
do
-- Print headers are used to help debugging process
if Configuration.SoloTestMode then
Configuration.PrintHeader = "[NevermoreEngineSolo] - "
else
if Configuration.IsServer then
Configuration.PrintHeader = "[NevermoreEngineServer] - "
else
Configuration.PrintHeader = "[NevermoreEngineLocal] - "
end
end
local Output = Configuration.PrintHeader .. "NevermoreEngine loaded. Modes: "
-- Print out information on whether or not FilteringEnabled is up or not.
if workspace.FilteringEnabled then
Output = Output .. " Filtering enabled. "
end
-- Print out whether or not ResetPlayerGuiOnSpawn is enabled or not.
if not Configuration.ResetPlayerGuiOnSpawn or not StarterGui.ResetPlayerGuiOnSpawn then
Output = Output .. " GUIs will not reload."
StarterGui.ResetPlayerGuiOnSpawn = false
end
print(Output)
end
Players.CharacterAutoLoads = false
-- If we're the server than we should retrieve server storage units.
if not Configuration.IsClient then
ServerStorage = game:GetService("ServerStorage")
ServerScriptService = game:GetService("ServerScriptService")
end
-----------------------
-- UTILITY FUNCTIONS --
-----------------------
local function WaitForChild(Parent, Name)
--- Yields until a child is added. Warns after 5 seconds of yield.
-- @param Parent The parent to wait for the child of
-- @param Name The name of the child
-- @return The child found
local Child = Parent:FindFirstChild(Name)
local StartTime = tick()
local Warned = false
while not Child do
wait(0)
Child = Parent:FindFirstChild(Name)
if not Warned and StartTime + 5 <= tick() then
Warned = true;
warn(Configuration.PrintHeader .. " " .. Name .. " has not replicated after 5 seconds, may not be able to execute Nevermore.")
end
end
return Child
end
local function pack(...)
--- Packs a tuple into a table and returns it
-- @return The packed tuple
return {...}
end
------------------------------
-- Load Dependent Resources --
------------------------------
local NevermoreContainer, ModulesContainer, ApplicationContainer, ReplicatedPackage, DataStreamContainer, EventStreamContainer
do
local function LoadResource(Parent, ResourceName)
--- Loads a resource or errors. Makes sure that a resource is available.
-- @param Parent The parent of the resource to load
-- @param ResourceName The name of the resource attempting to load
assert(type(ResourceName) == "string", "[NevermoreEngine] - ResourceName '" .. tostring(ResourceName) .. "' is " .. type(ResourceName) .. ", should be string")
local Resource = Parent:FindFirstChild(ResourceName)
if not Resource then
error(Configuration.PrintHeader .. "Failed to load required resource '" .. ResourceName .. "', expected at '" .. Parent:GetFullName() .. "'", 2)
return nil
else
return Resource
end
end
if Configuration.IsServer then
-- Load Resources --
NevermoreContainer = LoadResource(ServerScriptService, "Nevermore")
ModulesContainer = LoadResource(NevermoreContainer, "Modules")
ApplicationContainer = LoadResource(NevermoreContainer, "App")
-- Create the replicated package --
ReplicatedPackage = ReplicatedStorage:FindFirstChild(Configuration.ReplicatedPackageName)
if not ReplicatedPackage then
ReplicatedPackage = Instance.new("Folder")
ReplicatedPackage.Name = Configuration.ReplicatedPackageName
ReplicatedPackage.Parent = ReplicatedStorage
ReplicatedPackage.Archivable = false;
end
ReplicatedPackage:ClearAllChildren()
DataStreamContainer = ReplicatedPackage:FindFirstChild("DataStreamContainer")
if not DataStreamContainer then
DataStreamContainer = Instance.new("Folder")
DataStreamContainer.Name = "DataStreamContainer"
DataStreamContainer.Parent = ReplicatedPackage
DataStreamContainer.Archivable = false;
end
EventStreamContainer = ReplicatedPackage:FindFirstChild("EventStreamContainer")
if not EventStreamContainer then
EventStreamContainer = Instance.new("Folder")
EventStreamContainer.Name = "EventStreamContainer"
EventStreamContainer.Parent = ReplicatedPackage
EventStreamContainer.Archivable = false;
end
DataStreamContainer:ClearAllChildren()
else
-- Handle replication for clients
-- Load Resource Package --
ReplicatedPackage = WaitForChild(ReplicatedStorage, Configuration.ReplicatedPackageName)
DataStreamContainer = WaitForChild(ReplicatedPackage, "DataStreamContainer")
EventStreamContainer = WaitForChild(ReplicatedPackage, "EventStreamContainer")
end
end
--print(Configuration.PrintHeader .. "Loaded dependent resources module")
------------------------
-- RESOURCE MANAGMENT --
------------------------
local NetworkingRemoteFunction
local ResouceManager = {} do
--- Handles resource loading and replication
local ResourceCache = {}
local MainResourcesServer, MainResourcesClient
if Configuration.IsServer then
MainResourcesServer = {} -- Resources to load.
MainResourcesClient = {}
else
MainResourcesClient = {}
end
local function GetDataStreamObject(Name, Parent)
--- Products a new DataStream object if it doesn't already exist, otherwise
-- return's the current datastream.
-- @param Name The Name of the DataStream
-- @param [Parent] The parent to add to
Parent = Parent or DataStreamContainer
local DataStreamObject = Parent:FindFirstChild(Name)
if not DataStreamObject then
if Configuration.IsServer then
DataStreamObject = Instance.new("RemoteFunction")
DataStreamObject.Name = Name;
DataStreamObject.Archivable = false;
DataStreamObject.Parent = Parent
else
DataStreamObject = WaitForChild(Parent, Name) -- Client side, we must wait.'
end
end
return DataStreamObject
end
ResouceManager.GetDataStreamObject = GetDataStreamObject
local function GetEventStreamObject(Name, Parent)
--- Products a new EventStream object if it doesn't already exist, otherwise
-- return's the current datastream.
-- @param Name The Name of the EventStream
-- @param [Parent] The parent to add to
Parent = Parent or EventStreamContainer
local DataStreamObject = Parent:FindFirstChild(Name)
if not DataStreamObject then
if Configuration.IsServer then
DataStreamObject = Instance.new("RemoteEvent")
DataStreamObject.Name = Name;
DataStreamObject.Archivable = false;
DataStreamObject.Parent = Parent
else
DataStreamObject = WaitForChild(Parent, Name) -- Client side, we must wait.
end
end
return DataStreamObject
end
ResouceManager.GetEventStreamObject = GetEventStreamObject
if Configuration.IsClient then
NetworkingRemoteFunction = WaitForChild(DataStreamContainer, Configuration.DataSteamName)
else
NetworkingRemoteFunction = GetDataStreamObject(Configuration.DataSteamName, DataStreamContainer)
end
local function IsMainResource(Item)
--- Finds out if an Item is considered a MainResource
-- @return Boolean is a main resource
if Item:IsA("Script") then
if not Item.Disabled then
-- If an item is not disabled, then it's disabled, but yell at
-- the user.
--if Item.Name:lower():match("\.main$") == nil then
error(Configuration.PrintHeader .. Item:GetFullName() .. " is not disabled, and does not end with .Main.")
--end
return true
end
return Item.Name:lower():match("\.main$") ~= nil -- Check to see if it ends
-- in .main, ignoring caps
else
return false;
end
end
local function GetLoadablesForServer()
--- Get's the loadable items for the server, that should be insta-ran
-- @return A table full of the resources to be loaded
return MainResourcesServer
end
ResouceManager.GetLoadablesForServer = GetLoadablesForServer
local function GetLoadablesForClient()
--- Get's the loadable items for the Client, that should be insta-ran
-- @return A table full of the resources to be loaded
return MainResourcesClient
end
ResouceManager.GetLoadablesForClient = GetLoadablesForClient
local PopulateResourceCache
if Configuration.IsClient then
function PopulateResourceCache()
--- Populates the resource cache. For the client.
-- Should only be called once. Used internally.
local Populate
function Populate(Parent)
for _, Item in pairs(Parent:GetChildren()) do
if (Item:IsA("LocalScript") or Item:IsA("ModuleScript")) then
ResourceCache[Item.Name] = Item;
if IsMainResource(Item) then
MainResourcesClient[#MainResourcesClient+1] = Item;
end
else
Populate(Item)
end
end
end
Populate(ReplicatedPackage)
end
else -- Configuration.IsServer then
function PopulateResourceCache()
--- Populates the resource cache. For the server. Also populates
-- the replication cache. Used internally.
-- Should be called once.
--[[local NevermoreModule = script:Clone()
NevermoreModule.Archivable = false;
NevermoreModule.Parent = ReplicatedStorage--]]
local function Populate(Parent)
for _, Item in pairs(Parent:GetChildren()) do
if Item:IsA("Script") or Item:IsA("ModuleScript") then -- Will catch LocalScripts as they inherit from script
if ResourceCache[Item.Name] then
error(Configuration.PrintHeader .. "There are two Resources called '" .. Item:GetFullName() .."'. Nevermore failed to populate the cache..", 2)
else
if Item:IsA("LocalScript") or Item:IsA("ModuleScript") then
-- Clone the item into the replication packet for
-- replication. However, we do not clone server scripts.
--[[local ItemClone
if not (Item:IsA("ModuleScript") and Item.Name:lower():find("server")) then -- Don't clone scripts with the name "server" in it.
ItemClone = Item:Clone()
ItemClone.Archivable = false;
ItemClone.Parent = ReplicatedPackage
else
print("Not cloning resource '" .. Item.Name .."' as it is server only.")
end
if Item:IsA("ModuleScript") then
ResourceCache[Item.Name] = ItemClone or Item;
elseif IsMainResource(Item) then
MainResourcesClient[#MainResourcesClient+1] = Item
end--]]
if not (Item:IsA("ModuleScript") and Item.Name:lower():find("server")) then
if not Configuration.SoloTestMode then -- Do not move parents in SoloTestMode (keeps the error monitoring correct).
Item.Parent = ReplicatedPackage
end
end
if Item:IsA("ModuleScript") then
ResourceCache[Item.Name] = Item
elseif IsMainResource(Item) then
MainResourcesClient[#MainResourcesClient+1] = Item
end
else -- Do not replicate local scripts
if IsMainResource(Item) then
MainResourcesServer[#MainResourcesServer+1] = Item
end
ResourceCache[Item.Name] = Item
end
end
else
Populate(Item)
--error(Configuration.PrintHeader .. "The resource '" .. Item:GetFullName() .."' is not a LocalScript, Script, or ModuleScript, and cannot be included. Nevermore failed to populate the cache..", 2)
end
end
end
Populate(ModulesContainer)
end
end
ResouceManager.PopulateResourceCache = PopulateResourceCache
local function GetResource(ResourceName)
--- This script will load another script, module script, et cetera, if it is
-- available. It will return the resource in question.
-- @param ResourceName The name of the resource
-- @return The found resource
local ResourceFound = ResourceCache[ResourceName]
if ResourceFound then
return ResourceFound
else
error(Configuration.PrintHeader .. "The resource '" .. ResourceName .. "' does not exist, cannot load", 2)
end
end
ResouceManager.GetResource = GetResource
local function LoadScript(ScriptName)
--- Runs a script, and can be called multiple times if the script is not
-- a modular script.
-- @param ScriptName The name of the script to load.
local ScriptToLoad = GetResource(ScriptName)
if ScriptToLoad and ScriptToLoad:IsA("Script") then
local NewScript = ScriptToLoad:Clone()
NewScript.Disabled = true;
--[[if Configuration.SoloTestMode then
if NewScript:IsA("LocalScript") then
NewScript.Parent = Players.LocalPlayer:FindFirstChild("PlayerGui")
else
NewScript.Parent = script;
end
else
NewScript.Parent = script;
end--]]
if Configuration.IsServer then
NewScript.Parent = NevermoreContainer;
else
NewScript.Parent = Players.LocalPlayer:FindFirstChild("PlayerGui")
end
spawn(function()
wait(0)
NewScript.Disabled = false;
end)
else
error(Configuration.PrintHeader .. "The script '" .. ScriptName .. "' is a '".. (ScriptToLoad and ScriptToLoad.ClassName or "nil value") .. "' and cannot be loaded", 2)
end
end
ResouceManager.LoadScript = LoadScript
if Configuration.IsServer then
local function LoadScriptOnClient(Script, Client)
--- Runs a script on the client. Used internally.
-- @param Script The script to load. Should be a script object
-- @param Client The client to run the script on. Should be a Player
-- object
if Script and Script:IsA("LocalScript") then
local NewScript = Script:Clone()
NewScript.Disabled = true;
NewScript.Parent = Client:FindFirstChild("PlayerGui")
spawn(function()
wait(0)
NewScript.Disabled = false;
end)
else
error(Configuration.PrintHeader .. "The script '" .. tostring(Script) .. "' is a '" .. (Script and Script.ClassName or "nil value") .. "' and cannot be loaded", 2)
end
end
ResouceManager.LoadScriptOnClient = LoadScriptOnClient
local function ExecuteExecutables()
--- Executes all the executable scripts on the server.
for _, Item in pairs(GetLoadablesForServer()) do
LoadScript(Item.Name)
end
end
ResouceManager.ExecuteExecutables = ExecuteExecutables
end
--[[local NativeImports
local function ImportLibrary(LibraryDefinition, Environment, Prefix)
--- Imports a library into a given environment, potentially adding a PreFix
-- into any of the values of the library,
-- incase that's wanted. :)
-- @param LibraryDefinition Table, the libraries definition
-- @param Environment Another table, probably received by getfenv() in Lua 5.1, and __ENV in Lua 5.2
-- @Param [Prefix] Optional string that will be prefixed to each function imported into the environment.
if type(LibraryDefinition) ~= "table" then
error(Configuration.PrintHeader .. "The LibraryDefinition argument must be a table, got '" .. tostring(LibraryDefinition) .. "'", 2)
elseif type(Environment) ~= "table" then
error(Configuration.PrintHeader .. "The Environment argument must be a table, got '" .. tostring(Environment) .. "'", 2)
else
Prefix = Prefix or "";
for Name, Value in pairs(LibraryDefinition) do
if Environment[Prefix .. Name] == nil and not NativeImports[Name] then
Environment[Prefix .. Name] = LibraryDefinition[Name]
elseif not NativeImports[Name] then
error(Configuration.PrintHeader .. "Failed to import function '" .. (Prefix .. Name) .. "' as it already exists in the environment", 2)
end
end
end
end
ResouceManager.ImportLibrary = ImportLibrary
-- List of functions to import into each library. In this case, only the
-- environmental import functions and added to each library.
NativeImports = {
import = ImportLibrary;
Import = ImportLibrary;
}--]]
local function LoadLibrary(LibraryName)
--- Load's a modular script and packages it as a library.
-- @param LibraryName A string of the resource that ist the LibraryName
-- print(Configuration.PrintHeader .. "Loading Library " .. LibraryName)
local ModularScript = GetResource(LibraryName)
if ModularScript then
if ModularScript:IsA("ModuleScript") then
-- print(Configuration.PrintHeader .. "Loading Library " .. ModularScript:GetFullName())
local LibraryDefinition = require(ModularScript)
--[[if type(LibraryDefinition) == "table" then
-- Import native definitions
for Name, Value in pairs(NativeImports) do
if LibraryDefinition[Name] == nil then
LibraryDefinition[Name] = Value
end
end
--else
--error(Configuration.PrintHeader .. " Library '" .. LibraryName .. "' did not return a table, returned a '" .. type(LibraryDefinition) .. "' value, '" .. tostring(LibraryDefinition) .. "'")
end--]]
return LibraryDefinition
else
error(Configuration.PrintHeader .. " The resource " .. LibraryName
.. " is not a ModularScript, as expected, it is a "
.. ModularScript.ClassName, 2
)
end
else
error(Configuration.PrintHeader .. " Could not identify a library known as '" .. LibraryName .. "'", 2)
end
end
ResouceManager.LoadLibrary = LoadLibrary
end
--print(Configuration.PrintHeader .. "Loaded resource manager module")
-----------------------------
-- NETWORKING STREAM SETUP --
-----------------------------
local Network = {} -- API goes in here
--[[
Contains the following API:
Network.GetDataStream
Network.GetDataStream
--]]
do
--- Handles networking and PlayerLoading
local DataStreamMain
local GetDataStream
local DataStreamCache = {}
-- setmetatable(DataStreamCache, {__mode = "v"});
local function GetCachedDataStream(RemoteFunction)
--- Creates a datastream filter that will take requests and
-- filter them out.
-- @param RemoteFunction A remote function to connect to
-- Execute on the server:
--- Execute ( Player Client , [...] )
-- Execute on the client:
--- Execute ( [...] )
if DataStreamCache[RemoteFunction] then
if Configuration.IsClient then
DataStreamCache[RemoteFunction].ReloadConnection()
end
return DataStreamCache[RemoteFunction]
else
local DataStream = {}
local RequestTagDatabase = {}
-- Set request handling, for solo test mode. The problem here is that Server and Client scripts share the same
-- code base, because both load the same engine in replicated storage.
local function Send(...)
-- print(Configuration.PrintHeader .. " Sending SoloTestMode")
-- print(...)
local Arguments = {...}
local PossibleClient = Arguments[1]
if PossibleClient and type(PossibleClient) == "userdata" and PossibleClient:IsA("Player") then
local Request = Arguments[2]
if type(Request) == "string" then
local OtherArguments = {}
for Index=3, #Arguments do
OtherArguments[#OtherArguments+1] = Arguments[Index]
end
return RemoteFunction:InvokeClient(PossibleClient, Request:lower(), unpack(OtherArguments))
else
error(Configuration.PrintHeader .. "Invalid request to the DataStream, DataType '" .. type(Request) .. "' received. Resolved into '" .. tostring(Request) .. "'")
return nil
end
elseif type(PossibleClient) == "string" then
local Request = PossibleClient
if type(Request) == "string" then
local OtherArguments = {}
for Index=2, #Arguments do
OtherArguments[#OtherArguments+1] = Arguments[Index]
end
-- print("Invoke server")
return RemoteFunction:InvokeServer(Request:lower(), unpack(OtherArguments))
else
error(Configuration.PrintHeader .. "Invalid request to the DataStream, DataType '" .. type(Request) .. "' received. Resolved into '" .. tostring(Request) .. "'")
return nil
end
else
error(Configuration.PrintHeader .. "Invalid request to the DataStream, DataType '" .. type(PossibleClient))
end
end
local function SpawnSend(...)
--- Sends the data, but doesn't wait for a response or return one.
local Data = {...}
spawn(function()
Send(unpack(Data))
end)
end
if Configuration.IsServer or Configuration.SoloTestMode then
function RemoteFunction.OnServerInvoke(Client, Request, ...)
--- Handles incoming requests
-- @param Client The client the request is being sent to
-- @param Request The request string that is being sent
-- @param [...] The extra parameters of the request
-- @return The results, if successfully executed
if type(Request) == "string" then
-- print(Configuration.PrintHeader .. "Server request received")
-- print(...)
if Client == nil then
if Configuration.SoloTestMode then
Client = Players.LocalPlayer
else
error(Configuration.PrintHeader .. "No client provided")
end
end
local RequestExecuter = RequestTagDatabase[Request:lower()]
local RequestArguments = {...}
if RequestExecuter then
--[[local Results
Results = pack(RequestExecuter(Client, unpack(RequestArguments)))
return unpack(Results)--]]
return RequestExecuter(Client, unpack(RequestArguments))
else
warn(Configuration.PrintHeader .. "Unregistered request called, request tag '" .. Request .. "'.")
return nil
end
else
warn(Configuration.PrintHeader .. "Invalid request to the DataStream, DataType '" .. type(Request) .. "' received. Resolved into '" .. tostring(Request) .. "'")
return nil
end
end
if not Configuration.SoloTestMode then
function Send(Client, Request, ...)
--- Sends a request to the client
-- @param Client Player object, the client to send the request too
-- @param Request the request to send it too.
-- @return The results / derived data from the feedback
-- DEBUG --
--print(Configuration.PrintHeader .. " Sending Request '" .. Request .. "' to Client '" .. tostring(Client) .. "'.")
return RemoteFunction:InvokeClient(Client, Request:lower(), ...)
end
end
end
if Configuration.IsClient or Configuration.SoloTestMode then -- Handle clientside streaming.
-- We do this for solotest mode, to connect the OnClientInvoke and the OnServerInvoke
function DataStream.ReloadConnection()
--- Reloads the OnClientInvoke event, which gets disconnected when scripts die on the client.
-- However, this fixes it, because those scripts have to request the events every time.
--[[
-- Note: When using RemoteFunctions, in a module script, on ROBLOX, and you load the ModuleScript
with a LOCAL SCRIPT. When this LOCAL SCRIPT is killed, your OnClientInvoke function will be GARBAGE
COLLECTED. You must thus, reload the OnClientInvoke function everytime the local script is loaded.
--]]
function RemoteFunction.OnClientInvoke(Request, ...)
--- Handles incoming requests
-- @param Request The request string that is being sent
-- @param [...] The extra parameters of the request
-- @return The results, if successfully executed
if type(Request) == "string" then
-- print(Configuration.PrintHeader .. "Client request received")
-- print(...)
local RequestExecuter = RequestTagDatabase[Request:lower()]
local RequestArguments = {...}
if RequestExecuter then
spawn(function()
RequestExecuter(unpack(RequestArguments))
end)
else
-- warn(Configuration.PrintHeader .. "Unregistered request called, request tag '" .. Request .. "'.")
end
else
error(Configuration.PrintHeader .. "Invalid request to the DataStream, DataType '" .. type(Request) .. "' received. Resolved into '" .. tostring(Request) .. "'")
end
end
end
--- Reload the initial connection.
DataStream.ReloadConnection()
if not Configuration.SoloTestMode then
function Send(Request, ...)
--- Sends a request to the server
-- @param Request the request to send it too.
-- @return The results / derived data from the feedback
return RemoteFunction:InvokeServer(Request:lower(), ...)
end
end
end
DataStream.Send = Send
DataStream.send = Send
DataStream.Call = Send
DataStream.call = Send
DataStream.SpawnSend = SpawnSend
DataStream.spawnSend = SpawnSend
DataStream.spawn_send = SpawnSend
local function RegisterRequestTag(RequestTag, Execute)
--- Registers a request when sent
-- @param RequestTag The tag that is expected
-- @param Execute The functon to execute. It will be sent
-- all remainig arguments.
-- Request tags are not case sensitive
--if not RequestTagDatabase[RequestTag:lower()] then
RequestTagDatabase[RequestTag:lower()] = Execute;
--else
--error(Configuration.PrintHeader .. "The request tag " .. RequestTag:lower() .. " is already registered.")
--end
end
DataStream.RegisterRequestTag = RegisterRequestTag
DataStream.registerRequestTag = RegisterRequestTag
local function UnregisterRequestTag(RequestTag)
--- Unregisters the request from the tag
-- @param RequestTag String the tag to reregister
RequestTagDatabase[RequestTag:lower()] = nil;
end
DataStream.UnregisterRequestTag = UnregisterRequestTag
DataStream.unregisterRequestTag = UnregisterRequestTag
DataStreamCache[RemoteFunction] = DataStream
return DataStream
end
end
local function GetCachedEventStream(RemoteEvent)
-- Like GetCachedDataStream, but with RemoteEvents
-- @param RemoteEvent The remote event to get the stream for.
if DataStreamCache[RemoteEvent] then
if Configuration.IsClient then
DataStreamCache[RemoteEvent].ReloadConnection()
end
return DataStreamCache[RemoteEvent]
else
local DataStream = {}
local RequestTagDatabase = {}
local function Fire(...)
local Arguments = {...}
local PossibleClient = Arguments[1]
if PossibleClient and type(PossibleClient) == "userdata" and PossibleClient:IsA("Player") then
local Request = Arguments[2]
if type(Request) == "string" then
local OtherArguments = {}
for Index=3, #Arguments do
OtherArguments[#OtherArguments+1] = Arguments[Index]
end
return RemoteEvent:FireClient(PossibleClient, Request:lower(), unpack(OtherArguments))
else
error(Configuration.PrintHeader .. "Invalid request to the DataStream, DataType '" .. type(Request) .. "' received. Resolved into '" .. tostring(Request) .. "'")
return nil
end
elseif type(PossibleClient) == "string" then
local Request = PossibleClient
if type(Request) == "string" then
local OtherArguments = {}
for Index=2, #Arguments do
OtherArguments[#OtherArguments+1] = Arguments[Index]
end
return RemoteEvent:FireServer(Request:lower(), unpack(OtherArguments))
else
error(Configuration.PrintHeader .. "Invalid request to the DataStream, DataType '" .. type(Request) .. "' received. Resolved into '" .. tostring(Request) .. "'")
return nil
end
else
error(Configuration.PrintHeader .. "Invalid request DataType to the DataStream, DataType '" .. type(PossibleClient) .. "', String expected.")
end
end
local function FireAllClients(Request, ...)
if type(Request) == "string" then
RemoteEvent:FireAllClients(Request, ...)
else
error(Configuration.PrintHeader .. "Invalid reques DataType to the DataStream, DataType '" .. type(Request))
end
end
if Configuration.IsServer or Configuration.SoloTestMode then
RemoteEvent.OnServerEvent:connect(function(Client, Request, ...)
--- Handles incoming requests
-- @param Client The client the request is being sent to
-- @param Request The request string that is being sent
-- @param [...] The extra parameters of the request
-- @return The results, if successfully executed
if type(Request) == "string" then
if Client == nil then
if Configuration.SoloTestMode then
Client = Players.LocalPlayer
else
error(Configuration.PrintHeader .. "No client provided")
end
end
local RequestExecuter = RequestTagDatabase[Request:lower()]
local RequestArguments = {...}
if RequestExecuter then
RequestExecuter(Client, unpack(RequestArguments))
else
-- warn(Configuration.PrintHeader .. "Unregistered request called, request tag '" .. Request .. "'.")
end
else
error(Configuration.PrintHeader .. "Invalid request to the DataStream, DataType '" .. type(Request) .. "' received. Resolved into '" .. tostring(Request) .. "'")
end
end)
if not Configuration.SoloTestMode then
function Fire(Client, Request, ...)
--- Sends a request to the client
-- @param Client Player object, the client to send the request too
-- @param Request the request to send it too.
-- @return The results / derived data from the feedback
RemoteEvent:FireClient(Client, Request:lower(), ...)
end
end
end
if Configuration.IsClient or Configuration.SoloTestMode then -- Handle clientside streaming.
-- We do this for solotest mode, to connect the OnClientInvoke and the OnServerInvoke
local Event
function DataStream.ReloadConnection()
--- Reloads the OnClientInvoke event, which gets disconnected when scripts die on the client.
-- However, this fixes it, because those scripts have to request the events every time.
if Event then
Event:disconnect()
end
Event = RemoteEvent.OnClientEvent:connect(function(Request, ...)
--- Handles incoming requests
-- @param Request The request string that is being sent
-- @param [...] The extra parameters of the request
-- @return The results, if successfully executed
if type(Request) == "string" then
local RequestExecuter = RequestTagDatabase[Request:lower()]
local RequestArguments = {...}
if RequestExecuter then
spawn(function()
RequestExecuter(unpack(RequestArguments))
end)
else
-- warn(Configuration.PrintHeader .. "Unregistered request called, request tag '" .. Request .. "'.")
end
else
error(Configuration.PrintHeader .. "Invalid request to the DataStream, DataType '" .. type(Request) .. "' received. Resolved into '" .. tostring(Request) .. "'")
end
end)
end
--- Reload the initial connection.
DataStream.ReloadConnection()
if not Configuration.SoloTestMode then
function Fire(Request, ...)
--- Sends a request to the server
-- @param Request the request to send it too.
-- @return The results / derived data from the feedback
RemoteEvent:FireServer(Request:lower(), ...)
end
end
end
DataStream.Fire = Fire
DataStream.fire = Fire
DataStream.FireAllClients = FireAllClients
DataStream.fireAllClients = FireAllClients
local function RegisterRequestTag(RequestTag, Execute)
--- Registers a request when sent
-- @param RequestTag The tag that is expected
-- @param Execute The functon to execute. It will be sent
-- all remainig arguments.
-- Request tags are not case sensitive
RequestTagDatabase[RequestTag:lower()] = Execute;
end
DataStream.RegisterRequestTag = RegisterRequestTag
DataStream.registerRequestTag = RegisterRequestTag
local function UnregisterRequestTag(RequestTag)
--- Unregisters the request from the tag
-- @param RequestTag String the tag to reregister
RequestTagDatabase[RequestTag:lower()] = nil;
end
DataStream.UnregisterRequestTag = UnregisterRequestTag
DataStream.unregisterRequestTag = UnregisterRequestTag
DataStreamCache[RemoteEvent] = DataStream
return DataStream
end
end
local DataStreamMain = GetCachedDataStream(NetworkingRemoteFunction)
local function GetDataStream(DataStreamName)
--- Get's a dataStream channel
-- @param DataSteamName The channel to log in to.
-- @return The main datastream, if no DataSteamName is provided
if DataStreamName then
return GetCachedDataStream(ResouceManager.GetDataStreamObject(DataStreamName, DataStreamContainer))
else
error("[NevermoreEngine] - Paramter DataStreamName was nil")
end
end
Network.GetDataStream = GetDataStream
local function GetEventStream(EventStreamName)
--- Get's an EventStream chanel
-- @param DataSteamName The channel to log in to.
-- @return The main datastream, if no DataSteamName is provided
if EventStreamName then
return GetCachedEventStream(ResouceManager.GetEventStreamObject(EventStreamName, EventStreamContainer))
else
error("[NevermoreEngine] - Paramter EventStreamName was nil")
end
end
Network.GetEventStream = GetEventStream
local function GetMainDatastream()
--- Return's the main datastream, used internally for networking
return DataStreamMain
end
Network.GetMainDatastream = GetMainDatastream
local SplashConfiguration = {
BackgroundColor3 = Color3.new(237/255, 236/255, 233/255); -- Color of background of loading screen.
AccentColor3 = Color3.new(8/255, 130/255, 83/255); -- Not used.
LogoSize = 200;
LogoTexture = "http://www.roblox.com/asset/?id=129733987";
LogoSpacingUp = 70; -- Pixels up from loading frame.
ParticalOrbitDistance = 50; -- How far out the particals orbit
ZIndex = 10;
}
local function GenerateInitialSplashScreen(Player)
--- Generates the initial SplashScreen for the player.
-- @param Player The player to genearte the SplashScreen in.
-- @return The generated splashsreen
local ScreenGui = Instance.new("ScreenGui", Player:FindFirstChild("PlayerGui"))
ScreenGui.Name = "SplashScreen";
local MainFrame = Instance.new('Frame')
MainFrame.Name = "SplashScreen";
MainFrame.Position = UDim2.new(0, 0, 0, -38); -- top bar fix
MainFrame.Size = UDim2.new(1, 0, 1, 60); -- Sized ans positioned weirdly because ROBLOX's ScreenGui doesn't cover the whole screen.
MainFrame.BackgroundColor3 = SplashConfiguration.BackgroundColor3;
MainFrame.Visible = true;
MainFrame.ZIndex = SplashConfiguration.ZIndex;
MainFrame.BorderSizePixel = 0;
MainFrame.Parent = ScreenGui;
local ParticalFrame = Instance.new('Frame')
ParticalFrame.Name = "ParticalFrame";
ParticalFrame.Position = UDim2.new(0.5, -SplashConfiguration.ParticalOrbitDistance, 0.7, -SplashConfiguration.ParticalOrbitDistance);
ParticalFrame.Size = UDim2.new(0, SplashConfiguration.ParticalOrbitDistance*2, 0, SplashConfiguration.ParticalOrbitDistance*2); -- Sized ans positioned weirdly because ROBLOX's ScreenGui doesn't cover the whole screen.
ParticalFrame.Visible = true;
ParticalFrame.BackgroundTransparency = 1
ParticalFrame.ZIndex = SplashConfiguration.ZIndex;
ParticalFrame.BorderSizePixel = 0;
ParticalFrame.Parent = MainFrame;
local LogoLabel = Instance.new('ImageLabel')
LogoLabel.Name = "LogoLabel";
LogoLabel.Position = UDim2.new(0.5, -SplashConfiguration.LogoSize/2, 0.7, -SplashConfiguration.LogoSize/2 - SplashConfiguration.ParticalOrbitDistance*2 - SplashConfiguration.LogoSpacingUp);
LogoLabel.Size = UDim2.new(0, SplashConfiguration.LogoSize, 0, SplashConfiguration.LogoSize); -- Sized ans positioned weirdly because ROBLOX's ScreenGui doesn't cover the whole screen.
LogoLabel.Visible = true;
LogoLabel.BackgroundTransparency = 1
LogoLabel.Image = SplashConfiguration.LogoTexture;
LogoLabel.ZIndex = SplashConfiguration.ZIndex;
LogoLabel.BorderSizePixel = 0;
LogoLabel.Parent = MainFrame;
LogoLabel.ImageTransparency = 1;
--[[
local LoadingText = Instance.new("TextLabel")
LoadingText.Name = "LoadingText"
LoadingText.Position = UDim2.new(0.5, -SplashConfiguration.LogoSize/2, 0.7, -SplashConfiguration.LogoSize/2 - SplashConfiguration.ParticalOrbitDistance*2 - SplashConfiguration.LogoSpacingUp);
LoadingText.Size = UDim2.new(0, SplashConfiguration.LogoSize, 0, SplashConfiguration.LogoSize); -- Sized ans positioned weirdly because ROBLOX's ScreenGui doesn't cover the whole screen.
LoadingText.Visible = true;
LoadingText.BackgroundTransparency = 1
LoadingText.ZIndex = SplashConfiguration.ZIndex;
LoadingText.BorderSizePixel = 0;
LoadingText.TextColor3 = SplashConfiguration.AccentColor3;
LoadingText.TextXAlignment = "Center";
LoadingText.Text = "Boostrapping Adventure..."
LoadingText.Parent = MainFrame;
--]]
return ScreenGui
end
if Configuration.IsServer then
local function CheckIfPlayerIsBlacklisted(Player, BlackList)
--- Checks to see if a player is blacklisted from the server
-- @param Player The player to check for
-- @param Blacklist The string blacklist
-- @return Boolean is blacklisted
for Id in string.gmatch(BlackList, "%d+") do
local ProductInformation = (MarketplaceService:GetProductInfo(Id))
if ProductInformation then
if string.match(ProductInformation["Description"], Player.Name..";") then
return true;
end
end
end
for Name in string.gmatch(BlackList, "[%a%d]+") do
if Player.Name:lower() == Name:lower() then
return true;
end
end
return false;
end
local function CheckPlayer(player)
--- Makes sure a player has all necessary components.
-- @return Boolean If the player has all the right components
return player and player:IsA("Player")
and player:FindFirstChild("Backpack")
and player:FindFirstChild("StarterGear")
-- and player.PlayerGui:IsA("PlayerGui") -- PlayerGui does not replicate to other clients.
end
local function CheckCharacter(player)
--- Make sure that a character has all necessary components
-- @return Boolean If the player has all the right components
local character = player.Character;
return character
and character:FindFirstChild("Humanoid")
and character:FindFirstChild("Torso")
and character:FindFirstChild("Head")
and character.Humanoid:IsA("Humanoid")
and character.Head:IsA("BasePart")
and character.Torso:IsA("BasePart")
end
local function DumpExecutables(Player)
--- Executes all "MainResources" for the player
-- @param Player The player to load the resources on
if Player:IsDescendantOf(Players) then
print(Configuration.PrintHeader .. "Loading executables onto " .. tostring(Player))
for _, Item in pairs(ResouceManager.GetLoadablesForClient()) do
ResouceManager.LoadScriptOnClient(Item, Player)
end
end
end
local function SetupPlayer(Player)
--- Setups up a player
-- @param Player The player to setup
if Configuration.BlackList and CheckIfPlayerIsBlacklisted(Player, Configuration.BlackList) then
Player:Kick()
warn("Kicked Player " .. Player.Name .. " who was blacklisted")
return nil
else
local PlayerSplashScreen
local HumanoidDiedEvent
local ExecutablesDumped = false
local function SetupCharacter(ForceDumpExecutables)
--- Setup's up a player's character
-- @param ForceDumpExecutables Forces executables to be dumped, even if StarterGui.ResetPlayerGuiOnSpawn is true.
if not Configuration.CustomCharacters then
if Player and Player:IsDescendantOf(Players) then
while not (Player.Character
and Player.Character:FindFirstChild("Humanoid")
and Player.Character.Humanoid:IsA("Humanoid"))
and Player:IsDescendantOf(Players) do
wait(0) -- Wait for the player's character to load
end
-- Make sure the player is still in game.
if Player.Parent == Players then
if HumanoidDiedEvent then
HumanoidDiedEvent:disconnect()
HumanoidDiedEvent = nil
end
HumanoidDiedEvent = Player.Character.Humanoid.Died:connect(function()
wait(Configuration.CharacterRespawnTime)
if Player:IsDescendantOf(Players) then
Player:LoadCharacter()
end
end)
if not ExecutablesDumped or ForceDumpExecutables == true or StarterGui.ResetPlayerGuiOnSpawn then
wait() -- On respawn for some reason, this wait is needed.
DumpExecutables(Player)
ExecutablesDumped = true
end
else
print(Configuration.PrintHeader .. "is not int he game. Cannot finish load.")
end
else
print(Configuration.PrintHeader .. " is not in the game. Cannot load.")
end
end
end
local function LoadSplashScreen()
--- Load's the splash screen into the player
if Configuration.SplashScreen then
PlayerSplashScreen = GenerateInitialSplashScreen(Player)
if Configuration.SoloTestMode then
Network.AddSplashToNevermore(NevermoreEngine)
end
end
end
local function InitialCharacterLoad()
-- Makes sure the character loads, and sets up the character if it has already loaded
if not Player.Character then -- Incase the characters do start auto-loading.
if PlayerSplashScreen then
PlayerSplashScreen.Parent = nil
end
if Configuration.CustomCharacters then
Player:LoadCharacter()
if not Player.Character then
-- Player.CharacterAdded:wait()
-- Fixes potential infinite yield.
while not Player.Character and Player:IsDescendantOf(Players) do
wait()
end
end
if Player:IsDescendantOf(Players) then
Player.Character:Destroy()
end
else
Player:LoadCharacter()
end
if PlayerSplashScreen then
PlayerSplashScreen.Parent = Player.PlayerGui
end
else
SetupCharacter(true) -- Force dump on the first load.
end
end
-- WHAT MUST HAPPEN
-- Character must be loaded at least once
-- Nevermore must run on the client to get a splash running. However, this can be seen as optinoal.
-- Nevermore must load the splash into the player.
-- SETUP EVENT FIRST
Player.CharacterAdded:connect(SetupCharacter)
InitialCharacterLoad() -- Force load the character, no matter what.
LoadSplashScreen()
end
end
local function ConnectPlayers()
--- Connects all the events and adds players into the system.
Network.ConnectPlayers = nil -- Only do this once!
-- Setup all the players that joined...
for _, Player in pairs(game.Players:GetPlayers()) do
coroutine.resume(coroutine.create(function()
SetupPlayer(Player)
end))
end
-- And when they are added...
Players.PlayerAdded:connect(function(Player)
SetupPlayer(Player)
end)
end
Network.ConnectPlayers = ConnectPlayers
end
if Configuration.IsClient or Configuration.SoloTestMode then
-- Setup the Splash Screen.
-- However, in SoloTestMode, we need to setup the splashscreen in the
-- replicated storage module, which is technically the server module.
local function AnimateSplashScreen(ScreenGui)
--- Creates a Windows 8 style loading screen, finishing the loading animation
-- of pregenerated spash screens.
-- @param ScreenGui The ScreenGui generated by the splash initiator.
-- Will only be called if SpashScreens are enabled.
local Configuration = {
OrbitTime = 5; -- How long the orbit should last.
OrbitTimeBetweenStages = 0.5;
Texture = "http://www.roblox.com/asset/?id=129689248"; -- AssetId of orbiting object (Decal)
ParticalOrbitDistance = 50; -- How far out the particals orbit
ParticalSize = 10; -- How big the particals are, probably should be an even number..
ParticalCount = 5; -- How many particals to generate
ParticleSpacingTime = 0.25; -- How long to wait between earch partical before releasing the next one
}
local Splash = {}
local IsActive = true
local MainFrame = ScreenGui.SplashScreen
local ParticalFrame = MainFrame.ParticalFrame
local LogoLabel = MainFrame.LogoLabel
local ParticalList = {}
local function Destroy()
-- Can be called to Destroy the SplashScreen. Will have the Alias
-- ClearSplash in NevermoreEngine
IsActive = false;
MainFrame:Destroy()
if ScreenGui then
ScreenGui:Destroy()
end
end
Splash.Destroy = Destroy
local function SetParent(NewParent)
-- Used to fix rendering issues with multiple ScreenGuis.
MainFrame.Parent = NewParent
if ScreenGui then
ScreenGui:Destroy()
ScreenGui = nil
end
end
Splash.SetParent = SetParent
spawn(function()
LogoLabel.ImageTransparency = 1
ContentProvider:Preload(SplashConfiguration.LogoTexture)
while IsActive and (ContentProvider.RequestQueueSize > 0) do
RunService.RenderStepped:wait()
end
spawn(function()
while IsActive and LogoLabel.ImageTransparency >= 0 do
LogoLabel.ImageTransparency = LogoLabel.ImageTransparency - 0.05
RunService.RenderStepped:wait()
end
LogoLabel.ImageTransparency = 0
end)
if IsActive then
local function MakePartical(Parent, RotationRadius, Size, Texture)
-- Creates a partical that will circle around the center of it's Parent.
-- RotationRadius is how far away it orbits
-- Size is the size of the ball...
-- Texture is the asset id of the texture to use...
-- Create a new ImageLabel to be our rotationg partical
local Partical = Instance.new("ImageLabel")
Partical.Name = "Partical";
Partical.Size = UDim2.new(0, Size, 0, Size);
Partical.BackgroundTransparency = 1;
Partical.Image = Texture;
Partical.BorderSizePixel = 0;
Partical.ZIndex = 10;
Partical.Parent = Parent;
Partical.Visible = false;
local ParticalData = {
Frame = Partical;
RotationRadius = RotationRadius;
StartTime = math.huge;
Size = Size;
SetPosition = function(ParticalData, CurrentPercent)
-- Will set the position of the partical relative to CurrentPercent. CurrentPercent @ 0 should be 0 radians.
local PositionX = math.cos(math.pi * 2 * CurrentPercent) * ParticalData.RotationRadius
local PositionY = math.sin(math.pi * 2 * CurrentPercent) * ParticalData.RotationRadius
ParticalData.Frame.Position = UDim2.new(0.5 + PositionX/2, -ParticalData.Size/2, 0.5 + PositionY/2, -ParticalData.Size/2)
--ParticalData.Frame:TweenPosition(UDim2.new(0.5 + PositionX/2, -ParticalData.Size/2, 0.5 + PositionY/2, -ParticalData.Size/2), "Out", "Linear", 0.03, true)
end;
}
return ParticalData;
end
local function EaseOut(Percent, Amount)
-- Just return's the EaseOut smoothed out percentage
return -(1 - Percent^Amount) + 1
end
local function EaseIn(Percent, Amount)
-- Just return's the Easein smoothed out percentage
return Percent^Amount
end
local function EaseInOut(Percent, Amount)
-- Return's a smoothed out percentage, using in-out. 'Amount'
-- is the powered amount (So 2 would be a quadratic EaseInOut,
-- 3 a cubic, and so forth. Decimals supported)
if Percent < 0.5 then
return ((Percent*2)^Amount)/2
else
return (-((-(Percent*2) + 2)^Amount))/2 + 1
end
end
local function GetFramePercent(Start, Finish, CurrentPercent)
-- Return's the relative percentage to the overall
-- 'CurrentPercentage' which ranges from 0 to 100; So in one
-- case, 0 to 0.07, at 50% would be 0.035;
return ((CurrentPercent - Start) / (Finish - Start))
end
local function GetTransitionedPercent(Origin, Target, CurrentPercent)
-- Return's the Transitional percentage (How far around the
-- circle the little ball is), when given a Origin ((In degrees)
-- and a Target (In degrees), and the percentage transitioned
-- between the two...)
return (Origin + ((Target - Origin) * CurrentPercent)) / 360;
end
-- Start the beautiful update loop
-- Add / Create particals
for Index = 1, Configuration.ParticalCount do
ParticalList[Index] = MakePartical(ParticalFrame, 1, Configuration.ParticalSize, Configuration.Texture)
end
local LastStartTime = 0; -- Last time a partical was started
local ActiveParticalCount = 0;
local NextRunTime = 0 -- When the particals can be launched again...
while IsActive do
local CurrentTime = tick();
for Index, Partical in ipairs(ParticalList) do
-- Calculate the CurrentPercentage from the time and
local CurrentPercent = ((CurrentTime - Partical.StartTime) / Configuration.OrbitTime);
if CurrentPercent < 0 then
if LastStartTime + Configuration.ParticleSpacingTime <= CurrentTime and ActiveParticalCount == (Index - 1) and NextRunTime <= CurrentTime then
-- Launch Partical...
Partical.Frame.Visible = true;
Partical.StartTime = CurrentTime;
LastStartTime = CurrentTime
ActiveParticalCount = ActiveParticalCount + 1;
if Index == Configuration.ParticalCount then
NextRunTime = CurrentTime + Configuration.OrbitTime + Configuration.OrbitTimeBetweenStages;
end
Partical:SetPosition(45/360)
end
elseif CurrentPercent > 1 then
Partical.Frame.Visible = false;
Partical.StartTime = math.huge;
ActiveParticalCount = ActiveParticalCount - 1;
elseif CurrentPercent <= 0.08 then
Partical:SetPosition(GetTransitionedPercent(45, 145, EaseOut(GetFramePercent(0, 0.08, CurrentPercent), 1.2)))
elseif CurrentPercent <= 0.39 then
Partical:SetPosition(GetTransitionedPercent(145, 270, GetFramePercent(0.08, 0.39, CurrentPercent)))
elseif CurrentPercent <= 0.49 then
Partical:SetPosition(GetTransitionedPercent(270, 505, EaseInOut(GetFramePercent(0.39, 0.49, CurrentPercent), 1.1)))
elseif CurrentPercent <= 0.92 then
Partical:SetPosition(GetTransitionedPercent(505, 630, GetFramePercent(0.49, 0.92, CurrentPercent)))
elseif CurrentPercent <= 1 then
Partical:SetPosition(GetTransitionedPercent(630, 760, EaseOut(GetFramePercent(0.92, 1, CurrentPercent), 1.1)))
end
end
RunService.RenderStepped:wait()
end
end
end)
return Splash
end
local function SetupSplashScreenIfEnabled()
-- CLient stuff.
--- Sets up the Splashscreen if it's enabled, and returnst he disabling / removing function.
-- @return The removing function, even if the splashscreen doesn't exist.
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:FindFirstChild("PlayerGui")
while not LocalPlayer:FindFirstChild("PlayerGui") do
wait(0)
print("[NevermoreEngine] - Waiting for PlayerGui")
PlayerGui = LocalPlayer:FindFirstChild("PlayerGui")
end
local SplashEnabled = false
local ScreenGui = PlayerGui:FindFirstChild("SplashScreen")
local SplashScreen
if Configuration.SplashScreen and ScreenGui then
SplashEnabled = true
SplashScreen = AnimateSplashScreen(ScreenGui)
elseif Configuration.SplashScreen and Configuration.EnableFiltering and not Configuration.SoloTestMode then
SplashEnabled = true
ScreenGui = GenerateInitialSplashScreen(LocalPlayer)
SplashScreen = AnimateSplashScreen(ScreenGui)
else
print(Configuration.PrintHeader .. "Splash Screen could not be found, or is not enabled")
end
local function ClearSplash()
-- print(Configuration.PrintHeader .. "Clearing splash.")
--- Destroys and stops all animation of the current splashscreen, if it exists.
if SplashScreen then
SplashEnabled = false
SplashScreen.Destroy()
SplashScreen = nil;
end
end
local function GetSplashEnabled()
return SplashEnabled
end
local function SetSplashParent(NewParent)
assert(NewParent:IsDescendantOf(game), Configuration.PrintHeader .. "New parent must be a descendant of of game")
if SplashScreen then
SplashScreen.SetParent(NewParent)
else
warn(Configuration.PrintHeader .. "Could not set NewParent, Splash Screen could not be found, or is not enabled")
end
end
return ClearSplash, GetSplashEnabled, SetSplashParent
end
-- Network.SetupSplashScreenIfEnabled = SetupSplashScreenIfEnabled
local function AddSplashToNevermore(NevermoreEngine)
local ClearSplash, GetSplashEnabled, SetSplashParent = SetupSplashScreenIfEnabled()
NevermoreEngine.SetSplashParent = SetSplashParent
NevermoreEngine.setSplashParent = SetSplashParent
NevermoreEngine.ClearSplash = ClearSplash
NevermoreEngine.clearSplash = ClearSplash
NevermoreEngine.clear_splash = ClearSplash
NevermoreEngine.GetSplashEnabled = GetSplashEnabled
NevermoreEngine.getSplashEnabled = GetSplashEnabled
NevermoreEngine.get_splash_enabled = GetSplashEnabled
end
Network.AddSplashToNevermore = AddSplashToNevermore
end
end
--print(Configuration.PrintHeader .. "Loaded network module")
-----------------------
-- UTILITY NEVERMORE --
-----------------------
local SetRespawnTime
if Configuration.IsServer then
function SetRespawnTime(NewTime)
--- Sets how long it takes for a character to respawn.
-- @param NewTime The new time it takes for a character to respawn
if type(NewTime) == "number" then
Configuration.CharacterRespawnTime = NewTime
else
error(Configuration.PrintHeader .. " Could not set respawn time to '" .. tostring(NewTime) .. "', number expected, got '" .. type(NewTime) .. "'")
end
end
--[[Network.GetMainDatastream().RegisterRequestTag(Configuration.NevermoreRequestPrefix .. "SetRespawnTime", function(Client, NewTime)
SetRespawnTime(NewTime)
end)--]]
--else
--[[function SetRespawnTime(NewTime)
--- Sends a request to the server to set the respawn time.
-- @param NewTime The new respawn time.
Network.GetMainDatastream().Send(Configuration.NevermoreRequestPrefix .. "SetRespawnTime", NewTime)
end--]]
end
--print(Configuration.PrintHeader .. "Loaded Nevermore Utilities")
------------------------
-- INITIATE NEVERMORE --
------------------------
--print(Configuration.PrintHeader .. "Setup splashscreen")
NevermoreEngine.SetRespawnTime = SetRespawnTime
NevermoreEngine.setRespawnTime = SetRespawnTime
NevermoreEngine.set_respawn_time = SetRespawnTime
NevermoreEngine.GetResource = ResouceManager.GetResource
NevermoreEngine.getResource = ResouceManager.GetResource
NevermoreEngine.get_resource = ResouceManager.GetResource
NevermoreEngine.LoadLibrary = ResouceManager.LoadLibrary
NevermoreEngine.loadLibrary = ResouceManager.LoadLibrary
NevermoreEngine.load_library = ResouceManager.LoadLibrary
NevermoreEngine.ImportLibrary = ResouceManager.ImportLibrary
NevermoreEngine.importLibrary = ResouceManager.ImportLibrary
NevermoreEngine.import_library = ResouceManager.ImportLibrary
NevermoreEngine.Import = ResouceManager.ImportLibrary
NevermoreEngine.import = ResouceManager.ImportLibrary
-- These 2 following are used to get the raw objects.
NevermoreEngine.GetDataStreamObject = ResouceManager.GetDataStreamObject
NevermoreEngine.getDataStreamObject = ResouceManager.GetDataStreamObject
NevermoreEngine.get_data_stream_object = ResouceManager.GetDataStreamObject
NevermoreEngine.GetRemoteFunction = ResouceManager.GetDataStreamObject -- Uh, yeah, why haven't I done this before?
NevermoreEngine.GetEventStreamObject = ResouceManager.GetEventStreamObject
NevermoreEngine.getEventStreamObject = ResouceManager.GetEventStreamObject
NevermoreEngine.get_event_stream_object = ResouceManager.GetEventStreamObject
NevermoreEngine.GetRemoteEvent = ResouceManager.GetEventStreamObject
NevermoreEngine.GetDataStream = Network.GetDataStream
NevermoreEngine.getDataStream = Network.GetDataStream
NevermoreEngine.get_data_stream = Network.GetDataStream
NevermoreEngine.GetEventStream = Network.GetEventStream
NevermoreEngine.getEventStream = Network.GetEventStream
NevermoreEngine.get_event_stream = Network.GetEventStream
NevermoreEngine.SoloTestMode = Configuration.SoloTestMode -- Boolean value
-- Internally used
NevermoreEngine.GetMainDatastream = Network.GetMainDatastream
NevermoreEngine.NevermoreContainer = NevermoreContainer
NevermoreEngine.nevermoreContainer = NevermoreContainer
NevermoreEngine.nevermore_container = NevermoreContainer
NevermoreEngine.ReplicatedPackage = ReplicatedPackage
NevermoreEngine.replicatedPackage = ReplicatedPackage
NevermoreEngine.replicated_package = ReplicatedPackage
if Configuration.IsServer then
local function Initiate()
--- Called up by the loader.
--- Initiates Nevermore. This should only be called once.
-- Since Nevermore sets all of its executables, and executes them manually,
-- there is no need to wait for Nevermore when these run.
NevermoreEngine.Initiate = nil
ResouceManager.PopulateResourceCache()
Network.ConnectPlayers()
ResouceManager.ExecuteExecutables()
end
NevermoreEngine.Initiate = Initiate
else
ResouceManager.PopulateResourceCache()
-- Yield until player loads
assert(coroutine.resume(coroutine.create(function()
local LocalPlayer do
while not (LocalPlayer and LocalPlayer:IsA("Player")) do
warn(Configuration.PrintHeader, "Yielding until player is added. Currently found: " .. tostring(LocalPlayer))
LocalPlayer = Players.LocalPlayer or Players.ChildAdded:wait()
end
end
Network.AddSplashToNevermore(NevermoreEngine)
end)))
end
--print(Configuration.PrintHeader .. "Nevermore is initiated successfully."
--print(Configuration.PrintHeader .. "#ReturnValues = ".. (#ReturnValues))
return NevermoreEngine
|
-- Number setting
-- Part of Live Simulator: 2
-- See copyright notice in main.lua
local love = require("love")
local Luaoop = require("libs.Luaoop")
local Setting = require("setting")
local color = require("color")
local MainFont = require("main_font")
local Util = require("util")
local AssetCache = require("asset_cache")
local CircleIconButton = require("game.ui.circle_icon_button")
local ColorTheme = require("game.color_theme")
local baseSetting = require("game.settings.base")
local numberSetting = Luaoop.class("Livesim2.SettingItem.Number", baseSetting)
local function snapAt(v, snap)
return math.floor(v/snap) * snap
end
local function makePressed(obj, dir)
return function()
local internal = Luaoop.class.data(obj)
local value = Util.clamp(internal.value + internal.snap * dir, internal.range.min, internal.range.max)
if value ~= internal.value then
internal.value = snapAt(value, internal.snap)
internal.holdDelay = 0
internal.updateDirection = dir
obj:_updateValueDisplay()
obj:_emitChangedCallback(internal.value)
end
end
end
local INCREASE_X, INCREASE_Y = 420 + 160, 0
local DECREASE_X, DECREASE_Y = 420 - 36, 0
local RELOAD_X, RELOAD_Y = 420 + 160 + 40, 0
function numberSetting:__construct(frame, name, settingName, opts)
local internal = Luaoop.class.data(self)
baseSetting.__construct(self, name)
local img = AssetCache.loadImage("assets/image/ui/over_the_rainbow/navigate_back.png", {mipmaps = true})
internal.holdDelay = -math.huge
internal.updateDirection = 0
internal.range = opts
internal.div = opts.div or 1
internal.value = Util.clamp((opts.value or Setting.get(settingName)) * internal.div, opts.min, opts.max)
internal.font = MainFont.get(22)
internal.valueDisplay = love.graphics.newText(internal.font)
internal.snap = opts.snap or 1
internal.frame = frame
internal.display = opts.display or {}
local function released()
internal.holdDelay = -math.huge
internal.updateDirection = 0
if settingName then Setting.set(settingName, internal.value / internal.div) end
end
internal.increaseButton = CircleIconButton(color.transparent, 18, img, 0.24, ColorTheme.get(), math.pi)
internal.increaseButton:addEventListener("mousepressed", makePressed(self, 1))
internal.increaseButton:addEventListener("mousereleased", released)
frame:addElement(internal.increaseButton, self.x + INCREASE_X, self.y + INCREASE_Y)
internal.decreaseButton = CircleIconButton(color.transparent, 18, img, 0.24, ColorTheme.get())
internal.decreaseButton:addEventListener("mousepressed", makePressed(self, -1))
internal.decreaseButton:addEventListener("mousereleased", released)
frame:addElement(internal.decreaseButton, self.x + DECREASE_X, self.y + DECREASE_Y)
if opts.default then
local reload = AssetCache.loadImage("assets/image/ui/over_the_rainbow/reload.png", {mipmaps = true})
internal.resetButton = CircleIconButton(color.transparent, 18, reload, 0.32, ColorTheme.get())
internal.resetButton:addEventListener("mousereleased", function()
if internal.value ~= opts.default then
internal.value = opts.default
if settingName then Setting.set(settingName, opts.default / internal.div) end
self:_updateValueDisplay()
self:_emitChangedCallback(opts.default)
end
end)
frame:addElement(internal.resetButton, self.x + RELOAD_X, self.y + RELOAD_Y)
end
return self:_updateValueDisplay()
end
function numberSetting:__destruct()
local internal = Luaoop.class.data(self)
internal.frame:removeElement(internal.increaseButton)
internal.frame:removeElement(internal.decreaseButton)
if internal.resetButton then
internal.frame:removeElement(internal.resetButton)
end
end
function numberSetting:_updateValueDisplay()
local internal = Luaoop.class.data(self)
local s = tostring(internal.display[internal.value] or internal.value)
local w = internal.font:getWidth(s) * 0.5
internal.valueDisplay:clear()
internal.valueDisplay:add({color.white, s}, 0, 0, 0, 1, 1, w, 0)
end
function numberSetting:_positionChanged()
local internal = Luaoop.class.data(self)
internal.frame:setElementPosition(internal.increaseButton, self.x + INCREASE_X, self.y)
internal.frame:setElementPosition(internal.decreaseButton, self.x + DECREASE_X, self.y)
if internal.resetButton then
internal.frame:setElementPosition(internal.resetButton, self.x + RELOAD_X, self.y)
end
end
function numberSetting:update(dt)
local internal = Luaoop.class.data(self)
internal.holdDelay = internal.holdDelay + dt * 2
if internal.holdDelay >= 1 then
local value = Util.clamp(
internal.value + internal.snap * math.floor(internal.holdDelay) * internal.updateDirection,
internal.range.min,
internal.range.max
)
if value ~= internal.value then
internal.value = snapAt(value, internal.snap)
self:_updateValueDisplay()
self:_emitChangedCallback(internal.value)
end
end
end
function numberSetting:getValue()
local internal = Luaoop.class.data(self)
return internal.value / internal.div
end
function numberSetting:setValue(v)
local internal = Luaoop.class.data(self)
assert(type(v) == "number", "invalid value")
v = Util.clamp(v, internal.range.min, internal.range.max)
if v ~= internal.value then
internal.value = snapAt(v * internal.div, internal.snap)
self:_updateValueDisplay()
self:_emitChangedCallback(internal.value)
end
end
function numberSetting:draw()
local internal = Luaoop.class.data(self)
baseSetting.draw(self)
love.graphics.setColor(ColorTheme.get())
love.graphics.rectangle("line", self.x + 420 + 246, self.y + 86, 160, 36, 18, 18)
Util.drawText(internal.valueDisplay, self.x + 500 + 246, self.y + 5 + 86)
end
return numberSetting
|
object_tangible_collection_reward_sith_holocron_schematic_reward = object_tangible_collection_reward_shared_sith_holocron_schematic_reward:new {
}
ObjectTemplates:addTemplate(object_tangible_collection_reward_sith_holocron_schematic_reward, "object/tangible/collection/reward/sith_holocron_schematic_reward.iff")
|
function Client_SaveConfigureUI(alert)
Mod.Settings.MaxAttacks = InputMaxAttacks.GetValue();
if( Mod.Settings.MaxAttacks == nil)then
Mod.Settings.MaxAttacks = 5;
end
if( Mod.Settings.MaxAttacks < 1)then
alert('With this Settings, it is impossible to win a game through elimination.');
end
if( Mod.Settings.MaxAttacks > 100000)then
alert('The number is too big.');
end
end |
solution "packr"
configurations { "release" }
project "packr"
kind "ConsoleApp"
language "C++"
-- buildoptions { "-Wall" }
files { "**.h", "src/launcher.cpp" }
includedirs { "include", "include/jni-headers" }
defines { "NDEBUG" }
flags { "Optimize" }
kind "WindowedApp"
defines { "WINDOWS" }
includedirs { "include/jni-headers/win32" }
files { "src/main-windows.cpp" }
flags { "WinMain" }
platforms { "x32", "x64" }
|
--[[
选择目标
]]
local SelectTarget = class("SelectTarget", require("app.main.modules.script.ScriptBase"))
-- 构造函数
function SelectTarget:ctor(config)
table.merge(self,config)
end
-- 执行函数
function SelectTarget:execute(...)
if self.scene == "BATTLE" then
self:executeInBattle(...)
elseif self.scene == "MAP" then
self:executeInMap(...)
end
end
--[[
战场上选择
param 脚本参数
message 显示消息
role 使用角色
]]
function SelectTarget:executeInBattle(onComplete)
local msgui = self.role:isEnemy() and "message" or "ourmessage"
local selectteam = self.param.toenemy and
self.role:getTeam():getEnemyTeam() or self.role:getTeam()
local function doSelect(onComplete_)
selectteam:selectRoles(
function (success,targets)
if onComplete_ then
if success then
onComplete_(true,{ targets = targets })
else
if self.param.message then
uiMgr:closeUI(msgui)
end
onComplete_(false)
end
end
end,
{
role_normal = self.param.role_normal,
role_dead = self.param.role_dead,
multisel = self.param.multisel,
}
)
end
if self.param.message then
uiMgr:openUI(msgui,{
texts = gameMgr:getStrings(self.param.message),
showconfig = {
usecursor = true,
hidecsrlast = true,
ctrl_complete = false
},
onComplete = function ()
doSelect(function (...)
if onComplete then onComplete(...) end
end)
end
})
else
doSelect(onComplete)
end
end
--[[
地图上选择
param 脚本参数
message 显示消息
role 使用角色
]]
function SelectTarget:executeInMap(onComplete)
if self.param.toenemy then
uiMgr:openUI("message",{
autoclose = true,
texts = gameMgr:getStrings("NOT_USE_HERE"),
onComplete = function ()
if onComplete then onComplete(false) end
end
})
else
local function doSelect(onComplete_)
uiMgr:openUI("targetselect",function (success, targets)
if onComplete_ then
if success then
onComplete_(true,{ targets = targets })
else
if self.param.message then
uiMgr:closeUI("message")
end
uiMgr:closeUI("targetselect")
onComplete_(false)
end
end
end,{
team = self.role:getTeam(),
role_normal = self.param.role_normal,
role_dead = self.param.role_dead,
multisel = self.param.multisel,
})
end
if self.param.message then
uiMgr:openUI("message",{
texts = gameMgr:getStrings(self.param.message),
showconfig = {
usecursor = true,
hidecsrlast = true,
ctrl_complete = false
},
onComplete = function ()
doSelect(function (...)
if onComplete then onComplete(...) end
end)
end
})
else
doSelect(onComplete)
end
end
end
return SelectTarget
|
--[[
Name: "sh_comm.lua".
Product: "HL2 RP".
--]]
local MOUNT = MOUNT;
local COMMAND = {};
-- Set some information.
COMMAND.tip = "Record the biosignal of the character you're looking at.";
COMMAND.flags = CMD_DEFAULT;
-- Called when the command has been run.
function COMMAND:OnRun(player, arguments)
local target = player:GetEyeTraceNoCursor().Entity;
-- Check if a statement is true.
if ( target and target:IsPlayer() ) then
if (target:GetShootPos():Distance( player:GetShootPos() ) <= 192) then
if ( kuroScript.game:PlayerIsCombine(player) ) then
if ( !kuroScript.game:PlayerIsCombine(target) ) then
if (target:GetSharedVar("ks_Tied") != 0) then
target:SetCharacterData("biosignal", true);
-- Notify the player.
kuroScript.player.Notify(player, "You have recorded this character's biosignal.");
else
kuroScript.player.Notify(player, "This character is not tied!");
end;
else
kuroScript.player.Notify(player, "You cannot record the Combine's biosignal!");
end;
else
kuroScript.player.Notify(player, "You are not the Combine!");
end;
else
kuroScript.player.Notify(player, "This character is too far away!");
end;
else
kuroScript.player.Notify(player, "You must look at a valid character!");
end;
end;
-- Register the command.
kuroScript.command.Register(COMMAND, "biosignal"); |
data:extend({
{
type = "recipe",
name = "5d-mining-drill-range-3",
enabled = "false",
energy_required = 2,
ingredients =
{
{"5d-mining-drill-range-2", 1},
{"5d-tin-gear-wheel", 35},
{"zinc-plate", 15},
{"electronic-circuit", 50},
{"advanced-circuit", 15},
{"processing-unit", 10},
{"5d-gold-circuit", 5},
},
result = "5d-mining-drill-range-3"
},
{
type = "recipe",
name = "5d-mining-drill-range-2",
enabled = "false",
energy_required = 2,
ingredients =
{
{"5d-mining-drill-range-1", 1},
{"5d-aluminium-gear-wheel", 25},
{"lead-plate", 20},
{"5d-tin-plate", 20},
{"advanced-circuit", 10},
},
result = "5d-mining-drill-range-2"
},
{
type = "recipe",
name = "5d-mining-drill-range-1",
enabled = "false",
energy_required = 2,
ingredients =
{
{"electric-mining-drill", 1},
{"5d-zinc-gear-wheel", 10},
{"5d-tin-plate", 50},
{"advanced-circuit", 2},
},
result = "5d-mining-drill-range-1"
},
{
type = "recipe",
name = "5d-pumpjack-3",
energy_required = 20,
ingredients =
{
{"5d-tin-plate", 100},
{"5d-pumpjack-2", 1},
{"5d-gold-wire", 20},
{"5d-pipe-mk3", 25},
},
result = "5d-pumpjack-3",
enabled = false
},
{
type = "recipe",
name = "5d-pumpjack-2",
energy_required = 20,
ingredients =
{
{"5d-tin-plate", 35},
{"pumpjack", 1},
{"5d-zinc-gear-wheel", 15},
{"electronic-circuit", 10},
{"5d-pipe-mk2", 5},
},
result = "5d-pumpjack-2",
enabled = false
},
{
type = "recipe",
name = "5d-mining-drill-speed-3",
enabled = "false",
energy_required = 2,
ingredients =
{
{"5d-mining-drill-speed-2", 1},
{"5d-tin-gear-wheel", 20},
{"zinc-plate", 50},
{"electronic-circuit", 50},
{"advanced-circuit", 15},
{"processing-unit", 10},
{"5d-gold-circuit", 5},
},
result = "5d-mining-drill-speed-3"
},
{
type = "recipe",
name = "5d-mining-drill-speed-2",
enabled = "false",
energy_required = 2,
ingredients =
{
{"5d-mining-drill-speed-1", 1},
{"5d-aluminium-gear-wheel", 15},
{"lead-plate", 50},
{"5d-tin-plate", 50},
{"advanced-circuit", 10},
},
result = "5d-mining-drill-speed-2"
},
{
type = "recipe",
name = "5d-mining-drill-speed-1",
enabled = "false",
energy_required = 2,
ingredients =
{
{"electric-mining-drill", 1},
{"5d-zinc-gear-wheel", 20},
{"5d-tin-plate", 25},
{"advanced-circuit", 2},
},
result = "5d-mining-drill-speed-1"
},
}) |
Hephaistos.Recenter(ScreenData.GhostAdmin, 'ItemStartX', 'ItemStartY')
|
--***********************************************************
--** THE INDIE STONE **
--***********************************************************
require('ISUI/ISScrollingListBox')
require('Vehicles/ISUI/ISUI3DScene')
local FONT_HGT_SMALL = getTextManager():getFontHeight(UIFont.Small)
local FONT_HGT_MEDIUM = getTextManager():getFontHeight(UIFont.Medium)
---@class AnimationClipViewer : ISPanel
AnimationClipViewer = ISPanel:derive("AnimationClipViewer")
-----
AnimationClipViewer_ListBox = ISScrollingListBox:derive("AnimationClipViewer_ListBox")
local ListBox = AnimationClipViewer_ListBox
function ListBox:prerender()
ISScrollingListBox.prerender(self)
local clipName = self.items[self.selected] and self.items[self.selected].text
if clipName and (clipName ~= self.selectedClipName) then
self.selectedClipName = clipName
self.parent.scene.javaObject:fromLua2("setCharacterAnimationClip", "character1", clipName)
end
end
function ListBox:doDrawItem(y, item, alt)
if y + self:getYScroll() + self.itemheight < 0 or y + self:getYScroll() >= self.height then
return y + self.itemheight
end
return ISScrollingListBox.doDrawItem(self, y, item, alt)
end
function ListBox:onMouseDown(x, y)
ISScrollingListBox.onMouseDown(self, x, y)
end
function ListBox:indexOf(text)
for i,item in ipairs(self.items) do
if item.text == text then
return i
end
end
return -1
end
function ListBox:new(x, y, width, height)
local o = ISScrollingListBox.new(self, x, y, width, height)
return o
end
-----
AnimationClipViewer_OptionsPanel = ISPanel:derive("AnimationClipViewer_OptionsPanel")
local OptionsPanel = AnimationClipViewer_OptionsPanel
function OptionsPanel:createChildren()
local tickBox = ISTickBox:new(10, 10, 300, 500, "", self, self.onTickBox, option)
tickBox:initialise()
self:addChild(tickBox)
local gameState = getAnimationViewerState()
for i=1,gameState:getOptionCount() do
local option = gameState:getOptionByIndex(i-1)
tickBox:addOption(option:getName(), option)
tickBox:setSelected(i, option:getValue())
end
tickBox:setWidthToFit()
self.tickBox = tickBox
end
function OptionsPanel:onTickBox(index, selected)
local option = self.tickBox.optionData[index]
option:setValue(selected)
if option:getName() == "DrawGrid" then
self.parent.scene.javaObject:fromLua1("setDrawGrid", selected)
end
if option:getName() == "Isometric" then
self.parent:resetView()
end
if option:getName() == "UseDeferredMovement" then
self.parent.scene.javaObject:fromLua2("setCharacterUseDeferredMovement", "character1", selected)
end
end
function OptionsPanel:onMouseDownOutside(x, y)
if self:isMouseOver() then return end
self:setVisible(false)
-- self:removeFromUIManager()
end
function OptionsPanel:new(x, y, width, height)
local o = ISPanel.new(self, x, y, width, height)
o.backgroundColor.a = 0.8
return o
end
-----
AnimationClipViewer_Scene = ISUI3DScene:derive("AnimationClipViewer_Scene")
local Scene = AnimationClipViewer_Scene
function Scene:prerenderEditor()
self.javaObject:fromLua1("setGizmoVisible", "none")
self.javaObject:fromLua1("setGizmoOrigin", "none")
if not self.zeroVector then self.zeroVector = Vector3f.new() end
self.javaObject:fromLua1("setGizmoPos", self.zeroVector)
self.javaObject:fromLua1("setGizmoRotate", self.zeroVector)
self.javaObject:fromLua0("clearAABBs")
self.javaObject:fromLua0("clearAxes")
self.javaObject:fromLua1("setSelectedAttachment", nil)
end
function Scene:prerender()
ISUI3DScene.prerender(self)
end
function Scene:onMouseDown(x, y)
ISUI3DScene.onMouseDown(self, x, y)
local gameState = getAnimationViewerState()
self.rotate = not isKeyDown(Keyboard.KEY_LSHIFT)
end
function Scene:onMouseMove(dx, dy)
if self.rotate then
local current = self.javaObject:fromLua0("getViewRotation")
local rx = current:x() + 0
local ry = current:y() + dx / 2
local rz = current:z() + 0
if getAnimationViewerState():getBoolean("Isometric") then
rx = 30
rz = 0
end
self.javaObject:fromLua3("setViewRotation", rx, ry, rz)
return
end
ISUI3DScene.onMouseMove(self, dx, dy)
end
function Scene:onMouseUp(x, y)
ISUI3DScene.onMouseUp(self, x, y)
self.rotate = false
end
function Scene:onMouseUpOutside(x, y)
self:onMouseUp()
end
function Scene:onRightMouseDown(x, y)
end
function Scene:new(x, y, width, height)
local o = ISUI3DScene.new(self, x, y, width, height)
return o
end
-----
AnimationClipViewer_Timeline = ISPanel:derive("AnimationClipViewer_Timeline")
local Timeline = AnimationClipViewer_Timeline
function Timeline:render()
ISPanel.render(self)
local scene = self.parent.parent.scene
local time = scene.javaObject:fromLua1("getCharacterAnimationTime", "character1")
local duration = scene.javaObject:fromLua1("getCharacterAnimationDuration", "character1")
if not time or not duration then return end
if self.parent.parent.listBox.selectedClipName ~= self.selectedClipName then
self.selectedClipName = self.parent.parent.listBox.selectedClipName
self.keyframeTimes = scene.javaObject:fromLua2("getCharacterAnimationKeyframeTimes", "character1", self.keyframeTimes)
end
local times = self.keyframeTimes
for i=1,times:size() do
self:drawRect(self.width * times:get(i-1) / duration, 0, 1, self.height, 1.0, 0.5, 0.5, 0.5)
end
self:drawRect(self.width * time / duration, 0, 1, self.height, 1.0, 1.0, 1.0, 1.0)
end
function Timeline:onMouseDown(x, y)
local scene = self.parent.parent.scene
local duration = scene.javaObject:fromLua1("getCharacterAnimationDuration", "character1")
if not duration then return end
local xFraction = x / self.width
self.parent.parent.animate = false
scene.javaObject:fromLua2("setCharacterAnimate", "character1", false)
scene.javaObject:fromLua2("setCharacterAnimationTime", "character1", duration * xFraction)
self.dragging = true
self:setCapture(true)
end
function Timeline:onMouseMove(dx, dy)
if not self.dragging then return end
local scene = self.parent.parent.scene
local duration = scene.javaObject:fromLua1("getCharacterAnimationDuration", "character1")
if not duration then return end
local xFraction = self:getMouseX() / self.width
xFraction = math.max(xFraction, 0.0)
xFraction = math.min(xFraction, 1.0)
scene.javaObject:fromLua2("setCharacterAnimationTime", "character1", duration * xFraction)
end
function Timeline:onMouseMoveOutside(dx, dy)
self:onMouseMove(dx, dy)
end
function Timeline:onMouseUp(x, y)
self.dragging = false
self:setCapture(false)
end
function Timeline:onMouseUpOutside(x, y)
self.dragging = false
self:setCapture(false)
end
function Timeline:new(x, y, width, height)
local o = ISPanel.new(self, x, y, width, height)
o.borderColor.a = 0.0
return o
end
-----
function AnimationClipViewer:createChildren()
local gameState = getAnimationViewerState()
self.scene = Scene:new(0, 0, self.width, self.height)
self.scene:initialise()
self.scene:instantiate()
self.scene:setAnchorRight(true)
self.scene:setAnchorBottom(true)
self:addChild(self.scene)
self:resetView()
if gameState:getBoolean("Isometric") then
self.scene.javaObject:fromLua2("dragView", 0, self.height / 4)
else
self.scene.javaObject:fromLua2("dragView", 0, self.height / 3)
end
self.scene.javaObject:fromLua1("setMaxZoom", 20)
self.scene.javaObject:fromLua1("setZoom", 7)
self.scene.javaObject:fromLua1("setGizmoScale", 1.0 / 5.0)
self.scene.javaObject:fromLua1("setDrawGrid", gameState:getBoolean("DrawGrid"))
self.scene.javaObject:fromLua1("setDrawGridAxes", true)
self.scene.javaObject:fromLua1("setGridPlane", "XZ")
self.scene.javaObject:fromLua1("createCharacter", "character1")
self.scene.javaObject:fromLua2("setCharacterAlpha", "character1", 1.0)
self.scene.javaObject:fromLua2("setCharacterAnimate", "character1", self.animate)
self.scene.javaObject:fromLua2("setCharacterAnimSet", "character1", "player-editor")
self.scene.javaObject:fromLua2("setCharacterState", "character1", "runtime")
self.scene.javaObject:fromLua2("setCharacterClearDepthBuffer", "character1", false)
self.scene.javaObject:fromLua2("setCharacterShowBones", "character1", false)
self.scene.javaObject:fromLua2("setCharacterUseDeferredMovement", "character1", gameState:getBoolean("UseDeferredMovement"))
self.scene.javaObject:fromLua2("setObjectVisible", "character1", true)
self:createToolbar()
local bottomH = 100
self.filter = ISTextEntryBox:new("", 10, 10, 250, FONT_HGT_MEDIUM + 2 * 2)
self.filter.font = UIFont.Medium
self:addChild(self.filter)
self.filter:setClearButton(true)
local listY = self.filter:getBottom() + 4
local listBox = ListBox:new(10, listY, 250, self.height - bottomH - 10 - listY)
listBox:setAnchorBottom(true)
self:addChild(listBox)
listBox:setFont(UIFont.Small, 2)
self.listBox = listBox
self:setClipList()
self.bottomPanel = ISPanel:new(0, self.height - bottomH, self.width, bottomH)
self.bottomPanel:setAnchorTop(false)
self.bottomPanel:setAnchorLeft(false)
self.bottomPanel:setAnchorRight(false)
self.bottomPanel:setAnchorBottom(true)
self.bottomPanel:noBackground()
self:addChild(self.bottomPanel)
local timeline = Timeline:new(10, 0, self.width - 10 * 2, 50)
self.bottomPanel:addChild(timeline)
self.timeline = timeline
self.speedScale = ISSliderPanel:new(self.width / 2 - 400 / 2, self.bottomPanel.y - 30, 400, 20, self, self.onSpeedScaleChanged)
self.speedScale.anchorTop = false
self.speedScale.anchorBottom = true
self.speedScale:setValues(0.0, 5.0, 0.1, 1.0)
self.speedScale:setCurrentValue(1.0, true)
self:addChild(self.speedScale)
local buttonHgt = FONT_HGT_MEDIUM + 8
local button2 = ISButton:new(10, self.bottomPanel.height - 10 - buttonHgt, 80, buttonHgt, "EXIT", self, self.onExit)
self.bottomPanel:addChild(button2)
end
function AnimationClipViewer:createToolbar()
local toolHgt = 30
self.toolBar = ISPanel:new(0, 10, 300, toolHgt)
self.toolBar:noBackground()
self:addChild(self.toolBar)
local button = ISButton:new(0, 0, 60, toolHgt, "OPTIONS", self, self.onOptions)
self.toolBar:addChild(button)
self.buttonOptions = button
self.toolBar:setWidth(button:getRight())
self.toolBar:setX(self.width / 2 - self.toolBar.width / 2)
self.optionsPanel = OptionsPanel:new(0, 0, 300, 400)
self.optionsPanel:setVisible(false)
self:addChild(self.optionsPanel)
end
function AnimationClipViewer:onSpeedScaleChanged(speed, slider)
end
function AnimationClipViewer:resetView()
self.scene:setView("UserDefined")
local gameState = getAnimationViewerState()
if gameState:getBoolean("Isometric") then
self.scene.javaObject:fromLua3("setViewRotation", 30.0, 45.0, 0.0)
self.scene.javaObject:fromLua1("setGridPlane", "XZ")
else
self.scene.javaObject:fromLua3("setViewRotation", 0.0, 0.0, 0.0)
self.scene.javaObject:fromLua1("setGridPlane", "XY")
end
end
function AnimationClipViewer:setClipList()
self.listBox:clear()
local filterText = string.trim(self.filter:getInternalText())
local clips = getAnimationViewerState():fromLua0("getClipNames")
for i=1,clips:size() do
local clipName = clips:get(i-1)
if string.contains(string.lower(clipName), filterText) then
self.listBox:addItem(clipName, clipName)
end
end
end
function AnimationClipViewer:onResolutionChange(oldw, oldh, neww, newh)
self:setWidth(neww)
self:setHeight(newh)
self.bottomPanel:setX(self.width / 2 - self.bottomPanel.width / 2)
self.speedScale:setX(self.width / 2 - self.speedScale.width / 2)
end
function AnimationClipViewer:update()
ISPanel.update(self)
if self.width ~= getCore():getScreenWidth() or self.height ~= getCore():getScreenHeight() then
self:onResolutionChange(self.width, self.height, getCore():getScreenWidth(), getCore():getScreenHeight())
end
local filterText = string.trim(self.filter:getInternalText())
if self.filterText ~= filterText then
self.filterText = filterText
self:setClipList()
end
local speed = self.speedScale:getCurrentValue()
self.scene.javaObject:fromLua2("setCharacterAnimationSpeed", "character1", speed)
end
function AnimationClipViewer:prerender()
ISPanel.prerender(self)
self.scene:prerenderEditor()
self.scene.javaObject:fromLua6("addAxis", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
end
function AnimationClipViewer:render()
ISPanel.render(self)
local time = self:getCurrentTime()
local duration = self:getDuration()
local text = string.format("SECONDS: %.2f / %.2f", time, duration)
self:drawText(text, self.width / 2 - 150, self.height - 30, 1.0, 1.0, 1.0, 1.0, UIFont.Medium)
text = string.format("FRACTION: %.2f", time / duration)
self:drawText(text, self.width / 2 + 50, self.height - 30, 1.0, 1.0, 1.0, 1.0, UIFont.Medium)
local frame = self:getCurrentFrame()
local lastFrame = self:getLastFrame()
text = string.format("FRAME: %d / %d", math.min(frame, lastFrame), lastFrame)
self:drawText(text, self.width / 2 + 200, self.height - 30, 1.0, 1.0, 1.0, 1.0, UIFont.Medium)
text = string.format("SpeedScale: %.2f", self.speedScale:getCurrentValue())
self:drawText(text, self.speedScale.x, self.speedScale.y - 8 - FONT_HGT_MEDIUM, 1.0, 1.0, 1.0, 1.0, UIFont.Medium)
end
function AnimationClipViewer:onKeyPress(key)
local fps = self:getFPS()
if key == Keyboard.KEY_LEFT then
local time = self:getCurrentTime()
local frame = self:getCurrentFrame() - 1
if time * fps - frame > 0.1 then frame = frame + 1 end
self.scene.javaObject:fromLua2("setCharacterAnimationTime", "character1", math.max(frame - 1, 0) / fps)
end
if key == Keyboard.KEY_RIGHT then
local time = self:getCurrentTime()
local frame = self:getCurrentFrame() - 1
local lastFrame = self:getLastFrame()
self.scene.javaObject:fromLua2("setCharacterAnimationTime", "character1", math.min(frame + 1, lastFrame - 1) / fps)
end
if key == Keyboard.KEY_SPACE then
self.animate = not self.animate
self.scene.javaObject:fromLua2("setCharacterAnimate", "character1", self.animate)
end
end
function AnimationClipViewer:getFPS()
return 30
end
function AnimationClipViewer:getDuration()
return self.scene.javaObject:fromLua1("getCharacterAnimationDuration", "character1") or 1.0
end
function AnimationClipViewer:getCurrentTime()
return self.scene.javaObject:fromLua1("getCharacterAnimationTime", "character1") or 0.0
end
function AnimationClipViewer:getCurrentFrame()
local fps = self:getFPS()
local time = self:getCurrentTime()
return math.floor(time * fps + 0.01) + 1
end
function AnimationClipViewer:getLastFrame()
local fps = self:getFPS()
local duration = self:getDuration()
return luautils.round(duration * fps) + 1
end
function AnimationClipViewer:onOptions()
self.optionsPanel:setX(self.buttonOptions:getAbsoluteX())
self.optionsPanel:setY(self.buttonOptions:getAbsoluteY() + self.buttonOptions:getHeight())
self.optionsPanel:setVisible(true)
end
function AnimationClipViewer:onExit(button, x, y)
getAnimationViewerState():fromLua0("exit")
end
-- Called from Java
function AnimationClipViewer:showUI()
end
function AnimationClipViewer:new(x, y, width, height)
local o = ISPanel.new(self, x, y, width, height)
o:setAnchorRight(true)
o:setAnchorBottom(true)
o:noBackground()
o:setWantKeyEvents(true)
o.animate = true
getAnimationViewerState():setTable(o)
return o
end
-- Called from Java
function AnimationViewerState_InitUI()
local UI = AnimationClipViewer:new(0, 0, getCore():getScreenWidth(), getCore():getScreenHeight())
AnimationViewerState_UI = UI
UI:setVisible(true)
UI:addToUIManager()
end
|
-- @Author:pandayu
-- @Version:1.0
-- @DateTime:2018-09-09
-- @Project:pandaCardServer CardGame
-- @Contact: QQ:815099602
local _M = function(role,data)
if not data.pos or not data.itemid then return 2 end
if type(data.itemid) ~= "table" then return 2 end
data.pos = tonumber(data.pos)
if data.pos < 1 or data.pos > 10 then return 700 end
for i,v in ipairs(data.itemid) do
if not role.army:is_equipment(data.pos,i+2,v ) and v > 0 then --装备3~6
local item = role.depot:get(v)
if not item then return 600 end
local ok = role.army:wear_equipment(data.pos,item)
if not ok then return 601 end
end
end
return 0
end
return _M
|
require "wsapi.request"
require "wsapi.response"
require "wsapi.util"
local _G, setfenv = _G, setfenv
module("orbit")
local _M = _M
setfenv(1, _G)
_M._NAME = "orbit"
_M._VERSION = "2.2.0"
_M._COPYRIGHT = "Copyright (C) 2007-2010 Kepler Project"
_M._DESCRIPTION = "MVC Web Development for the Kepler platform"
local REPARSE = {}
_M.mime_types = {
ez = "application/andrew-inset",
atom = "application/atom+xml",
hqx = "application/mac-binhex40",
cpt = "application/mac-compactpro",
mathml = "application/mathml+xml",
doc = "application/msword",
bin = "application/octet-stream",
dms = "application/octet-stream",
lha = "application/octet-stream",
lzh = "application/octet-stream",
exe = "application/octet-stream",
class = "application/octet-stream",
so = "application/octet-stream",
dll = "application/octet-stream",
dmg = "application/octet-stream",
oda = "application/oda",
ogg = "application/ogg",
pdf = "application/pdf",
ai = "application/postscript",
eps = "application/postscript",
ps = "application/postscript",
rdf = "application/rdf+xml",
smi = "application/smil",
smil = "application/smil",
gram = "application/srgs",
grxml = "application/srgs+xml",
mif = "application/vnd.mif",
xul = "application/vnd.mozilla.xul+xml",
xls = "application/vnd.ms-excel",
ppt = "application/vnd.ms-powerpoint",
rm = "application/vnd.rn-realmedia",
wbxml = "application/vnd.wap.wbxml",
wmlc = "application/vnd.wap.wmlc",
wmlsc = "application/vnd.wap.wmlscriptc",
vxml = "application/voicexml+xml",
bcpio = "application/x-bcpio",
vcd = "application/x-cdlink",
pgn = "application/x-chess-pgn",
cpio = "application/x-cpio",
csh = "application/x-csh",
dcr = "application/x-director",
dir = "application/x-director",
dxr = "application/x-director",
dvi = "application/x-dvi",
spl = "application/x-futuresplash",
gtar = "application/x-gtar",
hdf = "application/x-hdf",
xhtml = "application/xhtml+xml",
xht = "application/xhtml+xml",
js = "application/x-javascript",
skp = "application/x-koan",
skd = "application/x-koan",
skt = "application/x-koan",
skm = "application/x-koan",
latex = "application/x-latex",
xml = "application/xml",
xsl = "application/xml",
dtd = "application/xml-dtd",
nc = "application/x-netcdf",
cdf = "application/x-netcdf",
sh = "application/x-sh",
shar = "application/x-shar",
swf = "application/x-shockwave-flash",
xslt = "application/xslt+xml",
sit = "application/x-stuffit",
sv4cpio = "application/x-sv4cpio",
sv4crc = "application/x-sv4crc",
tar = "application/x-tar",
tcl = "application/x-tcl",
tex = "application/x-tex",
texinfo = "application/x-texinfo",
texi = "application/x-texinfo",
t = "application/x-troff",
tr = "application/x-troff",
roff = "application/x-troff",
man = "application/x-troff-man",
me = "application/x-troff-me",
ms = "application/x-troff-ms",
ustar = "application/x-ustar",
src = "application/x-wais-source",
zip = "application/zip",
au = "audio/basic",
snd = "audio/basic",
mid = "audio/midi",
midi = "audio/midi",
kar = "audio/midi",
mpga = "audio/mpeg",
mp2 = "audio/mpeg",
mp3 = "audio/mpeg",
aif = "audio/x-aiff",
aiff = "audio/x-aiff",
aifc = "audio/x-aiff",
m3u = "audio/x-mpegurl",
ram = "audio/x-pn-realaudio",
ra = "audio/x-pn-realaudio",
wav = "audio/x-wav",
pdb = "chemical/x-pdb",
xyz = "chemical/x-xyz",
bmp = "image/bmp",
cgm = "image/cgm",
gif = "image/gif",
ief = "image/ief",
jpeg = "image/jpeg",
jpg = "image/jpeg",
jpe = "image/jpeg",
png = "image/png",
svg = "image/svg+xml",
svgz = "image/svg+xml",
tiff = "image/tiff",
tif = "image/tiff",
djvu = "image/vnd.djvu",
djv = "image/vnd.djvu",
wbmp = "image/vnd.wap.wbmp",
ras = "image/x-cmu-raster",
ico = "image/x-icon",
pnm = "image/x-portable-anymap",
pbm = "image/x-portable-bitmap",
pgm = "image/x-portable-graymap",
ppm = "image/x-portable-pixmap",
rgb = "image/x-rgb",
xbm = "image/x-xbitmap",
xpm = "image/x-xpixmap",
xwd = "image/x-xwindowdump",
igs = "model/iges",
iges = "model/iges",
msh = "model/mesh",
mesh = "model/mesh",
silo = "model/mesh",
wrl = "model/vrml",
vrml = "model/vrml",
ics = "text/calendar",
ifb = "text/calendar",
css = "text/css",
html = "text/html",
htm = "text/html",
asc = "text/plain",
txt = "text/plain",
rtx = "text/richtext",
rtf = "text/rtf",
sgml = "text/sgml",
sgm = "text/sgml",
tsv = "text/tab-separated-values",
wml = "text/vnd.wap.wml",
wmls = "text/vnd.wap.wmlscript",
etx = "text/x-setext",
mpeg = "video/mpeg",
mpg = "video/mpeg",
mpe = "video/mpeg",
qt = "video/quicktime",
mov = "video/quicktime",
mxu = "video/vnd.mpegurl",
avi = "video/x-msvideo",
movie = "video/x-sgi-movie",
ice = "x-conference/x-cooltalk",
rss = "application/rss+xml",
atom = "application/atom+xml"
}
_M.app_module_methods = {}
local app_module_methods = _M.app_module_methods
_M.web_methods = {}
local web_methods = _M.web_methods
local function flatten(t)
local res = {}
for _, item in ipairs(t) do
if type(item) == "table" then
res[#res + 1] = flatten(item)
else
res[#res + 1] = item
end
end
return table.concat(res)
end
local function make_tag(name, data, class)
if class then class = ' class="' .. class .. '"' else class = "" end
if not data then
return "<" .. name .. class .. "/>"
elseif type(data) == "string" then
return "<" .. name .. class .. ">" .. data ..
"</" .. name .. ">"
else
local attrs = {}
for k, v in pairs(data) do
if type(k) == "string" then
table.insert(attrs, k .. '="' .. tostring(v) .. '"')
end
end
local open_tag = "<" .. name .. class .. " " ..
table.concat(attrs, " ") .. ">"
local close_tag = "</" .. name .. ">"
return open_tag .. flatten(data) .. close_tag
end
end
function _M.new(app_module)
if type(app_module) == "string" then
app_module = { _NAME = app_module }
else
app_module = app_module or {}
end
for k, v in pairs(app_module_methods) do
app_module[k] = v
end
app_module.run = function (wsapi_env)
return _M.run(app_module, wsapi_env)
end
app_module.real_path = wsapi.app_path or "."
app_module.mapper = { default = true }
app_module.not_found = function (web)
web.status = "404 Not Found"
return [[<html>
<head><title>Not Found</title></head>
<body><p>Not found!</p></body></html>]]
end
app_module.server_error = function (web, msg)
web.status = "500 Server Error"
return [[<html>
<head><title>Server Error</title></head>
<body><pre>]] .. msg .. [[</pre></body></html>]]
end
app_module.reparse = REPARSE
app_module.dispatch_table = { get = {}, post = {}, put = {}, delete = {} }
return app_module
end
local function serve_file(app_module)
return function (web)
local filename = web.real_path .. web.path_info
return app_module:serve_static(web, filename)
end
end
function app_module_methods.dispatch_get(app_module, func, ...)
for _, pat in ipairs{ ... } do
table.insert(app_module.dispatch_table.get, { pattern = pat,
handler = func })
end
end
function app_module_methods.dispatch_post(app_module, func, ...)
for _, pat in ipairs{ ... } do
table.insert(app_module.dispatch_table.post, { pattern = pat,
handler = func })
end
end
function app_module_methods.dispatch_put(app_module, func, ...)
for _, pat in ipairs{ ... } do
table.insert(app_module.dispatch_table.put, { pattern = pat,
handler = func })
end
end
function app_module_methods.dispatch_delete(app_module, func, ...)
for _, pat in ipairs{ ... } do
table.insert(app_module.dispatch_table.delete, { pattern = pat,
handler = func })
end
end
function app_module_methods.dispatch_wsapi(app_module, func, ...)
for _, pat in ipairs{ ... } do
for _, tab in pairs(app_module.dispatch_table) do
table.insert(tab, { pattern = pat, handler = func, wsapi = true })
end
end
end
function app_module_methods.dispatch_static(app_module, ...)
app_module:dispatch_get(serve_file(app_module), ...)
end
function app_module_methods.serve_static(app_module, web, filename)
local ext = string.match(filename, "%.([^%.]+)$")
if app_module.use_xsendfile then
web.headers["Content-Type"] = _M.mime_types[ext] or
"application/octet-stream"
web.headers["X-Sendfile"] = filename
return "xsendfile"
else
local file = io.open(filename, "rb")
if not file then
return app_module.not_found(web)
else
web.headers["Content-Type"] = _M.mime_types[ext] or
"application/octet-stream"
local contents = file:read("*a")
file:close()
return contents
end
end
end
local function newtag(name)
local tag = {}
setmetatable(tag, {
__call = function (_, data)
return make_tag(name, data)
end,
__index = function(_, class)
return function (data)
return make_tag(name, data, class)
end
end
})
return tag
end
local function htmlify_func(func)
local tags = {}
local env = { H = function (name)
local tag = tags[name]
if not tag then
tag = newtag(name)
tags[name] = tag
end
return tag
end
}
local old_env = getfenv(func)
setmetatable(env, { __index = function (env, name)
if old_env[name] then
return old_env[name]
else
local tag = newtag(name)
rawset(env, name, tag)
return tag
end
end })
setfenv(func, env)
end
function _M.htmlify(app_module, ...)
if type(app_module) == "function" then
htmlify_func(app_module)
for _, func in ipairs{...} do
htmlify_func(func)
end
else
local patterns = { ... }
for _, patt in ipairs(patterns) do
if type(patt) == "function" then
htmlify_func(patt)
else
for name, func in pairs(app_module) do
if string.match(name, "^" .. patt .. "$") and
type(func) == "function" then
htmlify_func(func)
end
end
end
end
end
end
app_module_methods.htmlify = _M.htmlify
function app_module_methods.model(app_module, ...)
if app_module.mapper.default then
local table_prefix = (app_module._NAME and app_module._NAME .. "_") or ""
if not orbit.model then
require "orbit.model"
end
app_module.mapper = orbit.model.new(app_module.mapper.table_prefix or table_prefix,
app_module.mapper.conn, app_module.mapper.driver, app_module.mapper.logging)
end
return app_module.mapper:new(...)
end
function web_methods:redirect(url)
self.status = "302 Found"
self.headers["Location"] = url
return "redirect"
end
function web_methods:link(url, params)
local link = {}
local prefix = self.prefix or ""
local suffix = self.suffix or ""
for k, v in pairs(params or {}) do
link[#link + 1] = k .. "=" .. wsapi.util.url_encode(v)
end
local qs = table.concat(link, "&")
if qs and qs ~= "" then
return prefix .. url .. suffix .. "?" .. qs
else
return prefix .. url .. suffix
end
end
function web_methods:static_link(url)
local prefix = self.prefix or self.script_name
local is_script = prefix:match("(%.%w+)$")
if not is_script then return self:link(url) end
local vpath = prefix:match("(.*)/") or ""
return vpath .. url
end
function web_methods:empty(s)
return not s or string.match(s, "^%s*$")
end
function web_methods:content_type(s)
self.headers["Content-Type"] = s
end
function web_methods:page(name, env)
if not orbit.pages then
require "orbit.pages"
end
local filename
if name:sub(1, 1) == "/" then
filename = self.doc_root .. name
else
filename = self.real_path .. "/" .. name
end
local template = orbit.pages.load(filename)
if template then
return orbit.pages.fill(self, template, env)
end
end
function web_methods:page_inline(contents, env)
if not orbit.pages then
require "orbit.pages"
end
local template = orbit.pages.load(nil, contents)
if template then
return orbit.pages.fill(self, template, env)
end
end
function web_methods:empty_param(param)
return self:empty(self.input[param])
end
for name, func in pairs(wsapi.util) do
web_methods[name] = function (self, ...)
return func(...)
end
end
local function dispatcher(app_module, method, path, index)
index = index or 0
if #app_module.dispatch_table[method] == 0 then
return app_module["handle_" .. method], {}
else
for index = index+1, #app_module.dispatch_table[method] do
local item = app_module.dispatch_table[method][index]
local captures
if type(item.pattern) == "string" then
captures = { string.match(path, "^" .. item.pattern .. "$") }
else
captures = { item.pattern:match(path) }
end
if #captures > 0 then
for i = 1, #captures do
if type(captures[i]) == "string" then
captures[i] = wsapi.util.url_decode(captures[i])
end
end
return item.handler, captures, item.wsapi, index
end
end
end
end
local function make_web_object(app_module, wsapi_env)
local web = { status = "200 Ok", response = "",
headers = { ["Content-Type"]= "text/html" },
cookies = {} }
setmetatable(web, { __index = web_methods })
web.vars = wsapi_env
web.prefix = app_module.prefix or wsapi_env.SCRIPT_NAME
web.suffix = app_module.suffix
if wsapi_env.APP_PATH == "" then
web.real_path = app_module.real_path or "."
else
web.real_path = wsapi_env.APP_PATH
end
web.doc_root = wsapi_env.DOCUMENT_ROOT
local req = wsapi.request.new(wsapi_env)
local res = wsapi.response.new(web.status, web.headers)
web.set_cookie = function (_, name, value)
res:set_cookie(name, value)
end
web.delete_cookie = function (_, name, path)
res:delete_cookie(name, path)
end
web.path_info = req.path_info
web.path_translated = wsapi_env.PATH_TRANSLATED
if web.path_translated == "" then web.path_translated = wsapi_env.SCRIPT_FILENAME end
web.script_name = wsapi_env.SCRIPT_NAME
web.method = string.lower(req.method)
web.input, web.cookies = req.params, req.cookies
web.GET, web.POST = req.GET, req.POST
return web, res
end
function _M.run(app_module, wsapi_env)
local handler, captures, wsapi_handler, index = dispatcher(app_module,
string.lower(wsapi_env.REQUEST_METHOD),
wsapi_env.PATH_INFO)
handler = handler or app_module.not_found
captures = captures or {}
if wsapi_handler then
local ok, status, headers, res = xpcall(function ()
return handler(wsapi_env, unpack(captures))
end, debug.traceback)
if ok then
return status, headers, res
else
handler, captures = app_module.server_error, { status }
end
end
local web, res = make_web_object(app_module, wsapi_env)
repeat
local reparse = false
local ok, response = xpcall(function ()
return handler(web, unpack(captures))
end, debug.traceback)
if not ok then
res.status = "500 Internal Server Error"
res:write(app_module.server_error(web, response))
else
if response == REPARSE then
reparse = true
handler, captures, wsapi_handler, index = dispatcher(app_module,
string.lower(wsapi_env.REQUEST_METHOD),
wsapi_env.PATH_INFO, index)
handler, captures = handler or app_module.not_found, captures or {}
if wsapi_handler then
error("cannot reparse to WSAPI handler")
end
else
res.status = web.status
res:write(response)
end
end
until not reparse
return res:finish()
end
return _M
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.