aboutsummaryrefslogtreecommitdiff
path: root/src/server
ModeNameSize
-rw-r--r--CMakeLists.txt355logplain
-rw-r--r--activeobjectmgr.cpp5289logplain
-rw-r--r--activeobjectmgr.h1776logplain
-rw-r--r--luaentity_sao.cpp14362logplain
-rw-r--r--luaentity_sao.h3491logplain
-rw-r--r--mods.cpp3439logplain
-rw-r--r--mods.h1447logplain
-rw-r--r--player_sao.cpp20448logplain
-rw-r--r--player_sao.h7732logplain
-rw-r--r--serveractiveobject.cpp2398logplain
-rw-r--r--serveractiveobject.h8420logplain
-rw-r--r--serverinventorymgr.cpp5432logplain
-rw-r--r--serverinventorymgr.h1750logplain
-rw-r--r--unit_sao.cpp9774logplain
-rw-r--r--unit_sao.h4469logplain
ref='#n254'>254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419

local phash = elevator.phash
local get_node = elevator.get_node

local homedecor_path = minetest.get_modpath("homedecor")
local mineclone_path = core.get_modpath("mcl_core") and mcl_core
local default_path = core.get_modpath("default") and default
local aurum_path = core.get_modpath("aurum") and aurum

local moditems = {} -- local table to hold substitutes

-- Use homedecor's placeholder if possible.
if homedecor_path then
    minetest.register_alias("elevator:placeholder", "homedecor:expansion_placeholder")
else
    -- Placeholder node, in the style of homedecor.
    minetest.register_node("elevator:placeholder", {
        description = "Expansion Placeholder",
        selection_box = {
            type = "fixed",
            fixed = {0, 0, 0, 0, 0, 0},
        },
        groups = {
            not_in_creative_inventory=1
        },
        drawtype = "airlike",
        paramtype = "light",
        sunlight_propagates = true,

        walkable = false,
        buildable_to = false,
        is_ground_content = false,

        on_dig = function(pos, node, player)
            minetest.remove_node(pos)
            minetest.set_node(pos, {name="elevator:placeholder"})
        end
    })
end

if mineclone_path then
  moditems.el_shaft_groups = {pickaxey=1,axey=1,handy=1,swordy=1,transport=1,dig_by_piston=1}
  moditems.el_motor_groups = {pickaxey=1,axey=1,handy=1,swordy=1,transport=1,dig_by_piston=1}
  moditems.elevator_groups = {pickaxey=1,axey=1,handy=1,swordy=1,transport=1,dig_by_piston=1}
  moditems.elevator_special_groups = {not_in_creative_inventory=1,pickaxey=1,axey=1,handy=1,swordy=1,transport=1,dig_by_piston=1}
  moditems.sounds_stone = mcl_sounds.node_sound_stone_defaults
  moditems.el_motor_gfx = "elevator_motor_mcl.png"
  moditems.el_shaft_gfx = "elevator_shaft_mcl.png"
  moditems.el_box_gfx = "elevator_box_mcl.png"
  moditems.steel_block_image = "default_steel_block.png"
elseif default_path then
  moditems.el_shaft_groups = {cracky=2,oddly_breakable_by_hand=0} -- removing ability to destroy by hand to prevent accidental breakage of whole elevators
  moditems.el_motor_groups = {cracky=1}
  moditems.elevator_groups = {cracky=1,choppy=1,snappy=1}
  moditems.elevator_special_groups = {not_in_creative_inventory=1}
  moditems.sounds_stone = default.node_sound_stone_defaults
  moditems.el_motor_gfx = "elevator_motor.png"
  moditems.el_shaft_gfx = "elevator_shaft.png"
  moditems.el_box_gfx = "elevator_box.png"
  moditems.steel_block_image = "default_steel_block.png"
elseif aurum_path then
    moditems.el_shaft_groups = {dig_pick = 2}
    moditems.el_motor_groups = {dig_pick = 1}
    moditems.elevator_groups = {dig_pick = 1}
    moditems.elevator_special_groups = {not_in_creative_inventory=1}
    moditems.sounds_stone = aurum.sounds.stone
    moditems.el_motor_gfx = "elevator_motor.png"
    moditems.el_shaft_gfx = "elevator_shaft.png"
    moditems.el_box_gfx = "elevator_box.png"
    moditems.steel_block_image = "aurum_ore_white.png^[colorize:#cbcdcd:255^aurum_ore_bumps.png^aurum_ore_block.png"
else
    -- fallback for unknown games
    moditems.el_shaft_groups = {cracky=2, oddly_breakable_by_hand=0}
    moditems.el_motor_groups = {cracky=1}
    moditems.elevator_groups = {cracky=1, choppy=1, snappy=1}
    moditems.elevator_special_groups = {not_in_creative_inventory=1}
    moditems.sounds_stone = function() end
    moditems.el_motor_gfx = "elevator_motor.png"
    moditems.el_shaft_gfx = "elevator_shaft.png"
    moditems.el_box_gfx = "elevator_box.png"
    moditems.steel_block_image = "elevator_steel_block.png"
end

if minetest.global_exists("screwdriver") then
    moditems.on_rotate_disallow = screwdriver.disallow
end

minetest.register_node("elevator:shaft", {
    description = "Elevator Shaft",
    _doc_items_longdesc = "An elevator shaft that connects elevators to other elevators and motors.",
    _doc_items_usagehelp = "Building a vertical stack of elevators and shafts with an elevator motor on top allows vertical transportation.",
    tiles = { moditems.el_shaft_gfx },
    drawtype = "nodebox",
    use_texture_alpha = "clip",
    paramtype = "light",
    on_rotate = moditems.on_rotate_disallow,
    sunlight_propagates = true,
    groups = moditems.el_shaft_groups,
    sounds = moditems.sounds_stone(),
    climbable = true,
    node_box = {
        type = "fixed",
        fixed = {
            {-8/16,-8/16,-8/16,-7/16,8/16,8/16},
            {7/16,-8/16,-8/16,8/16,8/16,8/16},
            {-7/16,-8/16,-8/16,7/16,8/16,-7/16},
            {-7/16,-8/16,8/16,7/16,8/16,7/16},
        },
    },
    collisionbox = {
        type = "fixed",
        fixed = {
            {-8/16,-8/16,-8/16,-7/16,8/16,8/16},
            {7/16,-8/16,-8/16,8/16,8/16,8/16},
            {-7/16,-8/16,-8/16,7/16,8/16,-7/16},
            {-7/16,-8/16,8/16,7/16,8/16,7/16},
        },
    },
    after_place_node = function(pos)
        -- We might have connected a motor above to an elevator below.
        elevator.build_motor(elevator.locate_motor(pos))
    end,
    on_destruct = function(pos)
        -- Remove boxes and deactivate elevators below us.
        elevator.unbuild(pos, 1)
    end,
    _mcl_blast_resistance = 15, -- mineclone2 specific
    _mcl_hardness = 5, -- mineclone2 specific
  })

minetest.register_node("elevator:motor", {
    description = "Elevator Motor",
    _doc_items_longdesc = "The engine powering an elevator shaft. Placed at the top.",
    _doc_items_usagehelp = "Place the motor on the top of a stack of elevators and elevator shafts. The elevators will activate and you can then use them.",
    tiles = {
        moditems.steel_block_image,
        moditems.steel_block_image,
        moditems.el_motor_gfx,
        moditems.el_motor_gfx,
        moditems.el_motor_gfx,
        moditems.el_motor_gfx,
    },
    groups = moditems.el_motor_groups,
    sounds = moditems.sounds_stone(),
    after_place_node = function(pos, placer, itemstack)
        -- Set up the motor table.
        elevator.motors[phash(pos)] = {
            elevators = {},
            pnames = {},
            labels = {},
        }
        elevator.save_elevator()
        elevator.build_motor(phash(pos))
    end,
    on_destruct = function(pos)
        -- Destroy everything related to this motor.
        elevator.boxes[phash(pos)] = nil
        elevator.motors[phash(pos)] = nil
        elevator.save_elevator()
    end,
    _mcl_blast_resistance = 15,  -- mineclone2 specific
	  _mcl_hardness = 5, -- mineclone2 specific
})

-- Box of the active entitity.
local box_box = {
    { 0.48, -0.5,-0.5,  0.5,  1.5, 0.5},
    {-0.5 , -0.5, 0.48, 0.48, 1.5, 0.5},
    {-0.5,  -0.5,-0.5 ,-0.48, 1.5, 0.5},
    {-0.5 , -0.5, -0.48, 0.5, 1.5, -0.5},
    { -0.5,-0.5,-0.5,0.5,-0.48, 0.5},