Compare commits

..

4 Commits

Author SHA1 Message Date
Viator-MV
35c45e70f6 Christmas map (#681)
* Update comoss.yml

* Update comoss_d.yml
2024-12-15 22:11:38 +03:00
Ed
58269bb65e Snowballs (#677)
* snowballs

* biome update

* fixes
2024-12-14 14:57:15 +03:00
Ed
d7d0977eb6 New year preparation (#674)
* garland

* presents filter

* vladimirs weather

* snowed tilebrick
2024-12-14 01:01:36 +03:00
Ed
4cea96f6eb Garland (#673)
* garland

* presents filter
2024-12-13 22:20:00 +03:00
54 changed files with 67848 additions and 49138 deletions

View File

@@ -92,6 +92,9 @@ public sealed class RandomGiftSystem : EntitySystem
var mapGridCompName = _componentFactory.GetComponentName(typeof(MapGridComponent));
var physicsCompName = _componentFactory.GetComponentName(typeof(PhysicsComponent));
if (!_prototype.TryIndex<EntityCategoryPrototype>("ForkFiltered", out var indexedFilter))
return;
foreach (var proto in _prototype.EnumeratePrototypes<EntityPrototype>())
{
if (proto.Abstract || proto.HideSpawnMenu || proto.Components.ContainsKey(mapGridCompName) || !proto.Components.ContainsKey(physicsCompName))
@@ -102,6 +105,11 @@ public sealed class RandomGiftSystem : EntitySystem
if (!proto.Components.ContainsKey(itemCompName))
continue;
//CP14 Only cp14 items
if (!proto.Categories.Contains(indexedFilter))
continue;
//CP14 end
_possibleGiftsSafe.Add(proto.ID);
}
}

View File

@@ -31,4 +31,9 @@
- files: ["parry2.ogg"]
license: "CC-BY-4.0"
copyright: 'by EminYILDIRIM of Freesound.org.'
source: "https://freesound.org/people/EminYILDIRIM/sounds/536105/"
source: "https://freesound.org/people/EminYILDIRIM/sounds/536105/"
- files: ["snowball.ogg"]
license: "CC0-1.0"
copyright: 'by bajko of Freesound.org.'
source: "https://freesound.org/people/bajko/sounds/378058/"

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,25 +2,40 @@
id: CP14DirtEffect
categories: [ HideSpawnMenu ]
components:
- type: TimedDespawn
lifetime: 2
- type: Sprite
sprite: _CP14/Effects/material_splash.rsi
drawdepth: Effects
noRot: true
layers:
- sprite: _CP14/Effects/dirt.rsi
state: dirt1
- state: dirt1
map: [ "random" ]
- type: EffectVisuals
- type: Tag
tags:
- HideContextMenu
- type: AnimationPlayer
- type: RandomSprite
available:
- random:
dirt1: ""
dirt2: ""
- type: TimedDespawn
lifetime: 2
- type: EffectVisuals
- type: Tag
tags:
- HideContextMenu
- type: AnimationPlayer
- type: entity
id: CP14SnowEffect
parent: CP14DirtEffect
categories: [ HideSpawnMenu ]
components:
- type: Sprite
layers:
- state: snow1
map: [ "random" ]
- type: RandomSprite
available:
- random:
snow1: ""
snow2: ""
- type: entity
id: CP14DustEffect

View File

@@ -83,4 +83,4 @@
- state: snow
- state: frame
- type: CP14BiomeSpawner
biome: CP14Snowland
biome: CP14SnowlandTestResult

View File

@@ -8,4 +8,25 @@
prototypes:
- CP14DirtBlock1
chance: 1
deleteSpawnerAfterSpawn: false
deleteSpawnerAfterSpawn: false
- type: EmitSoundOnSpawn
sound:
collection: CP14Digging
- type: entity
id: CP14RandomSnowLootSpawner
name: dirt spawner
parent: CP14SnowEffect
categories: [ ForkFiltered ]
components:
- type: RandomSpawner
prototypes:
- CP14Snowball
chance: 1
deleteSpawnerAfterSpawn: false
- type: EmitSoundOnSpawn
sound:
path: /Audio/_CP14/Effects/snowball.ogg
params:
variation: 0.250
volume: 15

View File

@@ -138,7 +138,7 @@
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: _CP14/Effects/dirt.rsi
sprite: _CP14/Effects/material_splash.rsi
layers:
- state: dirt1

View File

@@ -396,3 +396,83 @@
- enum.DamageStateVisualLayers.Base:
shard1: ""
shard2: ""
- type: entity
id: CP14Snowball
parent:
- BaseItem
- ItemHeftyBase
categories: [ ForkFiltered ]
name: snowball
description: A small handful of snow, handy for throwing.
components:
- type: Item
size: Tiny
- type: Sprite
sprite: _CP14/Objects/Materials/snowball.rsi
layers:
- state: ball
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.2,-0.2,0.2,0.2"
density: 30
hard: true
mask:
- ItemMask
- type: LandAtCursor
- type: CP14MeleeSelfDamage
damageToSelf:
types:
Blunt: 1 # 1 hits
- type: DamageOnHighSpeedImpact
minimumSpeed: 0.1
damage:
types:
Blunt: 3
- type: MeleeWeapon
attackRate: 1.8
wideAnimationRotation: 225
wideAnimation: CP14WeaponArcSlash
damage:
types:
Cold: 0
soundHit:
path: /Audio/_CP14/Effects/snowball.ogg
params:
variation: 0.250
volume: 15
cPAnimationLength: 0.15
- type: DamageOtherOnHit
damage:
types:
Cold: 0
- type: StaminaDamageOnCollide
damage: 5
sound:
path: /Audio/Effects/pop.ogg
params:
variation: 0.250
volume: 15
- type: Damageable
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 1
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- !type:PlaySoundBehavior
sound:
path: /Audio/_CP14/Effects/snowball.ogg
params:
variation: 0.250
volume: 15
- !type:SpawnEntitiesBehavior
spawn:
CP14SnowEffect:
min: 1
max: 1

View File

@@ -0,0 +1,108 @@
- type: entity
id: CP14WallmauntGarlandBase
abstract: true
parent:
- CP14BaseWallmount
categories: [ ForkFiltered ]
name: crystals garland
description: Carefully crafted sparkling crystals tied on a string. For a festive attitude.
components:
- type: Sprite
sprite: _CP14/Structures/Decoration/garland_wallmount.rsi
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Glass
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 10
behaviors:
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
- !type:SpawnEntitiesBehavior
spawn:
CP14QuartzShard:
min: 0
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: PointLight
radius: 1.5
energy: 1
- type: MeleeSound
soundGroups:
Brute:
collection: GlassSmash
- type: entity
parent: CP14WallmauntGarlandBase
id: CP14WallmountGarlandRed
suffix: Red
components:
- type: Sprite
layers:
- state: string
- state: crystals
shader: unshaded
color: "#ff3d0b"
- type: PointLight
color: "#ff3d0b"
- type: entity
parent: CP14WallmauntGarlandBase
id: CP14WallmountGarlandYellow
suffix: Yellow
components:
- type: Sprite
layers:
- state: string
- state: crystals
shader: unshaded
color: "#ffe269"
- type: PointLight
color: "#ffe269"
- type: entity
parent: CP14WallmauntGarlandBase
id: CP14WallmountGarlandGreen
suffix: Green
components:
- type: Sprite
layers:
- state: string
- state: crystals
shader: unshaded
color: "#30be81"
- type: PointLight
color: "#30be81"
- type: entity
parent: CP14WallmauntGarlandBase
id: CP14WallmountGarlandPurple
suffix: Purple
components:
- type: Sprite
layers:
- state: string
- state: crystals
shader: unshaded
color: "#a878d1"
- type: PointLight
color: "#a878d1"
- type: entity
parent: CP14WallmauntGarlandBase
id: CP14WallmountGarlandBlue
suffix: Blue
components:
- type: Sprite
layers:
- state: string
- state: crystals
shader: unshaded
color: "#5eabeb"
- type: PointLight
color: "#5eabeb"

View File

@@ -44,4 +44,40 @@
footstepSoundCollection:
collection: FootstepSnow
params:
volume: 8
volume: 8
- type: Damageable
- type: Destructible
thresholds:
- trigger:
!type:DamageTypeTrigger
damageType: Heat
damage: 20
behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- trigger:
!type:DamageTrigger
damage: 40
behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- !type:SpawnEntitiesBehavior
spawn:
CP14Snowball:
min: 1
max: 3
- !type:SpawnEntitiesBehavior
spawn:
CP14SnowEffect:
min: 1
max: 2
- type: MeleeSound
soundGroups:
Brute:
path: /Audio/_CP14/Effects/snowball.ogg
params:
variation: 0.250
volume: 15
- type: Construction
graph: CP14Snowdrift
node: start

View File

@@ -96,6 +96,52 @@
graph: CP14WallDirt
node: WallDirt
- type: entity
id: CP14WallSnow
name: snow wall
parent: CP14BaseWall
description: A tall pile of snow. Can a house be built from it?
components:
- type: Sprite
sprite: _CP14/Structures/Walls/Natural/snow_wall.rsi
- type: Icon
sprite: _CP14/Structures/Walls/Natural/snow_wall.rsi
- type: IconSmooth
base: wall
- type: Damageable
damageContainer: StructuralInorganic
damageModifierSet: Rock
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 150
behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- trigger:
!type:DamageTrigger
damage: 50
behaviors:
- !type:PlaySoundBehavior
sound:
path: /Audio/_CP14/Effects/snowball.ogg
params:
variation: 0.250
volume: 15
- !type:SpawnEntitiesBehavior
spawn:
CP14Snowball:
min: 3
max: 5
- !type:SpawnEntitiesBehavior
spawn:
CP14SnowEffect:
min: 2
max: 3
- !type:DoActsBehavior
acts: ["Destruction"]
- type: entity
id: CP14WallStoneCopperOre
suffix: copper ore

View File

@@ -16,6 +16,10 @@
- state: crystal1
map: ["random"]
shader: unshaded
- type: MeleeSound
soundGroups:
Brute:
collection: GlassSmash
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Glass

View File

@@ -36,20 +36,6 @@
layers:
- !type:BiomeMetaLayer
template: CP14SnowFill
- !type:BiomeEntityLayer # More Trees
threshold: 0.4
noise:
seed: 4
noiseType: OpenSimplex2
fractalType: FBm
frequency: 0.7
allowedTiles:
- CP14FloorSnow
- CP14FloorSnowDeep
- CP14FloorSnowDeepDeep
entities:
- CP14FloraTreeSnow
#- CP14FloraTreeGreenLarge
- !type:BiomeEntityLayer # Snowdrifts
threshold: 0.3
noise:
@@ -67,4 +53,92 @@
- CP14FloorSnowDeep
- CP14FloorSnowDeepDeep
entities:
- CP14Snowdrift
- CP14Snowdrift
- !type:BiomeEntityLayer # Rare Trees
threshold: 0.8
noise:
seed: 0
noiseType: OpenSimplex2
fractalType: FBm
frequency: 2
allowedTiles:
- CP14FloorSnow
- CP14FloorSnowDeep
- CP14FloorSnowDeepDeep
entities:
- CP14FloraTreeSnow
#- CP14FloraTreeGreenLarge
# Подбиомы
# Лес
- type: biomeTemplate
id: CP14SnowlandForest
layers:
- !type:BiomeMetaLayer
template: CP14Snowland
- !type:BiomeEntityLayer # More Trees
threshold: 0.2
noise:
seed: 4
noiseType: OpenSimplex2
fractalType: FBm
frequency: 2
allowedTiles:
- CP14FloorSnow
- CP14FloorSnowDeep
- CP14FloorSnowDeepDeep
entities:
- CP14FloraTreeSnow
#- CP14FloraTreeGreenLarge
# Холмы
- type: biomeTemplate
id: CP14SnowlandHills # Холмы
layers:
- !type:BiomeMetaLayer
template: CP14SnowlandForest
- !type:BiomeTileLayer
tile: CP14FloorBase
invert: true
threshold: 0.5
noise:
seed: 6
noiseType: OpenSimplex2
frequency: 0.03
lacunarity: 2
fractalType: Ridged
octaves: 1
cellularDistanceFunction: Euclidean
cellularReturnType: Distance
cellularJitterModifier: 0.7
domainWarpType: OpenSimplex2Reduced
domainWarpAmp: 285
- !type:BiomeEntityLayer # Walls
allowedTiles:
- CP14FloorBase
threshold: -1.0
entities:
- CP14WallSnow
- type: biomeTemplate
id: CP14SnowlandTestResult
layers:
- !type:BiomeMetaLayer
template: CP14Snowland
- !type:BiomeMetaLayer
template: CP14SnowlandForest
threshold: 0.2
noise:
seed: 18
frequency: 0.02
fractalType: None
- !type:BiomeMetaLayer
template: CP14SnowlandHills
threshold: 0.4
noise:
seed: 14
frequency: 0.02
fractalType: None

View File

@@ -0,0 +1,22 @@
- type: constructionGraph
id: CP14Snowdrift
start: start
graph:
- node: start
entity: CP14Snowdrift
edges:
- to: CP14Snowdrift
steps:
- tool: CP14Digging
doAfter: 1
completed:
- !type:SpawnPrototype
prototype: CP14Snowball
amount: 3
- !type:SpawnPrototype
prototype: CP14SnowEffect
amount: 1
- !type:PlaySound
sound: /Audio/_CP14/Effects/snowball.ogg
- !type:DeleteEntity {}
- node: CP14Snowdrift

View File

@@ -197,7 +197,7 @@
West: /Textures/_CP14/Tiles/SnowDeepDeep/double_edge_W.png
baseTurf: CP14FloorDirt
deconstructTools: [ CP14Digging ]
itemDrop: CP14RandomDirtLootSpawner
itemDrop: CP14RandomSnowLootSpawner
isSubfloor: false
footstepSounds:
collection: FootstepSnow
@@ -228,9 +228,9 @@
East: /Textures/_CP14/Tiles/SnowDeep/double_edge_E.png
North: /Textures/_CP14/Tiles/SnowDeep/double_edge_N.png
West: /Textures/_CP14/Tiles/SnowDeep/double_edge_W.png
baseTurf: CP14FloorDirt
baseTurf: CP14FloorSnowDeepDeep
deconstructTools: [ CP14Digging ]
itemDrop: CP14RandomDirtLootSpawner
itemDrop: CP14RandomSnowLootSpawner
isSubfloor: false
footstepSounds:
collection: FootstepSnow
@@ -261,9 +261,9 @@
East: /Textures/_CP14/Tiles/Snow/double_edge_E.png
North: /Textures/_CP14/Tiles/Snow/double_edge_N.png
West: /Textures/_CP14/Tiles/Snow/double_edge_W.png
baseTurf: CP14FloorDirt
baseTurf: CP14FloorSnowDeep
deconstructTools: [ CP14Digging ]
itemDrop: CP14RandomDirtLootSpawner
itemDrop: CP14RandomSnowLootSpawner
isSubfloor: false
footstepSounds:
collection: FootstepSnow

View File

@@ -60,6 +60,39 @@
heatCapacity: 10000
weather: true
- type: tile
editorHidden: false
id: CP14FloorStonebricksSnowed
name: cp14-tiles-stonebricks
sprite: /Textures/_CP14/Tiles/Stonebricks/snowstonebricks.png
variants: 9
placementVariants:
- 1.0
- 1.0
- 1.0
- 1.0
- 1.0
- 1.0
- 1.0
- 1.0
- 1.0
edgeSpritePriority: 101
edgeSprites:
SouthEast: /Textures/_CP14/Tiles/Stonebricks/single_edge_SE.png
NorthEast: /Textures/_CP14/Tiles/Stonebricks/single_edge_NE.png
NorthWest: /Textures/_CP14/Tiles/Stonebricks/single_edge_NW.png
SouthWest: /Textures/_CP14/Tiles/Stonebricks/single_edge_SW.png
South: /Textures/_CP14/Tiles/Stonebricks/double_edge_S.png
East: /Textures/_CP14/Tiles/Stonebricks/double_edge_E.png
North: /Textures/_CP14/Tiles/Stonebricks/double_edge_N.png
West: /Textures/_CP14/Tiles/Stonebricks/double_edge_W.png
baseTurf: CP14FloorFoundation
isSubfloor: false
footstepSounds:
collection: FootstepAsteroid
heatCapacity: 10000
weather: true
- type: tile
editorHidden: false
id: CP14FloorStonebricksSmallCarved1

View File

@@ -28,3 +28,36 @@
sprite:
sprite: /Textures/_CP14/Effects/parallax.rsi
state: noise
- type: weather
id: CP14SnowLight
sprite:
sprite: /Textures/_CP14/Effects/weather.rsi
state: snowfall_light
sound:
path: /Audio/Effects/Weather/snowstorm_weak.ogg
params:
loop: true
volume: -6
- type: weather
id: CP14SnowMedium
sprite:
sprite: /Textures/_CP14/Effects/weather.rsi
state: snowfall_med
sound:
path: /Audio/Effects/Weather/snowstorm_weak.ogg
params:
loop: true
volume: -6
- type: weather
id: CP14SnowHeavy
sprite:
sprite: /Textures/_CP14/Effects/weather.rsi
state: snowfall_heavy
sound:
path: /Audio/Effects/Weather/snowstorm.ogg
params:
loop: true
volume: -6

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -40,6 +40,40 @@
2
]
]
},
{
"name": "snow1",
"delays": [
[
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
2
]
]
},
{
"name": "snow2",
"delays": [
[
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
2
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -1,6 +1,6 @@
{
"version": 1,
"copyright": "Taken from https://github.com/Citadel-Station-13/Citadel-Station-13-RP/tree/5781addfa1193c2811408f64d15176139395d670 and edited by vladimir.s (Discord)",
"copyright": "Taken from https://github.com/Citadel-Station-13/Citadel-Station-13-RP/tree/5781addfa1193c2811408f64d15176139395d670 and edited by vladimir.s (Discord). Snowfalls by vladimir.s",
"license": "CC-BY-SA-3.0",
"size": {
"x": 32,
@@ -44,6 +44,63 @@
0.03
]
]
},
{
"name": "snowfall_light",
"delays": [
[
0.11,
0.11,
0.11,
0.11,
0.11,
0.11,
0.11,
0.11,
0.11,
0.11,
0.11,
0.11
]
]
},
{
"name": "snowfall_med",
"delays": [
[
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1
]
]
},
{
"name": "snowfall_heavy",
"delays": [
[
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View File

@@ -0,0 +1,14 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CLA",
"copyright": "Created by TheShuEd (Github)",
"states": [
{
"name": "ball"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

View File

@@ -0,0 +1,19 @@
{
"version": 1,
"license": "CLA",
"copyright": "By TheShuEd",
"size": {
"x": 32,
"y": 96
},
"states": [
{
"name": "string",
"directions": 4
},
{
"name": "crystals",
"directions": 4
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,46 @@
{
"version": 1,
"size": {
"x": 32,
"y": 64
},
"license": "CLA",
"copyright": "Created by TheShuEd (Discord) ",
"states": [
{
"name": "wall0",
"directions": 4
},
{
"name": "wall1",
"directions": 4
},
{
"name": "wall2",
"directions": 4
},
{
"name": "wall3",
"directions": 4
},
{
"name": "wall4",
"directions": 4
},
{
"name": "wall5",
"directions": 4
},
{
"name": "wall6",
"directions": 4
},
{
"name": "wall7",
"directions": 4
},
{
"name": "full"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

View File

@@ -0,0 +1,13 @@
- files:
- snowstonebricks.png
- double_edge_E.png
- double_edge_N.png
- double_edge_S.png
- double_edge_W.png
- single_edge_NE.png
- single_edge_NW.png
- single_edge_SE.png
- single_edge_SW.png
license: "CC-BY-SA-3.0"
copyright: "Created by TheShuEd, midified by vladimir.s "
source: "https://github.com/crystallpunk-14/crystall-punk-14/pull/290"

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -1,36 +0,0 @@
# Color Replcaer
## The right version of python: 3.10+
## Settings
### Pallets in - pallets.py
### Main settings in - main.py
## Dependencies Install
in console
```bash
pip install -r requirements.txt
```
or just run
```bash
install_packages.bat
```
## Run
in console
```bash
python main.py
```
or just run
```bash
run.bat
```

View File

@@ -1,2 +0,0 @@
from .replacer import ColorReplacer
from .rgb_container import RGBContainer, RGBPallet

View File

@@ -1,44 +0,0 @@
from PIL import Image
import os
from color_replacer.rgb_container import RGBPallet
class ColorReplacer:
def __init__(self, replace_from: str, replace_to: str,
replace_from_pallet: RGBPallet, replace_to_pallet: RGBPallet):
self.replace_from = replace_from
self.replace_to = replace_to
self.replace_from_pallet = replace_from_pallet
self.replace_to_pallet = replace_to_pallet
self.pallets = self._create_color_map()
def _create_color_map(self) -> dict[tuple, tuple]:
color_map = {}
replace_to_pallet_len = len(self.replace_to_pallet.pallet)
for i in range(len(self.replace_from_pallet.pallet)):
if i == replace_to_pallet_len:
break
replace_from_pallet_tuple = tuple(self.replace_from_pallet.pallet[i].rgba_list)
color_map[replace_from_pallet_tuple] = tuple(self.replace_to_pallet.pallet[i].rgba_list)
return color_map
def _init_dirs(self):
if not os.path.exists(self.replace_to):
os.mkdir(self.replace_to)
return os.listdir(self.replace_from)
def replace_colors(self):
sprites = self._init_dirs()
for sprite in sprites:
if not sprite.endswith("png"):
continue
path = f"{self.replace_from}/{sprite}"
image = Image.open(path).convert("RGBA")
pixels = list(image.getdata())
new_pixels = [(self.pallets.get(pixel, pixel)) for pixel in pixels]
image.putdata(new_pixels)
image.save(f"{self.replace_to}/{sprite}")

View File

@@ -1,93 +0,0 @@
class InvalidRGBColor(Exception):
pass
class InvalidHexLen(Exception):
pass
class RGBContainer:
def __init__(self, red: int = 0, green: int = 0, blue: int = 0, alpha: int = 255):
self._red = self._check_channel_number(red)
self._green = self._check_channel_number(green)
self._blue = self._check_channel_number(blue)
self._alpha = self._check_channel_number(alpha)
self.rgba_list = [red, green, blue, alpha]
@classmethod
def from_hex(cls, hex_color: str):
hex_color = hex_color.lstrip('#')
hex_len = len(hex_color)
if hex_len not in (6, 8):
raise InvalidHexLen("HEX string length must be 6 or 8 characters.")
if hex_len == 6:
hex_color += 'FF'
red = int(hex_color[0:2], 16)
green = int(hex_color[2:4], 16)
blue = int(hex_color[4:6], 16)
alpha = int(hex_color[6:8], 16)
return RGBContainer(red, green, blue, alpha)
@staticmethod
def _check_channel_number(value: int):
if not 0 <= value <= 255:
raise InvalidRGBColor("Channel number must be in the range from 0 to 255")
return value
def __repr__(self):
return f"({self._red}, {self._green}, {self._blue}, {self._alpha})"
@property
def red(self):
return self._red
@red.setter
def red(self, new_red: int):
self._red = self._check_channel_number(new_red)
self.rgba_list[0] = new_red
@property
def green(self):
return self._green
@green.setter
def green(self, new_green: int):
self._green = self._check_channel_number(new_green)
self.rgba_list[1] = new_green
@property
def blue(self):
return self._blue
@blue.setter
def blue(self, new_blue: int):
self._blue = self._check_channel_number(new_blue)
self.rgba_list[2] = new_blue
@property
def alpha(self):
return self._alpha
@alpha.setter
def alpha(self, new_alpha: int):
self._alpha = self._check_channel_number(new_alpha)
self.rgba_list[3] = new_alpha
class RGBPallet:
def __init__(self, pallet: list[RGBContainer] | None = None):
self._pallet = pallet if pallet else []
@property
def pallet(self):
return self._pallet
def create_new_rgb_container(self, red: int = 0, green: int = 0, blue: int = 0, alpha: int = 255):
self._pallet.append(RGBContainer(red, green, blue, alpha))
def create_new_rgb_container_from_hex(self, hex_color: str):
self._pallet.append(RGBContainer.from_hex(hex_color))

View File

@@ -1,3 +0,0 @@
@echo off
pip install -r requirements.txt
pause

View File

@@ -1,13 +0,0 @@
from color_replacer import ColorReplacer
from pallets import *
# Del .rsi from dir name!
REPLACE_FROM = ""
REPLACE_TO = ""
REPLACE_FROM_PALLET = None # Chanhe None to your pallet!
REPLACE_TO_PALLET = None # Change None to your pallet!
replacer = ColorReplacer(REPLACE_FROM, REPLACE_TO, REPLACE_FROM_PALLET, REPLACE_TO_PALLET)
replacer.replace_colors()

View File

@@ -1,48 +0,0 @@
from color_replacer import RGBPallet
# Цвета в палитрах указаны от тёмных к более светлым.
# Colours in the palettes are listed from darker to lighter.
# Краткая Инструкция:
# Создать новую палитру можно через RGBPallet()
# Добавить цвета можно через rgba или hex
# Через rgba - обьект_палитры.create_new_rgb_container(красный, зелёный, синий, альфа канал)
# Через hex = обьект_палитры.create_new_rgb_container_from_hex(hex)
# Quick Instructions:
# Create a new palette using RGBPallet()
# Add colours via rgba or hex
# With rgba - palette object.create_new_rgb_container(red, green, blue, alpha channel)
# With hex = palette_object.create_new_rgb_container_from_hex(hex)
modular_copper_pallet = RGBPallet()
modular_copper_pallet.create_new_rgb_container_from_hex("#2f2825")
modular_copper_pallet.create_new_rgb_container_from_hex("#55433d")
modular_copper_pallet.create_new_rgb_container_from_hex("#754d38")
modular_copper_pallet.create_new_rgb_container_from_hex("#9a5e22")
modular_copper_pallet.create_new_rgb_container_from_hex("#b36510")
modular_copper_pallet.create_new_rgb_container_from_hex("#c57d07")
modular_gold_pallet = RGBPallet()
modular_gold_pallet.create_new_rgb_container_from_hex("#572116")
modular_gold_pallet.create_new_rgb_container_from_hex("#74371f")
modular_gold_pallet.create_new_rgb_container_from_hex("#b05b2c")
modular_gold_pallet.create_new_rgb_container_from_hex("#e88a36")
modular_gold_pallet.create_new_rgb_container_from_hex("#f1a94b")
modular_gold_pallet.create_new_rgb_container_from_hex("#ffe269")
modular_iron_pallet = RGBPallet()
modular_iron_pallet.create_new_rgb_container_from_hex("#282935")
modular_iron_pallet.create_new_rgb_container_from_hex("#3a3b4d")
modular_iron_pallet.create_new_rgb_container_from_hex("#5d5c71")
modular_iron_pallet.create_new_rgb_container_from_hex("#88899a")
modular_iron_pallet.create_new_rgb_container_from_hex("#b6b9cb")
modular_iron_pallet.create_new_rgb_container_from_hex("#e1e3e7")
mithril_pallet = RGBPallet()
mithril_pallet.create_new_rgb_container_from_hex("#052441")
mithril_pallet.create_new_rgb_container_from_hex("#024b76")
mithril_pallet.create_new_rgb_container_from_hex("#006c83")
mithril_pallet.create_new_rgb_container_from_hex("#1d8d7e")
mithril_pallet.create_new_rgb_container_from_hex("#52b695")
mithril_pallet.create_new_rgb_container_from_hex("#45d2a4")

View File

@@ -1 +0,0 @@
pillow~=11.0.0

View File

@@ -1,3 +0,0 @@
@echo off
python main.py
pause