curseword bbcode censor effect
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"<message>": "This is a cool debug test!"
|
||||
"<message>": "[cuss]FUCKING HELL[/cuss]"
|
||||
}
|
@@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://cqfthyrbb8k6v"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://di368n7hi66po"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/scene-scripts/dialog_bubble.cs" id="1_xtj1q"]
|
||||
[ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/fonts/urbane-rounded-medium.otf" id="2_qrihj"]
|
||||
[ext_resource type="AudioStream" uid="uid://cg6grs5k5m33n" path="res://assets/audios/typewrite/default_tw.wav" id="2_wg62u"]
|
||||
[ext_resource type="RichTextEffect" uid="uid://0o1lbwcdjg28" path="res://src/gdscript/tool/bbcodeeffects/cuss.tres" id="3_lmnhk"]
|
||||
[ext_resource type="Texture2D" uid="uid://04pdpdvkg2s" path="res://assets/textures/dialogue/dialogue_answer_ninepatch.png" id="3_n3y1v"]
|
||||
[ext_resource type="AudioStream" uid="uid://7si4jccoofsf" path="res://assets/audios/ui/small_btn.wav" id="5_w6jq7"]
|
||||
|
||||
@@ -55,6 +56,7 @@ theme_override_fonts/normal_font = ExtResource("2_qrihj")
|
||||
theme_override_font_sizes/normal_font_size = 42
|
||||
bbcode_enabled = true
|
||||
scroll_active = false
|
||||
custom_effects = [ExtResource("3_lmnhk")]
|
||||
visible_characters_behavior = 1
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
[ext_resource type="Script" path="res://src/scene-scripts/player.cs" id="1_qehox"]
|
||||
[ext_resource type="Texture2D" uid="uid://olceowuycu8c" path="res://assets/textures/debug/dummy-player-atlas.png" id="2_yu1q5"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqfthyrbb8k6v" path="res://scenes/gui/dialog_bubble.tscn" id="3_8f573"]
|
||||
[ext_resource type="PackedScene" uid="uid://di368n7hi66po" path="res://scenes/gui/dialog_bubble.tscn" id="3_8f573"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_068kt"]
|
||||
atlas = ExtResource("2_yu1q5")
|
||||
|
33
src/gdscript/tool/bbcodeeffects/cuss.gd
Normal file
33
src/gdscript/tool/bbcodeeffects/cuss.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
@tool
|
||||
extends RichTextEffect
|
||||
|
||||
|
||||
# Syntax: [cuss][/cuss]
|
||||
var bbcode = "cuss"
|
||||
|
||||
var VOWELS : PackedInt32Array = [97,101,105,111,117,65,69,73,79,85]#a,e,i,o,u,A,E,I,O,U
|
||||
var CHARS : PackedInt32Array = [38,36,33,64,42,35,37]#&,$,!,@,*,#,%
|
||||
var SPACE : int = 32
|
||||
|
||||
var _was_space = false
|
||||
|
||||
func get_text_server():
|
||||
return TextServerManager.get_primary_interface()
|
||||
|
||||
func _process_custom_fx(char_fx):
|
||||
var c = char_fx.glyph_index
|
||||
|
||||
var vowelBool : bool = false
|
||||
for x in VOWELS:
|
||||
if char_fx.glyph_index == get_text_server().font_get_glyph_index(char_fx.font, 1, x, 0):
|
||||
vowelBool = true
|
||||
|
||||
if not _was_space and not char_fx.relative_index == 0 and not c == get_text_server().font_get_glyph_index(char_fx.font, 1, SPACE, 0):
|
||||
var t = char_fx.elapsed_time + char_fx.glyph_index * 10.2 + char_fx.relative_index * 2
|
||||
t *= 4.3
|
||||
if vowelBool or sin(t) > 0.0:
|
||||
char_fx.glyph_index = get_text_server().font_get_glyph_index(char_fx.font, 1, CHARS[int(t) % len(CHARS)], 0)
|
||||
|
||||
_was_space = c == get_text_server().font_get_glyph_index(char_fx.font, 1, SPACE, 0)
|
||||
|
||||
return true
|
7
src/gdscript/tool/bbcodeeffects/cuss.tres
Normal file
7
src/gdscript/tool/bbcodeeffects/cuss.tres
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="RichTextEffect" load_steps=2 format=3 uid="uid://0o1lbwcdjg28"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/gdscript/tool/bbcodeeffects/cuss.gd" id="1_ctc4u"]
|
||||
|
||||
[resource]
|
||||
resource_name = "cuss"
|
||||
script = ExtResource("1_ctc4u")
|
Reference in New Issue
Block a user