New upstream version 0.4.5
Julien Puydt
7 years ago
0 | [mod] Visible Player Armor [3d_armor] | |
1 | ===================================== | |
2 | ||
3 | Depends: default | |
4 | ||
5 | Recommends: inventory_plus or unified_inventory (use only one) | |
6 | ||
7 | Adds craftable armor that is visible to other players. Each armor item worn contributes to | |
8 | a player's armor group level making them less vulnerable to weapons. | |
9 | ||
10 | Armor takes damage when a player is hurt but also offers a percentage chance of healing. | |
11 | Overall level is boosted by 10% when wearing a full matching set. | |
12 | ||
13 | Fire protection added by TenPlus1 when using crystal armor if Ethereal mod active, level 1 | |
14 | protects against torches, level 2 for crystal spike, level 3 for fire, level 5 for lava. | |
15 | ||
16 | Configuration | |
17 | ------------- | |
18 | ||
19 | Armor can be configured by adding a file called armor.conf in 3d_armor mod and/or world directory. | |
20 | see armor.conf.example for all available options. | |
21 | ||
22 | Note: worldpath config settings override any settings made in the mod's directory. | |
23 |
0 | minetest.register_alias("adminboots","3d_armor:boots_admin") | |
1 | minetest.register_alias("adminhelmet","3d_armor:helmet_admin") | |
2 | minetest.register_alias("adminchestplate","3d_armor:chestplate_admin") | |
3 | minetest.register_alias("adminleggings","3d_armor:leggings_admin") | |
4 | ||
5 | minetest.register_tool("3d_armor:helmet_admin", { | |
6 | description = "Admin Helmet", | |
7 | inventory_image = "3d_armor_inv_helmet_admin.png", | |
8 | groups = {armor_head=1000, armor_heal=1000, armor_use=0, armor_water=1, not_in_creative_inventory=1}, | |
9 | wear = 0, | |
10 | on_drop = function(itemstack, dropper, pos) | |
11 | return | |
12 | end, | |
13 | }) | |
14 | ||
15 | minetest.register_tool("3d_armor:chestplate_admin", { | |
16 | description = "Admin Chestplate", | |
17 | inventory_image = "3d_armor_inv_chestplate_admin.png", | |
18 | groups = {armor_torso=1000, armor_heal=1000, armor_use=0, not_in_creative_inventory=1}, | |
19 | wear = 0, | |
20 | on_drop = function(itemstack, dropper, pos) | |
21 | return | |
22 | end, | |
23 | }) | |
24 | ||
25 | minetest.register_tool("3d_armor:leggings_admin", { | |
26 | description = "Admin Leggings", | |
27 | inventory_image = "3d_armor_inv_leggings_admin.png", | |
28 | groups = {armor_legs=1000, armor_heal=1000, armor_use=0, not_in_creative_inventory=1}, | |
29 | wear = 0, | |
30 | on_drop = function(itemstack, dropper, pos) | |
31 | return | |
32 | end, | |
33 | }) | |
34 | ||
35 | minetest.register_tool("3d_armor:boots_admin", { | |
36 | description = "Admin Boots", | |
37 | inventory_image = "3d_armor_inv_boots_admin.png", | |
38 | groups = {armor_feet=1000, armor_heal=1000, armor_use=0, not_in_creative_inventory=1}, | |
39 | wear = 0, | |
40 | on_drop = function(itemstack, dropper, pos) | |
41 | return | |
42 | end, | |
43 | }) | |
44 |
0 | -- Armor Configuration (defaults) | |
1 | ||
2 | -- You can remove any unwanted armor materials from this table. | |
3 | -- Note that existing armor that is removed will show up as an unknown item. | |
4 | ARMOR_MATERIALS = { | |
5 | wood = "group:wood", | |
6 | cactus = "default:cactus", | |
7 | steel = "default:steel_ingot", | |
8 | bronze = "default:bronze_ingot", | |
9 | diamond = "default:diamond", | |
10 | gold = "default:gold_ingot", | |
11 | mithril = "moreores:mithril_ingot", | |
12 | crystal = "ethereal:crystal_ingot", | |
13 | } | |
14 | ||
15 | -- Enable fire protection (defaults true if using ethereal mod) | |
16 | ARMOR_FIRE_PROTECT = false | |
17 | ||
18 | -- Fire protection nodes, (name, protection level, damage) | |
19 | ARMOR_FIRE_NODES = { | |
20 | {"default:lava_source", 5, 4}, | |
21 | {"default:lava_flowing", 5, 4}, | |
22 | {"fire:basic_flame", 3, 4}, | |
23 | {"fire:permanent_flame", 3, 4}, | |
24 | {"ethereal:crystal_spike", 2, 1}, | |
25 | {"ethereal:fire_flower", 2, 1}, | |
26 | {"default:torch", 1, 1}, | |
27 | } | |
28 | ||
29 | -- Increase this if you get initialization glitches when a player first joins. | |
30 | ARMOR_INIT_DELAY = 1 | |
31 | ||
32 | -- Number of initialization attempts. | |
33 | -- Use in conjunction with ARMOR_INIT_DELAY if initialization problems persist. | |
34 | ARMOR_INIT_TIMES = 1 | |
35 | ||
36 | -- Increase this if armor is not getting into bones due to server lag. | |
37 | ARMOR_BONES_DELAY = 1 | |
38 | ||
39 | -- How often player armor/wield items are updated. | |
40 | ARMOR_UPDATE_TIME = 1 | |
41 | ||
42 | -- Drop armor when a player dies. | |
43 | -- Uses bones mod if present, otherwise items are dropped around the player. | |
44 | ARMOR_DROP = true | |
45 | ||
46 | -- Pulverise armor when a player dies, overrides ARMOR_DROP. | |
47 | ARMOR_DESTROY = false | |
48 | ||
49 | -- You can use this to increase or decrease overall armor effectiveness, | |
50 | -- eg: ARMOR_LEVEL_MULTIPLIER = 0.5 will reduce armor level by half. | |
51 | ARMOR_LEVEL_MULTIPLIER = 1 | |
52 | ||
53 | -- You can use this to increase or decrease overall armor healing, | |
54 | -- eg: ARMOR_HEAL_MULTIPLIER = 0 will disable healing altogether. | |
55 | ARMOR_HEAL_MULTIPLIER = 1 | |
56 | ||
57 | -- You can use this to increase or decrease overall armor radiation protection, | |
58 | -- eg: ARMOR_RADIATION_MULTIPLIER = 0 will completely disable radiation protection. | |
59 | -- Note: patched technic mod is required | |
60 | ARMOR_RADIATION_MULTIPLIER = 1 |
0 | ARMOR_INIT_DELAY = 1 | |
1 | ARMOR_INIT_TIMES = 1 | |
2 | ARMOR_BONES_DELAY = 1 | |
3 | ARMOR_UPDATE_TIME = 1 | |
4 | ARMOR_DROP = minetest.get_modpath("bones") ~= nil | |
5 | ARMOR_DESTROY = false | |
6 | ARMOR_LEVEL_MULTIPLIER = 1 | |
7 | ARMOR_HEAL_MULTIPLIER = 1 | |
8 | ARMOR_RADIATION_MULTIPLIER = 1 | |
9 | ARMOR_MATERIALS = { | |
10 | wood = "group:wood", | |
11 | cactus = "default:cactus", | |
12 | steel = "default:steel_ingot", | |
13 | bronze = "default:bronze_ingot", | |
14 | diamond = "default:diamond", | |
15 | gold = "default:gold_ingot", | |
16 | mithril = "moreores:mithril_ingot", | |
17 | crystal = "ethereal:crystal_ingot", | |
18 | } | |
19 | ARMOR_FIRE_PROTECT = minetest.get_modpath("ethereal") ~= nil | |
20 | ARMOR_FIRE_NODES = { | |
21 | {"default:lava_source", 5, 8}, | |
22 | {"default:lava_flowing", 5, 8}, | |
23 | {"fire:basic_flame", 3, 4}, | |
24 | {"fire:permanent_flame", 3, 4}, | |
25 | {"ethereal:crystal_spike", 2, 1}, | |
26 | {"ethereal:fire_flower", 2, 1}, | |
27 | {"default:torch", 1, 1}, | |
28 | } | |
29 | ||
30 | local skin_mod = nil | |
31 | local inv_mod = nil | |
32 | ||
33 | local modpath = minetest.get_modpath(ARMOR_MOD_NAME) | |
34 | local worldpath = minetest.get_worldpath() | |
35 | local input = io.open(modpath.."/armor.conf", "r") | |
36 | if input then | |
37 | dofile(modpath.."/armor.conf") | |
38 | input:close() | |
39 | input = nil | |
40 | end | |
41 | input = io.open(worldpath.."/armor.conf", "r") | |
42 | if input then | |
43 | dofile(worldpath.."/armor.conf") | |
44 | input:close() | |
45 | input = nil | |
46 | end | |
47 | if not minetest.get_modpath("moreores") then | |
48 | ARMOR_MATERIALS.mithril = nil | |
49 | end | |
50 | if not minetest.get_modpath("ethereal") then | |
51 | ARMOR_MATERIALS.crystal = nil | |
52 | end | |
53 | ||
54 | armor = { | |
55 | timer = 0, | |
56 | elements = {"head", "torso", "legs", "feet"}, | |
57 | physics = {"jump","speed","gravity"}, | |
58 | formspec = "size[8,8.5]image[2,0.75;2,4;armor_preview]" | |
59 | .."list[current_player;main;0,4.5;8,4;]" | |
60 | .."list[current_player;craft;4,1;3,3;]" | |
61 | .."list[current_player;craftpreview;7,2;1,1;]" | |
62 | .."listring[current_player;main]" | |
63 | .."listring[current_player;craft]", | |
64 | textures = {}, | |
65 | default_skin = "character", | |
66 | version = "0.4.5", | |
67 | } | |
68 | ||
69 | if minetest.get_modpath("inventory_plus") then | |
70 | inv_mod = "inventory_plus" | |
71 | armor.formspec = "size[8,8.5]button[0,0;2,0.5;main;Back]" | |
72 | .."image[2.5,0.75;2,4;armor_preview]" | |
73 | .."label[5,1;Level: armor_level]" | |
74 | .."label[5,1.5;Heal: armor_heal]" | |
75 | .."label[5,2;Fire: armor_fire]" | |
76 | .."label[5,2.5;Radiation: armor_radiation]" | |
77 | .."list[current_player;main;0,4.5;8,4;]" | |
78 | if minetest.get_modpath("crafting") then | |
79 | inventory_plus.get_formspec = function(player, page) | |
80 | end | |
81 | end | |
82 | elseif minetest.get_modpath("unified_inventory") then | |
83 | inv_mod = "unified_inventory" | |
84 | unified_inventory.register_button("armor", { | |
85 | type = "image", | |
86 | image = "inventory_plus_armor.png", | |
87 | }) | |
88 | unified_inventory.register_page("armor", { | |
89 | get_formspec = function(player, perplayer_formspec) | |
90 | local fy = perplayer_formspec.formspec_y | |
91 | local name = player:get_player_name() | |
92 | local formspec = "background[0.06,"..fy..";7.92,7.52;3d_armor_ui_form.png]" | |
93 | .."label[0,0;Armor]" | |
94 | .."list[detached:"..name.."_armor;armor;0,"..fy..";2,3;]" | |
95 | .."image[2.5,"..(fy - 0.25)..";2,4;"..armor.textures[name].preview.."]" | |
96 | .."label[5.0,"..(fy + 0.0)..";Level: "..armor.def[name].level.."]" | |
97 | .."label[5.0,"..(fy + 0.5)..";Heal: "..armor.def[name].heal.."]" | |
98 | .."label[5.0,"..(fy + 1.0)..";Fire: "..armor.def[name].fire.."]" | |
99 | .."label[5.0,"..(fy + 1.5)..";Radiation: "..armor.def[name].radiation.."]" | |
100 | .."listring[current_player;main]" | |
101 | .."listring[detached:"..name.."_armor;armor]" | |
102 | return {formspec=formspec} | |
103 | end, | |
104 | }) | |
105 | elseif minetest.get_modpath("inventory_enhanced") then | |
106 | inv_mod = "inventory_enhanced" | |
107 | end | |
108 | ||
109 | if minetest.get_modpath("skins") then | |
110 | skin_mod = "skins" | |
111 | elseif minetest.get_modpath("simple_skins") then | |
112 | skin_mod = "simple_skins" | |
113 | elseif minetest.get_modpath("u_skins") then | |
114 | skin_mod = "u_skins" | |
115 | elseif minetest.get_modpath("wardrobe") then | |
116 | skin_mod = "wardrobe" | |
117 | end | |
118 | ||
119 | armor.def = { | |
120 | state = 0, | |
121 | count = 0, | |
122 | } | |
123 | ||
124 | armor.update_player_visuals = function(self, player) | |
125 | if not player then | |
126 | return | |
127 | end | |
128 | local name = player:get_player_name() | |
129 | if self.textures[name] then | |
130 | default.player_set_textures(player, { | |
131 | self.textures[name].skin, | |
132 | self.textures[name].armor, | |
133 | self.textures[name].wielditem, | |
134 | }) | |
135 | end | |
136 | end | |
137 | ||
138 | armor.set_player_armor = function(self, player) | |
139 | local name, player_inv = armor:get_valid_player(player, "[set_player_armor]") | |
140 | if not name then | |
141 | return | |
142 | end | |
143 | local armor_texture = "3d_armor_trans.png" | |
144 | local armor_level = 0 | |
145 | local armor_heal = 0 | |
146 | local armor_fire = 0 | |
147 | local armor_water = 0 | |
148 | local armor_radiation = 0 | |
149 | local state = 0 | |
150 | local items = 0 | |
151 | local elements = {} | |
152 | local textures = {} | |
153 | local physics_o = {speed=1,gravity=1,jump=1} | |
154 | local material = {type=nil, count=1} | |
155 | local preview = armor:get_preview(name) or "character_preview.png" | |
156 | for _,v in ipairs(self.elements) do | |
157 | elements[v] = false | |
158 | end | |
159 | for i=1, 6 do | |
160 | local stack = player_inv:get_stack("armor", i) | |
161 | local item = stack:get_name() | |
162 | if stack:get_count() == 1 then | |
163 | local def = stack:get_definition() | |
164 | for k, v in pairs(elements) do | |
165 | if v == false then | |
166 | local level = def.groups["armor_"..k] | |
167 | if level then | |
168 | local texture = def.texture or item:gsub("%:", "_") | |
169 | table.insert(textures, texture..".png") | |
170 | preview = preview.."^"..texture.."_preview.png" | |
171 | armor_level = armor_level + level | |
172 | state = state + stack:get_wear() | |
173 | items = items + 1 | |
174 | armor_heal = armor_heal + (def.groups["armor_heal"] or 0) | |
175 | armor_fire = armor_fire + (def.groups["armor_fire"] or 0) | |
176 | armor_water = armor_water + (def.groups["armor_water"] or 0) | |
177 | armor_radiation = armor_radiation + (def.groups["armor_radiation"] or 0) | |
178 | for kk,vv in ipairs(self.physics) do | |
179 | local o_value = def.groups["physics_"..vv] | |
180 | if o_value then | |
181 | physics_o[vv] = physics_o[vv] + o_value | |
182 | end | |
183 | end | |
184 | local mat = string.match(item, "%:.+_(.+)$") | |
185 | if material.type then | |
186 | if material.type == mat then | |
187 | material.count = material.count + 1 | |
188 | end | |
189 | else | |
190 | material.type = mat | |
191 | end | |
192 | elements[k] = true | |
193 | end | |
194 | end | |
195 | end | |
196 | end | |
197 | end | |
198 | if minetest.get_modpath("shields") then | |
199 | armor_level = armor_level * 0.9 | |
200 | end | |
201 | if material.type and material.count == #self.elements then | |
202 | armor_level = armor_level * 1.1 | |
203 | end | |
204 | armor_level = armor_level * ARMOR_LEVEL_MULTIPLIER | |
205 | armor_heal = armor_heal * ARMOR_HEAL_MULTIPLIER | |
206 | armor_radiation = armor_radiation * ARMOR_RADIATION_MULTIPLIER | |
207 | if #textures > 0 then | |
208 | armor_texture = table.concat(textures, "^") | |
209 | end | |
210 | local armor_groups = {fleshy=100} | |
211 | if armor_level > 0 then | |
212 | armor_groups.level = math.floor(armor_level / 20) | |
213 | armor_groups.fleshy = 100 - armor_level | |
214 | armor_groups.radiation = 100 - armor_radiation | |
215 | end | |
216 | player:set_armor_groups(armor_groups) | |
217 | player:set_physics_override(physics_o) | |
218 | self.textures[name].armor = armor_texture | |
219 | self.textures[name].preview = preview | |
220 | self.def[name].state = state | |
221 | self.def[name].count = items | |
222 | self.def[name].level = armor_level | |
223 | self.def[name].heal = armor_heal | |
224 | self.def[name].jump = physics_o.jump | |
225 | self.def[name].speed = physics_o.speed | |
226 | self.def[name].gravity = physics_o.gravity | |
227 | self.def[name].fire = armor_fire | |
228 | self.def[name].water = armor_water | |
229 | self.def[name].radiation = armor_radiation | |
230 | self:update_player_visuals(player) | |
231 | end | |
232 | ||
233 | armor.update_armor = function(self, player) | |
234 | -- Legacy support: Called when armor levels are changed | |
235 | -- Other mods can hook on to this function, see hud mod for example | |
236 | end | |
237 | ||
238 | armor.get_player_skin = function(self, name) | |
239 | local skin = nil | |
240 | if skin_mod == "skins" or skin_mod == "simple_skins" then | |
241 | skin = skins.skins[name] | |
242 | elseif skin_mod == "u_skins" then | |
243 | skin = u_skins.u_skins[name] | |
244 | elseif skin_mod == "wardrobe" then | |
245 | skin = string.gsub(wardrobe.playerSkins[name], "%.png$","") | |
246 | end | |
247 | return skin or armor.default_skin | |
248 | end | |
249 | ||
250 | armor.get_preview = function(self, name) | |
251 | if skin_mod == "skins" then | |
252 | return armor:get_player_skin(name).."_preview.png" | |
253 | end | |
254 | end | |
255 | ||
256 | armor.get_armor_formspec = function(self, name) | |
257 | if not armor.textures[name] then | |
258 | minetest.log("error", "3d_armor: Player texture["..name.."] is nil [get_armor_formspec]") | |
259 | return "" | |
260 | end | |
261 | if not armor.def[name] then | |
262 | minetest.log("error", "3d_armor: Armor def["..name.."] is nil [get_armor_formspec]") | |
263 | return "" | |
264 | end | |
265 | local formspec = armor.formspec.."list[detached:"..name.."_armor;armor;0,1;2,3;]" | |
266 | formspec = formspec:gsub("armor_preview", armor.textures[name].preview) | |
267 | formspec = formspec:gsub("armor_level", armor.def[name].level) | |
268 | formspec = formspec:gsub("armor_heal", armor.def[name].heal) | |
269 | formspec = formspec:gsub("armor_fire", armor.def[name].fire) | |
270 | formspec = formspec:gsub("armor_radiation", armor.def[name].radiation) | |
271 | return formspec | |
272 | end | |
273 | ||
274 | armor.update_inventory = function(self, player) | |
275 | local name = armor:get_valid_player(player, "[set_player_armor]") | |
276 | if not name or inv_mod == "inventory_enhanced" then | |
277 | return | |
278 | end | |
279 | if inv_mod == "unified_inventory" then | |
280 | if unified_inventory.current_page[name] == "armor" then | |
281 | unified_inventory.set_inventory_formspec(player, "armor") | |
282 | end | |
283 | else | |
284 | local formspec = armor:get_armor_formspec(name) | |
285 | if inv_mod == "inventory_plus" then | |
286 | formspec = formspec.."listring[current_player;main]" | |
287 | .."listring[detached:"..name.."_armor;armor]" | |
288 | local page = player:get_inventory_formspec() | |
289 | if page:find("detached:"..name.."_armor") then | |
290 | inventory_plus.set_inventory_formspec(player, formspec) | |
291 | end | |
292 | elseif not core.setting_getbool("creative_mode") then | |
293 | player:set_inventory_formspec(formspec) | |
294 | end | |
295 | end | |
296 | end | |
297 | ||
298 | armor.get_valid_player = function(self, player, msg) | |
299 | msg = msg or "" | |
300 | if not player then | |
301 | minetest.log("error", "3d_armor: Player reference is nil "..msg) | |
302 | return | |
303 | end | |
304 | local name = player:get_player_name() | |
305 | if not name then | |
306 | minetest.log("error", "3d_armor: Player name is nil "..msg) | |
307 | return | |
308 | end | |
309 | local pos = player:getpos() | |
310 | local player_inv = player:get_inventory() | |
311 | local armor_inv = minetest.get_inventory({type="detached", name=name.."_armor"}) | |
312 | if not pos then | |
313 | minetest.log("error", "3d_armor: Player position is nil "..msg) | |
314 | return | |
315 | elseif not player_inv then | |
316 | minetest.log("error", "3d_armor: Player inventory is nil "..msg) | |
317 | return | |
318 | elseif not armor_inv then | |
319 | minetest.log("error", "3d_armor: Detached armor inventory is nil "..msg) | |
320 | return | |
321 | end | |
322 | return name, player_inv, armor_inv, pos | |
323 | end | |
324 | ||
325 | -- Register Player Model | |
326 | ||
327 | default.player_register_model("3d_armor_character.b3d", { | |
328 | animation_speed = 30, | |
329 | textures = { | |
330 | armor.default_skin..".png", | |
331 | "3d_armor_trans.png", | |
332 | "3d_armor_trans.png", | |
333 | }, | |
334 | animations = { | |
335 | stand = {x=0, y=79}, | |
336 | lay = {x=162, y=166}, | |
337 | walk = {x=168, y=187}, | |
338 | mine = {x=189, y=198}, | |
339 | walk_mine = {x=200, y=219}, | |
340 | sit = {x=81, y=160}, | |
341 | }, | |
342 | }) | |
343 | ||
344 | -- Register Callbacks | |
345 | ||
346 | minetest.register_on_player_receive_fields(function(player, formname, fields) | |
347 | local name = armor:get_valid_player(player, "[on_player_receive_fields]") | |
348 | if not name or inv_mod == "inventory_enhanced" then | |
349 | return | |
350 | end | |
351 | if inv_mod == "inventory_plus" and fields.armor then | |
352 | local formspec = armor:get_armor_formspec(name) | |
353 | inventory_plus.set_inventory_formspec(player, formspec) | |
354 | return | |
355 | end | |
356 | for field, _ in pairs(fields) do | |
357 | if string.find(field, "skins_set") then | |
358 | minetest.after(0, function(player) | |
359 | local skin = armor:get_player_skin(name) | |
360 | armor.textures[name].skin = skin..".png" | |
361 | armor:set_player_armor(player) | |
362 | end, player) | |
363 | end | |
364 | end | |
365 | end) | |
366 | ||
367 | minetest.register_on_joinplayer(function(player) | |
368 | default.player_set_model(player, "3d_armor_character.b3d") | |
369 | local name = player:get_player_name() | |
370 | local player_inv = player:get_inventory() | |
371 | local armor_inv = minetest.create_detached_inventory(name.."_armor", { | |
372 | on_put = function(inv, listname, index, stack, player) | |
373 | player:get_inventory():set_stack(listname, index, stack) | |
374 | armor:set_player_armor(player) | |
375 | armor:update_inventory(player) | |
376 | end, | |
377 | on_take = function(inv, listname, index, stack, player) | |
378 | player:get_inventory():set_stack(listname, index, nil) | |
379 | armor:set_player_armor(player) | |
380 | armor:update_inventory(player) | |
381 | end, | |
382 | on_move = function(inv, from_list, from_index, to_list, to_index, count, player) | |
383 | local plaver_inv = player:get_inventory() | |
384 | local stack = inv:get_stack(to_list, to_index) | |
385 | player_inv:set_stack(to_list, to_index, stack) | |
386 | player_inv:set_stack(from_list, from_index, nil) | |
387 | armor:set_player_armor(player) | |
388 | armor:update_inventory(player) | |
389 | end, | |
390 | allow_put = function(inv, listname, index, stack, player) | |
391 | return 1 | |
392 | end, | |
393 | allow_take = function(inv, listname, index, stack, player) | |
394 | return stack:get_count() | |
395 | end, | |
396 | allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) | |
397 | return count | |
398 | end, | |
399 | }) | |
400 | if inv_mod == "inventory_plus" then | |
401 | inventory_plus.register_button(player,"armor", "Armor") | |
402 | end | |
403 | armor_inv:set_size("armor", 6) | |
404 | player_inv:set_size("armor", 6) | |
405 | for i=1, 6 do | |
406 | local stack = player_inv:get_stack("armor", i) | |
407 | armor_inv:set_stack("armor", i, stack) | |
408 | end | |
409 | armor.def[name] = { | |
410 | state = 0, | |
411 | count = 0, | |
412 | level = 0, | |
413 | heal = 0, | |
414 | jump = 1, | |
415 | speed = 1, | |
416 | gravity = 1, | |
417 | fire = 0, | |
418 | water = 0, | |
419 | radiation = 0, | |
420 | } | |
421 | armor.textures[name] = { | |
422 | skin = armor.default_skin..".png", | |
423 | armor = "3d_armor_trans.png", | |
424 | wielditem = "3d_armor_trans.png", | |
425 | preview = armor.default_skin.."_preview.png", | |
426 | } | |
427 | if skin_mod == "skins" then | |
428 | local skin = skins.skins[name] | |
429 | if skin and skins.get_type(skin) == skins.type.MODEL then | |
430 | armor.textures[name].skin = skin..".png" | |
431 | end | |
432 | elseif skin_mod == "simple_skins" then | |
433 | local skin = skins.skins[name] | |
434 | if skin then | |
435 | armor.textures[name].skin = skin..".png" | |
436 | end | |
437 | elseif skin_mod == "u_skins" then | |
438 | local skin = u_skins.u_skins[name] | |
439 | if skin and u_skins.get_type(skin) == u_skins.type.MODEL then | |
440 | armor.textures[name].skin = skin..".png" | |
441 | end | |
442 | elseif skin_mod == "wardrobe" then | |
443 | local skin = wardrobe.playerSkins[name] | |
444 | if skin then | |
445 | armor.textures[name].skin = skin | |
446 | end | |
447 | end | |
448 | if minetest.get_modpath("player_textures") then | |
449 | local filename = minetest.get_modpath("player_textures").."/textures/player_"..name | |
450 | local f = io.open(filename..".png") | |
451 | if f then | |
452 | f:close() | |
453 | armor.textures[name].skin = "player_"..name..".png" | |
454 | end | |
455 | end | |
456 | for i=1, ARMOR_INIT_TIMES do | |
457 | minetest.after(ARMOR_INIT_DELAY * i, function(player) | |
458 | armor:set_player_armor(player) | |
459 | if not inv_mod then | |
460 | armor:update_inventory(player) | |
461 | end | |
462 | end, player) | |
463 | end | |
464 | end) | |
465 | ||
466 | if ARMOR_DROP == true or ARMOR_DESTROY == true then | |
467 | armor.drop_armor = function(pos, stack) | |
468 | local obj = minetest.add_item(pos, stack) | |
469 | if obj then | |
470 | obj:setvelocity({x=math.random(-1, 1), y=5, z=math.random(-1, 1)}) | |
471 | end | |
472 | end | |
473 | minetest.register_on_dieplayer(function(player) | |
474 | local name, player_inv, armor_inv, pos = armor:get_valid_player(player, "[on_dieplayer]") | |
475 | if not name then | |
476 | return | |
477 | end | |
478 | local drop = {} | |
479 | for i=1, player_inv:get_size("armor") do | |
480 | local stack = armor_inv:get_stack("armor", i) | |
481 | if stack:get_count() > 0 then | |
482 | table.insert(drop, stack) | |
483 | armor_inv:set_stack("armor", i, nil) | |
484 | player_inv:set_stack("armor", i, nil) | |
485 | end | |
486 | end | |
487 | armor:set_player_armor(player) | |
488 | if inv_mod == "unified_inventory" then | |
489 | unified_inventory.set_inventory_formspec(player, "craft") | |
490 | elseif inv_mod == "inventory_plus" then | |
491 | local formspec = inventory_plus.get_formspec(player,"main") | |
492 | inventory_plus.set_inventory_formspec(player, formspec) | |
493 | else | |
494 | armor:update_inventory(player) | |
495 | end | |
496 | if ARMOR_DESTROY == false then | |
497 | minetest.after(ARMOR_BONES_DELAY, function() | |
498 | local node = minetest.get_node(vector.round(pos)) | |
499 | if node then | |
500 | if node.name ~= "bones:bones" then | |
501 | pos.y = pos.y+1 | |
502 | node = minetest.get_node(vector.round(pos)) | |
503 | if node.name ~= "bones:bones" then | |
504 | minetest.log("warning", "Failed to add armor to bones node.") | |
505 | return | |
506 | end | |
507 | end | |
508 | local meta = minetest.get_meta(vector.round(pos)) | |
509 | local owner = meta:get_string("owner") | |
510 | local inv = meta:get_inventory() | |
511 | for _,stack in ipairs(drop) do | |
512 | if name == owner and inv:room_for_item("main", stack) then | |
513 | inv:add_item("main", stack) | |
514 | else | |
515 | armor.drop_armor(pos, stack) | |
516 | end | |
517 | end | |
518 | else | |
519 | for _,stack in ipairs(drop) do | |
520 | armor.drop_armor(pos, stack) | |
521 | end | |
522 | end | |
523 | end) | |
524 | end | |
525 | end) | |
526 | end | |
527 | ||
528 | minetest.register_on_player_hpchange(function(player, hp_change) | |
529 | local name, player_inv, armor_inv = armor:get_valid_player(player, "[on_hpchange]") | |
530 | if name and hp_change < 0 then | |
531 | ||
532 | -- used for insta kill tools/commands like /kill (doesnt damage armor) | |
533 | if hp_change < -100 then | |
534 | return hp_change | |
535 | end | |
536 | ||
537 | local heal_max = 0 | |
538 | local state = 0 | |
539 | local items = 0 | |
540 | for i=1, 6 do | |
541 | local stack = player_inv:get_stack("armor", i) | |
542 | if stack:get_count() > 0 then | |
543 | local use = stack:get_definition().groups["armor_use"] or 0 | |
544 | local heal = stack:get_definition().groups["armor_heal"] or 0 | |
545 | local item = stack:get_name() | |
546 | stack:add_wear(use) | |
547 | armor_inv:set_stack("armor", i, stack) | |
548 | player_inv:set_stack("armor", i, stack) | |
549 | state = state + stack:get_wear() | |
550 | items = items + 1 | |
551 | if stack:get_count() == 0 then | |
552 | local desc = minetest.registered_items[item].description | |
553 | if desc then | |
554 | minetest.chat_send_player(name, "Your "..desc.." got destroyed!") | |
555 | end | |
556 | armor:set_player_armor(player) | |
557 | armor:update_inventory(player) | |
558 | end | |
559 | heal_max = heal_max + heal | |
560 | end | |
561 | end | |
562 | armor.def[name].state = state | |
563 | armor.def[name].count = items | |
564 | heal_max = heal_max * ARMOR_HEAL_MULTIPLIER | |
565 | if heal_max > math.random(100) then | |
566 | hp_change = 0 | |
567 | end | |
568 | armor:update_armor(player) | |
569 | end | |
570 | return hp_change | |
571 | end, true) | |
572 | ||
573 | -- Fire Protection and water breating, added by TenPlus1 | |
574 | ||
575 | if ARMOR_FIRE_PROTECT == true then | |
576 | -- override hot nodes so they do not hurt player anywhere but mod | |
577 | for _, row in pairs(ARMOR_FIRE_NODES) do | |
578 | if minetest.registered_nodes[row[1]] then | |
579 | minetest.override_item(row[1], {damage_per_second = 0}) | |
580 | end | |
581 | end | |
582 | else | |
583 | print ("[3d_armor] Fire Nodes disabled") | |
584 | end | |
585 | ||
586 | minetest.register_globalstep(function(dtime) | |
587 | armor.timer = armor.timer + dtime | |
588 | if armor.timer < ARMOR_UPDATE_TIME then | |
589 | return | |
590 | end | |
591 | for _,player in pairs(minetest.get_connected_players()) do | |
592 | local name = player:get_player_name() | |
593 | local pos = player:getpos() | |
594 | local hp = player:get_hp() | |
595 | -- water breathing | |
596 | if name and armor.def[name].water > 0 then | |
597 | if player:get_breath() < 10 then | |
598 | player:set_breath(10) | |
599 | end | |
600 | end | |
601 | -- fire protection | |
602 | if ARMOR_FIRE_PROTECT == true | |
603 | and name and pos and hp then | |
604 | pos.y = pos.y + 1.4 -- head level | |
605 | local node_head = minetest.get_node(pos).name | |
606 | pos.y = pos.y - 1.2 -- feet level | |
607 | local node_feet = minetest.get_node(pos).name | |
608 | -- is player inside a hot node? | |
609 | for _, row in pairs(ARMOR_FIRE_NODES) do | |
610 | -- check fire protection, if not enough then get hurt | |
611 | if row[1] == node_head or row[1] == node_feet then | |
612 | if hp > 0 and armor.def[name].fire < row[2] then | |
613 | hp = hp - row[3] * ARMOR_UPDATE_TIME | |
614 | player:set_hp(hp) | |
615 | break | |
616 | end | |
617 | end | |
618 | end | |
619 | end | |
620 | end | |
621 | armor.timer = 0 | |
622 | end) | |
623 | ||
624 | -- kill player when command issued | |
625 | minetest.register_chatcommand("kill", { | |
626 | params = "<name>", | |
627 | description = "Kills player instantly", | |
628 | func = function(name, param) | |
629 | local player = minetest.get_player_by_name(name) | |
630 | if player then | |
631 | player:set_hp(-1001) | |
632 | end | |
633 | end, | |
634 | }) |
0 | 3d_armor -- Crafting Guide | |
1 | -------------------------- | |
2 | ||
3 | Helmets: | |
4 | ||
5 | +---+---+---+ | |
6 | | X | X | X | | |
7 | +---+---+---+ | |
8 | | X | | X | | |
9 | +---+---+---+ | |
10 | | | | | | |
11 | +---+---+---+ | |
12 | ||
13 | [3d_armor:helmet_wood] X = [default:wood] | |
14 | [3d_armor:helmet_cactus] X = [default:cactus] | |
15 | [3d_armor:helmet_steel] X = [default:steel_ingot] | |
16 | [3d_armor:helmet_bronze] X = [default:bronze_ingot] | |
17 | [3d_armor:helmet_diamond] X = [default:diamond] | |
18 | [3d_armor:helmet_gold] X = [default:gold_ingot] | |
19 | [3d_armor:helmet_mithril] X = [moreores:mithril_ingot] * | |
20 | [3d_armor:helmet_crystal] X = [ethereal:crystal_ingot] ** | |
21 | ||
22 | Chestplates: | |
23 | ||
24 | +---+---+---+ | |
25 | | X | | X | | |
26 | +---+---+---+ | |
27 | | X | X | X | | |
28 | +---+---+---+ | |
29 | | X | X | X | | |
30 | +---+---+---+ | |
31 | ||
32 | [3d_armor:chestplate_wood] X = [default:wood] | |
33 | [3d_armor:chestplate_cactus] X = [default:cactus] | |
34 | [3d_armor:chestplate_steel] X = [default:steel_ingot] | |
35 | [3d_armor:chestplate_bronze] X = [default:bronze_ingot] | |
36 | [3d_armor:chestplate_diamond] X = [default:diamond] | |
37 | [3d_armor:chestplate_gold] X = [default:gold_ingot] | |
38 | [3d_armor:chestplate_mithril] X = [moreores:mithril_ingot] * | |
39 | [3d_armor:chestplate_crystal] X = [ethereal:crystal_ingot] ** | |
40 | ||
41 | Leggings: | |
42 | ||
43 | +---+---+---+ | |
44 | | X | X | X | | |
45 | +---+---+---+ | |
46 | | X | | X | | |
47 | +---+---+---+ | |
48 | | X | | X | | |
49 | +---+---+---+ | |
50 | ||
51 | [3d_armor:leggings_wood] X = [default:wood] | |
52 | [3d_armor:leggings_cactus] X = [default:cactus] | |
53 | [3d_armor:leggings_steel] X = [default:steel_ingot] | |
54 | [3d_armor:leggings_bronze] X = [default:bronze_ingot] | |
55 | [3d_armor:leggings_diamond] X = [default:diamond] | |
56 | [3d_armor:leggings_gold] X = [default:gold_ingot] | |
57 | [3d_armor:leggings_mithril] X = [moreores:mithril_ingot] * | |
58 | [3d_armor:leggings_crystal] X = [ethereal:crystal_ingot] ** | |
59 | ||
60 | Boots: | |
61 | ||
62 | +---+---+---+ | |
63 | | X | | X | | |
64 | +---+---+---+ | |
65 | | X | | X | | |
66 | +---+---+---+ | |
67 | ||
68 | [3d_armor:boots_wood] X = [default:wood] | |
69 | [3d_armor:boots_cactus] X = [default:cactus] | |
70 | [3d_armor:boots_steel] X = [default:steel_ingot] | |
71 | [3d_armor:boots_bronze] X = [default:bronze_ingot | |
72 | [3d_armor:boots_diamond] X = [default:diamond] | |
73 | [3d_armor:boots_gold] X = [default:gold_ingot] | |
74 | [3d_armor:boots_mithril] X = [moreores:mithril_ingot] * | |
75 | [3d_armor:boots_crystal] X = [ethereal:crystal_ingot] ** | |
76 | ||
77 | * Requires moreores mod by Calinou - https://forum.minetest.net/viewtopic.php?id=549 | |
78 | ** Requires ethereal mod by Chinchow & TenPlus1 - https://github.com/tenplus1/ethereal |
0 | Adds craftable armor that is visible to other players. |
0 | ARMOR_MOD_NAME = minetest.get_current_modname() | |
1 | dofile(minetest.get_modpath(ARMOR_MOD_NAME).."/armor.lua") | |
2 | dofile(minetest.get_modpath(ARMOR_MOD_NAME).."/admin.lua") | |
3 | ||
4 | if ARMOR_MATERIALS.wood then | |
5 | minetest.register_tool("3d_armor:helmet_wood", { | |
6 | description = "Wood Helmet", | |
7 | inventory_image = "3d_armor_inv_helmet_wood.png", | |
8 | groups = {armor_head=5, armor_heal=0, armor_use=2000}, | |
9 | wear = 0, | |
10 | }) | |
11 | minetest.register_tool("3d_armor:chestplate_wood", { | |
12 | description = "Wood Chestplate", | |
13 | inventory_image = "3d_armor_inv_chestplate_wood.png", | |
14 | groups = {armor_torso=10, armor_heal=0, armor_use=2000}, | |
15 | wear = 0, | |
16 | }) | |
17 | minetest.register_tool("3d_armor:leggings_wood", { | |
18 | description = "Wood Leggings", | |
19 | inventory_image = "3d_armor_inv_leggings_wood.png", | |
20 | groups = {armor_legs=5, armor_heal=0, armor_use=2000}, | |
21 | wear = 0, | |
22 | }) | |
23 | minetest.register_tool("3d_armor:boots_wood", { | |
24 | description = "Wood Boots", | |
25 | inventory_image = "3d_armor_inv_boots_wood.png", | |
26 | groups = {armor_feet=5, armor_heal=0, armor_use=2000}, | |
27 | wear = 0, | |
28 | }) | |
29 | end | |
30 | ||
31 | if ARMOR_MATERIALS.cactus then | |
32 | minetest.register_tool("3d_armor:helmet_cactus", { | |
33 | description = "Cactuc Helmet", | |
34 | inventory_image = "3d_armor_inv_helmet_cactus.png", | |
35 | groups = {armor_head=5, armor_heal=0, armor_use=1000}, | |
36 | wear = 0, | |
37 | }) | |
38 | minetest.register_tool("3d_armor:chestplate_cactus", { | |
39 | description = "Cactus Chestplate", | |
40 | inventory_image = "3d_armor_inv_chestplate_cactus.png", | |
41 | groups = {armor_torso=10, armor_heal=0, armor_use=1000}, | |
42 | wear = 0, | |
43 | }) | |
44 | minetest.register_tool("3d_armor:leggings_cactus", { | |
45 | description = "Cactus Leggings", | |
46 | inventory_image = "3d_armor_inv_leggings_cactus.png", | |
47 | groups = {armor_legs=5, armor_heal=0, armor_use=1000}, | |
48 | wear = 0, | |
49 | }) | |
50 | minetest.register_tool("3d_armor:boots_cactus", { | |
51 | description = "Cactus Boots", | |
52 | inventory_image = "3d_armor_inv_boots_cactus.png", | |
53 | groups = {armor_feet=5, armor_heal=0, armor_use=2000}, | |
54 | wear = 0, | |
55 | }) | |
56 | end | |
57 | ||
58 | if ARMOR_MATERIALS.steel then | |
59 | minetest.register_tool("3d_armor:helmet_steel", { | |
60 | description = "Steel Helmet", | |
61 | inventory_image = "3d_armor_inv_helmet_steel.png", | |
62 | groups = {armor_head=10, armor_heal=0, armor_use=500}, | |
63 | wear = 0, | |
64 | }) | |
65 | minetest.register_tool("3d_armor:chestplate_steel", { | |
66 | description = "Steel Chestplate", | |
67 | inventory_image = "3d_armor_inv_chestplate_steel.png", | |
68 | groups = {armor_torso=15, armor_heal=0, armor_use=500}, | |
69 | wear = 0, | |
70 | }) | |
71 | minetest.register_tool("3d_armor:leggings_steel", { | |
72 | description = "Steel Leggings", | |
73 | inventory_image = "3d_armor_inv_leggings_steel.png", | |
74 | groups = {armor_legs=15, armor_heal=0, armor_use=500}, | |
75 | wear = 0, | |
76 | }) | |
77 | minetest.register_tool("3d_armor:boots_steel", { | |
78 | description = "Steel Boots", | |
79 | inventory_image = "3d_armor_inv_boots_steel.png", | |
80 | groups = {armor_feet=10, armor_heal=0, armor_use=500}, | |
81 | wear = 0, | |
82 | }) | |
83 | end | |
84 | ||
85 | if ARMOR_MATERIALS.bronze then | |
86 | minetest.register_tool("3d_armor:helmet_bronze", { | |
87 | description = "Bronze Helmet", | |
88 | inventory_image = "3d_armor_inv_helmet_bronze.png", | |
89 | groups = {armor_head=10, armor_heal=6, armor_use=250}, | |
90 | wear = 0, | |
91 | }) | |
92 | minetest.register_tool("3d_armor:chestplate_bronze", { | |
93 | description = "Bronze Chestplate", | |
94 | inventory_image = "3d_armor_inv_chestplate_bronze.png", | |
95 | groups = {armor_torso=15, armor_heal=6, armor_use=250}, | |
96 | wear = 0, | |
97 | }) | |
98 | minetest.register_tool("3d_armor:leggings_bronze", { | |
99 | description = "Bronze Leggings", | |
100 | inventory_image = "3d_armor_inv_leggings_bronze.png", | |
101 | groups = {armor_legs=15, armor_heal=6, armor_use=250}, | |
102 | wear = 0, | |
103 | }) | |
104 | minetest.register_tool("3d_armor:boots_bronze", { | |
105 | description = "Bronze Boots", | |
106 | inventory_image = "3d_armor_inv_boots_bronze.png", | |
107 | groups = {armor_feet=10, armor_heal=6, armor_use=250}, | |
108 | wear = 0, | |
109 | }) | |
110 | end | |
111 | ||
112 | if ARMOR_MATERIALS.diamond then | |
113 | minetest.register_tool("3d_armor:helmet_diamond", { | |
114 | description = "Diamond Helmet", | |
115 | inventory_image = "3d_armor_inv_helmet_diamond.png", | |
116 | groups = {armor_head=15, armor_heal=12, armor_use=100}, | |
117 | wear = 0, | |
118 | }) | |
119 | minetest.register_tool("3d_armor:chestplate_diamond", { | |
120 | description = "Diamond Chestplate", | |
121 | inventory_image = "3d_armor_inv_chestplate_diamond.png", | |
122 | groups = {armor_torso=20, armor_heal=12, armor_use=100}, | |
123 | wear = 0, | |
124 | }) | |
125 | minetest.register_tool("3d_armor:leggings_diamond", { | |
126 | description = "Diamond Leggings", | |
127 | inventory_image = "3d_armor_inv_leggings_diamond.png", | |
128 | groups = {armor_legs=20, armor_heal=12, armor_use=100}, | |
129 | wear = 0, | |
130 | }) | |
131 | minetest.register_tool("3d_armor:boots_diamond", { | |
132 | description = "Diamond Boots", | |
133 | inventory_image = "3d_armor_inv_boots_diamond.png", | |
134 | groups = {armor_feet=15, armor_heal=12, armor_use=100}, | |
135 | wear = 0, | |
136 | }) | |
137 | end | |
138 | ||
139 | if ARMOR_MATERIALS.gold then | |
140 | minetest.register_tool("3d_armor:helmet_gold", { | |
141 | description = "Gold Helmet", | |
142 | inventory_image = "3d_armor_inv_helmet_gold.png", | |
143 | groups = {armor_head=10, armor_heal=6, armor_use=250}, | |
144 | wear = 0, | |
145 | }) | |
146 | minetest.register_tool("3d_armor:chestplate_gold", { | |
147 | description = "Gold Chestplate", | |
148 | inventory_image = "3d_armor_inv_chestplate_gold.png", | |
149 | groups = {armor_torso=15, armor_heal=6, armor_use=250}, | |
150 | wear = 0, | |
151 | }) | |
152 | minetest.register_tool("3d_armor:leggings_gold", { | |
153 | description = "Gold Leggings", | |
154 | inventory_image = "3d_armor_inv_leggings_gold.png", | |
155 | groups = {armor_legs=15, armor_heal=6, armor_use=250}, | |
156 | wear = 0, | |
157 | }) | |
158 | minetest.register_tool("3d_armor:boots_gold", { | |
159 | description = "Gold Boots", | |
160 | inventory_image = "3d_armor_inv_boots_gold.png", | |
161 | groups = {armor_feet=10, armor_heal=6, armor_use=250}, | |
162 | wear = 0, | |
163 | }) | |
164 | end | |
165 | ||
166 | if ARMOR_MATERIALS.mithril then | |
167 | minetest.register_tool("3d_armor:helmet_mithril", { | |
168 | description = "Mithril Helmet", | |
169 | inventory_image = "3d_armor_inv_helmet_mithril.png", | |
170 | groups = {armor_head=15, armor_heal=12, armor_use=50}, | |
171 | wear = 0, | |
172 | }) | |
173 | minetest.register_tool("3d_armor:chestplate_mithril", { | |
174 | description = "Mithril Chestplate", | |
175 | inventory_image = "3d_armor_inv_chestplate_mithril.png", | |
176 | groups = {armor_torso=20, armor_heal=12, armor_use=50}, | |
177 | wear = 0, | |
178 | }) | |
179 | minetest.register_tool("3d_armor:leggings_mithril", { | |
180 | description = "Mithril Leggings", | |
181 | inventory_image = "3d_armor_inv_leggings_mithril.png", | |
182 | groups = {armor_legs=20, armor_heal=12, armor_use=50}, | |
183 | wear = 0, | |
184 | }) | |
185 | minetest.register_tool("3d_armor:boots_mithril", { | |
186 | description = "Mithril Boots", | |
187 | inventory_image = "3d_armor_inv_boots_mithril.png", | |
188 | groups = {armor_feet=15, armor_heal=12, armor_use=50}, | |
189 | wear = 0, | |
190 | }) | |
191 | end | |
192 | ||
193 | if ARMOR_MATERIALS.crystal then | |
194 | minetest.register_tool("3d_armor:helmet_crystal", { | |
195 | description = "Crystal Helmet", | |
196 | inventory_image = "3d_armor_inv_helmet_crystal.png", | |
197 | groups = {armor_head=15, armor_heal=12, armor_use=50, armor_fire=1}, | |
198 | wear = 0, | |
199 | }) | |
200 | minetest.register_tool("3d_armor:chestplate_crystal", { | |
201 | description = "Crystal Chestplate", | |
202 | inventory_image = "3d_armor_inv_chestplate_crystal.png", | |
203 | groups = {armor_torso=20, armor_heal=12, armor_use=50, armor_fire=1}, | |
204 | wear = 0, | |
205 | }) | |
206 | minetest.register_tool("3d_armor:leggings_crystal", { | |
207 | description = "Crystal Leggings", | |
208 | inventory_image = "3d_armor_inv_leggings_crystal.png", | |
209 | groups = {armor_legs=20, armor_heal=12, armor_use=50, armor_fire=1}, | |
210 | wear = 0, | |
211 | }) | |
212 | minetest.register_tool("3d_armor:boots_crystal", { | |
213 | description = "Crystal Boots", | |
214 | inventory_image = "3d_armor_inv_boots_crystal.png", | |
215 | groups = {armor_feet=15, armor_heal=12, armor_use=50, physics_speed=1, physics_jump=0.5, armor_fire=1}, | |
216 | wear = 0, | |
217 | }) | |
218 | end | |
219 | ||
220 | for k, v in pairs(ARMOR_MATERIALS) do | |
221 | minetest.register_craft({ | |
222 | output = "3d_armor:helmet_"..k, | |
223 | recipe = { | |
224 | {v, v, v}, | |
225 | {v, "", v}, | |
226 | {"", "", ""}, | |
227 | }, | |
228 | }) | |
229 | minetest.register_craft({ | |
230 | output = "3d_armor:chestplate_"..k, | |
231 | recipe = { | |
232 | {v, "", v}, | |
233 | {v, v, v}, | |
234 | {v, v, v}, | |
235 | }, | |
236 | }) | |
237 | minetest.register_craft({ | |
238 | output = "3d_armor:leggings_"..k, | |
239 | recipe = { | |
240 | {v, v, v}, | |
241 | {v, "", v}, | |
242 | {v, "", v}, | |
243 | }, | |
244 | }) | |
245 | minetest.register_craft({ | |
246 | output = "3d_armor:boots_"..k, | |
247 | recipe = { | |
248 | {v, "", v}, | |
249 | {v, "", v}, | |
250 | }, | |
251 | }) | |
252 | end | |
253 |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 | [mod] 3d Armor Stand [3d_armor_stand] | |
1 | ===================================== | |
2 | ||
3 | License Source Code: LGPL v2.1 | |
4 | ||
5 | Lecense Media: CC BY-SA 3.0 | |
6 |
0 | [mod] 3d Armor Stand [3d_armor_stand] | |
1 | ===================================== | |
2 | ||
3 | Depends: 3d_armor | |
4 | ||
5 | Adds a chest-like armor stand for armor storage and display. | |
6 | ||
7 | Crafting | |
8 | -------- | |
9 | ||
10 | F = Wooden Fence [default:fence_wood] | |
11 | S = Steel Ingot [default:steel_ingot] | |
12 | ||
13 | +---+---+---+ | |
14 | | | F | | | |
15 | +---+---+---+ | |
16 | | | F | | | |
17 | +---+---+---+ | |
18 | | S | S | S | | |
19 | +---+---+---+ | |
20 |
0 | local armor_stand_formspec = "size[8,7]" .. | |
1 | default.gui_bg .. | |
2 | default.gui_bg_img .. | |
3 | default.gui_slots .. | |
4 | default.get_hotbar_bg(0,3) .. | |
5 | "list[current_name;armor_head;3,0.5;1,1;]" .. | |
6 | "list[current_name;armor_torso;4,0.5;1,1;]" .. | |
7 | "list[current_name;armor_legs;3,1.5;1,1;]" .. | |
8 | "list[current_name;armor_feet;4,1.5;1,1;]" .. | |
9 | "image[3,0.5;1,1;3d_armor_stand_head.png]" .. | |
10 | "image[4,0.5;1,1;3d_armor_stand_torso.png]" .. | |
11 | "image[3,1.5;1,1;3d_armor_stand_legs.png]" .. | |
12 | "image[4,1.5;1,1;3d_armor_stand_feet.png]" .. | |
13 | "list[current_player;main;0,3;8,1;]" .. | |
14 | "list[current_player;main;0,4.25;8,3;8]" | |
15 | ||
16 | local elements = {"head", "torso", "legs", "feet"} | |
17 | ||
18 | local function get_stand_object(pos) | |
19 | local object = nil | |
20 | local objects = minetest.get_objects_inside_radius(pos, 0.5) or {} | |
21 | for _, obj in pairs(objects) do | |
22 | local ent = obj:get_luaentity() | |
23 | if ent then | |
24 | if ent.name == "3d_armor_stand:armor_entity" then | |
25 | -- Remove duplicates | |
26 | if object then | |
27 | obj:remove() | |
28 | else | |
29 | object = obj | |
30 | end | |
31 | end | |
32 | end | |
33 | end | |
34 | return object | |
35 | end | |
36 | ||
37 | local function update_entity(pos) | |
38 | local node = minetest.get_node(pos) | |
39 | local object = get_stand_object(pos) | |
40 | if object then | |
41 | if not string.find(node.name, "3d_armor_stand:") then | |
42 | object:remove() | |
43 | return | |
44 | end | |
45 | else | |
46 | object = minetest.add_entity(pos, "3d_armor_stand:armor_entity") | |
47 | end | |
48 | if object then | |
49 | local texture = "3d_armor_trans.png" | |
50 | local textures = {} | |
51 | local meta = minetest.get_meta(pos) | |
52 | local inv = meta:get_inventory() | |
53 | local yaw = 0 | |
54 | if inv then | |
55 | for _, element in pairs(elements) do | |
56 | local stack = inv:get_stack("armor_"..element, 1) | |
57 | if stack:get_count() == 1 then | |
58 | local item = stack:get_name() or "" | |
59 | local def = stack:get_definition() or {} | |
60 | local groups = def.groups or {} | |
61 | if groups["armor_"..element] then | |
62 | local texture = def.texture or item:gsub("%:", "_") | |
63 | table.insert(textures, texture..".png") | |
64 | end | |
65 | end | |
66 | end | |
67 | end | |
68 | if #textures > 0 then | |
69 | texture = table.concat(textures, "^") | |
70 | end | |
71 | if node.param2 then | |
72 | local rot = node.param2 % 4 | |
73 | if rot == 1 then | |
74 | yaw = 3 * math.pi / 2 | |
75 | elseif rot == 2 then | |
76 | yaw = math.pi | |
77 | elseif rot == 3 then | |
78 | yaw = math.pi / 2 | |
79 | end | |
80 | end | |
81 | object:setyaw(yaw) | |
82 | object:set_properties({textures={texture}}) | |
83 | end | |
84 | end | |
85 | ||
86 | local function has_locked_armor_stand_privilege(meta, player) | |
87 | local name = "" | |
88 | if player then | |
89 | if minetest.check_player_privs(player, "protection_bypass") then | |
90 | return true | |
91 | end | |
92 | name = player:get_player_name() | |
93 | end | |
94 | if name ~= meta:get_string("owner") then | |
95 | return false | |
96 | end | |
97 | return true | |
98 | end | |
99 | ||
100 | minetest.register_node("3d_armor_stand:armor_stand", { | |
101 | description = "Armor stand", | |
102 | drawtype = "mesh", | |
103 | mesh = "3d_armor_stand.obj", | |
104 | tiles = {"default_wood.png", "default_steel_block.png"}, | |
105 | paramtype = "light", | |
106 | paramtype2 = "facedir", | |
107 | walkable = false, | |
108 | selection_box = { | |
109 | type = "fixed", | |
110 | fixed = {-0.5,-0.5,-0.5, 0.5,1.4,0.5} | |
111 | }, | |
112 | groups = {choppy=2, oddly_breakable_by_hand=2}, | |
113 | sounds = default.node_sound_wood_defaults(), | |
114 | on_construct = function(pos) | |
115 | local meta = minetest.get_meta(pos) | |
116 | meta:set_string("formspec", armor_stand_formspec) | |
117 | meta:set_string("infotext", "Armor Stand") | |
118 | local inv = meta:get_inventory() | |
119 | for _, element in pairs(elements) do | |
120 | inv:set_size("armor_"..element, 1) | |
121 | end | |
122 | end, | |
123 | can_dig = function(pos, player) | |
124 | local meta = minetest.get_meta(pos) | |
125 | local inv = meta:get_inventory() | |
126 | for _, element in pairs(elements) do | |
127 | if not inv:is_empty("armor_"..element) then | |
128 | return false | |
129 | end | |
130 | end | |
131 | return true | |
132 | end, | |
133 | after_place_node = function(pos) | |
134 | minetest.add_entity(pos, "3d_armor_stand:armor_entity") | |
135 | end, | |
136 | allow_metadata_inventory_put = function(pos, listname, index, stack) | |
137 | local def = stack:get_definition() or {} | |
138 | local groups = def.groups or {} | |
139 | if groups[listname] then | |
140 | return 1 | |
141 | end | |
142 | return 0 | |
143 | end, | |
144 | allow_metadata_inventory_move = function(pos) | |
145 | return 0 | |
146 | end, | |
147 | on_metadata_inventory_put = function(pos) | |
148 | update_entity(pos) | |
149 | end, | |
150 | on_metadata_inventory_take = function(pos) | |
151 | update_entity(pos) | |
152 | end, | |
153 | after_destruct = function(pos) | |
154 | update_entity(pos) | |
155 | end, | |
156 | on_blast = function(pos) | |
157 | local object = get_stand_object(pos) | |
158 | if object then | |
159 | object:remove() | |
160 | end | |
161 | minetest.after(1, function(pos) | |
162 | update_entity(pos) | |
163 | end, pos) | |
164 | end, | |
165 | }) | |
166 | ||
167 | minetest.register_node("3d_armor_stand:locked_armor_stand", { | |
168 | description = "Locked Armor stand", | |
169 | drawtype = "mesh", | |
170 | mesh = "3d_armor_stand.obj", | |
171 | tiles = {"default_wood.png", "default_steel_block.png"}, | |
172 | paramtype = "light", | |
173 | paramtype2 = "facedir", | |
174 | walkable = false, | |
175 | selection_box = { | |
176 | type = "fixed", | |
177 | fixed = {-0.5,-0.5,-0.5, 0.5,1.4,0.5} | |
178 | }, | |
179 | groups = {choppy=2, oddly_breakable_by_hand=2}, | |
180 | sounds = default.node_sound_wood_defaults(), | |
181 | on_construct = function(pos) | |
182 | local meta = minetest.get_meta(pos) | |
183 | meta:set_string("formspec", armor_stand_formspec) | |
184 | meta:set_string("infotext", "Armor Stand") | |
185 | meta:set_string("owner", "") | |
186 | local inv = meta:get_inventory() | |
187 | for _, element in pairs(elements) do | |
188 | inv:set_size("armor_"..element, 1) | |
189 | end | |
190 | end, | |
191 | can_dig = function(pos, player) | |
192 | local meta = minetest.get_meta(pos) | |
193 | local inv = meta:get_inventory() | |
194 | for _, element in pairs(elements) do | |
195 | if not inv:is_empty("armor_"..element) then | |
196 | return false | |
197 | end | |
198 | end | |
199 | return true | |
200 | end, | |
201 | after_place_node = function(pos, placer) | |
202 | minetest.add_entity(pos, "3d_armor_stand:armor_entity") | |
203 | local meta = minetest.get_meta(pos) | |
204 | meta:set_string("owner", placer:get_player_name() or "") | |
205 | meta:set_string("infotext", "Armor Stand (owned by " .. | |
206 | meta:get_string("owner") .. ")") | |
207 | end, | |
208 | allow_metadata_inventory_put = function(pos, listname, index, stack, player) | |
209 | local meta = minetest.get_meta(pos) | |
210 | if not has_locked_armor_stand_privilege(meta, player) then | |
211 | return 0 | |
212 | end | |
213 | local def = stack:get_definition() or {} | |
214 | local groups = def.groups or {} | |
215 | if groups[listname] then | |
216 | return 1 | |
217 | end | |
218 | return 0 | |
219 | end, | |
220 | allow_metadata_inventory_take = function(pos, listname, index, stack, player) | |
221 | local meta = minetest.get_meta(pos) | |
222 | if not has_locked_armor_stand_privilege(meta, player) then | |
223 | return 0 | |
224 | end | |
225 | return stack:get_count() | |
226 | end, | |
227 | allow_metadata_inventory_move = function(pos) | |
228 | return 0 | |
229 | end, | |
230 | on_metadata_inventory_put = function(pos) | |
231 | update_entity(pos) | |
232 | end, | |
233 | on_metadata_inventory_take = function(pos) | |
234 | update_entity(pos) | |
235 | end, | |
236 | after_destruct = function(pos) | |
237 | update_entity(pos) | |
238 | end, | |
239 | on_blast = function(pos) | |
240 | local object = get_stand_object(pos) | |
241 | if object then | |
242 | object:remove() | |
243 | end | |
244 | minetest.after(1, function(pos) | |
245 | update_entity(pos) | |
246 | end, pos) | |
247 | end, | |
248 | }) | |
249 | ||
250 | minetest.register_entity("3d_armor_stand:armor_entity", { | |
251 | physical = true, | |
252 | visual = "mesh", | |
253 | mesh = "3d_armor_entity.obj", | |
254 | visual_size = {x=1, y=1}, | |
255 | collisionbox = {-0.1,-0.4,-0.1, 0.1,1.3,0.1}, | |
256 | textures = {"3d_armor_trans.png"}, | |
257 | pos = nil, | |
258 | timer = 0, | |
259 | on_activate = function(self) | |
260 | local pos = self.object:getpos() | |
261 | if pos then | |
262 | self.pos = vector.round(pos) | |
263 | update_entity(pos) | |
264 | end | |
265 | end, | |
266 | on_step = function(self, dtime) | |
267 | if not self.pos then | |
268 | return | |
269 | end | |
270 | self.timer = self.timer + dtime | |
271 | if self.timer > 1 then | |
272 | self.timer = 0 | |
273 | local pos = self.object:getpos() | |
274 | if pos then | |
275 | if vector.equals(vector.round(pos), self.pos) then | |
276 | return | |
277 | end | |
278 | end | |
279 | update_entity(self.pos) | |
280 | self.object:remove() | |
281 | end | |
282 | end, | |
283 | }) | |
284 | ||
285 | minetest.register_craft({ | |
286 | output = "3d_armor_stand:armor_stand", | |
287 | recipe = { | |
288 | {"", "default:fence_wood", ""}, | |
289 | {"", "default:fence_wood", ""}, | |
290 | {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, | |
291 | } | |
292 | }) | |
293 | ||
294 | minetest.register_craft({ | |
295 | output = "3d_armor_stand:locked_armor_stand", | |
296 | recipe = { | |
297 | {"3d_armor_stand:armor_stand", "default:steel_ingot"}, | |
298 | } | |
299 | }) | |
300 |
0 | # Blender v2.73 (sub 0) OBJ File: '3d_armor_entity_3.blend' | |
1 | # www.blender.org | |
2 | mtllib 3d_armor_entity.mtl | |
3 | o Player_Cube | |
4 | v 2.200000 9.763893 1.200000 | |
5 | v 2.200000 9.763893 -1.200000 | |
6 | v 2.200000 2.663871 1.200000 | |
7 | v 2.200000 2.663871 -1.200000 | |
8 | v -2.200000 9.763893 -1.200000 | |
9 | v -2.200000 9.763893 1.200000 | |
10 | v -2.200000 2.663871 -1.200000 | |
11 | v -2.200000 2.663871 1.200000 | |
12 | v 2.300000 13.863962 2.300000 | |
13 | v 2.300000 13.863962 -2.300000 | |
14 | v 2.300000 9.263885 2.300000 | |
15 | v 2.300000 9.263885 -2.300000 | |
16 | v -2.300000 13.863962 -2.300000 | |
17 | v -2.300000 13.863962 2.300000 | |
18 | v -2.300000 9.263885 -2.300000 | |
19 | v -2.300000 9.263885 2.300000 | |
20 | v -2.322686 2.473175 -1.300000 | |
21 | v -2.322686 2.473175 1.300000 | |
22 | v -4.713554 2.682348 1.300000 | |
23 | v -4.713554 2.682348 -1.300000 | |
24 | v -1.686446 9.745432 -1.300000 | |
25 | v -1.686446 9.745432 1.300000 | |
26 | v -4.077313 9.954605 1.300000 | |
27 | v -4.077313 9.954605 -1.300000 | |
28 | v 4.077313 9.954605 -1.300000 | |
29 | v 4.077313 9.954605 1.300000 | |
30 | v 1.686446 9.745432 1.300000 | |
31 | v 1.686446 9.745432 -1.300000 | |
32 | v 4.713554 2.682348 -1.300000 | |
33 | v 4.713554 2.682348 1.300000 | |
34 | v 2.322686 2.473175 1.300000 | |
35 | v 2.322686 2.473175 -1.300000 | |
36 | v 0.139099 2.938947 -1.200000 | |
37 | v 0.139099 2.938947 1.200000 | |
38 | v 0.261266 -4.059988 1.200000 | |
39 | v 0.261266 -4.059988 -1.200000 | |
40 | v 2.660901 -4.018101 1.190000 | |
41 | v 2.660901 -4.018101 -1.210000 | |
42 | v 2.538733 2.980834 1.190000 | |
43 | v 2.538733 2.980834 -1.210000 | |
44 | v -0.139099 2.938947 -1.200000 | |
45 | v -0.139099 2.938947 1.200000 | |
46 | v -0.261266 -4.059988 1.200000 | |
47 | v -0.261266 -4.059988 -1.200000 | |
48 | v -2.538734 2.980834 -1.210000 | |
49 | v -2.538734 2.980834 1.190000 | |
50 | v -2.660901 -4.018101 -1.210000 | |
51 | v -2.660901 -4.018101 1.190000 | |
52 | v -2.799999 -4.387500 1.390000 | |
53 | v -2.799999 -4.387500 -1.410000 | |
54 | v -2.800000 -0.812499 1.390000 | |
55 | v -2.800000 -0.812499 -1.410000 | |
56 | v -0.000000 -4.387500 -1.400000 | |
57 | v -0.000000 -4.387500 1.400000 | |
58 | v -0.000000 -0.812499 1.400000 | |
59 | v -0.000000 -0.812499 -1.400000 | |
60 | v 2.800000 -0.812499 -1.410000 | |
61 | v 2.800000 -0.812499 1.390000 | |
62 | v 2.799999 -4.387500 -1.410000 | |
63 | v 2.799999 -4.387500 1.390000 | |
64 | v 0.000000 -4.387500 -1.400000 | |
65 | v 0.000000 -4.387500 1.400000 | |
66 | v 0.000000 -0.812499 1.400000 | |
67 | v 0.000000 -0.812499 -1.400000 | |
68 | v 2.267006 13.830965 2.267006 | |
69 | v 2.267006 13.830965 -2.267006 | |
70 | v 2.267006 9.296881 2.267006 | |
71 | v 2.267006 9.296881 -2.267006 | |
72 | v -2.267006 13.830965 -2.267006 | |
73 | v -2.267006 13.830965 2.267006 | |
74 | v -2.267006 9.296881 -2.267006 | |
75 | v -2.267006 9.296881 2.267006 | |
76 | vt 0.250000 0.375000 | |
77 | vt 0.250000 0.000000 | |
78 | vt 0.312500 0.000000 | |
79 | vt 0.312500 0.375000 | |
80 | vt 0.437500 0.375000 | |
81 | vt 0.437500 0.500000 | |
82 | vt 0.312500 0.500000 | |
83 | vt 0.562500 0.375000 | |
84 | vt 0.562500 0.500000 | |
85 | vt 0.437500 0.000000 | |
86 | vt 0.500000 0.000000 | |
87 | vt 0.500000 0.375000 | |
88 | vt 0.625000 0.000000 | |
89 | vt 0.625000 0.375000 | |
90 | vt 0.500000 0.750000 | |
91 | vt 0.500000 0.500000 | |
92 | vt 0.625000 0.500000 | |
93 | vt 0.625000 0.750000 | |
94 | vt 0.750000 0.750000 | |
95 | vt 0.750000 1.000000 | |
96 | vt 0.625000 1.000000 | |
97 | vt 0.875000 0.750000 | |
98 | vt 0.875000 1.000000 | |
99 | vt 0.750000 0.500000 | |
100 | vt 0.875000 0.500000 | |
101 | vt 1.000000 0.750000 | |
102 | vt 1.000000 0.500000 | |
103 | vt 0.750000 0.375000 | |
104 | vt 0.812500 0.500000 | |
105 | vt 0.812500 0.375000 | |
106 | vt 0.687500 0.375000 | |
107 | vt 0.687500 0.500000 | |
108 | vt 0.687500 0.000000 | |
109 | vt 0.750000 0.000000 | |
110 | vt 0.812500 0.000000 | |
111 | vt 0.875000 0.375000 | |
112 | vt 0.875000 0.000000 | |
113 | vt 0.125000 0.375000 | |
114 | vt 0.062500 0.375000 | |
115 | vt 0.062500 0.500000 | |
116 | vt 0.125000 0.500000 | |
117 | vt 0.187500 0.375000 | |
118 | vt 0.187500 0.500000 | |
119 | vt 0.000000 0.375000 | |
120 | vt 0.000000 0.000000 | |
121 | vt 0.062500 0.000000 | |
122 | vt 0.187500 0.000000 | |
123 | vt 0.125000 0.000000 | |
124 | vt 0.437500 0.875000 | |
125 | vt 0.437500 1.000000 | |
126 | vt 0.375000 1.000000 | |
127 | vt 0.375000 0.875000 | |
128 | vt 0.250000 0.875000 | |
129 | vt 0.312500 0.875000 | |
130 | vt 0.312500 0.656250 | |
131 | vt 0.250000 0.656250 | |
132 | vt 0.500000 0.875000 | |
133 | vt 0.437500 0.656250 | |
134 | vt 0.500000 0.656250 | |
135 | vt 0.375000 0.656250 | |
136 | vt 0.312500 1.000000 | |
137 | usemtl Armor | |
138 | s off | |
139 | f 1/1 3/2 4/3 2/4 | |
140 | f 5/5 6/6 1/7 2/4 | |
141 | f 8/6 7/5 4/8 3/9 | |
142 | f 5/5 2/4 4/3 7/10 | |
143 | f 7/10 8/11 6/12 5/5 | |
144 | f 8/11 3/13 1/14 6/12 | |
145 | f 9/15 11/16 12/17 10/18 | |
146 | f 13/19 14/20 9/21 10/18 | |
147 | f 12/22 11/23 16/20 15/19 | |
148 | f 13/19 10/18 12/17 15/24 | |
149 | f 14/22 13/19 15/24 16/25 | |
150 | f 9/26 14/22 16/25 11/27 | |
151 | f 17/28 18/24 19/29 20/30 | |
152 | f 24/31 23/32 22/24 21/28 | |
153 | f 23/31 24/14 20/13 19/33 | |
154 | f 24/31 21/28 17/34 20/33 | |
155 | f 21/28 22/30 18/35 17/34 | |
156 | f 22/30 23/36 19/37 18/35 | |
157 | f 27/30 31/35 30/37 26/36 | |
158 | f 28/28 32/34 31/35 27/30 | |
159 | f 25/31 29/33 32/34 28/28 | |
160 | f 26/31 30/33 29/13 25/14 | |
161 | f 25/31 28/28 27/24 26/32 | |
162 | f 32/28 29/30 30/29 31/24 | |
163 | f 40/38 33/39 34/40 39/41 | |
164 | f 36/42 38/38 37/41 35/43 | |
165 | f 39/44 37/45 38/46 40/39 | |
166 | f 34/1 35/2 37/47 39/42 | |
167 | f 40/38 38/48 36/46 33/39 | |
168 | f 33/42 36/47 35/48 34/38 | |
169 | f 45/38 46/41 42/40 41/39 | |
170 | f 41/42 42/38 43/48 44/47 | |
171 | f 45/38 41/39 44/46 47/48 | |
172 | f 42/1 46/42 48/47 43/2 | |
173 | f 46/44 45/39 47/46 48/45 | |
174 | f 44/42 43/43 48/41 47/38 | |
175 | f 53/49 54/50 49/51 50/52 | |
176 | f 51/53 52/54 50/55 49/56 | |
177 | f 55/57 51/49 49/58 54/59 | |
178 | f 52/52 56/54 53/55 50/60 | |
179 | f 56/49 55/52 54/60 53/58 | |
180 | f 52/52 51/51 55/61 56/54 | |
181 | f 64/49 61/58 62/60 63/52 | |
182 | f 57/52 59/60 61/55 64/54 | |
183 | f 63/57 62/59 60/58 58/49 | |
184 | f 58/53 60/56 59/55 57/54 | |
185 | f 61/49 59/52 60/51 62/50 | |
186 | f 57/52 64/54 63/61 58/51 | |
187 | f 65/15 66/18 68/17 67/16 | |
188 | f 69/19 66/18 65/21 70/20 | |
189 | f 68/22 71/19 72/20 67/23 | |
190 | f 69/19 71/24 68/17 66/18 | |
191 | f 70/22 72/25 71/24 69/19 | |
192 | f 65/26 67/27 72/25 70/22 |
0 | # Blender v2.73 (sub 0) OBJ File: '3d_armor_stand.blend' | |
1 | # www.blender.org | |
2 | mtllib 3d_armor_stand.mtl | |
3 | o Player_Cube | |
4 | v 0.062500 1.312500 -0.062500 | |
5 | v 0.062500 1.312500 0.062500 | |
6 | v -0.062500 1.312500 -0.062500 | |
7 | v -0.062500 1.312500 0.062500 | |
8 | v -0.187500 -0.437504 0.062500 | |
9 | v -0.187500 -0.437504 -0.062500 | |
10 | v -0.187500 0.937500 0.062500 | |
11 | v -0.187500 0.937500 -0.062500 | |
12 | v -0.250000 0.250000 0.062500 | |
13 | v -0.250000 0.250000 -0.062500 | |
14 | v -0.250000 0.125003 0.062500 | |
15 | v -0.250000 0.125003 -0.062500 | |
16 | v 0.250000 0.250000 0.062500 | |
17 | v 0.250000 0.250000 -0.062500 | |
18 | v 0.250000 0.125003 0.062500 | |
19 | v 0.250000 0.125003 -0.062500 | |
20 | v -0.062500 -0.437504 -0.062500 | |
21 | v -0.062500 -0.437504 0.062500 | |
22 | v -0.062500 0.937500 0.062500 | |
23 | v -0.062500 0.937500 -0.062500 | |
24 | v 0.062500 0.250000 0.062500 | |
25 | v 0.062500 0.250000 -0.062500 | |
26 | v 0.187500 0.250000 -0.062500 | |
27 | v 0.187500 0.250000 0.062500 | |
28 | v 0.187500 0.937500 -0.062500 | |
29 | v 0.187500 0.937500 0.062500 | |
30 | v 0.187500 -0.437504 -0.062500 | |
31 | v 0.187500 -0.437504 0.062500 | |
32 | v 0.062500 -0.437504 -0.062500 | |
33 | v 0.062500 -0.437504 0.062500 | |
34 | v 0.062500 0.937500 0.062500 | |
35 | v 0.062500 0.937500 -0.062500 | |
36 | v -0.062500 0.812500 -0.062500 | |
37 | v -0.187500 0.812500 -0.062500 | |
38 | v -0.062500 0.812500 0.062500 | |
39 | v -0.187500 0.812500 0.062500 | |
40 | v 0.062500 0.812500 -0.062500 | |
41 | v 0.187500 0.812500 -0.062500 | |
42 | v 0.187500 0.812500 0.062500 | |
43 | v 0.062500 0.812500 0.062500 | |
44 | v 0.375000 0.812500 0.062500 | |
45 | v 0.375000 0.812500 -0.062500 | |
46 | v 0.375000 0.937500 0.062500 | |
47 | v 0.375000 0.937500 -0.062500 | |
48 | v 0.500000 -0.437500 -0.500000 | |
49 | v 0.500000 -0.437500 0.500000 | |
50 | v -0.500000 -0.437500 -0.500000 | |
51 | v -0.500000 -0.437500 0.500000 | |
52 | v -0.062500 0.250000 -0.062500 | |
53 | v -0.187500 0.250000 -0.062500 | |
54 | v -0.062500 0.250000 0.062500 | |
55 | v -0.187500 0.250000 0.062500 | |
56 | v -0.375000 0.937500 0.062500 | |
57 | v -0.375000 0.937500 -0.062500 | |
58 | v -0.375000 0.812500 -0.062500 | |
59 | v -0.375000 0.812500 0.062500 | |
60 | v 0.500000 -0.500000 -0.500000 | |
61 | v 0.500000 -0.500000 0.500000 | |
62 | v -0.500000 -0.500000 -0.500000 | |
63 | v -0.500000 -0.500000 0.500000 | |
64 | v 0.187500 0.124998 0.062500 | |
65 | v 0.187500 0.124998 -0.062500 | |
66 | v 0.062500 0.124998 0.062500 | |
67 | v 0.062500 0.124998 -0.062500 | |
68 | v -0.062500 0.124998 -0.062500 | |
69 | v -0.187500 0.124998 -0.062500 | |
70 | v -0.062500 0.124998 0.062500 | |
71 | v -0.187500 0.124998 0.062500 | |
72 | vt 0.000000 0.000000 | |
73 | vt 0.875000 0.000000 | |
74 | vt 0.875000 0.250000 | |
75 | vt 0.000000 0.250000 | |
76 | vt 0.125000 0.500000 | |
77 | vt 0.125000 0.750000 | |
78 | vt -0.000000 0.750000 | |
79 | vt -0.000000 0.500000 | |
80 | vt 0.750000 0.000000 | |
81 | vt 1.000000 0.000000 | |
82 | vt 1.000000 0.250000 | |
83 | vt 0.750000 0.250000 | |
84 | vt 0.375000 0.500000 | |
85 | vt 0.375000 0.750000 | |
86 | vt 0.875000 0.750000 | |
87 | vt 0.875000 1.000000 | |
88 | vt 0.000000 1.000000 | |
89 | vt 0.875000 0.500000 | |
90 | vt 0.750000 0.500000 | |
91 | vt 1.000000 0.500000 | |
92 | vt 1.000000 0.750000 | |
93 | vt 0.750000 0.750000 | |
94 | vt 0.625000 1.000000 | |
95 | vt 0.375000 1.000000 | |
96 | vt 0.625000 0.750000 | |
97 | vt 0.625000 0.500000 | |
98 | vt 0.250000 0.500000 | |
99 | vt 0.250000 0.750000 | |
100 | vt 0.625000 0.250000 | |
101 | vt 0.625000 -0.000000 | |
102 | vt 0.250000 0.250000 | |
103 | vt 0.250000 0.000000 | |
104 | vt 0.375000 0.250000 | |
105 | vt 0.250000 1.000000 | |
106 | vt 1.000000 1.000000 | |
107 | vt 0.750000 1.000000 | |
108 | vt 0.375000 -0.000000 | |
109 | vt 0.125000 0.250000 | |
110 | vt 0.125000 1.000000 | |
111 | vt 0.125000 0.000000 | |
112 | vt -0.000000 0.937500 | |
113 | vt 1.000000 0.937500 | |
114 | vt 0.937500 0.000000 | |
115 | vt 0.937500 1.000000 | |
116 | vt 1.000000 0.062500 | |
117 | vt 0.000000 0.062500 | |
118 | vt 0.062500 0.000000 | |
119 | vt 0.062500 1.000000 | |
120 | g Player_Cube_Stand | |
121 | usemtl Stand | |
122 | s off | |
123 | f 64/1 29/2 30/3 63/4 | |
124 | f 52/5 50/6 10/7 9/8 | |
125 | f 17/9 18/10 5/11 6/12 | |
126 | f 68/3 66/2 6/1 5/4 | |
127 | f 7/13 8/14 54/7 53/8 | |
128 | f 67/15 68/16 5/17 18/7 | |
129 | f 62/4 27/3 29/18 64/8 | |
130 | f 66/3 65/18 17/8 6/4 | |
131 | f 9/19 10/20 12/21 11/22 | |
132 | f 63/7 30/15 28/16 61/17 | |
133 | f 65/18 67/15 18/7 17/8 | |
134 | f 61/8 28/18 27/15 62/7 | |
135 | f 19/23 7/24 36/14 35/25 | |
136 | f 8/14 7/13 19/26 20/25 | |
137 | f 23/15 24/18 13/20 14/21 | |
138 | f 13/8 15/27 16/28 14/7 | |
139 | f 39/29 38/30 42/10 41/11 | |
140 | f 29/31 27/4 28/1 30/32 | |
141 | f 25/28 26/27 43/26 44/25 | |
142 | f 38/12 25/19 44/13 42/33 | |
143 | f 25/28 32/7 31/8 26/27 | |
144 | f 8/26 20/13 33/33 34/29 | |
145 | f 25/19 38/12 37/11 32/20 | |
146 | f 31/17 40/7 39/28 26/34 | |
147 | f 26/34 39/28 41/25 43/23 | |
148 | f 43/7 41/28 42/34 44/17 | |
149 | f 53/22 54/21 55/35 56/36 | |
150 | f 36/14 7/24 53/17 56/7 | |
151 | f 8/26 34/29 55/11 54/20 | |
152 | f 34/37 36/33 56/4 55/1 | |
153 | f 51/13 21/26 22/25 49/14 | |
154 | f 20/4 3/12 1/19 32/8 | |
155 | f 40/15 31/16 19/23 35/25 | |
156 | f 35/29 33/30 37/2 40/3 | |
157 | f 33/33 20/13 32/5 37/38 | |
158 | f 3/14 4/24 2/23 1/25 | |
159 | f 19/12 4/4 3/1 20/9 | |
160 | f 31/36 2/17 4/7 19/22 | |
161 | f 32/22 1/7 2/8 31/19 | |
162 | f 23/5 62/38 64/33 22/13 | |
163 | f 21/14 63/24 61/39 24/6 | |
164 | f 61/3 62/2 16/10 15/11 | |
165 | f 62/38 23/5 14/8 16/4 | |
166 | f 24/6 61/39 15/17 13/7 | |
167 | f 50/18 66/3 12/11 10/20 | |
168 | f 66/40 68/38 11/4 12/1 | |
169 | f 50/18 49/26 65/29 66/3 | |
170 | f 51/25 52/15 68/16 67/23 | |
171 | f 68/16 52/15 9/21 11/35 | |
172 | f 49/26 22/13 64/33 65/29 | |
173 | f 51/25 67/23 63/24 21/14 | |
174 | f 67/33 65/37 64/30 63/29 | |
175 | f 37/1 22/2 21/3 40/4 | |
176 | f 38/4 23/3 22/18 37/8 | |
177 | f 40/7 21/15 24/16 39/17 | |
178 | f 39/8 24/18 23/15 38/7 | |
179 | f 36/2 34/3 50/4 52/1 | |
180 | f 35/15 36/16 52/17 51/7 | |
181 | f 34/3 33/18 49/8 50/4 | |
182 | f 33/18 35/15 51/7 49/8 | |
183 | g Player_Cube_Base | |
184 | usemtl Base | |
185 | f 47/17 48/1 46/10 45/35 | |
186 | f 59/1 57/10 58/35 60/17 | |
187 | f 48/17 60/41 58/42 46/35 | |
188 | f 46/43 58/10 57/35 45/44 | |
189 | f 47/1 45/10 57/45 59/46 | |
190 | f 48/47 47/48 59/17 60/1 |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 | 3D Armor - Visible Player Armor | |
1 | =============================== | |
2 | ||
3 | Default Item Textures (C) Cisoun - WTFPL | |
4 | ||
5 | Armor Textures: Copyright (C) 2013 Ryan Jones - CC-BY-SA | |
6 | ||
7 | Source Code: Copyright (C) 2013 Stuart Jones - LGPL | |
8 | ||
9 | Special credit to Jordach and MirceaKitsune for providing the default 3d character model. | |
10 |
0 | Modpack - 3d Armor [0.4.5] | |
1 | ========================== | |
2 | ||
3 | ### Table of Contents | |
4 | <!-- START doctoc generated TOC please keep comment here to allow auto update --> | |
5 | <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | |
6 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> | |
7 | ||
8 | - [[mod] Visible Player Armor [3d_armor]](#mod-visible-player-armor-3d_armor) | |
9 | - [[mod] Visible Wielded Items [wieldview]](#mod-visible-wielded-items-wieldview) | |
10 | - [[mod] Shields [shields]](#mod-shields-shields) | |
11 | - [[mod] Technic Armor [technic_armor]](#mod-technic-armor-technic_armor) | |
12 | - [[mod] Hazmat Suit [hazmat_suit]](#mod-hazmat-suit-hazmat_suit) | |
13 | - [[mod] 3d Armor Stand [3d_armor_stand]](#mod-3d-armor-stand-3d_armor_stand) | |
14 | ||
15 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> | |
16 | ||
17 | ||
18 | [mod] Visible Player Armor [3d_armor] | |
19 | ------------------------------------- | |
20 | ||
21 | Minetest Version: 0.4.13 | |
22 | ||
23 | Game: minetest_game and many derivatives | |
24 | ||
25 | Depends: default | |
26 | ||
27 | Recommends: inventory_plus or unified_inventory (use only one) | |
28 | ||
29 | Adds craftable armor that is visible to other players. Each armor item worn contributes to | |
30 | a player's armor group level making them less vulnerable to attack. | |
31 | ||
32 | Armor takes damage when a player is hurt, however, many armor items offer a 'stackable' | |
33 | percentage chance of restoring the lost health points. Overall armor level is boosted by 10% | |
34 | when wearing a full matching set (helmet, chestplate, leggings and boots of the same material) | |
35 | ||
36 | Fire protection has been added by TenPlus1 and in use when ethereal mod is found and crystal | |
37 | armor has been enabled. each piece of armor offers 1 fire protection, level 1 protects | |
38 | against torches, level 2 against crystal spikes, 3 for fire and 5 protects when in lava. | |
39 | ||
40 | Compatible with player skins [skins] by Zeg9 and Player Textures [player_textures] by PilzAdam | |
41 | and [simple_skins] by TenPlus1. | |
42 | ||
43 | Armor can be configured by adding a file called armor.conf in 3d_armor mod or world directory. | |
44 | see armor.conf.example for all available options. | |
45 | ||
46 | [mod] Visible Wielded Items [wieldview] | |
47 | --------------------------------------- | |
48 | ||
49 | Depends: 3d_armor | |
50 | ||
51 | Makes hand wielded items visible to other players. | |
52 | ||
53 | [mod] Shields [shields] | |
54 | ----------------------- | |
55 | ||
56 | Depends: 3d_armor | |
57 | ||
58 | Originally a part of 3d_armor, shields have been re-included as an optional extra. | |
59 | If you do not want shields then simply remove the shields folder from the modpack. | |
60 | ||
61 | [mod] Technic Armor [technic_armor] | |
62 | ----------------------------------- | |
63 | ||
64 | Depends: 3d_armor, technic_worldgen | |
65 | ||
66 | Adds tin, silver and technic materials to 3d_armor. | |
67 | Requires technic (technic_worldgen at least) mod. | |
68 | ||
69 | [mod] Hazmat Suit [hazmat_suit] | |
70 | ------------------------------- | |
71 | ||
72 | Depends: 3d_armor, technic | |
73 | ||
74 | Adds hazmat suit to 3d_armor. It protects rather well from fire (if enabled in configuration) and radiation, and it has built-in oxygen supply. | |
75 | Requires technic mod. | |
76 | ||
77 | [mod] 3d Armor Stand [3d_armor_stand] | |
78 | ------------------------------------- | |
79 | ||
80 | Depends: 3d_armor | |
81 | ||
82 | Adds a chest-like armor stand for armor storage and display. |
0 | Visible player armor & wielded items. |
0 | [mod] Hazmat Suit [hazmat_suit] | |
1 | =================================== | |
2 | ||
3 | Adds hazmat suit to 3d_armor. It protects rather well from fire (if enabled in configuration) and radiation, and it has built-in oxygen supply. | |
4 | Requires technic mod. | |
5 | ||
6 | Depends: 3d_armor, technic | |
7 | ||
8 | Source code by numZero | |
9 | Textures by HybridDog and numZero |
0 | Adds hazmat suit (protects from water, fire and radiation) to 3d_armor. |
0 | local part_count = 4 | |
1 | ||
2 | local level = 35 | |
3 | local heal = 20 | |
4 | local use = 1000 | |
5 | local fire = 4 | |
6 | local water = 1 | |
7 | local radiation = 50 | |
8 | ||
9 | if minetest.get_modpath("shields") then | |
10 | level = level / 0.9 | |
11 | end | |
12 | ||
13 | if part_count == #armor.elements then | |
14 | level = level / 1.1 | |
15 | end | |
16 | ||
17 | level = math.floor(level / part_count) | |
18 | heal = math.floor(heal / part_count) | |
19 | fire = math.floor(fire / part_count) | |
20 | radiation = math.floor(radiation / part_count) | |
21 | ||
22 | minetest.register_craftitem("hazmat_suit:helmet_hazmat", { | |
23 | description = "Hazmat Helmet", | |
24 | inventory_image = "hazmat_suit_inv_helmet_hazmat.png", | |
25 | stack_max = 1, | |
26 | }) | |
27 | ||
28 | minetest.register_craftitem("hazmat_suit:chestplate_hazmat", { | |
29 | description = "Hazmat Chestplate", | |
30 | inventory_image = "hazmat_suit_inv_chestplate_hazmat.png", | |
31 | stack_max = 1, | |
32 | }) | |
33 | ||
34 | minetest.register_craftitem("hazmat_suit:sleeve_hazmat", { | |
35 | description = "Hazmat Sleeve", | |
36 | inventory_image = "hazmat_suit_inv_sleeve_hazmat.png", | |
37 | stack_max = 1, | |
38 | }) | |
39 | ||
40 | minetest.register_craftitem("hazmat_suit:leggings_hazmat", { | |
41 | description = "Hazmat Leggins", | |
42 | inventory_image = "hazmat_suit_inv_leggings_hazmat.png", | |
43 | stack_max = 1, | |
44 | }) | |
45 | ||
46 | minetest.register_craftitem("hazmat_suit:boots_hazmat", { | |
47 | description = "Hazmat Boots", | |
48 | inventory_image = "hazmat_suit_inv_boots_hazmat.png", | |
49 | stack_max = 1, | |
50 | }) | |
51 | ||
52 | minetest.register_tool("hazmat_suit:suit_hazmat", { | |
53 | description = "Hazmat Suit", | |
54 | inventory_image = "hazmat_suit_inv_suit_hazmat.png", | |
55 | groups = { | |
56 | armor_head = level, | |
57 | armor_torso = level, | |
58 | armor_legs = level, | |
59 | armor_feet = level, | |
60 | armor_heal = heal, | |
61 | armor_use = use, | |
62 | armor_fire = fire, | |
63 | armor_water = water, | |
64 | armor_radiation = radiation, | |
65 | }, | |
66 | wear = 0, | |
67 | }) | |
68 | ||
69 | minetest.register_craft({ | |
70 | output = "hazmat_suit:helmet_hazmat", | |
71 | recipe = { | |
72 | {"", "technic:stainless_steel_ingot", ""}, | |
73 | {"technic:stainless_steel_ingot", "default:glass", "technic:stainless_steel_ingot"}, | |
74 | {"technic:rubber", "technic:rubber", "technic:rubber"}, | |
75 | }, | |
76 | }) | |
77 | ||
78 | minetest.register_craft({ | |
79 | output = "hazmat_suit:chestplate_hazmat", | |
80 | recipe = { | |
81 | {"technic:lead_ingot", "dye:yellow", "technic:lead_ingot"}, | |
82 | {"technic:stainless_steel_ingot", "technic:lead_ingot", "technic:stainless_steel_ingot"}, | |
83 | {"technic:lead_ingot", "technic:stainless_steel_ingot", "technic:lead_ingot"}, | |
84 | }, | |
85 | }) | |
86 | ||
87 | minetest.register_craft({ | |
88 | output = "hazmat_suit:sleeve_hazmat", | |
89 | recipe = { | |
90 | {"technic:rubber", "dye:yellow"}, | |
91 | {"", "technic:stainless_steel_ingot"}, | |
92 | {"", "technic:rubber"}, | |
93 | }, | |
94 | }) | |
95 | ||
96 | minetest.register_craft({ | |
97 | output = "hazmat_suit:leggings_hazmat", | |
98 | recipe = { | |
99 | {"technic:rubber", "technic:lead_ingot", "technic:rubber"}, | |
100 | {"technic:stainless_steel_ingot", "technic:rubber", "technic:stainless_steel_ingot"}, | |
101 | {"technic:lead_ingot", "", "technic:lead_ingot"}, | |
102 | }, | |
103 | }) | |
104 | ||
105 | minetest.register_craft({ | |
106 | output = "hazmat_suit:boots_hazmat", | |
107 | recipe = { | |
108 | {"", "", ""}, | |
109 | {"technic:rubber", "", "technic:rubber"}, | |
110 | {"technic:stainless_steel_ingot", "", "technic:stainless_steel_ingot"}, | |
111 | }, | |
112 | }) | |
113 | ||
114 | minetest.register_craft({ | |
115 | output = "hazmat_suit:suit_hazmat", | |
116 | type = "shapeless", | |
117 | recipe = { | |
118 | "hazmat_suit:helmet_hazmat", | |
119 | "hazmat_suit:chestplate_hazmat", | |
120 | "hazmat_suit:leggings_hazmat", | |
121 | "hazmat_suit:boots_hazmat", | |
122 | "hazmat_suit:sleeve_hazmat", | |
123 | "hazmat_suit:sleeve_hazmat", | |
124 | }, | |
125 | }) |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 | Adds shields to 3d_armor | |
1 | ||
2 | Depends: 3d_armor | |
3 | ||
4 | Originally a part of 3d_armor, shields have been re-included as an optional extra. | |
5 | If you do not what shields then simply remove the shields folder from the modpack. |
0 | Shields -- Crafting Guide | |
1 | -------------------------- | |
2 | ||
3 | +---+---+---+ | |
4 | | X | X | X | | |
5 | +---+---+---+ | |
6 | | X | X | X | | |
7 | +---+---+---+ | |
8 | | | X | | | |
9 | +---+---+---+ | |
10 | ||
11 | [shields:shield_wood] X = [default:wood] | |
12 | [shields:shield_cactus] X = [default:cactus] | |
13 | [shields:shield_steel] X = [default:steel_ingot] | |
14 | [shields:shield_bronze] X = [default:bronze_ingot] | |
15 | [shields:shield_diamond] X = [default:diamond] | |
16 | [shields:shield_gold] X = [default:gold_ingot] | |
17 | [shields:shield_mithril] X = [moreores:mithril_ingot] | |
18 | [shields:shield_crystal] X = [ethereal:crystal_ingot] | |
19 | ||
20 | Enhanced Shields | |
21 | ---------------- | |
22 | ||
23 | +---+ | |
24 | | S | | |
25 | +---+ | |
26 | | X | | |
27 | +---+ | |
28 | | S | | |
29 | +---+ | |
30 | ||
31 | [shields:shield_enhanced_wood] X = [shields:shield_wood] | |
32 | [shields:shield_enhanced_cactus] X = [shields:shield_cactus] | |
33 | ||
34 | S = [default:steel_ingot] | |
35 |
0 | Adds visible shields to 3d armor. |
0 | local use_moreores = minetest.get_modpath("moreores") | |
1 | ||
2 | -- Regisiter Shields | |
3 | ||
4 | minetest.register_tool("shields:shield_admin", { | |
5 | description = "Admin Shield", | |
6 | inventory_image = "shields_inv_shield_admin.png", | |
7 | groups = {armor_shield=1000, armor_heal=100, armor_use=0, not_in_creative_inventory=1}, | |
8 | wear = 0, | |
9 | }) | |
10 | ||
11 | if ARMOR_MATERIALS.wood then | |
12 | minetest.register_tool("shields:shield_wood", { | |
13 | description = "Wooden Shield", | |
14 | inventory_image = "shields_inv_shield_wood.png", | |
15 | groups = {armor_shield=5, armor_heal=0, armor_use=2000}, | |
16 | wear = 0, | |
17 | }) | |
18 | minetest.register_tool("shields:shield_enhanced_wood", { | |
19 | description = "Enhanced Wood Shield", | |
20 | inventory_image = "shields_inv_shield_enhanced_wood.png", | |
21 | groups = {armor_shield=8, armor_heal=0, armor_use=1000}, | |
22 | wear = 0, | |
23 | }) | |
24 | minetest.register_craft({ | |
25 | output = "shields:shield_enhanced_wood", | |
26 | recipe = { | |
27 | {"default:steel_ingot"}, | |
28 | {"shields:shield_wood"}, | |
29 | {"default:steel_ingot"}, | |
30 | }, | |
31 | }) | |
32 | end | |
33 | ||
34 | if ARMOR_MATERIALS.cactus then | |
35 | minetest.register_tool("shields:shield_cactus", { | |
36 | description = "Cactus Shield", | |
37 | inventory_image = "shields_inv_shield_cactus.png", | |
38 | groups = {armor_shield=5, armor_heal=0, armor_use=2000}, | |
39 | wear = 0, | |
40 | }) | |
41 | minetest.register_tool("shields:shield_enhanced_cactus", { | |
42 | description = "Enhanced Cactus Shield", | |
43 | inventory_image = "shields_inv_shield_enhanced_cactus.png", | |
44 | groups = {armor_shield=8, armor_heal=0, armor_use=1000}, | |
45 | wear = 0, | |
46 | }) | |
47 | minetest.register_craft({ | |
48 | output = "shields:shield_enhanced_cactus", | |
49 | recipe = { | |
50 | {"default:steel_ingot"}, | |
51 | {"shields:shield_cactus"}, | |
52 | {"default:steel_ingot"}, | |
53 | }, | |
54 | }) | |
55 | end | |
56 | ||
57 | if ARMOR_MATERIALS.steel then | |
58 | minetest.register_tool("shields:shield_steel", { | |
59 | description = "Steel Shield", | |
60 | inventory_image = "shields_inv_shield_steel.png", | |
61 | groups = {armor_shield=10, armor_heal=0, armor_use=500}, | |
62 | wear = 0, | |
63 | }) | |
64 | end | |
65 | ||
66 | if ARMOR_MATERIALS.bronze then | |
67 | minetest.register_tool("shields:shield_bronze", { | |
68 | description = "Bronze Shield", | |
69 | inventory_image = "shields_inv_shield_bronze.png", | |
70 | groups = {armor_shield=10, armor_heal=6, armor_use=250}, | |
71 | wear = 0, | |
72 | }) | |
73 | end | |
74 | ||
75 | if ARMOR_MATERIALS.diamond then | |
76 | minetest.register_tool("shields:shield_diamond", { | |
77 | description = "Diamond Shield", | |
78 | inventory_image = "shields_inv_shield_diamond.png", | |
79 | groups = {armor_shield=15, armor_heal=12, armor_use=100}, | |
80 | wear = 0, | |
81 | }) | |
82 | end | |
83 | ||
84 | if ARMOR_MATERIALS.gold then | |
85 | minetest.register_tool("shields:shield_gold", { | |
86 | description = "Gold Shield", | |
87 | inventory_image = "shields_inv_shield_gold.png", | |
88 | groups = {armor_shield=10, armor_heal=6, armor_use=250}, | |
89 | wear = 0, | |
90 | }) | |
91 | end | |
92 | ||
93 | if ARMOR_MATERIALS.mithril then | |
94 | minetest.register_tool("shields:shield_mithril", { | |
95 | description = "Mithril Shield", | |
96 | inventory_image = "shields_inv_shield_mithril.png", | |
97 | groups = {armor_shield=15, armor_heal=12, armor_use=50}, | |
98 | wear = 0, | |
99 | }) | |
100 | end | |
101 | ||
102 | if ARMOR_MATERIALS.crystal then | |
103 | minetest.register_tool("shields:shield_crystal", { | |
104 | description = "Crystal Shield", | |
105 | inventory_image = "shields_inv_shield_crystal.png", | |
106 | groups = {armor_shield=15, armor_heal=12, armor_use=50, armor_fire=1}, | |
107 | wear = 0, | |
108 | }) | |
109 | end | |
110 | ||
111 | for k, v in pairs(ARMOR_MATERIALS) do | |
112 | minetest.register_craft({ | |
113 | output = "shields:shield_"..k, | |
114 | recipe = { | |
115 | {v, v, v}, | |
116 | {v, v, v}, | |
117 | {"", v, ""}, | |
118 | }, | |
119 | }) | |
120 | end | |
121 | ||
122 | minetest.after(0, function() | |
123 | table.insert(armor.elements, "shield") | |
124 | end) | |
125 |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 | [mod] Technic Armor [technic_armor] | |
1 | =================================== | |
2 | ||
3 | Adds tin, silver and technic materials to 3d_armor. | |
4 | Requires technic (technic_worldgen at least) mod. | |
5 | ||
6 | Depends: 3d_armor, technic_worldgen | |
7 | ||
8 | Source code and textures by poet.nohit and numzero |
0 | Adds tin, silver and technic materials to 3d_armor. |
0 | local stats = { | |
1 | lead = { name="Lead", material="technic:lead_ingot", armor=1.6, heal=0, use=500, radiation=80*1.1 }, | |
2 | brass = { name="Brass", material="technic:brass_ingot", armor=1.8, heal=0, use=650, radiation=43 }, | |
3 | cast = { name="Cast Iron", material="technic:cast_iron_ingot", armor=2.5, heal=8, use=200, radiation=40 }, | |
4 | carbon = { name="Carbon Steel", material="technic:carbon_steel_ingot", armor=2.7, heal=10, use=100, radiation=40 }, | |
5 | stainless = { name="Stainless Steel", material="technic:stainless_steel_ingot", armor=2.7, heal=10, use=75, radiation=40 }, | |
6 | } | |
7 | if minetest.get_modpath("moreores") then | |
8 | stats.tin = { name="Tin", material="moreores:tin_ingot", armor=1.6, heal=0, use=750, radiation=37 } | |
9 | stats.silver = { name="Silver", material="moreores:silver_ingot", armor=1.8, heal=6, use=650, radiation=53 } | |
10 | end | |
11 | ||
12 | local parts = { | |
13 | helmet = { place="head", name="Helmet", level=5, radlevel = 0.10, craft={{1,1,1},{1,0,1}} }, | |
14 | chestplate = { place="torso", name="Chestplate", level=8, radlevel = 0.35, craft={{1,0,1},{1,1,1},{1,1,1}} }, | |
15 | leggings = { place="legs", name="Leggings", level=7, radlevel = 0.15, craft={{1,1,1},{1,0,1},{1,0,1}} }, | |
16 | boots = { place="feet", name="Boots", level=4, radlevel = 0.10, craft={{1,0,1},{1,0,1}} }, | |
17 | } | |
18 | if minetest.get_modpath("shields") then | |
19 | parts.shield = { place="shield", name="Shield", level=5, radlevel=0.00, craft={{1,1,1},{1,1,1},{0,1,0}} } | |
20 | end | |
21 | ||
22 | -- Makes a craft recipe based on a template | |
23 | -- template is a recipe-like table but indices are used instead of actual item names: | |
24 | -- 0 means nothing, everything else is treated as an index in the materials table | |
25 | local function make_recipe(template, materials) | |
26 | local recipe = {} | |
27 | for j, trow in ipairs(template) do | |
28 | local rrow = {} | |
29 | for i, tcell in ipairs(trow) do | |
30 | if tcell == 0 then | |
31 | rrow[i] = "" | |
32 | else | |
33 | rrow[i] = materials[tcell] | |
34 | end | |
35 | end | |
36 | recipe[j] = rrow | |
37 | end | |
38 | return recipe | |
39 | end | |
40 | ||
41 | for key, armor in pairs(stats) do | |
42 | for partkey, part in pairs(parts) do | |
43 | local partname = "technic_armor:"..partkey.."_"..key | |
44 | minetest.register_tool(partname, { | |
45 | description = armor.name.." "..part.name, | |
46 | inventory_image = "technic_armor_inv_"..partkey.."_"..key..".png", | |
47 | groups = {["armor_"..part.place]=math.floor(part.level*armor.armor), armor_heal=armor.heal, armor_use=armor.use, armor_radiation=math.floor(part.radlevel*armor.radiation)}, | |
48 | wear = 0, | |
49 | }) | |
50 | minetest.register_craft({ | |
51 | output = partname, | |
52 | recipe = make_recipe(part.craft, {armor.material}), | |
53 | }) | |
54 | end | |
55 | end |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 | [mod] visible wielded items [wieldview] | |
1 | ======================================= | |
2 | ||
3 | depends: default, 3d_armor | |
4 | ||
5 | Makes hand wielded items visible to other players. | |
6 | ||
7 | default settings: [minetest.conf] | |
8 | ||
9 | # Set number of seconds between visible wielded item updates. | |
10 | wieldview_update_time = 2 | |
11 | ||
12 | # Show nodes as tiles, disabled by default | |
13 | wieldview_node_tiles = false | |
14 |
0 | Makes hand wielded items visible to other players. |
0 | local time = 0 | |
1 | local update_time = tonumber(minetest.setting_get("wieldview_update_time")) | |
2 | if not update_time then | |
3 | update_time = 2 | |
4 | minetest.setting_set("wieldview_update_time", tostring(update_time)) | |
5 | end | |
6 | local node_tiles = minetest.setting_getbool("wieldview_node_tiles") | |
7 | if not node_tiles then | |
8 | node_tiles = false | |
9 | minetest.setting_set("wieldview_node_tiles", "false") | |
10 | end | |
11 | ||
12 | wieldview = { | |
13 | wielded_item = {}, | |
14 | transform = {}, | |
15 | } | |
16 | ||
17 | dofile(minetest.get_modpath(minetest.get_current_modname()).."/transform.lua") | |
18 | ||
19 | wieldview.get_item_texture = function(self, item) | |
20 | local texture = "3d_armor_trans.png" | |
21 | if item ~= "" then | |
22 | if minetest.registered_items[item] then | |
23 | if minetest.registered_items[item].inventory_image ~= "" then | |
24 | texture = minetest.registered_items[item].inventory_image | |
25 | elseif node_tiles == true and minetest.registered_items[item].tiles | |
26 | and type(minetest.registered_items[item].tiles[1]) == "string" | |
27 | and minetest.registered_items[item].tiles[1] ~= "" then | |
28 | texture = minetest.inventorycube(minetest.registered_items[item].tiles[1]) | |
29 | end | |
30 | end | |
31 | if wieldview.transform[item] then | |
32 | texture = texture.."^[transform"..wieldview.transform[item] | |
33 | end | |
34 | end | |
35 | return texture | |
36 | end | |
37 | ||
38 | wieldview.update_wielded_item = function(self, player) | |
39 | if not player then | |
40 | return | |
41 | end | |
42 | local name = player:get_player_name() | |
43 | local stack = player:get_wielded_item() | |
44 | local item = stack:get_name() | |
45 | if not item then | |
46 | return | |
47 | end | |
48 | if self.wielded_item[name] then | |
49 | if self.wielded_item[name] == item then | |
50 | return | |
51 | end | |
52 | armor.textures[name].wielditem = self:get_item_texture(item) | |
53 | armor:update_player_visuals(player) | |
54 | end | |
55 | self.wielded_item[name] = item | |
56 | end | |
57 | ||
58 | minetest.register_on_joinplayer(function(player) | |
59 | local name = player:get_player_name() | |
60 | wieldview.wielded_item[name] = "" | |
61 | minetest.after(0, function(player) | |
62 | wieldview:update_wielded_item(player) | |
63 | end, player) | |
64 | end) | |
65 | ||
66 | minetest.register_globalstep(function(dtime) | |
67 | time = time + dtime | |
68 | if time > update_time then | |
69 | for _,player in ipairs(minetest.get_connected_players()) do | |
70 | wieldview:update_wielded_item(player) | |
71 | end | |
72 | time = 0 | |
73 | end | |
74 | end) | |
75 |
0 | -- Wielded Item Transformations - http://dev.minetest.net/texture | |
1 | ||
2 | wieldview.transform = { | |
3 | ["default:torch"]="R270", | |
4 | ["default:sapling"]="R270", | |
5 | ["flowers:dandelion_white"]="R270", | |
6 | ["flowers:dandelion_yellow"]="R270", | |
7 | ["flowers:geranium"]="R270", | |
8 | ["flowers:rose"]="R270", | |
9 | ["flowers:tulip"]="R270", | |
10 | ["flowers:viola"]="R270", | |
11 | ["bucket:bucket_empty"]="R270", | |
12 | ["bucket:bucket_water"]="R270", | |
13 | ["bucket:bucket_lava"]="R270", | |
14 | ["screwdriver:screwdriver"]="R270", | |
15 | ["screwdriver:screwdriver1"]="R270", | |
16 | ["screwdriver:screwdriver2"]="R270", | |
17 | ["screwdriver:screwdriver3"]="R270", | |
18 | ["screwdriver:screwdriver4"]="R270", | |
19 | ["vessels:glass_bottle"]="R270", | |
20 | ["vessels:drinking_glass"]="R270", | |
21 | ["vessels:steel_bottle"]="R270", | |
22 | } | |
23 |