Skip to content

Commit

Permalink
gold items fix/no longer overwriting some recipes/fixed dorf fort exi…
Browse files Browse the repository at this point in the history
…t fail/fences not initializing properly
  • Loading branch information
jkolokotronis committed Mar 27, 2015
1 parent de4c438 commit ee4bc2d
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 26 deletions.
14 changes: 3 additions & 11 deletions HeroInTheDark/scripts/fa_electricalfence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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}
5 changes: 2 additions & 3 deletions HeroInTheDark/scripts/fa_recipes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"

Expand All @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion HeroInTheDark/scripts/fa_strings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 13 additions & 0 deletions HeroInTheDark/scripts/postinits/fa_objectpostinits.lua
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
4 changes: 2 additions & 2 deletions HeroInTheDark/scripts/prefabs/fa_basearmor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
13 changes: 12 additions & 1 deletion HeroInTheDark/scripts/prefabs/fa_dorfhut.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
Expand All @@ -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 )
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, {}, {} )
8 changes: 4 additions & 4 deletions HeroInTheDark/scripts/prefabs/fa_dungeon_exit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions HeroInTheDark/scripts/prefabs/fa_hats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion HeroInTheDark/scripts/prefabs/fa_potions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion HeroInTheDark/scripts/prefabs/fa_totems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit ee4bc2d

Please sign in to comment.