diff --git a/functions.lua b/functions.lua index 19d5cb7..712fc52 100644 --- a/functions.lua +++ b/functions.lua @@ -226,7 +226,7 @@ end local tool_uses = {0, 30, 110, 150, 280, 300, 500, 1000} local function addWearout(player, tool_def) - if not core.settings:get_bool("creative_mode") then + if not cmer.creative then local item = player:get_wielded_item() if tool_def and tool_def.damage_groups and tool_def.damage_groups.fleshy then local uses = tool_uses[tool_def.damage_groups.fleshy] or 0 @@ -241,7 +241,8 @@ end local function spawnParticles(...) end -if core.settings:get_bool("creatures_enable_particles") == true then + +if cmer.enable_particles then spawnParticles = function(pos, velocity, texture_str) local vel = vector.multiply(velocity, 0.5) vel.y = 0 diff --git a/init.lua b/init.lua index 4ae35fc..704d83b 100644 --- a/init.lua +++ b/init.lua @@ -46,6 +46,7 @@ end local scripts = { + "settings", "common", "functions", "register", diff --git a/register.lua b/register.lua index 0e36079..6421735 100644 --- a/register.lua +++ b/register.lua @@ -24,8 +24,6 @@ -- @module register.lua -local allow_hostile = core.settings:get_bool("only_peaceful_mobs") ~= true - local function translate_def(def) local new_def = { physical = true, @@ -201,7 +199,7 @@ local function translate_def(def) self.object:set_hp(self.hp) - if not core.settings:get_bool("enable_damage") then + if not cmer.enable_damage then self.hostile = false end @@ -266,7 +264,7 @@ function cmer.register_mob(def) -- returns true if sucessfull core.register_entity(":" .. def.name, mob_def) -- register spawn - if def.spawning and not (def.stats.hostile and not allow_hostile) then + if def.spawning and not (def.stats.hostile and not cmer.allow_hostile) then local spawn_def = def.spawning spawn_def.mob_name = def.name spawn_def.mob_size = def.model.collisionbox diff --git a/settings.lua b/settings.lua new file mode 100644 index 0000000..7efffb1 --- /dev/null +++ b/settings.lua @@ -0,0 +1,8 @@ + +cmer.enable_particles = core.settings:get_bool("creatures_enable_particles", false) + +cmer.allow_hostile = core.settings:get_bool("only_peaceful_mobs") ~= true + +cmer.enable_damage = core.settings:get_bool("enable_damage", false) + +cmer.creative = core.settings:get_bool("creative_mode", false) diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..0da73fd --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,5 @@ + +# Only spawn mobs that don't attack players. +only_peaceful_mobs (Peaceful only) bool false + +creatures_enable_particles (Enable particles) bool false