myspace / Lua /ClassDefs /ClassDef-Inventory.generated.lua
sirnii's picture
Upload 1816 files
b6a38d7 verified
raw
history blame
46.4 kB
-- ========== GENERATED BY ClassDef Editor (Ctrl-Alt-F3) DO NOT EDIT MANUALLY! ==========
DefineClass.AmmoProperties = {
__parents = { "PropertyObject", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Caliber", id = "Caliber",
editor = "combo", default = false, template = true, items = function (self) return PresetGroupCombo("Caliber", "Default") end, },
{ category = "Caliber", id = "MaxStacks", name = "Max Stacks", help = "Ammo can stack up to that number.",
editor = "number", default = 10, template = true, slider = true, min = 1, max = 10000, },
{ id = "Modifications",
editor = "nested_list", default = false, template = true, base_class = "CaliberModification", inclusive = true, },
{ category = "Combat", id = "AppliedEffects", name = "Applied Effects",
editor = "preset_id_list", default = {}, template = true, preset_class = "CharacterEffectCompositeDef", preset_group = "Default", item_default = "", },
{ category = "General", id = "ammo_type_icon", name = "Ammo Type Icon", help = "Ammo type icon",
editor = "ui_image", default = false, template = true, },
},
}
DefineClass.ArmorProperties = {
__parents = { "ItemWithCondition", },
__generated_by_class = "ClassDef",
properties = {
{ id = "Slot",
editor = "combo", default = "Torso", template = true, items = function (self) return {"Head", "Torso", "Legs"} end, },
{ category = "Combat", id = "PenetrationClass",
editor = "number", default = 1, template = true,
name = function(self) return "Penetration Class: " .. (PenetrationClassIds[self.PenetrationClass] or "") end, slider = true, min = 1, max = 5, modifiable = true, },
{ category = "Combat", id = "DamageReduction", name = "Damage Reduction (Base)", help = "How much damage the armor absorbs when the attack lands in an area covered by the armor.",
editor = "number", default = 10, template = true, scale = "%", slider = true, min = 0, max = 100, },
{ category = "Combat", id = "AdditionalReduction", name = "Damage Reduction (Additional)", help = "Additional damage reduction applied when the effective Penetration Class of the attack is lower than the Penetration Class of the armor protecting the hit body part.",
editor = "number", default = 10, template = true, scale = "%", slider = true, min = 0, max = 100, },
{ category = "Combat", id = "ProtectedBodyParts", name = "Protected Body Parts",
editor = "set", default = false, template = true, items = function (self) return PresetGroupCombo("TargetBodyPart", "Default") end, },
{ category = "Combat", id = "Camouflage",
editor = "bool", default = false, template = true, },
},
}
DefineClass.BobbyRayShopAmmoProperties = {
__parents = { "BobbyRayShopItemProperties", },
__generated_by_class = "ClassDef",
properties = {
{ category = "BobbyRayShop", id = "CategoryPair",
editor = "preset_id", default = "12gauge", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "Ammo", },
},
}
function BobbyRayShopAmmoProperties:GetShopStats(stacks)
return BobbyRayStoreGetStats_Ammo(self)
end
DefineClass.BobbyRayShopArmorProperties = {
__parents = { "BobbyRayShopUsedItemProperties", },
__generated_by_class = "ClassDef",
properties = {
{ category = "BobbyRayShop", id = "CategoryPair",
editor = "preset_id", default = "UtilityArmor", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "Armor", },
},
}
function BobbyRayShopArmorProperties:GetShopStats(stacks)
return BobbyRayStoreGetStats_Armor(self)
end
function BobbyRayShopArmorProperties:GetShopDescription()
local hasDesc = self.Description and self.Description ~= ""
local hasHint = self.AdditionalHint and self.AdditionalHint ~= ""
local protectedParts = {}
for part,val in sorted_pairs(self.ProtectedBodyParts) do
local preset= Presets.TargetBodyPart.Default[part]
table.insert(protectedParts, preset.display_name)
end
local protectedPartsText = ""
if #protectedParts > 0 then
protectedPartsText = T{378508273050, "<bullet_point> Body parts - <parts>", parts = table.concat(protectedParts, ", ")}
end
--FindPreset("WeaponType", "Armor").Description
local text = hasDesc and self.Description or hasHint and self.AdditionalHint or ""
return protectedPartsText .. "\n" .. text
end
DefineClass.BobbyRayShopFirearmProperties = {
__parents = { "BobbyRayShopWeaponProperties", },
__generated_by_class = "ClassDef",
}
function BobbyRayShopFirearmProperties:GetShopStats(stacks)
return BobbyRayStoreGetStats_Firearm(self)
end
function BobbyRayShopFirearmProperties:GenerateInventoryEntries(stacks)
local items = {}
if self.Used then
local new_item = PlaceInventoryItem(self.class, self)
new_item.Condition = self.Condition
RestoreCloneWeaponComponents(new_item, self)
new_item.Cost = new_item.Cost
table.insert(items, new_item)
else
items = BobbyRayShopItemProperties.GenerateInventoryEntries(self, stacks)
end
for _, weapon in ipairs(items) do
-- make sure all equipped firearms have ammo
local ammo = GetAmmosWithCaliber(weapon.Caliber, "sort")[1]
if ammo then
local tempAmmo = PlaceInventoryItem(ammo.id)
tempAmmo.Amount = tempAmmo.MaxStacks
weapon:Reload(tempAmmo, "suspend_fx")
DoneObject(tempAmmo)
end
end
return items
end
function BobbyRayShopFirearmProperties:GetShopSubIcon()
return CountWeaponUpgrades(self) > 0 and "UI/Inventory/w_mod" or ""
end
DefineClass.BobbyRayShopItemProperties = {
__parents = { "PropertyObject", },
__generated_by_class = "ClassDef",
properties = {
{ category = "BobbyRayShop", id = "CanAppearInShop",
editor = "bool", default = false, template = true, },
{ category = "BobbyRayShop", id = "Tier", name = "Tier",
editor = "combo", default = 1, no_edit = function(self) return not self.CanAppearInShop end, template = true, items = function (self) return { 1, 2, 3 } end, },
{ category = "BobbyRayShop", id = "MaxStock",
editor = "number", default = 3, no_edit = function(self) return not self.CanAppearInShop end, template = true, min = 0, max = 99, },
{ category = "BobbyRayShop", id = "RestockWeight",
editor = "number", default = 100, no_edit = function(self) return not self.CanAppearInShop end, template = true, min = 0, },
{ category = "BobbyRayShop", id = "Stock",
editor = "number", default = 0, no_edit = true, template = true, min = 0, },
{ category = "BobbyRayShop", id = "New",
editor = "bool", default = false, no_edit = true, },
{ category = "BobbyRayShop", id = "Seen",
editor = "bool", default = false, no_edit = true, },
{ category = "BobbyRayShop", id = "LastRestock",
editor = "number", default = -1, no_edit = true, template = true, min = -1, },
{ category = "BobbyRayShop", id = "CanBeConsumed",
editor = "bool", default = true, no_edit = function(self) return not self.CanAppearInShop end, template = true, },
{ category = "BobbyRayShop", id = "CategoryPair",
editor = "preset_id", default = "Missing", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "_Missing", },
{ category = "BobbyRayShop", id = "ShopStackSize",
editor = "number", default = 1, no_edit = function(self) return not (g_Classes[self.id] and g_Classes[self.id].MaxStacks) or not self.CanAppearInShop end, template = true, min = 1, max = 99, },
{ category = "BobbyRayShop", id = "CanAppearStandard",
editor = "bool", default = true, read_only = true, no_edit = true, },
},
}
function BobbyRayShopItemProperties:GetShopDescription()
return (self.Description and self.Description ~= "" and self.Description) or self.AdditionalHint
end
function BobbyRayShopItemProperties:GetShopSubIcon()
return self.SubIcon
end
function BobbyRayShopItemProperties:GetShopStats(stacks)
return {{ Untranslated("(design)"), Untranslated("Not implemented") }}
end
function BobbyRayShopItemProperties:GetCategory()
return BobbyRayShopGetCategory(BobbyRayShopGetSubCategory(self.CategoryPair).Category)
end
function BobbyRayShopItemProperties:GetSubCategory()
return BobbyRayShopGetSubCategory(self.CategoryPair)
end
function BobbyRayShopItemProperties:GenerateInventoryEntries(stacks)
local items = {}
if self.MaxStacks then
local total_amount = stacks * (self.ShopStackSize or 1)
local stacks = DivCeil(total_amount, self.MaxStacks)
local remainder = total_amount - (stacks - 1) * self.MaxStacks
for i = 1, stacks - 1 do
local item = PlaceInventoryItem(self.class, self)
item.Amount = item.MaxStacks
table.insert(items, item)
end
local item = PlaceInventoryItem(self.class, self)
item.Amount = remainder
table.insert(items, item)
else
for i = 1, stacks do
table.insert(items, PlaceInventoryItem(self.class, self))
end
end
return items
end
DefineClass.BobbyRayShopMeleeWeaponProperties = {
__parents = { "BobbyRayShopWeaponProperties", },
__generated_by_class = "ClassDef",
}
function BobbyRayShopMeleeWeaponProperties:GetShopStats(stacks)
return BobbyRayStoreGetStats_MeleeWeapon(self)
end
function BobbyRayShopMeleeWeaponProperties:GetShopSubIcon()
return self.SubIcon
end
DefineClass.BobbyRayShopOtherProperties = {
__parents = { "BobbyRayShopItemProperties", },
__generated_by_class = "ClassDef",
properties = {
{ category = "BobbyRayShop", id = "CategoryPair",
editor = "preset_id", default = "Other", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "Other", },
},
}
function BobbyRayShopOtherProperties:GetShopDescription()
return self.AdditionalHint
end
function BobbyRayShopOtherProperties:GetShopStats(stacks)
return BobbyRayStoreGetStats_Other(self)
end
DefineClass.BobbyRayShopUsedItemProperties = {
__parents = { "BobbyRayShopItemProperties", },
__generated_by_class = "ClassDef",
properties = {
{ category = "BobbyRayShop", id = "CanAppearUsed",
editor = "bool", default = true, no_edit = function(self) return not self.CanAppearInShop end, template = true, },
{ category = "BobbyRayShop", id = "CanAppearStandard",
editor = "bool", default = true, no_edit = function(self) return not self.CanAppearInShop end, template = true, },
{ category = "BobbyRayShop", id = "Used",
editor = "bool", default = false, no_edit = true, },
},
}
function BobbyRayShopUsedItemProperties:GenerateInventoryEntries(stacks)
if self.Used then
local items = {}
local new_item = PlaceInventoryItem(self.class, self)
new_item.Condition = self.Condition
new_item.Cost = new_item.Cost
table.insert(items, new_item)
return items
else
return BobbyRayShopItemProperties.GenerateInventoryEntries(self, stacks)
end
end
function BobbyRayShopUsedItemProperties:GetShopConditionPercent()
return Untranslated{"<percent(condPercent)>", condPercent = self:GetConditionPercent()}
end
DefineClass.BobbyRayShopWeaponProperties = {
__parents = { "BobbyRayShopUsedItemProperties", },
__generated_by_class = "ClassDef",
properties = {
{ category = "BobbyRayShop", id = "CategoryPair",
editor = "preset_id", default = "UtilityWeapons", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "Weapons", },
},
}
function BobbyRayShopWeaponProperties:GetShopStats(stacks)
if self:GetSubCategory().id == "MeleeWeapons" then
return BobbyRayStoreGetStats_MeleeWeapon(self)
else
return BobbyRayStoreGetStats_Firearm(self)
end
end
function BobbyRayShopWeaponProperties:GetShopDescription()
local hasDesc = self.Description and self.Description ~= ""
local hasHint = self.AdditionalHint and self.AdditionalHint ~= ""
return hasDesc and self.Description or hasHint and self.AdditionalHint or FindPreset("WeaponType", self.WeaponType).Description
end
function BobbyRayShopWeaponProperties:GetShopSubIcon()
if IsKindOf(self, "Firearm") then
return CountWeaponUpgrades(self) > 0 and "UI/Inventory/w_mod" or ""
else
return BobbyRayShopItemProperties.GetShopSubIcon(self)
end
end
DefineClass.CapacityItemProperties = {
__parents = { "PropertyObject", },
__generated_by_class = "ClassDef",
properties = {
{ id = "MaxCapacity", name = "Max Capacity",
editor = "number", default = 1000, template = true, min = 0, max = 10000, },
{ id = "capacity",
editor = "number", default = false, no_edit = true, template = true, min = 0, max = 10000, },
{ id = "deplete_progress",
editor = "number", default = 0, no_edit = true, template = true, min = 0, max = 10000, },
{ id = "Deplete",
editor = "func", default = function (self, amount, holder)
self.capacity = self.capacity or self.MaxCapacity
AddScaledProgress(self, "deplete_progress", "capacity", -amount)
if self.capacity == 0 then
local container_slot_name = GetContainerInventorySlotName(holder)
local item = holder:RemoveItem(container_slot_name, self)
if item then
DoneObject(item)
return true
end
end
end, dont_save = true, no_edit = true, params = "self, amount, holder", },
{ id = "IsDepleted",
editor = "func", default = function (self)
return (self.capacity or self.MaxCapacity) <= 0
end, dont_save = true, no_edit = true, },
},
}
DefineClass.ExplosiveProperties = {
__parents = { "PropertyObject", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Explosion", id = "CenterUnitDamageMod", name = "Unit Damage Modifier (Center)", help = "modifier applied to damage when damaging units in the central tile of the explosion",
editor = "number", default = 100, template = true, scale = "%", min = 0, max = 500, },
{ category = "Explosion", id = "CenterObjDamageMod", name = "Object Damage Modifier (Center)", help = "modifier applied to damage when damaging objects in the central tile of the explosion",
editor = "number", default = 100, template = true, scale = "%", min = 0, max = 500, },
{ category = "Explosion", id = "CenterAppliedEffects", name = "Applied Effects (Center)", help = "status effects applied in the central tile of the explosion",
editor = "preset_id_list", default = {}, template = true, preset_class = "CharacterEffectCompositeDef", preset_group = "Default", item_default = "", },
{ category = "Explosion", id = "AreaOfEffect", name = "Area of Effect", help = "the blast range (radius) in number of tiles",
editor = "number", default = 3, template = true, min = 0, max = 20, modifiable = true, },
{ category = "Explosion", id = "CenterAreaOfEffect", name = "Central Area of Effect", help = "the central blast area radius in number of tiles",
editor = "number", default = 1, template = true, min = 1, max = 20, modifiable = true, },
{ category = "Explosion", id = "AreaUnitDamageMod", name = "Unit Damage Modifier (Area)", help = "modifier applied to damage when damaging units outside the central tile of the explosion",
editor = "number", default = 100, template = true, scale = "%", min = 0, max = 500, },
{ category = "Explosion", id = "AreaObjDamageMod", name = "Object Damage Modifier (Area)", help = "modifier applied to damage when damaging objects outside the central tile of the explosion",
editor = "number", default = 100, template = true, scale = "%", min = 0, max = 500, modifiable = true, },
{ category = "Explosion", id = "AreaAppliedEffects", name = "Applied Effects (Area)", help = "status effects applied outside the central tile of the explosion",
editor = "preset_id_list", default = {}, template = true, preset_class = "CharacterEffectCompositeDef", preset_group = "Default", item_default = "", },
{ category = "Explosion", id = "PenetrationClass",
editor = "number", default = 5, template = true,
name = function(self) return "Penetration Class: " .. (PenetrationClassIds[self.PenetrationClass] or "") end, slider = true, min = 1, max = 5, modifiable = true, },
{ category = "Explosion", id = "coneShaped", name = "Cone Shaped",
editor = "bool", default = false, template = true, },
{ category = "Explosion", id = "coneAngle", name = "Cone Angle", help = "The angle of the bigger cone arc",
editor = "number", default = 30, no_edit = function(self) return not self.coneShaped end, template = true, min = 1, max = 360, },
{ category = "Explosion", id = "BurnGround",
editor = "bool", default = true, template = true, },
{ category = "Explosion", id = "DeathType",
editor = "choice", default = "Normal", template = true, items = function (self) return {"Normal", "BlowUp"} end, },
{ id = "dbg_explosion_buttons",
editor = "buttons", default = false, buttons = { {name = "Set Debug Explosion Source", func = "DbgSetExplosionType"}, }, template = true, },
},
}
DefineClass.FirearmProperties = {
__parents = { "ItemWithCondition", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Caliber", id = "Caliber",
editor = "combo", default = false, template = true, items = function (self) return PresetGroupCombo("Caliber", "Default") end, },
{ category = "General", id = "btnAddAmmo",
editor = "buttons", default = false, buttons = { {name = "Add Ammo To Current Unit", func = "UIPlaceInInventoryAmmo"}, }, template = true, },
{ category = "Caliber", id = "Damage", help = "Damage of the firearm",
editor = "number", default = 0, template = true, min = 0, max = 1000, modifiable = true, },
{ category = "Caliber", id = "ObjDamageMod", name = "Objects damage modifier", help = "Multiplicative damage modifier against objects (non-units)",
editor = "number", default = 100, template = true, scale = "%", min = 0, max = 1000, modifiable = true, },
{ category = "Caliber", id = "AimAccuracy", name = "Aim Accuracy", help = "Base chance to hit increase per aim action",
editor = "number", default = 2, template = true, scale = "%", min = 1, modifiable = true, },
{ category = "Caliber", id = "CritChance", name = "Crit Chance", help = "Base chance to cause a critical hit which deals more damage.",
editor = "number", default = 0, template = true, scale = "%", slider = true, min = 0, max = 100, modifiable = true, },
{ category = "Caliber", id = "CritChanceScaled", name = "Crit Chance (Scaled)", help = "Additional chance to cause a critical hit (scaled by level, specified number is at merc level 10)",
editor = "number", default = 10, template = true, scale = "%", slider = true, min = 0, max = 100, modifiable = true, },
{ category = "Caliber", id = "MagazineSize", name = "Magazine Size", help = "Number of bullets in a single clip",
editor = "number", default = 1, template = true, min = 1, max = 1000, modifiable = true, },
{ category = "Caliber", id = "PenetrationClass",
editor = "number", default = 1, template = true,
name = function(self) return "Penetration Class: " .. (PenetrationClassIds[self.PenetrationClass] or "") end, slider = true, min = 1, max = 5, modifiable = true, },
{ category = "Caliber", id = "IgnoreCoverReduction", name = "Ignore Cover Reduction", help = "If > 0 attacks with this weapon will ignore the damage reduction that would normally apply for targets in cover.",
editor = "number", default = 0, template = true, min = 0, max = 100, modifiable = true, },
{ category = "Caliber", id = "WeaponRange", name = "Range", help = "Range at which the penalty of the gun is 100.",
editor = "number", default = 20, template = true, slider = true, min = 1, max = 200, modifiable = true, },
{ category = "Caliber", id = "PointBlankBonus", help = "attacks get bonus CTH in point-blank range",
editor = "number", default = 0, template = true, min = 0, max = 1, modifiable = true, },
{ category = "Caliber", id = "OverwatchAngle", name = "Overwatch Angle", help = "overwatch area cone angle",
editor = "number", default = 2400, template = true,
no_edit = function(self) return
(self.PreparedAttackType ~= "Overwatch" and self.PreparedAttackType ~= "Both" and self.PreparedAttackType ~= "Machine Gun")
end, scale = "deg", slider = true, min = 1, max = 5400, modifiable = true, },
{ category = "Caliber", id = "BuckshotConeAngle", name = "Buckshot Cone Angle",
editor = "number", default = 1600, template = true,
no_edit = function(self) return not table.find(self.AvailableAttacks, "Buckshot") end, scale = "deg", min = 60, max = 7200, modifiable = true, },
{ category = "Caliber", id = "BuckshotFalloffDamage", name = "Buckshot Falloff Damage", help = "what percent of nominal damage is the attack dealing at max range (cone length)",
editor = "number", default = 25, template = true,
no_edit = function(self) return not table.find(self.AvailableAttacks, "Buckshot") end, scale = "%", min = 0, max = 100, modifiable = true, },
{ category = "Caliber", id = "BuckshotFalloffStart", name = "Buckshot Falloff Start", help = "at what percent of the max distance (cone length) does the damage falloff start",
editor = "number", default = 50, template = true,
no_edit = function(self) return not table.find(self.AvailableAttacks, "Buckshot") end, scale = "%", min = 0, max = 100, modifiable = true, },
{ category = "Caliber", id = "Noise", name = "Noise Range", help = "Range (in tiles) in which the weapon alerts unaware enemies when firing.",
editor = "number", default = 20, template = true, min = 0, max = 100, modifiable = true, },
{ category = "Caliber", id = "RangePenalty", name = "Range Penalty",
editor = "accuracy_chart", default = "", dont_save = true, template = true, },
{ category = "General", id = "HandSlot", help = "One-haneded or two-handed weapon.",
editor = "combo", default = "OneHanded", template = true, items = function (self) return { "OneHanded", "TwoHanded" } end, },
{ category = "Body & Components", id = "Entity",
editor = "combo", default = false, template = true, items = function (self) return GetWeaponEntities end, },
{ category = "Body & Components", id = "fxClass", name = "FX Class", help = "use to override the default fx class of this weapon",
editor = "combo", default = "", template = true, items = function (self) return ItemTemplatesCombo("FirearmProperties") end, },
{ category = "Body & Components", id = "ComponentSlots",
editor = "nested_list", default = false, template = true, base_class = "WeaponComponentSlot", inclusive = true, },
{ category = "Body & Components", id = "Color",
editor = "combo", default = "Olive", template = true, items = function (self) return Presets.WeaponColor.Default end, },
{ category = "Body & Components", id = "BaseDifficulty", help = 'Base difficulty value compared against the "Mechanical" skill.',
editor = "number", default = false, template = true, min = 0, max = 10000000, modifiable = true, },
{ category = "Body & Components", id = "HolsterSlot", help = "By default Two Handed weapons go on shoulders, One Handed go to legs",
editor = "combo", default = "", template = true, items = function (self) return { "", "Shoulder", "Leg" } end, },
{ category = "Body & Components", id = "ModifyRightHandGrip",
editor = "bool", default = false, template = true, },
{ category = "General", id = "PreparedAttackType", name = "Prepared Attack Type",
editor = "choice", default = "Overwatch", template = true, items = function (self) return { "Overwatch", "Pin Down", "None", "Both", "Machine Gun" } end, },
{ category = "General", id = "AvailableAttacks", name = "Available Attacks",
editor = "preset_id_list", default = {}, template = true, preset_class = "CombatAction", preset_group = "WeaponAttacks", item_default = "", },
{ category = "ActionPoints", id = "ShootAP", name = "Shoot", help = "Action points needed to shoot a single shot",
editor = "number", default = 1000, template = true, scale = "AP", min = 1000, max = 50000, modifiable = true, },
{ category = "ActionPoints", id = "ReloadAP", name = "Reload", help = "Action points needed to reload the gun",
editor = "number", default = 1000, template = true, scale = "AP", min = 1000, max = 50000, modifiable = true, },
{ category = "ActionPoints", id = "MaxAimActions", name = "Max Aim Actions", help = "Max number of aim actions allowed",
editor = "number", default = 3, min = 0, max = 5, modifiable = true, },
{ category = "Debug", id = "SetRange", name = "Range",
editor = "number", default = 10, dont_save = true, template = true, slider = true, min = 0, max = 50, },
{ category = "Debug", id = "DPS",
editor = "number", default = false, dont_save = true, read_only = true, template = true, min = 0, max = 1000, },
},
}
function FirearmProperties:GetDPS()
return self:GetProperty("Damage") * Max(0, GetRangeAccuracy(self, self:GetProperty("SetRange")*const.SlabSizeX)) / 100
end
function FirearmProperties:HasPointBlankBonus()
return self.PointBlankBonus ~= 0
end
DefineClass.GrenadeProperties = {
__parents = { "ItemWithCondition", "MishapProperties", "ExplosiveProperties", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Combat", id = "BaseDamage", name = "Base Damage",
editor = "number", default = 20, template = true, min = 0, max = 200, },
{ category = "Combat", id = "Scatter", help = "area in which the grenade may scatter defined as a radius in tiles.",
editor = "number", default = 3, template = true, min = 0, max = 20, },
{ category = "Combat", id = "AttackAP", name = "Attack AP", help = "AP to throw the greanade",
editor = "number", default = 6000, template = true, scale = "AP", step = 1000, slider = true, min = 1000, max = 15000, },
{ category = "Combat", id = "BaseRange", name = "Throw Range (Min)", help = "Number of tiles that this grenade can be thrown by a unit with 0 Strength.",
editor = "number", default = 5, template = true, min = -10, max = 30, },
{ category = "Combat", id = "ThrowMaxRange", name = "Throw Range (Max)", help = "Number of tiles that this grenade can be thrown by a unit with 100 Strength.",
editor = "number", default = 15, template = true, min = -10, max = 30, },
{ category = "Combat", id = "CanBounce",
editor = "bool", default = true, template = true, },
{ category = "Combat", id = "InaccurateMinOffset", name = "Min Offset (Inaccurate Throw)", help = "Minimum distance to the target point for inaccurate throws, at 10 tiles",
editor = "number", default = 1000, template = true, scale = "m", min = 1, max = 20000, },
{ category = "Combat", id = "InaccurateMaxOffset", name = "Max Offset (Inaccurate Throw)", help = "Maximum distance to the target point for inaccurate throws, at 10 tiles",
editor = "number", default = 5000, template = true, scale = "m", min = 1, max = 20000, },
{ category = "Combat", id = "IgnoreCoverReduction", name = "Ignore Cover Reduction", help = "If > 0 attacks with this weapon will ignore the damage reduction that would normally apply for targets in cover.",
editor = "number", default = 0, template = true, min = 0, max = 100, modifiable = true, },
{ category = "Combat", id = "Noise", name = "Noise", help = "Range (in tiles) in which the explosion alerts unaware enemies.",
editor = "number", default = 20, template = true, min = 0, max = 100, modifiable = true, },
{ category = "Combat", id = "ThrowNoise", name = "Throw Noise", help = "Range (in tiles) in which items that do not explode immediately can still alert enemies when they land.",
editor = "number", default = 3, template = true, min = 0, max = 100, modifiable = true, },
{ category = "Combat", id = "aoeType", name = "AOE Type", help = "additional effect that happens after the explosion (optional)",
editor = "choice", default = "none", template = true, items = function (self) return {"none", "fire", "smoke", "teargas", "toxicgas"} end, },
{ category = "General", id = "Entity",
editor = "choice", default = false, read_only = true, no_edit = true, template = true, items = function (self) return ClassDescendantsCombo("GrenadeVisual") end, },
{ category = "General", id = "ActionIcon", name = "Throw Action Icon",
editor = "ui_image", default = false, template = true, },
},
}
DefineClass.HeavyWeaponProperties = {
__parents = { "ItemWithCondition", "MishapProperties", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Caliber", id = "Caliber",
editor = "combo", default = false, template = true, items = function (self) return PresetGroupCombo("Caliber", "Default") end, },
{ category = "Combat", id = "AttackAP", name = "Attack AP", help = "AP to throw the greanade",
editor = "number", default = 6000, template = true, scale = "AP", step = 1000, slider = true, min = 1000, max = 15000, },
{ category = "Combat", id = "BombardRadius", help = "defines the radius (in tiles) of the zone where the bombard ordnance can fall",
editor = "number", default = 4, template = true, min = 0, max = 10, modifiable = true, },
{ category = "Body & Components", id = "ComponentSlots",
editor = "nested_list", default = false, template = true, base_class = "WeaponComponentSlot", inclusive = true, },
{ category = "Body & Components", id = "Entity",
editor = "combo", default = false, template = true, items = function (self) return GetWeaponEntities end, },
},
}
DefineClass.InventoryItemProperties = {
__parents = { "ItemWithCondition", },
__generated_by_class = "ClassDef",
properties = {
{ category = "General", id = "Icon",
editor = "ui_image", default = "", template = true, image_preview_size = 400, },
{ category = "General", id = "SubIcon", help = "A small icon on the bootom left side of the item's icon",
editor = "ui_image", default = "", template = true, image_preview_size = 30, },
{ category = "General", id = "ItemType",
editor = "preset_id", default = false, template = true, preset_class = "WeaponType", },
{ category = "General", id = "DisplayName", name = "Display Name",
editor = "text", default = false, template = true, translate = true, },
{ category = "General", id = "DisplayNamePlural", name = "Display Name Plural",
editor = "text", default = false, template = true, translate = true, },
{ category = "General", id = "colorStyle", name = "Color Style",
editor = "preset_id", default = false, template = true, preset_class = "TextStyle", },
{ category = "General", id = "Description",
editor = "text", default = false, template = true, translate = true, lines = 1, max_lines = 3, },
{ category = "General", id = "AdditionalHint", name = "Additional Hint", help = "Additional keywords text to add to item's rollover hint. Added after the autogenerated keyswors for weapons.",
editor = "text", default = false, template = true, translate = true, lines = 1, max_lines = 10, },
{ category = "General", id = "LargeItem",
editor = "number", default = 0, template = true, slider = true, min = 0, max = 1, modifiable = true, },
{ category = "General", id = "Cumbersome",
editor = "number", default = 0, template = true, slider = true, min = 0, max = 1, modifiable = true, },
{ category = "General", id = "UnitStat", name = "Unit Stat", help = "Unit Properties stat.",
editor = "choice", default = false, template = true, items = function (self) return GetUnitStatsCombo() end, },
{ category = "General", id = "Valuable", name = "Valuable Item (for VR only)", help = "Will check whether to play the ValuableItemFound VR",
editor = "number", default = 0, template = true, min = 0, max = 1, modifiable = true, },
{ category = "General", id = "btnAddItem",
editor = "buttons", default = false, buttons = { {name = "Add To Current Unit", func = "UIPlaceInInventory"}, }, template = true, },
{ category = "BobbyRayShop", id = "Cost", help = "How much this item costs to buy in $",
editor = "number", default = 1000, template = true, min = 0, max = 10000000, modifiable = true, },
{ category = "General", id = "loot_def", name = "LootDef", help = "Loot def for the items ValuableItemContainer contains",
editor = "preset_id", default = false, no_edit = function(self) return self.object_class ~= "ValuableItemContainer" end, template = true, preset_class = "LootDef", },
{ category = "General", id = "locked", name = "Locked", help = "Locked items cannot be moved from their slot. They also disappear when the bearer dies.",
editor = "bool", default = false, template = true, },
{ category = "Reactions", id = "OnItemGained",
editor = "func", default = function (self, owner, slot) end, template = true, params = "self, owner, slot", },
{ category = "Reactions", id = "OnItemLost",
editor = "func", default = function (self, owner, slot) end, template = true, params = "self, owner, slot", },
{ id = "owner", name = "Owner", help = "The item owner if any.",
editor = "text", default = false, },
{ id = "extra_tag", help = "Extra data to identify unique items. Note that for stacking items this will be wiped when they're stacked.",
editor = "text", default = false, },
{ id = "base_drop_chance",
editor = "number", default = 5, read_only = true, no_edit = true, },
{ id = "drop_chance",
editor = "number", default = 0, read_only = true, no_edit = true, },
{ id = "guaranteed_drop",
editor = "bool", default = false, read_only = true, no_edit = true, },
},
}
function InventoryItemProperties:GetColoredName(plural)
local style = TextStyles[self.colorStyle]
if style then
local r, g, b = GetRGB(style.TextColor)
local colorTag = string.format("<color %i %i %i>", r, g, b)
return T{236471449642, "<colorTag><name></color>", colorTag = colorTag, name = plural and self.DisplayNamePlural or self.DisplayName }
else
return plural and self.DisplayNamePlural or self.DisplayName
end
end
function InventoryItemProperties:GetEquipCost()
return const["Action Point Costs"].EquipItem
end
function InventoryItemProperties:GetUIWidth()
return self:IsLargeItem() and 2 or 1
end
function InventoryItemProperties:GetUIHeight()
return 1
end
function InventoryItemProperties:GetRolloverType()
return self.ItemType
end
function InventoryItemProperties:IsLargeItem()
return self.LargeItem ~= 0
end
function InventoryItemProperties:IsCumbersome()
return self.Cumbersome ~= 0
end
function InventoryItemProperties:IsValuable()
return self.Valuable ~= 0
end
DefineClass.InventoryTab = {
__parents = { "ListPreset", },
__generated_by_class = "PresetDef",
properties = {
{ id = "display_name",
editor = "text", default = false, translate = true, lines = 2, max_lines = 100, },
{ id = "icon",
editor = "ui_image", default = "UI/Inventory/tabs_all.png", image_preview_size = 100, },
{ id = "item_classes",
editor = "string_list", default = {}, item_default = "", items = false, },
{ id = "FilterItem",
editor = "func", default = function (self, item)
if not next(self.item_classes) then
return true
end
return IsKindOfClasses(item, self.item_classes)
end, template = true, params = "self, item", },
},
GlobalMap = "InventoryTabs",
}
DefineClass.ItemUpgradeProperties = {
__parents = { "PropertyObject", },
__generated_by_class = "ClassDef",
properties = {
{ id = "Slot",
editor = "combo", default = "Modification", template = true, items = function (self) return {"Underslung", "Muzzle", "Sights", "Magazine", "Modification"} end, },
},
}
DefineClass.ItemWithCondition = {
__parents = { "PropertyObject", "ScrapableItem", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Condition", id = "Condition", help = "The overall condition of the item which is lowered when the item is fired/hit",
editor = "number", default = 100, template = true, min = 0, max = 10000, },
{ category = "Condition", id = "RepairCost", name = "Repair Cost", help = "How long it takes to repair the item using Mechanical skill. Each hour a mechanic contributes his/her skill towards repair. To increase Condition by 1 point the merc has to contribute this much points.",
editor = "number", default = 80, template = true, min = 0, max = 1000, },
{ category = "Condition", id = "Repairable", name = "Repairable", help = "Whether the item can be repaired",
editor = "bool", default = true, template = true, },
{ category = "Condition", id = "Reliability", help = "For guns. Percentage. How fast or slowly condition is lost when the gun is fired. High percentage means that the gun is more reliable.",
editor = "number", default = 40, template = true,
no_edit = function(self) local class = g_Classes[self.object_class or false]
return not IsKindOf(class, "FirearmBase") end, slider = true, min = 0, max = 98, modifiable = true, },
{ category = "Condition", id = "Degradation", help = "For armors. When the armor is hit how much of the damage is transfered as condition loss.",
editor = "number", default = 50, template = true,
no_edit = function(self) local class = g_Classes[self.object_class or false]
return not IsKindOf(class, "Armor") end, slider = true, min = 0, max = 100, },
{ category = "Condition", id = "repair_progress",
editor = "number", default = 0, no_edit = true, template = true, },
},
}
function ItemWithCondition:AmountOfScrapPartsFromItem()
local parts = self:GetScrapParts()
if self.Condition and self.Condition < 50 then
parts = parts / 2
end
return parts
end
DefineClass.MeleeWeaponProperties = {
__parents = { "ItemWithCondition", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Combat", id = "BaseChanceToHit", name = "Base Chance To Hit", help = "Multiplies chance to hit finaly. Used to define differently accurate weapon types.",
editor = "number", default = 90, template = true, slider = true, min = 0, max = 100, },
{ category = "Combat", id = "CritChance", name = "Crit Chance", help = "Base chance to cause a critical hit which deals more damage.",
editor = "number", default = 0, template = true, scale = "%", slider = true, min = 0, max = 100, modifiable = true, },
{ category = "Combat", id = "CritChanceScaled", name = "Crit Chance (Scaled)", help = "Additional chance to cause a critical hit (scaled by level, specified number is at merc level 10)",
editor = "number", default = 10, template = true, scale = "%", slider = true, min = 0, max = 100, modifiable = true, },
{ category = "Combat", id = "BaseDamage", name = "Base Damage", help = "Melee weapon damage scales based on damage. This property defines the base cost.",
editor = "number", default = 10, template = true, min = 0, max = 200, },
{ category = "Combat", id = "AimAccuracy", name = "Aim Accuracy", help = "Base chance to hit increase per aim action",
editor = "number", default = 2, template = true, scale = "%", min = 1, modifiable = true, },
{ category = "Combat", id = "PenetrationClass",
editor = "number", default = 1, template = true,
name = function(self) return "Penetration Class: " .. (PenetrationClassIds[self.PenetrationClass] or "") end, slider = true, min = 1, max = 5, modifiable = true, },
{ category = "Combat", id = "DamageMultiplier", name = "Damage Multiplier", help = "In %. Strength stat is multiplied by this percentage when multiplying melee damage",
editor = "number", default = 200, template = true, scale = "%", min = 0, max = 1000, },
{ category = "Combat", id = "IgnoreCoverReduction", name = "Ignore Cover Reduction", help = "If > 0 attacks with this weapon will ignore the damage reduction that would normally apply for targets in cover.",
editor = "number", default = 0, template = true, min = 0, max = 100, modifiable = true, },
{ category = "Combat", id = "CanThrow", name = "Can Throw",
editor = "bool", default = false, template = true, },
{ category = "Combat", id = "WeaponRange", name = "Range", help = "Range at which the penalty of the gun is 100.",
editor = "number", default = 8, template = true,
no_edit = function(self) return not self.CanThrow end, slider = true, min = 1, max = 20, modifiable = true, },
{ category = "Combat", id = "Charge",
editor = "bool", default = false, template = true, },
{ category = "Combat", id = "IsUnarmed",
editor = "bool", default = false, template = true, },
{ category = "Action Points", id = "AttackAP", name = "Attack", help = "Action Points needed to make a basic attack.",
editor = "number", default = 5000, template = true, scale = "AP", min = 0, max = 30000, },
{ category = "Action Points", id = "MaxAimActions", name = "Max Aim Actions", help = "Max number of allowed aim actions.",
editor = "number", default = 2, template = true, min = 0, max = 4, },
{ category = "Melee Weapon", id = "Noise", help = "How much noise the weapon makes when attacking.",
editor = "number", default = 100, template = true, min = 0, max = 1000, },
{ category = "Melee Weapon", id = "NeckAttackType",
editor = "choice", default = "bleed", template = true, items = function (self) return {"choke", "bleed", "lethal"} end, },
{ category = "Body & Components", id = "Entity",
editor = "combo", default = false, template = true, items = function (self) return GetWeaponEntities end, },
{ category = "Body & Components", id = "fxClass", name = "FX Class", help = "use to override the default fx class of this weapon",
editor = "combo", default = "", template = true, items = function (self) return ItemTemplatesCombo("MeleeWeaponProperties") end, },
{ category = "Body & Components", id = "HolsterSlot", help = "By default Two Handed weapons go on shoulders, One Handed go to legs",
editor = "combo", default = "", template = true, items = function (self) return { "", "Shoulder", "Leg" } end, },
},
}
DefineClass.MiscItemProperties = {
__parents = { "ItemWithCondition", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Execution", id = "effect_moment", name = "Effect moment",
editor = "choice", default = false, template = true, items = function (self) return InventoryItemEffectMoments end, },
{ category = "Execution", id = "Effects", help = "Effects that are executed when consuming an item.",
editor = "nested_list", default = false, template = true, base_class = "Effect", },
{ category = "Execution", id = "action_name", name = "Name", help = "Action name",
editor = "text", default = false, template = true, translate = true, },
{ category = "Execution", id = "destroy_item", name = "Destroy item", help = "Destroy item after execution.",
editor = "bool", default = false, template = true, },
{ category = "Execution", id = "onlyOnMap", name = "Only on Map", help = "Can be used only when the unit is on a loaded map.",
editor = "bool", default = false, template = true, },
{ category = "Execution", id = "APCost", name = "AP Cost", help = "How much does the item cost to use while in combat.",
editor = "number", default = 2, template = true, },
},
}
DefineClass.OrdnanceProperties = {
__parents = { "ExplosiveProperties", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Caliber", id = "Caliber",
editor = "combo", default = false, template = true, items = function (self) return PresetGroupCombo("Caliber", "Default") end, },
{ category = "Caliber", id = "MaxStacks", name = "Max Stacks", help = "Ammo can stack up to that number.",
editor = "number", default = 10, template = true, slider = true, min = 1, max = 10000, },
{ category = "Combat", id = "BaseDamage", name = "Base Damage",
editor = "number", default = 20, template = true, min = 0, },
{ category = "Combat", id = "Noise", name = "Noise", help = "Range (in tiles) in which the explosion alerts unaware enemies.",
editor = "number", default = 20, template = true, min = 0, max = 100, modifiable = true, },
{ category = "Combat", id = "aoeType", name = "AOE Type", help = "additional effect that happens after the explosion (optional)",
editor = "choice", default = "none", template = true, items = function (self) return {"none", "fire", "smoke", "teargas", "toxicgas"} end, },
{ category = "Combat", id = "CanBounce",
editor = "bool", default = false, template = true, },
{ category = "General", id = "Entity",
editor = "choice", default = false, read_only = true, no_edit = true, template = true, items = function (self) return ClassDescendantsCombo("GrenadeVisual") end, },
{ category = "General", id = "ammo_type_icon", name = "Ammo Type Icon", help = "Ammo type icon",
editor = "ui_image", default = false, template = true, },
},
}
DefineClass.QuestItemProperties = {
__parents = { "PropertyObject", },
__generated_by_class = "ClassDef",
}
DefineClass.ScrapableItem = {
__parents = { "PropertyObject", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Condition", id = "ScrapParts", name = "Scrap Parts", help = "The number for Parts that are given to the player when its scraped",
editor = "number", default = 0, template = true, min = 0, max = 1000, },
},
}
function ScrapableItem:GetScrapParts()
return self.ScrapParts
end
function ScrapableItem:AmountOfScrapPartsFromItem()
return self:GetScrapParts()
end
DefineClass.StatBoostItemProperties = {
__parents = { "ItemWithCondition", },
__generated_by_class = "ClassDef",
properties = {
{ category = "Stat boost item", id = "stat", name = "Stat",
editor = "choice", default = false, template = true, items = function (self) return GetUnitStatsCombo end, },
{ category = "Stat boost item", id = "boost", name = "Boost value",
editor = "number", default = false, template = true, },
},
}
DefineClass.TransmutedItemProperties = {
__parents = { "ItemWithCondition", },
__generated_by_class = "ClassDef",
properties = {
{ id = "OriginalItemId",
editor = "preset_id", default = false, preset_class = "InventoryItemCompositeDef", },
{ id = "RevertCondition",
editor = "combo", default = false, items = function (self) return {"attacks", "damage"} end, },
{ id = "RevertConditionCounter",
editor = "number", default = false, },
},
}
function TransmutedItemProperties:MakeTransmutation(fromitem)
local new_item, prev_item
if fromitem =="revert" then
new_item = PlaceInventoryItem(self.OriginalItemId)
prev_item = self
else
new_item = self
prev_item = fromitem
end
new_item.Condition = prev_item.Condition
return new_item, prev_item
end