Move settings into settings.lua

master
Jordan Irwin 2021-05-23 23:33:21 -07:00
parent c58f022570
commit 26d76dced9
5 changed files with 19 additions and 6 deletions

View File

@ -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

View File

@ -46,6 +46,7 @@ end
local scripts = {
"settings",
"common",
"functions",
"register",

View File

@ -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

8
settings.lua Normal file
View File

@ -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)

5
settingtypes.txt Normal file
View File

@ -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