added the remove_list setting to delete already existing entities in the game
This commit is contained in:
parent
28e40c9c5a
commit
86295f1296
@ -13,5 +13,3 @@ Cute kawaii mobs for Minetest.
|
||||
There are in a separate github repository:
|
||||
|
||||
[Petz RAW](https://github.com/runsy/petz_raw)
|
||||
|
||||
|
||||
|
@ -261,6 +261,19 @@ function petz.set_initial_properties(self, staticdata, dtime_s)
|
||||
--2. ALREADY EXISTING MOBS
|
||||
--
|
||||
elseif not captured_mob then
|
||||
--Check if the petz was removed from the petz list in the settings
|
||||
local remove_petz = true
|
||||
for key, value in pairs(petz.settings["petz_list"]) do
|
||||
if value == self.type then
|
||||
minetest.chat_send_all(value)
|
||||
remove_petz = false
|
||||
break
|
||||
end
|
||||
end
|
||||
if remove_petz then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
petz.load_vars(self) --Load memory variables
|
||||
--
|
||||
--3. CAPTURED MOBS
|
||||
|
@ -42,6 +42,22 @@ petz.file_exists = function(name)
|
||||
end
|
||||
end
|
||||
|
||||
if petz.settings["remove_list"] then
|
||||
for i = 1, #petz.settings["remove_list"] do
|
||||
local file_name = modpath .. "/petz/"..petz.settings["remove_list"][i].."_mobkit"..".lua"
|
||||
if petz.file_exists(file_name) then
|
||||
assert(loadfile(file_name))(S)
|
||||
end
|
||||
--Override the petz_list
|
||||
for j = 1, #petz.settings["petz_list"] do --load all the petz.lua files
|
||||
if petz.settings["remove_list"][i] == petz.settings["petz_list"][j] then
|
||||
table.remove(petz.settings["petz_list"], j)
|
||||
--mokapi.remove_table_by_key(petz.settings["petz_list"], j)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #petz.settings["petz_list"] do --load all the petz.lua files
|
||||
local file_name = modpath .. "/petz/"..petz.settings["petz_list"][i].."_mobkit"..".lua"
|
||||
if petz.file_exists(file_name) then
|
||||
|
Binary file not shown.
@ -3,6 +3,10 @@
|
||||
|
||||
petz_list = kitty,puppy,ducky,lamb,lion,calf,panda,grizzly,pony,parrot,chicken,piggy,wolf,elephant,elephant_female,pigeon,moth,camel,clownfish,bat,silkworm,chimp,hamster,dolphin,tropicalfish,beaver,turtle,frog,toucan,bee,queen_bee,mr_pumpkin,foxy,penguin,polar_bear,santa_killer,werewolf,tarantula,butterfly,rat,goat,squirrel,leopard,snow_leopard,ant,warrior_ant,queen_ant,rooster,hen,bunny
|
||||
|
||||
#This list is to remove already existing entities in the game
|
||||
##Note that overrides the petz_list
|
||||
remove_list =
|
||||
|
||||
##Tamagochi Mode (Take care of your pet: fed it...)
|
||||
tamagochi_mode = true
|
||||
##check_time: default 2400
|
||||
|
@ -12,6 +12,12 @@ local settings_def = {
|
||||
default = "",
|
||||
},
|
||||
{
|
||||
name = "remove_list",
|
||||
type = "string",
|
||||
split = true,
|
||||
default = "",
|
||||
},
|
||||
{
|
||||
name = "disable_monsters",
|
||||
type = "boolean",
|
||||
default = false,
|
||||
@ -441,7 +447,7 @@ for key, value in ipairs(settings_def) do
|
||||
value.default = ''
|
||||
end
|
||||
local str = user:get(value.name) or settings:get(value.name, value.default)
|
||||
if value.split then
|
||||
if str and value.split then
|
||||
str = string.split(str)
|
||||
end
|
||||
petz.settings[value.name] = str
|
||||
|
BIN
petz/textures/pet_wagon_chest.png
Normal file
BIN
petz/textures/pet_wagon_chest.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 5.0 KiB |
Loading…
x
Reference in New Issue
Block a user