added (unfinished) mini crewmates, fixed bug causing amoguses couldnt jump underwater and some other sussy changes

This commit is contained in:
2023-01-28 23:58:43 +01:00
parent 8b7a428b88
commit 4e7a041d58
3 changed files with 248 additions and 10 deletions

View File

@@ -18,8 +18,8 @@ local entity = {
-- physics config -- <--- HERE IS PART FOR YOU "USER" (NERD)
gravity = 9.81, -- m/s^2
walk_acceletation_speed = 0.2, -- self explainatory
rotation_acceletation_speed = 3, -- self explainatory
walk_acceleration_speed = 0.2, -- self explainatory
rotation_acceleration_speed = 3, -- self explainatory
min_jump_force = 15, -- self explainatory
max_jump_force = 25, -- self explainatory
@@ -48,11 +48,11 @@ local entity = {
on_step = function(self, dtime)
-- play amogus sound randomly
if math.random(300) == 1 then
if math.random(200) == 1 then
minetest.sound_play("amogus_sound", {
pos = self.object:get_pos(),
gain = 1.0,
max_hear_distance = 5
max_hear_distance = 50
})
end
@@ -73,8 +73,8 @@ local entity = {
if self.is_going_forward then
--local pos = self.object:get_pos()
local vel = self.object:get_velocity()
vel.x = vel.x + dir_cos * self.walk_acceletation_speed
vel.z = vel.z + dir_sin * self.walk_acceletation_speed
vel.x = vel.x + dir_cos * self.walk_acceleration_speed
vel.z = vel.z + dir_sin * self.walk_acceleration_speed
self.object:set_velocity(vel)
end
@@ -95,7 +95,7 @@ local entity = {
end
-- update rotation_velocity
self.rotation_velocity = self.rotation_velocity + self.rotation_direction * self.rotation_acceletation_speed * dtime
self.rotation_velocity = self.rotation_velocity + self.rotation_direction * self.rotation_acceleration_speed * dtime
-- update rotation
self.object:set_yaw(self.object:get_yaw() + self.rotation_velocity * dtime)
@@ -111,15 +111,15 @@ local entity = {
pos.z = pos.z + dir_sin
local bnode = minetest.get_node(pos)
if bnode.name ~= "air" then
if bnode.name == "air" or bnode.name == "amogus_blocks:water" then
self.block_lastly_in_front = false
else
if self.block_lastly_in_front == false then
self.block_lastly_in_front = true
local vel = self.object:get_velocity()
vel.y = vel.y + (math.random() * self.min_max_jump_force_diff + self.min_jump_force)
self.object:set_velocity(vel)
end
else
self.block_lastly_in_front = false
end