Changeset 3210

Show
Ignore:
Timestamp:
01/13/10 21:20:57 (8 months ago)
Author:
ghoulsblade
Message:
fixed targetting multi-floor etc, for example when placing furniture
Location:
trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/lua/lib.2d.mousepick.lua

    r3025 r3210  
    8686                gMousePickFoundHit.hit_yloc = sprite.yloc or item.yloc 
    8787                gMousePickFoundHit.hit_zloc = sprite.zloc or item.zloc 
     88                gMousePickFoundHit.hit_artid = sprite.artid or item.artid 
    8889                --~ print("RayPickDynamics",GetStaticTileTypeName(sprite.data.artid))  
    8990        end 
     
    145146                end 
    146147                if (o.hittype == kMousePickHitType_Dynamic      ) then  
     148                        hitinfo = hitinfo..sprintf("packetid=0x%02x,",data.packetid or 0)  
     149                        hitinfo = hitinfo..sprintf("itemclass=0x%02x,",data.itemclass or 0)  
     150                        hitinfo = hitinfo..sprintf("amount2=0x%02x,",data.amount2 or 0)  
     151                        hitinfo = hitinfo..sprintf("artid_base=0x%04x,",data.artid_base or 0)  
    147152                        hitinfo = hitinfo..sprintf("amount=0x%02x,",data.amount or 0)  
    148153                end 
     
    150155                if (o.hittype == kMousePickHitType_Static                       ) then hitinfo = hitinfo.."static" end 
    151156                if (o.hittype == kMousePickHitType_Terrain                      ) then hitinfo = hitinfo.."terrain" end 
    152                 if (o.hittype == kMousePickHitType_Dynamic                      ) then hitinfo = hitinfo.."dynamic" end 
     157                if (o.hittype == kMousePickHitType_Dynamic                      ) then   
     158                        if (gTileTypeLoader) then 
     159                                local t = GetStaticTileType(data.artid) 
     160                                if (t and t.msName) then hitinfo = hitinfo..t.msName.."," end 
     161                                if (t and t.miFlags) then hitinfo = hitinfo.."tflag="..hex(t.miFlags).."," end 
     162                        end 
     163                        hitinfo = hitinfo.."oflag="..hex(data.flag or 0).."," 
     164                        hitinfo = hitinfo.."dynamic" 
     165                end 
    153166                if (o.hittype == kMousePickHitType_Mobile                       ) then hitinfo = hitinfo.."mobile" end 
    154167                if (o.hittype == kMousePickHitType_ContainerItem        ) then hitinfo = hitinfo.."containeritem" end 
  • trunk/lua/lib.cursor.lua

    r3024 r3210  
    171171    if (hitobject.hittype == kMousePickHitType_Dynamic) then 
    172172        bSendPos = false 
    173         Send_Target_Dynamic(hitobject.dynamic) 
     173                local item = hitobject.dynamic 
     174                if (item and ItemIsMulti(item)) then  
     175                        Send_Target_MultiPart(  hitobject.hit_xloc or item.xloc, 
     176                                                                        hitobject.hit_yloc or item.yloc, 
     177                                                                        hitobject.hit_zloc or item.zloc,item,hitobject.hit_artid) 
     178                else  
     179                        Send_Target_Dynamic(item) 
     180                end 
    174181    end 
    175182 
     
    184191        bSendPos = false  
    185192        local x,y,z = GetMouseHitTileCoords() 
    186         Send_Target_Static(hitobject.hit_xloc or x,hitobject.hit_yloc or y,hitobject.hit_zloc or z,hitobject.entity,hitobject.hit_artid) 
     193                Send_Target_Static(hitobject.hit_xloc or x,hitobject.hit_yloc or y,hitobject.hit_zloc or z,hitobject.entity,hitobject.hit_artid) 
    187194    end 
    188195     
  • trunk/lua/net/net.cursor.lua

    r3024 r3210  
    5353-- Send Targetcursor (0x6c) 
    5454function Send_Target (bIsPos,flag,serial,x,y,z,model) 
     55        print("Send_Target",bIsPos,hex(flag),hex(serial),x,y,z,hex(model)) 
    5556        --printf("NET: Send_Target: %d 0x%02x 0x%08x %d %d %d 0x%04x\n",bIsPos and 1 or 0,flag,serial,x or 0,y or 0,z or 0,model or 0) 
    5657        local out = GetSendFIFO() 
     
    106107        Send_Target_Item(dynamic) -- compatible fieldnames  
    107108end 
     109 
     110function Send_Target_MultiPart(x,y,z,item,hit_artid) 
     111        Send_Target(true,0,0,x or 0,y or 0,z or 0,hit_artid or item.artid or 0)  
     112end 
  • trunk/plugins/loot.lua

    r3206 r3210  
    201201        if (artid == 0xe9d) then return false end -- music instruments 
    202202        if (artid == 0xe9c) then return false end -- music instruments 
    203         --~ if (artid == 0x1bfb and item.amount >= 30) then return true end -- bolts 
    204         --~ if (artid == 0x0f3f and item.amount >= 30) then return true end -- arrows 
     203        if (artid == 0x1bfb and item.amount >= 30) then return true end -- bolts 
     204        if (artid == 0x0f3f and item.amount >= 30) then return true end -- arrows 
    205205        if (1 == 2) then -- jewels 
    206206                if (artid == 0xf21) then return true end -- star saphire