first commit

master
runs 2020-04-21 19:55:35 +02:00
commit f01416db60
10 changed files with 154 additions and 0 deletions

6
api/api.lua Normal file
View File

@ -0,0 +1,6 @@
local modpath, modname, S = ...
local creative_mode = minetest.settings:get_bool("creative_mode")
assert(loadfile(modpath .. "/api/api_on_die.lua"))(S)

3
api/api_on_die.lua Normal file
View File

@ -0,0 +1,3 @@
function sama.on_die(self, pos)
end

1
behaviour.lua Normal file
View File

@ -0,0 +1 @@

50
brain.lua Normal file
View File

@ -0,0 +1,50 @@
function sama.brain(self)
local pos = self.object:get_pos()
mobkit.vitals(self)
if self.hp <= 0 then
sama.on_die(self)
return
end
sama.check_ground_suffocation(self, pos)
if mobkit.timer(self, 1) then
local prty = mobkit.get_queue_priority(self)
if prty < 90 then
sama.env_damage(self, pos, 90) --enviromental damage: lava, fire...
end
if prty < 80 then
if self.isinliquid then
mobkit.hq_liquid_recovery(self, 80)
return
end
end
local player = mobkit.get_nearby_player(self)
--Follow Behaviour
if prty < 50 then
if sama.bh_start_follow(self, pos, player, 50) == true then
return
end
end
if prty == 54 then
if petz.bh_stop_follow(self, player) == true then
return
end
end
--Roam default
if mobkit.is_queue_empty_high(self) and self.status == "" then
mobkit.hq_wanderfly(self, 0)
end
end
end

23
init.lua Normal file
View File

@ -0,0 +1,23 @@
--
-- sama
-- License:GPLv3
--
local modname = "sama"
local modpath = minetest.get_modpath(modname)
local mg_name = minetest.get_mapgen_setting("mg_name")
-- internationalization boilerplate
local S = minetest.get_translator(minetest.get_current_modname())
--
-- Samantha Mod
--
sama = {}
-- Load the files
assert(loadfile(modpath .. "/samantha.lua"))
assert(loadfile(modpath .. "/behaviour.lua"))
assert(loadfile(modpath .. "/brain.lua"))
assert(loadfile(modpath .. "/api/api.lua"))(modpath, modname, S )

5
mod.conf Normal file
View File

@ -0,0 +1,5 @@
name = sama
description = A Female Character for Minetest
depends = mobkit
optional_depends =
version =

BIN
models/samantha.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Binary file not shown.

66
samantha.lua Normal file
View File

@ -0,0 +1,66 @@
-- Samantha Definitions
local samantha = {}
minetest.register_entity("sama:samantha" ,{
name = "Samantha",
drops = {
},
rotate = petz.settings.rotate,
physical = true,
stepheight = 0.1, --EVIL!
collide_with_objects = true,
collisionbox = collisionbox,
visual = petz.settings.visual,
mesh = mesh,
textures = textures,
visual_size = visual_size,
static_save = true,
get_staticdata = mobkit.statfunc,
-- api props
springiness= 0,
buoyancy = 0.5, -- portion of hitbox submerged
max_speed = 2,
jump_height = 1.5,
view_range = 10,
lung_capacity = 10, -- seconds
max_hp = 8,
attack={range=0.5, damage_groups={fleshy=3}},
animation = {
walk={range={x=1, y=12}, speed=25, loop=true},
run={range={x=13, y=25}, speed=25, loop=true},
stand={
{range={x=26, y=46}, speed=5, loop=true},
{range={x=47, y=59}, speed=5, loop=true},
{range={x=82, y=94}, speed=5, loop=true},
},
},
sounds = {
},
logic = sama.brain,
on_activate = function(self, staticdata, dtime_s) --on_activate, required
mobkit.actfunc(self, staticdata, dtime_s)
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
end,
on_rightclick = function(self, clicker)
end,
on_step = function(self, dtime)
mobkit.stepfunc(self, dtime) -- required
--petz.on_step(self, dtime)
end,
on_die = sama.on_die(self, pos)
})
--petz:register_egg("petz:lamb", S("Lamb"), "petz_spawnegg_lamb.png", true)