Add the intro cutscene, a start to the map, and various other things.
This commit is contained in:
parent
d0c0a3ebb6
commit
1b2199705b
46 changed files with 1401 additions and 91 deletions
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
local ns = artifact
|
||||
|
||||
local db = minetest.get_mod_storage()
|
||||
|
||||
function ns.apply_key(m)
|
||||
m.object:set_properties {
|
||||
textures = {"artifact_key.png"},
|
||||
|
|
@ -10,6 +12,17 @@ function ns.apply_key(m)
|
|||
m.eye_height = 1.6
|
||||
-- Switch hand appearance.
|
||||
m.inv:set_stack("main", 1, ItemStack("input_"..m.character))
|
||||
if m.healthbar then
|
||||
m.object:hud_change(m.healthbar, "text", "artifact_heart.png")
|
||||
end
|
||||
m.blackrod = minetest.add_entity(m.object:get_pos(), "display")
|
||||
m.blackrod:set_properties {
|
||||
visual = "mesh",
|
||||
mesh = "artifact_blackrod.obj",
|
||||
textures = {"artifact_blackrod.png"},
|
||||
visual_size = vector.new(1,1,1) *10
|
||||
}
|
||||
m.blackrod:set_attach(m.object, "RightArm", vector.new(0.25, -5.5, 0), vector.new(90,0,0))
|
||||
end
|
||||
|
||||
function ns.apply_vix(m)
|
||||
|
|
@ -21,19 +34,135 @@ function ns.apply_vix(m)
|
|||
m.eye_height = 1.5
|
||||
-- Switch hand appearance.
|
||||
m.inv:set_stack("main", 1, ItemStack("input_"..m.character))
|
||||
m.object:hud_change(m.healthbar, "text", "artifact_heart_vix.png")
|
||||
if m.blackrod then
|
||||
m.blackrod:remove()
|
||||
m.blackrod = nil
|
||||
end
|
||||
end
|
||||
|
||||
function ns.swap_character(m)
|
||||
if m.character == "vix" then
|
||||
artifact.sidekick.character = "vix"
|
||||
m:set_character("key")
|
||||
ns.apply_key(m)
|
||||
else
|
||||
artifact.sidekick.character = "key"
|
||||
m:set_character("vix")
|
||||
ns.apply_vix(m)
|
||||
end
|
||||
|
||||
if artifact.sidekick.ref then
|
||||
-- `m.pos` includes eye_height, and we don't want that here.
|
||||
local pos = m.object:get_pos()
|
||||
local yaw = m.yaw
|
||||
local pitch = m.pitch
|
||||
m.object:set_pos(artifact.sidekick.ref.object:get_pos())
|
||||
m.object:set_look_horizontal(artifact.sidekick.yaw)
|
||||
m.object:set_look_vertical(artifact.sidekick.pitch)
|
||||
artifact.sidekick.ref.object:set_pos(pos)
|
||||
artifact.sidekick.ref.object:set_yaw(yaw)
|
||||
artifact.sidekick.ref.object:set_bone_override("Head", m.object:get_bone_override("Head"))
|
||||
artifact.sidekick.ref.object:set_bone_override("root", m.object:get_bone_override("root"))
|
||||
artifact.sidekick.pos = pos
|
||||
artifact.sidekick.yaw = yaw
|
||||
artifact.sidekick.pitch = pitch
|
||||
|
||||
local e = artifact.sidekick.ref
|
||||
if artifact.sidekick.character == "vix" then
|
||||
artifact.sidekick.ref.object:set_properties {
|
||||
textures = {"artifact_vix.png"},
|
||||
visual_size = vector.new(1,1,1) *0.8
|
||||
}
|
||||
if e.blackrod then
|
||||
e.blackrod:remove()
|
||||
end
|
||||
else
|
||||
e.object:set_properties {
|
||||
textures = {"artifact_key.png"},
|
||||
visual_size = vector.new(1,1,1) *0.88
|
||||
}
|
||||
e.blackrod = minetest.add_entity(e.object:get_pos(), "display")
|
||||
e.blackrod:set_properties {
|
||||
visual = "mesh",
|
||||
mesh = "artifact_blackrod.obj",
|
||||
textures = {"artifact_blackrod.png"},
|
||||
visual_size = vector.new(1,1,1) *10
|
||||
}
|
||||
e.blackrod:set_attach(e.object, "RightArm", vector.new(0.25, -5.5, 0), vector.new(90,0,0))
|
||||
end
|
||||
end
|
||||
artifact.sidekick.save()
|
||||
end
|
||||
|
||||
|
||||
|
||||
include "key.lua"
|
||||
include "vix.lua"
|
||||
|
||||
artifact.sidekick = setmetatable(minetest.deserialize(db:get("sidekick") or "return nil") or {
|
||||
pos = vector.zero(),
|
||||
pitch = 0,
|
||||
yaw = 0,
|
||||
character = "vix",
|
||||
}, {
|
||||
__index = {
|
||||
save = function()
|
||||
local ref = artifact.sidekick.ref
|
||||
-- Temporarily erase the entity so we can serialize properly.
|
||||
artifact.sidekick.ref = nil
|
||||
db:set_string("sidekick", minetest.serialize(artifact.sidekick))
|
||||
artifact.sidekick.ref = ref
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_entity(":artifact:sidekick", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "artifact_character.gltf",
|
||||
textures = {"artifact_key.png"},
|
||||
physical = true,
|
||||
collisionbox = {
|
||||
-0.3, 0,-0.3,
|
||||
0.3, 1.77, 0.3
|
||||
}
|
||||
},
|
||||
_interact_marker_offset = function() return vector.new(0, 1.1,0) end,
|
||||
_interact_time = 0.4,
|
||||
on_activate = function(e, data)
|
||||
if data then
|
||||
extend(e, minetest.deserialize(data) or {})
|
||||
end
|
||||
if artifact.sidekick.character == "vix" then
|
||||
e.object:set_properties {
|
||||
textures = {"artifact_key.png"},
|
||||
visual_size = vector.new(1,1,1) *0.88
|
||||
}
|
||||
end
|
||||
-- Gravity.
|
||||
e.object:set_acceleration(vector.new(0,-9.81,0))
|
||||
-- Make quite sure that we only ever have one of these.
|
||||
-- Remove this one because the first one we spawned is _probably_ the
|
||||
-- right one (e.g. if someone got unloaded, then loaded again after
|
||||
-- a replacement was spawned).
|
||||
if artifact.sidekick.ref then
|
||||
e.object:remove()
|
||||
return
|
||||
else
|
||||
artifact.sidekick.ref = e
|
||||
end
|
||||
end,
|
||||
on_deactivate = function(e)
|
||||
artifact.sidekick.ref = nil
|
||||
end,
|
||||
get_staticdata = function(e)
|
||||
return minetest.serialize{
|
||||
cahracter = e.character
|
||||
}
|
||||
end,
|
||||
on_interact = function(e, m)
|
||||
ns.swap_character(m)
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
local ns = artifact
|
||||
|
||||
|
||||
function ns.do_whack(m)
|
||||
|
||||
end
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
name = artifact_characters
|
||||
depends = artifact_story
|
||||
depends = artifact_base
|
||||
49
mods/artifact_characters/models/artifact_blackrod.obj
Normal file
49
mods/artifact_characters/models/artifact_blackrod.obj
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Made in Blockbench 4.12.5
|
||||
mtllib artifact_blackrod.mtl
|
||||
|
||||
o cube
|
||||
v 0.03125000000000003 1 0.03125
|
||||
v 0.03125000000000003 1 -0.03125
|
||||
v 0.03125000000000003 -0.75 0.03125
|
||||
v 0.03125000000000003 -0.75 -0.03125
|
||||
v -0.03125 1 -0.03125
|
||||
v -0.03125 1 0.03125
|
||||
v -0.03125 -0.75 -0.03125
|
||||
v -0.03125 -0.75 0.03125
|
||||
vt 0 1
|
||||
vt 0.03125 1
|
||||
vt 0.03125 0.125
|
||||
vt 0 0.125
|
||||
vt 0.03125 1
|
||||
vt 0.0625 1
|
||||
vt 0.0625 0.125
|
||||
vt 0.03125 0.125
|
||||
vt 0.0625 1
|
||||
vt 0.09375 1
|
||||
vt 0.09375 0.125
|
||||
vt 0.0625 0.125
|
||||
vt 0.09375 1
|
||||
vt 0.125 1
|
||||
vt 0.125 0.125
|
||||
vt 0.09375 0.125
|
||||
vt 0.15625 0.96875
|
||||
vt 0.125 0.96875
|
||||
vt 0.125 1
|
||||
vt 0.15625 1
|
||||
vt 0.15625 0.96875
|
||||
vt 0.125 0.96875
|
||||
vt 0.125 0.9375
|
||||
vt 0.15625 0.9375
|
||||
vn 0 0 -1
|
||||
vn 1 0 0
|
||||
vn 0 0 1
|
||||
vn -1 0 0
|
||||
vn 0 1 0
|
||||
vn 0 -1 0
|
||||
usemtl m_99dd5155-5cc9-5980-76ce-3093fe3734a6
|
||||
f 4/4/1 7/3/1 5/2/1 2/1/1
|
||||
f 3/8/2 4/7/2 2/6/2 1/5/2
|
||||
f 8/12/3 3/11/3 1/10/3 6/9/3
|
||||
f 7/16/4 8/15/4 6/14/4 5/13/4
|
||||
f 6/20/5 1/19/5 2/18/5 5/17/5
|
||||
f 7/24/6 4/23/6 3/22/6 8/21/6
|
||||
BIN
mods/artifact_characters/textures/artifact_blackrod.png
Normal file
BIN
mods/artifact_characters/textures/artifact_blackrod.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 133 B |
|
|
@ -0,0 +1,99 @@
|
|||
local ns = artifact
|
||||
|
||||
minetest.register_entity(":artifact:burst", {
|
||||
initial_properties = {
|
||||
visual = "sprite",
|
||||
textures = {"blank.png"},
|
||||
pointable = false,
|
||||
physical = true,
|
||||
collide_with_objects = false,
|
||||
collisionbox = {
|
||||
-0.2, -0.2, -0.2,
|
||||
0.2, 0.2, 0.2
|
||||
},
|
||||
static_save = false,
|
||||
},
|
||||
on_activate = function(e, rot)
|
||||
e.object:set_armor_groups{immortal = 1}
|
||||
end,
|
||||
on_deactivate = function(e)
|
||||
for _, x in ipairs(e._particles) do
|
||||
minetest.delete_particlespawner(x)
|
||||
end
|
||||
end,
|
||||
on_step = function(e, dtime, movement)
|
||||
if movement.collides then
|
||||
minetest.add_particlespawner {
|
||||
pos = e.object:get_pos(),
|
||||
radius = 0.1,
|
||||
texture = {
|
||||
name = "artifact_light.png",
|
||||
alpha_tween = {1, 0}
|
||||
},
|
||||
glow = 8,
|
||||
size_tween = {
|
||||
{min = 2, max = 3},
|
||||
{min = 4, max = 5}
|
||||
},
|
||||
attract = {
|
||||
kind = "point",
|
||||
strength = {
|
||||
min = -50,
|
||||
max = -20,
|
||||
},
|
||||
origin = e.object:get_pos()
|
||||
},
|
||||
amount = 25,
|
||||
exptime = 0.5,
|
||||
drag = 1,
|
||||
time = 0.1,
|
||||
}
|
||||
e.object:remove()
|
||||
end
|
||||
end,
|
||||
impulse = function(e, vel)
|
||||
-- The documentation said that `vel` is relative to the parent entity...
|
||||
-- I guess the documentation is wrong?
|
||||
local rot = vel:normalize():dir_to_rotation()
|
||||
local min, max = vector.sort(vector.new(-1,-1,-1):rotate(rot), vector.new(1,1,0):rotate(rot))
|
||||
e._particles = {
|
||||
-- Tail
|
||||
minetest.add_particlespawner {
|
||||
attached = e.object,
|
||||
pos = {
|
||||
min = vector.new(-1,-1,-1) *0.2,
|
||||
max = vector.new(1,1,1) *0.2
|
||||
},
|
||||
vel = {
|
||||
min = min,
|
||||
max = max
|
||||
},
|
||||
texture = {
|
||||
name = "artifact_light.png",
|
||||
alpha_tween = {1, 0}
|
||||
},
|
||||
size = 0.4,
|
||||
glow = 10,
|
||||
amount = 450,
|
||||
time = 0
|
||||
},
|
||||
-- Head
|
||||
minetest.add_particlespawner {
|
||||
attached = e.object,
|
||||
pos = vector.zero(),
|
||||
vel = vel,
|
||||
texture = "[fill:16x16:0,0:#fff",
|
||||
size = 3,
|
||||
glow = 14,
|
||||
amount = 150,
|
||||
time = 0,
|
||||
exptime = 0.1
|
||||
}
|
||||
}
|
||||
e.object:set_velocity(vel)
|
||||
end
|
||||
})
|
||||
|
||||
function ns.do_shoot(m)
|
||||
minetest.add_entity(m.pos +m.dir, "artifact:burst", tostring(m.yaw)):get_luaentity():impulse(m.dir *30)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue