]> git.lizzy.rs Git - Crafter.git/commitdiff
Overhaul snowman with ElCeejo's remake of 22i's snowman model :D
authoroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 23 May 2020 20:33:44 +0000 (16:33 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 23 May 2020 20:33:44 +0000 (16:33 -0400)
mods/mob/api/api_hook.lua
mods/mob/api/interaction.lua
mods/mob/api/timers.lua
mods/mob/init.lua
mods/mob/models/attributes.txt
mods/mob/models/snowman.b3d

index 40b062697d773a1cb9b310ee8b685ab31205e7e0..e4733305572dab087d28e03811508bfdd1b877dc 100644 (file)
@@ -97,7 +97,9 @@ mob_register.explosion_blink_color = def.explosion_blink_color or "white"
 mob_register.explosion_blink_timer = def.explosion_blink_timer or 0.2
 
 mob_register.custom_function_begin = def.custom_function_begin
+mob_register.custom_function = def.custom_function
 mob_register.custom_function_end = def.custom_function_end
+
 mob_register.projectile_timer_cooldown = def.projectile_timer_cooldown
 mob_register.attacked_hostile = def.attacked_hostile
 
@@ -131,6 +133,12 @@ if def.pathfinds then
        mob_register.pathfinding_timer = 0
 end
 
+if def.custom_timer then
+       mob_register.c_timer = 0
+       mob_register.custom_timer = def.custom_timer
+       mob_register.custom_timer_function = def.custom_timer_function
+end
+
 mobs.create_movement_functions(def,mob_register)
 mobs.create_interaction_functions(def,mob_register)
 mobs.create_data_handling_functions(def,mob_register)
@@ -149,9 +157,20 @@ mob_register.on_step = function(self, dtime,moveresult)
        end
        
        if self.dead == false and self.death_animation_timer == 0 then
+               if self.do_custom_timer then
+                       self.do_custom_timer(self,dtime)
+               end
+
+               if self.custom_function then
+                       self.custom_function(self,dtime,moveresult)
+               end
+
                self.move(self,dtime,moveresult)
+               
                --self.debug_nametag(self,dtime)
+
                self.manage_hurt_color_timer(self,dtime)
+
                if self.set_animation then
                        self.set_animation(self)
                end
index c59c43818eae061583701f05c4207f09ecb56d76..a98d8f4f8f522be16626a4d4c048a34c3f0f9f8c 100644 (file)
@@ -334,4 +334,4 @@ mobs.create_interaction_functions = function(def,mob_register)
        end
        
        return(mob_register)
-end
+end
\ No newline at end of file
index 053e2a345958239f4b3fd963e442145e626c343e..bac10c897f6318f9ae3f56e2535e6588749cc521 100644 (file)
@@ -59,6 +59,16 @@ mobs.create_timer_functions = function(def,mob_register)
                end
        end
 
+       if def.custom_timer then
+               mob_register.do_custom_timer = function(self,dtime)
+                       self.c_timer = self.c_timer + dtime
+                       if self.c_timer >= self.custom_timer then
+                               self.c_timer = 0 
+                               self.custom_timer_function(self,dtime)
+                       end
+               end
+       end
+
        mob_register.manage_projectile_timer = function(self,dtime)
                self.projectile_timer = self.projectile_timer - dtime
        end
index 13e285dff7a1713bb22e56ee0f84cc272f1216d8..d5f87ea1c1a4739bc9201aad9c12fdf6e0a59c70 100644 (file)
@@ -92,7 +92,7 @@ mobs.register_mob(
 
 
         -----
-        --head_bone = "head",
+        --head_bone = "Bone",
         debug_head_pos = false,
         head_directional_offset = 0, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
         head_height_offset = 1.625, --added to the base y position
@@ -105,7 +105,7 @@ mobs.register_mob(
         
         is_visible = true,
         pointable = true,
-        automatic_face_movement_dir = 0,
+        automatic_face_movement_dir = -90,
         automatic_face_movement_max_rotation_per_sec = 300,
         makes_footstep_sound = false,
         hp = 10,
@@ -121,7 +121,7 @@ mobs.register_mob(
         animation_multiplier = 10,
         ----
         ----
-        death_rotation = "x",
+        death_rotation = "z",
         
         hurt_sound = "wool",
         die_sound = "wool",
@@ -132,6 +132,29 @@ mobs.register_mob(
         projectile_type = "weather:snowball",
         projectile_timer_cooldown = 1,
 
+        custom_function = function(self,dtime,moveresult)
+               if moveresult and moveresult.touching_ground then
+                       local pos = vector.floor(vector.add(self.object:get_pos(),0.5))
+
+                       if self.custom_old_pos and not vector.equals(pos,self.custom_old_pos) then
+                               if minetest.get_nodedef(minetest.get_node(pos).name,"buildable_to") == true and minetest.get_nodedef(minetest.get_node(vector.new(pos.x,pos.y-1,pos.z)).name,"buildable_to") == false then
+                                       minetest.set_node(pos,{name="weather:snow"})
+                               end
+                       end
+                       self.custom_old_pos = pos
+               end
+        end,
+
+        custom_timer = 0.75,
+        custom_timer_function = function(self,dtime)
+               if weather_type and weather_type ~= 1 then
+                       self.object:punch(self.object, 2, 
+                               {
+                               full_punch_interval=1.5,
+                               damage_groups = {damage=2},
+                               })
+               end
+        end,
        }
 )
 
index f17c04823d5483276ade61578972d657720f45f1..e2184d60e1f4e01c12944970d1421716c0d37627 100644 (file)
@@ -1,4 +1,7 @@
 These are pulled from multiple mods from 22i https://github.com/22i, also thank you 22i for attributing me to OpenAI
 
 Currently:
-pig - https://github.com/22i/minecraft-voxel-blender-models
+pig,creeper,nitro_creeper,spider - https://github.com/22i/minecraft-voxel-blender-models
+
+snowman - Originally by 22i (see above) redone by ElCeejo https://github.com/ElCeejo Thanks!
+
index 4d0d420bdcd096b527579f9859a92ccf25cc4677..8e24badf85bd2ab3b90a9384064b2577371a1d86 100644 (file)
Binary files a/mods/mob/models/snowman.b3d and b/mods/mob/models/snowman.b3d differ