Skip to content

Commit

Permalink
Fixed potions affecting incapacitated people
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoSupremo committed May 10, 2020
1 parent 8298842 commit 99e9ff4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion entities/consumables/scripts/happy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ function HappyTown.use(consumable, consumable_data, player_id, target_entity)
}
local population = stonehearth.population:get_population(player_id)
for _, entity in population:get_citizens():each() do
if entity and entity:is_valid() then
local ic = entity:get_component('stonehearth:incapacitation')
if entity and entity:is_valid() and not ic:is_incapacitated() then
local paused_goblin = stonehearth.ai:inject_ai(entity, { actions = { 'stonehearth:actions:be_away_from_town' } })
radiant.entities.add_thought(entity, 'stonehearth:thoughts:social:happy_potion')
radiant.entities.set_resource(entity, 'calories', 50)
Expand Down
3 changes: 2 additions & 1 deletion entities/consumables/scripts/memory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ local MemoryTown = class()
function MemoryTown.use(consumable, consumable_data, player_id, target_entity)
local population = stonehearth.population:get_population(player_id)
for _, entity in population:get_citizens():each() do
if entity and entity:is_valid() then
local ic = entity:get_component('stonehearth:incapacitation')
if entity and entity:is_valid() and not ic:is_incapacitated() then
radiant.effects.run_effect(entity, 'stonehearth:effects:poof_effect:grey')
radiant.effects.run_effect(entity, 'stonehearth:effects:thoughts:alert')
local happiness = entity:get_component('stonehearth:happiness')
Expand Down
3 changes: 2 additions & 1 deletion entities/consumables/scripts/teleport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ function TeleportTown.use(consumable, consumable_data, player_id, target_entity)
local town_center = stonehearth.town:get_town(player_id):get_landing_location()
local location = radiant.terrain.find_placement_point(town_center, 1, 5)
for _, entity in population:get_citizens():each() do
if entity and entity:is_valid() then
local ic = entity:get_component('stonehearth:incapacitation')
if entity and entity:is_valid() and not ic:is_incapacitated() then
local paused_goblin = stonehearth.ai:inject_ai(entity, { actions = { 'stonehearth:actions:be_away_from_town' } })
local delay_start_timer = radiant.on_game_loop_once('reset ai wait', function()
if paused_goblin then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function SwampWorldGenerationService:_add_water_bodies(regions)
water_bounds.max.y = water_bounds.max.y - math.floor(water_height_delta)

local water_region = terrain_region:intersect_cube(water_bounds)
stonehearth.hydrology:create_water_body_with_region(water_region, height)
stonehearth.hydrology:create_water_body_with_region(water_region, height, true)

local water_bounds_negative = Cube3(terrain_bounds)
water_bounds_negative.max.y = water_bounds_negative.max.y - math.floor(water_height_delta)
Expand Down
6 changes: 2 additions & 4 deletions swamp_goblins_server.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
swamp_goblins = {}
print("Swamp Goblins Mod version 20.5.7")
print("Swamp Goblins Mod version 20.5.10")

--[[
bug: potions affect knocked out or sleeping guys
bug: shaman cook workbenches at the wrong level, move it all after the others
bug?: shaman cook workbenches at the wrong level, move it all after the others
move default market stall to earthmaster
Expand Down

0 comments on commit 99e9ff4

Please sign in to comment.