From ee4bc2de728427fcc9cecb46fae57f53edcc3201 Mon Sep 17 00:00:00 2001 From: jkolokotronis Date: Fri, 27 Mar 2015 16:56:39 +0100 Subject: [PATCH] gold items fix/no longer overwriting some recipes/fixed dorf fort exit fail/fences not initializing properly --- HeroInTheDark/scripts/fa_electricalfence.lua | 14 +++----------- HeroInTheDark/scripts/fa_recipes.lua | 5 ++--- HeroInTheDark/scripts/fa_strings.lua | 7 ++++++- .../scripts/postinits/fa_objectpostinits.lua | 13 +++++++++++++ HeroInTheDark/scripts/prefabs/fa_basearmor.lua | 4 ++-- HeroInTheDark/scripts/prefabs/fa_dorfhut.lua | 13 ++++++++++++- HeroInTheDark/scripts/prefabs/fa_dungeon_exit.lua | 8 ++++---- HeroInTheDark/scripts/prefabs/fa_hats.lua | 4 ++-- HeroInTheDark/scripts/prefabs/fa_potions.lua | 2 +- HeroInTheDark/scripts/prefabs/fa_totems.lua | 5 ++++- 10 files changed, 49 insertions(+), 26 deletions(-) diff --git a/HeroInTheDark/scripts/fa_electricalfence.lua b/HeroInTheDark/scripts/fa_electricalfence.lua index 19187537..498a8551 100644 --- a/HeroInTheDark/scripts/fa_electricalfence.lua +++ b/HeroInTheDark/scripts/fa_electricalfence.lua @@ -170,7 +170,7 @@ function FA_ElectricalFence:StartTask() local alpha=math.atan(WALL_WIDTH/dist) local r=math.tan(alpha)*WALL_WIDTH+dist local angle=node:GetAngleToPoint(v:GetPosition()) - local ents = TheSim:FindEntities(middle.x, middle.y, middle.z, r,self.dotags,self.donttags) + local ents = TheSim:FindEntities(middle.x, middle.y, middle.z, r,nil,self.donttags) for i,caught in pairs(ents) do if(caught and caught.components.combat and not (caught.components.health and caught.components.health:IsDead()))then local caughtangle=node:GetAngleToPoint(caught:GetPosition())-angle @@ -201,6 +201,7 @@ function FA_FenceManager:ConfigFence(tag,caster,dotags, donttags) local fence=self.fences[tag] if(fence==nil)then fence=FA_ElectricalFence() + self.fences[tag]=fence end fence:Config(caster,dotags,donttags) end @@ -236,6 +237,7 @@ function FA_FenceManager:AddNode(node) local fence=self.fences[tag] if(fence==nil)then fence=FA_ElectricalFence() + self.fences[tag]=fence end fence:AddNode(node) end @@ -249,15 +251,5 @@ end local FenceManager=FA_FenceManager() -FA_ModUtil.AddPrefabPostInit("world",function(inst) - inst:DoTaskInTime(0,function() - --need to delay activate for player, but i could just fire it up for the rest without delays? Meh --- inst:DoTaskInTime(0,function() - FenceManager:ConfigFence("lightningfence",GetPlayer(),{"lightningfence"}, {"FX", "DECOR","INLIMBO","pet","companion","player","lightningfence"}) - FenceManager:ConfigFence("lightningfence_kos",nil,{"lightningfence_kos"},{"FX", "DECOR","INLIMBO","lightningfence"}) - FenceManager:Init() - end) --- end) -end) return {FenceManager=FenceManager} \ No newline at end of file diff --git a/HeroInTheDark/scripts/fa_recipes.lua b/HeroInTheDark/scripts/fa_recipes.lua index 9521a356..3e0982f0 100644 --- a/HeroInTheDark/scripts/fa_recipes.lua +++ b/HeroInTheDark/scripts/fa_recipes.lua @@ -124,7 +124,7 @@ local r=Recipe("multitool_axe_pickaxe", {Ingredient("bluegem", 2)}, RECIPETABS.F local r=Recipe("sewing_kit", {Ingredient("goldnugget", 5)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFITEMSTAND, nil, nil, true) local r=Recipe("armorslurper", {Ingredient("fa_diamondpebble", 1,"images/inventoryimages/fa_inventoryimages.xml")}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFITEMSTAND, nil, nil, true) local r=Recipe("sewing_kit", {Ingredient("goldnugget", 5)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFITEMSTAND, nil, nil, true) -local r=Recipe("lantern", {Ingredient("goldnugget", 5)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFITEMSTAND, nil, nil, true) +local r=Recipe("fa_dorf_lantern", {Ingredient("goldnugget", 5)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFITEMSTAND, nil, nil, true) local r=Recipe("trap_teeth", {Ingredient("goldnugget", 5)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFITEMSTAND, nil, nil, true) --Dwarf bed 2 red gems local r=Recipe("yellowstaff", {Ingredient("fa_diamondpebble", 3,"images/inventoryimages/fa_inventoryimages.xml")}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFITEMSTAND, nil, nil, true) @@ -134,7 +134,6 @@ r.atlas = "images/inventoryimages/fa_inventoryimages.xml" local r=Recipe("fa_smalldorfbag", {Ingredient("fa_diamondpebble", 7,"images/inventoryimages/fa_inventoryimages.xml")}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFITEMSTAND, nil, nil, true) r.image="fa_bag.tex" r.atlas = "images/inventoryimages/fa_inventoryimages.xml" -local r=Recipe("yellowstaff", {Ingredient("fa_diamondpebble", 3,"images/inventoryimages/fa_inventoryimages.xml")}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFITEMSTAND, nil, nil, true) local r=Recipe("fa_recipebook", {Ingredient("fa_diamondpebble", 3,"images/inventoryimages/fa_inventoryimages.xml")}, RECIPETABS.FA_DWARFTRADER,TECH.FA_DORFITEMSTAND, nil, nil, true) r.image="book_birds.tex" @@ -150,7 +149,7 @@ r.atlas = "images/inventoryimages/fa_inventoryimages.xml" local r=Recipe("fa_dorfbed_player", {Ingredient("bluegem", 2)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFRESOURCESTAND, "fa_dorfbed_player_placer",nil,true) r.image="tent.tex" local r=Recipe("charcoal", {Ingredient("goldnugget", 5)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFRESOURCESTAND, nil, nil, true,20) -local r=Recipe("gunpowder", {Ingredient("goldnugget", 1)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFRESOURCESTAND, nil, nil, true) +local r=Recipe("fa_dorf_gunpowder", {Ingredient("goldnugget", 1)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFRESOURCESTAND, nil, nil, true) local r=Recipe("thulecite", {Ingredient("goldnugget", 5)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFRESOURCESTAND, nil, nil, true) local r=Recipe("marble", {Ingredient("goldnugget", 5)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFRESOURCESTAND, nil, nil, true,5) local r=Recipe("bluegem", {Ingredient("goldnugget", 5)}, RECIPETABS.FA_DWARFTRADER, TECH.FA_DORFRESOURCESTAND, nil, nil, true) diff --git a/HeroInTheDark/scripts/fa_strings.lua b/HeroInTheDark/scripts/fa_strings.lua index b9350429..4b2b90b7 100644 --- a/HeroInTheDark/scripts/fa_strings.lua +++ b/HeroInTheDark/scripts/fa_strings.lua @@ -1422,7 +1422,12 @@ STRINGS.NAMES.FA_MINECART = "Minecart" STRINGS.CHARACTERS.GENERIC.DESCRIBE.FA_MINECART = "Minecart" STRINGS.NAMES.FA_ORCREFUSE = "Orc Refuse Pile" STRINGS.CHARACTERS.GENERIC.DESCRIBE.FA_ORCREFUSE = "Orc Refuse Pile" - +STRINGS.NAMES.FA_DORF_LANTERN = "Dwarven Lantern" +STRINGS.CHARACTERS.GENERIC.DESCRIBE.FA_DORF_LANTERN = "Dwarven Lantern" +STRINGS.RECIPE_DESC.FA_DORF_LANTERN = "Dwarven Lantern" +STRINGS.NAMES.FA_DORF_GUNPOWDER = "Dwarven Gunpowder" +STRINGS.CHARACTERS.GENERIC.DESCRIBE.FA_DORF_GUNPOWDER = "Dwarven Gunpowder" +STRINGS.RECIPE_DESC.FA_DORF_GUNPOWDER = "Dwarven Gunpowder" STRINGS.NAMES.FA_BLUERACK = "Armor Rack" STRINGS.CHARACTERS.GENERIC.DESCRIBE.FA_BLUERACK = "Armor Rack" diff --git a/HeroInTheDark/scripts/postinits/fa_objectpostinits.lua b/HeroInTheDark/scripts/postinits/fa_objectpostinits.lua index c67556a8..3559451a 100644 --- a/HeroInTheDark/scripts/postinits/fa_objectpostinits.lua +++ b/HeroInTheDark/scripts/postinits/fa_objectpostinits.lua @@ -1,4 +1,17 @@ +local fences=require "fa_electricalfence" +local FenceManager=fences.FenceManager + +FA_ModUtil.AddPrefabPostInit("world",function(inst) + inst:DoTaskInTime(0,function() + --need to delay activate for player, but i could just fire it up for the rest without delays? Meh +-- inst:DoTaskInTime(0,function() + FenceManager:ConfigFence("lightningfence",GetPlayer(),{"lightningfence"}, {"FX", "DECOR","INLIMBO","pet","companion","player","lightningfence"}) + FenceManager:ConfigFence("lightningfence_kos",nil,{"lightningfence_kos"},{"FX", "DECOR","INLIMBO","lightningfence"}) + FenceManager:Init() + end) +-- end) +end) local doSkeletonSpawn=function(inst) local skel=SpawnPrefab("skeletonspawn") diff --git a/HeroInTheDark/scripts/prefabs/fa_basearmor.lua b/HeroInTheDark/scripts/prefabs/fa_basearmor.lua index a3070885..63893ba6 100644 --- a/HeroInTheDark/scripts/prefabs/fa_basearmor.lua +++ b/HeroInTheDark/scripts/prefabs/fa_basearmor.lua @@ -116,10 +116,10 @@ local function goldarmor() if(FA_DLCACCESS)then - inst.components.equippable.dapperness = -ARMOR_GOLD_DAPPERNESS + inst.components.equippable.dapperness = ARMOR_GOLD_DAPPERNESS else inst:AddComponent("dapperness") - inst.components.dapperness.dapperness = -ARMOR_GOLD_DAPPERNESS + inst.components.dapperness.dapperness = ARMOR_GOLD_DAPPERNESS end diff --git a/HeroInTheDark/scripts/prefabs/fa_dorfhut.lua b/HeroInTheDark/scripts/prefabs/fa_dorfhut.lua index 18f4e94d..514ab170 100644 --- a/HeroInTheDark/scripts/prefabs/fa_dorfhut.lua +++ b/HeroInTheDark/scripts/prefabs/fa_dorfhut.lua @@ -391,6 +391,15 @@ local function fndorfotherrecipes() return inst end +local function fndorflantern() + local inst = Prefabs["lantern"].fn() + return inst +end +local function fndorfgunpowder() + local inst = Prefabs["gunpowder"].fn() + return inst +end + return Prefab( "common/objects/fa_dorfhut", fnhut, hutassets, prefabs ), Prefab( "common/objects/fa_dorfbed", fnbed, bedassets, prefabs ), Prefab( "common/objects/fa_dorfstand", fnstand, standassets, prefabs ), @@ -405,4 +414,6 @@ Prefab( "common/objects/fa_dorfstand_recipe_weapon_5", fnweaponrecipes, standass Prefab( "common/objects/fa_dorfstand_equipment_6", fndorfequipment, standassets, prefabs ), Prefab( "common/objects/fa_dorfstand_recipe_armor_7", fndorfarmorrecipes, standassets, prefabs ), Prefab( "common/objects/fa_dorfstand_recipe_smelting_8", fndorfsmelterrecipes, standassets, prefabs ), -Prefab( "common/objects/fa_dorfstand_recipe_other_9", fndorfotherrecipes, standassets, prefabs ) \ No newline at end of file +Prefab( "common/objects/fa_dorfstand_recipe_other_9", fndorfotherrecipes, standassets, prefabs ), +Prefab( "common/objects/fa_dorf_lantern", fndorflantern, {}, {} ), +Prefab( "common/objects/fa_dorf_gunpowder", fndorfgunpowder, {}, {} ) \ No newline at end of file diff --git a/HeroInTheDark/scripts/prefabs/fa_dungeon_exit.lua b/HeroInTheDark/scripts/prefabs/fa_dungeon_exit.lua index 554e7d94..3ccccb83 100644 --- a/HeroInTheDark/scripts/prefabs/fa_dungeon_exit.lua +++ b/HeroInTheDark/scripts/prefabs/fa_dungeon_exit.lua @@ -147,12 +147,12 @@ local inst=fn() inst.AnimState:SetBank("fa_orcfort_cage") inst.Transform:SetScale(1, 1, 1) inst.components.activatable.OnActivate = function(inst,doer) - SetPause(true) +-- SetPause(true) doer.AnimState:OverrideSymbol("chains", "fa_cagechains", "chains") doer.AnimState:OverrideSymbol("cage", "fa_orcfort_cage", "cage") inst:RemoveFromScene() doer.AnimState:PlayAnimation("fa_cagedrop",true) - doer:DoTaskInTime(5,OnActivate) + doer:DoTaskInTime(2,function() OnActivate(inst,doer) end) end return inst end @@ -163,12 +163,12 @@ local inst=fn() inst.AnimState:SetBuild("fa_dorffort_rcage") inst.AnimState:SetBank("fa_dorffort_rcage") inst.components.activatable.OnActivate = function(inst,doer) - SetPause(true) +-- SetPause(true) doer.AnimState:OverrideSymbol("chains", "fa_cagechains", "chains") doer.AnimState:OverrideSymbol("cage", "fa_dorffort_rcage", "cage") inst:RemoveFromScene() doer.AnimState:PlayAnimation("fa_cagedrop",true) - doer:DoTaskInTime(5,OnActivate) + doer:DoTaskInTime(2,function() OnActivate(inst,doer) end) end return inst end diff --git a/HeroInTheDark/scripts/prefabs/fa_hats.lua b/HeroInTheDark/scripts/prefabs/fa_hats.lua index ce9b29c0..8f4ed441 100644 --- a/HeroInTheDark/scripts/prefabs/fa_hats.lua +++ b/HeroInTheDark/scripts/prefabs/fa_hats.lua @@ -286,10 +286,10 @@ local function onequip(inst, owner, build) inst.components.waterproofer:SetEffectiveness(ARMOR_GOLDHAT_WATERPROOFNESS) end if(FA_DLCACCESS)then - inst.components.equippable.dapperness = -ARMOR_GOLD_DAPPERNESS + inst.components.equippable.dapperness = ARMOR_GOLD_DAPPERNESS else inst:AddComponent("dapperness") - inst.components.dapperness.dapperness = -ARMOR_GOLD_DAPPERNESS + inst.components.dapperness.dapperness = ARMOR_GOLD_DAPPERNESS end inst:AddComponent("fueled") diff --git a/HeroInTheDark/scripts/prefabs/fa_potions.lua b/HeroInTheDark/scripts/prefabs/fa_potions.lua index 35bf7d73..690024fb 100644 --- a/HeroInTheDark/scripts/prefabs/fa_potions.lua +++ b/HeroInTheDark/scripts/prefabs/fa_potions.lua @@ -619,7 +619,7 @@ end local function winecommon(inst,eatfn) inst:AddComponent("finiteuses") - isnt:RemoveComponent("stackable") + inst:RemoveComponent("stackable") inst.components.finiteuses:SetOnFinished( onfinished) inst.components.finiteuses:SetMaxUses(3) inst.components.finiteuses:SetUses(3) diff --git a/HeroInTheDark/scripts/prefabs/fa_totems.lua b/HeroInTheDark/scripts/prefabs/fa_totems.lua index 39afe3d2..a2c91120 100644 --- a/HeroInTheDark/scripts/prefabs/fa_totems.lua +++ b/HeroInTheDark/scripts/prefabs/fa_totems.lua @@ -467,7 +467,8 @@ end local function bluefn_player() local inst=bluefn() inst:AddTag("companion") - data.fa_fencetag="lightningfence" + inst.fa_fencetag="lightningfence" + inst:AddTag(inst.fa_fencetag) inst:AddComponent("machine") inst.components.machine.ison = true @@ -501,6 +502,7 @@ end end if(data and data.fa_fencetag)then inst.fa_fencetag=data.fa_fencetag + inst:RemoveTag("lightningfence_kos") inst:AddTag(inst.fa_fencetag) --something has to do configuration, and tags are unknown before load --this is extremely ugly place to put it in @@ -513,6 +515,7 @@ end local function bluefn_kos(Sim) local inst=bluefn(Sim) inst.fa_fencetag="lightningfence_kos" + inst:AddTag("lightningfence_kos") if(FenceManager.initialized)then inst:DoTaskInTime(0.1,function(inst) FenceManager:AddNode(inst)