Browse Source

fixes, and now bones writes to log instead of just printing to console

master
poikilos 8 years ago
committed by Jacob Gustafson
parent
commit
e206cb74be
  1. 13
      README.md
  2. 9
      games/ENLIVEN/mods/bones/init.lua
  3. 95
      games/ENLIVEN/mods/protector/init.lua

13
README.md

@ -37,13 +37,24 @@ Otherwise just install everything EXCEPT cme_to_spawners & tsm_pyramids_to_spawn
## Changes: ## Changes:
* (2017-02-15) (change homedecor_modpack/homedecor) Add optional non-adult beverage version of homedecor in homedecor_modpack (just changes display name & variable name of Wine rack and Beer tap and beer mug, and textures for beer mug) * (2017-02-22) Fix protector crash (also sent to TenPlus1):
```lua
if player and player:is_player() and player:get_hp() > 0 then -- ADDED THIS LINE
-- hurt player if protection violated
-- (a bunch of code is here for processing violations) --
end -- ADDED THIS LINE
return true
```
* (2017-02-22) NOTE: the protector fix below was merged by TenPlus1 today
* (2017-02-15) (change protector) Avoid crash by not allowing non-player to dig protected area (may only happen when one of the owners of an area does it--that was the crash scenario) * (2017-02-15) (change protector) Avoid crash by not allowing non-player to dig protected area (may only happen when one of the owners of an area does it--that was the crash scenario)
changed changed
return protector.can_dig(1, pos, player:get_player_name(), true, 1) return protector.can_dig(1, pos, player:get_player_name(), true, 1)
to to
return player and protector.can_dig(1, pos, player:get_player_name(), true, 1) or false return player and protector.can_dig(1, pos, player:get_player_name(), true, 1) or false
* (2017-02-15) (change homedecor_modpack/homedecor) Add optional non-adult beverage version of homedecor in homedecor_modpack (just changes display name & variable name of Wine rack and Beer tap and beer mug, and textures for beer mug)
* (2017-02-15) (change bones) Show player (and print to server console) where died (and say bones remain or why not) -- with this addition, you can search your server log for "player's bones" where player is playername whether bones remain or not. * (2017-02-15) (change bones) Show player (and print to server console) where died (and say bones remain or why not) -- with this addition, you can search your server log for "player's bones" where player is playername whether bones remain or not.
* (2017-02-14) (change mobs) Added some nonviolent textures that could be used in a school to the ENLIVEN/mods folder (they can be manually installed after ENLIVEN by copying them to the same place in your games/ENLIVEN folder on your installation of Minetest) * (2017-02-14) (change mobs) Added some nonviolent textures that could be used in a school to the ENLIVEN/mods folder (they can be manually installed after ENLIVEN by copying them to the same place in your games/ENLIVEN folder on your installation of Minetest)
* (2017-02-06) Added installation of trmp_minetest_game to the installer script, since treasurer requires one or more trms in order to work (tested and working now on tsm_railcorridors) * (2017-02-06) Added installation of trmp_minetest_game to the installer script, since treasurer requires one or more trms in order to work (tested and working now on tsm_railcorridors)

9
games/ENLIVEN/mods/bones/init.lua

@ -169,7 +169,7 @@ minetest.register_on_dieplayer(function(player)
local pos = vector.round(player:getpos()) local pos = vector.round(player:getpos())
-- return if keep inventory set or in creative mode -- return if keep inventory set or in creative mode
if bones_mode == "keep" or minetest.setting_getbool("creative_mode") then if bones_mode == "keep" or minetest.setting_getbool("creative_mode") then
print(player:get_player_name() .. "'s bones do not remain since in creative_mode -- died at " .. minetest.pos_to_string(vector.round(player:getpos()))) minetest.log("action", "[bones] " .. player:get_player_name() .. "'s bones do not remain since in creative_mode -- died at " .. minetest.pos_to_string(vector.round(player:getpos())))
minetest.chat_send_player(player:get_player_name(), player:get_player_name() .. "'s bones do not remain since in creative_mode -- died at " .. minetest.pos_to_string(pos)) --formerly ("Bones placed at %s."):format(pos) minetest.chat_send_player(player:get_player_name(), player:get_player_name() .. "'s bones do not remain since in creative_mode -- died at " .. minetest.pos_to_string(pos)) --formerly ("Bones placed at %s."):format(pos)
return return
end end
@ -177,7 +177,7 @@ minetest.register_on_dieplayer(function(player)
local player_inv = player:get_inventory() local player_inv = player:get_inventory()
if player_inv:is_empty("main") and if player_inv:is_empty("main") and
player_inv:is_empty("craft") then player_inv:is_empty("craft") then
print(player:get_player_name() .. "'s bones do not remain since inventory and craft are empty -- died at " .. minetest.pos_to_string(vector.round(player:getpos()))) minetest.log("action", "[bones] " .. player:get_player_name() .. "'s bones do not remain since inventory and craft are empty -- died at " .. minetest.pos_to_string(vector.round(player:getpos())))
minetest.chat_send_player(player:get_player_name(), player:get_player_name() .. "'s bones do not remain since inventory and craft are empty -- died at " .. minetest.pos_to_string(pos)) --formerly ("Bones placed at %s."):format(pos) minetest.chat_send_player(player:get_player_name(), player:get_player_name() .. "'s bones do not remain since inventory and craft are empty -- died at " .. minetest.pos_to_string(pos)) --formerly ("Bones placed at %s."):format(pos)
return return
end end
@ -210,14 +210,15 @@ minetest.register_on_dieplayer(function(player)
player_inv:set_list("craft", {}) player_inv:set_list("craft", {})
drop(pos, ItemStack("bones:bones")) drop(pos, ItemStack("bones:bones"))
print(player:get_player_name() .. "'s bones do not remain since area is_protected -- died at " .. minetest.pos_to_string(pos))
minetest.log("action", "[bones] " .. player:get_player_name() .. "'s bones do not remain since area is_protected -- died at " .. minetest.pos_to_string(pos))
minetest.chat_send_player(player:get_player_name(), player:get_player_name() .. "'s do not remain since area is_protected -- died at " .. minetest.pos_to_string(pos)) --formerly ("Bones placed at %s."):format(pos) minetest.chat_send_player(player:get_player_name(), player:get_player_name() .. "'s do not remain since area is_protected -- died at " .. minetest.pos_to_string(pos)) --formerly ("Bones placed at %s."):format(pos)
return return
end end
local param2 = minetest.dir_to_facedir(player:get_look_dir()) local param2 = minetest.dir_to_facedir(player:get_look_dir())
minetest.set_node(pos, {name = "bones:bones", param2 = param2}) minetest.set_node(pos, {name = "bones:bones", param2 = param2})
print(player:get_player_name() .. "'s bones remain where died at " .. minetest.pos_to_string(pos)) minetest.log("action", "[bones] " .. player:get_player_name() .. "'s bones remain where died at " .. minetest.pos_to_string(pos))
minetest.chat_send_player(player:get_player_name(), player:get_player_name() .. "'s bones remain where died at " .. minetest.pos_to_string(pos)) --formerly ("Bones placed at %s."):format(pos) minetest.chat_send_player(player:get_player_name(), player:get_player_name() .. "'s bones remain where died at " .. minetest.pos_to_string(pos)) --formerly ("Bones placed at %s."):format(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

95
games/ENLIVEN/mods/protector/init.lua

@ -270,73 +270,72 @@ function minetest.is_protected(pos, digger)
-- is area protected against digger? -- is area protected against digger?
if not protector.can_dig(protector.radius, pos, digger, false, 1) then if not protector.can_dig(protector.radius, pos, digger, false, 1) then
local player = minetest.get_player_by_name(digger) local player = minetest.get_player_by_name(digger)
if player and player:is_player() and player:get_hp() > 0 then -- ADDED THIS LINE
-- hurt player if protection violated
if protector.hurt > 0
and player then
player:set_hp(player:get_hp() - protector.hurt)
end
-- hurt player if protection violated -- flip player when protection violated
if protector.hurt > 0 if protector.flip
and player then and player then
player:set_hp(player:get_hp() - protector.hurt)
end
-- flip player when protection violated
if protector.flip
and player then
-- yaw + 180° -- yaw + 180°
--local yaw = player:get_look_horizontal() + math.pi --local yaw = player:get_look_horizontal() + math.pi
local yaw = player:get_look_yaw() + math.pi local yaw = player:get_look_yaw() + math.pi
if yaw > 2 * math.pi then if yaw > 2 * math.pi then
yaw = yaw - 2 * math.pi yaw = yaw - 2 * math.pi
end end
--player:set_look_horizontal(yaw) --player:set_look_horizontal(yaw)
player:set_look_yaw(yaw) player:set_look_yaw(yaw)
-- invert pitch -- invert pitch
--player:set_look_vertical(-player:get_look_vertical()) --player:set_look_vertical(-player:get_look_vertical())
player:set_look_pitch(-player:get_look_pitch()) player:set_look_pitch(-player:get_look_pitch())
-- if digging below player, move up to avoid falling through hole -- if digging below player, move up to avoid falling through hole
local pla_pos = player:getpos() local pla_pos = player:getpos()
if pos.y < pla_pos.y then if pos.y < pla_pos.y then
player:setpos({ player:setpos({
x = pla_pos.x, x = pla_pos.x,
y = pla_pos.y + 0.8, y = pla_pos.y + 0.8,
z = pla_pos.z z = pla_pos.z
}) })
end
end end
end
-- drop tool/item if protection violated
if protector.drop == true
and player then
local holding = player:get_wielded_item() -- drop tool/item if protection violated
if protector.drop == true
and player then
if holding:to_string() ~= "" then local holding = player:get_wielded_item()
-- take stack if holding:to_string() ~= "" then
local sta = holding:take_item(holding:get_count())
player:set_wielded_item(holding)
-- incase of lag, reset stack -- take stack
minetest.after(0.1, function() local sta = holding:take_item(holding:get_count())
player:set_wielded_item(holding) player:set_wielded_item(holding)
-- drop stack -- incase of lag, reset stack
local obj = minetest.add_item(player:getpos(), sta) minetest.after(0.1, function()
if obj then player:set_wielded_item(holding)
obj:setvelocity({x = 0, y = 5, z = 0})
end
end)
-- drop stack
local obj = minetest.add_item(player:getpos(), sta)
if obj then
obj:setvelocity({x = 0, y = 5, z = 0})
end
end)
end
end end
end end
return true return true
end end

Loading…
Cancel
Save