-- =================================================================== -- This parameter is a light level used in Outer Space realms. Due to -- an apparent bug in the MT mapgen API, this parameter should be less -- than the maximum allowed level (15). default.space_light_generic = 10 -- =================================================================== local enable_ncvirus = ocutil.bool_default ("enable_ncvirus") local node_name local use_spacesuit -- =================================================================== minetest.register_craftitem ("default:spacesuit", { description = "Spacesuit Being Worn" , inventory_image = "default_spacesuit_item.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:spacesuit_off") end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:spacesuit_off", { description = "Spacesuit Taken Off" , inventory_image = "default_spacesuit_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:spacesuit") end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_dress_pink_01" , { description = "Costume Pink Dress Being Worn" , inventory_image = "costume_dress_pink_01.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_dress_pink_01_off" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_dress_pink_01_off" , { description = "Costume Pink Dress Not Worn" , inventory_image = "costume_dress_pink_01_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_dress_pink_01" ) end return itemstack end , }) -- =================================================================== -- 210906 RJK: Added music suit. minetest.register_craftitem ("default:musicbadge", { description = "Music Badge Being Worn" , inventory_image = "default_musicbadge.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:musicbadge_off") end return itemstack end , }) -- =================================================================== -- 210906 RJK: Added music suit. minetest.register_craftitem ("default:musicbadge_off", { description = "Music Badge Taken Off" , inventory_image = "default_musicbadge_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:musicbadge") end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:ncmask", { description = "Anti-Virus Mask Being Worn" , inventory_image = "default_ncmask.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:ncmask_off") end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:ncmask_off", { description = "Virus Mask Taken Off" , inventory_image = "default_ncmask_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:ncmask") end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_cat_crookedstar" , { description = "Cat CrookedStar Costume Being Worn" , inventory_image = "costume_cat_crookedstar.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_cat_crookedstar_off" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_cat_crookedstar_off" , { description = "Costume Cat Crookedstar Not Worn" , inventory_image = "costume_cat_crookedstar_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_cat_crookedstar" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_cat_grey" , { description = "Grey Cat Costume Being Worn" , inventory_image = "costume_cat_grey.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_cat_grey_off" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_cat_grey_off" , { description = "Grey Cat Costume Not Worn" , inventory_image = "costume_cat_grey_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_cat_grey" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_cat_onesie" , { description = "Cat Onesie Costume Being Worn" , inventory_image = "costume_cat_onesie.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_cat_onesie_off" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_cat_onesie_off" , { description = "Cat Onesie Costume Not Worn" , inventory_image = "costume_cat_onesie_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_cat_onesie" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_cat_oreo" , { description = "Cat Oreo Costume Being Worn" , inventory_image = "costume_cat_oreo.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_cat_oreo_off" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_cat_oreo_off" , { description = "Cat Oreo Costume Not Worn" , inventory_image = "costume_cat_oreo_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_cat_oreo" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_tiger" , { description = "Tiger Costume Being Worn" , inventory_image = "costume_tiger.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_tiger_off" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_tiger_off" , { description = "Tiger Costume Not Worn" , inventory_image = "costume_tiger_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_tiger" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_dress_wedding_01" , { description = "Wedding Dress Costume Being Worn" , inventory_image = "costume_dress_wedding_01.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_dress_wedding_01_off" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_dress_wedding_01_off" , { description = "Wedding Dress Costume Not Worn" , inventory_image = "costume_dress_wedding_01_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_dress_wedding_01" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_wolf_onesie_01" , { description = "Wolf Onesie Costume #1 Being Worn" , inventory_image = "costume_wolf_onesie_01.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_wolf_onesie_01_off" ) end return itemstack end , }) -- =================================================================== minetest.register_craftitem ("default:costume_wolf_onesie_01_off" , { description = "Wolf Onesie Costume #1 Not Worn" , inventory_image = "costume_wolf_onesie_01_off.png" , on_use = function (itemstack, user, pointed_thing) if itemstack:take_item() ~= nil then itemstack:add_item ("default:costume_wolf_onesie_01" ) end return itemstack end , }) -- =================================================================== -- Armor base-names (i.e., names without "default:") listed in the or- -- der of what goes on first. -- 210906 RJK: Dropped "default" version of crystal armor and added -- music suit. local canon_armor = { "ncmask" , "musicbadge" , "spacesuit" , "costume_cat_crookedstar" , "costume_cat_grey" , "costume_cat_onesie" , "costume_cat_oreo" , "costume_dress_pink_01" , "costume_dress_wedding_01" , "costume_tiger" , "costume_wolf_onesie_01" , } -- =================================================================== -- "showing" may be: -- (a) nil -- (b) a scalar armor base-name from "canon_armor" -- (c) a list of such base-names -- =================================================================== local showing_str = function (showing) if type (showing) ~= "table" then return showing end local str = "" for _, one_item in ipairs (showing) do str = str .. one_item .. "," end return str end -- =================================================================== -- A tick-cycle length of greater than one doesn't work well in this -- context. local tick = 0 local tick_cycle = 1 -- =================================================================== default.update_player_skins = function (pllist) -- =================================================================== local change_skin local overlay_name if ocutil.mod_exists ("coderskins" ) then change_skin = coderskins.change_skin overlay_name = coderskins.overlay_name end if ocutil.mod_exists ("miniskins" ) then change_skin = miniskins.change_skin overlay_name = miniskins.overlay_name end if change_skin == nil then return end -- =================================================================== if use_spacesuit == nil then use_spacesuit = minetest.setting_get ("spacesuit") if ocutil.str_false (use_spacesuit) then use_spacesuit = false end if use_spacesuit == nil then use_spacesuit = true end end if not use_spacesuit then return end -- =================================================================== local spccall = true if pllist == nil then pllist = minetest.get_connected_players() spccall = false end -- =================================================================== for _, player in ipairs (pllist) do local plname = player:get_player_name() -- Check to see if the current player does or doesn't have active ar- -- mor in inventory. local has_armor = {} local one_item for _, one_item in ipairs (canon_armor) do if player:get_inventory():contains_item ("main", "default:" .. one_item) then table.insert (has_armor, one_item) end end if rawget (_G, "armor") and armor.cat ~= nil then local alist3d = armor.cat [plname] if alist3d ~= nil then table.insert (has_armor, alist3d) end end local ktable = ocutil.vtable_to_ktable (has_armor) local showing = overlay_name [plname] if coderskins.force_update then showing = "" end if showing_str (showing ) ~= showing_str (has_armor ) then change_skin (plname, has_armor) end if spccall == false and math.random() < (0.1 * tick_cycle) then if ktable ["spacesuit"] then if player:get_breath() < 11 then player:set_breath (11) end end end -- =================================================================== local pos -- Kludge to force bubbles update if spccall == false and math.random() > (1.00 - (tick_cycle / 100)) then if pos == nil then pos = player:getpos() end end -- =================================================================== if spccall == false and enable_ncvirus and not ktable ["ncmask"] and not ktable ["spacesuit"] and math.random() > (1.00 - (tick_cycle / 25)) then if pos == nil then pos = player:getpos() end local tnob = minetest.get_objects_inside_radius (pos, 6) for _, obj in ipairs (tnob) do if obj:is_player() and obj:get_player_name() ~= plname then local hp = player:get_hp() - 1 minetest.chat_send_player (plname, "NC Virus damage! You're not social distancing or wearing a mask!") player:set_hp (hp) end end end end end -- =================================================================== minetest.register_globalstep (function (dtime) tick = tick + 1 if tick < tick_cycle then return end tick = 0 default.update_player_skins() end) -- =================================================================== -- 210701 RJK: For MT 5+, vacuum may require revert of the following -- trollstream commit in order to work correctly: -- -- Hash: 3253b6bd2238eaa8f773f7881f8e47200dc5f42a -- From: Lars Hofhansl -- Date: Sun, 16 Oct 2016 21:27:21 -0700 -- Subject: Don't use day light sky unless noclip and free_move are -- enabled -- If the commit can't be reverted, world admins will need to set the -- boolean option "disable_vacuum" to true in "world.conf". local disable_vacuum = false if minetest.setting_getbool ("disable_vacuum") then disable_vacuum = true end -- =================================================================== node_name = "default:vacuum" -- if not disable_vacuum then minetest.register_node (node_name, { description = "Vacuum" , drawtype = "airlike" , paramtype = "light" , sunlight_propagates = true , light_source = 0 , tiles = { "transparent.png" } , post_effect_color = { a=1, r=0, g=0, b=0 } , buildable_to = true , diggable = false , is_ground_content = false , pointable = false , walkable = false , drowning = 1 , groups = { vacuum=1 , not_in_creative_inventory=1 } , }) end -- =================================================================== local fairlight = ocutil.numsetzero ("fairlight") minetest.register_node ("default:fair", { description = "Fair Air" , drawtype = "airlike" , paramtype = "light" , sunlight_propagates = true , light_source = fairlight , tiles = { "transparent.png" } , post_effect_color = { a=1, r=0, g=0, b=0 } , buildable_to = true , diggable = false , is_ground_content = false , pointable = false , walkable = false , drowning = 0 , }) -- =================================================================== local c_air = minetest.get_content_id ("air") if c_air == nil then ocutil.panic ("air undefined") end if disable_vacuum then default.c_vacuum = c_air default.convert_force ("default:vacuum", "air") else default.c_vacuum = minetest.get_content_id ("default:vacuum") end -- =================================================================== -- End of file.