content stringlengths 5 1.05M |
|---|
return function()
local Janitor = require(script.Parent)
describe("Janitor.is", function()
it("should recognize janitor constructed from Janitor.new function", function()
expect(function()
assert(Janitor.is(Janitor.new()) == true)
end).never.throw()
end)
end)
end
|
-- * Metronome IM *
--
-- This file is part of the Metronome XMPP server and is released under the
-- ISC License, please see the LICENSE file in this source package for more
-- information about copyright and licensing.
module:set_global()
local jid_bare = require "util.jid".bare
-- Setup, Init functions.
-- initialize function counter table on the global object on start
function init_counter()
metronome.stanza_counter = {
iq = { incoming = 0, outgoing = 0 },
message = { incoming = 0, outgoing = 0 },
presence = { incoming = 0, outgoing = 0 }
}
end
-- Basic Stanzas' Counters
local function callback(check)
return function(self)
local name = self.stanza.name
if not metronome.stanza_counter then init_counter() end
if check then
metronome.stanza_counter[name].outgoing = metronome.stanza_counter[name].outgoing + 1
else
metronome.stanza_counter[name].incoming = metronome.stanza_counter[name].incoming + 1
end
end
end
function module.add_host(module)
-- Hook all pre-stanza events.
module:hook("pre-iq/bare", callback(true), 999)
module:hook("pre-iq/full", callback(true), 999)
module:hook("pre-iq/host", callback(true), 999)
module:hook("pre-message/bare", callback(true), 999)
module:hook("pre-message/full", callback(true), 999)
module:hook("pre-message/host", callback(true), 999)
module:hook("pre-presence/bare", callback(true), 999)
module:hook("pre-presence/full", callback(true), 999)
module:hook("pre-presence/host", callback(true), 999)
-- Hook all stanza events.
module:hook("iq/bare", callback(false), 999)
module:hook("iq/full", callback(false), 999)
module:hook("iq/host", callback(false), 999)
module:hook("message/bare", callback(false), 999)
module:hook("message/full", callback(false), 999)
module:hook("message/host", callback(false), 999)
module:hook("presence/bare", callback(false), 999)
module:hook("presence/full", callback(false), 999)
module:hook("presence/host", callback(false), 999)
end
-- Set up!
module:hook("server-started", init_counter);
|
local pairs = pairs
local GetSpellInfo = GetSpellInfo
local CreateFrame = CreateFrame
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local Auras = Gladdy:NewModule("Auras", nil, {
auraFontSize = 16,
auraFontColor = {r = 1, g = 1, b = 0, a = 1}
})
function Auras:Initialise()
self.frames = {}
self.auras = self:GetAuraList()
self:RegisterMessage("AURA_GAIN")
self:RegisterMessage("AURA_FADE")
self:RegisterMessage("UNIT_DEATH", "AURA_FADE")
end
function Auras:CreateFrame(unit)
local auraFrame = CreateFrame("Frame", nil, Gladdy.buttons[unit])
auraFrame:ClearAllPoints()
auraFrame:SetPoint("TOPLEFT", auraFrame:GetParent(), "TOPLEFT", -2, 0)
auraFrame:SetScript("OnUpdate", function(self, elapsed)
if (self.active) then
if (self.timeLeft <= 0) then
Auras:AURA_FADE(unit)
else
self.timeLeft = self.timeLeft - elapsed
self.text:SetFormattedText("%.1f", self.timeLeft)
end
end
end)
auraFrame.icon = auraFrame:CreateTexture(nil, "ARTWORK")
auraFrame.icon:SetAllPoints(auraFrame)
auraFrame.text = auraFrame:CreateFontString(nil, "OVERLAY")
auraFrame.text:SetFont(Gladdy.LSM:Fetch("font"), Gladdy.db.auraFontSize)
auraFrame.text:SetTextColor(Gladdy.db.auraFontColor.r, Gladdy.db.auraFontColor.g, Gladdy.db.auraFontColor.b, Gladdy.db.auraFontColor.a)
auraFrame.text:SetShadowOffset(1, -1)
auraFrame.text:SetShadowColor(0, 0, 0, 1)
auraFrame.text:SetJustifyH("CENTER")
auraFrame.text:SetPoint("CENTER")
self.frames[unit] = auraFrame
self:ResetUnit(unit)
end
function Auras:UpdateFrame(unit)
local auraFrame = self.frames[unit]
if (not auraFrame) then return end
local classIcon = Gladdy.modules.Classicon.frames[unit]
auraFrame:SetWidth(classIcon:GetWidth())
auraFrame:SetHeight(classIcon:GetHeight())
auraFrame.text:SetFont(Gladdy.LSM:Fetch("font"), Gladdy.db.auraFontSize)
auraFrame.text:SetTextColor(Gladdy.db.auraFontColor.r, Gladdy.db.auraFontColor.g, Gladdy.db.auraFontColor.b, Gladdy.db.auraFontColor.a)
end
function Auras:ResetUnit(unit)
self:AURA_FADE(unit)
end
function Auras:Test(unit)
local aura, _, icon
if (unit == "arena1") then
aura, _, icon = GetSpellInfo(12826)
elseif (unit == "arena3") then
aura, _, icon = GetSpellInfo(31224)
end
if (aura) then
self:AURA_GAIN(unit, aura, icon, self.auras[aura].duration, self.auras[aura].priority)
end
end
function Auras:AURA_GAIN(unit, aura, icon, duration, priority)
local auraFrame = self.frames[unit]
if (not auraFrame) then return end
if (auraFrame.priority and auraFrame.priority > priority) then
return
end
auraFrame.name = aura
auraFrame.timeLeft = duration
auraFrame.priority = priority
auraFrame.icon:SetTexture(icon)
auraFrame.active = true
end
function Auras:AURA_FADE(unit)
local auraFrame = self.frames[unit]
if (not auraFrame) then return end
auraFrame.active = false
auraFrame.name = nil
auraFrame.timeLeft = 0
auraFrame.priority = nil
auraFrame.icon:SetTexture("")
auraFrame.text:SetText("")
end
local function option(params)
local defaults = {
get = function(info)
local key = info.arg or info[#info]
return Gladdy.dbi.profile[key]
end,
set = function(info, value)
local key = info.arg or info[#info]
Gladdy.dbi.profile[key] = value
Gladdy:UpdateFrame()
end,
}
for k, v in pairs(params) do
defaults[k] = v
end
return defaults
end
local function colorOption(params)
local defaults = {
get = function(info)
local key = info.arg or info[#info]
return Gladdy.dbi.profile[key].r, Gladdy.dbi.profile[key].g, Gladdy.dbi.profile[key].b, Gladdy.dbi.profile[key].a
end,
set = function(info, r, g, b ,a)
local key = info.arg or info[#info]
Gladdy.dbi.profile[key].r, Gladdy.dbi.profile[key].g, Gladdy.dbi.profile[key].b, Gladdy.dbi.profile[key].a = r, g, b, a
Gladdy:UpdateFrame()
end,
}
for k, v in pairs(params) do
defaults[k] = v
end
return defaults
end
function Auras:GetOptions()
return {
auraFontColor = colorOption({
type = "color",
name = L["Font color"],
desc = L["Color of the text"],
order = 4,
hasAlpha = true,
}),
auraFontSize = option({
type = "range",
name = L["Font size"],
desc = L["Size of the text"],
order = 5,
min = 1,
max = 20,
}),
}
end
function Auras:GetAuraList()
return {
-- Cyclone
[GetSpellInfo(33786)] = {
track = "debuff",
duration = 6,
priority = 40,
},
-- Hibername
[GetSpellInfo(18658)] = {
track = "debuff",
duration = 10,
priority = 40,
magic = true,
},
-- Entangling Roots
[GetSpellInfo(26989)] = {
track = "debuff",
duration = 10,
priority = 30,
onDamage = true,
magic = true,
root = true,
},
-- Feral Charge
[GetSpellInfo(16979)] = {
track = "debuff",
duration = 4,
priority = 30,
root = true,
},
-- Bash
[GetSpellInfo(8983)] = {
track = "debuff",
duration = 4,
priority = 30,
},
-- Pounce
[GetSpellInfo(9005)] = {
track = "debuff",
duration = 3,
priority = 40,
},
-- Maim
[GetSpellInfo(22570)] = {
track = "debuff",
duration = 6,
priority = 40,
incapacite = true,
},
-- Innervate
[GetSpellInfo(29166)] = {
track = "buff",
duration = 20,
priority = 10,
},
-- Freezing Trap Effect
[GetSpellInfo(14309)] = {
track = "debuff",
duration = 10,
priority = 40,
onDamage = true,
magic = true,
},
-- Wyvern Sting
[GetSpellInfo(19386)] = {
track = "debuff",
duration = 10,
priority = 40,
onDamage = true,
poison = true,
sleep = true,
},
-- Scatter Shot
[GetSpellInfo(19503)] = {
track = "debuff",
duration = 4,
priority = 40,
onDamage = true,
},
-- Silencing Shot
[GetSpellInfo(34490)] = {
track = "debuff",
duration = 3,
priority = 15,
magic = true,
},
-- Intimidation
[GetSpellInfo(19577)] = {
track = "debuff",
duration = 2,
priority = 40,
},
-- The Beast Within
[GetSpellInfo(34692)] = {
track = "buff",
duration = 18,
priority = 20,
},
-- Polymorph
[GetSpellInfo(12826)] = {
track = "debuff",
duration = 10,
priority = 40,
onDamage = true,
magic = true,
},
-- Dragon's Breath
[GetSpellInfo(31661)] = {
track = "debuff",
duration = 3,
priority = 40,
onDamage = true,
magic = true,
},
-- Frost Nova
[GetSpellInfo(27088)] = {
track = "debuff",
duration = 8,
priority = 30,
onDamage = true,
magic = true,
root = true,
},
-- Freeze (Water Elemental)
[GetSpellInfo(33395)] = {
track = "debuff",
duration = 8,
priority = 30,
onDamage = true,
magic = true,
root = true,
},
-- Counterspell - Silence
[GetSpellInfo(18469)] = {
track = "debuff",
duration = 4,
priority = 15,
magic = true,
},
-- Ice Block
[GetSpellInfo(45438)] = {
track = "buff",
duration = 10,
priority = 20,
},
-- Hammer of Justice
[GetSpellInfo(10308)] = {
track = "debuff",
duration = 6,
priority = 40,
magic = true,
},
-- Repentance
[GetSpellInfo(20066)] = {
track = "debuff",
duration = 6,
priority = 40,
onDamage = true,
magic = true,
incapacite = true,
},
-- Blessing of Protection
[GetSpellInfo(10278)] = {
track = "buff",
duration = 10,
priority = 10,
},
-- Blessing of Freedom
[GetSpellInfo(1044)] = {
track = "buff",
duration = 14,
priority = 10,
},
-- Divine Shield
[GetSpellInfo(642)] = {
track = "buff",
duration = 12,
priority = 20,
},
-- Psychic Scream
[GetSpellInfo(8122)] = {
track = "debuff",
duration = 8,
priority = 40,
onDamage = true,
fear = true,
magic = true,
},
-- Chastise
[GetSpellInfo(44047)] = {
track = "debuff",
duration = 8,
priority = 30,
root = true,
},
-- Mind Control
[GetSpellInfo(605)] = {
track = "debuff",
duration = 10,
priority = 40,
magic = true,
},
-- Silence
[GetSpellInfo(15487)] = {
track = "debuff",
duration = 5,
priority = 15,
magic = true,
},
-- Pain Suppression
[GetSpellInfo(33206)] = {
track = "buff",
duration = 8,
priority = 10,
},
-- Sap
[GetSpellInfo(6770)] = {
track = "debuff",
duration = 10,
priority = 40,
onDamage = true,
incapacite = true,
},
-- Blind
[GetSpellInfo(2094)] = {
track = "debuff",
duration = 10,
priority = 40,
onDamage = true,
},
-- Cheap Shot
[GetSpellInfo(1833)] = {
track = "debuff",
duration = 4,
priority = 40,
},
-- Kidney Shot
[GetSpellInfo(8643)] = {
track = "debuff",
duration = 6,
priority = 40,
},
-- Gouge
[GetSpellInfo(1776)] = {
track = "debuff",
duration = 4,
priority = 40,
onDamage = true,
incapacite = true,
},
-- Kick - Silence
[GetSpellInfo(18425)] = {
track = "debuff",
duration = 2,
priority = 15,
},
-- Garrote - Silence
[GetSpellInfo(1330)] = {
track = "debuff",
duration = 3,
priority = 15,
},
-- Cloak of Shadows
[GetSpellInfo(31224)] = {
track = "buff",
duration = 5,
priority = 20,
},
-- Fear
[GetSpellInfo(5782)] = {
track = "debuff",
duration = 10,
priority = 40,
onDamage = true,
fear = true,
magic = true,
},
-- Death Coil
[GetSpellInfo(27223)] = {
track = "debuff",
duration = 3,
priority = 40,
},
-- Shadowfury
[GetSpellInfo(30283)] = {
track = "debuff",
duration = 2,
priority = 40,
magic = true,
},
-- Seduction (Succubus)
[GetSpellInfo(6358)] = {
track = "debuff",
duration = 10,
priority = 40,
onDamage = true,
fear = true,
magic = true,
},
-- Howl of Terror
[GetSpellInfo(5484)] = {
track = "debuff",
duration = 8,
priority = 40,
onDamage = true,
fear = true,
magic = true,
},
-- Spell Lock (Felhunter)
[GetSpellInfo(24259)] = {
track = "debuff",
duration = 3,
priority = 15,
magic = true,
},
-- Unstable Affliction
[GetSpellInfo(31117)] = {
track = "debuff",
duration = 5,
priority = 15,
magic = true,
},
-- Intimidating Shout
[GetSpellInfo(5246)] = {
track = "debuff",
duration = 8,
priority = 15,
onDamage = true,
fear = true,
},
-- Concussion Blow
[GetSpellInfo(12809)] = {
track = "debuff",
duration = 5,
priority = 40,
},
-- Intercept Stun
[GetSpellInfo(25274)] = {
track = "debuff",
duration = 3,
priority = 40,
},
-- Spell Reflection
[GetSpellInfo(23920)] = {
track = "buff",
duration = 5,
priority = 10,
},
-- War Stomp
[GetSpellInfo(20549)] = {
track = "debuff",
duration = 2,
priority = 40,
},
-- Arcane Torrent
[GetSpellInfo(28730)] = {
track = "debuff",
duration = 2,
priority = 15,
magic = true,
},
}
end |
CodexDB["meta"]={
["chests"]={
[-186750]=0,
[-184935]=0,
[-184933]=0,
[-184930]=0,
[-181804]=0,
[-181802]=0,
[-181800]=0,
[-181798]=0,
[-181366]=0,
[-181083]=0,
[-181074]=0,
[-180523]=0,
[-180392]=0,
[-180229]=0,
[-180228]=0,
[-179703]=0,
[-179564]=0,
[-179528]=0,
[-176944]=0,
[-176224]=0,
[-176188]=0,
[-169243]=0,
[-161513]=0,
[-153473]=0,
[-153472]=0,
[-153471]=0,
[-153470]=0,
[-153464]=0,
[-153463]=0,
[-153462]=0,
[-153454]=0,
[-153453]=0,
[-153451]=0,
[-143980]=0,
[-142191]=0,
[-141596]=0,
[-131979]=0,
[-111095]=0,
[-106319]=0,
[-106318]=0,
[-105581]=0,
[-105579]=0,
[-105578]=0,
[-75300]=0,
[-75299]=0,
[-75298]=0,
[-75293]=0,
[-74448]=0,
[-19021]=0,
[-19020]=0,
[-19019]=0,
[-19018]=0,
[-19017]=0,
[-17155]=0,
[-13873]=0,
[-13359]=0,
[-4149]=0,
[-4096]=0,
[-3743]=0,
[-3719]=0,
[-3715]=0,
[-3707]=0,
[-3706]=0,
[-3705]=0,
[-3704]=0,
[-3703]=0,
[-3702]=0,
[-3695]=0,
[-3694]=0,
[-3693]=0,
[-3691]=0,
[-3690]=0,
[-3689]=0,
[-3662]=0,
[-3661]=0,
[-3660]=0,
[-3659]=0,
[-3658]=0,
[-2857]=0,
[-2855]=0,
[-2852]=0,
[-2850]=0,
[-2849]=0,
[-2847]=0,
[-2845]=0,
[-2844]=0,
[-2843]=0,
},
["herbs"]={
[-183046]=235,
[-180168]=270,
[-180167]=260,
[-180166]=280,
[-180165]=210,
[-180164]=230,
[-176642]=220,
[-176641]=285,
[-176640]=280,
[-176639]=270,
[-176638]=260,
[-176637]=250,
[-176636]=230,
[-176589]=300,
[-176588]=290,
[-176587]=285,
[-176586]=280,
[-176584]=270,
[-176583]=260,
[-142145]=250,
[-142144]=245,
[-142143]=235,
[-142142]=230,
[-142141]=220,
[-142140]=210,
[-3730]=100,
[-3729]=70,
[-3727]=50,
[-3726]=15,
[-3725]=0,
[-3724]=0,
[-2866]=205,
[-2046]=170,
[-2045]=85,
[-2044]=195,
[-2043]=185,
[-2042]=160,
[-2041]=150,
[-1628]=120,
[-1624]=125,
[-1623]=115,
[-1622]=100,
[-1621]=70,
[-1620]=50,
[-1619]=15,
[-1618]=0,
[-1617]=0,
},
["mines"]={
[-181249]=65,
[-181248]=0,
[-181109]=155,
[-181108]=230,
[-181069]=305,
[-181068]=305,
[-180215]=275,
[-177388]=275,
[-176645]=175,
[-176643]=245,
[-175404]=275,
[-165658]=230,
[-150082]=245,
[-150081]=230,
[-150080]=155,
[-150079]=175,
[-123848]=245,
[-123310]=175,
[-123309]=230,
[-105569]=75,
[-103713]=0,
[-103711]=65,
[-73941]=155,
[-73940]=75,
[-73939]=125,
[-19903]=150,
[-3764]=65,
[-3763]=0,
[-2653]=75,
[-2055]=0,
[-2054]=65,
[-2047]=230,
[-2040]=175,
[-1735]=125,
[-1734]=155,
[-1733]=75,
[-1732]=65,
[-1731]=0,
[-1667]=65,
[-1610]=65,
[-324]=245,
},
}
|
--[[ Repeat loops ]]
-- Simple repeat
repeat
print "Good 1"
until true
-- Simple repeat with continue
repeat
continue
until true
print "Good 2"
-- Repeat with code after a continue
repeat
print "Good 3"
if true then
continue
end
print "Bad 1"
until true
-- Repeat with locals before and after a continue and code after a deep continue
do
local n = 0
local set = {}
repeat
local p = n
n = n + 1
if p == 1 then
if p then
continue
end
end
local q = true
set[p] = q
until p == 2
if set[0] and set[2] and not set[1] and not set[3] then
print "Good 4"
else
print "Bad 2"
end
end
-- Repeat with upvalues and continue
do
local n = 0
local set = {}
repeat
local p = n
n = n + 1
set[p] = function() p = p + 1; return p end
if p == 1 then
continue
end
p = p - 1
until p == 2
if set[0]() == 0 and set[1]() == 2 and set[2]() == 2 then
if set[0]() == 1 and set[2]() == 3 then
print "Good 5"
else
print "Bad 3"
end
else
print "Bad 4"
end
end
-- Even complex until clauses are executed after a continue
do
local good = false
repeat
local p = true
if p then
continue
end
print "Bad 5"
until (function() good = function() return p end; return p end)()
if good then
print "Good 6"
else
print "Bad 6"
end
end
--[[ Numeric for loops ]]
-- Continue on non-final iteration
do
local set = {}
for i = 1, 3 do
if i == 2 then
continue
end
set[i] = i
end
if set[1] and set[3] and not set[2] and not set[4] then
print "Good 7"
else
print "Bad 7"
end
end
-- Continue on all iterations
do
local set = {}
for i = 1, 3 do
set[i] = i
continue
end
if set[1] and set[2] and set[3] and not set[4] then
print "Good 8"
else
print "Bad 8"
end
end
--[[ Generic for loops ]]
-- Continue on single iteration
do
local input = {a = true, b = true, c = false}
local output = {}
for k, v in pairs(input) do
if not v then
continue
end
output[k] = v
end
if output.a and output.b and not output.c then
print "Good 9"
else
print "Bad 9"
end
end
-- Continue on every iteration
do
local values = {false, false, false}
for k in ipairs(values) do
values[k] = true
if values[k] then
continue
end
end
if values[1] and values[2] and values[3] then
print "Good 10"
else
print "Bad 10"
end
end
--[[ While loops ]]
-- Continue on one iteration, break on one iteration
do
local i = 0
local set = {}
while true do
i = i + 1
if i == 2 then
continue
elseif i == 4 then
break
end
set[i] = true
end
if set[1] and not set[2] and set[3] and not set[4] then
print "Good 11"
else
print "Bad 11"
end
end
-- Continue on every iteration
do
local i = 1
local set = {}
while i <= 3 do
set[i] = true
i = i + 1
do
continue
end
set = {}
end
if set[1] and set[2] and set[3] and not set[4] then
print "Good 12"
else
print "Bad 12"
end
end
|
-----------------------------------
-- Area: Xarcabard
-- NPC: qm1 (???)
-- Involved in Quests: The Three Magi
-- !pos -331 -29 -49 112
-----------------------------------
local ID = require("scripts/zones/Xarcabard/IDs")
require("scripts/globals/npc_util")
require("scripts/globals/quests")
-----------------------------------
function onTrade(player, npc, trade)
if
player:getQuestStatus(WINDURST, tpz.quest.id.windurst.THE_THREE_MAGI) == QUEST_ACCEPTED and
npcUtil.tradeHas(trade, 613) and
not player:hasItem(1104) and
npcUtil.popFromQM(player, npc, ID.mob.CHAOS_ELEMENTAL)
then
player:confirmTrade()
end
end
function onTrigger(player, npc)
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end |
-- Class Definition
Character = {}
Character.__index = Character
setmetatable(Character, {
__call = function(self, playerId, data)
local character = {}
character.PlayerId = playerId
character.Id = data.Id
character.PermissionLevel = data.PermissionLevel
character.SteamId = data.SteamId
character.IsAdmin = false
character.ServerId = data.ServerId
-- gang information
character.GangId = data.GangId
character.GangRank = data.GangRank
character.GangReputation = data.GangReputation
-- arrays
character.SkinProfiles = {}
character.Inventory = {}
character.Weapons = {}
character.Vehicles = {}
character.Arrests = {}
character.Citations = {}
-- admin infomation
character.AdminShowIds = false
character.IsSpectating = false
character.LastTeleportLocation = nil
-- personal information
character.TwitterName = data.TwitterName
character.FirstName = data.FirstName
character.LastName = data.LastName
character.DateOfBirth = data.DateOfBirth
character.MobileNumber = data.MobileNumber
-- permits/licenses
character.HasWeaponPermit = data.HasWeaponPermit
character.HasConcealedPermit = data.HasConcealedPermit
character.HasHuntingPermit = data.HasHuntingPermit
character.HasRealtorLicense = data.HasRealtorLicense
-- house information
character.HouseZoneName = data.HouseZoneName
character.HouseId = data.HouseId
-- insurance information
character.HasInsurance = data.HasInsurance
character.HasMoeJack = data.HasMoeJack
character.InsuranceCost = data.InsuranceCost
character.NextInsurancePaymentAt = data.NextInsurancePaymentAt
character.NextMoeJackPaymentAt = data.NextMoeJackPaymentAt
-- officer/ems information
character.IsOfficer = data.IsOfficer
character.IsEms = data.IsEms
character.PoliceDepartment = data.PoliceDepartment
character.EmsDepartment = data.EmsDepartment
character.PoliceTag = data.PoliceTag
character.EmsTag = data.EmsTag
character.OfficerRank = data.OfficerRank
character.EmsRank = data.EmsRank
character.Status = data.Status
character.PoliceRadarSpeed = data.PoliceRadarSpeed
-- officer certifications
character.AirCertified = data.AirCertified
character.K9Certified = data.K9Certified
character.M4Certified = data.M4Certified
character.SwatCertified = data.SwatCertified
-- job
character.LastJobId = data.JobId
-- jail
character.IsInJail = data.IsInJail
character.JailReleaseDate = data.JailReleaseDate
character.JailTime = data.JailTime
character.JailReason = data.JailReason
character.TotalJailedTime = data.TotalJailedTime
character.SentToJailOn = data.SentToJailOn
-- stats
character.KilledCount = data.KilledCount
character.KnockedOutCount = data.KnockedOutCount
character.KickCount = data.KickCount
character.BanCount = data.BanCount
character.WarningCount = data.WarningCount
-- robberies
character.IsStealing = false
character.RobberyIndex = -1
-- money information
character.Cash = tonumber(data.Cash)
character.Bank = tonumber(data.Bank)
character.BitCoin = tonumber(data.BitCoin)
character.StateFines = tonumber(data.StateFines)
character.MedicalFines = tonumber(data.MedicalFines)
-- police information
character.CautionCodes = data.CautionCodes
character.IsWanted = data.IsWanted
character.WantedReason = data.WantedReason
character.WarrantAuthor = data.WarrantAuthor
-- health information
character.IsDead = data.IsDead
-- position/chat
character.Coords = { x = data.X, y = data.Y, z = data.Z }
character.LastCoords = { x = data.X, y = data.Y, z = data.Z }
-- license information
character.LicensePoints = data.LicensePoints
character.PassedDMVWritten = data.PassedDMVWritten
character.PassedDMVDriven = data.PassedDMVDriven
character.LicenseA = data.LicenseA
character.LicenseB = data.LicenseB
character.LicenseC = data.LicenseC
character.LicenseM = data.LicenseM
character.LicenseP = data.LicenseP
-- other
character.IsUsingLockpick = false
character.Tattoos = nil
-- phone
character.PhoneContacts = {}
character.PhoneMessages = {}
return setmetatable(character, Character)
end
})
|
---------------------------------------------
-- Perfect Defense
---------------------------------------------
require("scripts/globals/monstertpmoves")
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/msg")
---------------------------------------------
function onAbilityCheck(player, target, ability)
return 0,0
end
function onPetAbility(target, pet, skill, master)
local power = 100 * (master:getMP() / master:getMaxMP())
duration = 60
if (master ~= nil) then
local summoningSkill = master:getSkillLevel(tpz.skill.SUMMONING_MAGIC)
if (summoningSkill > 600) then
summoningSkill = 600
end
duration = 30 + summoningSkill / 20
end
target:delStatusEffect(tpz.effect.PERFECT_DEFENSE)
target:addStatusEffect(tpz.effect.PERFECT_DEFENSE,power,3,duration)
skill:setMsg(tpz.msg.basic.SKILL_GAIN_EFFECT)
master:setMP(0)
return tpz.effect.PERFECT_DEFENSE
end |
local Basis = require "Basis"
local DataStruct = require "DataStruct"
local Grid = require "Grid"
local Updater = require "Updater"
local Time = require "Lib.Time"
local x0, y0 = 0.0, 0.0 -- location of O
local zet = 1e9 -- Dpar/Dperp
local Dpar = 1.0 -- parallel heat conduction
local Dperp = Dpar/zet -- perpendicular heat conduction
local bx = function(x, y)
return -(y-y0)/math.sqrt((x-x0)^2+(y-y0)^2)
end
local by = function(x, y)
return (x-x0)/math.sqrt((x-x0)^2+(y-y0)^2)
end
tbl = {
lower = {-0.5, -0.5},
upper = {0.5, 0.5},
cells = {4, 4},
Dxx = function (t, z)
local x, y = z[1], z[2]
return Dpar*bx(x,y)^2 + Dperp*by(x,y)^2
end,
Dyy = function (t, z)
local x, y = z[1], z[2]
return Dperp*bx(x,y)^2 + Dpar*by(x,y)^2
end,
Dxy = function (t, z)
local x, y = z[1], z[2]
return (Dpar-Dperp)*bx(x,y)*by(x,y)
end,
}
local grid = Grid.RectCart {
lower = tbl.lower,
upper = tbl.upper,
cells = tbl.cells,
}
local basis = Basis.CartModalSerendipity {
ndim = grid:ndim(),
polyOrder = 1,
}
local function getField()
return DataStruct.Field {
onGrid = grid,
numComponents = basis:numBasis(),
ghost = {1, 1},
metaData = {
polyOrder = basis:polyOrder(),
basisType = basis:id(),
},
}
end
local Dxx = getField()
local initDxx = Updater.ProjectOnBasis {
onGrid = grid,
basis = basis,
numQuad = numQuad,
evaluate = tbl.Dxx,
projectOnGhosts = true,
}
initDxx:advance(0.0, {}, {Dxx})
local Dyy = getField()
local initDyy = Updater.ProjectOnBasis {
onGrid = grid,
basis = basis,
numQuad = numQuad,
evaluate = tbl.Dyy,
projectOnGhosts = true,
}
initDyy:advance(0.0, {}, {Dyy})
local Dxy = getField()
local initDxy = Updater.ProjectOnBasis {
onGrid = grid,
basis = basis,
numQuad = numQuad,
evaluate = tbl.Dxy,
projectOnGhosts = true,
}
initDxy:advance(0.0, {}, {Dxy})
Dxx:write("Dxx.bp")
Dyy:write("Dyy.bp")
Dxy:write("Dxy.bp")
|
function class(base, init)
local c = {} -- a new class instance
if not init and type(base) == 'function' then
init = base
base = nil
elseif type(base) == 'table' then
-- our new class is a shallow copy of the base class!
for i,v in pairs(base) do
c[i] = v
end
c._base = base
end
-- the class will be the metatable for all its objects,
-- and they will look up their methods in it.
c.__index = c
-- expose a constructor which can be called by <classname>(<args>)
local mt = {}
mt.__call = function(class_tbl, ...)
local obj = {}
setmetatable(obj,c)
if init then
init(obj,...)
else
-- make sure that any stuff from the base class is initialized!
if base and base.init then
base.init(obj, ...)
end
end
return obj
end
c.init = init
c.is_a = function(self, klass)
local m = getmetatable(self)
while m do
if m == klass then return true end
m = m._base
end
return false
end
setmetatable(c, mt)
return c
end
function isArray(t)
if type(t)~="table" then return nil,"Argument is not a table! It is: "..type(t) end
--check if all the table keys are numerical and count their number
local count=0
for k,v in pairs(t) do
if type(k)~="number" then return false else count=count+1 end
end
--all keys are numerical. now let's see if they are sequential and start with 1
for i=1,count do
--Hint: the VALUE might be "nil", in that case "not t[i]" isn't enough, that's why we check the type
if not t[i] and type(t[i])~="nil" then return false end
end
return true
end
function dumpTable(table, depth)
if (depth > 200) then
print("Error: Depth > 200 in dumpTable()")
return
end
for k,v in pairs(table) do
if (type(v) == "table") then
print(string.rep(" ", depth)..k..":")
dumpTable(v, depth+1)
else
print(string.rep(" ", depth)..k..": ",v)
end
end
end
function split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
function randomIntArray(size, max)
math.randomseed( os.time() )
local ar = {}
for i = 0, size do
ar[i] = math.random(0, max)
end
return ar
end
-- Returns the sum of a sequence of values
function sum(x)
local s = 0
for _, v in ipairs(x) do s = s + v end
return s
end
-- Calculates the arithmetic mean of a set of values
-- x : an array of values
-- returns : the arithmetic mean
function arithmetic_mean(x)
return (sum(x) / #x)
end
function compareTo(str1, str2)
if str1 == str2 then
return 0
elseif str1 < str2 then
return -1
else
return 1
end
end
function hex_to_binary(hex)
return hex:gsub('..', function(hexval)
return string.char(tonumber(hexval, 16))
end)
end
function getOS()
local raw_os_name, raw_arch_name = '', ''
-- LuaJIT shortcut
if jit and jit.os and jit.arch then
raw_os_name = jit.os
raw_arch_name = jit.arch
else
-- is popen supported?
local popen_status, popen_result = pcall(io.popen, "")
if popen_status then
popen_result:close()
-- Unix-based OS
raw_os_name = io.popen('uname -s','r'):read('*l')
raw_arch_name = io.popen('uname -m','r'):read('*l')
else
-- Windows
local env_OS = os.getenv('OS')
local env_ARCH = os.getenv('PROCESSOR_ARCHITECTURE')
if env_OS and env_ARCH then
raw_os_name, raw_arch_name = env_OS, env_ARCH
end
end
end
raw_os_name = (raw_os_name):lower()
raw_arch_name = (raw_arch_name):lower()
local os_patterns = {
['windows'] = 'Windows',
['linux'] = 'Linux',
['mac'] = 'Mac',
['darwin'] = 'Mac',
['^mingw'] = 'Windows',
['^cygwin'] = 'Windows',
['bsd$'] = 'BSD',
['SunOS'] = 'Solaris',
}
local arch_patterns = {
['^x86$'] = 'x86',
['i[%d]86'] = 'x86',
['amd64'] = 'x86_64',
['x86_64'] = 'x86_64',
['Power Macintosh'] = 'powerpc',
['^arm'] = 'arm',
['^mips'] = 'mips',
['e2k'] = 'e2k',
}
local os_name, arch_name = 'unknown', 'unknown'
for pattern, name in pairs(os_patterns) do
if raw_os_name:match(pattern) then
os_name = name
break
end
end
for pattern, name in pairs(arch_patterns) do
if raw_arch_name:match(pattern) then
arch_name = name
break
end
end
return os_name, arch_name
end |
dofile(minetest.get_modpath("mylights").."/lightbox.lua")
dofile(minetest.get_modpath("mylights").."/lightbulbs.lua")
dofile(minetest.get_modpath("mylights").."/ws.lua")
dofile(minetest.get_modpath("mylights").."/cubes.lua")
dofile(minetest.get_modpath("mylights").."/lamppost.lua")
dofile(minetest.get_modpath("mylights").."/lantern.lua")
dofile(minetest.get_modpath("mylights").."/sewer_light.lua")
dofile(minetest.get_modpath("mylights").."/ceilinglights.lua")
dofile(minetest.get_modpath("mylights").."/machine_bulbs.lua")
dofile(minetest.get_modpath("mylights").."/machine_cubes.lua")
dofile(minetest.get_modpath("mylights").."/aliases.lua")
print ("mylights loaded")
|
luaSetWaxConfig({openBindOCFunction=true})
require "TwitterTableViewController"
waxClass{"AppDelegate", protocols = {"UIApplicationDelegate"}}
function applicationDidFinishLaunching(self, application)
local f = CGSize(33.0,44.0)
local a = f.width
print("结构体", tostring(f))
local frame = UIScreen:mainScreen():bounds()
self.window = UIWindow:initWithFrame(frame)
self.window:setBackgroundColor(UIColor:orangeColor())
self.viewController = TwitterTableViewController:init()
self.window:setRootViewController(self.viewController)
self.window:makeKeyAndVisible()
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(),
toblock(
function()
print("dispatch_after hhhh");
end)
)
end
|
function _init()
end
function _draw()
end
function _update60()
end
--- [adapted from Lua wiki](http://lua-users.org/wiki/ObjectOrientationTutorial)
function make_class()
local cls = {}
function cls.new(...)
local instance = setmetatable({}, cls)
local init = cls._init
if init then
init(instance, ...)
end
return instance
end
function cls.__call(cls_, ...)
return cls_.new(...)
end
return cls
end
--- @module Crafting
Crafting = {}
--- @class Crafting.Element
--- @field i number Index for arrays.
--- @field name string Human-readable name of element.
Crafting.Element = make_class()
function Crafting.Element:_init(i, name)
self.i = i
self.name = name
end
-- TODO: figure out why this isn't callable (run main_test.lua for error)
Crafting.Element.FIRE = Crafting.Element(1, 'fire')
Crafting.Element.ICE = Crafting.Element.new(2, 'ice')
Crafting.Element.LIGHTNING = Crafting.Element.new(3, 'lightning')
Crafting.Element.WIND = Crafting.Element.new(4, 'wind')
--- @class Crafting.Item
--- a usable item, piece of equipment, or material
--- @field recipe Crafting.Recipe
--- @field desc string
Crafting.Item = {}
--- @class Crafting.Recipe
--- the recipe for an item
--- @field start Crafting.Recipe.Node
Crafting.Recipe = {}
--- @class Crafting.Recipe.Requirement
--- a Ryza material loop
--- @field element Crafting.Element
--- @field count number
Crafting.Recipe.Requirement = {}
--- @class Crafting.Recipe.Node
--- a Ryza material loop
--- @field levels Crafting.Recipe.Node.Level[]
Crafting.Recipe.Node = {}
--- @class Crafting.Recipe.Node.Level
Crafting.Recipe.Node.Level = {}
|
dependencies = {
basePath = "./deps"
}
function dependencies.load()
dir = path.join(dependencies.basePath, "premake/*.lua")
deps = os.matchfiles(dir)
for i, dep in pairs(deps) do
dep = dep:gsub(".lua", "")
require(dep)
end
end
function dependencies.imports()
for i, proj in pairs(dependencies) do
if type(i) == 'number' then
proj.import()
end
end
end
function dependencies.projects()
for i, proj in pairs(dependencies) do
if type(i) == 'number' then
proj.project()
end
end
end
newoption {
trigger = "copy-to",
description = "Optional, copy the EXE to a custom folder after build, define the path here if wanted.",
value = "PATH"
}
dependencies.load()
workspace "t7x"
startproject "t7x"
location "./build"
objdir "%{wks.location}/obj"
targetdir "%{wks.location}/bin/%{cfg.platform}/%{cfg.buildcfg}"
configurations {
"Debug",
"Release",
}
architecture "x64"
platforms "x64"
buildoptions "/std:c++latest"
systemversion "latest"
symbols "On"
staticruntime "On"
editandcontinue "Off"
warnings "Extra"
characterset "ASCII"
flags {
"NoIncrementalLink",
"NoMinimalRebuild",
"MultiProcessorCompile",
"No64BitChecks"
}
configuration "windows"
defines {
"_WINDOWS",
"WIN32",
}
configuration "Release"
optimize "Full"
buildoptions "/Os"
defines {
"NDEBUG",
}
flags {
"FatalCompileWarnings",
}
configuration "Debug"
optimize "Debug"
defines {
"DEBUG",
"_DEBUG",
}
configuration {}
project "t7x"
kind "WindowedApp"
language "C++"
pchheader "std_include.hpp"
pchsource "src/std_include.cpp"
files {
"./src/**.rc",
"./src/**.hpp",
"./src/**.cpp",
"./src/resources/**.*"
}
includedirs {
"./src",
"%{prj.location}/src",
}
resincludedirs {
"$(ProjectDir)src"
}
if _OPTIONS["copy-to"] then
postbuildcommands {
"copy /y \"$(TargetDir)*.exe\" \"" .. _OPTIONS["copy-to"] .. "\""
}
end
dependencies.imports()
group "Dependencies"
dependencies.projects()
rule "ProtobufCompiler"
display "Protobuf compiler"
location "./build"
fileExtension ".proto"
buildmessage "Compiling %(Identity) with protoc..."
buildcommands {
'@echo off',
'path "$(SolutionDir)\\..\\tools"',
'if not exist "$(ProjectDir)\\src\\proto" mkdir "$(ProjectDir)\\src\\proto"',
'protoc --error_format=msvs -I=%(RelativeDir) --cpp_out=src\\proto %(Identity)',
}
buildoutputs {
'$(ProjectDir)\\src\\proto\\%(Filename).pb.cc',
'$(ProjectDir)\\src\\proto\\%(Filename).pb.h',
} |
-- avoid memory leak
collectgarbage("setpause", 100)
collectgarbage("setstepmul", 5000)
require "mainMenu"
----------------
-- run
local scene = CCScene:create()
scene:addChild(CreateTestMenu())
CCDirector:sharedDirector():runWithScene(scene)
|
-- Keybindings
-- =============================================================================
local map = vim.api.nvim_set_keymap
-- Cursor movement
-- -----------------------------------------------------------------------------
map('n', '<up>', 'gk', {silent = true, noremap = true})
map('n', '<down>', 'gj', {silent = true, noremap = true})
map('n', '<home>', 'g<Home>', {silent = true, noremap = true})
map('n', '<end>', 'g<End>', {silent = true, noremap = true})
map('i', '<up>', '<C-o>gk', {silent = true, noremap = true})
map('i', '<down>', '<C-o>gj', {silent = true, noremap = true})
map('i', '<home>', '<C-o>g<Home>', {silent = true, noremap = true})
map('i', '<end>', '<C-o>g<End>', {silent = true, noremap = true})
-- Function keys
-- -----------------------------------------------------------------------------
map('n', '<F5>', ':NvimTreeToggle<CR>', {silent = true})
-- Leader configuration
-- -----------------------------------------------------------------------------
map('n', '<Space>', '<NOP>', {noremap = true, silent = true})
vim.g.mapleader = ' '
-- Prefix: g
-- -----------------------------------------------------------------------------
map('n', 'ga', '<Plug>(EasyAlign)', {})
map('x', 'ga', '<Plug>(EasyAlign)', {})
-- Normal mode (mappings without prefix)
-- -----------------------------------------------------------------------------
-- Clear highlighting on escale in normal mode.
map('n', '<Esc>', ':noh<CR><Esc>', {silent = true, noremap = true})
-- Insert mode
-- -----------------------------------------------------------------------------
-- Remap keys that open floaterm.
map('i', '<F1>', '<ESC><F1>', {noremap = false})
map('i', '<F2>', '<ESC><F2>', {noremap = false})
map('i', '<F3>', '<ESC><F3>', {noremap = false})
map('i', '<F4>', '<ESC><F4>', {noremap = false})
-- Visual mode
-- -----------------------------------------------------------------------------
-- Move selected line / block of text in visual mode
map('x', '<S-Up>', ':move \'<-2<CR>gv-gv', {noremap = true, silent = true})
map('x', '<S-Down>', ':move \'>+1<CR>gv-gv', {noremap = true, silent = true})
-- Terminal mode
-- -----------------------------------------------------------------------------
map('t', '<Esc>', '<C-\\><C-n>', {noremap = true, silent = true})
-- Lsp saga
-- -----------------------------------------------------------------------------
map('n', '<C-f>', '<cmd>lua require("lspsaga.action").smart_scroll_with_saga(1)<cr>', {noremap = true, silent = true})
map('n', '<C-b>', '<cmd>lua require("lspsaga.action").smart_scroll_with_saga(-1)<cr>', {noremap = true, silent = true})
-- WhichKey
-- -----------------------------------------------------------------------------
local wk = require("which-key")
-- Leader (normal mode)
-- --------------------
wk.register({
['<leader>'] = {
-- Window movement
['<Up>'] = {'<C-w>k', 'Up window'},
['<Down>'] = {'<C-w>j', 'Down window'},
['<Left>'] = {'<C-w>h', 'Left window'},
['<Right>'] = {'<C-w>l', 'Left window'},
-- UndoTree
u = {'UndotreeToggle', 'Undo tree'},
-- Buffer management
[','] = {'<cmd>Telescope buffers<cr>', 'List buffers'},
b = {
name = '+buffer',
c = {'<cmd>BufferClose<cr>', 'Close buffer'},
C = {'<cmd>BufferCloseAllButCurrent<cr>', 'Close all but current'},
d = {'<cmd>bdelete<cr>', 'Delete buffer'},
p = {'<cmd>BufferPick<cr>', 'Buffer pick'},
s = {'<cmd>setlocal spell!<cr>', 'Toggle spell'},
w = {'<cmd>StripWhitespace<cr>', 'Strip white space'},
W = {'<cmd>ToggleWhitespace<cr>', 'Toggle white space'},
['['] = {'<cmd>BufferPrevious<cr>', 'Prev. buffer'},
[']'] = {'<cmd>BufferNext<cr>', 'Next buffer'}
},
-- File management
f = {
name = '+file',
a = {'<cmd>Telescope live_grep<cr>', 'Find word'},
b = {'<cmd>Telescope marks<cr>', 'Bookmarks'},
f = {'<cmd>Telescope find_files<cr>', 'Find files'},
h = {'<cmd>Telescope oldfiles<cr>', 'History'},
},
-- LSP
l = {
name = '+lsp',
a = {'<cmd>lua require("lspsaga.codeaction").code_action()<CR>', 'Code action'},
c = {'<cmd>lua require("lspsaga.diagnostic").show_cursor_diagnostics()<cr>', 'Cursor diag.'},
d = {'<cmd>lua require("lspsaga.provider").preview_definition()<cr>', 'Preview definition'},
f = {'<cmd>lua vim.lsp.buf.formatting()<cr>', 'Buffer formatting'},
h = {'<cmd>lua require("lspsaga.provider").lsp_finder()<cr>', 'Lsp Finder'},
k = {'<cmd>lua require("lspsaga.hover").render_hover_doc()<cr>', 'Hover doc.'},
l = {'<cmd>lua require("lspsaga.diagnostic").show_line_diagnostics()<cr>', 'Line diag.'},
r = {'<cmd>lua require("lspsaga.rename").rename()<cr>', 'Rename'},
s = {'<cmd>lua require("lspsaga.signaturehelp").signature_help()<cr>', 'Signature help'},
['['] = {'<cmd>lua require("lspsaga.diagnostic").lsp_jump_diagnostic_prev()<cr>', 'Prev. diag.'},
[']'] = {'<cmd>lua require("lspsaga.diagnostic").lsp_jump_diagnostic_next()<cr>', 'Next diag.'},
},
-- Git
g = {
name = '+git',
g = {'<cmd>Git<cr>', 'Fugitive'},
s = {'<cmd>Gitsigns stage_hunk<cr>', 'Stage hunk'},
u = {'<cmd>Gitsigns undo_stage_hunk<cr>', 'Undo stage hunk'},
r = {'<cmd>Gitsigns reset_hunk<cr>', 'Reset hunk'},
R = {'<cmd>Gitsigns reset_buffer<cr>', 'Reset buffer'},
p = {'<cmd>Gitsigns preview_hunk<cr>', 'Preview hunk'},
b = {'<cmd>lua require"gitsigns".blame_line{full=true}<cr>', 'Blame line'},
S = {'<cmd>Gitsigns stage_buffer<cr>', 'Stage buffer'},
U = {'<cmd>Gitsigns reset_buffer_index<cr>', 'Reset buffer index'},
[']'] = {'<cmd>Gitsigns next_hunk<cr>', 'Next hunk'},
['['] = {'<cmd>Gitsigns prev_hunk<cr>', 'Next hunk'},
},
-- Bookmark
m = {
name = '+bookmark',
m = {'<cmd>BookmarkToggle<cr>', 'Toogle bookmark'},
i = {'<cmd>BookmarkAnnotate<cr>', 'Annotate bookmark'},
n = {'<cmd>BookmarkNext<cr>', 'Next bookmark'},
p = {'<cmd>BookmarkPrev<cr>', 'Prev. bookmark'},
},
-- Session
s = {
name = '+session',
l = {'<cmd><C-u>SessionLoad<cr>', 'Load session'},
s = {'<cmd><C-u>SessionSave<cr>', 'Save session'},
},
-- Text manipulation
t = {
name = '+text',
c = {
name = '+align comments',
l = {"<cmd>call v:lua.require('utils/align_comment').align_comments('l')<cr>", 'To the left'},
c = {"<cmd>call v:lua.require('utils/align_comment').align_comments('c')<cr>", 'To the center'},
r = {"<cmd>call v:lua.require('utils/align_comment').align_comments('r')<cr>", 'To the right'},
['.'] = {
name = '+with dot',
l = {"<cmd>call v:lua.require('utils/align_comment').align_comments_with_char('.', 'l')<cr>", 'To the left'},
c = {"<cmd>call v:lua.require('utils/align_comment').align_comments_with_char('.', 'c')<cr>", 'To the center'},
r = {"<cmd>call v:lua.require('utils/align_comment').align_comments_with_char('.', 'r')<cr>", 'To the right'},
},
},
['f'] = {
['name'] = '+fill',
['f'] = {"<cmd>call v:lua.require('utils/fill_text').fill_with_cursor_character()<cr>", 'Fill with cursor char'},
['p'] = {"<cmd>call v:lua.require('utils/fill_text').fill_with_input()<cr>", 'Fill with input pattern'}
}
},
-- Window manipulation
w = {
name = '+window',
['-'] = {'<cmd>split<cr>', 'Horiz. window'},
['|'] = {'<cmd>vsplit<cr>', 'Vert. window'},
c = {'<cmd>close<cr>', 'Close window'},
k = {'<cmd><C-w>k<cr>', 'Up window'},
j = {'<cmd><C-w>j<cr>', 'Down window'},
h = {'<cmd><C-w>h<cr>', 'Left window'},
l = {'<cmd><C-w>l<cr>', 'Right window'},
}
}
})
-- Leader (visual mode)
-- --------------------
wk.register({
['<leader>'] = {
-- LSP
l = {
name = '+lsp',
a = {'<cmd>lua require("lspsaga.codeaction").code_action()<CR>', 'Code action'},
c = {'<cmd>lua require("lspsaga.diagnostic").show_cursor_diagnostics()<cr>', 'Cursor diag.'},
d = {'<cmd>lua require("lspsaga.provider").preview_definition()<cr>', 'Preview definition'},
f = {'<cmd>lua vim.lsp.buf.formatting()<cr>', 'Buffer formatting'},
h = {'<cmd>lua require("lspsaga.provider").lsp_finder()<cr>', 'Lsp Finder'},
k = {'<cmd>lua require("lspsaga.hover").render_hover_doc()<cr>', 'Hover doc.'},
l = {'<cmd>lua require("lspsaga.diagnostic").show_line_diagnostics()<cr>', 'Line diag.'},
r = {'<cmd>lua require("lspsaga.rename").rename()<cr>', 'Rename'},
s = {'<cmd>lua require("lspsaga.signaturehelp").signature_help()<cr>', 'Signature help'},
['['] = {'<cmd>lua require("lspsaga.diagnostic").lsp_jump_diagnostic_prev()<cr>', 'Prev. diag.'},
[']'] = {'<cmd>lua require("lspsaga.diagnostic").lsp_jump_diagnostic_next()<cr>', 'Next diag.'},
},
-- Git
g = {
name = '+git',
s = {':Gitsigns stage_hunk<cr>', 'Stage hunk'},
r = {':Gitsigns reset_hunk<cr>', 'Reset hunk'},
},
-- Text manipulation
t = {
name = '+text',
c = {
name = '+align comments',
l = {"<cmd>call v:lua.require('utils/align_comment').align_comments('l')<cr>", 'To the left'},
c = {"<cmd>call v:lua.require('utils/align_comment').align_comments('c')<cr>", 'To the center'},
r = {"<cmd>call v:lua.require('utils/align_comment').align_comments('r')<cr>", 'To the right'},
['.'] = {
name = '+with dot',
l = {"<cmd>call v:lua.require('utils/align_comment').align_comments_with_char('.', 'l')<cr>", 'To the left'},
c = {"<cmd>call v:lua.require('utils/align_comment').align_comments_with_char('.', 'c')<cr>", 'To the center'},
r = {"<cmd>call v:lua.require('utils/align_comment').align_comments_with_char('.', 'r')<cr>", 'To the right'},
},
},
['f'] = {
['name'] = '+fill',
['f'] = {"<cmd>call v:lua.require('utils/fill_text').fill_with_cursor_character()<cr>", 'Fill with cursor char'},
['p'] = {"<cmd>call v:lua.require('utils/fill_text').fill_with_input()<cr>", 'Fill with input pattern'}
}
},
}
}, {
mode = 'v',
})
-- s
-- -----------------------------------------------------------------------------
wk.register({
s = {
name = 'Hop',
l = {'<cmd>HopLine<cr>', 'Hop line'},
s = {'<cmd>HopChar2<cr>', 'Hop char 2'},
w = {'<cmd>HopWord<cr>', 'Hop word'},
}
})
|
local MAKE_SNAPSHOT
game._snapshots = {}
stead.make_snapshot = function(nr)
if not stead.tonum(nr) then nr = 0 end
local h = { };
h.txt = ''
h.write = function(s, ...)
local a = {...};
for i = 1, stead.table.maxn(a) do
s.txt = s.txt .. stead.tostr(a[i]);
end
end
local old = game._snapshots; game._snapshots = nil
stead.do_savegame(game, h);
game._snapshots = old
game._snapshots[nr] = h.txt;
end
function isSnapshot(nr)
if not stead.tonum(nr) then nr = 0 end
return (game._snapshots[nr] ~= nil)
end
stead.restore_snapshot = function (nr)
if not stead.tonum(nr) then nr = 0 end
local ss = game._snapshots
if not ss[nr] then return nil, true end -- nothing todo
local i,v
if stead.api_atleast(1, 7, 1) then
stead.gamereset("main.lua", true);
else
stead.gamefile("main.lua", true);
end
local f, err = stead.eval(ss[nr]..' ');
if not f then return end
local i,r = f();
game._snapshots = ss
if r then
return nil, false
end
i = stead.do_ini(game, true);
if stead.api_atleast(1, 7, 1) then
i = game:start()
stead.rawset(_G, 'PLAYER_MOVED', true) -- force fading
else -- legacy
if not game.showlast then
stead.last_disp(false)
end
i = stead.cat('', stead.last_disp())
end
stead.rawset(_G, 'RAW_TEXT', true)
-- delete_snapshot(nr);
if stead.cctx() then
stead.pr(i)
end
return i;
end
stead.delete_snapshot = function(nr)
if not stead.tonum(nr) then nr = 0 end
game._snapshots[nr] = nil
end
function make_snapshot(nr)
if stead.type(nr) ~= 'number' then
nr = 0
end
MAKE_SNAPSHOT = nr
end
function restore_snapshot(nr)
return stead.restore_snapshot(nr)
end
function delete_snapshot(nr)
return stead.delete_snapshot(nr);
end
iface.cmd = stead.hook(iface.cmd, function(f, ...)
local r,v = f(...);
if MAKE_SNAPSHOT ~= nil then
stead.make_snapshot(MAKE_SNAPSHOT);
MAKE_SNAPSHOT = nil
end
return r,v
end)
-- vim:ts=4
|
Talk(0, "小师父,你先回龙门客栈,若有需要你帮忙时,我再去找你.", "talkname0", 1);
Leave(49);
ModifyEvent(60, 2, 1, 1, -1, -1, -1, 6650, 6694, 6650, 20, -2, -2);
ModifyEvent(60, 15, 1, 1, 983, -1, -1, 6604, 6648, 6604, 20, -2, -2);
do return end;
|
local varm_util = require("modules/varm_util")
local node_reqs = {}
-- ('Set Variable: A = !B' Node)
function node_reqs.ensure_support_methods(node, proj_state)
-- Only primitive types, so no required includes to check.
return true
end
-- ('Set Variable: A = !B' Node)
function node_reqs.append_node(node, node_graph, proj_state)
local node_text = ' // ("Set Variable logical-not" node)\n'
node_text = node_text .. ' NODE_' .. node.node_ind .. ':\n'
-- (The actual variable setting.)
if node.options.var_a_name ~= '(None)' and node.options.var_b_name ~= '(None)' then
node_text = node_text .. ' ' .. node.options.var_a_name .. ' = !' .. node.options.var_b_name .. ';\n'
else
return nil
end
-- (Done.)
if node.output and node.output.single then
node_text = node_text .. ' goto NODE_' .. node.output.single .. ';\n'
else
return nil
end
node_text = node_text .. ' // (End "Set Variable logical-not" node)\n\n'
if not varm_util.code_node_lode(node, node_text, proj_state) then
return nil
end
return true
end
return node_reqs
|
local table1 = {1,2,3}
local table2 = table1
table2[3] = 4
print(unpack(table1))
|
minetest.register_on_dieplayer(function(player)
local pname = player:get_player_name()
local pos = player:getpos()
pos.x = math.floor(pos.x)
pos.y = math.floor(pos.y)
pos.z = math.floor(pos.z)
minetest.chat_send_player(pname, "You died at " ..pos.x.. ", " ..pos.y.. ", " ..pos.z)
minetest.log("action", "Player '" ..pname.. "' died at: " ..pos.x.. ", " ..pos.y.. ", " ..pos.z)
end)
|
grenade_imperial_detonator = {
minimumLevel = 0,
maximumLevel = -1,
customObjectName = "Imperial detonator grenade",
directObjectTemplate = "object/weapon/ranged/grenade/grenade_imperial_detonator.iff",
craftingValues = {
{"mindamage",645,989,0},
{"maxdamage",1300,2000,0},
{"attackspeed",6,2.5,1},
{"woundchance",7,13,0},
{"hitpoints",1000,1000,0},
{"zerorangemod",-16,14,0},
{"maxrange",64,64,0},
{"maxrangemod",-45,-15,0},
{"midrange",0,30,0},
{"midrangemod",10,30,0},
{"attackhealthcost",163,88,0},
{"attackactioncost",163,88,0},
{"attackmindcost",65,35,0},
},
-- randomDotChance: The chance of this weapon object dropping with a random dot on it. Higher number means less chance. Set to 0 to always have a random dot.
randomDotChance = 1000,
junkDealerTypeNeeded = JUNKWEAPONS,
junkMinValue = 30,
junkMaxValue = 55
}
addLootItemTemplate("grenade_imperial_detonator", grenade_imperial_detonator)
|
local lz4 = require("lz4")
local readfile = require("readfile")
local function decompress(s, e, size)
local ds = lz4.block_decompress_safe(e, size)
assert(s == ds)
local df = lz4.block_decompress_fast(e, size)
assert(s == df)
end
local function test_block(s)
local e1 = lz4.block_compress(s)
decompress(s, e1, #s)
local e2 = lz4.block_compress_hc(s)
decompress(s, e2, #s)
print(#e1.."/"..#e2.."/"..#s)
end
test_block(string.rep("0123456789", 100000))
test_block(readfile("../lua_lz4.c"))
test_block(readfile("../LICENSE"))
print("ok")
|
local Vector=require("vector")
require("objects")
backgroundColor=draw.white
textColor=draw.gray
defaultColor=draw.black
scale=60/1
drawScale=true
function computeForces(o)
table.insert(o.forces,{
f=Vector(0,0),
r=Vector(0,0)
})
end
function initObjects()
initCircle{x=2,y=2,r=0.5,Vx=5,Vy=0,m=1.5,fill=false,name="1"}
initCircle{x=8,y=2,r=0.5,Vx=-2,Vy=0,m=2,fill=false,name="2"}
end |
require 'nn';
require 'nngraph';
local san = {}
function san.n_attention_layer(img_feat_size, img_tr_size, rnn_size, common_embedding_size, num_attention_layer, num_last_fc, fc1_size, fc2_size, non_linearity, num_visual_concepts)
local inputs, outputs = {}, {}
table.insert(inputs, nn.Identity()())
table.insert(inputs, nn.Identity()())
local img_feat = inputs[1]
local ques_feat = inputs[2]
local u = ques_feat
local img_tr = nn.Dropout(0.5)(nn.Tanh()(nn.View(-1, 196, img_tr_size)(nn.Linear(img_feat_size, img_tr_size)(nn.View(img_feat_size):setNumInputDims(2)(img_feat)))))
for i = 1, num_attention_layer do
-- linear layer: 14x14x512 -> 14x14x512
local img_common = nn.View(-1, 196, common_embedding_size)(nn.Linear(img_tr_size, common_embedding_size)(nn.View(-1, img_tr_size)(img_tr)))
-- replicate lstm state 196 times
local ques_common = nn.Linear(rnn_size, common_embedding_size)(u)
local ques_repl = nn.Replicate(196, 2)(ques_common)
-- add image and question features (both 196x512)
local img_ques_common = nn.Dropout(0.5)(nn.Tanh()(nn.CAddTable()({img_common, ques_repl})))
local h = nn.Linear(common_embedding_size, 1)(nn.View(-1, common_embedding_size)(img_ques_common))
local p = nn.SoftMax()(nn.View(-1, 196)(h))
-- weighted sum of image features
local p_att = nn.View(1, -1):setNumInputDims(1)(p)
local img_tr_att = nn.MM(false, false)({p_att, img_tr})
local img_tr_att_feat = nn.View(-1, img_tr_size)(img_tr_att)
-- add image feature vector and question vector
if i == num_attention_layer then
u = img_tr_att_feat
else
u = nn.CAddTable()({img_tr_att_feat, u})
end
end
if num_last_fc == 2 then
if non_linearity == 'tanh' then
local o = nn.Linear(fc1_size,num_visual_concepts)(nn.Dropout(0.5)(nn.Tanh()(nn.Linear(img_tr_size, fc1_size)(nn.Dropout(0.5)(u)))))
table.insert(outputs, o)
elseif non_linearity == 'relu' then
local o = nn.Linear(fc1_size,num_visual_concepts)(nn.Dropout(0.5)(nn.ReLU()(nn.Linear(img_tr_size, fc1_size)(nn.Dropout(0.5)(u)))))
table.insert(outputs, o)
end
elseif num_last_fc == 3 then
if non_linearity == 'tanh' then
local o = nn.Linear(fc2_size,num_visual_concepts)(nn.Dropout(0.5)(nn.Tanh()(nn.Linear(fc1_size,fc2_size)(nn.Dropout(0.5)(nn.Tanh()(nn.Linear(img_tr_size, fc1_size)(nn.Dropout(0.5)(u))))))))
table.insert(outputs, o)
elseif non_linearity == 'relu' then
local o = nn.Linear(fc2_size,num_visual_concepts)(nn.Dropout(0.5)(nn.ReLU()(nn.Linear(fc1_size,fc2_size)(nn.Dropout(0.5)(nn.ReLU()(nn.Linear(img_tr_size, fc1_size)(nn.Dropout(0.5)(u))))))))
table.insert(outputs, o)
end
end
return nn.gModule(inputs, outputs)
end
return san
|
local addonName = ...;
-- @class RisenAuctions
local RisenAuctions = LibStub("AceAddon-3.0"):NewAddon("RisenAuctions",
"AceConsole-3.0",
"AceEvent-3.0",
"AceHook-3.0");
RisenAuctions.Version = GetAddOnMetadata(addonName, 'Version');
function RisenAuctions:OnInitialize()
-- self:InitDatabase();
-- self:RegisterOptionWindow();
self:RegisterEvent('AUCTION_HOUSE_SHOW');
self:RegisterEvent('AUCTION_HOUSE_CLOSED');
-- if not self.db.riAuctionsDb then self.db.riAuctionsDb = {} end
RisenAuctions:Print("initialized");
end
function RisenAuctions:OnEnable()
-- Called when the addon is enabled
RisenAuctions:Print("enabled");
end
function RisenAuctions:OnDisable()
-- Called when the addon is disabled
RisenAuctions:Print("disabled");
end
function RisenAuctions:AUCTION_HOUSE_SHOW() end
function RisenAuctions:AUCTION_HOUSE_CLOSED() end
|
ITEM.name = "Hellhound Meat"
ITEM.description = "Uncooked meat from a Hellhound."
ITEM.longdesc = "This chunk of meat from the mutated type of dog called a Hellhound feels warm to the touch, even though it was killed hours ago. Considered a delicacy among STALKERs used to eating the regular dog meat."
ITEM.model = "models/lostsignalproject/items/consumable/raw_dog.mdl"
ITEM.price = 1680
ITEM.width = 1
ITEM.height = 1
ITEM.WeightPerHunger = 0.040
ITEM.BaseWeight = 0.688
ITEM.WeightPerLevel = 0.276
ITEM.meal = "meal_hellhound"
ITEM.img = ix.util.GetMaterial("cotz/ui/icons/food_13.png")
ITEM.sound = "stalkersound/inv_eat_mutant_food.mp3"
ITEM:Hook("use", function(item)
item.player:EmitSound(item.sound or "items/battery_pickup.wav")
item.player:AddBuff("debuff_radiation", 10, { amount = 16/20 })
ix.chat.Send(item.player, "iteminternal", "eats a bit of their "..item.name..".", false)
end)
function ITEM:PopulateTooltipIndividual(tooltip)
if !self.entity then
ix.util.PropertyDesc(tooltip, "Low Tier Mutant Meat", Color(0, 255, 0))
ix.util.PropertyDesc(tooltip, "Toxic Food", Color(255, 0, 0))
end
end |
modifier_pet_summoner_critters = class({})
function modifier_pet_summoner_critters:CheckState()
return {
[MODIFIER_STATE_DISARMED] = true,
[MODIFIER_STATE_HEXED] = true,
[MODIFIER_STATE_MUTED] = true,
[MODIFIER_STATE_SILENCED] = true
}
end
function modifier_pet_summoner_critters:DeclareFunctions()
return {
MODIFIER_PROPERTY_MODEL_CHANGE,
MODIFIER_PROPERTY_MOVESPEED_BASE_OVERRIDE,
MODIFIER_PROPERTY_PROVIDES_FOW_POSITION
}
end
function modifier_pet_summoner_critters:GetModifierModelChange()
return "models/items/courier/courier_janjou/courier_janjou.vmdl"
end
function modifier_pet_summoner_critters:GetModifierMoveSpeedOverride()
return 140
end
function modifier_pet_summoner_critters:GetModifierProvidesFOWVision() return 1 end
function modifier_pet_summoner_critters:IsPurgable() return false end
function modifier_pet_summoner_critters:GetTexture() return "lion_voodoo" end
modifier_pet_summoner_mittens_meow_aura = class({})
function modifier_pet_summoner_mittens_meow_aura:IsPurgable() return false end
function modifier_pet_summoner_mittens_meow_aura:RemoveOnDeath() return false end
function modifier_pet_summoner_mittens_meow_aura:IsHidden() return true end
function modifier_pet_summoner_mittens_meow_aura:IsAura() return true end
function modifier_pet_summoner_mittens_meow_aura:GetModifierAura()
return "modifier_pet_summoner_mittens_meow"
end
function modifier_pet_summoner_mittens_meow_aura:GetAuraRadius() return 99999 end
function modifier_pet_summoner_mittens_meow_aura:GetAuraSearchTeam() return DOTA_UNIT_TARGET_TEAM_FRIENDLY end
function modifier_pet_summoner_mittens_meow_aura:GetAuraSearchType() return DOTA_UNIT_TARGET_BASIC+DOTA_UNIT_TARGET_HERO end
function modifier_pet_summoner_mittens_meow_aura:GetAuraSearchFlags() return DOTA_UNIT_TARGET_FLAG_NONE end
function modifier_pet_summoner_mittens_meow_aura:GetAuraEntityReject(hTarget)
if hTarget:GetPlayerOwnerID() == self:GetParent():GetPlayerOwnerID() then return false else return true end
end
modifier_pet_summoner_mittens_meow = class({})
function modifier_pet_summoner_mittens_meow:DeclareFunctions() return {MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE} end
function modifier_pet_summoner_mittens_meow:GetModifierPreAttack_BonusDamage()
if self:GetCaster():PassivesDisabled() then
return 0
else
return self:GetAbility():GetSpecialValueFor("bonus_damage")
end
end |
--esmobs v1.3
--maikerumine
--made for Extreme Survival game
--License for code is WTFPL
-------------------------
--BAD NPC'S
-------------------------
mobs:register_mob("esmobs:badplayer2", {
type = "monster",
hp_min = 35,
hp_max = 75,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_2.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_steel"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 3,
drops = {
{name = "default:jungletree",
chance = 1,
min = 0,
max = 2,},
{name = "default:sword_steel",
chance = 2,
min = 0,
max = 1,},
{name = "default:stick",
chance = 2,
min = 0,
max=3,},
},
armor = 100,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch2",
},
})
mobs:register_mob("esmobs:badplayer3", {
type = "monster",
hp_min = 49,
hp_max = 83,
collisionbox = {-0.3, -0.6, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_3.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_steel"].inventory_image,
},
visual_size = {x=1.2, y=.7},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 0.1,
run_velocity = 2,
damage = 3,
drops = {
{name = "default:stone_with_mese",
chance = 7,
min = 0,
max = 5,},
{name = "default:sword_steel",
chance = 1,
min = 0,
max = 1,},
{name = "default:apple",
chance = 1,
min = 1,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell2",
death = "mobs_howl",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:badplayer4", {
type = "monster",
hp_min = 37,
hp_max = 82,
collisionbox = {-0.3, -1.3, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_4.png",
"3d_armor_trans.png",
minetest.registered_items["default:pick_steel"].inventory_image,
},
visual_size = {x=1.2, y=1.3},
makes_footstep_sound = true,
view_range = 19,
walk_velocity = 1,
run_velocity = 3,
damage = 3,
drops = {
{name = "default:sword_steel",
chance = 2,
min =0,
max = 1,},
{name = "default:pick_steel",
chance = 4,
min = 0,
max = 1,},
{name = "default:steel_ingot",
chance = 2,
min = 1,
max=3,},
},
armor = 100,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch",
},
})
mobs:register_mob("esmobs:badplayer6", {
type = "monster",
hp_min = 130,
hp_max = 140,
collisionbox = {-0.3, -0.8, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_6.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_mese"].inventory_image,
},
visual_size = {x=.9, y=.8},
makes_footstep_sound = true,
view_range = 20,
walk_velocity = 3,
run_velocity = 4,
damage = 3,
drops = {
{name = "default:sword_mese",
chance = 3,
min = 0,
max = 1,},
{name = "default:gold_ingot",
chance = 3,
min = 0,
max = 1,},
{name = "default:apple",
chance = 2,
min = 1,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:badplayer7", {
type = "monster",
hp_min = 37,
hp_max = 70,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_7.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_bronze"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1.2,
run_velocity = 3,
damage = 3,
drops = {
{name = "default:sword_bronze",
chance = 2,
min = 0,
max = 1,},
{name = "default:bronze_ingot",
chance = 3,
min = 0,
max = 5,},
{name = "default:apple",
chance = 1,
min = 1,
max=2,},
},
armor = 85,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell2",
death = "mobs_yeti_death",
attack = "mobs_oerkki_attack",
},
})
mobs:register_mob("esmobs:badplayer8", {
type = "monster",
hp_min = 157,
hp_max = 195,
collisionbox = {-0.3, -0.8, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_8.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_steel"].inventory_image,
},
visual_size = {x=0.6, y=0.8},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 1.5,
damage = 3,
drops = {
{name = "default:snow",
chance = 1,
min = 3,
max = 33,},
{name = "default:sword_steel",
chance = 2,
min = 0,
max = 1,},
{name = "default:ice",
chance = 2,
min = 13,
max=30,},
},
armor = 100,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch2",
},
})
mobs:register_mob("esmobs:badplayer9", {
type = "monster",
hp_min = 177,
hp_max = 190,
collisionbox = {-0.3, -0.8, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_9.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_bronze"].inventory_image,
},
visual_size = {x=.9, y=.8},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 3,
drops = {
{name = "default:sword_bronze",
chance = 2,
min = 0,
max = 1,},
{name = "default:stone_with_diamond",
chance = 6,
min = 0,
max = 3,},
{name = "default:apple",
chance = 1,
min = 1,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:badplayer10", {
type = "monster",
hp_min = 157,
hp_max = 200,
collisionbox = {-0.3, -1.5, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_10.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_mese"].inventory_image,
},
visual_size = {x=1.3, y=1.5},
makes_footstep_sound = true,
view_range = 10,
walk_velocity = 0.5,
run_velocity =15,
damage = 4,
drops = {
{name = "farming:cotton",
chance = 1,
min = 3,
max = 5,},
{name = "default:sword_diamond",
chance = 3,
min = 0,
max = 1,},
{name = "default:sword_mese",
chance = 2,
min = 0,
max=1,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_fireball",
attack = "mobs_slash_attack",
},
})
mobs:register_mob("esmobs:badplayer11", {
type = "monster",
hp_min = 49,
hp_max = 85,
collisionbox = {-0.3, -1.3, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_11.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_steel"].inventory_image,
},
visual_size = {x=1, y=1.3},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 2,
damage = 3,
drops = {
{name = "default:sapling",
chance = 1,
min = 3,
max = 5,},
{name = "default:sword_steel",
chance = 6,
min = 0,
max = 1,},
{name = "default:dirt",
chance = 2,
min = 13,
max=30,},
},
armor = 100,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch2",
},
})
mobs:register_mob("esmobs:badplayer12", {
type = "monster",
hp_min = 57,
hp_max = 85,
collisionbox = {-0.3, -0.5, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_12.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_wood"].inventory_image,
},
visual_size = {x=1, y=.5},
makes_footstep_sound = true,
view_range = 25,
walk_velocity = 0.3,
run_velocity = 1.5,
damage = 3,
drops = {
{name = "default:grass_1",
chance = 1,
min = 3,
max = 5,},
{name = "default:sword_wood",
chance = 2,
min = 1,
max = 1,},
{name = "default:sand",
chance = 2,
min = 13,
max=30,},
},
armor = 100,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:badplayer16", {
type = "monster",
hp_min = 47,
hp_max = 85,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_16.png",
"3d_armor_trans.png",
minetest.registered_items["default:pick_wood"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 1.4,
damage = 3,
drops = {
{name = "default:pick_wood",
chance = 1,
min = 0,
max = 1,},
{name = "default:sword_wood",
chance = 1,
min = 1,
max = 1,},
{name = "default:stick",
chance = 2,
min = 1,
max=5,},
},
armor = 90,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch",
},
})
mobs:register_mob("esmobs:badplayer18", {
type = "monster",
hp_min = 48,
hp_max = 77,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_18.png",
"3d_armor_trans.png",
minetest.registered_items["default:pick_stone"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 2,
damage = 3,
drops = {
{name = "default:pick_stone",
chance = 1,
min = 1,
max = 3,},
{name = "default:sword_stone",
chance = 5,
min = 0,
max = 1,},
{name = "default:stone_with_gold",
chance = 2,
min = 4,
max=8,},
},
armor = 90,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_eerie",
death = "mobs_yeti_death",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:badplayer22", {
type = "monster",
hp_min = 77,
hp_max = 90,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_22.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_steel"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 3,
run_velocity = 3,
damage = 4,
drops = {
{name = "default:chest",
chance = 1,
min = 0,
max = 1,},
{name = "default:sword_steel",
chance = 1,
min = 0,
max = 1,},
{name = "default:book",
chance = 4,
min = 1,
max=30,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_die_yell",
death = "mobs_death2",
attack = "default_punch",
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
step = 1,
})
mobs:register_mob("esmobs:badplayer23", {
type = "monster",
hp_min = 127,
hp_max = 152,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_23.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_steel"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 17,
walk_velocity = 1.3,
run_velocity = 3.5,
damage = 3,
drops = {
{name = "default:steelblock",
chance = 3,
min = 0,
max = 2,},
{name = "default:sword_steel",
chance = 1,
min = 0,
max = 1,},
{name = "default:bronze_ingot",
chance = 2,
min = 1,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch2",
},
})
mobs:register_mob("esmobs:badplayer24", {
type = "monster",
hp_min = 137,
hp_max = 159,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_24.png",
"3d_armor_trans.png",
minetest.registered_items["default:goldblock"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 0.5,
run_velocity = 3,
damage = 2.5,
drops = {
{name = "default:goldblock",
chance = 6,
min = 1,
max = 4,},
{name = "default:sword_steel",
chance = 1,
min = 0,
max = 1,},
{name = "default:stick",
chance = 2,
min = 0,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
fly = true,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell2",
death = "mobs_barbarian_death",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:badplayer25", {
type = "monster",
hp_min = 100,
hp_max = 120,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_25.png",
"3d_armor_trans.png",
minetest.registered_items["default:pick_diamond"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 12,
walk_velocity = 2,
run_velocity = 3,
damage = 5,
drops = {
{name = "default:pick_diamond",
chance = 2,
min = 0,
max = 1,},
{name = "default:sword_diamond",
chance = 1,
min = 0,
max = 2,},
{name = "default:apple",
chance = 2,
min = 1,
max=5,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch",
},
})
mobs:register_mob("esmobs:badplayer26", {
type = "monster",
hp_min = 73,
hp_max = 80,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_26.png",
"3d_armor_trans.png",
minetest.registered_items["default:axe_steel"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 2,
damage = 3,
drops = {
{name = "default:axe_steel",
chance = 1,
min = 0,
max = 2,},
{name = "farming:seed_cotton",
chance = 1,
min = 0,
max = 1,},
{name = "default:stick",
chance = 2,
min = 1,
max=3,},
},
armor = 90,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch2",
},
})
mobs:register_mob("esmobs:badplayer27", {
type = "monster",
hp_min = 99,
hp_max = 140,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_27.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_diamond"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 10,
walk_velocity = 2,
run_velocity = 4,
damage = 6,
drops = {
{name = "default:sword_diamond",
chance = 1,
min = 0,
max = 1,},
{name = "default:apple",
chance = 1,
min = 1,
max = 7,},
{name = "default:stick",
chance = 1,
min = 1,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell2",
death = "mobs_barbarian_death",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:badplayer28", {
type = "monster",
hp_min = 77,
hp_max = 90,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_28.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_steel"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 25,
walk_velocity = 0.5,
run_velocity = 1.5,
damage = 3,
drops = {
{name = "default:obsidian",
chance = 2,
min = 0,
max = 5,},
{name = "default:sword_steel",
chance = 1,
min = 0,
max = 1,},
{name = "default:apple",
chance = 2,
min = 1,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch",
},
})
mobs:register_mob("esmobs:badplayer29", {
type = "monster",
hp_min = 69,
hp_max = 89,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_29.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_stone"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 2,
damage = 3,
drops = {
{name = "default:sword_stone",
chance = 1,
min = 0,
max = 2,},
{name = "default:water_flowing",
chance = 3,
min = 0,
max = 1,},
{name = "default:apple",
chance = 2,
min = 1,
max=9,},
},
armor = 100,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_eerie",
death = "mobs_yeti_death",
attack = "default_punch2",
},
})
mobs:register_mob("esmobs:badplayer30", {
type = "monster",
hp_min = 137,
hp_max = 150,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_30.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_mese"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 5,
walk_velocity = 1,
run_velocity = 5,
damage = 4,
drops = {
{name = "default:diamondblock",
chance = 4,
min = 1,
max = 3,},
{name = "default:sword_mese",
chance = 2,
min = 0,
max = 1,},
{name = "default:apple",
chance = 2,
min = 2,
max=7,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell2",
death = "mobs_howl",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:badplayer31", {
type = "monster",
hp_min = 77,
hp_max = 130,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_31.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_mese"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 5,
walk_velocity = 1,
run_velocity = 5,
damage = 4,
drops = {
{name = "default:cactus",
chance = 5,
min = 0,
max = 3,},
{name = "default:sword_mese",
chance = 2,
min = 1,
max = 1,},
{name = "default:dirt",
chance = 2,
min = 6,
max=23,},
},
armor = 80,
drawtype = "front",
water_damage = 0,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell2",
death = "mobs_howl",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:badplayer35", {
type = "monster",
hp_min = 35,
hp_max = 75,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"character_21.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_steel"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1.9,
run_velocity = 3.8,
damage = 4,
drops = {
{name = "default:jungletree",
chance = 1,
min = 0,
max = 2,},
{name = "default:sword_steel",
chance = 2,
min = 0,
max = 1,},
{name = "default:stick",
chance = 2,
min = 0,
max=3,},
},
armor = 80,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 1,
fear_height = 5,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch2",
},
})
mobs:register_mob("esmobs:Mr_Black", {
type = "monster",
hp_min = 35,
hp_max = 65,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_33.png",
"3d_armor_trans.png",
minetest.registered_items["default:sword_stone"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 2,
sounds = {
war_cry = "mobs_barbarian_yell1",
death = "mobs_barbarian_death",
attack = "default_punch1",
},
drops = {
{name = "default:apple",
chance = 1,
min = 1,
max = 2,},
{name = "default:sword_steel",
chance = 2,
min = 0,
max = 1,},
},
armor = 75,
drawtype = "front",
water_damage = 70,
lava_damage = 50,
light_damage = 0,
fear_height = 5,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
sounds = {
attack = "default_punch3",
},
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Mr. Black: Grrrrrrrrrrrr!",3)
if item:get_name() == "esmobs:meat" or item:get_name() == "farming:bread" then
local hp = self.object:get_hp()
if hp + 4 > self.hp_max then return end
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_hp(hp+4)
-- right clicking with gold lump drops random item from mobs.npc_drops
elseif item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = mobs.npc_drops[math.random(1,#mobs.npc_drops)]})
else
if self.owner == "" then
self.owner = clicker:get_player_name()
else
local formspec = "size[8,4]"
formspec = formspec .. "textlist[2.85,0;2.1,0.5;dialog;What can I do for you?]"
formspec = formspec .. "button_exit[1,1;2,2;gfollow;follow]"
formspec = formspec .. "button_exit[5,1;2,2;gstand;stand]"
formspec = formspec .. "button_exit[0,2;4,4;gfandp;follow and protect]"
formspec = formspec .. "button_exit[4,2;4,4;gsandp;stand and protect]"
--formspec = formspec .. "button_exit[1,2;2,2;ggohome; go home]"
--formspec = formspec .. "button_exit[5,2;2,2;gsethome; sethome]"
minetest.show_formspec(clicker:get_player_name(), "order", formspec)
minetest.register_on_player_receive_fields(function(clicker, formname, fields)
if fields.gfollow then
self.order = "follow"
self.attacks_monsters = false
end
if fields.gstand then
self.order = "stand"
self.attacks_monsters = false
end
if fields.gfandp then
self.order = "follow"
self.attacks_monsters = true
end
if fields.gsandp then
self.order = "stand"
self.attacks_monsters = true
end
if fields.gsethome then
self.floats = self.object:getpos()
end
if fields.ggohome then
if self.floats then
self.order = "stand"
self.object:setpos(self.floats)
end
end
end)
end
end
end,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
attacks_monsters = true,
peaceful = true,
group_attack = true,
--step = 1,
})
-------------------------
--BAD NPC'S ES
-------------------------
if es then
mobs:register_mob("esmobs:Jasmine", {
type = "monster",
hp_min = 277,
hp_max = 290,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_42.png",
"3d_armor_trans.png",
minetest.registered_items["es:sword_purpellium"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 18,
walk_velocity = 5,
run_velocity = 3.4,
damage = 7,
drops = {
{name = "default:diamond",
chance = 5,
min = 0,
max = 2,},
{name = "es:sword_emerald",
chance = 7,
min = 0,
max = 1,},
{name = "flowers:rose",
chance = 6,
min = 0,
max=1,},
},
armor = 75,
drawtype = "front",
water_damage = 10,
lava_damage = 50,
light_damage = 70,
fear_height = 4,
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local_chat(clicker:getpos(),"Jasmine: Tame me now, come to me later, we will chat after I have cooled off.",3)
if item:get_name() == "esmobs:meat" or item:get_name() == "farming:bread" then
local hp = self.object:get_hp()
if hp + 4 > self.hp_max then return end
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_hp(hp+4)
-- right clicking with gold lump drops random item from mobs.npc_drops
elseif item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = mobs.npc_drops[math.random(1,#mobs.npc2_drops)]})
else
if self.owner == "" then
self.owner = clicker:get_player_name()
else
local formspec = "size[8,4]"
formspec = formspec .. "textlist[2.85,0;2.1,0.5;dialog;What can I do for you?]"
formspec = formspec .. "button_exit[1,1;2,2;gfollow;follow]"
formspec = formspec .. "button_exit[5,1;2,2;gstand;stand]"
formspec = formspec .. "button_exit[0,2;4,4;gfandp;follow and protect]"
formspec = formspec .. "button_exit[4,2;4,4;gsandp;stand and protect]"
--formspec = formspec .. "button_exit[1,2;2,2;ggohome; go home]"
--formspec = formspec .. "button_exit[5,2;2,2;gsethome; sethome]"
minetest.show_formspec(clicker:get_player_name(), "order", formspec)
minetest.register_on_player_receive_fields(function(clicker, formname, fields)
if fields.gfollow then
self.order = "follow"
self.attacks_monsters = false
end
if fields.gstand then
self.order = "stand"
self.attacks_monsters = false
end
if fields.gfandp then
self.order = "follow"
self.attacks_monsters = true
end
if fields.gsandp then
self.order = "stand"
self.attacks_monsters = true
end
if fields.gsethome then
self.floats = self.object:getpos()
end
if fields.ggohome then
if self.floats then
self.order = "stand"
self.object:setpos(self.floats)
end
end
end)
end
end
end,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell2",
death = "mobs_howl",
attack = "default_punch3",
},
})
mobs:register_mob("esmobs:Infinium_Monster", {
type = "monster",
hp_min = 377,
hp_max = 390,
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.8, 0.3},
visual = "mesh",
mesh = "3d_armor_character.b3d",
textures = {"badplayer_32.png",
"3d_armor_trans.png",
--minetest.registered_items["default:sword_mese"].inventory_image,
minetest.registered_items["fire:basic_flame"].inventory_image,
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 25,
walk_velocity = 1,
run_velocity = 4,
--floats=1,
fly = true,
stepheight = 3,
fall_speed = 3,
damage = 5,
drops = {
{name = "default:obsidian",
chance = 5,
min = 3,
max = 10,},
{name = "default:sword_diamond",
chance = 2,
min = 1,
max = 1,},
{name = "default:lava_source",
chance = 2,
min = 1,
max=2,},
{name = "es:infiniumblock",
chance = 4,
min = 1,
max=2,},
},
armor = 80,
drawtype = "front",
water_damage = 0,
lava_damage = 0,
light_damage = 0,
fear_height = 50,
on_rightclick = nil,
attack_type = "dogfight",
pathfinding = true,
group_attack = true,
replace_rate = 5,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
peaceful = false,
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
sounds = {
war_cry = "mobs_barbarian_yell2",
death = "mobs_howl",
attack = "default_punch3",
},
})
end
--REFERENCE
--function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height)
--mobs:register_spawn("mobs:dirt_monster", {"default:dirt_with_grass", "ethereal:gray_dirt"}, 7, 0, 7000, 2, 31000)
--NOTE: ALWAYS PUT THE REGISTER_SPAWN BELOW THE REGISTER_ENTITY!!!!!
mobs:register_spawn("esmobs:badplayer2", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer3", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer4", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer6", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer7", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer8", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer9", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer10", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer11", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer12", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer16", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer18", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer22", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer23", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer24", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer25", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer26", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer27", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer28", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer29", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer30", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer31", {"default:dirt_with_grass","default:stone","meru:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
mobs:register_spawn("esmobs:badplayer35", {"default:sandstone","default:stone", "default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, -20)
--mobs:register_spawn("esmobs:Mr_Black", {"default:dirt_with_grass","default:desert_sand","default:sand","default:stonebrick","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 4, -1, 18000, 1, 3000)
--mobs:register_spawn("esmobs:Jasmine", {"default:obsidian","es:infiniumblock","es:stone_with_infinium","default:cobble","default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 7, -1, 18000, 1, -1000)
--mobs:register_spawn("esmobs:Infinium_Monster", {"default:obsidian","default:lava_source","default:lava_flowing","es:stone_with_infinium"}, 12, -1, 18000, 3, 10)
|
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 0,
groupcaps = {
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0}
},
damage_groups = {fleshy=1},
}
})
minetest.register_tool("ws_core:knife_flint", {
description = "Flint Knife",
inventory_image = "ws_knife_flint.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level=0,
groupcaps={
cracky = {times={[2]=4.0, [3]=1.25}, uses=15, maxlevel=1},
},
damage_groups = {fleshy=2},
},
sound = {breaks = "default_tool_breaks"},
})
minetest.register_tool("ws_core:hatchet_flint", {
description = "Flint Hatchet",
inventory_image = "ws_knife_flint.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=0,
groupcaps={
choppy = {times={[2]=3.00, [3]=1.60}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
},
groups = {hatchet = 1},
sound = {breaks = "default_tool_breaks"},
})
minetest.register_tool("ws_core:pick_bone", {
description = "Bone Pickaxe",
inventory_image = "ws_pickaxe_bone.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level=0,
groupcaps={
cracky = {times={[2]=4.0, [3]=1.25}, uses=15, maxlevel=1},
},
damage_groups = {fleshy=2},
},
sound = {breaks = "default_tool_breaks"},
})
minetest.register_tool("ws_core:axe_wood", {
description = "Flint Axe",
inventory_image = "ws_hatchet_flint.png",
tool_capabilities = {
full_punch_interval = 1.1,
max_drop_level=0,
groupcaps={
choppy={times={[1]=6.0, [2]=2.50, [3]=1.45}, uses=15, maxlevel=1},
},
damage_groups = {fleshy=2},
},
sound = {breaks = "default_tool_breaks"},
}) |
local i18n = require("core.i18n")
i18n.add {
wish = {
what_do_you_wish_for = "何を望む?",
your_wish = "「{$1}!!」",
it_is_sold_out = "あ、それ在庫切れ。",
something_appears = "足元に{itemname($1)}が転がってきた。",
something_appears_from_nowhere = "足元に{itemname($1)}が転がってきた。",
you_learn_skill = "{$1}の技術を会得した!",
your_skill_improves = "{$1}が上昇した!",
wish_gold = "金貨が降ってきた!",
wish_platinum = "プラチナ硬貨が降ってきた!",
wish_small_medal = "小さなメダルが降ってきた!",
wish_sex = "{name($1)}は{$2}になった! …もう後戻りはできないわよ。",
wish_youth = "ふぅん…そんな願いでいいんだ。",
wish_man_inside = "中の神も大変…あ…中の神なんているわけないじゃない!…ねえ、聞かなかったことにしてね。",
wish_god_inside = "中の人も大変ね。",
wish_ehekatl = "「うみみゅみゅぁ!」",
wish_lulwy = "「アタシを呼びつけるとは生意気ね。」",
wish_opatos = "工事中。",
wish_kumiromi = "工事中。",
wish_mani = "工事中。",
wish_death = "それがお望みなら…",
wish_redemption = {
you_are_not_a_sinner = "…罪なんて犯してないじゃない。",
what_a_convenient_wish = "あら…都合のいいことを言うのね。",
},
wish_alias = {
impossible = "だめよ。",
what_is_your_new_alias = "新しい異名は?",
new_alias = "あなたの新しい異名は「{$1}」。満足したかしら?",
no_change = "あら、そのままでいいの?",
},
general_wish = {
skill = "スキル",
item = "アイテム",
card = "カード",
summon = "召喚",
figure = {"剥製", "はく製"},
},
special_wish = {
god_inside = "中の神",
man_inside = "中の人",
ehekatl = "エヘカトル",
lulwy = "ルルウィ",
opatos = "オパートス",
kumiromi = "クミロミ",
mani = "マニ",
youth = {"若さ", "若返り", "年", "美貌"},
alias = {"通り名", "異名"},
sex = {"性転換", "性", "異性"},
redemption = "贖罪",
death = "死",
ally = "仲間",
gold = {"金", "金貨", "富", "財産"},
small_medal = {"メダル", "小さなメダル", "ちいさなメダル"},
platinum = {"プラチナ", "プラチナ硬貨"},
fame = "名声",
},
},
}
|
--- Called before an operation to check whether other plugins allow the operation.
-- returns true to abort operation, returns false to continue.
-- a_HookName is the name of the hook to call. Everything after that are arguments for the hook.
function CallHook(a_HookName, ...)
assert(g_Hooks[a_HookName] ~= nil)
for idx, callback in ipairs(g_Hooks[a_HookName]) do
local res = cPluginManager:CallPlugin(callback.PluginName, callback.CallbackName, ...)
if (res) then
-- The callback wants to abort the operation
return true
end
end
return false
end
function GetMultipleBlockChanges(MinX, MaxX, MinZ, MaxZ, Player, World, Operation)
local MinY = 256
local MaxY = 0
local Object = {}
function Object:SetY(Y)
if Y < MinY then
MinY = Y
elseif Y > MaxY then
MaxY = Y
end
end
function Object:Flush()
local FinalCuboid = cCuboid(
Vector3i(MinX, MinY, MinZ),
Vector3i(MaxX, MaxY, MaxZ)
)
return CallHook("OnAreaChanging", FinalCuboid, Player, World, Operation)
end
return Object
end
|
local UserInputService = game:GetService("UserInputService")
local gui = script.Parent
local dragging
local dragInput
local dragStart
local startPos
local function update(input)
local delta = input.Position - dragStart
gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end
gui.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
dragStart = input.Position
startPos = gui.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)
gui.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
dragInput = input
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == dragInput and dragging then
update(input)
end
end) |
-- -*- mode: lua; tab-width: 2; indent-tabs-mode: 1; st-rulers: [70] -*-
-- vim: ts=4 sw=4 ft=lua noet
----------------------------------------------------------------------
-- @author Daniel Barney <daniel@pagodabox.com>
-- @copyright 2015, Pagoda Box, Inc.
-- @doc
--
-- @end
-- Created : 21 May 2015 by Daniel Barney <daniel@pagodabox.com>
----------------------------------------------------------------------
local Cauterize = require('cauterize')
local log = require('logger')
local json = require('json')
local utl = require('../util')
local ConfigLoader = Cauterize.Supervisor:extend()
function ConfigLoader:_init()
local dont_update = utl.config_get('replicated_db')
-- load all the systems from the config file into the db, but only
-- if a system with the same name does not exist
local systems = utl.config_get('systems')
for name,system in pairs(systems) do
local data = system.data
system.data = nil
if dont_update then
local exists = ConfigLoader.call('store','fetch','system',name)
if exists[1] then
break
end
end
ConfigLoader.call('store','enter','system',name,json.stringify(system))
for idx,data in pairs(data) do
ConfigLoader.call('store', 'enter', 'system-' .. name,
tostring(idx), json.stringify(data))
end
end
-- load all nodes in the config file into the database, but only if
-- the current node isn't in it.
local node_name = utl.config_get('node_name')
log.info('checking if the config needs to be loaded into the db')
local exists = ConfigLoader.call('store','fetch','nodes',node_name)
if not exists[1] then
local nodes = utl.config_get('nodes_in_cluster')
for name,node in pairs(nodes) do
ConfigLoader.call('store','enter','nodes',name,
json.stringify(node))
end
end
end
return ConfigLoader |
includes("volk",
"flecs",
"EASTL",
"header_only",
"glm",
"GLFW") |
local skynet = require "skynet"
local mysql = require "mysql"
local CMD = {}
local db
function CMD.start()
-- print("CMD.start start connect.")
db = mysql.connect{
host = "127.0.0.1",
port = 3306,
database = "employees",
user = "root",
password = "sa12345",
max_packet_size = 1024 * 1024
}
-- print("CMD.start start connect end.")
if db then
-- print("connect to mysql success.")
db:query("set charset utf8")
else
skynet.error("mysql connect error.")
end
end
function CMD.server_ver()
print("server_ver", mysql.server_ver(db))
end
function CMD.close()
mysql.disconnect(db)
end
function CMD.query(sql)
return mysql.query(db, sql)
end
skynet.init(function()
print("mysqld service init.")
end)
skynet.start(function()
print("mysqld service start.")
skynet.dispatch("lua", function(session, source, cmd, ...)
local f = assert(CMD[cmd], cmd .. "not found")
skynet.retpack(f(...))
end)
end)
|
-----------------------------------
-- Area: North Gustaberg
-- Mob: Maneating Hornet
-- Note: Place Holder For Stinging Sophie
-----------------------------------
local ID = require("scripts/zones/North_Gustaberg/IDs")
require("scripts/globals/regimes")
require("scripts/globals/mobs")
-----------------------------------
function onMobDeath(mob, player, isKiller)
tpz.regime.checkRegime(player, mob, 17, 1, tpz.regime.type.FIELDS)
end
function onMobDespawn(mob)
tpz.mob.phOnDespawn(mob, ID.mob.STINGING_SOPHIE_PH, 5, math.random(1200, 3600)) -- 20 to 60 minutes
end
|
return Def.Sprite {
Texture=NOTESKIN:GetPath( '_downleft', 'tap note' );
Frames = Sprite.LinearFrames( 6, 1 );
}; |
local configure_rainbow = require('config.plugins.rainbow.theme')
local available, highlight = pcall(require, 'nvim-treesitter.highlight')
g.rainbow_active = 1
configure_rainbow()
-- Handle treesitter screweing up colored brackets
if available ~= nil then
local hlmap = vim.treesitter.highlighter.hl_map
hlmap.error = nil
hlmap["punctuation.delimiter"] = "Delimiter"
hlmap["punctuation.bracket"] = nil
end
|
--Pre-made areas
--Waves
AREA_SHORTWAVE3 = {
{1, 1, 1},
{1, 1, 1},
{0, 3, 0}
}
AREA_WAVE10 = {
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 3, 0, 0, 0}
}
AREA_WAVE11 = {
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 3, 0, 0, 0}
}
AREA_WAVE12 = {
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 3, 0, 0, 0}
}
AREA_WAVE13 = {
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 3, 0, 0, 0}
}
AREA_WAVE4 = {
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0},
{0, 1, 1, 1, 0},
{0, 0, 3, 0, 0}
}
AREA_WAVE5 = {
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0},
{0, 1, 1, 1, 0},
{0, 1, 1, 1, 0},
{0, 0, 1, 0, 0},
{0, 0, 3, 0, 0}
}
AREA_WAVE6 = {
{0, 0, 0, 0, 0},
{0, 1, 3, 1, 0},
{0, 0, 0, 0, 0}
}
AREA_WAVE7 = {
{1, 1, 1, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0},
{0, 1, 1, 1, 0},
{0, 0, 3, 0, 0}
}
AREA_SQUAREWAVE5 = {
{1, 1, 1},
{1, 1, 1},
{1, 1, 1},
{0, 1, 0},
{0, 3, 0}
}
AREA_SQUAREWAVE6 = {
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0}
}
AREA_SQUAREWAVE7 = {
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0}
}
--Diagonal waves
AREADIAGONAL_WAVE4 = {
{0, 0, 0, 0, 1, 0},
{0, 0, 0, 1, 1, 0},
{0, 0, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 0, 3}
}
AREADIAGONAL_SQUAREWAVE5 = {
{1, 1, 1, 0, 0},
{1, 1, 1, 0, 0},
{1, 1, 1, 0, 0},
{0, 0, 0, 1, 0},
{0, 0, 0, 0, 3}
}
AREADIAGONAL_WAVE6 = {
{0, 0, 1},
{0, 3, 0},
{1, 0, 0}
}
AREADIAGONAL_WAVE7 = {
{0, 0, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 1, 1, 0},
{0, 0, 0, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 0, 0, 3}
}
--Beams
AREA_BEAM1 = {
{3}
}
AREA_BEAM5 = {
{1},
{1},
{1},
{1},
{3}
}
AREA_BEAM7 = {
{1},
{1},
{1},
{1},
{1},
{1},
{3}
}
AREA_BEAM8 = {
{1},
{1},
{1},
{1},
{1},
{1},
{1},
{3}
}
--Diagonal Beams
AREADIAGONAL_BEAM5 = {
{1, 0, 0, 0, 0},
{0, 1, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 0, 1, 0},
{0, 0, 0, 0, 3}
}
AREADIAGONAL_BEAM7 = {
{1, 0, 0, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 0, 0, 3}
}
--Circles
AREA_CIRCLE2X2 = {
{0, 1, 1, 1, 0},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0}
}
AREA_CIRCLE3X3 = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}
AREA_CIRCLE3X32 = {
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1}
}
AREA_CIRCLE3X33 = {
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 0, 0, 1, 1, 1},
{1, 1, 0, 3, 1, 1, 1},
{1, 1, 0, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1}
}
-- Crosses
AREA_CIRCLE1X1 = {
{0, 1, 0},
{1, 3, 1},
{0, 1, 0}
}
AREA_CIRCLE5X5 = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}
AREA_CIRCLE5X5V2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 3, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
AREA_CIRCLE6X6 = {
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}
}
--Squares
AREA_SQUARE1X1 = {
{1, 1, 1},
{1, 3, 1},
{1, 1, 1}
}
-- Walls
AREA_WALLFIELD = {
{1, 1, 3, 1, 1}
}
AREADIAGONAL_WALLFIELD = {
{0, 0, 0, 0, 1},
{0, 0, 0, 1, 1},
{0, 1, 3, 1, 0},
{1, 1, 0, 0, 0},
{1, 0, 0, 0, 0},
}
-- Walls Energy
AREA_WALLFIELD_ENERGY = {
{1, 1, 1, 3, 1, 1, 1}
}
AREADIAGONAL_WALLFIELD_ENERGY = {
{0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 1, 1},
{0, 0, 0, 0, 1, 1, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 1, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 0},
}
-- The numbered-keys represents the damage values, and their table
-- contains the minimum and maximum number of rounds of those damage values.
RANGE = {
[1] = {19, 20}, [2] = {10, 10}, [3] = {6, 7}, [4] = {4, 5}, [5] = {3, 4},
[6] = {3, 4}, [7] = {2, 3}, [8] = {2, 3}, [9] = {2, 3}, [10] = {1, 2},
[11] = {1, 2}, [12] = {1, 2}, [13] = {1, 2}, [14] = {1, 2}, [15] = {1, 2},
[16] = {1, 2}, [17] = {1, 2}, [18] = {1, 2}, [19] = {1, 2}
}
function Creature:addDamageCondition(target, conditionType, listType, damage, time, rounds)
if target:isImmune(conditionType) then
return false
end
local condition = Condition(conditionType)
condition:setParameter(CONDITION_PARAM_OWNER, self:getId())
condition:setParameter(CONDITION_PARAM_DELAYED, true)
if listType == 0 then
local exponent, value = -10, 0
while value < damage do
value = math.floor(10 * math.pow(1.2, exponent) + 0.5)
condition:addDamage(1, time or 4000, -value)
if value >= damage then
local permille = math.random(10, 1200) / 1000
condition:addDamage(1, time or 4000, -math.max(1, math.floor(value * permille + 0.5)))
else
exponent = exponent + 1
end
end
elseif listType == 1 then
rounds = rounds or RANGE
if rounds[damage] then
condition:addDamage(math.random(1, rounds[damage][2]), time or 4000, -damage)
damage = damage - 1
end
while damage > 0 do
condition:addDamage(rounds[damage] and math.random(rounds[damage][1], rounds[damage][2]) or 1, time or 4000, -damage)
damage = damage - (damage > 21 and math.floor(damage / 20) + math.random(0, 1) or 1)
end
elseif listType == 2 then
for _ = 1, rounds do
condition:addDamage(1, math.random(time[1], time[2]) * 1000, -damage)
end
end
target:addCondition(condition)
return true
end
function Player:addPartyCondition(combat, variant, condition, baseMana)
local party = self:getParty()
if not party then
self:sendCancelMessage(RETURNVALUE_NOPARTYMEMBERSINRANGE)
self:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
local members = party:getMembers()
members[#members + 1] = party:getLeader()
local position = self:getPosition()
local affectedMembers = {}
for _, member in ipairs(members) do
if member:getPosition():getDistance(position) <= 36 then
affectedMembers[#affectedMembers + 1] = member
end
end
if #affectedMembers <= 1 then
self:sendCancelMessage(RETURNVALUE_NOPARTYMEMBERSINRANGE)
position:sendMagicEffect(CONST_ME_POFF)
return false
end
local mana = math.ceil(math.pow(0.9, #affectedMembers - 1) * baseMana * #affectedMembers)
if self:getMana() < mana then
self:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA)
position:sendMagicEffect(CONST_ME_POFF)
return false
end
if not combat:execute(self, variant) then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
position:sendMagicEffect(CONST_ME_POFF)
return false
end
self:addMana(baseMana - mana, false)
self:addManaSpent(mana - baseMana)
for _, member in ipairs(affectedMembers) do
member:addCondition(condition)
end
return true
end
function Player:conjureItem(reagentId, conjureId, conjureCount, effect)
if not conjureCount and conjureId ~= 0 then
local itemType = ItemType(conjureId)
if itemType:getId() == 0 then
return false
end
local charges = itemType:getCharges()
if charges ~= 0 then
conjureCount = charges
end
end
if reagentId ~= 0 and not self:removeItem(reagentId, 1, -1) then
self:sendCancelMessage(RETURNVALUE_YOUNEEDAMAGICITEMTOCASTSPELL)
self:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
local item = self:addItem(conjureId, conjureCount)
if not item then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
self:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
if item:hasAttribute(ITEM_ATTRIBUTE_DURATION) then
item:decay()
end
self:getPosition():sendMagicEffect(item:getType():isRune() and CONST_ME_MAGIC_RED or effect)
return true
end
|
-----------------------------------------------
-- battleaxe_small.lua
-- Represents a battleaxe that a player can wield or pick up
-- Created by NimbusBP1729
-----------------------------------------------
--
-- Creates a new small battleaxe object
-- @return the small battleaxe object created
return {
hand_x = 12,
hand_y = 20,
frameAmt = 3,
width = 32,
height = 31,
dropWidth = 23,
dropHeight = 21,
damage = 4,
special_damage = {slash = 1, axe = 1},
bbox_width = 22,
bbox_height = 22,
bbox_offset_x = {1,9,10},
bbox_offset_y = {0,0,10},
hitAudioClip = 'mace_hit',
animations = {
default = {'once', {'1,1'}, 1},
wield = {'once', {'1,1','2,1','3,1'},0.1}
},
action = "wieldaction2"
}
|
local M = {}
local function motion(key, back_key)
if vim.v.count1 > 1 then
vim.cmd("normal! " .. vim.v.count1 .. key)
return
end
local initial_line = vim.fn.line(".")
vim.cmd("normal! " .. key)
local new_line = vim.fn.line(".")
if initial_line ~= new_line then
vim.cmd("normal! " .. back_key)
end
end
function M.set_keymap(mode, key, back_key)
vim.keymap.set(mode, key, function()
motion(key, back_key)
end, { noremap = true, expr = false, silent = false })
end
return M
|
local M = { }
local name = "test_cart2"
local me = ...
local TK = require("PackageToolkit")
local case = (require(me .. ".case"))["case"]
M[name] = function()
local separator = TK.lists.head(TK.strings.split(package.config))
local s1 = string.format("A%s1", separator)
local s2 = string.format("A%s2", separator)
local s3 = string.format("B%s1", separator)
local s4 = string.format("B%s2", separator)
local solution = {
s1,
s2,
s3,
s4
}
case({
"A",
"B"
}, {
1,
2
}, solution, "case 1")
return true
end
return M
|
--[[
* Natural Selection 2 - Combat++ Mod
* WhiteWizard - 2017
* CPPShared
]]
if Server then
Script.Load("lua/Server.lua")
elseif Client then
Script.Load("lua/Client.lua")
elseif Predict then
Script.Load("lua/Predict.lua")
end
Script.Load("lua/CPPUtilities.lua")
if Server then
-- combat doesn't have batteries but we still want sentries to work
local function UpdateBatteryState(self)
-- just override the local function
-- CPPSentry.lua has the PowerConsumerMixin injected in it to make the
-- sentries work with power nodes
end
ReplaceLocals(Sentry.OnUpdate, {UpdateBatteryState = UpdateBatteryState})
end
if Client then
local function ShowHUD(self, show)
assert(Client)
if self.marineHudVisible ~= show then
self.marineHudVisible = show
ClientUI.SetScriptVisibility("Hud/Marine/GUIMarineHUD", "Alive", show)
end
if self.exoHudVisible ~= show then
self.exoHudVisible = show
ClientUI.SetScriptVisibility("Hud/Marine/GUIExoHUD", "Alive", show)
ClientUI.SetScriptVisibility("Combat/GUI/MarineStatusHUD", "Alive", true)
Shared.Message("Turning on Combat Marine Status HUD for Exo")
end
end
ReplaceLocals(Exo.OnInitLocalClient, { ShowHUD = ShowHUD })
ReplaceLocals(Exo.UpdateClientEffects, { ShowHUD = ShowHUD } )
end
|
local function create_targeter(data)
local _name = data.name
return {
type = "item",
name = _name,
icon = data.sprite..".png",
flags = {"goes-to-quickbar"},
order = "a[".._name.."]",
place_result = (data.type and data.type == "target" and _name) or nil,
stack_size = 2
}
end
local function create_selection_targeter(data)
local _name = data.name
return {
type = "selection-tool",
name = _name,
icon = data.sprite..".png",
flags = {"goes-to-quickbar"},
order = "a[".._name.."]",
stack_size = 2,
selection_color = { r = 1, g = 1, b = 0 },
selection_mode = data.mode or {"any-entity"},
selection_cursor_box_type = data.box_type or "copy",
alt_selection_color = { r = 1, g = 1, b = 0 },
alt_selection_mode = data.alt_mode or {"any-entity"},
alt_selection_cursor_box_type = data.alt_box_type or "copy"
}
end
local function create_dummy_entity(data)
local _name = data.name
return {
type = "decorative",
name = _name,
flags = {"placeable-neutral", "placeable-off-grid", "not-on-map"},
icon = data.sprite..".png",
order = "a-b-a",
collision_box = {{-0.4, -0.4}, {0.4, 0.4}},
selection_box = {{-0.4, -0.4}, {0.4, 0.4}},
selectable_in_game = false,
pictures =
{
{
filename = data.sprite..".png",
width = 32,
height = 32,
},
}
}
end
function register_ability( _data )
if not _data.type or _data.type == "activate" then
data:extend({
create_targeter( _data )
})
elseif _data.type == "target" then
data:extend({
create_targeter( _data ),
create_dummy_entity( _data )
})
elseif _data.type == "area" then
data:extend({
create_selection_targeter( _data )
})
end
end
|
local Skada = Skada
local pairs, wipe, max = pairs, wipe, math.max
local getmetatable, setmetatable, time = getmetatable, setmetatable, time
-- a dummy table used as fallback
local dummyTable = {}
Skada.dummyTable = dummyTable
-- this one should be used at modules level
local T = Skada.Table
local cacheTable = T.get("Skada_CacheTable")
Skada.cacheTable = cacheTable
-- prototypes declaration
local setPrototype = {} -- sets
Skada.setPrototype = setPrototype
local actorPrototype = {} -- common to actors
local actorPrototype_mt = {__index = actorPrototype}
Skada.actorPrototype = actorPrototype
local playerPrototype = setmetatable({}, actorPrototype_mt) -- players
Skada.playerPrototype = playerPrototype
local enemyPrototype = setmetatable({}, actorPrototype_mt) -- enemies
Skada.enemyPrototype = enemyPrototype
-------------------------------------------------------------------------------
-- segment/set prototype & functions
-- binds a set table to set prototype
function setPrototype:Bind(obj)
if obj and getmetatable(obj) ~= self then
setmetatable(obj, self)
self.__index = self
if obj.players then
for i = 1, #obj.players do
playerPrototype:Bind(obj.players[i], obj)
end
end
if obj.enemies then
for i = 1, #obj.enemies do
enemyPrototype:Bind(obj.enemies[i], obj)
end
end
end
return obj
end
-- returns the segment's time
function setPrototype:GetTime()
return max((self.time or 0) > 0 and self.time or (time() - self.starttime), 0.1)
end
-- returns the actor's time if found (player or enemy)
function setPrototype:GetActorTime(id, name, active)
local actor = self:GetActor(name, id)
return actor and actor:GetTime(active) or self:GetTime()
end
-- attempts to retrieve a player
function setPrototype:GetPlayer(id, name)
if self.players and ((id and id ~= "total") or name) then
for i = 1, #self.players do
local actor = self.players[i]
if actor and ((id and actor.id == id) or (name and actor.name == name)) then
return playerPrototype:Bind(actor, self)
end
end
end
-- couldn't be found, rely on skada.
local actor = Skada:FindPlayer(self, id, name, true)
return actor and playerPrototype:Bind(actor, self)
end
-- attempts to retrieve an enemy
function setPrototype:GetEnemy(name, id)
if self.enemies and name then
for i = 1, #self.enemies do
local actor = self.enemies[i]
if actor and ((name and actor.name == name) or (id and actor.id == id)) then
return enemyPrototype:Bind(actor, self)
end
end
end
-- couldn't be found, rely on skada.
local actor = Skada:FindEnemy(self, name, id)
return actor and enemyPrototype:Bind(actor, self)
end
-- attempts to find an actor (player or enemy)
function setPrototype:GetActor(name, id)
-- player first.
if self.players and ((id and id ~= "total") or name) then
for i = 1, #self.players do
local actor = self.players[i]
if actor and ((id and actor.id == id) or (name and actor.name == name)) then
return playerPrototype:Bind(actor, self)
end
end
end
-- enemy second
if self.enemies and name then
for i = 1, #self.enemies do
local actor = self.enemies[i]
if actor and ((name and actor.name == name) or (id and actor.id == id)) then
return enemyPrototype:Bind(actor, self), true
end
end
end
-- couldn't be found, rely on skada.
return Skada:FindActor(self, id, name)
end
-- returns the actor's time
function setPrototype:GetActorTime(id, name, active)
local actor = self:GetActor(name, id)
return actor and actor:GetTime(active) or 0
end
-- ------------------------------------
-- damage done functions
-- ------------------------------------
-- returns the set's damage amount
function setPrototype:GetDamage(useful)
local damage = 0
-- players
if Skada.db.profile.absdamage and self.totaldamage then
damage = self.totaldamage
elseif self.damage then
damage = self.damage
end
if useful and self.overkill then
damage = max(0, damage - self.overkill)
end
-- arena damage
if Skada.forPVP and self.type == "arena" then
if Skada.db.profile.absdamage and self.etotaldamage then
damage = damage + self.etotaldamage
elseif self.edamage then
damage = damage + self.edamage
end
if useful and self.eoverkill then
damage = max(0, damage - self.eoverkill)
end
end
return damage
end
-- returns set's dps and damage amount
function setPrototype:GetDPS(useful)
local dps, damage = 0, self:GetDamage(useful)
if damage > 0 then
dps = damage / max(1, self:GetTime())
end
return dps, damage
end
-- returns the set's overkill
function setPrototype:GetOverkill()
local overkill = self.overkill or 0
if Skada.forPVP and self.type == "arena" and self.eoverkill then
overkill = overkill + self.eoverkill
end
return overkill
end
-- returns the actor's damage amount
function setPrototype:GetActorDamage(id, name, useful)
local actor = self:GetActor(name, id)
return actor and actor:GetDamage(useful) or 0
end
-- returns the actor's dps and damage amount.
function setPrototype:GetActorDPS(id, name, useful, active)
local actor = self:GetActor(name, id)
if actor then
return actor:GetDPS(useful, active)
end
return 0, 0
end
-- returns the actor's damage spells table if found
function setPrototype:GetActorDamageSpells(id, name)
local actor = self:GetActor(name, id)
if actor then
return actor.damagespells, actor
end
end
-- returns the actor's damage targets table if found
function setPrototype:GetActorDamageTargets(id, name, tbl)
local actor = self:GetActor(name, id)
if actor then
return actor:GetDamageTargets(tbl), actor
end
end
-- returns the actor's damage on the given target
function setPrototype:GetActorDamageOnTarget(id, name, targetname)
local actor = self:GetActor(name, id)
if actor then
return actor:GetDamageOnTarget(targetname)
end
return 0, 0, 0
end
-- ------------------------------------
-- damage taken functions
-- ------------------------------------
-- returns the set's damage taken amount
function setPrototype:GetDamageTaken()
local damage = 0
-- players
if Skada.db.profile.absdamage and self.totaldamagetaken then
damage = self.totaldamagetaken
elseif self.damagetaken then
damage = self.damagetaken
end
-- arena damage
if Skada.forPVP and self.type == "arena" and self.GetEnemyDamageTaken then
damage = damage + self:GetEnemyDamageTaken()
end
return damage
end
-- returns the set's dtps and damage taken amount
function setPrototype:GetDTPS()
local dtps, damage = 0, self:GetDamageTaken()
if damage > 0 then
dtps = damage / max(1, self:GetTime())
end
return dtps, damage
end
-- returns the actor's damage taken amount
function setPrototype:GetActorDamageTaken(id, name)
local actor = self:GetActor(name, id)
return actor and actor:GetDamageTaken()
end
-- returns the actor's dtps and damage taken amount
function setPrototype:GetActorDTPS(id, name, active)
local actor = self:GetActor(name, id)
if actor then
return actor:GetDTPS(active)
end
return 0, 0
end
-- returns the actor's damage taken spells table if found
function setPrototype:GetActorDamageTakenSpells(id, name)
local actor = self:GetActor(name, id)
return actor and actor.damagetakenspells
end
-- returns the actor's damage taken sources table if found
function setPrototype:GetActorDamageSources(id, name, tbl)
local actor = self:GetActor(name, id)
if actor then
return actor:GetDamageSources(tbl), actor
end
end
-- returns the damage, overkill and useful
function setPrototype:GetActorDamageFromSource(id, name, targetname)
local actor = self:GetActor(name, id)
if actor then
return actor:GetDamageFromSource(targetname)
end
return 0, 0, 0
end
-- ------------------------------------
-- absorb and healing functions
-- ------------------------------------
-- returns the set's heal amount
function setPrototype:GetHeal()
local heal = self.heal or 0
-- include enemies healing in arena
if Skada.forPVP and self.type == "arena" and self.eheal then
heal = heal + self.eheal
end
return heal
end
-- returns the set's hps and heal amount
function setPrototype:GetHPS()
local heal = self:GetHeal()
if heal > 0 then
return heal / max(1, self:GetTime()), heal
end
return 0, heal
end
-- returns the set's overheal amount
function setPrototype:GetOverheal()
local overheal = self.overheal or 0
-- include enemies healing in arena
if Skada.forPVP and self.type == "arena" and self.eoverheal then
overheal = overheal + self.eoverheal
end
return overheal
end
-- returns the set's overheal per second and overheal amount
function setPrototype:GetOHPS()
local overheal = self:GetOverheal()
if overheal > 0 then
return overheal / max(1, self:GetTime()), overheal
end
return 0, overheal
end
-- returns the set's total heal amount, including overheal amount
function setPrototype:GetTotalHeal()
local heal = self.heal or 0
if self.overheal then
heal = heal + self.overheal
end
-- include enemies in arena
if Skada.forPVP and self.type == "arena" and self.eheal then
heal = heal + self.eheal
end
return heal
end
-- returns the set's total hps and heal
function setPrototype:GetTHPS()
local heal = self:GetTotalHeal()
if heal > 0 then
return heal / max(1, self:GetTime()), heal
end
return 0, heal
end
-- returns the set's absorb amount
function setPrototype:GetAbsorb()
local absorb = self.absorb or 0
-- include enemies in arena
if Skada.forPVP and self.type == "arena" and self.eabsorb then
absorb = absorb + self.eabsorb
end
return absorb
end
-- returns the set's absorb per second and absorb amount
function setPrototype:GetAPS()
local absorb = self:GetAbsorb()
if absorb > 0 then
return absorb / max(1, self:GetTime()), absorb
end
return 0, absorb
end
-- returns the set's amount of heal and absorb combined
function setPrototype:GetAbsorbHeal()
local heal = self.heal or 0
if self.absorb then
heal = heal + self.absorb
end
-- include enemies healing in arena
if Skada.forPVP and self.type == "arena" then
if self.eheal then
heal = heal + self.eheal
end
if self.eabsorb then
heal = heal + self.eabsorb
end
end
return heal
end
-- returns the set's absorb and heal per sec
function setPrototype:GetAHPS()
local heal = self:GetAbsorbHeal()
if heal > 0 then
return heal / max(1, self:GetTime()), heal
end
return 0, heal
end
-------------------------------------------------------------------------------
-- common actors functions
-- binds a table to the prototype table
function actorPrototype:Bind(obj, set)
if obj and getmetatable(obj) ~= self then
setmetatable(obj, self)
self.__index = self
obj.super = set
end
return obj
end
-- for better dps calculation, we use active time for Arena/BGs.
function actorPrototype:GetTime(active)
active = active or (self.super.type == "pvp") or (self.super.type == "arena")
return Skada:GetActiveTime(self.super, self, active)
end
-- ------------------------------------
-- damage done functions
-- ------------------------------------
-- returns the actor's damage amount
function actorPrototype:GetDamage(useful)
local damage = 0
if Skada.db.profile.absdamage and self.totaldamage then
damage = self.totaldamage
elseif self.damage then
damage = self.damage
end
if useful and self.overkill then
damage = max(0, damage - self.overkill)
end
return damage
end
-- returns the actor's dps and damage amount
function actorPrototype:GetDPS(useful, active)
local damage = self:GetDamage(useful)
if damage > 0 then
return damage / max(1, self:GetTime(active)), damage
end
return 0, damage
end
-- returns the actor's overkill
function actorPrototype:GetOverkill()
return self.overkill or 0
end
-- returns the actor's damage targets table if found
function actorPrototype:GetDamageTargets(tbl)
if self.damagespells then
tbl = wipe(tbl or cacheTable)
for _, spell in pairs(self.damagespells) do
if spell.targets then
for name, tar in pairs(spell.targets) do
if not tbl[name] then
tbl[name] = {amount = tar.amount, total = tar.total, overkill = tar.overkill}
else
tbl[name].amount = tbl[name].amount + tar.amount
if tar.total then
tbl[name].total = (tbl[name].total or 0) + tar.total
end
if tar.overkill then
tbl[name].overkill = (tbl[name].overkill or 0) + tar.overkill
end
end
-- attempt to get actor details
if not tbl[name].class then
local actor = self.super:GetActor(name)
if actor then
tbl[name].id = actor.id
tbl[name].class = actor.class
tbl[name].role = actor.role
tbl[name].spec = actor.spec
end
end
end
end
end
end
return tbl
end
-- returns the damage on the given target
function actorPrototype:GetDamageOnTarget(name)
local damage, overkill, useful = 0, 0, 0
if self.damagespells and name then
for _, spell in pairs(self.damagespells) do
if spell.targets and spell.targets[name] then
-- damage
if Skada.db.profile.absdamage and spell.targets[name].total then
damage = damage + spell.targets[name].total
elseif spell.targets[name].amount then
damage = damage + spell.targets[name].amount
end
-- overkill
if spell.targets[name].overkill then
overkill = overkill + spell.targets[name].overkill
end
-- useful
if spell.targets[name].useful then
useful = useful + spell.targets[name].useful
end
end
end
end
return damage, overkill, useful
end
-- ------------------------------------
-- damage taken functions
-- ------------------------------------
-- returns the actor's damage taken amount
function actorPrototype:GetDamageTaken()
if Skada.db.profile.absdamage and self.totaldamagetaken then
return self.totaldamagetaken
end
return self.damagetaken or 0
end
-- returns the actor's dtps and damage taken amount
function actorPrototype:GetDTPS(active)
local damage = self:GetDamageTaken()
if damage > 0 then
return damage / max(1, self:GetTime(active)), damage
end
return 0, damage
end
-- returns the actors damage sources
function actorPrototype:GetDamageSources(tbl)
if self.damagetakenspells then
tbl = wipe(tbl or cacheTable)
for _, spell in pairs(self.damagetakenspells) do
if spell.sources then
for name, source in pairs(spell.sources) do
if not tbl[name] then
tbl[name] = {
amount = source.amount,
total = source.total,
overkill = source.overkill, -- nil for players
useful = source.useful, -- nil for enemies
}
else
tbl[name].amount = tbl[name].amount + source.amount
if source.total then
tbl[name].total = (tbl[name].total or 0) + source.total
end
if source.overkill then -- nil for players
tbl[name].overkill = (tbl[name].overkill or 0) + source.overkill
end
if source.useful then -- nil for enemies
tbl[name].useful = (tbl[name].useful or 0) + source.useful
end
end
-- attempt to get actor details
if not tbl[name].class then
local actor = self.super:GetActor(name)
if actor then
tbl[name].id = actor.id
tbl[name].class = actor.class
tbl[name].role = actor.role
tbl[name].spec = actor.spec
end
end
end
end
end
end
return tbl
end
-- returns the actors damage from the given source
function actorPrototype:GetDamageFromSource(name)
local damage, overkill, useful = 0, 0, 0
if self.damagetakenspells and name then
for _, spell in pairs(self.damagetakenspells) do
if spell.sources and spell.sources[name] then
-- damage
if Skada.db.profile.absdamage and spell.sources[name].total then
damage = damage + spell.sources[name].total
elseif spell.sources[name].amount then
damage = damage + spell.sources[name].amount
end
-- overkill
if spell.sources[name].overkill then
overkill = overkill + spell.sources[name].overkill
end
-- useful
if spell.sources[name].useful then
useful = useful + spell.sources[name].useful
end
end
end
end
return damage, overkill, useful
end
-- ------------------------------------
-- absorb and healing functions
-- ------------------------------------
-- returns the actor' heal amount
function actorPrototype:GetHeal()
return self.heal or 0
end
-- returns the actor's hps and heal amount
function actorPrototype:GetHPS(active)
local heal = self.heal or 0
if heal > 0 then
return heal / max(1, self:GetTime(active)), heal
end
return 0, heal
end
-- returns the actor's overheal amount
function actorPrototype:GetOverheal()
return self.overheal or 0
end
-- returns the actor's overheal per second and overheal amount
function actorPrototype:GetOHPS(active)
local overheal = self.overheal or 0
if overheal > 0 then
return overheal / max(1, self:GetTime(active)), overheal
end
return 0, overheal
end
-- returns the actor's total heal, including overheal
function actorPrototype:GetTotalHeal()
local heal = self.heal or 0
if self.overheal then
heal = heal + self.overheal
end
return heal
end
-- returns the actor's total hps and heal
function actorPrototype:GetTHPS(active)
local heal = self:GetTotalHeal()
if heal > 0 then
return heal / max(1, self:GetTime(active)), heal
end
return 0, heal
end
-- returns the actor's heal targets table if found
function actorPrototype:GetHealTargets(tbl)
if self.healspells then
tbl = wipe(tbl or cacheTable)
for _, spell in pairs(self.healspells) do
if spell.targets then
for name, target in pairs(spell.targets) do
if type(target) == "number" then
if not tbl[name] then
tbl[name] = {amount = target}
else
tbl[name].amount = tbl[name].amount + target
end
else
if not tbl[name] then
tbl[name] = {amount = target.amount, overheal = target.overheal}
else
tbl[name].amount = tbl[name].amount + target.amount
if target.overheal then
tbl[name].overheal = (tbl[name].overheal or 0) + target.overheal
end
end
end
-- attempt to get actor details
if not tbl[name].class then
local actor = self.super:GetActor(name)
if actor then
tbl[name].id = actor.id
tbl[name].class = actor.class
tbl[name].role = actor.role
tbl[name].spec = actor.spec
end
end
end
end
end
end
return tbl
end
-- returns the amount of heal and overheal on the given target
function actorPrototype:GetHealOnTarget(name)
local heal, overheal = 0, 0
if self.healspells and name then
for _, spell in pairs(self.healspells) do
if spell.targets and spell.targets[name] then
if type(spell.targets[name]) == "number" then
heal = heal + spell.targets[name]
else
heal = heal + spell.targets[name].amount
if spell.targets[name].overheal then
overheal = overheal + spell.targets[name].overheal
end
end
end
end
end
return heal, overheal
end
-- returns the table of overheal targets if found
function actorPrototype:GetOverhealTargets(tbl)
if self.overheal and self.healspells then
tbl = wipe(tbl or cacheTable)
for _, spell in pairs(self.healspells) do
if (spell.overheal or 0) > 0 and spell.targets then
for name, target in pairs(spell.targets) do
if (target.overheal or 0) > 0 then
if not tbl[name] then
tbl[name] = {amount = target.overheal, total = target.amount + target.overheal}
else
tbl[name].amount = tbl[name].amount + target.overheal
tbl[name].total = tbl[name].total + target.amount + target.overheal
end
-- attempt to get actor details
if not tbl[name].class then
local actor = self.super:GetActor(name)
if actor then
tbl[name].id = actor.id
tbl[name].class = actor.class
tbl[name].role = actor.role
tbl[name].spec = actor.spec
end
end
end
end
end
end
end
return tbl
end
-- returns the amount of overheal on the given target
function actorPrototype:GetOverhealOnTarget(name)
local overheal = 0
if self.overheal and self.healspells and name then
for _, spell in pairs(self.healspells) do
if (spell.overheal or 0) > 0 and spell.targets and spell.targets[name] and spell.targets[name].overheal then
overheal = overheal + spell.targets[name].overheal
end
end
end
return overheal
end
-- returns the total heal amount on the given target
function actorPrototype:GetTotalHealTargets(tbl)
if self.healspells then
tbl = wipe(tbl or cacheTable)
for _, spell in pairs(self.healspells) do
if spell.targets then
for name, target in pairs(spell.targets) do
if type(target) == "number" then
if not tbl[name] then
tbl[name] = {amount = target}
else
tbl[name].amount = tbl[name].amount + target
end
else
if not tbl[name] then
tbl[name] = {amount = target.amount + target.overheal}
else
tbl[name].amount = tbl[name].amount + target.amount + target.overheal
end
end
-- attempt to get actor details
if not tbl[name].class then
local actor = self.super:GetActor(name)
if actor then
tbl[name].id = actor.id
tbl[name].class = actor.class
tbl[name].role = actor.role
tbl[name].spec = actor.spec
end
end
end
end
end
end
return tbl
end
-- returns the total heal amount on the given target
function actorPrototype:GetTotalHealOnTarget(name)
local heal = 0
if self.healspells and name then
for _, spell in pairs(self.healspells) do
if spell.targets and spell.targets[name] then
if type(spell.targets[name]) == "number" then
heal = heal + spell.targets[name]
else
heal = heal + spell.targets[name].amount + spell.targets[name].overheal
end
end
end
end
return heal
end
-- returns the actor's absorb amount
function actorPrototype:GetAbsorb()
return self.absorb or 0
end
-- returns the actor's absorb per second and absorb amount
function actorPrototype:GetAPS(active)
local absorb = self.absorb or 0
if absorb > 0 then
return absorb / max(1, self:GetTime(active)), absorb
end
return 0, absorb
end
-- returns the actor's amount of heal and absorb combined
function actorPrototype:GetAbsorbHeal()
local heal = self.heal or 0
if self.absorb then
heal = heal + self.absorb
end
return heal
end
-- returns the actor's absorb and heal per sec
function actorPrototype:GetAHPS(active)
local heal = self:GetAbsorbHeal()
if heal > 0 then
return heal / max(1, self:GetTime(active)), heal
end
return 0, heal
end
-- returns the actor's absorb targets table if found
function actorPrototype:GetAbsorbTargets(tbl)
if self.absorbspells then
tbl = wipe(tbl or cacheTable)
for _, spell in pairs(self.absorbspells) do
if spell.targets then
for name, amount in pairs(spell.targets) do
if not tbl[name] then
tbl[name] = {amount = amount}
else
tbl[name].amount = tbl[name].amount + amount
end
-- attempt to get actor details
if not tbl[name].class then
local actor = self.super:GetActor(name)
if actor then
tbl[name].id = actor.id
tbl[name].class = actor.class
tbl[name].role = actor.role
tbl[name].spec = actor.spec
end
end
end
end
end
end
return tbl
end
-- returns the actor's absorb and heal targets table if found
function actorPrototype:GetAbsorbHealTargets(tbl)
if self.healspells or self.absorbspells then
tbl = wipe(tbl or cacheTable)
-- absorb targets
if self.absorbspells then
for _, spell in pairs(self.absorbspells) do
if spell.targets then
for name, amount in pairs(spell.targets) do
if not tbl[name] then
tbl[name] = {amount = amount}
else
tbl[name].amount = tbl[name].amount + amount
end
-- attempt to get actor details
if not tbl[name].class then
local actor = self.super:GetActor(name)
if actor then
tbl[name].id = actor.id
tbl[name].class = actor.class
tbl[name].role = actor.role
tbl[name].spec = actor.spec
end
end
end
end
end
end
-- heal targets
if self.healspells then
for _, spell in pairs(self.healspells) do
if spell.targets then
for name, target in pairs(spell.targets) do
if type(target) == "number" then
if not tbl[name] then
tbl[name] = {amount = target}
else
tbl[name].amount = tbl[name].amount + target
end
else
if not tbl[name] then
tbl[name] = {amount = target.amount, overheal = target.overheal}
else
tbl[name].amount = tbl[name].amount + target.amount
if target.overheal then
tbl[name].overheal = (tbl[name].overheal or 0) + target.overheal
end
end
end
-- attempt to get actor details
if not tbl[name].class then
local actor = self.super:GetActor(name)
if actor then
tbl[name].id = actor.id
tbl[name].class = actor.class
tbl[name].role = actor.role
tbl[name].spec = actor.spec
end
end
end
end
end
end
end
return tbl
end
-- returns the amount of absorb and heal on the given target
function actorPrototype:GetAbsorbHealOnTarget(name)
local heal, overheal = 0, 0
-- absorb spells
if name and self.absorbspells then
for _, spell in pairs(self.absorbspells) do
if spell.targets and spell.targets[name] then
heal = heal + spell.targets[name]
end
end
end
-- heal spells
if self.healspells and name then
for _, spell in pairs(self.healspells) do
if spell.targets and spell.targets[name] then
if type(spell.targets[name]) == "number" then
heal = heal + spell.targets[name]
else
heal = heal + spell.targets[name].amount
if spell.targets[name].overheal then
overheal = overheal + spell.targets[name].overheal
end
end
end
end
end
return heal, overheal
end |
--[[------------------------------------------------------------------
Flashlight icon.
]]--------------------------------------------------------------------
local FLASH_FULL, FLASH_EMPTY, FLASH_BEAM = 'flash_full', 'flash_empty', 'flash_beam'
local gmod_suit = GetConVar('gmod_suit')
--[[ Create element ]]--
local ELEMENT = GSRCHUD.element.create()
-- draw
function ELEMENT:draw()
local localPlayer = GSRCHUD.localPlayer()
local scale = GSRCHUD.sprite.scale()
-- sort parameters
local x = self.parameters.x or ScrW()
local y = self.parameters.y or 16 * scale
local amount = self.parameters.amount or localPlayer:GetSuitPower() * .01
local used = self.parameters.inUse
local hide = self.parameters.hide
local hlBg = self.parameters.highlightEmptySprite
local xoff = (self.parameters.fullSpriteOffsetX or 0) * scale
local yoff = (self.parameters.fullSpriteOffsetY or 0) * scale
local low = self.parameters.low
-- sort nil parameters
if used == nil then used = localPlayer:KeyDown(IN_SPEED) or localPlayer:WaterLevel() >= 3 or localPlayer:FlashlightIsOn() end
if hide == nil then hide = not gmod_suit:GetBool() end
-- call hooks to allow third party addons customize it
local _amount, _used, _hide = hook.Run('GSRCHUDFlashlight')
if _hide ~= nil then hide = _hide end
if _amount then amount = _amount end -- replace amount if one was provided
-- export whether the flashlight is visible
self:export('visible', not hide)
-- do not draw if prompted to do so
if hide then return end
local w, h = GSRCHUD.sprite.getSize(FLASH_BEAM, scale)
local highlight = 0
if low == nil then
low = amount <= .25
else
if isnumber(low) then low = amount <= low end
end
-- select colour
low = GSRCHUD.sprite.userColour(GSRCHUD.config.getFlashlightColour(), low)
-- draw beam and highlight sprite
if _used or (_used == nil and used) then
GSRCHUD.sprite.draw(FLASH_BEAM, x, y, low, TEXT_ALIGN_RIGHT)
highlight = 1
end
-- displace flashlight icon
x = x - w
-- draw background
if not hlBg then
GSRCHUD.sprite.draw(FLASH_EMPTY, x, y, low, TEXT_ALIGN_RIGHT)
else -- if background should be highlighted, draw a twin sprite
GSRCHUD.sprite.drawTwin(FLASH_EMPTY, x, y, highlight, low, TEXT_ALIGN_RIGHT)
end
-- get foreground sprite size
w, h = GSRCHUD.sprite.getSize(FLASH_FULL)
-- apply foreground offset
x = x + xoff
y = y + yoff
-- draw foreground
render.SetScissorRect(x - (w * amount), y, x + w, y + h, true)
GSRCHUD.sprite.drawTwin(FLASH_FULL, x, y, highlight, low, TEXT_ALIGN_RIGHT)
render.SetScissorRect(0, 0, 0, 0, false)
end
-- register
GSRCHUD.element.register('flashlight', {'CHudSuitPower'}, ELEMENT)
|
tfm.exec.disableAutoShaman()
tfm.exec.disableAutoNewGame()
math.inSquare = function(x1,y1,r1,x2,y2,r2)
return (x1 + r1 > x2 - r2 and x1 - r1 < x2 + r2) and (y1 + r1 > y2 - r2 and y1 - r1 < y2 + r2)
end
info = {}
eventNewPlayer = function(n)
tfm.exec.chatMessage("<J>Press <B>spacebar</B> to get the enemy and <B>B</B> for boost.", playerName)
if not info[n] then
info[n] = {
n = n,
id = tfm.get.room.playerList[n].id,
isDead = {false,0},
capture = 0,
size = 10,
speed = 5,
boost = {0,0,0}, -- speed, end, is boosting
color = math.random(0xFFFFFF),
coord = {math.random(800),math.random(400)},
dir = {0,0},
}
end
for k,v in next,{0,1,2,3,32,string.byte("POB",1,3)} do
system.bindKeyboard(n,v,true,true)
system.bindKeyboard(n,v,false,true)
end
end
table.foreach(tfm.get.room.playerList,eventNewPlayer)
eventNewGame = function()
table.foreach(tfm.get.room.playerList,tfm.exec.killPlayer)
end
eventLoop = function(currentTime)
_G.currentTime = currentTime
end
loop = function()
if currentTime / 1000 > 3 then
for k,v in next,info do
if not v.isDead[1] then
v.coord[1] = v.coord[1] + v.dir[1]
v.coord[2] = v.coord[2] + v.dir[2]
if v.coord[1] < 1 then
v.coord[1] = 800
elseif v.coord[1] > 800 then
v.coord[1] = 1
end
if v.coord[2] < 1 then
v.coord[2] = 400
elseif v.coord[2] > 400 then
v.coord[2] = 1
end
if v.boost[3] == 1 then
if v.boost[2] > 0 then
v.boost[2] = v.boost[2] - .5
else
v.boost[2] = 0
v.boost[3] = 0
v.speed = v.boost[1]
end
else
if v.boost[2] < 4.5 then
v.boost[2] = v.boost[2] + .05
end
end
ui.addTextArea(v.id or 1000,"",nil,v.coord[1] or 0,v.coord[2] or 0,v.size or 10,v.size or 10,v.color or 1,v.color or 1,.5,true)
ui.addTextArea(-v.id,"<font size='8' color='#E6FF00'>" .. v.n,nil,v.coord[1] - 10 - #v.n,v.coord[2] - (v.size/2) - 15,nil,nil,1,1,0,true)
ui.addTextArea(0,string.format("X: %s\nY: %s\nSize: %sx%s\nSpeed: %s\nBoost: %s",v.coord[1],v.coord[2],v.size,v.size,v.speed,v.boost[2]),v.n,0,30,120,100,1,1,0,true)
else
if os.time() > v.isDead[2] then
v.isDead = {false,0}
v.coord = {math.random(800),math.random(400)}
end
end
end
end
end
system.looping(loop, 10)
eventKeyboard = function(n,k,d)
if k == 32 then
if os.time() > info[n].capture then
info[n].capture = os.time() + 5000
for k,v in next,info do
if n ~= v.n then
if math.inSquare(v.coord[1],v.coord[2],v.size,info[n].coord[1],info[n].coord[2],info[n].size) then
info[n].size = info[n].size + (10/100) * v.size
info[n].speed = info[n].speed + (15/100) * v.speed
ui.removeTextArea(v.id,nil)
ui.removeTextArea(-v.id,nil)
ui.removeTextArea(0,v.n)
v.isDead = {true,os.time() + 10000}
v.size = 10
v.speed = 5
info[n].capture = 0
break
end
end
end
end
elseif k == string.byte("B") then
if info[n].boost[2] > .5 then
info[n].boost[3] = d and 1 or 0
if d then
info[n].boost[1] = info[n].speed
info[n].speed = info[n].speed * 2.5
else
info[n].speed = info[n].boost[1]
end
end
elseif k == string.byte("P") then
elseif k == string.byte("O") then
ui.showColorPicker(0,n,info[n].color,"Square")
else
if k == 0 then
info[n].dir = {-info[n].speed,0}
elseif k == 2 then
info[n].dir = {info[n].speed,0}
elseif k == 1 then
info[n].dir = {0,-info[n].speed}
elseif k == 3 then
info[n].dir = {0,info[n].speed}
end
end
end
eventColorPicked = function(i,n,c)
info[n].color = c
end
tfm.exec.newGame('<C><P /><Z><S /><D /><O /></Z></C>') |
function GM:Think()
self:StateThink();
self:ConsciousnessThink();
self:AIThink();
end
|
----------------------------------------------------------------------------------------
-- Configuration of Nameplates
----------------------------------------------------------------------------------------
local E, C, L = select(2, ...):unpack()
C.nameplate.whiteList = {
-- Buffs
[642] = true, -- 圣盾术
[1022] = true, -- 保护之手
[23920] = true, -- 法术反射
[45438] = true, -- 寒冰屏障
[186265] = true, -- 灵龟守护
-- Debuffs
[2094] = true, -- 致盲
[10326] = true, -- 超度邪恶
[20549] = true, -- 战争践踏
[107079] = true, -- 震山掌
[117405] = true, -- 束缚射击
[127797] = true, -- 乌索尔旋风
[272295] = true, -- 悬赏
-- Mythic+
[228318] = true, -- 激怒
[226510] = true, -- 血池
[343553] = true, -- 万噬之怨
[343502] = true, -- 鼓舞光环
-- Dungeons
[320293] = true, -- 伤逝剧场,融入死亡
[331510] = true, -- 伤逝剧场,死亡之愿
[333241] = true, -- 伤逝剧场,暴脾气
[336449] = true, -- 凋魂之殇,玛卓克萨斯之墓
[336451] = true, -- 凋魂之殇,玛卓克萨斯之壁
[333737] = true, -- 凋魂之殇,凝结之疾
[328175] = true, -- 凋魂之殇,凝结之疾
[340357] = true, -- 凋魂之殇,急速感染
[228626] = true, -- 彼界,怨灵之瓮
[344739] = true, -- 彼界,幽灵
[333227] = true, -- 彼界,不死之怒
[326450] = true, -- 赎罪大厅,忠心的野兽
[343558] = true, -- 通灵战潮,病态凝视
[343470] = true, -- 通灵战潮,碎骨之盾
[328351] = true, -- 通灵战潮,染血长枪
[322433] = true, -- 赤红深渊,石肤术
[321402] = true, -- 赤红深渊,饱餐
[327416] = true, -- 晋升高塔,心能回灌
[317936] = true, -- 晋升高塔,弃誓信条
[327812] = true, -- 晋升高塔,振奋英气
[339917] = true, -- 晋升高塔,命运之矛
[323149] = true, -- 仙林,黑暗之拥
[322569] = true, -- 仙林,兹洛斯之手
[355147] = true, -- 集市,鱼群鼓舞
[355057] = true, -- 集市,鱼人战吼
[351088] = true, -- 集市,圣物联结
[355640] = true, -- 集市,重装方阵
[355783] = true, -- 集市,力量增幅
[347840] = true, -- 集市,野性
[347015] = true, -- 集市,强化防御
-- Raids
[334695] = true, -- 动荡能量,猎手
[345902] = true, -- 破裂的联结,猎手
[346792] = true, -- 罪触之刃,猩红议会
}
C.nameplate.blackList = {
[15407] = true, -- 精神鞭笞
[51714] = true, -- 锋锐之霜
[199721] = true, -- 腐烂光环
[214968] = true, -- 死灵光环
[214975] = true, -- 抑心光环
[273977] = true, -- 亡者之握
[276919] = true, -- 承受压力
[206930] = true, -- 心脏打击
} |
local loveMath = require("love.math")
local abs = math.abs
local cos = math.cos
local floor = math.floor
local max = math.max
local min = math.min
local modf = math.modf
local sin = math.sin
local sqrt = math.sqrt
local M = {}
function M.clamp(x, minX, maxX)
return min(max(x, minX), maxX)
end
function M.cross(ax, ay, az, bx, by, bz)
return ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx
end
function M.distance2(x1, y1, x2, y2)
local dx = x2 - x1
local dy = y2 - y1
return sqrt(dx * dx + dy * dy)
end
function M.distance3(x1, y1, z1, x2, y2, z2)
local dx = x2 - x1
local dy = y2 - y1
local dz = z2 - z1
return sqrt(dx * dx + dy * dy + dz * dz)
end
function M.dot3(x1, y1, z1, x2, y2, z2)
return x1 * x2 + y1 * y2 + z1 * z2
end
function M.length3(x, y, z)
return sqrt(x * x + y * y + z * z)
end
function M.mix(a, b, t)
return (1 - t) * a + t * b
end
function M.mix3(ax, ay, az, bx, by, bz, tx, ty, tz)
ty = ty or tx
tz = tz or tx
local x = (1 - tx) * ax + tx * bx
local y = (1 - ty) * ay + ty * by
local z = (1 - tz) * az + tz * bz
return x, y, z
end
function M.mix4(ax, ay, az, aw, bx, by, bz, bw, tx, ty, tz, tw)
ty = ty or tx
tz = tz or tx
tw = tw or tx
local x = (1 - tx) * ax + tx * bx
local y = (1 - ty) * ay + ty * by
local z = (1 - tz) * az + tz * bz
local w = (1 - tw) * aw + tw * bw
return x, y, z, w
end
function M.normalize2(x, y)
local length = sqrt(x * x + y * y)
return x / length, y / length, length
end
function M.normalize3(x, y, z)
local length = sqrt(x * x + y * y + z * z)
return x / length, y / length, z / length, length
end
function M.perp(x, y, z)
if abs(x) < abs(y) then
if abs(y) < abs(z) then
return 0, -z, y
elseif abs(x) < abs(z) then
return 0, z, -y
else
return -y, x, 0
end
else
if abs(z) < abs(y) then
return y, -x, 0
elseif abs(z) < abs(x) then
return z, 0, -x
else
return -z, 0, x
end
end
end
function M.round3(x, y, z)
return floor(x + 0.5), floor(y + 0.5), floor(z + 0.5)
end
-- https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
function M.setRotation3(t, axisX, axisY, axisZ, angle)
local t11, t12, t13, t14,
t21, t22, t23, t24,
t31, t32, t33, t34,
t41, t42, t43, t44 = t:getMatrix()
local cosAngle = cos(angle)
local sinAngle = sin(angle)
t11 = cosAngle + axisX * axisX * (1 - cosAngle)
t12 = axisX * axisY * (1 - cosAngle) - axisZ * sinAngle
t13 = axisX * axisZ * (1 - cosAngle) + axisY * sinAngle
t21 = axisY * axisX * (1 - cosAngle) + axisZ * sinAngle
t22 = cosAngle + axisY * axisY * (1 - cosAngle)
t23 = axisY * axisZ * (1 - cosAngle) - axisX * sinAngle
t31 = axisZ * axisX * (1 - cosAngle) - axisY * sinAngle
t32 = axisZ * axisY * (1 - cosAngle) + axisX * sinAngle
t33 = cosAngle + axisZ * axisZ * (1 - cosAngle)
t:setMatrix(t11, t12, t13, t14,
t21, t22, t23, t24,
t31, t32, t33, t34,
t41, t42, t43, t44)
return t
end
function M.setTranslation3(t, x, y, z)
local t11, t12, t13, t14,
t21, t22, t23, t24,
t31, t32, t33, t34,
t41, t42, t43, t44 = t:getMatrix()
t:setMatrix(t11, t12, t13, x,
t21, t22, t23, y,
t31, t32, t33, z,
t41, t42, t43, t44)
return t
end
function M.smoothstep(x1, x2, x)
x = min(max((x - x1) / (x2 - x1), 0), 1)
return x * x * (3 - 2 * x)
end
function M.squaredDistance3(x1, y1, z1, x2, y2, z2)
return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1)
end
function M.transformPoint3(t, x, y, z)
local t11, t12, t13, t14,
t21, t22, t23, t24,
t31, t32, t33, t34,
t41, t42, t43, t44 = t:getMatrix()
local tx = t11 * x + t12 * y + t13 * z + t14
local ty = t21 * x + t22 * y + t23 * z + t24
local tz = t31 * x + t32 * y + t33 * z + t34
return tx, ty, tz
end
function M.transformVector3(t, x, y, z)
local t11, t12, t13, t14,
t21, t22, t23, t24,
t31, t32, t33, t34,
t41, t42, t43, t44 = t:getMatrix()
local tx = t11 * x + t12 * y + t13 * z
local ty = t21 * x + t22 * y + t23 * z
local tz = t31 * x + t32 * y + t33 * z
return tx, ty, tz
end
function M.translate3(t, x, y, z)
return t:apply(loveMath.newTransform():setMatrix(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1))
end
return M
|
local basePath = (...):gsub('[^%.]+$', '')
local Button = require(basePath .. "Button")
local SliderHandle = Button:extend()
function SliderHandle.updatePos(self, dx, dy, isLocal)
local startPoint = -self.length/2 + self.offset -- Slider handle must be anchored to center point.
local endPoint = self.length/2 + self.offset
if dx and dy then
-- Convert dx and dx to local deltas relative to the bar.
if not isLocal then
local bar = self.bar
local wx, wy = bar._to_world.x + dx, bar._to_world.y + dy
dx, dy = bar:toLocal(wx, wy)
end
-- Clamp to start and end points.
self._myAlloc.x = math.max(startPoint, math.min(endPoint, self._myAlloc.x + dx))
else -- Set based on current fraction.
self._myAlloc.x = startPoint + self.length * self.fraction
end
end
function SliderHandle.drag(self, dx, dy, dragType, isLocal)
if dragType then return end -- Only respond to the default drag type.
self:updatePos(dx, dy, isLocal)
self.fraction = (self._myAlloc.x - self.offset + self.length/2) / self.length
if self.dragFunc then self:dragFunc(self.fraction) end
self.theme[self.themeType].drag(self, dx, dy)
end
local dirs = { up = {0, -1}, down = {0, 1}, left = {-1, 0}, right = {1, 0} }
local COS45 = math.cos(math.rad(45))
function SliderHandle.getFocusNeighbor(self, dir)
local dirVec = dirs[dir]
local bar = self.bar
local x, y = bar._to_world.x + dirVec[1], bar._to_world.y + dirVec[2]
x, y = bar:toLocal(x, y)
if math.abs(x) > COS45 then -- Input direction is roughly aligned with slider rotation.
self:drag(x * self.nudgeDist, 0, nil, true)
return 1 -- Consume input.
else
return self.neighbor[dir]
end
end
return SliderHandle
|
local insert, concat
do
local _obj_0 = table
insert, concat = _obj_0.insert, _obj_0.concat
end
local unpack = unpack or table.unpack
local lpeg = require("lpeg")
local R, S, V, P
R, S, V, P = lpeg.R, lpeg.S, lpeg.V, lpeg.P
local C, Cs, Ct, Cmt, Cg, Cb, Cc, Cp
C, Cs, Ct, Cmt, Cg, Cb, Cc, Cp = lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.Cmt, lpeg.Cg, lpeg.Cb, lpeg.Cc, lpeg.Cp
local escaped_char = S("<>'&\"") / {
[">"] = ">",
["<"] = "<",
["&"] = "&",
["'"] = "'",
["/"] = "/",
['"'] = """
}
local alphanum = R("az", "AZ", "09")
local num = R("09")
local hex = R("09", "af", "AF")
local valid_char = C(P("&") * (alphanum ^ 1 + P("#") * (num ^ 1 + S("xX") * hex ^ 1)) + P(";"))
local white = S(" \t\n") ^ 0
local text = C((1 - escaped_char) ^ 1)
local word = (alphanum + S("._-:")) ^ 1
local value = C(word) + P('"') * C((1 - P('"')) ^ 0) * P('"') + P("'") * C((1 - P("'")) ^ 0) * P("'")
local attribute = C(word) * (white * P("=") * white * value) ^ -1
local comment = P("<!--") * (1 - P("-->")) ^ 0 * P("-->")
local value_ignored = word + P('"') * (1 - P('"')) ^ 0 * P('"') + P("'") * (1 - P("'")) ^ 0 * P("'")
local attribute_ignored = word * (white * P("=") * white * value_ignored) ^ -1
local open_tag_ignored = P("<") * white * word * (white * attribute_ignored) ^ 0 * white * (P("/") * white) ^ -1 * P(">")
local close_tag_ignored = P("<") * white * P("/") * white * word * white * P(">")
local escape_text = Cs((escaped_char + 1) ^ 0 * -1)
local Sanitizer
Sanitizer = function(opts)
local allowed_tags, add_attributes, self_closing
do
local _obj_0 = opts and opts.whitelist or require("web_sanitize.whitelist")
allowed_tags, add_attributes, self_closing = _obj_0.tags, _obj_0.add_attributes, _obj_0.self_closing
end
local tag_stack = { }
local attribute_stack = { }
local tag_has_dynamic_add_attribute
tag_has_dynamic_add_attribute = function(tag)
local inject = add_attributes[tag]
if not (inject) then
return false
end
for _, v in pairs(inject) do
if type(v) == "function" then
return true
end
end
return false
end
local check_tag
check_tag = function(str, pos, tag)
local lower_tag = tag:lower()
local allowed = allowed_tags[lower_tag]
if not (allowed) then
return false
end
insert(tag_stack, lower_tag)
return true, tag
end
local check_close_tag
check_close_tag = function(str, pos, punct, tag, rest)
local lower_tag = tag:lower()
local top = #tag_stack
pos = top
while pos >= 1 do
if tag_stack[pos] == lower_tag then
break
end
pos = pos - 1
end
if pos == 0 then
return false
end
local buffer = { }
local k = 1
for i = top, pos + 1, -1 do
local _continue_0 = false
repeat
local next_tag = tag_stack[i]
tag_stack[i] = nil
if attribute_stack[i] then
attribute_stack[i] = nil
end
if self_closing[next_tag] then
_continue_0 = true
break
end
buffer[k] = "</"
buffer[k + 1] = next_tag
buffer[k + 2] = ">"
k = k + 3
_continue_0 = true
until true
if not _continue_0 then
break
end
end
tag_stack[pos] = nil
if attribute_stack[pos] then
attribute_stack[pos] = nil
end
buffer[k] = punct
buffer[k + 1] = tag
buffer[k + 2] = rest
return true, unpack(buffer)
end
local pop_tag
pop_tag = function(str, pos, ...)
local idx = #tag_stack
tag_stack[idx] = nil
if attribute_stack[idx] then
attribute_stack[idx] = nil
end
return true, ...
end
local fail_tag
fail_tag = function()
local idx = #tag_stack
tag_stack[idx] = nil
if attribute_stack[idx] then
attribute_stack[idx] = nil
end
return false
end
local check_attribute
check_attribute = function(str, pos_end, pos_start, name, value)
local tag_idx = #tag_stack
local tag = tag_stack[tag_idx]
local lower_name = name:lower()
local allowed_attributes = allowed_tags[tag]
if type(allowed_attributes) ~= "table" then
return true
end
if tag_has_dynamic_add_attribute(tag) then
local attributes = attribute_stack[tag_idx]
if not (attributes) then
attributes = { }
attribute_stack[tag_idx] = attributes
end
attributes[lower_name] = value
table.insert(attributes, {
name,
value
})
end
local attr = allowed_attributes[lower_name]
local new_val
if type(attr) == "function" then
new_val = attr(value, name, tag)
if not (new_val) then
return true
end
else
if not (attr) then
return true
end
end
if type(new_val) == "string" then
return true, " " .. tostring(name) .. "=\"" .. tostring(assert(escape_text:match(new_val))) .. "\""
else
return true, str:sub(pos_start, pos_end - 1)
end
end
local inject_attributes
inject_attributes = function()
local tag_idx = #tag_stack
local top_tag = tag_stack[tag_idx]
local inject = add_attributes[top_tag]
if inject then
local buff = { }
local i = 1
for k, v in pairs(inject) do
local _continue_0 = false
repeat
if type(v) == "function" then
v = v(attribute_stack[tag_idx] or { })
end
if not (v) then
_continue_0 = true
break
end
buff[i] = " "
buff[i + 1] = k
buff[i + 2] = '="'
buff[i + 3] = v
buff[i + 4] = '"'
i = i + 5
_continue_0 = true
until true
if not _continue_0 then
break
end
end
return true, unpack(buff)
else
return true
end
end
local tag_attributes = Cmt(Cp() * white * attribute, check_attribute) ^ 0
local open_tag = C(P("<") * white) * Cmt(word, check_tag) * (tag_attributes * C(white) * Cmt("", inject_attributes) * (Cmt("/" * white * ">", pop_tag) + C(">")) + Cmt("", fail_tag))
local close_tag = Cmt(C(P("<") * white * P("/") * white) * C(word) * C(white * P(">")), check_close_tag)
if opts and opts.strip_tags then
open_tag = open_tag + open_tag_ignored
close_tag = close_tag + close_tag_ignored
end
if opts and opts.strip_comments then
open_tag = comment + open_tag
end
local html = Ct((open_tag + close_tag + valid_char + escaped_char + text) ^ 0 * -1)
return function(str)
tag_stack = { }
local buffer = assert(html:match(str), "failed to parse html")
local k = #buffer + 1
for i = #tag_stack, 1, -1 do
local _continue_0 = false
repeat
local tag = tag_stack[i]
if self_closing[tag] then
_continue_0 = true
break
end
buffer[k] = "</"
buffer[k + 1] = tag
buffer[k + 2] = ">"
k = k + 3
_continue_0 = true
until true
if not _continue_0 then
break
end
end
return concat(buffer)
end
end
local Extractor
Extractor = function(opts)
local html_text = Ct((open_tag_ignored / " " + close_tag_ignored / " " + valid_char + escaped_char + text) ^ 0 * -1)
return function(str)
local buffer = assert(html_text:match(str), "failed to parse html")
local out = concat(buffer)
out = out:gsub("%s+", " ")
return (out:match("^%s*(.-)%s*$"))
end
end
return {
Sanitizer = Sanitizer,
Extractor = Extractor,
escape_text = escape_text
}
|
if Client then
function MarineActionFinderMixin:OnProcessMove()
PROFILE("MarineActionFinderMixin:OnProcessMove")
local kIconUpdateRate = 0.25
local prediction = Shared.GetIsRunningPrediction()
if prediction then
return
end
local now = Shared.GetTime()
local enoughTimePassed = (now - self.lastMarineActionFindTime) >= kIconUpdateRate
if not enoughTimePassed then
return
end
self.lastMarineActionFindTime = now
local success = false
local gameStarted = self:GetGameStarted()
if self:GetIsAlive() then
local manualPickupWeapon = self:GetNearbyPickupableWeapon()
if gameStarted and manualPickupWeapon then
self.actionIconGUI:ShowIcon(BindingsUI_GetInputValue("Use"), manualPickupWeapon:GetClassName(), nil)
success = true
else
local ent = self:PerformUseTrace()
local usageAllowed = ent ~= nil -- check for entity
usageAllowed = usageAllowed and (gameStarted or (ent.GetUseAllowedBeforeGameStart and ent:GetUseAllowedBeforeGameStart())) -- check if entity can be used before game start
usageAllowed = usageAllowed and (not GetWarmupActive() or not ent.GetCanBeUsedDuringWarmup or ent:GetCanBeUsedDuringWarmup()) -- check if entity can be used during warmup
if usageAllowed then
if GetPlayerCanUseEntity(self, ent) then
if ent:isa("CommandStation") and ent:GetIsBuilt() and not self:GetIsUsing() then
local hintText = gameStarted and "START_COMMANDING" or "START_GAME"
self.actionIconGUI:ShowIcon(BindingsUI_GetInputValue("Use"), nil, hintText, nil)
success = true
elseif HasMixin(ent, "Digest") and ent:GetIsAlive() then
local hintFraction = DigestMixin.GetDigestFraction(ent)
-- avoid the slight flicker at the end, caused by the digest effect for Clogs..
if hintFraction <= 1.0 then
local hintText = "RECYCLE"
self.actionIconGUI:ShowIcon(BindingsUI_GetInputValue("Use"), nil, hintText, hintFraction)
success = true
end
elseif not self:GetIsUsing() then
self.actionIconGUI:ShowIcon(BindingsUI_GetInputValue("Use"), nil, hintText, nil)
success = true
end
end
end
end
end
if not success then
self.actionIconGUI:Hide()
end
end
end |
local mysql = mysql
local encode = encode
local random = math.random
local min = math.min
local mysqlconn = {
host = "DBHOSTNAME",
port = 3306,
database = "hello_world",
user = "benchmarkdbuser",
password = "benchmarkdbpass"
}
return function(ngx)
local db = mysql:new()
assert(db:connect(mysqlconn))
local num_queries = tonumber(ngx.var.arg_queries) or 1
-- May seem like a stupid branch, but since we know that
-- at a benchmark it will always be taken one way,
-- it doesn't matter. For me, after a small warmup, the performance
-- is identical to a version without the branch
-- http://wiki.luajit.org/Numerical-Computing-Performance-Guide
if num_queries == 1 then
ngx.print(encode(db:query('SELECT * FROM World WHERE id = '..random(1,10000))[1]))
else
local worlds = {}
num_queries = min(500, num_queries)
for i=1, num_queries do
worlds[#worlds+1] = db:query('SELECT * FROM World WHERE id = '..random(1,10000))[1]
end
ngx.print( encode(worlds) )
end
db:set_keepalive(0, 256)
end
|
local spec = require('cmp.utils.spec')
local feedkeys = require('cmp.utils.feedkeys')
local types = require('cmp.types')
local core = require('cmp.core')
local source = require('cmp.source')
local keymap = require('cmp.utils.keymap')
local api = require('cmp.utils.api')
describe('cmp.core', function()
describe('confirm', function()
local confirm = function(request, filter, completion_item)
local c = core.new()
local s = source.new('spec', {
complete = function(_, _, callback)
callback({ completion_item })
end,
})
c:register_source(s)
feedkeys.call(request, 'n', function()
c:complete(c:get_context({ reason = types.cmp.ContextReason.Manual }))
vim.wait(5000, function()
return #c.sources[s.id].entries > 0
end)
end)
feedkeys.call(filter, 'n', function()
c:confirm(c.sources[s.id].entries[1], {})
end)
local state = {}
feedkeys.call('', 'x', function()
feedkeys.call('', 'n', function()
if api.is_cmdline_mode() then
state.buffer = { api.get_current_line() }
else
state.buffer = vim.api.nvim_buf_get_lines(0, 0, -1, false)
end
state.cursor = api.get_cursor()
end)
end)
return state
end
describe('insert-mode', function()
before_each(spec.before)
it('label', function()
local state = confirm('iA', 'IU', {
label = 'AIUEO',
})
assert.are.same(state.buffer, { 'AIUEO' })
assert.are.same(state.cursor, { 1, 5 })
end)
it('insertText', function()
local state = confirm('iA', 'IU', {
label = 'AIUEO',
insertText = '_AIUEO_',
})
assert.are.same(state.buffer, { '_AIUEO_' })
assert.are.same(state.cursor, { 1, 7 })
end)
it('textEdit', function()
local state = confirm(keymap.t('i***AEO***<Left><Left><Left><Left><Left>'), 'IU', {
label = 'AIUEO',
textEdit = {
range = {
start = {
line = 0,
character = 3,
},
['end'] = {
line = 0,
character = 6,
},
},
newText = 'foo\nbar\nbaz',
},
})
assert.are.same(state.buffer, { '***foo', 'bar', 'baz***' })
assert.are.same(state.cursor, { 3, 3 })
end)
it('insertText & snippet', function()
local state = confirm('iA', 'IU', {
label = 'AIUEO',
insertText = 'AIUEO($0)',
insertTextFormat = types.lsp.InsertTextFormat.Snippet,
})
assert.are.same(state.buffer, { 'AIUEO()' })
assert.are.same(state.cursor, { 1, 6 })
end)
it('textEdit & snippet', function()
local state = confirm(keymap.t('i***AEO***<Left><Left><Left><Left><Left>'), 'IU', {
label = 'AIUEO',
insertTextFormat = types.lsp.InsertTextFormat.Snippet,
textEdit = {
range = {
start = {
line = 0,
character = 3,
},
['end'] = {
line = 0,
character = 6,
},
},
newText = 'foo\nba$0r\nbaz',
},
})
assert.are.same(state.buffer, { '***foo', 'bar', 'baz***' })
assert.are.same(state.cursor, { 2, 2 })
end)
end)
describe('cmdline-mode', function()
before_each(spec.before)
it('label', function()
local state = confirm(':A', 'IU', {
label = 'AIUEO',
})
assert.are.same(state.buffer, { 'AIUEO' })
assert.are.same(state.cursor[2], 5)
end)
it('insertText', function()
local state = confirm(':A', 'IU', {
label = 'AIUEO',
insertText = '_AIUEO_',
})
assert.are.same(state.buffer, { '_AIUEO_' })
assert.are.same(state.cursor[2], 7)
end)
it('textEdit', function()
local state = confirm(keymap.t(':***AEO***<Left><Left><Left><Left><Left>'), 'IU', {
label = 'AIUEO',
textEdit = {
range = {
start = {
line = 0,
character = 3,
},
['end'] = {
line = 0,
character = 6,
},
},
newText = 'foobarbaz',
},
})
assert.are.same(state.buffer, { '***foobarbaz***' })
assert.are.same(state.cursor[2], 12)
end)
end)
end)
end)
|
local StateBase = require(script:GetCustomProperty("StatesStateBase"))
local SLIDING_BRAKING = script:GetCustomProperty("SlidingBraking")
local SLIDING_FRICTION = script:GetCustomProperty("SlidingFriction")
local SLIDING_VELOCITY = script:GetCustomProperty("SlidingVelocity")
local DEFAULT_BRAKING = script:GetCustomProperty("DefaultBraking")
local DEFAULT_FRICTION = script:GetCustomProperty("DefaultFriction")
local SLIDING_COOLDOWN = script:GetCustomProperty("SlidingCooldown")
local SLIDING_DURATION = script:GetCustomProperty("SlidingDuration")
local NewState = {}
NewState.__index = NewState
setmetatable(NewState, StateBase)
NewState.name = "Slide"
NewState.ExitTask = nil
NewState.possibleStates = {
"Idle",
"Dance",
"Walk",
"Firing",
"Scoping",
"End",
}
function NewState:Enter(player)
if not Object.IsValid(player) then return end
StateBase.Enter(self)
local ForwardVector = Vector3.FORWARD
player:AddImpulse( ForwardVector * SLIDING_VELOCITY )
self.ExitTask = Task.Spawn(function()
if player.serverUserData.MovementStateMachime then
player.serverUserData.MovementStateMachime:ChangeState("Walk")
end
end, SLIDING_DURATION)
player.groundFriction = SLIDING_FRICTION
player.brakingDecelerationWalking = SLIDING_BRAKING
player.movementControlMode = MovementControlMode.NONE
end
function NewState:Update(player)
if not Object.IsValid(player) then return end
StateBase.Update(self)
if not player.isCrouching and player.serverUserData.MovementStateMachime then
player.serverUserData.MovementStateMachime:ChangeState("Walk")
end
end
function NewState:Exit(player)
if self.ExitTask then
self.ExitTask:Cancel()
self.ExitTask = nil
end
if not Object.IsValid(player) then return end
StateBase.Exit(self)
player.groundFriction = 8
player.brakingDecelerationWalking = 640
player.movementControlMode = MovementControlMode.FACING_RELATIVE
local velocity = player:GetVelocity()
velocity.x = 0
velocity.y = 0
player:SetVelocity(velocity)
end
return NewState |
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ==========
PrgAmbientLife["Visitslide"] = function(unit, bld, obj, spot, slot_data, slot, slotname)
local spot_pos, wp, wait_pos, _x, _y, _x2, _y2, _z, _angle, slideOut
unit:PushDestructor(function(unit)
PrgChangeSpotFlags(bld, bld, spot, 0, 1, slotname, slot)
end)
spot_pos = bld:GetSpotLocPos(spot)
wp = bld:FindWaypointsInRange("Path", 50, spot_pos, "Nearest", unit)
wait_pos = wp and wp[#wp]
unit:Goto(wait_pos)
if band(PrgChangeSpotFlags(bld, bld, spot, 0, 0, slotname, slot), 1) == 1 then
_x, _y = bld:GetSpotLocPosXYZ(spot)
_x2, _y2 = unit:GetSpotLocPosXYZ(-1)
_x, _y, _z, _angle = OrientAxisToVectorXYZ(1, _x - _x2, _y - _y2, 0)
unit:SetAxisAngle(_x, _y, _z, _angle, 200)
unit:SetStateText("idle")
while band(PrgChangeSpotFlags(bld, bld, spot, 0, 0, slotname, slot), 1) == 1 do
Sleep(500)
if unit.visit_restart then unit:PopAndCallDestructor() return end
end
end
PrgChangeSpotFlags(bld, bld, spot, 1, 0, slotname, slot)
FollowWaypointPath(unit, wp, nil, 1) -- move [nil .. 1]
unit:PlayState("playSlideUp")
PrgChangeSpotFlags(bld, bld, spot, 0, 1, slotname, slot)
spot = nil
slideOut = bld:GetRandomSpot("Visitslideout")
_x, _y, _z = bld:GetSpotLocPosXYZ(slideOut)
unit:SetPos(_x, _y, _z, 0)
unit:SetAngle(bld:GetSpotAngle2D(slideOut), 0)
unit:PlayState("playSlideDown", 1, const.eDontCrossfade)
unit:PopAndCallDestructor()
end
|
--MoveCurve
--H_Tohka/HitDown_1 HitDown_1
return
{
filePath = "H_Tohka/HitDown_1",
startTime = Fixed64(0) --[[0]],
startRealTime = Fixed64(0) --[[0]],
endTime = Fixed64(23068672) --[[22]],
endRealTime = Fixed64(346031) --[[0.33]],
isZoom = true,
isCompensate = false,
curve = {
[1] = {
time = 0 --[[0]],
value = 0 --[[0]],
inTangent = 2097152 --[[2]],
outTangent = 2097152 --[[2]],
},
[2] = {
time = 1048576 --[[1]],
value = 1048576 --[[1]],
inTangent = 0 --[[0]],
outTangent = 0 --[[0]],
},
},
} |
local crypto_shorthash_keygen_sig = [[
void %s(unsigned char *)
]]
local crypto_shorthash_sig = [[
int %s(unsigned char *,
const unsigned char *,
unsigned long long,
const unsigned char *)
]]
local signatures = {
['crypto_shorthash_keygen'] = crypto_shorthash_keygen_sig,
['crypto_shorthash'] = crypto_shorthash_sig,
['crypto_shorthash_siphashx24'] = crypto_shorthash_sig,
}
return signatures
|
--- === ConfigWatcher ===
---
--- Reload the environment when .lua files in ~/.hammerspoon are modified.
local PathWatcher = require("hs.pathwatcher")
local Settings = require("hs.settings")
local hs = hs
local obj = {}
obj.__index = obj
obj.name = "ConfigWatcher"
obj.version = "1.0"
obj.author = "roeybiran <roeybiran@icloud.com>"
obj.homepage = "https://github.com/Hammerspoon/Spoons"
obj.license = "MIT - https://opensource.org/licenses/MIT"
local pathWatcher = nil
local configWatcherActiveKey = "RBConfigWatcherActive"
local function patchWatcherCallbackFn(files, flagTables)
local doReload = false
for i, file in pairs(files) do
if file:sub(-4) == ".lua" then
if flagTables[i].itemModified or flagTables[i].itemCreated or flagTables[i].itemRenamed then
doReload = true
break
end
end
end
if doReload then
if Settings.get(configWatcherActiveKey) then
hs.reload()
end
end
end
--- ConfigWatcher.toggle()
--- Method
--- Toggles the module.
function obj.toggle()
if pathWatcher then
obj.stop()
else
obj.start()
end
end
--- ConfigWatcher.stop()
--- Method
--- Stops the module.
function obj.stop()
Settings.set(configWatcherActiveKey, false)
pathWatcher:stop()
pathWatcher = nil
end
--- ConfigWatcher.start()
--- Method
--- Starts the module.
function obj.start()
Settings.set(configWatcherActiveKey, true)
if not pathWatcher then
obj.init()
end
pathWatcher:start()
end
--- ConfigWatcher.isActive()
--- Method
---
--- Returns:
--- * A boolean, true if the module is active, otherwise false
function obj.isActive()
return pathWatcher ~= nil
end
function obj.init()
pathWatcher = PathWatcher.new(".", patchWatcherCallbackFn)
end
return obj
|
-- TipScaner.lua
-- @Author : Dencer (tdaddon@163.com)
-- @Link : https://dengsir.github.io
-- @Date : 5/22/2020, 9:31:04 AM
---@type ns
local ns = select(2, ...)
---@type GameTooltip
local TipScaner = CreateFrame('GameTooltip')
ns.TipScaner = TipScaner
---@type FontString[]
local LFonts, RFonts = {}, {}
for i = 1, 40 do
LFonts[i], RFonts[i] = TipScaner:CreateFontString(), TipScaner:CreateFontString()
LFonts[i]:SetFontObject('GameFontNormal')
RFonts[i]:SetFontObject('GameFontNormal')
TipScaner:AddFontStrings(LFonts[i], RFonts[i])
end
function TipScaner:Clear()
self:ClearLines()
if not self:IsOwned(WorldFrame) then
self:SetOwner(WorldFrame, 'ANCHOR_NONE')
end
end
TipScaner.L = LFonts
TipScaner.R = RFonts
|
object_building_player_city_cityhall_tatooine_02 = object_building_player_city_shared_cityhall_tatooine_02:new {
}
ObjectTemplates:addTemplate(object_building_player_city_cityhall_tatooine_02, "object/building/player/city/cityhall_tatooine_02.iff")
|
local assert = assert
local buffer = require 'buffer'
local read_buf = buffer.read
local M = {}
local function read_struct(buf, info, fmt)
local res = read_buf(buf, assert(fmt or info.fmt))
assert(# res == # info)
local r = {}
for i, v in ipairs(info) do r[v] = res[i] end
return r
end
M.read_buf = read_buf
M.read_struct = read_struct
function M.read_array(buf, offset, size, num, info, fmt)
offset = offset - size
local fmt = '+%d %s'
local r = {}
for i = 1, num do
r[i] = read_struct(buf, info, fmt:format(offset + i * size, info.fmt))
end
return r
end
return M
|
------------------- ABOUT ----------------------
--
-- This is the first stop of hero's journey.
-- Here he'll get fuels to continue traveling.
-- However, the PAotH allies of the hero have
-- been taken hostages by professor Hogevil.
-- So hero has to get whatever available equipement
-- there is and rescue them.
HedgewarsScriptLoad("/Scripts/Locale.lua")
HedgewarsScriptLoad("/Scripts/Animate.lua")
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
----------------- VARIABLES --------------------
-- globals
local campaignName = loc("A Space Adventure")
local missionName = loc("The first stop")
local weaponsAcquired = false
local battleZoneReached = false
local checkPointReached = 1 -- 1 is start of the game
local afterDialog02 = false
local gameOver = false
local minionsDead = false
-- dialogs
local dialog01 = {}
local dialog02 = {}
local dialog03 = {}
local dialog04 = {}
local dialog05 = {}
local dialog06 = {}
-- mission objectives
local goals = {
[dialog01] = {missionName, loc("Getting ready"), loc("Go to the upper platform and get the weapons in the crates!"), 1, 4500},
[dialog02] = {missionName, loc("Prepare to fight"), loc("Go down and save these PAotH hogs!"), 1, 5000},
[dialog03] = {missionName, loc("The fight begins!"), loc("Neutralize your enemies and be careful!"), 1, 5000},
[dialog04] = {missionName, loc("The fight begins!"), loc("Neutralize your enemies and be careful!"), 1, 5000}
}
-- crates
local weaponsY = 100
local bazookaX = 70
local parachuteX = 110
local grenadeX = 160
local deserteagleX = 200
-- hogs
local hero = {}
local paoth1 = {}
local paoth2 = {}
local paoth3 = {}
local paoth4 = {}
local professor = {}
local minion1 = {}
local minion2 = {}
local minion3 = {}
local minion4 = {}
-- teams
local teamA = {}
local teamB = {}
local teamC = {}
local teamD = {}
-- hedgehogs values
hero.name = loc("Hog Solo")
hero.x = 1380
hero.y = 1750
hero.dead = false
paoth1.name = loc("Joe")
paoth1.x = 1430
paoth1.y = 1750
paoth2.name = loc("Bruce")
paoth2.x = 3760
paoth2.y = 1800
paoth3.name = loc("Helena")
paoth3.x = 3800
paoth3.y = 1800
paoth4.name = loc("Boris")
paoth4.x = 3860
paoth4.y = 1800
professor.name = loc("Prof. Hogevil")
professor.x = 3800
professor.y = 1600
professor.dead = false
professor.health = 120
minion1.name = loc("Minion")
minion1.x = 2460
minion1.y = 1450
minion2.name = loc("Minion")
minion2.x = 2450
minion2.y = 1900
minion3.name = loc("Minion")
minion3.x = 3500
minion3.y = 1750
teamA.name = loc("PAotH")
teamA.color = -6
teamB.name = loc("Minions")
teamB.color = -2
teamC.name = loc("Professor")
teamC.color = -2
teamD.name = loc("Hog Solo")
teamD.color = -6
-------------- LuaAPI EVENT HANDLERS ------------------
function onGameInit()
Seed = 1
GameFlags = gfSolidLand + gfDisableWind
TurnTime = 25000
CaseFreq = 0
MinesNum = 0
MinesTime = 3000
Explosives = 0
HealthDecrease = 0
WaterRise = 0
Map = "moon01_map"
Theme = "Cheese" -- Because ofc moon is made of cheese :)
-- Hero
teamD.name = AddMissionTeam(teamD.color)
if tonumber(GetCampaignVar("HeroHealth")) then
hero.gear = AddMissionHog(tonumber(GetCampaignVar("HeroHealth")))
else
hero.gear = AddMissionHog(100)
end
hero.name = GetHogName(hero.gear)
AnimSetGearPosition(hero.gear, hero.x, hero.y)
-- PAotH
teamA.name = AddTeam(teamA.name, teamA.color, "Earth", "Island", "Default_qau", "cm_galaxy")
SetTeamPassive(teamA.name, true)
paoth1.gear = AddHog(paoth1.name, 0, 100, "scif_2001O")
AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
HogTurnLeft(paoth1.gear, true)
paoth2.gear = AddHog(paoth2.name, 0, 100, "scif_2001Y")
AnimSetGearPosition(paoth2.gear, paoth2.x, paoth2.y)
HogTurnLeft(paoth2.gear, true)
paoth3.gear = AddHog(paoth3.name, 0, 100, "hair_purple")
AnimSetGearPosition(paoth3.gear, paoth3.x, paoth3.y)
HogTurnLeft(paoth3.gear, true)
paoth4.gear = AddHog(paoth4.name, 0, 100, "scif_2001Y")
AnimSetGearPosition(paoth4.gear, paoth4.x, paoth4.y)
HogTurnLeft(paoth4.gear, true)
-- Professor
teamC.name = AddTeam(teamC.name, teamC.color, "star", "Island", "Default_qau", "cm_sine")
SetTeamPassive(teamC.name, true)
professor.gear = AddHog(professor.name, 0, professor.health, "tophats")
AnimSetGearPosition(professor.gear, professor.x, professor.y)
HogTurnLeft(professor.gear, true)
-- Minions
teamB.name = AddTeam(teamB.name, teamB.color, "eyecross", "Island", "Default_qau", "cm_sine")
minion1.gear = AddHog(minion1.name, 1, 50, "Gasmask")
AnimSetGearPosition(minion1.gear, minion1.x, minion1.y)
HogTurnLeft(minion1.gear, true)
minion2.gear = AddHog(minion2.name, 1, 50, "Gasmask")
AnimSetGearPosition(minion2.gear, minion2.x, minion2.y)
HogTurnLeft(minion2.gear, true)
minion3.gear = AddHog(minion3.name, 1, 50, "Gasmask")
AnimSetGearPosition(minion3.gear, minion3.x, minion3.y)
HogTurnLeft(minion3.gear, true)
-- get the check point
checkPointReached = initCheckpoint("moon01")
if checkPointReached == 1 then
-- Start of the game
elseif checkPointReached == 2 then
AnimSetGearPosition(hero.gear, parachuteX, weaponsY)
if GetHealth(hero.gear) + 5 > 100 then
SaveCampaignVar("HeroHealth", 100)
else
SaveCampaignVar("HeroHealth", GetHealth(hero.gear) + 5)
end
end
AnimInit(true)
AnimationSetup()
end
function onGameStart()
-- wait for the first turn to start
AnimWait(hero.gear, 3000)
FollowGear(hero.gear)
ShowMission(campaignName, missionName, string.format(loc("%s has to refuel the saucer."), hero.name)..
"|"..loc("Rescue the imprisoned PAotH team and get the fuel!"), 10, 0)
AddAmmo(minion1.gear, amDEagle, 10)
AddAmmo(minion2.gear, amDEagle, 10)
AddAmmo(minion3.gear, amDEagle, 10)
AddAmmo(minion1.gear, amBazooka, 2)
AddAmmo(minion2.gear, amBazooka, 2)
AddAmmo(minion3.gear, amBazooka, 2)
AddAmmo(minion1.gear, amGrenade, 2)
AddAmmo(minion2.gear, amGrenade, 2)
AddAmmo(minion3.gear, amGrenade, 2)
-- check for death has to go first
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
AddEvent(onProfessorDeath, {professor.gear}, professorDeath, {professor.gear}, 0)
AddEvent(onMinionsDeath, {professor.gear}, minionsDeath, {professor.gear}, 0)
AddEvent(onProfessorAndMinionsDeath, {professor.gear}, professorAndMinionsDeath, {professor.gear}, 0)
AddEvent(onProfessorHit, {professor.gear}, professorHit, {professor.gear}, 1)
if checkPointReached == 1 then
AddAmmo(hero.gear, amRope, 2)
AddAmmo(hero.gear, amSkip, 0)
SpawnSupplyCrate(bazookaX, weaponsY, amBazooka)
SpawnSupplyCrate(parachuteX, weaponsY, amParachute)
SpawnSupplyCrate(grenadeX, weaponsY, amGrenade)
SpawnSupplyCrate(deserteagleX, weaponsY, amDEagle)
AddEvent(onWeaponsPlatform, {hero.gear}, weaponsPlatform, {hero.gear}, 0)
EndTurn(true)
AddAnim(dialog01)
elseif checkPointReached == 2 then
AddAmmo(hero.gear, amBazooka, 3)
AddAmmo(hero.gear, amParachute, 1)
AddAmmo(hero.gear, amGrenade, 6)
AddAmmo(hero.gear, amDEagle, 4)
SetWind(60)
GameFlags = bor(GameFlags,gfDisableWind)
weaponsAcquired = true
afterDialog02 = true
EndTurn(true)
AddAnim(dialog02)
end
-- this event check goes here to be executed after the onWeaponsPlatform check
AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0)
SendHealthStatsOff()
end
function onAmmoStoreInit()
SetAmmo(amBazooka, 0, 0, 0, 3)
SetAmmo(amParachute, 0, 0, 0, 1)
SetAmmo(amGrenade, 0, 0, 0, 6)
SetAmmo(amDEagle, 0, 0, 0, 4)
SetAmmo(amSkip, 9, 0, 0, 1)
end
function onGameTick()
AnimUnWait()
if ShowAnimation() == false then
return
end
ExecuteAfterAnimations()
CheckEvents()
if CurrentHedgehog ~= hero.gear and not battleZone then
EndTurn(true)
end
end
function onNewTurn()
-- rounds start if hero got his weapons or got near the enemies
if CurrentHedgehog == hero.gear then
if not weaponsAcquired and not battleZoneReached then
SetTurnTimeLeft(MAX_TURN_TIME)
end
elseif CurrentHedgehog == minion1.gear or CurrentHedgehog == minion2.gear or CurrentHedgehog == minion3.gear then
if not battleZoneReached then
EndTurn(true)
elseif weaponsAcquired and not battleZoneReached and afterDialog02 then
battleZone(hero.gear)
end
elseif CurrentHedgehog == professor.gear then
if weaponsAcquired and not battleZoneReached and afterDialog02 then
battleZone(hero.gear)
else
EndTurn(true)
end
end
if minionsDead and (not (professor.dead or GetHealth(professor.gear) == nil or GetHealth(professor.gear) == 0)) then
FollowGear(professor.gear)
end
end
function onPrecise()
if GameTime > 3000 then
SetAnimSkip(true)
end
end
function onGearDelete(gear)
if gear == hero.gear then
hero.dead = true
elseif gear == professor.gear then
professor.dead = true
end
end
-------------- EVENTS ------------------
function onWeaponsPlatform(gear)
if not hero.dead and (GetAmmoCount(hero.gear, amBazooka) > 0 or GetAmmoCount(hero.gear, amParachute) > 0 or
GetAmmoCount(hero.gear, amGrenade) > 0 or GetAmmoCount(hero.gear, amDEagle) > 0) and StoppedGear(hero.gear) then
return true
end
return false
end
function onHeroDeath(gear)
if hero.dead then
return true
end
return false
end
function onBattleZone(gear)
if not battleZoneReached and not hero.dead and StoppedGear(gear) and
(GetX(gear) > 1900 or (weaponsAcquired and GetY(gear) > 1200)) then
return true
end
return false
end
function onProfessorHit(gear)
if GetHealth(gear) then
if CurrentHedgehog ~= hero.gear and GetHealth(gear) < professor.health then
professor.health = GetHealth(gear)
return true
elseif GetHealth(gear) < professor.health then
professor.health = GetHealth(gear)
end
end
return false
end
function onProfessorDeath(gear)
if professor.dead then
return true
end
return false
end
function onMinionsDeath(gear)
if not (GetHealth(minion1.gear) or GetHealth(minion2.gear) or GetHealth(minion3.gear)) then
return true
end
return false
end
function onProfessorAndMinionsDeath(gear)
if professor.dead and (not (GetHealth(minion1.gear) or GetHealth(minion2.gear) or GetHealth(minion3.gear))) then
return true
end
return false
end
-------------- ACTIONS ------------------
function weaponsPlatform(gear)
if not battleZoneReached then
-- Player entered weapons platform before entering battle zone.
-- Checkpoint and dialog!
saveCheckpoint("2")
SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
EndTurn(true)
weaponsAcquired = true
SetWind(60)
GameFlags = bor(GameFlags,gfDisableWind)
AddAmmo(hero.gear, amRope, 0)
AddAmmo(hero.gear, amSkip, 100)
if GetX(hero.gear) < 1900 then
AddAnim(dialog02)
end
end
-- The player may screw up by going into the battle zone too early (dialog03).
-- In that case, the player is punished for this stupid move (no checkpoint),
-- but it is still theoretically possible to win by going for the weapons
-- very fast.
end
function heroDeath(gear)
SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name))
SendStat(siCustomAchievement, loc("You have to get the weapons and rescue the PAotH researchers."))
sendSimpleTeamRankings({teamC.name, teamB.name, teamD.name, teamA.name})
EndGame()
end
function battleZone(gear)
battleZoneReached = true
AddAmmo(hero.gear, amSkip, 100)
EndTurn(true)
if weaponsAcquired then
AddAnim(dialog04)
else
AddAnim(dialog03)
end
end
function professorHit(gear)
if currentHedgehog ~= hero.gear then
AnimSay(professor.gear,loc("Don't hit me, you fools!"), SAY_SHOUT, 2000)
end
end
function victory()
AnimCaption(hero.gear, loc("Congrats! You won!"), 6000)
saveCompletedStatus(1)
SendStat(siGameResult, string.format(loc("%s wins, congratulations!"), hero.name))
sendSimpleTeamRankings({teamD.name, teamA.name, teamC.name, teamB.name})
SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
resetCheckpoint() -- reset this mission
gameOver = true
EndGame()
end
function professorAndMinionsDeath(gear)
if gameOver then return end
if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
SendStat(siCustomAchievement, loc("You have eliminated Professor Hogevil."))
SendStat(siCustomAchievement, loc("You have eliminated the evil minions."))
SaveCampaignVar("ProfDiedOnMoon", "1")
victory()
end
function professorDeath(gear)
if gameOver then return end
if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
local m1h = GetHealth(minion1.gear)
local m2h = GetHealth(minion2.gear)
local m3h = GetHealth(minion3.gear)
if m1h == 0 or m2h == 0 or m3h == 0 then return end
if m1h and m1h > 0 and StoppedGear(minion1.gear) then
Dialog06Setup(minion1.gear)
elseif m2h and m2h > 0 and StoppedGear(minion2.gear) then
Dialog06ASetup(minion2.gear)
elseif m3h and m3h > 0 and StoppedGear(minion3.gear) then
Dialog06Setup(minion3.gear)
end
AddAnim(dialog06)
end
function afterDialog06()
if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
EndTurn(true)
SendStat(siCustomAchievement, loc("You have eliminated Professor Hogevil."))
SendStat(siCustomAchievement, loc("You drove the minions away."))
SaveCampaignVar("ProfDiedOnMoon", "1")
victory()
end
function afterDialog05()
if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
EndTurn(true)
HideHog(professor.gear)
SendStat(siCustomAchievement, loc("You have eliminated the evil minions."))
SendStat(siCustomAchievement, loc("You drove Professor Hogevil away."))
SaveCampaignVar("ProfDiedOnMoon", "0")
victory()
end
function minionsDeath(gear)
minionsDead = true
if professor.dead or GetHealth(professor.gear) == nil or GetHealth(professor.gear) == 0 then return end
if gameOver then return end
if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return end
SetTeamPassive(teamC.name, false)
AddAnim(dialog05)
end
-------------- ANIMATIONS ------------------
function Skipanim(anim)
if goals[anim] ~= nil then
ShowMission(unpack(goals[anim]))
end
if anim == dialog01 then
AnimSwitchHog(hero.gear)
elseif anim == dialog02 then
setAfterDialog02()
AnimSwitchHog(hero.gear)
elseif anim == dialog03 or anim == dialog04 then
startCombat()
elseif anim == dialog05 then
runaway(professor.gear)
afterDialog05()
elseif anim == dialog06 then
runaway(minion1.gear)
runaway(minion2.gear)
runaway(minion3.gear)
afterDialog06()
end
end
function AnimationSetup()
-- DIALOG 01 - Start, welcome to moon
AddSkipFunction(dialog01, Skipanim, {dialog01})
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near a PAotH base on the moon ..."), 4000}})
table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, string.format(loc("Hey, %s! Finally you have come!"), hero.name), SAY_SAY, 2000}})
table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("It seems that Professor Hogevil has prepared for your arrival!"), SAY_SAY, 4000}})
table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("He has captured the rest of the PAotH team and awaits to capture you!"), SAY_SAY, 5000}})
table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("We have to hurry! Are you armed?"), SAY_SAY, 4300}})
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 450}})
table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("No, I am afraid I had to travel light."), SAY_SAY, 2500}})
table.insert(dialog01, {func = AnimWait, args = {paoth1.gear, 3200}})
table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Okay, then you have to go and take some of the weapons we have hidden in case of an emergency!"), SAY_SAY, 7000}})
table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("They are up there! Take this rope and hurry!"), SAY_SAY, 7000}})
table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm, okay ..."), SAY_SAY, 2500}})
table.insert(dialog01, {func = ShowMission, args = goals[dialog01]})
table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
-- DIALOG 02 - To the weapons platform
AddSkipFunction(dialog02, Skipanim, {dialog02})
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 100}})
table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Checkpoint reached!"), 4000}})
table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I've made it! Yeah!"), SAY_SHOUT, 4000}})
table.insert(dialog02, {func = AnimSay, args = {paoth1.gear, loc("Nice! Now hurry and get down! You have to rescue my friends!"), SAY_SHOUT, 7000}})
table.insert(dialog02, {func = setAfterDialog02, args = {}})
table.insert(dialog02, {func = ShowMission, args = goals[dialog02]})
table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
-- DIALOG 03 - Hero spotted and has no weapons
AddSkipFunction(dialog03, Skipanim, {dialog03})
table.insert(dialog03, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}})
table.insert(dialog03, {func = AnimSay, args = {minion1.gear, loc("Look, boss! There is the target!"), SAY_SHOUT, 4000}})
table.insert(dialog03, {func = AnimSay, args = {professor.gear, loc("Prepare for battle!"), SAY_SHOUT, 4000}})
table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Oops, I've been spotted and I have no weapons! I am doomed!"), SAY_THINK, 4000}})
table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
table.insert(dialog03, {func = startCombat, args = {hero.gear}})
-- DIALOG 04 - Hero spotted and *HAS* weapons
AddSkipFunction(dialog04, Skipanim, {dialog04})
table.insert(dialog04, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}})
table.insert(dialog04, {func = AnimSay, args = {minion1.gear, loc("Look, boss! There is the target!"), SAY_SHOUT, 4000}})
table.insert(dialog04, {func = AnimSay, args = {professor.gear, loc("Prepare for battle!"), SAY_SHOUT, 4000}})
table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Here we go!"), SAY_THINK, 4000}})
table.insert(dialog04, {func = ShowMission, args = goals[dialog04]})
table.insert(dialog04, {func = startCombat, args = {hero.gear}})
-- DIALOG 05 - All minions dead
AddSkipFunction(dialog05, Skipanim, {dialog05})
table.insert(dialog05, {func = AnimWait, args = {professor.gear, 1500}})
table.insert(dialog05, {func = AnimSay, args = {professor.gear, loc("I may lost this battle, but I haven't lost the war yet!"), SAY_SHOUT, 5000}})
table.insert(dialog05, {func = runaway, args = {professor.gear}})
table.insert(dialog05, {func = afterDialog05, args = {professor.gear}})
end
function Dialog06Setup(livingMinion)
-- DIALOG 06 - Professor dead
AddSkipFunction(dialog06, Skipanim, {dialog06})
table.insert(dialog06, {func = AnimWait, args = {livingMinion, 1500}})
table.insert(dialog06, {func = AnimSay, args = {livingMinion, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 3000}})
table.insert(dialog06, {func = runaway, args = {minion1.gear}})
table.insert(dialog06, {func = runaway, args = {minion2.gear}})
table.insert(dialog06, {func = runaway, args = {minion3.gear}})
table.insert(dialog06, {func = afterDialog06, args = {livingMinion}})
end
function runaway(gear)
if GetHealth(gear) then
AddVisualGear(GetX(gear)-5, GetY(gear)-5, vgtSmoke, 0, false)
AddVisualGear(GetX(gear)+5, GetY(gear)+5, vgtSmoke, 0, false)
AddVisualGear(GetX(gear)-5, GetY(gear)+5, vgtSmoke, 0, false)
AddVisualGear(GetX(gear)+5, GetY(gear)-5, vgtSmoke, 0, false)
SetState(gear, bor(GetState(gear), gstInvisible))
end
end
------------------- custom "animation" functions --------------------------
function startCombat()
-- use this so minion3 will gain control
AnimSwitchHog(minion3.gear)
EndTurn(true)
end
function setAfterDialog02()
afterDialog02 = true
end
|
---
-- Module containing some general utility functions used in many places in Kong.
--
-- NOTE: Before implementing a function here, consider if it will be used in many places
-- across Kong. If not, a local function in the appropriate module is prefered.
--
-- @copyright Copyright 2016 Mashape Inc. All rights reserved.
-- @license [Apache 2.0](https://opensource.org/licenses/Apache-2.0)
-- @module kong.tools.utils
local ffi = require "ffi"
local uuid = require "resty.jit-uuid"
local C = ffi.C
local ffi_new = ffi.new
local ffi_str = ffi.string
local fmt = string.format
local type = type
local pairs = pairs
local ipairs = ipairs
local re_find = ngx.re.find
local tostring = tostring
local sort = table.sort
local concat = table.concat
local insert = table.insert
local find = string.find
local gsub = string.gsub
ffi.cdef[[
typedef unsigned char u_char;
int gethostname(char *name, size_t len);
int RAND_bytes(u_char *buf, int num);
unsigned long ERR_get_error(void);
void ERR_load_crypto_strings(void);
void ERR_free_strings(void);
const char *ERR_reason_error_string(unsigned long e);
]]
local _M = {}
--- Retrieves the hostname of the local machine
-- @return string The hostname
function _M.get_hostname()
local result
local SIZE = 128
local buf = ffi_new("unsigned char[?]", SIZE)
local res = C.gethostname(buf, SIZE)
if res == 0 then
local hostname = ffi_str(buf, SIZE)
result = gsub(hostname, "%z+$", "")
else
local f = io.popen("/bin/hostname")
local hostname = f:read("*a") or ""
f:close()
result = gsub(hostname, "\n$", "")
end
return result
end
do
local pl_utils = require "pl.utils"
local _system_infos
function _M.get_system_infos()
if _system_infos then
return _system_infos
end
_system_infos = {
hostname = _M.get_hostname()
}
local ok, _, stdout = pl_utils.executeex("getconf _NPROCESSORS_ONLN")
if ok then
_system_infos.cores = tonumber(stdout:sub(1, -2))
end
ok, _, stdout = pl_utils.executeex("uname -a")
if ok then
_system_infos.uname = stdout:gsub(";", ","):sub(1, -2)
end
return _system_infos
end
end
do
local bytes_buf_t = ffi.typeof "char[?]"
function _M.get_rand_bytes(n_bytes)
local buf = ffi_new(bytes_buf_t, n_bytes)
if C.RAND_bytes(buf, n_bytes) == 0 then
-- get error code
local err_code = C.ERR_get_error()
if err_code == 0 then
return nil, "could not get SSL error code from the queue"
end
-- get human-readable error string
C.ERR_load_crypto_strings()
local err = C.ERR_reason_error_string(err_code)
C.ERR_free_strings()
return nil, "could not get random bytes (" ..
"reason:" .. ffi_str(err) .. ") "
end
return ffi_str(buf, n_bytes)
end
end
local v4_uuid = uuid.generate_v4
--- Generates a v4 uuid.
-- @function uuid
-- @return string with uuid
_M.uuid = uuid.generate_v4
--- Generates a random unique string
-- @return string The random string (a uuid without hyphens)
function _M.random_string()
return v4_uuid():gsub("-", "")
end
local uuid_regex = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
function _M.is_valid_uuid(str)
if type(str) ~= 'string' or #str ~= 36 then return false end
return re_find(str, uuid_regex, 'ioj') ~= nil
end
-- function below is more acurate, but invalidates previously accepted uuids and hence causes
-- trouble with existing data during migrations.
-- see: https://github.com/thibaultcha/lua-resty-jit-uuid/issues/8
-- function _M.is_valid_uuid(str)
-- return str == "00000000-0000-0000-0000-000000000000" or uuid.is_valid(str)
--end
do
local pl_stringx = require "pl.stringx"
_M.split = pl_stringx.split
_M.strip = pl_stringx.strip
end
do
local url = require "socket.url"
--- URL escape and format key and value
-- values should be already decoded or the `raw` option should be passed to prevent double-encoding
local function encode_args_value(key, value, raw)
if not raw then
key = url.escape(key)
end
if value ~= nil then
if not raw then
value = url.escape(value)
end
return fmt("%s=%s", key, value)
else
return key
end
end
--- Encode a Lua table to a querystring
-- Tries to mimic ngx_lua's `ngx.encode_args`, but also percent-encode querystring values.
-- Supports multi-value query args, boolean values.
-- It also supports encoding for bodies (only because it is used in http_client for specs.
-- @TODO drop and use `ngx.encode_args` once it implements percent-encoding.
-- @see https://github.com/Mashape/kong/issues/749
-- @param[type=table] args A key/value table containing the query args to encode.
-- @param[type=boolean] raw If true, will not percent-encode any key/value and will ignore special boolean rules.
-- @treturn string A valid querystring (without the prefixing '?')
function _M.encode_args(args, raw)
local query = {}
local keys = {}
for k in pairs(args) do
keys[#keys+1] = k
end
sort(keys)
for _, key in ipairs(keys) do
local value = args[key]
if type(value) == "table" then
for _, sub_value in ipairs(value) do
query[#query+1] = encode_args_value(key, sub_value, raw)
end
elseif value == true then
query[#query+1] = encode_args_value(key, raw and true or nil, raw)
elseif value ~= false and value ~= nil or raw then
value = tostring(value)
if value ~= "" then
query[#query+1] = encode_args_value(key, value, raw)
elseif raw or value == "" then
query[#query+1] = key
end
end
end
return concat(query, "&")
end
end
--- Checks whether a request is https or was originally https (but already terminated).
-- It will check in the current request (global `ngx` table). If the header `X-Forwarded-Proto` exists
-- with value `https` then it will also be considered as an https connection.
-- @param allow_terminated if truthy, the `X-Forwarded-Proto` header will be checked as well.
-- @return boolean or nil+error in case the header exists multiple times
_M.check_https = function(allow_terminated)
if ngx.var.scheme:lower() == "https" then
return true
end
if not allow_terminated then
return false
end
local forwarded_proto_header = ngx.req.get_headers()["x-forwarded-proto"]
if tostring(forwarded_proto_header):lower() == "https" then
return true
end
if type(forwarded_proto_header) == "table" then
-- we could use the first entry (lower security), or check the contents of each of them (slow). So for now defensive, and error
-- out on multiple entries for the x-forwarded-proto header.
return nil, "Only one X-Forwarded-Proto header allowed"
end
return false
end
--- Merges two table together.
-- A new table is created with a non-recursive copy of the provided tables
-- @param t1 The first table
-- @param t2 The second table
-- @return The (new) merged table
function _M.table_merge(t1, t2)
if not t1 then t1 = {} end
if not t2 then t2 = {} end
local res = {}
for k,v in pairs(t1) do res[k] = v end
for k,v in pairs(t2) do res[k] = v end
return res
end
--- Checks if a value exists in a table.
-- @param arr The table to use
-- @param val The value to check
-- @return Returns `true` if the table contains the value, `false` otherwise
function _M.table_contains(arr, val)
if arr then
for _, v in pairs(arr) do
if v == val then
return true
end
end
end
return false
end
--- Checks if a table is an array and not an associative array.
-- *** NOTE *** string-keys containing integers are considered valid array entries!
-- @param t The table to check
-- @return Returns `true` if the table is an array, `false` otherwise
function _M.is_array(t)
if type(t) ~= "table" then return false end
local i = 0
for _ in pairs(t) do
i = i + 1
if t[i] == nil and t[tostring(i)] == nil then return false end
end
return true
end
--- Deep copies a table into a new table.
-- Tables used as keys are also deep copied, as are metatables
-- @param orig The table to copy
-- @return Returns a copy of the input table
function _M.deep_copy(orig)
local copy
if type(orig) == "table" then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[_M.deep_copy(orig_key)] = _M.deep_copy(orig_value)
end
setmetatable(copy, _M.deep_copy(getmetatable(orig)))
else
copy = orig
end
return copy
end
function _M.shallow_copy(orig)
local orig_type = type(orig)
local copy
if orig_type == "table" then
copy = {}
for orig_key, orig_value in pairs(orig) do
copy[orig_key] = orig_value
end
else -- number, string, boolean, etc
copy = orig
end
return copy
end
local err_list_mt = {}
--- Concatenates lists into a new table.
function _M.concat(...)
local result = {}
local insert = table.insert
for _, t in ipairs({...}) do
for _, v in ipairs(t) do insert(result, v) end
end
return result
end
--- Add an error message to a key/value table.
-- If the key already exists, a sub table is created with the original and the new value.
-- @param errors (Optional) Table to attach the error to. If `nil`, the table will be created.
-- @param k Key on which to insert the error in the `errors` table.
-- @param v Value of the error
-- @return The `errors` table with the new error inserted.
function _M.add_error(errors, k, v)
if not errors then errors = {} end
if errors and errors[k] then
if getmetatable(errors[k]) ~= err_list_mt then
errors[k] = setmetatable({errors[k]}, err_list_mt)
end
insert(errors[k], v)
else
errors[k] = v
end
return errors
end
--- Try to load a module.
-- Will not throw an error if the module was not found, but will throw an error if the
-- loading failed for another reason (eg: syntax error).
-- @param module_name Path of the module to load (ex: kong.plugins.keyauth.api).
-- @return success A boolean indicating wether the module was found.
-- @return module The retrieved module, or the error in case of a failure
function _M.load_module_if_exists(module_name)
local status, res = pcall(require, module_name)
if status then
return true, res
-- Here we match any character because if a module has a dash '-' in its name, we would need to escape it.
elseif type(res) == "string" and find(res, "module '"..module_name.."' not found", nil, true) then
return false, res
else
error(res)
end
end
local find = string.find
local tostring = tostring
-- Numbers taken from table 3-7 in www.unicode.org/versions/Unicode6.2.0/UnicodeStandard-6.2.pdf
-- find-based solution inspired by http://notebook.kulchenko.com/programming/fixing-malformed-utf8-in-lua
function _M.validate_utf8(val)
local str = tostring(val)
local i, len = 1, #str
while i <= len do
if i == find(str, "[%z\1-\127]", i) then i = i + 1
elseif i == find(str, "[\194-\223][\123-\191]", i) then i = i + 2
elseif i == find(str, "\224[\160-\191][\128-\191]", i)
or i == find(str, "[\225-\236][\128-\191][\128-\191]", i)
or i == find(str, "\237[\128-\159][\128-\191]", i)
or i == find(str, "[\238-\239][\128-\191][\128-\191]", i) then i = i + 3
elseif i == find(str, "\240[\144-\191][\128-\191][\128-\191]", i)
or i == find(str, "[\241-\243][\128-\191][\128-\191][\128-\191]", i)
or i == find(str, "\244[\128-\143][\128-\191][\128-\191]", i) then i = i + 4
else
return false, i
end
end
return true
end
return _M
|
--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
-- The target value is a series of consecutive window lists or sub windows
local bVisibility = nil;
local nLevel = 1;
local aTargetPath = {};
function onInit()
for sWord in string.gmatch(target[1], "([%w_]+)") do
table.insert(aTargetPath, sWord);
end
if expand then
bVisibility = true;
elseif collapse then
bVisibility = false;
end
if togglelevel then
nLevel = tonumber(togglelevel[1]) or 0;
if nLevel < 1 then
nLevel = 1;
end
end
end
function onButtonPress()
applyTo(window[aTargetPath[1]], 1);
end
function applyTo(vTarget, nIndex)
if nIndex > nLevel then
vTarget.setVisible(bVisibility);
end
nIndex = nIndex + 1;
if nIndex > #aTargetPath then
return;
end
local sTargetType = type(vTarget);
if sTargetType == "windowlist" then
for _,wChild in pairs(vTarget.getWindows()) do
applyTo(wChild[aTargetPath[nIndex]], nIndex);
end
elseif sTargetType == "subwindow" then
applyTo(vTarget.subwindow[aTargetPath[nIndex]], nIndex);
end
end
|
return {
cURL = {
{
description = "cURL: Lua binding to libcurl",
homepage = "https://github.com/Lua-cURL",
license = "MIT/X11",
name = "cURL",
require = {
lcurl = "0.3.1-103",
luajit = "2.0"
},
version = "0.3.1-103",
version_dir = "0_3_1+103"
}
},
clib_libcurl = {
{
description = "free and easy-to-use client-side URL transfer library",
homepage = "http://curl.haxx.se",
license = "MIT/X11-derived",
name = "clib_libcurl",
require = {
luajit = "2.0"
},
version = "7.42.1-3",
version_dir = "7_42_1+3"
}
},
lcurl = {
{
description = "cURL: Lua binding to libcurl",
homepage = "https://github.com/Lua-cURL",
license = "MIT/X11",
name = "lcurl",
require = {
cURL = "0.3.1-103",
clib_libcurl = "7",
luajit = "2.0"
},
version = "0.3.1-103",
version_dir = "0_3_1+103"
}
},
lfs = {
{
description = "luafilesystem : File System Library for the Lua Programming Language",
homepage = "http://keplerproject.github.io/luafilesystem",
license = "MIT/X11",
name = "lfs",
require = {
luajit = "2.0"
},
version = "1.6.3-203",
version_dir = "1_6_3+203"
}
},
luajit = {
{
description = "LuaJIT: Just-In-Time Compiler (JIT) for Lua",
homepage = "http://luajit.org/luajit.html",
license = "MIT",
name = "luajit",
require = {},
version = "2.1.head20151128",
version_dir = "2_1_head20151128"
}
},
pkg = {
{
description = "ULua package manager",
homepage = "http://ulua.io/pkg.html",
license = "MIT <http://opensource.org/licenses/MIT>",
name = "pkg",
require = {
cURL = "0.3.1",
lfs = "1.6.2",
luajit = "2.0",
serpent = "0.27"
},
version = "1.0.beta10",
version_dir = "1_0_beta10"
}
},
serpent = {
{
description = "serpent : Lua serializer and pretty printer",
homepage = "https://github.com/pkulchenko/serpent",
license = "MIT",
name = "serpent",
require = {
luajit = "2.0"
},
version = "0.28-103",
version_dir = "0_28+103"
}
}
} |
local AddPlayerPostInit = AddPlayerPostInit
local AddPrefabPostInit = AddPrefabPostInit
local AddPrefabPostInitAny = AddPrefabPostInitAny
local AddStategraphPostInit = AddStategraphPostInit
GLOBAL.setfenv(1, GLOBAL)
--------------------------------------------------------------------------------
-------------------------------- PLAYER COMMON ---------------------------------
--------------------------------------------------------------------------------
local function TryDescribe(base_str, descstrings, modifier)
return descstrings and (
type(descstrings) == "string" and base_str
or descstrings[modifier] and base_str.."."..modifier
or descstrings.GENERIC and base_str..".GENERIC"
)
end
local function TryCharStrings(inst, base_str, charstrings, modifier)
if charstrings then
base_str = base_str..".DESCRIBE."
local character = string.upper(inst.prefab)
return TryDescribe(base_str..character, charstrings.DESCRIBE[character], modifier)
or TryDescribe(base_str.."PLAYER", charstrings.DESCRIBE.PLAYER, modifier)
end
end
local function player_common_get_special_desc_fn(inst, viewer)
local modifier = inst.components.inspectable:GetStatus(viewer) or "GENERIC"
local character = string.upper(viewer.prefab)
local str = character
and TryCharStrings(inst, "CHARACTERS."..character, STRINGS.CHARACTERS[character], modifier)
or TryCharStrings(inst, "CHARACTERS.GENERIC", STRINGS.CHARACTERS.GENERIC, modifier)
local ret = {
strtype = "format",
content = str,
params = {inst:GetDisplayName()}
}
return EncodeStrCode(ret)
end
AddPlayerPostInit(function(inst)
if not TheWorld.ismastersim then return end
if inst.components.inspectable then
inst.components.inspectable.getspecialdescription = player_common_get_special_desc_fn
end
end)
--------------------------------------------------------------------------------
---------------------------------- SKELETONS -----------------------------------
--------------------------------------------------------------------------------
local function skeleton_getdesc(inst, viewer)
if inst.char and not viewer:HasTag("playerghost") then
local mod = GetGenderStrings(inst.char)
-- local desc = GetDescriptionCode(viewer, inst, mod)
local char = string.upper(inst.char)
local name = inst.playername or STRINGS.NAMES[char] and STRCODE_HEADER..".NAMES."..char
local params = {}
--no translations for player killer's name
if inst.pkname then
params = {name, inst.pkname}
return GetDescriptionCode(viewer, inst, mod, "format", params)
end
--permanent translations for death cause
if inst.cause == "unknown" then
inst.cause = "shenanigans"
elseif inst.cause == "moose" then
inst.cause = math.random() < .5 and "moose1" or "moose2"
end
--viewer based temp translations for death cause
local cause =
inst.cause == "nil"
and (viewer == "waxwell" and
"charlie" or
"darkness")
or inst.cause
local caus = string.upper(cause)
params = {name, STRCODE_HEADER .. "NAMES.".. (STRINGS.NAMES[caus] and caus or "SHENANIGANS")}
return GetDescriptionCode(viewer, inst, mod, "format", params)
end
end
AddPrefabPostInit("skeleton_player", function(inst)
if not TheWorld.ismastersim then return end
local SetSkeletonDescription = inst.SetSkeletonDescription
inst.SetSkeletonDescription = function(...)
SetSkeletonDescription(...)
inst.components.inspectable.getspecialdescription = skeleton_getdesc
end
local onload = inst.OnLoad
inst.OnLoad = function(...)
onload(...)
if inst.components.inspectable then
inst.components.inspectable.getspecialdescription = skeleton_getdesc
end
end
end)
--------------------------------------------------------------------------------
-------------------------------- SINGING SHELL ---------------------------------
--------------------------------------------------------------------------------
local NOTES =
{
"C",
"C#",
"D",
"D#",
"E",
"F",
"F#",
"G",
"G#",
"A",
"A#",
"B",
}
local function shell_getdescription(inst, viewer)
-- return subfmt(GetDescription(viewer, inst, "GENERIC"), {note = NOTES[inst.components.cyclable.step]})
return GetDescriptionCode(viewer, inst, "GENERIC", "subfmt", {note = NOTES[inst.components.cyclable.step]})
end
local shells = {
"singingshell_octave5",
"singingshell_octave4",
"singingshell_octave3",
}
local function shell_postinit(inst)
if not TheWorld.ismastersim then return end
inst.components.inspectable.descriptionfn = shell_getdescription
end
for _, prefab in ipairs(shells) do
AddPrefabPostInit(prefab, shell_postinit)
end
--------------------------------------------------------------------------------
--------------------------------- DEATH EVENT ----------------------------------
--------------------------------------------------------------------------------
-- local EventAnnouncer = require("widgets/eventannouncer")
require("widgets/eventannouncer")
function GetNewDeathAnnouncementString(theDead, source, pkname, sourceispet)
if not theDead or not source then return "" end
-- local message = ""
local msg_tab = {
strtype = "format",
content = {},
params = {}
}
if source and not theDead:HasTag("playerghost") then
if pkname ~= nil then
local petname = sourceispet and STRINGS.NAMES[string.upper(source)] or nil
if petname ~= nil then
msg_tab.content = {
"$%s ",
"UI.HUD.DEATH_ANNOUNCEMENT_1",
"$ ",
"UI.HUD.DEATH_PET_NAME",
}
msg_tab.params = {
theDead:GetDisplayName(),
STRCODE_HEADER .. "NAMES." .. string.upper(source)
}
-- theDead:GetDisplayName().." "..STRINGS.UI.HUD.DEATH_ANNOUNCEMENT_1.." "..string.format(STRINGS.UI.HUD.DEATH_PET_NAME, pkname, petname)
else
msg_tab.content = {
"$%s ",
"UI.HUD.DEATH_ANNOUNCEMENT_1",
"$ %s",
}
msg_tab.params = {
theDead:GetDisplayName(),
pkname
}
-- message = theDead:GetDisplayName().." "..STRINGS.UI.HUD.DEATH_ANNOUNCEMENT_1.." "..pkname
end
elseif table.contains(GetActiveCharacterList(), source) then
msg_tab.content = {
"$%s ",
"UI.HUD.DEATH_ANNOUNCEMENT_1",
"$ %s",
}
msg_tab.params = {
theDead:GetDisplayName(),
FirstToUpper(source)
}
-- message = theDead:GetDisplayName().." "..STRINGS.UI.HUD.DEATH_ANNOUNCEMENT_1.." "..FirstToUpper(source)
else
source = string.upper(source)
if source == "NIL" then
if theDead == "WAXWELL" then
source = "CHARLIE"
else
source = "DARKNESS"
end
elseif source == "UNKNOWN" then
source = "SHENANIGANS"
elseif source == "MOOSE" then
if math.random() < .5 then
source = "MOOSE1"
else
source = "MOOSE2"
end
end
msg_tab.content = {
"$%s ",
"UI.HUD.DEATH_ANNOUNCEMENT_1",
"$ %s",
}
msg_tab.params = {
theDead:GetDisplayName(),
STRCODE_HEADER .. "NAMES." .. (STRINGS.NAMES[source] and source or "SHENANIGANS")
}
-- source = source and STRINGS.NAMES[source] or STRINGS.NAMES.SHENANIGANS
-- message = theDead:GetDisplayName().." "..STRINGS.UI.HUD.DEATH_ANNOUNCEMENT_1.." "..source
end
if not theDead.ghostenabled then
table.insert(msg_tab.content, "$.")
-- message = message.."."
else
local gender = GetGenderStrings(theDead.prefab)
if STRINGS.UI.HUD["DEATH_ANNOUNCEMENT_2_"..gender] then
table.insert(msg_tab.content, "UI.HUD.DEATH_ANNOUNCEMENT_2_"..gender)
-- message = message..STRINGS.UI.HUD["DEATH_ANNOUNCEMENT_2_"..gender]
else
table.insert(msg_tab.content, "UI.HUD.DEATH_ANNOUNCEMENT_2_DEFAULT")
-- message = message..STRINGS.UI.HUD.DEATH_ANNOUNCEMENT_2_DEFAULT
end
end
else
local gender = GetGenderStrings(theDead.prefab)
if STRINGS.UI.HUD["GHOST_DEATH_ANNOUNCEMENT_"..gender] then
msg_tab.content = {
"$%s ",
"UI.HUD.GHOST_DEATH_ANNOUNCEMENT_" .. gender,
}
msg_tab.params = {
theDead:GetDisplayName()
}
-- message = theDead:GetDisplayName().." "..STRINGS.UI.HUD["GHOST_DEATH_ANNOUNCEMENT_"..gender]
else
msg_tab.content = {
"$%s ",
"UI.HUD.GHOST_DEATH_ANNOUNCEMENT_DEFAULT",
}
msg_tab.params = {
theDead:GetDisplayName()
}
-- message = theDead:GetDisplayName().." "..STRINGS.UI.HUD.GHOST_DEATH_ANNOUNCEMENT_DEFAULT
end
end
return EncodeStrCode(msg_tab)
end
local STRCODE_REVIERS = {}
STRCODE_REVIERS[STRINGS.NAMES.POCKETWATCH_REVIVE] = "NAMES.POCKETWATCH_REVIVE"
STRCODE_REVIERS[STRINGS.NAMES.POCKETWATCH_REVIVE_REVIVER] = "NAMES.POCKETWATCH_REVIVE_REVIVER"
STRCODE_REVIERS[STRINGS.NAMES.AMULET] = "NAMES.AMULET"
STRCODE_REVIERS[STRINGS.NAMES.RESURRECTIONSTONE] = "NAMES.RESURRECTIONSTONE"
STRCODE_REVIERS[STRINGS.NAMES.RESURRECTIONSTATUE] = "NAMES.RESURRECTIONSTATUE"
STRCODE_REVIERS[STRINGS.NAMES.MULTIPLAYER_PORTAL] = "NAMES.MULTIPLAYER_PORTAL"
STRCODE_REVIERS[STRINGS.NAMES.MULTIPLAYER_PORTAL_MOONROCK] = "NAMES.MULTIPLAYER_PORTAL_MOONROCK"
STRCODE_REVIERS[STRINGS.NAMES.MULTIPLAYER_PORTAL_MOONROCK_CONSTR_PLANS] = "NAMES.MULTIPLAYER_PORTAL_MOONROCK_CONSTR_PLANS"
function GetNewRezAnnouncementString(theRezzed, source)
if not theRezzed or not source then return "" end
local strcode_source = source == STRINGS.NAMES.SHENANIGANS and STRCODE_HEADER .. "NAMES.SHENANIGANS"
or STRCODE_REVIERS[source] and STRCODE_HEADER .. STRCODE_REVIERS[source]
or source
print("GetNewRezAnnouncementString", strcode_source)
-- local message = theRezzed:GetDisplayName().." "..STRINGS.UI.HUD.REZ_ANNOUNCEMENT.." "..source.."."
local msg_tab = {
strtype = "format",
content = {
"$%s ",
"UI.HUD.REZ_ANNOUNCEMENT",
"$ %s."
},
params = {
theRezzed:GetDisplayName(),
strcode_source
}
}
-- return message
return EncodeStrCode(msg_tab)
end
--------------------------------------------------------------------------------
--------------------------------- MOD OUTDATE ----------------------------------
--------------------------------------------------------------------------------
-- local Networking_ModOutOfDateAnnouncement = Networking_ModOutOfDateAnnouncement
-- function Networking_ModOutOfDateAnnouncement(mod)
-- local ret = {
-- strtype = "format",
-- content = IsRail() and "MODS.VERSIONING.OUT_OF_DATE_RAIL" or "MODS.VERSIONING.OUT_OF_DATE",
-- params = {
-- mod
-- }
-- }
-- Networking_Announcement(EncodeStrCode(ret), nil , "mod")
-- end
--------------------------------------------------------------------------------
---------------------------------- TERRARIUM -----------------------------------
--------------------------------------------------------------------------------
STRCODE_ANNOUNCE[STRINGS.EYEOFTERROR_CANCEL] = "EYEOFTERROR_CANCEL"
STRCODE_ANNOUNCE[STRINGS.EYEOFTERROR_COMING] = "EYEOFTERROR_COMING"
STRCODE_ANNOUNCE[STRINGS.TWINS_COMING] = "TWINS_COMING"
STRCODE_SUBFMT[STRINGS.EYEOFTERROR_TARGET] = "EYEOFTERROR_TARGET"
STRCODE_SUBFMT[STRINGS.TWINS_TARGET] = "TWINS_TARGET"
--------------------------------------------------------------------------------
--------------------------------- WAGSTAFF_NPC ---------------------------------
--------------------------------------------------------------------------------
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_START[1]] = "WAGSTAFF_NPC_START.1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_START[2]] = "WAGSTAFF_NPC_START.2"
-- table.insert(STRCODE_TALKER, "WAGSTAFF_NPC_MUMBLE_1.1")
-- table.insert(STRCODE_TALKER, "WAGSTAFF_NPC_MUMBLE_1.2")
-- table.insert(STRCODE_TALKER, "WAGSTAFF_NPC_MUMBLE_1.3")
-- table.insert(STRCODE_TALKER, "WAGSTAFF_NPC_MUMBLE_1.4")
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_THIS_WAY[1]] = "WAGSTAFF_NPC_THIS_WAY.1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_THIS_WAY[2]] = "WAGSTAFF_NPC_THIS_WAY.2"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_THIS_WAY[3]] = "WAGSTAFF_NPC_THIS_WAY.3"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_NO_WAY1[1]] = "WAGSTAFF_NPC_NO_WAY1.1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_NO_WAY2[1]] = "WAGSTAFF_NPC_NO_WAY2.1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_NO_WAY3[1]] = "WAGSTAFF_NPC_NO_WAY3.1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_NOT_THIS_TOOL[1]] = "WAGSTAFF_NPC_NOT_THIS_TOOL.1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_NOT_THIS_TOOL[2]] = "WAGSTAFF_NPC_NOT_THIS_TOOL.2"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_YES_THIS_TOOL[1]] = "WAGSTAFF_NPC_YES_THIS_TOOL.1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_YES_THIS_TOOL[2]] = "WAGSTAFF_NPC_YES_THIS_TOOL.2"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_TOO_BUSY[1]] = "WAGSTAFF_NPC_TOO_BUSY.1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_TOO_BUSY[2]] = "WAGSTAFF_NPC_TOO_BUSY.2"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_EXPERIMENT_DONE_1] = "WAGSTAFF_NPC_EXPERIMENT_DONE_1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_EXPERIMENT_DONE_2] = "WAGSTAFF_NPC_EXPERIMENT_DONE_2"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_EXPERIMENT_FAIL_1] = "WAGSTAFF_NPC_EXPERIMENT_FAIL_1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_EXPERIMENT_FAIL_2] = "WAGSTAFF_NPC_EXPERIMENT_FAIL_2"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_STORMPASS] = "WAGSTAFF_NPC_STORMPASS"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_MEETING] = "WAGSTAFF_NPC_MEETING"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_MEETING_2] = "WAGSTAFF_NPC_MEETING_2"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_MEETING_3] = "WAGSTAFF_NPC_MEETING_3"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_MEETING_4] = "WAGSTAFF_NPC_MEETING_4"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_MEETING_5] = "WAGSTAFF_NPC_MEETING_5"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_WANT_TOOL_1] = "WAGSTAFF_NPC_WANT_TOOL_1"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_WANT_TOOL_2] = "WAGSTAFF_NPC_WANT_TOOL_2"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_WANT_TOOL_3] = "WAGSTAFF_NPC_WANT_TOOL_3"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_WANT_TOOL_4] = "WAGSTAFF_NPC_WANT_TOOL_4"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_WANT_TOOL_5] = "WAGSTAFF_NPC_WANT_TOOL_5"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_CAPTURESTART] = "WAGSTAFF_NPC_CAPTURESTART"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_CAPTURESTOP] = "WAGSTAFF_NPC_CAPTURESTOP"
STRCODE_TALKER[STRINGS.WAGSTAFF_NPC_CAPTURESTOP2] = "WAGSTAFF_NPC_CAPTURESTOP2"
STRCODE_TALKER[STRINGS.WAGSTAFF_GOTTAGO1] = "WAGSTAFF_GOTTAGO1"
STRCODE_TALKER[STRINGS.WAGSTAFF_GOTTAGO2] = "WAGSTAFF_GOTTAGO2"
local function npc_strcodespeaker_postinit(inst)
local talker = inst.components.talker
if talker then
talker:MakeStringCodeSpeaker()
end
end
for _, prefab in ipairs({"wagstaff_npc", "wagstaff_npc_pstboss", "alterguardian_contained"}) do
AddPrefabPostInit(prefab, npc_strcodespeaker_postinit)
end
--------------------------------------------------------------------------------
--------------------------------- HERMIT_CRAB ----------------------------------
--------------------------------------------------------------------------------
AddPrefabPostInit("hermitcrab", npc_strcodespeaker_postinit)
STRCODE_TALKER[STRINGS.HERMITCRAB_TALK_ONPURCHASE.LOW[1]] = "HERMITCRAB_TALK_ONPURCHASE.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_TALK_ONPURCHASE.MED[1]] = "HERMITCRAB_TALK_ONPURCHASE.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_TALK_ONPURCHASE.HIGH[1]] = "HERMITCRAB_TALK_ONPURCHASE.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.PLANT_FLOWERS.LOW[1]] = "HERMITCRAB_COMPLAIN.PLANT_FLOWERS.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.PLANT_FLOWERS.MED[1]] = "HERMITCRAB_COMPLAIN.PLANT_FLOWERS.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.PLANT_FLOWERS.HIGH[1][1]] = "HERMITCRAB_COMPLAIN.PLANT_FLOWERS.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.PLANT_FLOWERS.HIGH[1][2]] = "HERMITCRAB_COMPLAIN.PLANT_FLOWERS.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.REMOVE_JUNK.LOW[1]] = "HERMITCRAB_COMPLAIN.REMOVE_JUNK.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.REMOVE_JUNK.MED[1]] = "HERMITCRAB_COMPLAIN.REMOVE_JUNK.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.REMOVE_JUNK.HIGH[1]] = "HERMITCRAB_COMPLAIN.REMOVE_JUNK.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.PLANT_BERRIES.LOW[1]] = "HERMITCRAB_COMPLAIN.PLANT_BERRIES.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.PLANT_BERRIES.MED[1]] = "HERMITCRAB_COMPLAIN.PLANT_BERRIES.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.PLANT_BERRIES.HIGH[1][1]] = "HERMITCRAB_COMPLAIN.PLANT_BERRIES.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.PLANT_BERRIES.HIGH[1][2]] = "HERMITCRAB_COMPLAIN.PLANT_BERRIES.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.FILL_MEATRACKS.LOW[1]] = "HERMITCRAB_COMPLAIN.FILL_MEATRACKS.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.FILL_MEATRACKS.MED[1][1]] = "HERMITCRAB_COMPLAIN.FILL_MEATRACKS.MED.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.FILL_MEATRACKS.MED[1][2]] = "HERMITCRAB_COMPLAIN.FILL_MEATRACKS.MED.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.FILL_MEATRACKS.HIGH[1]] = "HERMITCRAB_COMPLAIN.FILL_MEATRACKS.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.LOW[1][1]] = "HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.LOW.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.LOW[1][2]] = "HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.LOW.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.MED[1]] = "HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.HIGH[1][1]] = "HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.HIGH[1][2]] = "HERMITCRAB_COMPLAIN.GIVE_HEAVY_FISH.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.LOW[1][1]] = "HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.LOW.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.LOW[1][2]] = "HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.LOW.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.MED[1]] = "HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.HIGH[1][1]] = "HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.HIGH[1][2]] = "HERMITCRAB_COMPLAIN.GIVE_UMBRELLA.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_PUFFY_VEST.LOW[1]] = "HERMITCRAB_COMPLAIN.GIVE_PUFFY_VEST.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_PUFFY_VEST.MED[1]] = "HERMITCRAB_COMPLAIN.GIVE_PUFFY_VEST.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_PUFFY_VEST.HIGH[1]] = "HERMITCRAB_COMPLAIN.GIVE_PUFFY_VEST.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FLOWER_SALAD.LOW[1]] = "HERMITCRAB_COMPLAIN.GIVE_FLOWER_SALAD.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FLOWER_SALAD.MED[1]] = "HERMITCRAB_COMPLAIN.GIVE_FLOWER_SALAD.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FLOWER_SALAD.HIGH[1][1]] = "HERMITCRAB_COMPLAIN.GIVE_FLOWER_SALAD.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FLOWER_SALAD.HIGH[1][2]] = "HERMITCRAB_COMPLAIN.GIVE_FLOWER_SALAD.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_WINTER.LOW[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_WINTER.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_WINTER.MED[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_WINTER.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_WINTER.HIGH[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_WINTER.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_SUMMER.LOW[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_SUMMER.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_SUMMER.MED[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_SUMMER.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_SUMMER.HIGH[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_SUMMER.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_SPRING.LOW[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_SPRING.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_SPRING.MED[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_SPRING.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_SPRING.HIGH[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_SPRING.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_AUTUM.LOW[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_AUTUM.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_AUTUM.MED[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_AUTUM.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_COMPLAIN.GIVE_FISH_AUTUM.HIGH[1]] = "HERMITCRAB_COMPLAIN.GIVE_FISH_AUTUM.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.PLANT_FLOWERS.LOW[1]] = "HERMITCRAB_INVESTIGATE.PLANT_FLOWERS.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.PLANT_FLOWERS.MED[1]] = "HERMITCRAB_INVESTIGATE.PLANT_FLOWERS.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.PLANT_FLOWERS.HIGH[1]] = "HERMITCRAB_INVESTIGATE.PLANT_FLOWERS.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.PLANT_BERRIES.LOW[1]] = "HERMITCRAB_INVESTIGATE.PLANT_BERRIES.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.PLANT_BERRIES.MED[1]] = "HERMITCRAB_INVESTIGATE.PLANT_BERRIES.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.PLANT_BERRIES.HIGH[1]] = "HERMITCRAB_INVESTIGATE.PLANT_BERRIES.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.FILL_MEATRACKS.LOW[1]] = "HERMITCRAB_INVESTIGATE.FILL_MEATRACKS.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.FILL_MEATRACKS.MED[1]] = "HERMITCRAB_INVESTIGATE.FILL_MEATRACKS.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.FILL_MEATRACKS.HIGH[1]] = "HERMITCRAB_INVESTIGATE.FILL_MEATRACKS.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.REMOVE_LUREPLANT.LOW[1]] = "HERMITCRAB_INVESTIGATE.REMOVE_LUREPLANT.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.REMOVE_LUREPLANT.MED[1]] = "HERMITCRAB_INVESTIGATE.REMOVE_LUREPLANT.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INVESTIGATE.REMOVE_LUREPLANT.HIGH[1]] = "HERMITCRAB_INVESTIGATE.REMOVE_LUREPLANT.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[0][1]] = "HERMITCRAB_GREETING.0.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[0][2]] = "HERMITCRAB_GREETING.0.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[0][3]] = "HERMITCRAB_GREETING.0.3"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[0][4]] = "HERMITCRAB_GREETING.0.4"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[0][5]] = "HERMITCRAB_GREETING.0.5"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[1][1]] = "HERMITCRAB_GREETING.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[1][2]] = "HERMITCRAB_GREETING.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[2][1]] = "HERMITCRAB_GREETING.2.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[2][2]] = "HERMITCRAB_GREETING.2.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[3][1]] = "HERMITCRAB_GREETING.3.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[3][2]] = "HERMITCRAB_GREETING.3.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[3][3]] = "HERMITCRAB_GREETING.3.3"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[4][1][1]] = "HERMITCRAB_GREETING.4.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[4][1][2]] = "HERMITCRAB_GREETING.4.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[4][2]] = "HERMITCRAB_GREETING.4.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[5][1]] = "HERMITCRAB_GREETING.5.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[5][2][1]] = "HERMITCRAB_GREETING.5.2.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[5][2][2]] = "HERMITCRAB_GREETING.5.2.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[6][1]] = "HERMITCRAB_GREETING.6.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[7][1]] = "HERMITCRAB_GREETING.7.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[7][2]] = "HERMITCRAB_GREETING.7.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[7][3]] = "HERMITCRAB_GREETING.7.3"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[8][1]] = "HERMITCRAB_GREETING.8.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[9][1]] = "HERMITCRAB_GREETING.9.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[9][2][1]] = "HERMITCRAB_GREETING.9.2.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[9][2][2]] = "HERMITCRAB_GREETING.9.2.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[10][1]] = "HERMITCRAB_GREETING.10.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[10][2]] = "HERMITCRAB_GREETING.10.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GREETING[10][3]] = "HERMITCRAB_GREETING.10.3"
STRCODE_TALKER[STRINGS.HERMITCRAB_DEFAULT_REWARD.LOW[1][1]] = "HERMITCRAB_DEFAULT_REWARD.LOW.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_DEFAULT_REWARD.LOW[1][2]] = "HERMITCRAB_DEFAULT_REWARD.LOW.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_DEFAULT_REWARD.MED[1]] = "HERMITCRAB_DEFAULT_REWARD.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_DEFAULT_REWARD.HIGH[1]] = "HERMITCRAB_DEFAULT_REWARD.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GROUP_REWARD.LOW[1][1]] = "HERMITCRAB_GROUP_REWARD.LOW.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GROUP_REWARD.LOW[1][2]] = "HERMITCRAB_GROUP_REWARD.LOW.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GROUP_REWARD.MED[1]] = "HERMITCRAB_GROUP_REWARD.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GROUP_REWARD.HIGH[1][1]] = "HERMITCRAB_GROUP_REWARD.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GROUP_REWARD.HIGH[1][2]] = "HERMITCRAB_GROUP_REWARD.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_INTRODUCE[1][1]] = "HERMITCRAB_INTRODUCE.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_INTRODUCE[1][2]] = "HERMITCRAB_INTRODUCE.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_1.LOW[1]] = "HERMITCRAB_REWARD.FIX_HOUSE_1.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_1.MED[1]] = "HERMITCRAB_REWARD.FIX_HOUSE_1.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_1.HIGH[1]] = "HERMITCRAB_REWARD.FIX_HOUSE_1.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_2.LOW[1]] = "HERMITCRAB_REWARD.FIX_HOUSE_2.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_2.MED[1]] = "HERMITCRAB_REWARD.FIX_HOUSE_2.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_2.HIGH[1]] = "HERMITCRAB_REWARD.FIX_HOUSE_2.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_3.LOW[1]] = "HERMITCRAB_REWARD.FIX_HOUSE_3.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_3.MED[1][1]] = "HERMITCRAB_REWARD.FIX_HOUSE_3.MED.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_3.MED[1][2]] = "HERMITCRAB_REWARD.FIX_HOUSE_3.MED.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_3.HIGH[1][1]] = "HERMITCRAB_REWARD.FIX_HOUSE_3.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_3.HIGH[1][2]] = "HERMITCRAB_REWARD.FIX_HOUSE_3.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FIX_HOUSE_3.HIGH[1][3]] = "HERMITCRAB_REWARD.FIX_HOUSE_3.HIGH.1.3"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.PLANT_FLOWERS.LOW[1]] = "HERMITCRAB_REWARD.PLANT_FLOWERS.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.PLANT_FLOWERS.MED[1]] = "HERMITCRAB_REWARD.PLANT_FLOWERS.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.PLANT_FLOWERS.HIGH[1]] = "HERMITCRAB_REWARD.PLANT_FLOWERS.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.REMOVE_JUNK.LOW[1]] = "HERMITCRAB_REWARD.REMOVE_JUNK.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.REMOVE_JUNK.MED[1]] = "HERMITCRAB_REWARD.REMOVE_JUNK.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.REMOVE_JUNK.HIGH[1][1]] = "HERMITCRAB_REWARD.REMOVE_JUNK.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.REMOVE_JUNK.HIGH[1][2]] = "HERMITCRAB_REWARD.REMOVE_JUNK.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.PLANT_BERRIES.LOW[1][1]] = "HERMITCRAB_REWARD.PLANT_BERRIES.LOW.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.PLANT_BERRIES.LOW[1][2]] = "HERMITCRAB_REWARD.PLANT_BERRIES.LOW.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.PLANT_BERRIES.MED[1]] = "HERMITCRAB_REWARD.PLANT_BERRIES.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.PLANT_BERRIES.HIGH[1][1]] = "HERMITCRAB_REWARD.PLANT_BERRIES.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.PLANT_BERRIES.HIGH[1][2]] = "HERMITCRAB_REWARD.PLANT_BERRIES.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FILL_MEATRACKS.LOW[1]] = "HERMITCRAB_REWARD.FILL_MEATRACKS.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FILL_MEATRACKS.MED[1]] = "HERMITCRAB_REWARD.FILL_MEATRACKS.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.FILL_MEATRACKS.HIGH[1]] = "HERMITCRAB_REWARD.FILL_MEATRACKS.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_HEAVY_FISH.LOW[1][1]] = "HERMITCRAB_REWARD.GIVE_HEAVY_FISH.LOW.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_HEAVY_FISH.LOW[1][2]] = "HERMITCRAB_REWARD.GIVE_HEAVY_FISH.LOW.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_HEAVY_FISH.MED[1]] = "HERMITCRAB_REWARD.GIVE_HEAVY_FISH.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_HEAVY_FISH.HIGH[1][1]] = "HERMITCRAB_REWARD.GIVE_HEAVY_FISH.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_HEAVY_FISH.HIGH[1][2]] = "HERMITCRAB_REWARD.GIVE_HEAVY_FISH.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.REMOVE_LUREPLANT.LOW[1][1]] = "HERMITCRAB_REWARD.REMOVE_LUREPLANT.LOW.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.REMOVE_LUREPLANT.LOW[1][2]] = "HERMITCRAB_REWARD.REMOVE_LUREPLANT.LOW.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.REMOVE_LUREPLANT.MED[1]] = "HERMITCRAB_REWARD.REMOVE_LUREPLANT.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.REMOVE_LUREPLANT.HIGH[1][1]] = "HERMITCRAB_REWARD.REMOVE_LUREPLANT.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.REMOVE_LUREPLANT.HIGH[1][2]] = "HERMITCRAB_REWARD.REMOVE_LUREPLANT.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_UMBRELLA.LOW[1]] = "HERMITCRAB_REWARD.GIVE_UMBRELLA.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_UMBRELLA.MED[1]] = "HERMITCRAB_REWARD.GIVE_UMBRELLA.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_UMBRELLA.HIGH[1]] = "HERMITCRAB_REWARD.GIVE_UMBRELLA.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_PUFFY_VEST.LOW[1]] = "HERMITCRAB_REWARD.GIVE_PUFFY_VEST.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_PUFFY_VEST.MED[1]] = "HERMITCRAB_REWARD.GIVE_PUFFY_VEST.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_PUFFY_VEST.HIGH[1]] = "HERMITCRAB_REWARD.GIVE_PUFFY_VEST.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FLOWER_SALAD.LOW[1]] = "HERMITCRAB_REWARD.GIVE_FLOWER_SALAD.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FLOWER_SALAD.MED[1]] = "HERMITCRAB_REWARD.GIVE_FLOWER_SALAD.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FLOWER_SALAD.HIGH[1][1]] = "HERMITCRAB_REWARD.GIVE_FLOWER_SALAD.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FLOWER_SALAD.HIGH[1][2]] = "HERMITCRAB_REWARD.GIVE_FLOWER_SALAD.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_WINTER.LOW[1]] = "HERMITCRAB_REWARD.GIVE_FISH_WINTER.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_WINTER.MED[1]] = "HERMITCRAB_REWARD.GIVE_FISH_WINTER.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_WINTER.HIGH[1]] = "HERMITCRAB_REWARD.GIVE_FISH_WINTER.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_SUMMER.LOW[1]] = "HERMITCRAB_REWARD.GIVE_FISH_SUMMER.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_SUMMER.MED[1]] = "HERMITCRAB_REWARD.GIVE_FISH_SUMMER.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_SUMMER.HIGH[1]] = "HERMITCRAB_REWARD.GIVE_FISH_SUMMER.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_SPRING.LOW[1]] = "HERMITCRAB_REWARD.GIVE_FISH_SPRING.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_SPRING.MED[1]] = "HERMITCRAB_REWARD.GIVE_FISH_SPRING.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_SPRING.HIGH[1]] = "HERMITCRAB_REWARD.GIVE_FISH_SPRING.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_AUTUM.LOW[1]] = "HERMITCRAB_REWARD.GIVE_FISH_AUTUM.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_AUTUM.MED[1]] = "HERMITCRAB_REWARD.GIVE_FISH_AUTUM.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REWARD.GIVE_FISH_AUTUM.HIGH[1]] = "HERMITCRAB_REWARD.GIVE_FISH_AUTUM.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_1[1][1]] = "HERMITCRAB_STORE_UNLOCK_1.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_1[1][2]] = "HERMITCRAB_STORE_UNLOCK_1.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_2[1][1]] = "HERMITCRAB_STORE_UNLOCK_2.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_2[1][2]] = "HERMITCRAB_STORE_UNLOCK_2.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_3[1][1]] = "HERMITCRAB_STORE_UNLOCK_3.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_3[1][2]] = "HERMITCRAB_STORE_UNLOCK_3.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_4[1][1]] = "HERMITCRAB_STORE_UNLOCK_4.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_4[1][2]] = "HERMITCRAB_STORE_UNLOCK_4.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_5[1][1]] = "HERMITCRAB_STORE_UNLOCK_5.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_STORE_UNLOCK_5[1][2]] = "HERMITCRAB_STORE_UNLOCK_5.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_PLANTED_LUREPLANT_DIED.LOW[1]] = "HERMITCRAB_PLANTED_LUREPLANT_DIED.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_PLANTED_LUREPLANT_DIED.MED[1]] = "HERMITCRAB_PLANTED_LUREPLANT_DIED.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_PLANTED_LUREPLANT_DIED.HIGH[1]] = "HERMITCRAB_PLANTED_LUREPLANT_DIED.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GO_HOME[1]] = "HERMITCRAB_GO_HOME.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_PANIC[1]] = "HERMITCRAB_PANIC.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_PANICHAUNT[1]] = "HERMITCRAB_PANICHAUNT.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_PANICFIRE[1]] = "HERMITCRAB_PANICFIRE.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_FIGHT[1][1]] = "HERMITCRAB_FIGHT.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_FIGHT[1][2]] = "HERMITCRAB_FIGHT.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_ATTEMPT_TRADE.LOW[1]] = "HERMITCRAB_ATTEMPT_TRADE.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ATTEMPT_TRADE.MED[1]] = "HERMITCRAB_ATTEMPT_TRADE.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ATTEMPT_TRADE.HIGH[1][1]] = "HERMITCRAB_ATTEMPT_TRADE.HIGH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ATTEMPT_TRADE.HIGH[1][2]] = "HERMITCRAB_ATTEMPT_TRADE.HIGH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GETFISH_BIG[1]] = "HERMITCRAB_GETFISH_BIG.1"
STRCODE_SUBFMT[STRINGS.HERMITCRAB_REFUSE_SMALL_FISH[1]] = "HERMITCRAB_REFUSE_SMALL_FISH.1"
STRCODE_SUBFMT[STRINGS.HERMITCRAB_REFUSE_SMALL_FISH[2]] = "HERMITCRAB_REFUSE_SMALL_FISH.2"
STRCODE_SUBFMT[STRINGS.HERMITCRAB_REFUSE_SMALL_FISH[3]] = "HERMITCRAB_REFUSE_SMALL_FISH.3"
STRCODE_TALKER[STRINGS.HERMITCRAB_REFUSE_SALAD[1][1]] = "HERMITCRAB_REFUSE_SALAD.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REFUSE_SALAD[1][2]] = "HERMITCRAB_REFUSE_SALAD.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_REFUSE_ICE_HOT[1]] = "HERMITCRAB_REFUSE_ICE_HOT.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REFUSE_ICE_HAD[1]] = "HERMITCRAB_REFUSE_ICE_HAD.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REFUSE_UMBRELLA[1]] = "HERMITCRAB_REFUSE_UMBRELLA.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REFUSE_UMBRELLA_HASONE[1]] = "HERMITCRAB_REFUSE_UMBRELLA_HASONE.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REFUSE_COAT[1]] = "HERMITCRAB_REFUSE_COAT.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REFUSE_COAT_HASONE[1]] = "HERMITCRAB_REFUSE_COAT_HASONE.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_REFUSE_VEST[1]] = "HERMITCRAB_REFUSE_VEST.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_ROYALTY[1]] = "HERMITCRAB_ANNOUNCE_ROYALTY.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_ROYALTY[2]] = "HERMITCRAB_ANNOUNCE_ROYALTY.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_ROYALTY[3]] = "HERMITCRAB_ANNOUNCE_ROYALTY.3"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_LINESNAP[1]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_LINESNAP.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE[1]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE[2]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE[3]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE.3"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE[4]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE.4"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE[5]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE.5"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE[6]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_IDLE_QUOTE.6"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_LINETOOLOOSE[1]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_LINETOOLOOSE.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_BADCAST[1]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_BADCAST.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_GOTAWAY[1][1]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_GOTAWAY.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_GOTAWAY[1][2]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_GOTAWAY.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_BOTHERED.LOW[1]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_BOTHERED.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_BOTHERED.MED[1]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_BOTHERED.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_ANNOUNCE_OCEANFISHING_BOTHERED.HIGH[1]] = "HERMITCRAB_ANNOUNCE_OCEANFISHING_BOTHERED.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_LEVEL10_PLAYERGOOD[1]] = "HERMITCRAB_LEVEL10_PLAYERGOOD.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_LEVEL10_LOWHEALTH[1][1]] = "HERMITCRAB_LEVEL10_LOWHEALTH.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_LEVEL10_LOWHEALTH[1][2]] = "HERMITCRAB_LEVEL10_LOWHEALTH.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_LEVEL10_LOWSANITY[1][1]] = "HERMITCRAB_LEVEL10_LOWSANITY.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_LEVEL10_LOWSANITY[1][2]] = "HERMITCRAB_LEVEL10_LOWSANITY.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_LEVEL10_LOWHUNGER[1][1]] = "HERMITCRAB_LEVEL10_LOWHUNGER.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_LEVEL10_LOWHUNGER[1][2]] = "HERMITCRAB_LEVEL10_LOWHUNGER.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_THROWBOTTLE.LOW[1][1]] = "HERMITCRAB_THROWBOTTLE.LOW.1.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_THROWBOTTLE.LOW[1][2]] = "HERMITCRAB_THROWBOTTLE.LOW.1.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_THROWBOTTLE.MED[1]] = "HERMITCRAB_THROWBOTTLE.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_THROWBOTTLE.HIGH[1]] = "HERMITCRAB_THROWBOTTLE.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_HARVESTMEAT.LOW[1]] = "HERMITCRAB_HARVESTMEAT.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_HARVESTMEAT.MED[1]] = "HERMITCRAB_HARVESTMEAT.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_HARVESTMEAT.HIGH[1]] = "HERMITCRAB_HARVESTMEAT.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_MOON_FISSURE_VENT.LOW[1]] = "HERMITCRAB_MOON_FISSURE_VENT.LOW.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_MOON_FISSURE_VENT.MED[1]] = "HERMITCRAB_MOON_FISSURE_VENT.MED.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_MOON_FISSURE_VENT.HIGH[1]] = "HERMITCRAB_MOON_FISSURE_VENT.HIGH.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GOT_PEARL[1]] = "HERMITCRAB_GOT_PEARL.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GOT_PEARL[2]] = "HERMITCRAB_GOT_PEARL.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GOT_PEARL[3]] = "HERMITCRAB_GOT_PEARL.3"
STRCODE_TALKER[STRINGS.HERMITCRAB_GOT_PEARL[4]] = "HERMITCRAB_GOT_PEARL.4"
STRCODE_TALKER[STRINGS.HERMITCRAB_GOT_PEARL[5]] = "HERMITCRAB_GOT_PEARL.5"
STRCODE_TALKER[STRINGS.HERMITCRAB_WANT_HOUSE[1]] = "HERMITCRAB_WANT_HOUSE.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GIVE_PEARL[1]] = "HERMITCRAB_GIVE_PEARL.1"
STRCODE_TALKER[STRINGS.HERMITCRAB_GIVE_PEARL[2]] = "HERMITCRAB_GIVE_PEARL.2"
STRCODE_TALKER[STRINGS.HERMITCRAB_GIVE_PEARL[3]] = "HERMITCRAB_GIVE_PEARL.3"
--------------------------------------------------------------------------------
------------------------------- TROPHYSCALE_FISH -------------------------------
--------------------------------------------------------------------------------
local function IsHoldingItem(inst)
return inst.components.trophyscale.item_data ~= nil and not inst:HasTag("burnt")
end
local function trophyscale_fish_getdesc(inst, viewer)
if inst:HasTag("burnt") then
return GetDescriptionCode(viewer, inst, "BURNT")
elseif inst:HasTag("fire") then
return GetDescriptionCode(viewer, inst, "BURNING")
elseif IsHoldingItem(inst) then
local data = inst.components.trophyscale.item_data
local heavy_postfix = (data.is_heavy and "_HEAVY" or "")
if data.prefab_override_owner ~= nil then
-- return subfmt(GetDescription(viewer, inst, "HAS_ITEM"..heavy_postfix), {weight = data.weight or "",
-- owner = STRINGS.UI.HUD.TROPHYSCALE_PREFAB_OVERRIDE_OWNER[data.prefab_override_owner] ~= nil and STRINGS.UI.HUD.TROPHYSCALE_PREFAB_OVERRIDE_OWNER[data.prefab_override_owner]
-- or STRINGS.UI.HUD.TROPHYSCALE_UNKNOWN_OWNER})
return GetDescriptionCode(viewer, inst, "HAS_ITEM"..heavy_postfix, "subfmt", {weight = data.weight or "",
owner = STRINGS.UI.HUD.TROPHYSCALE_PREFAB_OVERRIDE_OWNER[data.prefab_override_owner] ~= nil and STRCODE_HEADER .. "UI.HUD.TROPHYSCALE_PREFAB_OVERRIDE_OWNER." .. data.prefab_override_owner
or STRCODE_HEADER .. "UI.HUD.TROPHYSCALE_UNKNOWN_OWNER"})
else
local name = data.owner_userid == nil and STRCODE_HEADER .. "UI.HUD.TROPHYSCALE_UNKNOWN_OWNER" or data.owner_name
-- return data.owner_userid ~= nil and data.owner_userid == viewer.userid and subfmt(GetDescription(viewer, inst, "OWNER"..heavy_postfix), {weight = data.weight or "", owner = name or ""}) or
-- subfmt(GetDescription(viewer, inst, "HAS_ITEM"..heavy_postfix), {weight = data.weight or "", owner = name or ""})
return data.owner_userid ~= nil and data.owner_userid == viewer.userid
and GetDescriptionCode(viewer, inst, "OWNER"..heavy_postfix, "subfmt", {weight = data.weight or "", owner = name or ""})
or GetDescriptionCode(viewer, inst, "HAS_ITEM"..heavy_postfix, "subfmt", {weight = data.weight or "", owner = name or ""})
end
end
return GetDescriptionCode(viewer, inst) or nil
end
AddPrefabPostInit("trophyscale_fish", function(inst)
if not TheWorld.ismastersim then return end
inst.components.inspectable.getspecialdescription = trophyscale_fish_getdesc
end)
--------------------------------------------------------------------------------
------------------------- TROPHYSCALE_OVERSIZEDVEGGIES -------------------------
--------------------------------------------------------------------------------
local function trophyscale_oversizedveggies_getdesc(inst, viewer)
if inst:HasTag("burnt") then
return GetDescriptionCode(viewer, inst, "BURNT")
elseif inst:HasTag("fire") then
return GetDescriptionCode(viewer, inst, "BURNING")
elseif IsHoldingItem(inst) then
local data = inst.components.trophyscale.item_data
if data.weight == nil or data.weight <= 0 then
return GetDescriptionCode(viewer, inst, "HAS_ITEM_LIGHT")
end
local heavy_postfix = (data.is_heavy and "_HEAVY" or "")
return GetDescriptionCode(viewer, inst, "HAS_ITEM"..heavy_postfix, "subfmt", {weight = data.weight or "", day = data.day or ""})
end
return GetDescriptionCode(viewer, inst) or nil
end
AddPrefabPostInit("trophyscale_oversizedveggies", function(inst)
if not TheWorld.ismastersim then return end
inst.components.inspectable.getspecialdescription = trophyscale_oversizedveggies_getdesc
end)
--------------------------------------------------------------------------------
--------------------------- YOTC_CARRAT_RACE_FINISH ----------------------------
--------------------------------------------------------------------------------
local function yotc_carrat_race_finish_getdesc(inst, viewer)
if inst:HasTag("burnt") then
return GetDescriptionCode(viewer, inst, "BURNT")
elseif inst._active and inst._winner ~= nil then
if inst._winner.userid ~= nil and inst._winner.userid == viewer.userid then
return GetDescriptionCode(viewer, inst, "I_WON")
elseif inst._winner.name ~= nil then
return GetDescriptionCode(viewer, inst, "SOMEONE_ELSE_WON", "subfmt", { winner = inst._winner.name })
end
end
return GetDescriptionCode(viewer, inst) or nil
end
AddPrefabPostInit("yotc_carrat_race_finish", function(inst)
if not TheWorld.ismastersim then return end
inst.components.inspectable.getspecialdescription = yotc_carrat_race_finish_getdesc
end)
--------------------------------------------------------------------------------
------------------------------- USE_POCKET_SCALE -------------------------------
--------------------------------------------------------------------------------
AddStategraphPostInit("wilson", function(self)
-- local onenter = self.states["use_pocket_scale"].onenter
self.states["use_pocket_scale"].timeline[1] =
TimeEvent(30 * FRAMES, function(inst)
local weight = inst.sg.statemem.target ~= nil and inst.sg.statemem.target.components.weighable:GetWeight() or nil
if weight ~= nil and inst:PerformBufferedAction() then
local announce_str = inst.sg.statemem.target.components.weighable:GetWeightPercent() >= TUNING.WEIGHABLE_HEAVY_WEIGHT_PERCENT and "ANNOUNCE_WEIGHT_HEAVY" or "ANNOUNCE_WEIGHT"
local str = GetStringCode(inst, announce_str, nil, "subfmt", {weight = string.format("%0.2f", weight)})
inst.components.talker:Say(str)
else
inst.AnimState:ClearOverrideBuild(inst.sg.statemem.target_build)
inst:ClearBufferedAction()
inst.AnimState:SetTime(51 * FRAMES)
end
end)
end)
--------------------------------------------------------------------------------
---------------------------------- BLUEPRINT -----------------------------------
--------------------------------------------------------------------------------
local function get_blueprint_string_ret(inst)
local ret = inst.is_rare
and {
strtype = "subfmt",
content = "NAMES.BLUEPRINT_RARE",
params = { item = STRINGS.NAMES[string.upper(inst.recipetouse)] and STRCODE_HEADER .. "NAMES." .. string.upper(inst.recipetouse) or STRCODE_HEADER .. "NAMES.UNKNOWN" }
}
or {
content = {
-- "$angri ", -- Test String
STRINGS.NAMES[string.upper(inst.recipetouse)] and "NAMES." .. string.upper(inst.recipetouse) or "NAMES.UNKNOWN",
"$ ",
"NAMES.BLUEPRINT"
}
}
return EncodeStrCode(ret)
end
local function blueprint_postinit(inst)
if not TheWorld.ismastersim then return end
inst.components.named:SetName(get_blueprint_string_ret(inst))
local onload = inst.OnLoad
inst.OnLoad = function(inst, data)
onload(inst, data)
inst.components.named:SetName(get_blueprint_string_ret(inst))
inst.drawnameoverride = get_blueprint_string_ret(inst)
end
local onhaunt = inst.components.hauntable.onhaunt
inst.components.hauntable:SetOnHauntFn(function(self, ...)
onhaunt(self, ...)
inst.components.named:SetName(get_blueprint_string_ret(inst))
inst.drawnameoverride = get_blueprint_string_ret(inst)
end)
inst.drawnameoverride = get_blueprint_string_ret(inst)
end
AddPrefabPostInit("blueprint", blueprint_postinit)
--------------------------------------------------------------------------------
----------------------------------- MINISIGN -----------------------------------
--------------------------------------------------------------------------------
local function minisign_displaynamefn(inst)
return #inst._imagename:value() > 0
and subfmt(STRINGS.NAMES.MINISIGN_DRAWN, { item = IsStrCode(inst._imagename:value()) and ResolveStrCode(SubStrCode(inst._imagename:value())) or inst._imagename:value() })
or STRINGS.NAMES.MINISIGN
end
local function minisign_postinit(inst)
inst.displaynamefn = minisign_displaynamefn
end
local minisigns = {
"minisign",
"minisign_drawn",
}
for _, sign in ipairs(minisigns) do
AddPrefabPostInit(sign, minisign_postinit)
end
require("components/drawingtool")
ACTIONS.DRAW.stroverridefn = function(act)
local item = FindEntityToDraw(act.target, act.invobject)
local drawnameoverride = item and item.drawnameoverride
return item ~= nil
and subfmt(STRINGS.ACTIONS.DRAWITEM,
{ item = drawnameoverride
and (IsStrCode(drawnameoverride) and ResolveStrCode(SubStrCode(drawnameoverride)) or drawnameoverride)
or item:GetBasicDisplayName() })
or nil
end
local function common_drawnameoverride_fn(inst)
local name = inst.nameoverride or inst.prefab
inst.drawnameoverride = inst.drawnameoverride or EncodeStrCode({content = "NAMES." .. string.upper(name)})
end
local function spicedfoods_drawnameoverride_fn(inst)
local spicename = string.gsub(inst.prefab, (inst.nameoverride or "") .. "_", "")
spicename = string.upper(spicename)
local drawnameoverride = {
strtype = "subfmt",
content = "NAMES." .. spicename .. "_FOOD",
params = {
food = STRCODE_HEADER .. "NAMES." .. string.upper(inst.nameoverride)
}
}
-- subfmt(STRINGS.NAMES[data.spice.."_FOOD"], { food = STRINGS.NAMES[string.upper(inst.nameoverride)] })
inst.drawnameoverride = inst.drawnameoverride or EncodeStrCode(drawnameoverride)
end
local function add_drawname_override(inst)
if not TheWorld.ismastersim then return end
if inst:HasTag("_inventoryitem")
and not (inst:HasTag("INLIMBO") or inst:HasTag("notdrawable"))
and inst.displaynamefn == nil
and inst.name_author_netid == nil
then
inst:DoTaskInTime(0, common_drawnameoverride_fn)
end
if inst:HasTag("spicedfood") then
inst:DoTaskInTime(0, spicedfoods_drawnameoverride_fn)
end
end
AddPrefabPostInitAny(add_drawname_override)
--------------------------------------------------------------------------------
------------------------------------ SKETCH ------------------------------------
--------------------------------------------------------------------------------
local SKETCHES =
{
{ item = "chesspiece_pawn", recipe = "chesspiece_pawn_builder" },
{ item = "chesspiece_rook", recipe = "chesspiece_rook_builder" },
{ item = "chesspiece_knight", recipe = "chesspiece_knight_builder" },
{ item = "chesspiece_bishop", recipe = "chesspiece_bishop_builder" },
{ item = "chesspiece_muse", recipe = "chesspiece_muse_builder" },
{ item = "chesspiece_formal", recipe = "chesspiece_formal_builder" },
{ item = "chesspiece_deerclops", recipe = "chesspiece_deerclops_builder" },
{ item = "chesspiece_bearger", recipe = "chesspiece_bearger_builder" },
{ item = "chesspiece_moosegoose", recipe = "chesspiece_moosegoose_builder" },
{ item = "chesspiece_dragonfly", recipe = "chesspiece_dragonfly_builder" },
{ item = "chesspiece_clayhound", recipe = "chesspiece_clayhound_builder", image = "chesspiece_clayhound_sketch" },
{ item = "chesspiece_claywarg", recipe = "chesspiece_claywarg_builder", image = "chesspiece_claywarg_sketch" },
{ item = "chesspiece_butterfly", recipe = "chesspiece_butterfly_builder", image = "chesspiece_butterfly_sketch" },
{ item = "chesspiece_anchor", recipe = "chesspiece_anchor_builder", image = "chesspiece_anchor_sketch" },
{ item = "chesspiece_moon", recipe = "chesspiece_moon_builder", image = "chesspiece_moon_sketch" },
{ item = "chesspiece_carrat", recipe = "chesspiece_carrat_builder", image = "chesspiece_carrat_sketch" },
{ item = "chesspiece_malbatross", recipe = "chesspiece_malbatross_builder" },
{ item = "chesspiece_crabking", recipe = "chesspiece_crabking_builder" },
{ item = "chesspiece_toadstool", recipe = "chesspiece_toadstool_builder" },
{ item = "chesspiece_stalker", recipe = "chesspiece_stalker_builder" },
{ item = "chesspiece_klaus", recipe = "chesspiece_klaus_builder" },
{ item = "chesspiece_beequeen", recipe = "chesspiece_beequeen_builder" },
{ item = "chesspiece_antlion", recipe = "chesspiece_antlion_builder" },
{ item = "chesspiece_minotaur", recipe = "chesspiece_minotaur_builder" },
{ item = "chesspiece_beefalo", recipe = "chesspiece_beefalo_builder", image = "chesspiece_beefalo_sketch" },
{ item = "chesspiece_guardianphase3", recipe = "chesspiece_guardianphase3_builder", image = "chesspiece_guardianphase3_sketch" },
{ item = "chesspiece_eyeofterror", recipe = "chesspiece_eyeofterror_builder" },
{ item = "chesspiece_twinsofterror", recipe = "chesspiece_twinsofterror_builder" },
}
local function get_sketch_string_fn(inst)
local ret = {
strtype = "subfmt",
content = "NAMES.SKETCH",
params = {
item = STRCODE_HEADER .. "NAMES." .. string.upper(SKETCHES[inst.sketchid].recipe)
}
}
return EncodeStrCode(ret)
end
local function sketch_postinit(inst)
if not TheWorld.ismastersim then return end
inst.components.named:SetName(get_sketch_string_fn(inst))
local onload = inst.OnLoad
inst.OnLoad = function(inst, data)
onload(inst, data)
inst.components.named:SetName(get_sketch_string_fn(inst))
inst.drawnameoverride = get_sketch_string_fn(inst)
end
inst.drawnameoverride = get_sketch_string_fn(inst)
end
AddPrefabPostInit("sketch", sketch_postinit)
--------------------------------------------------------------------------------
--------------------------------- TACKLESKETCH ---------------------------------
--------------------------------------------------------------------------------
local TACKLESKETCHES =
{
{ item = "oceanfishingbobber_ball", recipe = "oceanfishingbobber_ball" },
{ item = "oceanfishingbobber_oval", recipe = "oceanfishingbobber_oval" },
{ item = "oceanfishingbobber_crow", recipe = "oceanfishingbobber_crow" },
{ item = "oceanfishingbobber_robin", recipe = "oceanfishingbobber_robin" },
{ item = "oceanfishingbobber_robin_winter", recipe = "oceanfishingbobber_robin_winter" },
{ item = "oceanfishingbobber_canary", recipe = "oceanfishingbobber_canary" },
{ item = "oceanfishingbobber_goose", recipe = "oceanfishingbobber_goose" },
{ item = "oceanfishingbobber_malbatross", recipe = "oceanfishingbobber_malbatross" },
{ item = "oceanfishinglure_hermit_drowsy", recipe = "oceanfishinglure_hermit_drowsy" },
{ item = "oceanfishinglure_hermit_rain", recipe = "oceanfishinglure_hermit_rain" },
{ item = "oceanfishinglure_hermit_heavy", recipe = "oceanfishinglure_hermit_heavy" },
{ item = "oceanfishinglure_hermit_snow", recipe = "oceanfishinglure_hermit_snow" },
}
local function get_tacklesketch_string_fn(inst)
local ret = {
strtype = "subfmt",
content = "NAMES.TACKLESKETCH",
params = {
item = STRCODE_HEADER .. "NAMES." .. string.upper(TACKLESKETCHES[inst.sketchid].recipe)
}
}
return EncodeStrCode(ret)
end
local function tacklesketch_postinit(inst)
if not TheWorld.ismastersim then return end
inst.components.named:SetName(get_tacklesketch_string_fn(inst))
local onload = inst.OnLoad
inst.OnLoad = function(inst, data)
onload(inst, data)
inst.components.named:SetName(get_tacklesketch_string_fn(inst))
inst.drawnameoverride = get_tacklesketch_string_fn(inst)
end
inst.drawnameoverride = get_tacklesketch_string_fn(inst)
end
AddPrefabPostInit("tacklesketch", tacklesketch_postinit)
--------------------------------------------------------------------------------
-------------------------------- POSSIBLENAMES ---------------------------------
--------------------------------------------------------------------------------
local function rename_possiblenames(inst)
inst.components.named:PickNewName()
end
local function insert_possiblenames(table, index, strcode)
if table and #table > 0 then
local lenth = #table
STRCODE_POSSIBLENAMES[index] = STRCODE_POSSIBLENAMES[index] or {}
for i = 1, lenth do
STRCODE_POSSIBLENAMES[index][table[i]] = STRCODE_POSSIBLENAMES[index][table[i]] or {}
STRCODE_POSSIBLENAMES[index][table[i]][#STRCODE_POSSIBLENAMES[index][table[i]] + 1] = strcode .. tostring(i)
end
end
end
local possiblenames_prefabs = {
-- ["mooseegg"] = {"NAMES.MOOSEEGG", "NAMES.MOOSENEST"},
["moose"] = "NAMES.MOOSE",
["bunnyman"] = "BUNNYMANNAMES.",
["carnival_crowkid"] = "CROWNAMES.",
["pigman"] = "PIGNAMES.",
["pigguard"] = "PIGNAMES.",
["moonpig"] = "PIGNAMES.",
}
local function do_possiblenames_postinit(prefab, strcode, override_table)
AddPrefabPostInit(prefab, function(inst)
if not TheWorld.ismastersim then
return
end
insert_possiblenames(override_table or inst.components.named.possiblenames, prefab, strcode)
rename_possiblenames(inst)
local onload = inst.OnLoad
inst.OnLoad = function(inst, data)
if onload then onload(inst, data) end
rename_possiblenames(inst)
end
end)
end
for prefab, strcode in pairs(possiblenames_prefabs) do
do_possiblenames_postinit(prefab, strcode)
end
-- local override_moose_strings
scheduler:ExecuteInTime(0, function()
local moose_languages = {"zh", "zht", "chs"}
for i = 1, #moose_languages do
if LanguageTranslator.defaultlang == moose_languages[i] then
STRINGS.NAMES.MOOSE1 = "麋鹿鸭"
STRINGS.NAMES.MOOSE2 = "麋鹿鹅"
STRINGS.NAMES.MOOSEEGG1 = "麋鹿鸭蛋"
STRINGS.NAMES.MOOSEEGG2 = "麋鹿鹅蛋"
STRINGS.NAMES.MOOSENEST1 = "麋鹿鸭巢"
STRINGS.NAMES.MOOSENEST2 = "麋鹿鹅巢"
-- print("Moose Strings Hack!")
end
end
end)
do_possiblenames_postinit("mooseegg", "NAMES.MOOSEEGG", {STRINGS.NAMES["MOOSEEGG1"], STRINGS.NAMES["MOOSEEGG2"]})
do_possiblenames_postinit("mooseegg", "NAMES.MOOSENEST", {STRINGS.NAMES["MOOSENEST1"], STRINGS.NAMES["MOOSENEST2"]})
-- Fix string hack after loading.
AddPrefabPostInit("mooseegg", function(inst)
if not TheWorld.ismastersim then return end
local onloadpostpass = inst.OnLoadPostPass
inst.OnLoadPostPass = function(inst, ents, data, ...)
if onloadpostpass then
onloadpostpass(inst, ents, data, ...)
end
if data.has_egg and not data.EggHatched then
if inst.components.timer:TimerExists("HatchTimer") then
inst:DoTaskInTime(3 * FRAMES, function(inst)
inst.components.named.possiblenames = {STRINGS.NAMES["MOOSEEGG1"], STRINGS.NAMES["MOOSEEGG2"]}
rename_possiblenames(inst)
end)
end
else
inst:DoTaskInTime(3 * FRAMES, function(inst)
inst.components.named.possiblenames = {STRINGS.NAMES["MOOSENEST1"], STRINGS.NAMES["MOOSENEST2"]}
rename_possiblenames(inst)
end)
end
end
end)
AddPrefabPostInit("moose", function(inst)
if not TheWorld.ismastersim then return end
inst:DoTaskInTime(3 * FRAMES, function(inst)
inst.components.named.possiblenames = {STRINGS.NAMES["MOOSE1"], STRINGS.NAMES["MOOSE2"]}
rename_possiblenames(inst)
end)
end)
|
--[[
Loops through the list of tags and cleans out any references to
expired keys. If all keys are cleaned from a tag, removes the tag.
--]]
local tagList = {}
local tagsRemoved = 0
local keysCleaned = 0
if(#tagList == 0) then
tagList = redis.call('keys', '*:tag:*')
end
for _, tagName in pairs(tagList) do
local tagType = redis.call('type', tagName)
if(tagType['ok'] == 'set') then
local tagKeys = redis.call('smembers', tagName)
local tagActive = 0
local deadKeys = {}
for _, key in pairs(tagKeys) do
local keyActive = redis.call('exists', key)
if(keyActive == 0) then
table.insert(deadKeys, key)
end
end
if(#deadKeys > 0) then
redis.call('srem', tagName, unpack(deadKeys))
end
if(#deadKeys == #tagKeys) then
redis.call('del', tagName)
tagsRemoved = tagsRemoved + 1
end
keysCleaned = keysCleaned + #deadKeys
end
end
return keysCleaned |
local PLUGIN = PLUGIN;
Clockwork.kernel:IncludePrefixed("sv_plugin.lua"); |
require ("prototypes.entity.demo-pipecovers")
local hit_effects = require ("prototypes.entity.demo-hit-effects")
local sounds = require("prototypes.entity.demo-sounds")
if not data.is_demo then
require ("prototypes.entity.assemblerpipes")
end
data:extend(
{
{
type = "mining-drill",
name = "electric-mining-drill",
icon = "__base__/graphics/icons/electric-mining-drill.png",
icon_size = 64, icon_mipmaps = 4,
flags = {"placeable-neutral", "player-creation"},
minable = {mining_time = 0.3, result = "electric-mining-drill"},
max_health = 300,
resource_categories = {"basic-solid"},
corpse = "medium-remnants",
dying_explosion = "electric-mining-drill-explosion",
collision_box = {{ -1.4, -1.4}, {1.4, 1.4}},
selection_box = {{ -1.5, -1.5}, {1.5, 1.5}},
damaged_trigger_effect = hit_effects.entity(),
input_fluid_box = (not data.is_demo) and
{
production_type = "input-output",
pipe_picture = assembler2pipepictures(),
pipe_covers = pipecoverspictures(),
base_area = 1,
height = 2,
base_level = -1,
pipe_connections =
{
{ position = {-2, 0} },
{ position = {2, 0} },
{ position = {0, 2} }
}
} or nil,
working_sound =
{
sound =
{
filename = "__base__/sound/electric-mining-drill.ogg",
volume = 0.42
},
--apparent_volume = 1.5,
--max_sounds_per_type = 3,
audible_distance_modifier = 0.7,
fade_in_ticks = 4,
fade_out_ticks = 20,
},
vehicle_impact_sound = sounds.generic_impact,
open_sound = sounds.machine_open,
close_sound = sounds.machine_close,
animations =
{
north =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-N.png",
line_length = 8,
width = 98,
height = 113,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(0, -8.5),
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-N.png",
line_length = 8,
width = 196,
height = 226,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(0, -8),
run_mode = "forward-then-backward",
scale = 0.5
}
},
east =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-E.png",
line_length = 8,
width = 105,
height = 98,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(3.5, -1),
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-E.png",
line_length = 8,
width = 211,
height = 197,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(3.75, -1.25),
run_mode = "forward-then-backward",
scale = 0.5
}
},
south =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-S.png",
line_length = 8,
width = 98,
height = 109,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(0, -1.5),
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-S.png",
line_length = 8,
width = 196,
height = 219,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(0, -1.25),
run_mode = "forward-then-backward",
scale = 0.5
}
},
west =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-W.png",
line_length = 8,
width = 105,
height = 98,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(-3.5, -1),
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-W.png",
line_length = 8,
width = 211,
height = 197,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(-3.75, -0.75),
run_mode = "forward-then-backward",
scale = 0.5
}
}
},
shadow_animations =
{
north =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-N-drill-shadow.png",
flags = { "shadow" },
line_length = 8,
width = 101,
height = 111,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(1.5, -7.5),
draw_as_shadow = true,
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-N-drill-shadow.png",
flags = { "shadow" },
line_length = 8,
width = 201,
height = 223,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(1.25, -7.25),
draw_as_shadow = true,
run_mode = "forward-then-backward",
scale = 0.5
}
},
east =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-E-drill-shadow.png",
flags = { "shadow" },
line_length = 8,
width = 110,
height = 97,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(6, -0.5),
draw_as_shadow = true,
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-E-drill-shadow.png",
flags = { "shadow" },
line_length = 8,
width = 221,
height = 195,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(6.25, -0.25),
draw_as_shadow = true,
run_mode = "forward-then-backward",
scale = 0.5
}
},
south =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-S-drill-shadow.png",
flags = { "shadow" },
line_length = 8,
width = 100,
height = 103,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(1, 2.5),
draw_as_shadow = true,
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-S-drill-shadow.png",
flags = { "shadow" },
line_length = 8,
width = 200,
height = 206,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(1, 2.5),
draw_as_shadow = true,
run_mode = "forward-then-backward",
scale = 0.5
}
},
west =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-W-drill-shadow.png",
flags = { "shadow" },
line_length = 8,
width = 114,
height = 97,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(1, -0.5),
draw_as_shadow = true,
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-W-drill-shadow.png",
flags = { "shadow" },
line_length = 8,
width = 229,
height = 195,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(1.25, -0.25),
draw_as_shadow = true,
run_mode = "forward-then-backward",
scale = 0.5
}
}
},
input_fluid_patch_sprites =
{
north =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-N-patch.png",
width = 100,
height = 111,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(0, -6.5),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-N-patch.png",
width = 200,
height = 222,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-0.5, -6.5),
scale = 0.5
}
},
east =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-E-patch.png",
width = 100,
height = 110,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(0, -6),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-E-patch.png",
width = 200,
height = 219,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(0, -5.75),
scale = 0.5
}
},
south =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-S-patch.png",
width = 100,
height = 113,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(0, -7.5),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-S-patch.png",
width = 200,
height = 226,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-0.5, -7.5),
scale = 0.5
}
},
west =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-W-patch.png",
width = 100,
height = 108,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(0, -5),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-W-patch.png",
width = 200,
height = 220,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-0.5, -6),
scale = 0.5
}
}
},
input_fluid_patch_shadow_sprites =
{
north =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-N-patch-shadow.png",
flags = { "shadow" },
width = 110,
height = 98,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(5, 0),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-N-patch-shadow.png",
flags = { "shadow" },
width = 220,
height = 197,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(5, -0.25),
scale = 0.5
}
},
east =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-E-patch-shadow.png",
flags = { "shadow" },
width = 112,
height = 98,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(6, 0),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-E-patch-shadow.png",
flags = { "shadow" },
width = 224,
height = 198,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(6, 0),
scale = 0.5
}
},
south =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-S-patch-shadow.png",
flags = { "shadow" },
width = 110,
height = 98,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(5, 0),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-S-patch-shadow.png",
flags = { "shadow" },
width = 220,
height = 197,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(5, -0.25),
scale = 0.5
}
},
west =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-W-patch-shadow.png",
flags = { "shadow" },
width = 110,
height = 98,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(5, 0),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-W-patch-shadow.png",
flags = { "shadow" },
width = 220,
height = 197,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(5, -0.25),
scale = 0.5
}
}
},
input_fluid_patch_shadow_animations =
{
north =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-N-drill-received-shadow.png",
tint = { r=0.5, g=0.5, b=0.5, a=0.5 },
line_length = 8,
width = 100,
height = 102,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(-1, -3),
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-N-drill-received-shadow.png",
tint = { r=0.5, g=0.5, b=0.5, a=0.5 },
line_length = 8,
width = 204,
height = 206,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(-0.5, -2),
run_mode = "forward-then-backward",
scale = 0.5
}
},
east =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-E-drill-received-shadow.png",
tint = { r=0.5, g=0.5, b=0.5, a=0.5 },
line_length = 8,
width = 102,
height = 98,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(0, -2),
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-E-drill-received-shadow.png",
tint = { r=0.5, g=0.5, b=0.5, a=0.5 },
line_length = 8,
width = 204,
height = 209,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(-0.5, -1.25),
run_mode = "forward-then-backward",
scale = 0.5
}
},
south =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-S-drill-received-shadow.png",
tint = { r=0.5, g=0.5, b=0.5, a=0.5 },
line_length = 8,
width = 100,
height = 98,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(-1, -1),
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-S-drill-received-shadow.png",
tint = { r=0.5, g=0.5, b=0.5, a=0.5 },
line_length = 8,
width = 204,
height = 204,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(-0.5, -2.5),
run_mode = "forward-then-backward",
scale = 0.5
}
},
west =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-W-drill-received-shadow.png",
tint = { r=0.5, g=0.5, b=0.5, a=0.5 },
line_length = 8,
width = 96,
height = 99,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(0, -1.5),
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-W-drill-received-shadow.png",
tint = { r=0.5, g=0.5, b=0.5, a=0.5 },
line_length = 8,
width = 198,
height = 206,
frame_count = 64,
animation_speed = 0.5,
direction_count = 1,
shift = util.by_pixel(1, -2),
run_mode = "forward-then-backward",
scale = 0.5
}
}
},
input_fluid_patch_window_sprites =
{
north =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-N-window-background.png",
width = 72,
height = 54,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-1, 1),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-N-window-background.png",
width = 142,
height = 107,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-1, 0.75),
scale = 0.5
}
},
east =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-E-window-background.png",
width = 51,
height = 74,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-11.5, -11),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-E-window-background.png",
width = 104,
height = 147,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-11, -11.25),
scale = 0.5
}
},
south =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-S-window-background.png",
width = 71,
height = 44,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-1.5, -29),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-S-window-background.png",
width = 141,
height = 86,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-1.75, -29),
scale = 0.5
}
},
west =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-W-window-background.png",
width = 41,
height = 69,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(11.5, -11.5),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-W-window-background.png",
width = 80,
height = 137,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(11.5, -11.25),
scale = 0.5
}
}
},
input_fluid_patch_window_flow_sprites =
{
{
north =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-N-fluid-flow.png",
width = 68,
height = 50,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-2, -1),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-N-fluid-flow.png",
width = 136,
height = 99,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-2.5, -0.75),
scale = 0.5
}
},
east =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-E-fluid-flow.png",
width = 41,
height = 70,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-11.5, -11),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-E-fluid-flow.png",
width = 82,
height = 139,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-11.5, -11.25),
scale = 0.5
}
},
south =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-S-fluid-flow.png",
width = 68,
height = 40,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-2, -29),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-S-fluid-flow.png",
width = 136,
height = 80,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-2.5, -29.5),
scale = 0.5
}
},
west =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-W-fluid-flow.png",
width = 42,
height = 70,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(11, -11),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-W-fluid-flow.png",
width = 83,
height = 140,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(10.75, -11),
scale = 0.5
}
}
}
},
input_fluid_patch_window_base_sprites =
{
{
north =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-N-fluid-background.png",
width = 70,
height = 48,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-2, 0),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-N-fluid-background.png",
width = 138,
height = 94,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-2, 0),
scale = 0.5
}
},
east =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-E-fluid-background.png",
width = 42,
height = 70,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-12, -11),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-E-fluid-background.png",
width = 84,
height = 138,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-12, -11),
scale = 0.5
}
},
south =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-S-fluid-background.png",
width = 70,
height = 40,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-2, -29),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-S-fluid-background.png",
width = 138,
height = 80,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(-2, -29),
scale = 0.5
}
},
west =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-W-fluid-background.png",
width = 42,
height = 69,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(12, -10.5),
hr_version =
{
priority = "extra-high",
filename = "__base__/graphics/entity/electric-mining-drill/hr-electric-mining-drill-W-fluid-background.png",
width = 83,
height = 137,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel(11.75, -10.75),
scale = 0.5
}
}
}
},
mining_speed = 0.5,
energy_source =
{
type = "electric",
emissions_per_minute = 10,
usage_priority = "secondary-input"
},
energy_usage = "90kW",
resource_searching_radius = 2.49,
vector_to_place_result = {0, -1.85},
module_specification =
{
module_slots = 3
},
radius_visualisation_picture =
{
filename = "__base__/graphics/entity/electric-mining-drill/electric-mining-drill-radius-visualization.png",
width = 10,
height = 10
},
monitor_visualization_tint = {r=78, g=173, b=255},
fast_replaceable_group = "mining-drill",
circuit_wire_connection_points = circuit_connector_definitions["electric-mining-drill"].points,
circuit_connector_sprites = circuit_connector_definitions["electric-mining-drill"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
},
{
type = "mining-drill",
name = "burner-mining-drill",
icon = "__base__/graphics/icons/burner-mining-drill.png",
icon_size = 64, icon_mipmaps = 4,
flags = {"placeable-neutral", "player-creation"},
resource_categories = {"basic-solid"},
minable = {mining_time = 0.3, result = "burner-mining-drill"},
max_health = 150,
corpse = "burner-mining-drill-remnants",
dying_explosion = "burner-mining-drill-explosion",
collision_box = {{ -0.7, -0.7}, {0.7, 0.7}},
selection_box = {{ -1, -1}, {1, 1}},
damaged_trigger_effect = hit_effects.entity(),
mining_speed = 0.25,
working_sound =
{
sound =
{
{
filename = "__base__/sound/burner-mining-drill.ogg",
volume = 0.6
},
{
filename = "__base__/sound/burner-mining-drill-1.ogg",
volume = 0.6
}
},
--max_sounds_per_type = 3,
fade_in_ticks = 4,
fade_out_ticks = 20
},
open_sound = sounds.machine_open,
close_sound = sounds.machine_close,
vehicle_impact_sound = sounds.generic_impact,
allowed_effects = {}, -- no beacon effects on the burner drill
energy_source =
{
type = "burner",
fuel_category = "chemical",
effectivity = 1,
fuel_inventory_size = 1,
emissions_per_minute = 12,
smoke =
{
{
name = "smoke",
deviation = {0.1, 0.1},
frequency = 3
}
}
},
energy_usage = "150kW",
animations =
{
north =
{
layers =
{
{
priority = "high",
width = 87,
height = 95,
line_length = 4,
shift = util.by_pixel(2.5, 0.5),
filename = "__base__/graphics/entity/burner-mining-drill/burner-mining-drill-N.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
width = 173,
height = 188,
line_length = 4,
shift = util.by_pixel(2.75, 0.5),
filename = "__base__/graphics/entity/burner-mining-drill/hr-burner-mining-drill-N.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
scale = 0.5
}
},
{
priority = "high",
width = 109,
height = 76,
line_length = 4,
shift = util.by_pixel(23.5, -1),
filename = "__base__/graphics/entity/burner-mining-drill/burner-mining-drill-N-shadow.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
draw_as_shadow = true,
hr_version =
{
priority = "high",
width = 217,
height = 150,
line_length = 4,
shift = util.by_pixel(23.75, -1),
filename = "__base__/graphics/entity/burner-mining-drill/hr-burner-mining-drill-N-shadow.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
draw_as_shadow = true,
scale = 0.5
}
}
}
},
east =
{
layers =
{
{
priority = "high",
width = 93,
height = 84,
line_length = 4,
shift = util.by_pixel(2.5, 1),
filename = "__base__/graphics/entity/burner-mining-drill/burner-mining-drill-E.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
width = 185,
height = 168,
line_length = 4,
shift = util.by_pixel(2.75, 1),
filename = "__base__/graphics/entity/burner-mining-drill/hr-burner-mining-drill-E.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
scale = 0.5
}
},
{
priority = "high",
width = 93,
height = 65,
line_length = 4,
shift = util.by_pixel(13.5, 0.5),
filename = "__base__/graphics/entity/burner-mining-drill/burner-mining-drill-E-shadow.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
draw_as_shadow = true,
hr_version =
{
priority = "high",
width = 185,
height = 128,
line_length = 4,
shift = util.by_pixel(13.75, 0.5),
filename = "__base__/graphics/entity/burner-mining-drill/hr-burner-mining-drill-E-shadow.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
draw_as_shadow = true,
scale = 0.5
}
}
}
},
south =
{
layers =
{
{
priority = "high",
width = 87,
height = 87,
line_length = 4,
shift = util.by_pixel(0.5, -0.5),
filename = "__base__/graphics/entity/burner-mining-drill/burner-mining-drill-S.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
width = 174,
height = 174,
line_length = 4,
shift = util.by_pixel(0.5, -0.5),
filename = "__base__/graphics/entity/burner-mining-drill/hr-burner-mining-drill-S.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
scale = 0.5
}
},
{
priority = "high",
width = 88,
height = 69,
line_length = 4,
shift = util.by_pixel(11, 2.5),
filename = "__base__/graphics/entity/burner-mining-drill/burner-mining-drill-S-shadow.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
draw_as_shadow = true,
hr_version =
{
priority = "high",
width = 174,
height = 137,
line_length = 4,
shift = util.by_pixel(11, 2.75),
filename = "__base__/graphics/entity/burner-mining-drill/hr-burner-mining-drill-S-shadow.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
draw_as_shadow = true,
scale = 0.5
}
}
}
},
west =
{
layers =
{
{
priority = "high",
width = 91,
height = 88,
line_length = 4,
shift = util.by_pixel(-1.5, 0),
filename = "__base__/graphics/entity/burner-mining-drill/burner-mining-drill-W.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
hr_version =
{
priority = "high",
width = 180,
height = 176,
line_length = 4,
shift = util.by_pixel(-1.5, 0),
filename = "__base__/graphics/entity/burner-mining-drill/hr-burner-mining-drill-W.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
scale = 0.5
}
},
{
priority = "high",
width = 89,
height = 66,
line_length = 4,
shift = util.by_pixel(7.5, 1),
filename = "__base__/graphics/entity/burner-mining-drill/burner-mining-drill-W-shadow.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
draw_as_shadow = true,
hr_version =
{
priority = "high",
width = 176,
height = 130,
line_length = 4,
shift = util.by_pixel(7.5, 1),
filename = "__base__/graphics/entity/burner-mining-drill/hr-burner-mining-drill-W-shadow.png",
frame_count = 32,
animation_speed = 0.5,
run_mode = "forward-then-backward",
draw_as_shadow = true,
scale = 0.5
}
}
}
}
},
monitor_visualization_tint = {r=78, g=173, b=255},
resource_searching_radius = 0.99,
vector_to_place_result = {-0.5, -1.3},
fast_replaceable_group = "mining-drill",
circuit_wire_connection_points = circuit_connector_definitions["burner-mining-drill"].points,
circuit_connector_sprites = circuit_connector_definitions["burner-mining-drill"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
}
}
)
|
local builder = require("installer/integrations/null_ls/helpers").npm.builder
return builder({
name = "prettier",
install_package = "prettier",
type = { "formatting" },
})
|
return function (x, y, w, h, r, line_width, color)
love.graphics.setLineStyle("smooth")
love.graphics.setLineWidth(line_width)
if color then love.graphics.setColor(color) end
love.graphics.rectangle("line", x, y, w, h, r, r)
end
|
local Modules = script.Parent.Parent.Parent
local Roact = require(Modules.Roact)
local StudioThemeAccessor = require(Modules.Plugin.Components.StudioThemeAccessor)
local Util = require(Modules.Plugin.Util)
local function ScrollingFrame(props)
local children = {}
if props.List then
local listProps = props.List == true and {} or props.List
children.UIListLayout = Roact.createElement(
"UIListLayout",
Util.merge({
SortOrder = Enum.SortOrder.LayoutOrder,
}, listProps)
)
end
for key, value in pairs(props[Roact.Children]) do
children[key] = value
end
return StudioThemeAccessor.withTheme(function(theme, isDarkTheme)
return Roact.createElement("Frame", {
Size = props.Size or UDim2.new(1, 0, 1, 0),
Position = props.Position,
AnchorPoint = props.AnchorPoint,
BorderSizePixel = props.ShowBorder and 1 or 0,
BackgroundColor3 = theme:GetColor("MainBackground"),
BorderColor3 = theme:GetColor("Border"),
LayoutOrder = props.LayoutOrder,
ZIndex = props.ZIndex,
Visible = props.Visible,
ClipsDescendants = true,
[Roact.Ref] = props[Roact.Ref],
}, {
BarBackground = Roact.createElement("Frame", {
BackgroundColor3 = theme:GetColor("ScrollBarBackground"),
Size = UDim2.new(0, 12, 1, 0),
AnchorPoint = Vector2.new(1, 0),
Position = UDim2.new(1, 0, 0, 0),
BorderSizePixel = 0,
}),
ScrollingFrame = Roact.createElement("ScrollingFrame", {
Size = UDim2.new(1, -2, 1, 0),
VerticalScrollBarInset = Enum.ScrollBarInset.Always,
BackgroundTransparency = 1,
BorderSizePixel = 0,
ScrollBarThickness = 8,
TopImage = "rbxasset://textures/StudioToolbox/ScrollBarTop.png",
MidImage = "rbxasset://textures/StudioToolbox/ScrollBarMiddle.png",
BottomImage = "rbxasset://textures/StudioToolbox/ScrollBarBottom.png",
ScrollBarImageColor3 = isDarkTheme and Color3.fromRGB(85, 85, 85) or Color3.fromRGB(245, 245, 245), --theme:GetColor("ScrollBar"),
CanvasSize = UDim2.new(0, 0, 0, 0),
AutomaticCanvasSize = Enum.AutomaticSize.Y,
}, children),
})
end)
end
return ScrollingFrame
|
--[[
Script for adding the extensions menu items.
]]--
function onInit()
registerMenuItems();
end
-- Add menu items to the Settings menu, pertaining to the 5e Combat Enhancer extension.
function registerMenuItems()
OptionsManager.registerOption2("CE_HCW", false, "option_header_5eenhancer", "option_actor_health_widget_conditions", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "on" })
OptionsManager.registerOption2("CE_ARM", false, "option_header_5eenhancer", "option_automatic_ranged_modifiers", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "on" })
OptionsManager.registerOption2("CE_BOT", false, "option_header_5eenhancer", "option_blood_on_tokens", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "on" })
OptionsManager.registerOption2("CE_BP", false, "option_header_5eenhancer", "option_blood_pool", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "on" })
OptionsManager.registerOption2("CE_HHB", false, "option_header_5eenhancer", "option_horizontal_health_bars", "option_entry_cycler",
{ labels = "Off|Left, Default|Left, Taller|Centered, Default|Centered, Taller", values = "option_off|option_v1|option_v2|option_v3|option_v4", default = "option_off" })
OptionsManager.registerOption2("CE_LHD", false, "option_header_5eenhancer", "option_larger_health_dots", "option_entry_cycler",
{ labels = "Off|Larger|Largest", values = "option_off|option_larger|option_largest", default = "option_larger" })
OptionsManager.registerOption2("CE_TRA", false, "option_header_5eenhancer", "option_token_rotation_with_alt", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "on" })
OptionsManager.registerOption2("CE_SRU", false, "option_header_5eenhancer", "option_show_reach_underlay", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "on" })
OptionsManager.registerOption2("CE_SFU", false, "option_header_5eenhancer", "option_show_faction_underlay", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "on" })
OptionsManager.registerOption2("CE_SC", false, "option_header_5eenhancer", "option_skull_or_cross", "option_entry_cycler",
{ labels = "Off|Skull|Cross", values = "option_off|option_skull|option_cross", default = "option_skull" })
-- OptionsManager.registerOption2("CE_STR", false, "option_header_5eenhancer", "option_stop_token_rotate", "option_entry_cycler",
-- { labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "off" })
OptionsManager.registerOption2("CE_TRBC", false, "option_header_5eenhancer", "option_token_remove_button_combo", "option_entry_cycler",
{ labels = "Alt + L-Click|Alt + Shift + L-Click", values = "option_val_alt|option_val_alt_shift", default = "option_val_alt" })
OptionsManager.registerOption2("CE_HFS", false, "option_header_5eenhancer", "option_height_font_size", "option_entry_cycler",
{ labels = "small|medium|large", values = "option_small|option_medium|option_large", default = "option_medium" })
OptionsManager.registerOption2("CE_SAAU", false, "option_header_5eenhancer", "option_gm_underlay_show_ct_active_actor_underlay", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "off" })
OptionsManager.registerOption2("CE_UOP", false, "option_header_5eenhancer", "option_gm_underlay_opacity", "option_entry_cycler",
{ labels = "100%|90%|80%|70%|60%|50%|40%|30%|20% (best)|10%", values = "100|90|80|70|60|50|40|30|20|10", default = "20" })
OptionsManager.registerOption2("CE_US", false, "option_header_5eenhancer", "option_gm_underlay_size", "option_entry_cycler",
{ labels = "full|half", values = "option_full|option_half", default = "option_full" })
OptionsManager.registerOption2("CE_FR", false, "option_header_5eenhancer", "option_flanking_rules", "option_entry_cycler",
{ labels = "Advantage|+1|+2|+5", values = "option_val_on|option_val_1|option_val_2|option_val_on_5", baselabel = "option_val_off", baseval = "option_val_off", default = "option_val_off" })
OptionsManager.registerOption2("CE_RMM", false, "option_header_5eenhancer", "option_ranged_melee_modifier", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "on" })
-- OptionsManager.registerOption2("CE_RRU", false, "option_header_5eenhancer", "option_range_rules_used", "option_entry_cycler",
-- { labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "off" })
OptionsManager.registerOption2("CE_SNIA", false, "option_header_5eenhancer", "option_skip_non_initiatived_actor", "option_entry_cycler",
{ labels = "option_val_on", valueSs = "on", baselabel = "option_val_off", baseval = "off", default = "off" })
OptionsManager.registerOption2("CE_STG", false, "option_header_5eenhancer", "option_saving_throw_graphics", "option_entry_cycler",
{ labels = "option_val_on", values = "on", baselabel = "option_val_off", baseval = "off", default = "on" })
-- Window Resize menu options
OptionsManager.registerOption2("IM_BG", false, "option_header_5eenhancher_window_resizing", "option_backgrounds", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_CLASS", false, "option_header_5eenhancher_window_resizing", "option_classes", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_NPCPOWER", false, "option_header_5eenhancher_window_resizing", "option_npc_powers", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_FEAT", false, "option_header_5eenhancher_window_resizing", "option_feats", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_ITEM", false, "option_header_5eenhancher_window_resizing", "option_items", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_NOTE", false, "option_header_5eenhancher_window_resizing", "option_notes", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_NPC", false, "option_header_5eenhancher_window_resizing", "option_npc", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_PCA", false, "option_header_5eenhancher_window_resizing", "option_pc_ability", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_RACE", false, "option_header_5eenhancher_window_resizing", "option_races", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_SKILL", false, "option_header_5eenhancher_window_resizing", "option_skills", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_STORY", false, "option_header_5eenhancher_window_resizing", "option_story", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_SPELL", false, "option_header_5eenhancher_window_resizing", "option_spells", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
OptionsManager.registerOption2("IM_QUEST", false, "option_header_5eenhancher_window_resizing", "option_quests", "option_entry_cycler",
{ labels = "default|larger", values = "option_default|option_larger", default = "option_default" })
end |
--[[
Simple Anti MapHack for Starcraft: BroodWar 1.16.1
Copyright (C) 2014 HarpyWar (harpywar@gmail.com)
This file is a part of the PvPGN Project http://pvpgn.pro
Licensed under the same terms as Lua itself.
]]--
-- just unique request id for maphack
ah_mh_request_id = 99
-- map visible offset
ah_mh_offset = 0x0047FD12
-- map visible normal value (without maphack)
ah_mh_value = 139
function ah_init()
timer_add("ah_timer", config.ah_interval, ah_timer_tick)
INFO("Starcraft Antihack activated")
end
-- send memory check request to all players in games
function ah_timer_tick(options)
-- iterate all games
for i,game in pairs(api.server_get_games()) do
-- check only Starcraft: BroodWar
if game.clienttag and (game.clienttag == CLIENTTAG_BROODWARS) then
-- check only games where count of players > 1
if game.players and (substr_count(game.players, ",") > -1) then
--DEBUG(game.players)
-- check every player in the game
for username in string.split(game.players,",") do
api.client_readmemory(username, ah_mh_request_id, ah_mh_offset, 2)
-- HINT: place here more readmemory requests
end
end
end
end
end
-- handle response from the client
function ah_handle_client(account, request_id, data)
local is_cheater = false
-- maphack
if (request_id == ah_mh_request_id) then
-- read value from the memory
local value = bytes_to_int(data, 0, 2)
--TRACE(account.name .. " memory value: " .. value)
if not (value == ah_mh_value) then
is_cheater = true
end
-- process another hack check
--elseif (request_id == ...) then
end
if (is_cheater) then
-- lock cheater account
account_set_auth_lock(account.name, true)
account_set_auth_lockreason(account.name, "we do not like cheaters")
-- notify all players in the game about cheater
local game = api.game_get_by_id(account.game_id)
if game then
for username in string.split(game.players,",") do
api.message_send_text(username, message_type_error, nil, account.name .. " was banned by the antihack system.")
end
end
-- kick cheater
api.client_kill(account.name)
INFO(account.name .. " was banned by the antihack system.")
end
end
|
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
ui_page('html/index.html')
files({
'html/index.html',
'html/script.js',
'html/style.css',
'html/img/burger.png',
'html/img/bottle.png',
'html/img/donuts.png',
'html/img/biere.png',
'html/img/absinthe.png',
'html/img/champagne.png',
'html/img/chips.png',
'html/img/choco.png',
'html/img/cocacola.png',
'html/img/cafe.png',
'html/img/cupcake.png',
'html/img/tonic.png',
'html/img/sprunk.png',
'html/img/lait.png',
'html/img/vin.png',
'html/img/sandwich.png',
'html/img/tequila.png',
'html/img/vodka.png',
'html/img/whisky.png',
'html/img/phone.png',
'html/img/sim.png',
'html/img/cru.png',
'html/img/jusraisin.png',
'html/img/kit.png',
'html/img/croq.png',
'html/img/cig.png',
'html/font/vibes.ttf',
'html/img/box.png',
'html/img/carticon.png',
})
client_scripts {
'config.lua',
'client/main.lua',
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'locales/sv.lua',
}
server_scripts {
'config.lua',
'server/main.lua',
'@mysql-async/lib/MySQL.lua'
}
|
ys = ys or {}
ys.Battle.BattleBuffBulletPierce = class("BattleBuffBulletPierce", ys.Battle.BattleBuffEffect)
ys.Battle.BattleBuffBulletPierce.__name = "BattleBuffBulletPierce"
ys.Battle.BattleBuffBulletPierce.Ctor = function (slot0, slot1)
slot0.Battle.BattleBuffBulletPierce.super.Ctor(slot0, slot1)
end
ys.Battle.BattleBuffBulletPierce.SetArgs = function (slot0, slot1, slot2)
slot0._number = slot0._tempData.arg_list.number
slot0._rate = slot0._tempData.arg_list.rate
slot0._bulletType = slot0._tempData.arg_list.bulletType or 0
end
ys.Battle.BattleBuffBulletPierce.onBulletCreate = function (slot0, slot1, slot2, slot3)
slot4 = slot3._bullet
if slot0:IsHappen(tonumber(slot0._rate)) and (slot0._bulletType == slot4._tempData.type or slot0._bulletType == 0) then
slot4._pierceCount = slot0._number
end
end
return
|
local items = {}
for _, file in ipairs(love.filesystem.getDirectoryItems("assets/items")) do
local itemList = dofile("assets/items/" .. file)
for name, i in pairs(itemList) do
items[name] = i
end
end
return items
|
local UnityEngine = require "LuaRoot.lib.unity_engine"
local GameObject = UnityEngine.GameObject
local MeshFilter = UnityEngine.MeshFilter
local Resources = UnityEngine.Resources
local Mesh = UnityEngine.Mesh
local Vector3 = UnityEngine.Vector3
local MeshRenderer = UnityEngine.MeshRenderer
local Material = UnityEngine.Material
local function create()
local component
local mesh = Resources.Load("Mesh/Quad1x1W1L1VC", Mesh._Type())
local material = Resources.Load("Material/Sprite", Material._Type())
local unity_obj = GameObject._New("HERO")
component = unity_obj:AddComponent(MeshFilter._Type())
local mesh_filter = MeshFilter._ConvertFrom(component)
print("mesh_filter:", mesh_filter:ToString())
print("mesh_filter.mesh:", mesh_filter.mesh)
mesh_filter.sharedMesh = Mesh._ConvertFrom(mesh)
unity_obj.transform.localScale = Vector3._New(128,128,128)
component = unity_obj:AddComponent(MeshRenderer._Type())
local mesh_renderer = MeshRenderer._ConvertFrom(component)
mesh_renderer.castShadows = false
mesh_renderer.receiveShadows = false
mesh_renderer.material = Material._ConvertFrom(material)
local mt = {
__index = {
move = function(self, x, y)
local unity_obj = rawget(self, "__unity_obj")
unity_obj.transform.localPosition = Vector3._New(x, y, 0)
end
},
__newindex = function(self, key, value)
end,
}
return setmetatable({
__unity_obj = unity_obj,
}, mt)
end
return {
create = create,
}
|
if m_simpleTV.User == nil then m_simpleTV.User = {} end
if m_simpleTV.User.WestSide == nil then m_simpleTV.User.WestSide = {} end
if m_simpleTV.User.WestSide.info == nil then m_simpleTV.User.WestSide.info = 0 end
if m_simpleTV.User.WestSide.info == 0 then
m_simpleTV.Control.ExecuteAction(161,0) --KEY_OSD_SHOW_CURRENT_EPG_DESC
m_simpleTV.Control.ExecuteAction(65,0) --CHANNEL_INFO_OSD
m_simpleTV.Control.ExecuteAction(36,1) --KEYOSDCURPROG
elseif m_simpleTV.User.WestSide.info == 1 then
m_simpleTV.Control.ExecuteAction(161,0) --KEY_OSD_SHOW_CURRENT_EPG_DESC
m_simpleTV.Control.ExecuteAction(65,1) --CHANNEL_INFO_OSD
m_simpleTV.Control.ExecuteAction(36,0) --KEYOSDCURPROG
elseif m_simpleTV.User.WestSide.info >= 2 then
m_simpleTV.Control.ExecuteAction(36,0) --KEYOSDCURPROG
m_simpleTV.Control.ExecuteAction(161,1) --KEY_OSD_SHOW_CURRENT_EPG_DESC
m_simpleTV.Control.ExecuteAction(65,0) --CHANNEL_INFO_OSD
--elseif m_simpleTV.User.WestSide.info >= 3 then
-- m_simpleTV.Control.ExecuteAction(36,0) --KEYOSDCURPROG
-- m_simpleTV.Control.ExecuteAction(65,0) --CHANNEL_INFO_OSD
-- m_simpleTV.Control.ExecuteAction(161,0) --KEY_OSD_SHOW_CURRENT_EPG_DESC
-- show_portal_window() --KEY_OSD_SHOW_PORTAL_INFO
m_simpleTV.User.WestSide.info = -1
end
m_simpleTV.User.WestSide.info = m_simpleTV.User.WestSide.info + 1
--m_simpleTV.OSD.ShowMessageT({text='info: ' .. m_simpleTV.User.WestSide.info,id='wsInfo'})
|
--------------------------------------------------------
-- Frame Saving & Loading
--------------------------------------------------------
local EGP = EGP
EGP.Frames = {}
function EGP:SaveFrame( ply, Ent, index )
if (!EGP.Frames[ply]) then EGP.Frames[ply] = {} end
EGP.Frames[ply][index] = table.Copy(Ent.RenderTable)
end
function EGP:LoadFrame( ply, Ent, index )
if (!EGP.Frames[ply]) then EGP.Frames[ply] = {} return false end
if (SERVER) then
local bool = (EGP.Frames[ply][index] != nil)
if (!bool) then return false end
return true, table.Copy(EGP.Frames[ply][index])
else
local frame = EGP.Frames[ply][index]
if (!frame) then return false end
Ent.RenderTable = table.Copy(frame)
Ent:EGP_Update()
end
end
|
function PLUGIN:PlayerShouldGetHungry(ply)
if ply:IsAdmin() and ply:GetMoveType() == MOVETYPE_NOCLIP then
return false
end
end |
--Minetest 0.4.7 mod: concrete
--(c) 2013 by RealBadAngel <mk@realbadangel.pl>
local technic = rawget(_G, "technic") or {}
technic.concrete_posts = {}
-- Boilerplate to support localized strings if intllib mod is installed.
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
for i = 0, 31 do
minetest.register_alias("technic:concrete_post"..i,
"technic:concrete_post")
end
for i = 32, 63 do
minetest.register_alias("technic:concrete_post"..i,
"technic:concrete_post_with_platform")
end
local steel_ingot
if minetest.get_modpath("technic_worldgen") then
steel_ingot = "technic:carbon_steel_ingot"
else
steel_ingot = "default:steel_ingot"
end
minetest.register_craftitem(":technic:rebar", {
description = S("Rebar"),
inventory_image = "technic_rebar.png",
})
minetest.register_node(":technic:concrete", {
description = S("Concrete Block"),
tiles = {"technic_concrete_block.png",},
groups = {cracky=1, level=2, concrete=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node(":technic:blast_resistant_concrete", {
description = S("Blast-resistant Concrete Block"),
tiles = {"technic_blast_resistant_concrete_block.png",},
groups = {cracky=1, level=3, concrete=1},
sounds = default.node_sound_stone_defaults(),
on_blast = function(pos, intensity)
if intensity > 1 then
minetest.remove_node(pos)
minetest.add_item(pos, "technic:blast_resistant_concrete")
end
end,
})
local box_platform = {-0.5, 0.3, -0.5, 0.5, 0.5, 0.5}
local box_post = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
local box_front = {-0.1, -0.3, 0, 0.1, 0.3, -0.5}
local box_back = {-0.1, -0.3, 0, 0.1, 0.3, 0.5}
local box_left = {0, -0.3, -0.1, -0.5, 0.3, 0.1}
local box_right = {0, -0.3, -0.1, 0.5, 0.3, 0.1}
minetest.register_node(":technic:concrete_post_platform", {
description = S("Concrete Post Platform"),
tiles = {"technic_concrete_block.png",},
groups={cracky=1, level=2},
sounds = default.node_sound_stone_defaults(),
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {box_platform}
},
on_place = function (itemstack, placer, pointed_thing)
local node = minetest.get_node(pointed_thing.under)
if node.name ~= "technic:concrete_post" then
return minetest.item_place_node(itemstack, placer, pointed_thing)
end
minetest.set_node(pointed_thing.under, {name="technic:concrete_post_with_platform"})
itemstack:take_item()
placer:set_wielded_item(itemstack)
return itemstack
end,
})
for platform = 0, 1 do
local after_dig_node = nil
if platform == 1 then
after_dig_node = function(pos, old_node)
old_node.name = "technic:concrete_post"
minetest.set_node(pos, old_node)
end
end
minetest.register_node(":technic:concrete_post"..(platform == 1 and "_with_platform" or ""), {
description = S("Concrete Post"),
tiles = {"technic_concrete_block.png"},
groups = {cracky=1, level=2, concrete_post=1, not_in_creative_inventory=platform},
sounds = default.node_sound_stone_defaults(),
drop = (platform == 1 and "technic:concrete_post_platform" or
"technic:concrete_post"),
paramtype = "light",
sunlight_propagates = true,
drawtype = "nodebox",
connects_to = {"group:concrete", "group:concrete_post"},
node_box = {
type = "connected",
fixed = {box_post, (platform == 1 and box_platform or nil)},
connect_front = box_front,
connect_back = box_back,
connect_left = box_left,
connect_right = box_right,
},
after_dig_node = after_dig_node,
})
end
|
local g = vim.g
local xdg_base = vim.fn['hz#xdg_base']
-- Share tags cache between vim and gvim
g.gutentags_cache_dir = xdg_base('cache', 'tags')
|
-----------------------------------------
-- INFORMATION
-----------------------------------------
--[[
Each quest has many different Main steps
Each Main step can have many steps
each step can have many conditions
Main steps are not actually created by ZOS
--]]
-----------------------------------------
-- LOCALIZED GLOBAL VARIABLES
-----------------------------------------
local ZGV = _G.ZGV
local tinsert,type, ipairs = table.insert, type, ipairs
local Data = ZGV.Data
local MakeExcerpt = ZGV.Utils.MakeExcerpt
local MatchExcerpt = ZGV.Utils.MatchExcerpt
local d = _G.d
local GetJournalQuestNumSteps = _G.GetJournalQuestNumSteps
local GetJournalQuestStepInfo = _G.GetJournalQuestStepInfo
local EMPTY_STRING = _G.EMPTY_STRING
local GetJournalQuestNumConditions = _G.GetJournalQuestNumConditions
local GetJournalQuestConditionInfo = _G.GetJournalQuestConditionInfo
local GetJournalQuestInfo = _G.GetJournalQuestInfo
-- Saved Variables initialized at startup
local svchardata, savedquests, svcompletedquests
-- Classes
local Quest = ZGV.Class:New("Quest")
local Quest_mt = { __index = Quest }
local Quests = ZGV.Class:New("Quests")
local Quests_mt = { __index = Quest }
local QuestStep = ZGV.Class:New("QuestStep")
local QuestStep_mt = { __index = QuestStep }
local QuestCondition = ZGV.Class:New("QuestCondition")
local QuestCondition_mt = { __index = QuestCondition }
local QuestReward = ZGV.Class:New("QuestReward")
local QuestReward_mt = { __index = QuestReward }
local PrefixPairs = _G.PrefixPairs
local GetByPrefix = _G.GetByPrefix
local MAX_JOURNAL_QUESTS = _G.MAX_JOURNAL_QUESTS
local IsValidQuestIndex = _G.IsValidQuestIndex
local GetJournalQuestName = _G.GetJournalQuestName
-- Enums
local questTypes = {}
for k,v in PrefixPairs("QUEST_TYPE") do
questTypes[v] = k:gsub("QUEST_TYPE_","")
end
local questStepTypes = {}
for k,v in PrefixPairs("QUEST_STEP_TYPE") do
questStepTypes[v] = k:gsub("QUEST_STEP_TYPE_","")
end
local questConditionTypes = {}
for k,v in PrefixPairs("QUEST_CONDITION_TYPE") do
questConditionTypes[v] = k:gsub("QUEST_CONDITION_TYPE_","")
end
local questRewardTypes = {}
for k,v in PrefixPairs("REWARD_TYPE") do
questRewardTypes[v] = k:gsub("REWARD_TYPE_","")
end
local stepVisibilityTypes = {}
for k,v in PrefixPairs("QUEST_STEP_VISIBILITY") do
stepVisibilityTypes[v] = k:gsub("QUEST_STEP_VISIBILITY_","")
end
-----------------------------------------
-- SAVED REFERENCES
-----------------------------------------
ZGV.Quests = Quests
ZGV.QuestProto = Quest
ZGV.completedQuests = {}
Quests.questTypes = questTypes
Quests.questStepTypes = questStepTypes
Quests.questConditionTypes = questConditionTypes
Quests.questRewardTypes = questRewardTypes
Quests.stepVisibilityTypes = stepVisibilityTypes
_G['ZQuest']=Quest
_G['ZQuestStep']=QuestStep
_G['ZQuestCondition']=QuestCondition
-----------------------------------------
-- LOAD TIME SETUP
-----------------------------------------
-- Setup a metatable for easier access to completed quests.
setmetatable(ZGV.completedQuests,{
__index = function(self,ind) return Quests:IsQuestComplete(ind) end,
__call = function(self,...) return Quests:IsQuestComplete(...) end
})
-----------------------------------------
-- QUESTS FUNCTIONS
-----------------------------------------
-- These are supposed to be the ONLY public functions, since there's virtually zero need to interface
-- with all the Step/Condition mechanics from outside.
Quests.journal = {}
function Quests:FindQuest(questName)
if not questName then return end
for i = 1,MAX_JOURNAL_QUESTS do
if IsValidQuestIndex(i) then
local name = GetJournalQuestName(i)
if name == questName then
return i
end
end
end
end
function Quests:HasQuest(id)
return not not self:FindQuest(id)
end
function Quests:RemoveQuest(journalIndex)
if type(journalIndex)=="string" then
journalIndex = self:FindQuest(journalIndex)
end
self.journal[journalIndex]=nil
end
function Quests:Clear()
ZGV.Utils.table_wipe_keys(Quests.journal)
end
-- Load quest from journal into Quests, so that we can update and check its progress and shit.
-- Used on startup and in "quest added" events.
function Quests:GetQuest(journalIndex,is_retry) -- or questname
local questname
if type(journalIndex) == "string" then
questname = journalIndex
journalIndex = self:FindQuest(questname)
end
if not journalIndex then return end
local quest = self.journal[journalIndex]
if quest and questname and quest.name~=questname then -- Whoa, journal changed, title mismatch!
if is_retry then
return nil
end -- failed to retry
self:UpdateJournal()
return self:GetQuest(questname,"retry")
end
if not quest then
-- Quest isn't in our table for this session, lets try to get it from our data first. If not in data (include SV) then create new.
quest = Quest:New(journalIndex)
self.journal[journalIndex] = quest
end
return quest
end
function Quests:UpdateQuest(journalIndex)
local quest = Quests:GetQuest(journalIndex)
if quest then
quest:FillFromJournal()
end
-- TODO... or will this suffice?
end
--PUBLIC
function Quests:SetConditionCoords(journalIndex,stepnum,condnum, typ,m,x,y,r,b1,b2)
local GetByPrefix = _G.GetByPrefix
if not journalIndex or not stepnum or not condnum then
error("Quests:SetConditionCoords without journalIndex, stepnum or condnum")
end
local quest = Quests:GetQuest(journalIndex)
if not quest then return end -- shouldn't happen!
if quest.steps[stepnum] ~= nil then
local step = quest.steps[stepnum]
if not step then return end
local cond = step.conditions[condnum]
if not cond then return end
cond.coords = { pinType = GetByPrefix("MAP_PIN_TYPE",typ) or typ, map = m, x = x, y = y, r = r, b1 = b1, b2 = b2 }
--ZGV:Debug(("&quest Got coords for quest |cffffff%s|r step |cffffff%d|r cond |cffffff%d|r: %d %.3f %.3f %.3f %s %s"):format(quest.name,step.num,cond.num,typ,x,y,r, tostring(b1),tostring(b2)))
end
end
--PUBLIC though legacy
function Quests:IsQuestComplete(questid)
return ZGV.QuestTracker:IsQuestComplete(questid)
end
--PUBLIC
-- This is the powerhorse. Returns: complete,possible,explanation,...
-- v1.1 stripped
function Quests:GetCompletionStatus(qname,condtxt)
ZGV:Debug("&quest GetCompletionS |cffeeaa%s|r / |cffaaee%s|r",qname or "", condtxt or "")
-- QUEST: COMPLETE? Perhaps it's all done?
local isComplete = self:IsQuestComplete(qname)
if isComplete then
return true,true,"quest complete"
end -- Whole quest is complete. Cheers.
-- ... if not, keep checking.
-- Check quest in journal.
local quest = self:GetQuest(qname)
if not quest then
return false,false,"not in journal"
end
if quest:HasRecentlyCompletedCondition(condtxt) then
return true,true,"cond recently completed"
end
--
-- STEP: PINPOINT. Use condtxt if need be.
local stepnum,condnum = quest:FindStepCond(condtxt)
if not stepnum then
return false,false,"no step matched",condtxt
end -- no step? too bad.
local step = quest.steps[stepnum]
if not step then
return false,false,"no step found"
end
-- ... if we have a step, carry on!
local complete,possible = step:IsComplete()
if complete then
return complete,possible,"step completion"
end
-- COND: PINPOINT (if we haven't already, when trying to find the step.)
local cond = condnum and step.conditions and step.conditions[condnum]
if not cond then
local complete,possible = step:IsComplete()
return complete,possible,"step overrides cond"
end -- no condition? too bad.
-- Hallelujah, we have the condition nailed!
local complete,possible,curv,maxv = cond:GetCompletion()
return complete,possible,"cond completion",curv,maxv, ("|c00aaff%s|cffffff step |c00ffaa%d|cffffff cond |c00ffaa%d |c00aaff%s|r"):format(qname, stepnum,condnum, condtxt or "?")
end
function Quests:UpdateJournal()
self:Clear()
for ji = 1,MAX_JOURNAL_QUESTS do
if IsValidQuestIndex(ji) then
self:GetQuest(ji) -- This loads all our current quests into ZGV.Quests
end
end
end
-----------------------------------------
-- QUEST DATA FUNCTIONS
-----------------------------------------
function Quest:New(journalIndex)
if not journalIndex then
error("Quest:New(nil) !?")
end
local name = GetJournalQuestName(journalIndex)
local quest={
name=name,
id=Data:GetQuestIdByName(name),
steps={},
}
setmetatable(quest,Quest_mt)
quest:FillFromJournal(journalIndex)
return quest
end
-- /dump ZGV.Quests:GetCompletionStatus("Finding the Family",nil,1)
local ShowFloatingMessage = ZGV.Utils.ShowFloatingMessage
-- Create a new Quest object (from current journal data) to put in ZGV.Quests.
function Quest:FillFromJournal(journalIndex)
if not journalIndex then
journalIndex = self:GetJournalIndex()
if not journalIndex then
self.steps = nil
return
end
end
local questName, backgroundText, activeStepText, activeStepType, activeStepTrackerOverrideText, completed, tracked, questLevel, pushed, questType = GetJournalQuestInfo(journalIndex)
if questName == "" then
return false
end
if questName ~= self.name then
if ZGV.DEV then
d("What..? Quest journalIndex="..journalIndex.." has name "..questName..", expected "..(self.name or "?"))
end
return
end
self.name = questName
self.level = questLevel
self.bgtext = backgroundText
self.questType = questTypes[questType] or questType
if self.steps and self.activeStepText ~= activeStepText then -- make "new" step
self.oldsteps = self.steps
end
-- fill
self.steps = {}
for stepnum=1,GetJournalQuestNumSteps(journalIndex) do
local step = self.steps[stepnum] or QuestStep:New()
local ok = step:FillFromJournal(journalIndex,stepnum)
if ok and (not self.steps[stepnum] or self.steps[stepnum].text~=step.text) then
step.parentQuest = self
self.steps[stepnum]=step
end
end
self.activeStepText = activeStepText
return self
end
local function textmatch(subject,test)
if not subject or not test then
return false
end
if subject == test then
return true
end
local zo_plainstrfind = _G.zo_plainstrfind
if zo_plainstrfind(test,"*") and subject:match(test) then
return true
end
return false
end
-- Check which CURRENT step/condition this textual objective belongs to.
function Quest:FindStepCond(condtxt)
for snum,s in ipairs(self.steps) do
if textmatch(s.trackerText,condtxt)
then return snum,0
end -- trackerText matched?
if s.conditions then
for cnum,c in ipairs(s.conditions) do
if textmatch(c.text,condtxt) then
return snum,cnum
end
end
end
end
return nil,nil
end
-- Check which CURRENT step/condition this textual objective belongs to.
function Quest:HasRecentlyCompletedCondition(condtxt)
if not self.oldsteps then
return false
end
for snum,s in ipairs(self.oldsteps) do
if textmatch(s.trackerText,condtxt) then
return true
end -- trackerText matched?
if s.conditions then
for cnum,c in ipairs(s.conditions) do
if textmatch(c.text,condtxt) then
return true
end
end
end
end
return false
end
---------------- QUEST DATA DUMPS --------------------------
function Quest:Dump_OLD_StageSnapshot(strict)
local snap = {}
tinsert(snap,("Q1 %s"):format(MakeExcerpt(self.bgtext)))
local ji = self:GetJournalIndex()
local trackered
for si = 1,GetJournalQuestNumSteps(ji) do
local steptext,visibility,steptype,tracker,numcond = GetJournalQuestStepInfo(ji,si)
if steptext == EMPTY_STRING then
steptext = "NO TEXT"
end
tinsert(snap,("S%d %s%s"):format(si,strict and "== " or "",MakeExcerpt(steptext)))
if tracker and tracker ~= EMPTY_STRING then
tinsert(snap,("S%dC0 %s%s"):format(si,"== ",MakeExcerpt(tracker)))
trackered = true
end
for ci = 1,GetJournalQuestNumConditions(ji,si) do
local conditionText,current,maxv,isFailCondition,isComplete,isCreditShared = GetJournalQuestConditionInfo(ji,si,ci)
conditionText = conditionText:gsub(ZGV.Utils.quest_cond_counts,"")
tinsert(snap,("S%dC%d %s%s"):format(si,ci,(strict or ((si == 1 and ci == 1) and not trackered)) and "== " or "", MakeExcerpt(conditionText)))
end
end
return snap
end
function Quest:DumpQuestStructure()
local qi=self:GetJournalIndex()
local title,bgtext,asteptxt,asteptype,astepoverride,_,_,_ = GetJournalQuestInfo(qi)
local ret = {}
tinsert(ret,(("%d. |cffffff%s"):format(qi,title)))
for si=1,GetJournalQuestNumSteps(qi) do
local steptext,visibility,steptype,tracker,numcond = GetJournalQuestStepInfo(qi,si)
if steptext == EMPTY_STRING then
steptext = "NO TEXT"
end
tinsert(ret,("- Step %d. |cffeedd%s|r |c008800(|c00aa00%s|c008800)|r%s"):format(
si,steptext,
GetByPrefix("QUEST_STEP_TYPE",steptype,true),
visibility and (" |c0088ff[|c33aaff%s|c0088ff]|r"):format(GetByPrefix("QUEST_STEP_VISIBILITY",visibility,true) or visibility) or ""
))
if tracker ~= EMPTY_STRING then
tinsert(ret,("' = tracker: |cffaa00%s|r"):format(tracker))
end
for ci = 1,GetJournalQuestNumConditions(qi,si) do
local conditionText,current,max,isFailCondition,isComplete,isCreditShared = GetJournalQuestConditionInfo(qi,si,ci)
conditionText = conditionText:gsub(ZGV.Utils.quest_cond_counts,"")
tinsert(ret,("- - Cond %d. |cffeebb%s|r |c888888(%d/%d)|r%s"):format(ci,conditionText,current,max,(isFailCondition and " |cff0000(FAIL)" or "")..(isComplete and " |c00ff00(COMPLETE)" or "")))
end
end
return ret
end
function Quest:DumpQuestStructure_Print()
d(self:DumpQuestStructure())
end
function Quest:_TODO_DumpReport_TODO_rework_into_oldsteps()
self.recentStages = self.recentStages or {}
local recent = #self.recentStages>0 and table.concat(self.recentStages,",") or "unknown"
local s = "--- QUEST STAGE REPORT ---\n"
s = s .. ("QUEST: %s ##%d\n"):format(self.name,self.id)
local currentStage = _G.currentStage
if currentStage then
s = s .. "CURRENT STAGE:\n"
else
s = s .. ([[RECENT STAGES: %s
CURRENT QUEST STATE:
]]):format(recent)
end
local lastrecent = self.recentStages[#self.recentStages]
s = s .. (" [%d] = {\n"):format(tonumber(lastrecent) and lastrecent+1 or 0)
for i,r in ipairs(self:DumpStageSnapshot()) do
s = s .. (" [[%s]],"):format(r)
--if r:match("STAGE %d") then s = s .. " --MAYBE" end
s = s .. "\n";
end
s = s .. " },"
return s
end
-----------------------------------------
-- QUEST CLASS FUNCTIONS
-----------------------------------------
function Quest:GetJournalIndex()
return Quests:FindQuest(self.name or "") or (ZGV:Debug("Journal for quest "..(self.name or "?").." unknown!?") and nil)
end
function Quest:GetText()
return self.steps and self.steps[1] and self.steps[1].text or "NO TEXT??"
end
function Quest:tostring()
return "Quest: "..(self.name or "")
end
-----------------------------------------
-- QUESTSTEP CLASS FUNCTIONS
-----------------------------------------
function QuestStep:New()
local step = {
conditions = {},
}
setmetatable(step,QuestStep_mt)
return step
end
function QuestStep:FillFromJournal(journalIndex, stepIndex) -- MAKE SURE WE'RE ON THAT STAGE!
journalIndex = journalIndex or self.parentQuest:GetJournalIndex()
stepIndex = stepIndex or self.num
if not journalIndex or not stepIndex then
error("Step:FillFromJournal() no journalindex or stepnum given or found")
end
local steptext, visibility, stepType, trackerOverrideText, numConditions = GetJournalQuestStepInfo(journalIndex, stepIndex)
if steptext == EMPTY_STRING then
steptext = "NO TEXT"
end
if trackerOverrideText == EMPTY_STRING then
trackerOverrideText = nil
end
self.num = stepIndex
self.text = steptext
self.stepType = questStepTypes[stepType] or stepType
self.visibility = stepVisibilityTypes[visibility] or visibility
self.trackerText = trackerOverrideText
self.num = stepIndex
self:FillConditionsFromJournal(journalIndex,self.num)
return self
end
function QuestStep:FillConditionsFromJournal(journalIndex, stepIndex) -- indexes optional, step may already know them
if (not journalIndex or not stepIndex) then
if not self.parentQuest then return end
journalIndex = self.parentQuest:GetJournalIndex() -- REGARDLESS whether the stage is current or not!!!
if not journalIndex then
error("We don't have the quest!?")
end -- we don't have that quest?? WTF?
end
stepIndex = stepIndex or self.num
self.num = stepIndex
for condNum=1,GetJournalQuestNumConditions(journalIndex, stepIndex) do
local condition = self.conditions[condNum] or QuestCondition:New()
local ok = condition:FillFromJournal(journalIndex, stepIndex, condNum)
if ok then
condition.parentStep = self
self.conditions[condNum]=condition
end
end
return self
end
function QuestStep:GetQuestJournalIndex()
return self.parentQuest and self.parentQuest:GetJournalIndex()
end
function QuestStep:IsComplete()
if self.stepType=="END" and self.visibility=="HIDDEN" and #self.conditions==0 then
return true,true
end
if self.stepType=="END" then
return false,true
end
for ci,cond in ipairs(self.conditions) do
local complete,possible=cond:GetCompletion()
if complete and self.stepType=="OR" then
return true,true
end
if not complete and self.stepType=="AND" then
return false,true
end
end
return self.stepType == "AND",true
end
function QuestStep:tostring()
return "Step: "..(self.text or "")
end
-----------------------------------------
-- QUESTCONDITION CLASS FUNCTIONS
-----------------------------------------
function QuestCondition:New()
local condition = {}
setmetatable(condition,QuestCondition_mt)
return condition
end
function QuestCondition:FillFromJournal(journalIndex, stepIndex, conditionIndex) -- MAY NOT BE CURRENT STAGE. Use with caution.
if not journalIndex or not stepIndex and self.num and self.parentStep then
journalIndex = self:GetQuestJournalIndex()
if not journalIndex then return end -- we don't have that quest...
conditionIndex = self.num
stepIndex = self.parentStep.num
end
self.num=conditionIndex
local conditionText, current, maxval, isFailCondition, isComplete, isCreditShared = GetJournalQuestConditionInfo(journalIndex, stepIndex, conditionIndex)
conditionText = conditionText:gsub(ZGV.Utils.quest_cond_counts,"")
local condType = _G.GetJournalQuestConditionType(journalIndex, stepIndex, conditionIndex)
if conditionText=="" and current==0 and maxval==0 then
return false
end
self.text = conditionText
self.condType = questConditionTypes[condType] or condType
self.current = current
self.maxval = maxval
return self
end
function QuestCondition:GetCompletion() -- returns: isComplete,isCurrent,curVal,maxVal
local journalIndex = self:GetQuestJournalIndex()
if not journalIndex then
return false,false,"WTF #1"
end -- strange...
local conditionText, current, maxval, isFailCondition, isComplete, isCreditShared = GetJournalQuestConditionInfo(journalIndex,self.parentStep.num,self.num)
return isComplete,true,current,maxval
end
function QuestCondition:GetQuestJournalIndex()
return self.parentStep and self.parentStep:GetQuestJournalIndex()
end
function QuestCondition:RequestCoords()
local complete,possible,curr,need = self:GetCompletion()
if not possible then return end
local journalIndex = self:GetQuestJournalIndex()
if not journalIndex then
return false,"WTF #2"
end -- strange...
local RequestJournalQuestConditionAssistance = _G.RequestJournalQuestConditionAssistance
RequestJournalQuestConditionAssistance(self:GetQuestJournalIndex(),self.parentStep.num,self.num)
-- the event is handled in QuestTracker
end
function QuestCondition:tostring()
return "Cond: " .. (self.text or "")
end
-----------------------------------------
-- DEBUG
-----------------------------------------
function Quests:Debug(...)
local str = ...
ZGV:Debug("&quest "..str, select(2,...) )
end
-----------------------------------------
-- STARTUP
-----------------------------------------
tinsert(ZGV.startups,function(self)
end)
|
return {'nvs'} |
--[[
Copyright 2018 American Megatrends Inc.
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.
--]]
-------------
-- Redirect-Handler module
-- @module RedirectHandler
-- @author AMI MegaRAC
local turbo = require("turbo")
local CONFIG = require("config")
local RedfishHandler = require("redfish-handler")
local RedirectHandler = class("RedirectHandler", RedfishHandler)
--- function to perform the get operation and redirect when "/" present.
function RedirectHandler:get()
local url_given = type(self.options) == "string"
local PATH = url_given and self.options or self.request.headers:get_url_field(turbo.httputil.UF.PATH)
local QUERY = self.request.headers:get_url_field(turbo.httputil.UF.QUERY)
local redirect_path = url_given and PATH or PATH:gsub("/+$", "")
local redirect_location = QUERY and redirect_path..'?'..QUERY or redirect_path
self:redirect(redirect_location)
end
--- function to perform the post operation and redirect when "/" present.
function RedirectHandler:post()
local url_given = type(self.options) == "string"
local PATH = url_given and self.options or self.request.headers:get_url_field(turbo.httputil.UF.PATH)
local redirect_path = url_given and PATH or PATH:gsub("/+$", "")
local redirect_location = QUERY and redirect_path..'?'..QUERY or redirect_path
self:set_status(307)
self:set_header("Location", redirect_location)
end
--- function to perform the put operation and redirect when "/" present.
function RedirectHandler:put()
local url_given = type(self.options) == "string"
local PATH = url_given and self.options or self.request.headers:get_url_field(turbo.httputil.UF.PATH)
local redirect_path = url_given and PATH or PATH:gsub("/+$", "")
local redirect_location = QUERY and redirect_path..'?'..QUERY or redirect_path
--set the http status to 301 - permanently redirected
self:redirect(redirect_location, true)
end
--- function to perform the patch operation and redirect when "/" present.
function RedirectHandler:patch()
local url_given = type(self.options) == "string"
local PATH = url_given and self.options or self.request.headers:get_url_field(turbo.httputil.UF.PATH)
local redirect_path = url_given and PATH or PATH:gsub("/+$", "")
local redirect_location = QUERY and redirect_path..'?'..QUERY or redirect_path
--set the http status to 301 - permanently redirected
self:redirect(redirect_location, true)
end
--- function to perform the delete operation and redirect when "/" present.
function RedirectHandler:delete()
local url_given = type(self.options) == "string"
local PATH = url_given and self.options or self.request.headers:get_url_field(turbo.httputil.UF.PATH)
local redirect_path = url_given and PATH or PATH:gsub("/+$", "")
local redirect_location = QUERY and redirect_path..'?'..QUERY or redirect_path
--set the http status to 301 - permanently redirected
self:redirect(redirect_location, true)
end
return RedirectHandler
|
--[[
Name: "sh_mysterious_fiveseven.lua".
Product: "HL2 RP".
--]]
local ITEM = {};
-- Set some information.
ITEM.base = "weapon_base";
ITEM.name = "Mysterious's FiveSeven";
ITEM.model = "models/weapons/w_pist_fiveseven.mdl";
ITEM.weight = 1.5;
ITEM.uniqueID = "mysterious_fiveseven";
ITEM.weaponClass = "weapon_fiveseven";
ITEM.description = "A small pistol with odd markings engraved into it.";
-- Register the item.
kuroScript.item.Register(ITEM); |
-- '#include' statements
local SampleInterface = require("SampleInterface")
local SampleInterfaceImplementation = require("SampleInterfaceImplementation")
insulate("Insulated Interface Test | ", function()
local sampleInterface = nil
setup(function()
sampleInterface = SampleInterface:new()
end)
test("Should throw an error", function()
assert.has_error(sampleInterface.returnOne)
end)
test("Should NOT throw an error", function()
assert.has_no.errors(sampleInterface.returnTwo)
end)
test("Should NOT throw an error for implementation", function()
assert.has_error(sampleInterface.returnOne)
sampleInterface = SampleInterfaceImplementation:new()
assert.has_no.errors(sampleInterface.returnOne)
assert.is.equal(1, sampleInterface:returnOne())
assert.has_no.errors(sampleInterface.returnTwo)
end)
end)
|
local server = require "http.server"
local searchMgr = require "SearchMgr"
local write = server.write
local htmlTags = require "HtmlTags"
local console = require "sys.console"
local localConfig = require "LocalConfig"
local core = require "sys.core"
local keywordDatabaseMgr = require "KeywordDatabaseMgr"
local dispatch = {}
local defaultHead = htmlTags.Head
local defaultTail = htmlTags.Tail
local default = defaultHead..defaultTail
local signedHead = htmlTags.HeadWithSign or defaultHead
local addNewSearchItemHead = htmlTags.AddNewSearchItemHead or defaultHead
local addNewSearchItemWithSignHead = htmlTags.AddNewSearchItemHeadWithSign or defaultHead
local function checkRequest(request)
if request.Cookie ~= core.envget("Cookie") then
return false
end
if not request.form or request.form.sign ~= core.envget("Sign") then
return false
end
return true
end
dispatch["/"] = function(fd, request, body)
local body = default
local head = {
"Content-Type: text/html",
}
if checkRequest(request) then
body = signedHead
end
write(fd, 200, head, body)
end
local content = ""
dispatch["/download"] = function(fd, request, body)
write(fd, 200, {"Content-Type: text/plain"}, content)
end
dispatch["/upload"] = function(fd, request, body)
if request.form.Hello then
content = request.form.Hello
end
local body = "Upload done, please access download to see the result"
local head = {
"Content-Type: text/plain",
}
write(fd, 200, head, body)
end
dispatch["/search"] = function(fd, request, body)
if not checkRequest(request) then
local head = {
"Content-Type: text/html",
}
local body = "并不是谁都能访问的"
if htmlTags.SearchResultNoSignHead then
body = htmlTags.SearchResultNoSignHead.."并不是谁都能访问的"..htmlTags.SearchResultTail
end
write(fd, 200, head, body)
return
end
if request.form.Hello then
content = request.form.Hello
end
local body = htmlTags.SearchResultHead..searchMgr:GetAnswer(content)..htmlTags.SearchResultTail
local head = {
"Content-Type: text/html",
}
write(fd, 200, head, body)
end
dispatch["/detail"] = function(fd, request, body)
if request.form.Hello then
content = request.form.Hello
end
local body = htmlTags.SearchResultHead..searchMgr:GetDetail(content)..htmlTags.SearchResultTail
local head = {
"Content-Type: text/html",
}
write(fd, 200, head, body)
end
dispatch["/addWnd"] = function(fd, request, body)
local body = addNewSearchItemHead..defaultTail
local head = {
"Content-Type: text/html",
}
if checkRequest(request) then
print("valid request found")
body = addNewSearchItemWithSignHead..defaultTail
end
write(fd, 200, head, body)
end
dispatch["/add"] = function(fd, request, body)
local body = default
local head = {
"Content-Type: text/html",
}
print("handle is add")
if checkRequest(request) then
local keyword = request.form.kwd
local itemType = request.form.itemType
local parseRule = request.form.parseRule
local title = request.form.tit
local content = request.form.cnt
local item = {
keyword = keyword,
itemType = itemType,
parseRule = parseRule,
title = title,
content = content,
}
local addResult = keywordDatabaseMgr:Add(item)
body = addNewSearchItemHead..addResult..defaultTail
else
print("invalid request")
end
write(fd, 200, head, body)
end
-- Entry!
server.listen(":8089", function(fd, request, body)
local c = dispatch[request.uri]
if c then
c(fd, request, body)
else
print("Unsupport uri", request.uri)
write(fd, 404, {"Content-Type: text/plain"}, "404 Page Not Found")
end
end)
console {
addr = ":1234"
}
|
return {'orde','ordebewaarder','ordebroeder','ordedienst','ordehandhaver','ordehandhaving','ordeketen','ordekleed','ordekruis','ordelievend','ordelijk','ordelijkheid','ordelint','ordeloos','ordeloosheid','ordenen','ordening','ordeningsbeleid','ordeningsprincipe','ordentelijk','ordentelijkheid','ordepolitie','ordeprobleem','ordeproblemen','order','orderbedrag','orderbehandeling','orderbeheer','orderbevestiging','orderbiljet','orderboek','orderbrief','orderbriefje','orderclausule','orderdatum','orderformulier','ordergedreven','ordergrootte','orderkopie','ordernummer','orderontvangst','orderpapier','orderportefeuille','orderpositie','orderprogramma','orderregel','orderstatus','orderstroom','orderverlies','orderverwerking','ordeteken','ordetroepen','ordeverstoorder','ordeverstoring','ordevoorstel','ordi','ordinaal','ordinaat','ordinair','ordinantie','ordinariaat','ordinarius','ordinatie','ordineren','ordner','ordonnans','ordonnansofficier','ordonnantie','ordonneren','ordovicium','orderverwerkingssysteem','orderverzamelaar','ordegrootte','ordewoord','ordemaatregel','ordeningsmodel','ordeningsplan','ordeningsrecht','orderafhandeling','ordersysteem','orderwaarde','ordetermijn','ordewacht','orderproces','ordeboek','ordingen','ordelman','ordebroeders','ordediensten','ordelievende','ordelijke','ordelijker','ordelijkste','ordelinten','ordeloze','ordelozer','ordemaatregelen','ordemoties','orden','ordende','ordenden','ordeningen','ordeningsprincipes','ordent','ordentelijke','ordentelijker','ordentelijkste','ordeoefeningen','orderbevestigingen','orderboeken','orderbriefjes','orderbrieven','orderformulieren','ordergegevens','ordernummers','orderpapieren','orderportefeuilles','orderregels','orders','ordertje','ordertjes','ordes','ordetekenen','ordetekens','ordeverstoorders','ordezusters','ordinairder','ordinaire','ordinairst','ordinaten','ordineerde','ordners','ordonnansen','ordonnansofficieren','ordonnanties','ordonnantien','ordonneerde','ordonneerden','ordonneert','ordebewaarders','ordehandhavers','ordekleren','ordenend','ordenende','orderboekje','orderontvangsten','ordeverstoringen','ordinale','ordeklederen','ordekruisen','ordeloost','ordinanties','ordinarii','ordinantien','ordis','ordinariaten','ordewoorden','orderboekjes','ordeningsplannen','ordersystemen','ordergroottes','ordegroottes','orderposities'} |
--------------------------------------------------------------------------------
-- Function......... : easeOutInQuad
-- Author........... :
-- Description...... :
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function Tweener.easeOutInQuad ( t, b, c, d )
--------------------------------------------------------------------------------
if (t < d/2) then return this.easeOutQuad (t*2, b, c/2, d) end
return this.easeInQuad((t*2)-d, b+c/2, c/2, d);
--------------------------------------------------------------------------------
end
--------------------------------------------------------------------------------
|
local M = {}
M.config = {
settings = {
ltex = {
language = "en-GB",
},
},
}
return M
|
-- Prosody XMPP Server Configuration
--
-- Information on configuring Prosody can be found on our
-- website at https://prosody.im/doc/configure
--
-- Tip: You can check that the syntax of this file is correct
-- when you have finished by running this command:
-- prosodyctl check config
-- If there are any errors, it will let you know what and where
-- they are, otherwise it will keep quiet.
--
-- Good luck, and happy Jabbering!
---------- Server-wide settings ----------
-- Settings in this section apply to the whole server and are the default settings
-- for any virtual hosts
-- This is a (by default, empty) list of accounts that are admins
-- for the server. Note that you must create the accounts separately
-- (see https://prosody.im/doc/creating_accounts for info)
-- Example: admins = { "user1@example.com", "user2@example.net" }
admins = { "{admin_jid}" }
-- Enable use of libevent for better performance under high load
-- For more information see: https://prosody.im/doc/libevent
use_libevent = true
-- Prosody will always look in its source directory for modules, but
-- this option allows you to specify additional locations where Prosody
-- will look for modules first. For community modules, see https://modules.prosody.im/
plugin_paths = { "/etc/prosody/prosody-modules" }
-- This is the list of modules Prosody will load on startup.
-- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too.
-- Documentation for bundled modules can be found at: https://prosody.im/doc/modules
modules_enabled = {
-- Generally required
"roster"; -- Allow users to have a roster. Recommended ;)
"saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
"tls"; -- Add support for secure TLS on c2s/s2s connections
"dialback"; -- s2s dialback support
"disco"; -- Service discovery
-- Not essential, but recommended
"carbons"; -- Keep multiple clients in sync
"pep"; -- Enables users to publish their mood, activity, playing music and more
"private"; -- Private XML storage (for room bookmarks, etc.)
"blocklist"; -- Allow users to block communications with other users
"vcard4"; -- User profiles (stored in PEP)
"vcard_legacy"; -- Conversion between legacy vCard and PEP Avatar, vcard
-- Nice to have
"version"; -- Replies to server version requests
"uptime"; -- Report how long server has been running
"time"; -- Let others know the time here on this server
"ping"; -- Replies to XMPP pings with pongs
"register"; -- Allow users to register on this server using a client and change passwords
"mam"; -- Store messages in an archive and allow users to access it
"csi_simple"; -- Simple Mobile optimizations
-- Admin interfaces
"admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands
"admin_telnet"; -- Opens telnet console interface on localhost port 5582
-- HTTP modules
"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
"websocket"; -- XMPP over WebSockets
"http_files"; -- Serve static files from a directory over HTTP
"http_file_share";
-- Other specific functionality
"limits"; -- Enable bandwidth limiting for XMPP connections
"server_contact_info"; -- Publish contact information for this service
"announce"; -- Send announcement to all online users
--"welcome"; -- Welcome users who register accounts
"watchregistrations"; -- Alert admins of registrations
"proxy65"; -- Enables a file transfer proxy service which clients behind NAT can use
-- Custom
"cloud_notify";
"smacks";
"throttle_presence";
"filter_chatstates";
"http_altconnect";
"register_web";
"lastlog";
"listusers";
"bookmarks";
"block_registrations";
"firewall",
"register_dnsbl_firewall_mark";
"spam_reporting";
"watch_spam_reports";
"s2s_blacklist";
}
-- These modules are auto-loaded, but should you want
-- to disable them then uncomment them here:
modules_disabled = {
-- "offline"; -- Store offline messages
-- "c2s"; -- Handle client connections
-- "s2s"; -- Handle server-to-server connections
-- "posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
}
contact_info = {
abuse = { "xmpp:{admin_jid}" };
admin = { "xmpp:{admin_jid}" };
feedback = { "xmpp:{admin_jid}" };
security = { "xmpp:{admin_jid}" };
support = { "xmpp:{admin_jid}" };
}
-- https://prosody.im/security/advisory_20210512/
gc = {
speed = 500;
}
c2s_stanza_size_limit = 256 * 1024
s2s_stanza_size_limit = 512 * 1024
limits = {
c2s = {
rate = "10kb/s";
burst = "2s";
};
s2sin = {
rate = "30kb/s";
burst = "2s";
}
}
ssl = {
options = {
no_renegotiation = true;
}
}
-- Disable account creation by default, for security
-- For more information see https://prosody.im/doc/creating_accounts
allow_registration = false
min_seconds_between_registrations = 60
-- Force clients to use encrypted connections? This option will
-- prevent clients from authenticating unless they are using encryption.
c2s_require_encryption = true
-- Force servers to use encrypted connections? This option will
-- prevent servers from authenticating unless they are using encryption.
-- Note that this is different from authentication
s2s_require_encryption = true
-- Force certificate authentication for server-to-server connections?
-- This provides ideal security, but requires servers you communicate
-- with to support encryption AND present valid, trusted certificates.
-- NOTE: Your version of LuaSec must support certificate verification!
-- For more information see https://prosody.im/doc/s2s#security
s2s_secure_auth = true
-- Some servers have invalid or self-signed certificates. You can list
-- remote domains here that will not be required to authenticate using
-- certificates. They will be authenticated using DNS instead, even
-- when s2s_secure_auth is enabled.
--s2s_insecure_domains = { "gmail.com", "im.rmilk.com" }
-- Even if you leave s2s_secure_auth disabled, you can still require valid
-- certificates for some domains by specifying a list here.
--s2s_secure_domains = { "jabber.org" }
legacy_ssl_ports = { 5223 }
legacy_ssl_ssl = {
certificate = "/etc/prosody/certs/{domain}.crt";
key = "/etc/prosody/certs/{domain}.key";
}
-- Required for init scripts and prosodyctl
pidfile = "/tmp/prosody.pid"
-- Select the authentication backend to use. The 'internal' providers
-- use Prosody's configured data storage to store the authentication data.
-- To allow Prosody to offer secure authentication mechanisms to clients, the
-- default provider stores passwords in plaintext. If you do not trust your
-- server please see https://prosody.im/doc/modules/mod_auth_internal_hashed
-- for information about using the hashed backend.
authentication = "internal_hashed"
-- Select the storage backend to use. By default Prosody uses flat files
-- in its configured data directory, but it also supports more backends
-- through modules. An "sql" backend is included by default, but requires
-- additional dependencies. See https://prosody.im/doc/storage for more info.
storage = "internal" -- Default is "internal"
-- For the "sql" backend, you can uncomment *one* of the below to configure:
-- sql = { driver = "SQLite3", database = "prosody.sqlite" } -- Default. 'database' is the filename.
--sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
--sql = { driver = "PostgreSQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
-- Archiving configuration
-- If mod_mam is enabled, Prosody will store a copy of every message. This
-- is used to synchronize conversations between multiple clients, even if
-- they are offline. This setting controls how long Prosody will keep
-- messages in the archive before removing them.
--archive_expires_after = "1w" -- Remove archived messages after 1 week
-- You can also configure messages to be stored in-memory only. For more
-- archiving options, see https://prosody.im/doc/modules/mod_mam
-- Logging configuration
-- For advanced logging see https://prosody.im/doc/logging
log = {
{levels = {min = "info"}, to = "console"};
}
-- Uncomment to enable statistics
-- For more info see https://prosody.im/doc/statistics
-- statistics = "internal"
-- Certificates
-- Every virtual host and component needs a certificate so that clients and
-- servers can securely verify its identity. Prosody will automatically load
-- certificates/keys from the directory specified here.
-- For more information, including how to use 'prosodyctl' to auto-import certificates
-- (from e.g. Let's Encrypt) see https://prosody.im/doc/certificates
-- Location of directory to find certificates in (relative to main config file):
certificates = "certs"
https_certificate = "certs/{domain}.crt"
cross_domain_bosh = true
cross_domain_websocket = true
http_default_host = "{domain}"
http_file_share_size_limit = 16*1024*1024 -- 16 MiB
http_file_share_daily_quota = 100*1024*1024 -- 100 MiB per day per user
http_file_share_expires_after = 60 * 60 * 24 -- a day
http_paths = {
register_web = "/register";
files = "/";
}
block_registrations_users = { "administrator", "admin", "root", "postmaster", "xmpp", "jabber", "contact", "mail", "abuse" }
-- Allow only simple ASCII characters in usernames
block_registrations_require = "^[a-zA-Z0-9_.-]+$"
-- DroneBL
registration_rbl = "dnsbl.dronebl.org"
-- Automatic message to flagged user account, outlining where to find help
-- as well as why the IP was blocked. You can use the following variables:
-- $ip $username $host
registration_rbl_message = "[...] More details: https://dronebl.org/lookup?ip=$ip"
-- Enable firewall marks and load the firewall script
firewall_experimental_user_marks = true
firewall_scripts = {
"/etc/prosody/rbl.pfw";
"module:scripts/jabberspam-simple-blocklist.pfw";
}
s2s_blacklist = {
"chatwith.xyz",
"exploit.im",
"jabbim.sk",
"jabbim.ru",
"omemo.im",
"crime.io",
"xmpp.jp",
"jabber.cz",
"draugr.de",
"jabster.pl",
"blabber.im",
"jabbim.cz",
"jabb.im",
"jabbim.pl",
"njs.netlab.cz",
"jabber.root.cz",
"0nl1ne.at",
"jabbim.com",
"xabber.de",
"creep.im",
"ubuntu-jabber.de",
"ubuntu-jabber.net",
"verdammung.org",
"deshalbfrei.org",
"jabber.sk",
}
captcha_options = {
provider = "hcaptcha";
captcha_private_key = "{captcha_private}";
captcha_public_key = "{captcha_public}";
}
registration_notification = "User $username just registered on $host from $ip via $source"
http_files_dir = "/www"
----------- Virtual hosts -----------
-- You need to add a VirtualHost entry for each domain you wish Prosody to serve.
-- Settings under each VirtualHost entry apply *only* to that host.
VirtualHost "{domain}"
--VirtualHost "example.com"
-- certificate = "/path/to/example.crt"
------ Components ------
-- You can specify components to add hosts that provide special services,
-- like multi-user conferences, and transports.
-- For more information on components, see https://prosody.im/doc/components
---Set up a MUC (multi-user chat) room server on conference.example.com:
Component "room.{domain}" "muc"
name = "{domain} Chatrooms"
restrict_room_creation = "local"
muc_tombstones = true
modules_enabled = {
"muc_mam",
"muc_limits",
"vcard_muc",
}
Component "proxy.{domain}" "proxy65"
proxy65_address = "{domain}"
proxy65_acl = { "{domain}" }
Component "upload.{domain}" "http_file_share"
modules_enabled = {
"acme_challenge_dir",
}
---Set up an external component (default component port is 5347)
--
-- External components allow adding various services, such as gateways/
-- transports to other networks like ICQ, MSN and Yahoo. For more info
-- see: https://prosody.im/doc/components#adding_an_external_component
--
--Component "gateway.example.com"
-- component_secret = "password"
|
slot0 = class("TaskCommonPage", import("..base.BaseSubView"))
slot0.getUIName = function (slot0)
return "TaskListPage"
end
slot0.OnLoaded = function (slot0)
slot0._scrllPanel = slot0:findTF("right_panel")
slot0._scrollView = slot0._scrllPanel:GetComponent("LScrollRect")
end
slot0.OnInit = function (slot0)
slot0.taskCards = {}
slot0._scrollView.onInitItem = function (slot0)
slot0:onInitTask(slot0)
end
slot0._scrollView.onUpdateItem = function (slot0, slot1)
slot0:onUpdateTask(slot0, slot1)
end
end
slot0.onInitTask = function (slot0, slot1)
slot0.taskCards[slot1] = TaskCard.New(slot1, slot0.contextData.viewComponent)
end
slot0.onUpdateTask = function (slot0, slot1, slot2)
if not slot0.taskCards[slot2] then
slot0:onInitTask(slot2)
slot3 = slot0.taskCards[slot2]
end
slot3:update(slot0.taskVOs[slot1 + 1])
end
slot0.Update = function (slot0, slot1, slot2, slot3)
slot0:Show()
slot0.taskVOs = {}
for slot8, slot9 in pairs(slot4) do
if slot9:getConfig("visibility") == 1 and slot2[slot9:GetRealType()] then
table.insert(slot0.taskVOs, slot9)
end
end
if (slot1 == TaskScene.PAGE_TYPE_ALL or slot1 == TaskScene.PAGE_TYPE_ROUTINE) and TaskScene.IsPassScenario() and TaskScene.IsNewStyleTime() then
slot6 = getProxy(TaskProxy)
for slot10, slot11 in ipairs(slot5) do
if not (slot6:getTaskById(slot11) or slot6:getFinishTaskById(slot11)) then
table.insert(slot0.taskVOs, Task.New({
progress = 0,
id = slot11
}))
end
end
end
slot0:Sort()
slot0._scrollView:SetTotalCount(#slot0.taskVOs, -1)
if slot0:GetSliderValue() > 0 then
slot0._scrollView:ScrollTo(slot5)
end
if slot3 then
slot3(slot0.taskVOs)
end
end
slot0.GetSliderValue = function (slot0)
slot1 = -1
if slot0.contextData.targetId then
slot2 = nil
for slot6, slot7 in ipairs(slot0.taskVOs) do
if slot7.id == slot0.contextData.targetId then
slot2 = slot6 - 1
break
end
end
if slot2 then
slot1 = slot0._scrollView:HeadIndexToValue(slot2)
end
end
return slot1
end
slot0.Sort = function (slot0)
function slot1(slot0, slot1, slot2)
return slot3(slot0) < slot3(slot1)
end
function slot2(slot0)
return (slot0:IsUrTask() and 1) or 0
end
function slot3(slot0, slot1)
if slot0:GetRealType() == slot1:GetRealType() then
return slot0.id < slot1.id
elseif slot0:getTaskStatus() == 0 then
return slot0(slot0:GetRealType(), slot1:GetRealType(), {
26,
36,
6,
3,
4,
13,
5,
2,
1
})
elseif slot0:getTaskStatus() == 1 then
return slot0(slot0:GetRealType(), slot1:GetRealType(), {
26,
36,
6,
1,
4,
13,
2,
5,
3
})
end
end
table.sort(slot0.taskVOs, function (slot0, slot1)
if slot0:getTaskStatus() == slot1:getTaskStatus() then
if ((slot0.id == 10302 and 1) or 0) == ((slot1.id == 10302 and 1) or 0) then
if slot0(slot0) == slot0(slot1) then
return slot1(slot0, slot1)
else
return slot5 < slot4
end
else
return slot3 < slot2
end
else
return slot2(slot0:getTaskStatus(), slot1:getTaskStatus(), {
1,
0,
2,
-1
})
end
end)
end
slot0.OnDestroy = function (slot0)
for slot4, slot5 in pairs(slot0.taskCards) do
slot5:dispose()
end
end
slot0.GetWaitToCheckList = function (slot0)
slot1 = slot0.taskVOs or {}
slot2 = {}
for slot6, slot7 in pairs(slot1) do
if slot7:getTaskStatus() == 1 and slot7:getConfig("visibility") == 1 then
table.insert(slot2, slot7)
end
end
return slot2
end
slot0.ExecuteOneStepSubmit = function (slot0)
slot1 = slot0:GetWaitToCheckList()
slot2 = nil
slot4 = nil
function slot5()
slot0, slot1 = slot2:filterOverflowTaskVOList(slot3)
slot0 = slot2:filterSubmitTaskVOList(slot2.filterSubmitTaskVOList, slot4)
slot0 = slot2:filterChoiceTaskVOList(slot2.filterChoiceTaskVOList, slot4)
pg.m02:sendNotification(GAME.MERGE_TASK_ONE_STEP_AWARD, {
resultList = pg.m02.sendNotification
})
end
coroutine.wrap(slot5)()
if false then
pg.TipsMgr.GetInstance():ShowTips(i18n("award_overflow_tip"))
slot3 = false
end
end
slot0.filterOverflowTaskVOList = function (slot0, slot1)
slot2 = {}
slot5 = getProxy(PlayerProxy):getData().gold
slot6 = getProxy(PlayerProxy).getData().oil
slot7 = (not LOCK_UR_SHIP and getProxy(BagProxy):GetLimitCntById(pg.gameset.urpt_chapter_max.description[1])) or 0
slot8 = pg.gameset.max_gold.key_value
slot9 = pg.gameset.max_oil.key_value
slot10 = (not LOCK_UR_SHIP and pg.gameset.urpt_chapter_max.description[2]) or 0
slot11 = false
for slot15, slot16 in pairs(slot1) do
if not slot16:judgeOverflow(slot5, slot6, slot7) then
table.insert(slot2, slot16)
end
if slot17 then
slot11 = true
end
end
return slot2, slot11
end
slot0.filterSubmitTaskVOList = function (slot0, slot1, slot2)
slot3 = {}
for slot8, slot9 in ipairs(slot4) do
if slot9:getConfig("sub_type") == TASK_SUB_TYPE_GIVE_ITEM or slot9:getConfig("sub_type") == TASK_SUB_TYPE_GIVE_VIRTUAL_ITEM or slot9:getConfig("sub_type") == TASK_SUB_TYPE_PLAYER_RES then
slot10 = DROP_TYPE_ITEM
if slot9:getConfig("sub_type") == TASK_SUB_TYPE_PLAYER_RES then
slot10 = DROP_TYPE_RESOURCE
end
pg.MsgboxMgr.GetInstance().ShowMsgBox(slot15, {
type = MSGBOX_TYPE_ITEM_BOX,
content = i18n("sub_item_warning"),
items = {
{
type = slot10,
id = slot9:getConfig("target_id_for_client"),
count = slot9:getConfig("target_num")
}
},
onYes = function ()
table.insert(table.insert, )
table.insert()
end,
onNo = function ()
slot0()
end
})
coroutine.yield()
else
table.insert(slot3, slot9)
end
end
return slot3
end
slot0.filterChoiceTaskVOList = function (slot0, slot1)
slot2 = {}
for slot7, slot8 in ipairs(slot3) do
if slot8:isSelectable() then
slot10 = {}
for slot14, slot15 in ipairs(slot9) do
slot10[#slot10 + 1] = {
type = slot15[1],
id = slot15[2],
count = slot15[3],
index = slot14
}
end
slot11 = nil
pg.MsgboxMgr.GetInstance().ShowMsgBox(slot16, {
type = MSGBOX_TYPE_ITEM_BOX,
content = i18n("select_award_warning"),
items = slot10,
itemFunc = function (slot0)
slot0 = slot0.index
end,
onYes = function ()
if not slot0 then
pg.TipsMgr.GetInstance():ShowTips(i18n("no_item_selected_tip"))
else
for slot5, slot6 in ipairs(slot1) do
table.insert(slot0, {
type = slot6[1],
id = slot6[2],
number = slot6[3]
})
end
slot2.choiceItemList = slot0
table.insert(slot3, table.insert)
process()
end
end,
onNo = function ()
process()
end
})
coroutine.yield()
else
table.insert(slot2, slot8)
end
end
return slot2
end
return slot0
|
-- you can "require" lua libraries
require "randist"
-- comment out things in this file using:
--[[ comment in order to test how things work --]]
function testfunc()
-- delay by 1/2 beat
bdelay(.5)
bv(1500) -- set beat value for this environment (1500 ms)
-- do the following 3 times:
for i=1, 3 do
-- send to "bd" receiver with "list" selector
pdsend{"bd", "list", "this", "is", "a", "bass", "drum?"}
-- delay by a beat
bdelay(1)
end
end
-- define a step sequencer that prints, every 50 ms, 100 times
paul = stepseq({{"one"}, {"blah"},
{"three"}, {"4"},
{"5"}, {"6"}}, {{{print}}}, 50, 80)
-- define a global function
function test(loo)
print(loo)
end
-- if a function named "predone" is in the global loadENV,
-- it will be called before exiting
-- here a sine is sent to "display" with a pulse-width mod of .25
-- (so 1/2 the cycle will finish in 1/4 of the total wavelength)
-- if possess is changed to addfnow, then "done!" will display
-- before the oscillator, not after
function predone()
possess(oscil({{pdsend, {"display", "float"}},
{2, 3}}, 5, "sin", 0, 0.25).addf(5005, 1, 0))
print("done!")
end
-- main function that start() calls (entry point)
function main()
-- print to pd console
print("hi, in main")
-- make an exponential line that prints every 25 milliseconds
local aline = reline(print, 25)
-- add testfunc
addfnow(testfunc)
print("jumping:")
-- now the line will jump to 10 and call print() on 10
aline.jump(10)
for i=1, 4 do
pd.post("onbeat")
--delay by a beat
bdelay(1)
end
-- add paul, have it start at step 1, and have it take over main's thread
possess(paul.addf(1))
-- add the line, go to 0 in 4 seconds after paul's done
addfnow(aline.addf(0, 4000))
end |
#!/usr/bin/env lua
--require 't5'
-- this is a test comment
-- test comment
-- test comment
--tables
city = {}
city.name = "Seattle"
city.population = 10000
city.mayor = "Klark McDonald"
-- test comment
-- test comment
--[[io.write('Hello, what is your name? ')
local name = io.read()
io.write('Nice to meet you, ', name, '!\n')--]]
--can use semicolon to write two statements in one line
--local var = nil
--io.write("Which aspect of hte city you want to know?: "); local var = io.read() --will throw error in other parts of the program cuz its local
local clock = os.clock
function sleep(n) -- stop execution for x seconds
local t0 = clock()
while clock() - t0 <= n do end
end
local function printWait(num, var, time)
io.write(num,". ", var, "\n"); sleep(time)
end
local function city_part(var) -- check if `var` is x, meant to be usef or menu func
if (var == "name" or var == " name" or var == "Name" or var == "1") then
print("Name:", city.name)
elseif (var == "population" or var == "2") then
print("Population:", city.population)
elseif (var == "mayor" or var == "3") then
print("Mayor:", city.mayor)
elseif (var == "exit" or var == "Exit" or var == "4") then
io.write("goodbye!\n"); os.exit(0)
elseif (var == "all" or var == "5") then
io.write("\n----------||----------\nName:\t\t", city.name, "\nPopulation:\t", city.population, "\nMayor:\t\t", city.mayor, "\n")
else
io.write("The given argument ", var, " was not recognized!")
end
end
local function menu() -- main menu
repeat
io.write("----MENU----\n")
--sleep(2) --worked
local global_time = 0.1
printWait(1, "name", global_time); printWait(2, "population", global_time); printWait(3, "mayor", global_time); printWait(4, "exit", global_time); printWait(5, "all", global_time);
io.write("\n")
--io.write("1. name\n2. population\n3. mayor\n4. exit\n5. all\n\n")
io.write("Which aspect of the city you want to know?: "); usrInput = io.read() --can't be local, cuz we need it to be used in the whole program's scope
city_part(usrInput)
until (usrInput == "exit")
end
menu()
--city_part()
|
-- This might have been installed in Lua 5.1 .luarocks so make sure to set the version correctly
local _testMain = require("TestMain")
local game = _testMain.game
local habitat = _testMain.habitat
local ReplicatedStorage = _testMain.ReplicatedStorage
local replicatedStorageChildren = ReplicatedStorage:GetChildren()
for _, child in pairs(replicatedStorageChildren) do
print(child.Name)
end
local modScript = ReplicatedStorage.Nevermore
print(modScript)
local nevermoreRequire = habitat.require("Nevermore")
local StateMachineMachine = nevermoreRequire("StateMachineMachine")
local internalSharedData = {
ReadyForSecondStateA = false
}
local firstStateCompleted = false
local stateMachine = StateMachineMachine.NewStateMachine()
local firstState = StateMachineMachine.NewState("FirstState")
firstState.NextStatesNames = { "SecondStateA", "SecondStateB" }
firstState.InternalData = internalSharedData
function firstState:CanTransitionFrom(previousState, data)
if previousState ~= nil and previousState["Name"] ~= nil then
print(" Previous State: " .. previousState.Name)
end
-- This ensures it won't loop infinitely
return previousState.Name == "FourthState"
end
function firstState:Action()
self.InternalData.ReadyForSecondStateA = true
self:PrintInternalDataTable()
end
function firstState:CanPerformAction()
return true
end
function firstState:StateStoppedCallback()
firstStateCompleted = true
print("First state completed? " .. tostring(firstStateCompleted))
end
local secondStateA = StateMachineMachine.NewState("SecondStateA")
secondStateA.NextStatesNames = { "ThirdState" }
secondStateA.InternalData = internalSharedData
function secondStateA:CanTransitionFrom(previousState, data)
if previousState.Name == "FirstState" and data["ReadyForSecondStateA"] then
return true
end
return false
end
function secondStateA:Action()
self.InternalData.ReadyForThirdState = true
self:PrintInternalDataTable()
end
function secondStateA:CanPerformAction()
return true
end
function secondStateA:StateStoppedCallback()
print("SecondStateA stopped")
end
local secondStateB = StateMachineMachine.NewState("SecondStateB")
secondStateB.NextStatesNames = { "ThirdState" }
secondStateB.InternalData = internalSharedData
function secondStateB:CanTransitionFrom(previousState, data)
if data["ReadyForSecondStateB"] then
return true
end
return false
end
function secondStateB:Action()
self.InternalData.ReadyForThirdState = false
self:PrintInternalDataTable()
end
function secondStateB:CanPerformAction()
return true
end
local thirdState = StateMachineMachine.NewState("ThirdState")
thirdState.NextStatesNames = { "FirstState" }
thirdState.InternalData = internalSharedData
function thirdState:CanTransitionFrom(previousState, data)
print(" -- Data passed to third state:")
for name, thing in pairs(data) do
print(tostring(name) .. ": " .. tostring(thing))
end
if data["ReadyForThirdState"] then
return true
end
return false
end
function thirdState:Action()
self.InternalData.ReadyForFirstState = true
self:PrintInternalDataTable()
end
function thirdState:CanPerformAction()
return true
end
function thirdState:StateStoppedCallback()
print("Third state stopped")
end
stateMachine:AddState(firstState)
stateMachine:AddState(secondStateA)
stateMachine:AddState(secondStateB)
stateMachine:AddState(thirdState)
stateMachine.CurrentState = firstState
local firstRunData = {}
stateMachine:Update(firstRunData)
print("*** Running second update ***")
local inputData = { ReadyForSecondStateA = true }
stateMachine:Update(inputData)
-- Should be ready for third state
print("*** Running third update ***")
stateMachine:Update({ ReadyForThirdState = true})
-- Should re-run third state
stateMachine:Update(internalSharedData)
assert(stateMachine.CurrentState.Name == "ThirdState") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.