-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cde95a2
commit c2fc083
Showing
17 changed files
with
328 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- local log = radiant.log.create_logger('MountainGrass') | ||
local MountainGrass = class() | ||
local Point3 = _radiant.csg.Point3 | ||
local Cube3 = _radiant.csg.Cube3 | ||
local Region3 = _radiant.csg.Region3 | ||
|
||
function MountainGrass:post_activate() | ||
local json = radiant.entities.get_json(self) | ||
self.radius = json.radius or 8 | ||
self.block_type = json.block_type or "grass" | ||
self.priority = json.priority or 10 --less = higher priority | ||
|
||
self.timer = stonehearth.calendar:set_timer('replacing rocks with grass', self.priority, function() | ||
local location = radiant.entities.get_world_grid_location(self._entity) | ||
if location and location.y > 50 then | ||
local block_type = radiant.terrain.get_block_types()[self.block_type] | ||
local cube = Cube3( | ||
location + Point3(-self.radius,-1,-self.radius), | ||
location + Point3( self.radius, 0, self.radius) | ||
) | ||
local grass_region = radiant.terrain.intersect_cube(cube) | ||
for cube in grass_region:each_cube() do | ||
radiant.terrain.add_cube(Cube3(cube.min,cube.max,block_type)) | ||
end | ||
end | ||
self.timer = nil | ||
self._entity:remove_component('swamp_goblins:mountain_grass') | ||
end) | ||
end | ||
|
||
return MountainGrass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,88 @@ | ||
{ | ||
"name": "firefly", | ||
"duration": 20000, | ||
"particle": { | ||
"lifetime": { | ||
"start": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [9000, 10000] | ||
} | ||
}, | ||
"speed": { | ||
"start": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [0.4, 0.5] | ||
} | ||
}, | ||
|
||
"color": { | ||
"start": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [ | ||
[0.4, 0.5, 0.0, 1.0], | ||
[0.0, 0.6, 0.3, 1.0] | ||
] | ||
}, | ||
"over_lifetime_a": { | ||
"kind": "CURVE", | ||
"values": [ | ||
[0.0, 0.0], [0.02, 1.0], [0.1, 1.0], [0.12, 0.0], | ||
[0.2, 0.0], [0.22, 1.0], [0.3, 1.0], [0.32, 0.0], | ||
[0.4, 0.0], [0.42, 1.0], [0.5, 1.0], [0.52, 0.0], | ||
[0.6, 0.0], [0.62, 1.0], [0.7, 1.0], [0.72, 0.0], | ||
[0.8, 0.0], [0.82, 1.0], [0.9, 1.0], [0.92, 0.0] | ||
] | ||
} | ||
}, | ||
"scale": { | ||
"start": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [0.1, 0.2] | ||
} | ||
}, | ||
"velocity": { | ||
} | ||
}, | ||
"emission": { | ||
"rate": { | ||
"kind": "CONSTANT", | ||
"values": [3] | ||
}, | ||
"origin": { | ||
"surface": "RECTANGLE", | ||
"values": [8, 8] | ||
}, | ||
"angle": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [0,360] | ||
} | ||
} | ||
"name": "firefly", | ||
"duration": 20000, | ||
"material": "materials/cubemitter.material.json", | ||
"loops": true, | ||
"emission": { | ||
"rate": { | ||
"kind": "CONSTANT", | ||
"values": [3] | ||
}, | ||
"angle": { | ||
"kind": "CONSTANT", | ||
"values": [0] | ||
}, | ||
"origin": { | ||
"surface": "SPHERE", | ||
"values": [4, 0, 360] | ||
} | ||
}, | ||
"particle": { | ||
"lifetime": { | ||
"start": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [9000, 10000] | ||
} | ||
}, | ||
"speed": { | ||
"start": { | ||
"kind": "CONSTANT", | ||
"values": [0] | ||
} | ||
}, | ||
"velocity": { | ||
"over_lifetime_x": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [-0.3, 0.3] | ||
}, | ||
"over_lifetime_y": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [-0.3, 0.3] | ||
}, | ||
"over_lifetime_z": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [-0.3, 0.3] | ||
} | ||
}, | ||
"scale": { | ||
"start": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [0.1, 0.2] | ||
} | ||
}, | ||
"color": { | ||
"start": { | ||
"kind": "RANDOM_BETWEEN", | ||
"values": [ | ||
[0.4, 0.5, 0, 1], | ||
[0, 0.6, 0.3, 1] | ||
] | ||
}, | ||
"over_lifetime_a": { | ||
"kind": "CURVE", | ||
"values": [ | ||
[0, 0], | ||
[0.02, 1], | ||
[0.1, 1], | ||
[0.12, 0], | ||
[0.2, 0], | ||
[0.22, 1], | ||
[0.3, 1], | ||
[0.32, 0], | ||
[0.4, 0], | ||
[0.42, 1], | ||
[0.5, 1], | ||
[0.52, 0], | ||
[0.6, 0], | ||
[0.62, 1], | ||
[0.7, 1], | ||
[0.72, 0], | ||
[0.8, 0], | ||
[0.82, 1], | ||
[0.9, 1], | ||
[0.92, 0] | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.