Auto generate dot file with base item combinations
This commit is contained in:
@@ -7,7 +7,7 @@ module Dodge.Combine
|
||||
, toggleCombineInv
|
||||
, enterCombineInv
|
||||
) where
|
||||
import Dodge.Combine.Combinations
|
||||
import Dodge.Combine.Trie
|
||||
import Dodge.Base.You
|
||||
import Dodge.Data
|
||||
import Dodge.Item.Amount
|
||||
@@ -27,13 +27,7 @@ import qualified Data.IntMap.Strict as IM
|
||||
import qualified Data.Map.Strict as M
|
||||
--import Data.Map.Merge.Strict
|
||||
import Data.Maybe
|
||||
import Data.List (scanl',sortOn,sort)
|
||||
|
||||
combinationsTrie :: Trie (IcAmount,ItemBaseType) Item
|
||||
combinationsTrie = foldr
|
||||
(uncurry insertInTrie . first sort)
|
||||
emptyTrie
|
||||
itemCombinations
|
||||
import Data.List (scanl',sortOn)
|
||||
|
||||
invertInventory :: IM.IntMap Item -> [(ItemBaseType,IcAmount,Int)]
|
||||
invertInventory = IM.foldrWithKey
|
||||
|
||||
@@ -32,9 +32,9 @@ itemCombinations =
|
||||
-- , po [BANGCONE,PUMP,HARDWARE] $ grenadeLauncher 1
|
||||
-- , po [GRENADELAUNCHER 1,MOTOR,DRUM] $ grenadeLauncher 2
|
||||
|
||||
, p [p 2 $ cr PIPE,o $ cr HARDWARE] bangCane
|
||||
, p [p 2 $ cr PIPE,o BANGCANE] (bangCaneX 2)
|
||||
, po [BANGCANE,cr TIN] rifle
|
||||
, p [p 2 $ cr PIPE,o $ cr HARDWARE] (bangCaneX 1)
|
||||
, p [p 2 $ cr PIPE,o $ BANGCANEX 1] (bangCaneX 2)
|
||||
, po [BANGCANEX 1,cr TIN] rifle
|
||||
, po [RIFLE,cr PLANK] repeater
|
||||
, po [REPEATER,cr SPRING,cr HARDWARE] autoRifle
|
||||
, po [REPEATER,cr SPRING,cr CAN] burstRifle
|
||||
@@ -91,7 +91,7 @@ itemCombinations =
|
||||
++ map (\i -> po [cr PIPE,BANGSTICK i] $ bangStick (i+1)) [1..8]
|
||||
++ map (\i -> po [REVOLVERX i,cr CAN] $ revolverX (i+1)) [1..5]
|
||||
++ map (\i -> p [o (BANGCANEX i),p 2 $ cr PIPE] $ bangCaneX (i+1)) [1..5]
|
||||
++ map (\i -> po [MINIGUNX i,BANGCANE] $ miniGunX (i+1)) [3..15]
|
||||
++ map (\i -> po [MINIGUNX i,BANGCANEX 1] $ miniGunX (i+1)) [3..15]
|
||||
|
||||
++ [ po (_iyBase (_itType it):mtype) $ it & itType . iyModules . ix modtype .~ m
|
||||
| (modtype,is,ms) <- moduleCombinations
|
||||
|
||||
@@ -48,7 +48,7 @@ pictureWeaponOnAimItem p' cr posInInv
|
||||
= handD holsteredOneHandWep
|
||||
| isSelected
|
||||
= handD holsteredWep
|
||||
| otherwise = emptyBlank
|
||||
| otherwise = mempty
|
||||
where
|
||||
shoulderD = translateSPz 18
|
||||
handD = translateSPz 15
|
||||
|
||||
@@ -76,8 +76,8 @@ bangCane = defaultBulletWeapon
|
||||
& itConsumption . laMax .~ 1
|
||||
& itConsumption . laCycle .~ [loadPartialInsert 10 1]
|
||||
bangCaneX :: Int -> Item
|
||||
bangCaneX i = bangCane
|
||||
{ _itUse = ruseAmmoParamsRate 6 upHammer
|
||||
bangCaneX i = defaultBulletWeapon
|
||||
& itUse .~ ruseAmmoParamsRate 6 upHammer
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, withSoundItemChoiceStart caneStickSoundChoice
|
||||
@@ -88,7 +88,7 @@ bangCaneX i = bangCane
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
]
|
||||
, _itDimension = ItemDimension
|
||||
& itDimension .~ ItemDimension
|
||||
{ _dimRad = 8
|
||||
, _dimCenter = V3 5 0 0
|
||||
, _dimPortage = HeldItem
|
||||
@@ -101,11 +101,22 @@ bangCaneX i = bangCane
|
||||
. (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5))) [0..i-1]
|
||||
) <> caneClipX i it
|
||||
}
|
||||
} & itUse . useAim . aimWeight .~ 6
|
||||
& itUse . useAim . aimRange .~ 1
|
||||
& itUse . useAim . aimStance .~ TwoHandFlat
|
||||
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
||||
& itUse . useAim . aimWeight .~ 6
|
||||
& itUse . useAim . aimRange .~ 1
|
||||
& itUse . useAim . aimStance .~ TwoHandFlat
|
||||
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
||||
& itConsumption . laMax .~ i
|
||||
& itParams .~ BulletShooter
|
||||
{ _muzVel = 0.8
|
||||
, _rifling = 0.9
|
||||
, _bore = 2
|
||||
, _gunBarrels = SingleBarrel
|
||||
{ _brlInaccuracy = 0.01
|
||||
}
|
||||
, _recoil = 50
|
||||
, _torqueAfter = 0.1
|
||||
, _randomOffset = 0
|
||||
}
|
||||
& itParams . gunBarrels .~ MultiBarrel
|
||||
{_brlSpread = AlignedBarrels
|
||||
,_brlNum = i
|
||||
|
||||
@@ -239,7 +239,7 @@ throwRemoteBomb cr w = setLocation
|
||||
| otherwise = v'
|
||||
j = crSel cr
|
||||
-- resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTE"
|
||||
removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> emptyBlank
|
||||
removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> mempty
|
||||
resetFire = set (creatures . ix cid . crInv . ix j . itUse . rUse)
|
||||
$ \_ -> explodeRemoteBomb itid i
|
||||
p' = _crPos cr +.+ rotateV (_crDir cr) (V2 (_crRad cr) 0)
|
||||
|
||||
@@ -10,6 +10,7 @@ import Dodge.Initialisation
|
||||
--import Dodge.LevelGen.Data
|
||||
import Dodge.Tree
|
||||
import Geometry.ConvexPoly
|
||||
import Dodge.Combine.Graph
|
||||
--import Dodge.LevelGen.LevelStructure
|
||||
|
||||
import Data.Foldable
|
||||
@@ -18,6 +19,7 @@ import System.Random
|
||||
import Control.Lens
|
||||
import Control.Monad.State
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import qualified Data.Text.IO as TIO
|
||||
|
||||
generateWorldFromSeed :: Int -> IO World
|
||||
generateWorldFromSeed i = do
|
||||
@@ -25,6 +27,7 @@ generateWorldFromSeed i = do
|
||||
writeFile "log/attemptedSeeds" ""
|
||||
writeFile "log/treeCluster" ""
|
||||
writeFile "log/aGeneratedRoomLayout" ""
|
||||
TIO.writeFile "log/itemCombinations.gv" combinationsDotGraph
|
||||
(roomList,bounds) <- layoutLevelFromSeed 0 i
|
||||
return $ saveLevelStartSlot
|
||||
$ postGenerationProcessing
|
||||
|
||||
+18
-10
@@ -1,15 +1,15 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
module ShapePicture
|
||||
( emptyBlank
|
||||
, translateSP
|
||||
( --emptyBlank
|
||||
translateSP
|
||||
, translateSPf
|
||||
, translateSPz
|
||||
, rotateSP
|
||||
, SPic
|
||||
, noPic
|
||||
, noShape
|
||||
, _spShape
|
||||
, _spPicture
|
||||
-- , _spShape
|
||||
-- , _spPicture
|
||||
, mirrorSPyz
|
||||
, mirrorSPxz
|
||||
) where
|
||||
@@ -25,37 +25,45 @@ type SPic = (Shape, Picture)
|
||||
|
||||
-- should all this be inlined/inlinable?
|
||||
noPic :: Shape -> SPic
|
||||
{-# INLINE noPic #-}
|
||||
noPic = (,mempty)
|
||||
|
||||
noShape :: Picture -> SPic
|
||||
{-# INLINE noShape #-}
|
||||
noShape = (mempty,)
|
||||
|
||||
_spShape :: SPic -> Shape
|
||||
_spShape = fst
|
||||
_spPicture :: SPic -> Picture
|
||||
_spPicture = snd
|
||||
--_spShape :: SPic -> Shape
|
||||
--_spShape = fst
|
||||
--_spPicture :: SPic -> Picture
|
||||
--_spPicture = snd
|
||||
|
||||
emptyBlank :: SPic
|
||||
emptyBlank = mempty
|
||||
--emptyBlank :: SPic
|
||||
--emptyBlank = mempty
|
||||
|
||||
translateSPf :: Float -> Float -> SPic -> SPic
|
||||
{-# INLINE translateSPf #-}
|
||||
translateSPf x y = bimap (translateSH (V3 x y 0)) (translate x y)
|
||||
|
||||
translateSPz :: Float -> SPic -> SPic
|
||||
{-# INLINE translateSPz #-}
|
||||
translateSPz z = bimap (translateSH (V3 0 0 z)) (translate3 (V3 0 0 z))
|
||||
|
||||
translateSP :: Point3 -> SPic -> SPic
|
||||
{-# INLINE translateSP #-}
|
||||
translateSP v = bimap (translateSH v) (translate3 v)
|
||||
|
||||
rotateSP :: Float -> SPic -> SPic
|
||||
{-# INLINE rotateSP #-}
|
||||
rotateSP a = bimap (rotateSH a) (rotate a)
|
||||
|
||||
mirrorSPxz :: SPic -> SPic
|
||||
{-# INLINE mirrorSPxz #-}
|
||||
mirrorSPxz = bimap (S.map (over shVs reverse) . overPosSH flipy) mirrorxz
|
||||
where
|
||||
flipy (V3 x y z) = V3 x (negate y) z
|
||||
|
||||
mirrorSPyz :: SPic -> SPic
|
||||
{-# INLINE mirrorSPyz #-}
|
||||
mirrorSPyz = bimap (S.map (over shVs reverse) . overPosSH flipx) mirroryz
|
||||
where
|
||||
flipx (V3 x y z) = V3 (negate x) y z
|
||||
|
||||
Reference in New Issue
Block a user