DEADSOFTWARE

Small refactoring of physics module
[cavecraft.git] / src / items_logic.mpsrc
index d4900720c14ff97e92740b4079910d991620deb5..efcee9fb5ecb4034a8e3c47b848166b25fd43625 100644 (file)
@@ -12,7 +12,7 @@ interface
  procedure updateBlock(x, y:integer);\r
 \r
 implementation\r
- uses invui, maps, drop, console, furnace, png3, func, jpeg, mob, vars, bmp, items, chest, inv, player, items_store, particles, worldgen, phy, sign;\r
+ uses invui, maps, drop, console, furnace, png3, func, jpeg, mobs, vars, bmp, items, chest, inv, player, items_store, particles, worldgen, phy, sign;\r
 \r
 procedure usebonemeal(block:integer);\r
  var\r
@@ -231,7 +231,7 @@ procedure destroy_block_cr(id, xx, yy:integer);
      setmap(0,xx,yy);\r
      destsign(getmapinfo(xx,yy));\r
     end; else\r
-   if id=106 then\r
+   if (id = 106) or (id = 125) then\r
     begin\r
      setmap(0,xx,yy);\r
      DestroyFurnace(xx, yy);\r
@@ -266,7 +266,7 @@ procedure destroy_block_cr(id, xx, yy:integer);
     begin\r
      if createsign(xx,yy)=-1 then set_block_code:=true;\r
     end; else\r
-    if it=106 then\r
+    if (it = 106) or (it = 125) then\r
      begin\r
       if CreateFurnace(xx, yy)=FURNACE_ERROR then\r
        set_block_code:=true;\r
@@ -338,7 +338,7 @@ procedure destroy_block_cr(id, xx, yy:integer);
     begin\r
      destsign(getmapinfo(xx,yy));\r
     end; else\r
-   if id=106 then\r
+   if (id = 106) or (id = 125) then\r
     begin\r
      DestroyFurnace(xx, yy);\r
     end; else\r
@@ -578,7 +578,7 @@ procedure destroy_block_cr(id, xx, yy:integer);
      destsign(getmapinfo(xx,yy));\r
      drop.create(104,1,xx*16+4,yy*16+4);\r
     end; else\r
-   if id=106 then\r
+   if (id = 106) or (id = 125) then\r
     begin\r
      setmap(0,xx,yy);\r
      DestroyFurnace(xx, yy);\r
@@ -680,7 +680,7 @@ procedure destroy_block_cr(id, xx, yy:integer);
    if block=104 then\r
     keymode:=5;*/\r
    else\r
-   if block=106 then\r
+   if (block = 106) or (block = 125) then\r
     OpenFurnaceWindow(info);\r
    else\r
    if block=107 then\r
@@ -853,7 +853,7 @@ procedure destroy_block_cr(id, xx, yy:integer);
     begin\r
      if getBlockColl(block)=0 then\r
       begin\r
-       mob.create(M_ZOMBY, x*16, y*16);\r
+       Mobs.Create(Mobs.zomby, x * 16, y * 16);\r
        decItem(invcur);\r
       end;\r
     end;\r
@@ -1253,8 +1253,9 @@ procedure updateBlock(x, y:integer);
   else\r
   if block=63 then\r
    begin\r
-    if (light>7) or (getMap(x, y+1)=0) then\r
-     setmap(0, x, y);\r
+    // В зимнем биоме снег не растапливается при сильном свете\r
+    if ((light > 7) and (getBiomMap(x) <> 2)) or (getMap(x, y + 1) = 0) then\r
+      setmap(0, x, y);\r
    end;\r
   else\r
   if block=74 then\r
@@ -1348,6 +1349,14 @@ procedure updateBlock(x, y:integer);
      create_particle(4, x*16+4, y*16+4);\r
    end;\r
   else\r
+  if (block = 106) or (block = 125) then\r
+   begin\r
+    if furnaceBurn(getMapInfo(x, y)) then\r
+      setmap(125, x, y);\r
+    else\r
+      setmap(106, x, y);\r
+   end;\r
+  else\r
   if block=110 then\r
    begin\r
     if (getmap(x-1, y)=0) or (getmap(x+1, y)=0) or (getmap(x, y-1)=0) or (getmap(x, y+1)=0) then\r
@@ -1356,9 +1365,9 @@ procedure updateBlock(x, y:integer);
   else\r
   if block=30 then\r
    begin\r
-    if (random(GENWOOD_RND)=random(GENWOOD_RND)) and (getMap(x, y+2)<>30) then\r
-     setMap(30, x, y-1);\r
-    if (getMap(x, y+1)<>7) or (getMap(x, y+1)<>30) then\r
+    if (random(GENWOOD_RND) = random(GENWOOD_RND)) and (getMap(x, y + 2) <> 30) then\r
+     setMap(30, x, y - 1);\r
+    if (getMap(x, y + 1) <> 7) and (getMap(x, y + 1) <> 30) then\r
      begin\r
       setMap(0, x, y);\r
       destroy_block_1(block, x, y);\r