💾 Archived View for gemini.susa.net › petz_functions.gmi captured on 2023-11-04 at 11:50:30. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
ack 'petz\..+ = function'
The global variable 'petz' is defined and intialised in petz/init.lua as follows.
petz = {} -- --Settings -- petz.settings = {} petz.settings.mesh = nil petz.settings.visual_size = {} petz.settings.rotate = 0 assert(loadfile(modpath .. "/settings.lua"))(modpath, S) --Load the settings petz.tamed_by_owner = {} --a list of tamed petz with owner assert(loadfile(modpath .. "/api/api.lua"))(modpath, modname, S) assert(loadfile(modpath .. "/mobkit/mobkit.lua"))(modpath, S) assert(loadfile(modpath .. "/misc/misc.lua"))(modpath, S) assert(loadfile(modpath .. "/server/cron.lua"))(modname)
The following is a list of lines throughout the codebase that define a petz.<something> = function()
init.lua:36:petz.file_exists = function(name) api/api_wool_milk.lua:70:petz.milk_milk = function(self, clicker) api/api_wool_milk.lua:87:petz.cut_feather = function(self, clicker) api/api_helper_functions.lua: 7:petz.set_properties = function(self, properties) api/api_helper_functions.lua:63:petz.pos_front_player = function(player) api/api_helper_functions.lua:76:petz.first_to_upper = function(str) api/api_helper_functions.lua:80:petz.str_is_empty = function(str) api/api_helper_functions.lua:84:petz.is_pos_nan = function(pos) api/api_helper_functions.lua:92:petz.str_remove_spaces = function(str) api/api_on_punch.lua:3:petz.puncher_is_player = function(puncher) api/api_on_punch.lua:11:petz.calculate_damage = function(self, time_from_last_punch, tool_capabilities) api/api_on_punch.lua:35:petz.punch_tamagochi = function (self, puncher) api/api_orders.lua: 3:petz.ownthing = function(self) api/api_orders.lua:16:petz.stand = function(self) api/api_orders.lua:21:petz.standhere = function(self) api/api_orders.lua:44:petz.guard = function(self) api/api_orders.lua:50:petz.follow = function(self, player) api/api_orders.lua:65:petz.alight = function(self) api/api_sleep.lua: 3:petz.calculate_sleep_times = function(self) api/api_sleep.lua:39:petz.bh_sleep = function(self, prty) api/api_sleep.lua:65:petz.sleep = function(self, prty, force) api/api_spawn.lua: 3:petz.get_node_below = function(pos) api/api_spawn.lua: 28:petz.spawn_mob = function(spawn_pos, limit_max_mobs, abr, liquidflag) api/api_spawn.lua:243:petz.pos_to_spawn = function(pet_name, pos) api/api_forms.lua: 3:petz.create_form = function(player_name, context) api/api_forms.lua:388:petz.create_detached_saddlebag_inventory = function(name) api/api_forms.lua:408:petz.create_food_form = function(self) api/api_forms.lua:446:petz.create_affinity_form = function(self) api/api_init_prop.lua: 71:petz.genetics_random_texture = function(self, textures_count) api/api_init_prop.lua: 93:petz.set_random_gender = function() api/api_init_prop.lua:101:petz.get_gen = function(self) api/api_init_prop.lua:111:petz.genetics_texture = function(self, textures_count) api/api_init_prop.lua:119:petz.load_vars = function(self) api/api_lifetime.lua: 3:petz.check_lifetime = function(self) api/api_lifetime.lua:20:petz.lifetime_timer = function(self, lifetime, on_step_time) api/api_mount.lua: 7:petz.mount = function(self, clicker, wielded_item, wielded_item_name) api/api_mount.lua:57:petz.put_saddle = function(self, clicker, wielded_item, wielded_item_name) api/api_on_die.lua: 7:petz.on_die = function(self) api/api_on_die.lua:100:petz.was_killed_by_player = function(self, puncher) api/api_on_rightclick.lua:16:petz.on_rightclick = function(self, clicker) api/api_on_step.lua:3:petz.on_step = function(self, dtime) api/api_tamagochi.lua: 9:petz.calculate_affinity_change = function(rate)
api/api_tamagochi.lua: 18:petz.set_affinity = function(self, rate)
Calculates the new affinity for the pet, and bounds it between 0 and 100.
Uses mobkit.remember() to store the affinity value.
api/api_tamagochi.lua: 31:petz.init_tamagochi_timer = function(self)
Calls petz.timer(self) if self is tamed and is configured to be updated on a timer.
Returns true if so, false otherwise. The naming is a bit confusing (the mob has a
boolean with the same name as this function).
api/api_tamagochi.lua: 44:petz.timer = function(self)
Declares a function to call after some time has elapsed (i.e. petz.settings.tamagochi_check_time), using the 'minetest.after' API.
This function handles decreasing health and affinity, and also decides the future state of the mob's 'init_tamagochi_timer' boolean flag (this is presumably used elsewhere to decide whether the pet should have a future timer initialised again).
api/api_brush.lua:3:petz.brush = function(self, wielded_item_name, pet_name)
Called to brush a pet with the given item.
api/api_tamagochi.lua:128:petz.abandon_pet = function(self, msg) misc/armors.lua:3:petz.armor_destroy = function(name, player) misc/lycanthropy.lua:109:petz.set_lycanthropy = function(player) misc/lycanthropy.lua:152:petz.unset_lycanthropy = function(player) misc/lycanthropy.lua:169:petz.reset_lycanthropy = function(player) misc/lycanthropy.lua:303:petz.set_3d_armor_lycanthropy = function(player) misc/lycanthropy.lua:313:petz.unset_3d_armor_lycanthropy = function(player) misc/mount.lua:65:petz.force_detach = function(player) mobkit/bh_head.lua:64:petz.return_head_to_origin = function(self) mobkit/helper_functions.lua: 7:petz.lookback = function(self, pos2) mobkit/helper_functions.lua: 17:petz.lookat = function(self, pos2) mobkit/helper_functions.lua:196:petz.pos_front = function(self, pos)